问:
Get values from nested hash
I have this Hash that I use store values and if the values are not found to get default values:

```<code>AMOUNT = {
  EUR: {
    eps:         { AT: 1_00 },
    safetypay:   { PE: 15_000_00, CR: 5_000_00, BE: 15_000_00, },
    przelewy24:  5_00,
    qiwi:        5_00,
    bcmc:        { AT: 1_00, BE: 1_00 },
    giropay:     { DE: 1_00 },
    ideal:       { NL: 1_00 },
    mybank:      { IT: 1_00, FR: 1_00 },
  },
  CZK: {
    trustpay:   { CZ: 20_00 }
  }
}.with_indifferent_access
</code>```

I would like to get values based on the keys so I tried this:

```<code>def amount_for(payment_type, country, currency)
  payment_amount = AMOUNT.dig(currency, payment_type, country) if payment_type.is_a?(Hash)
  payment_amount ||= AMOUNT.dig(currency, payment_type)
  payment_amount ||= 1
end
</code>```

But I get for result not number but {"AT"=>100, "BE"=>100}. If I remove the check if payment_type.is_a?(Hash) I get exception Integer does not have #dig method (RuntimeError)

Do you know how I can solve this issue?

答:
payment_type will be e.g. "AT" - it's the argument you pass into your function, it will never be a Hash.

This rewrite should do what you want:

```<code>def amount_for(payment_type, country = nil, currency = nil)
  path = [payment_type, country, currency].compact
  obj = AMOUNT
  obj = obj[path.shift] while Hash === obj && !path.empty?
  return obj || 1
end
</code>```

Alternately, this is rather similar to the code you wrote:

```<code>def amount_for(payment_type, country = nil, currency = nil)
  tmp = AMOUNT.dig(payment_type, country, currency)
  return tmp if tmp
  tmp = AMOUNT.dig(payment_type, country)
  return tmp if tmp
  tmp = AMOUNT.dig(payment_type)
  return tmp if tmp
  return 1
end
</code>```

Title: Get values from nested hash

Body:
I have this Hash that I use store values and if the values are not found to get default values:

AMOUNT = {
  EUR: {
    eps:         { AT: 1_00 },
    safetypay:   { PE: 15_000_00, CR: 5_000_00, BE: 15_000_00, },
    przelewy24:  5_00,
    qiwi:        5_00,
    bcmc:        { AT: 1_00, BE: 1_00 },
    giropay:     { DE: 1_00 },
    ideal:       { NL: 1_00 },
    mybank:      { IT: 1_00, FR: 1_00 },
  },
  CZK: {
    trustpay:   { CZ: 20_00 }
  }
}.with_indifferent_access

I would like to get values based on the keys so I tried this:

def amount_for(payment_type, country, currency)
  payment_amount = AMOUNT.dig(currency, payment_type, country) if payment_type.is_a?(Hash)
  payment_amount ||= AMOUNT.dig(currency, payment_type)
  payment_amount ||= 1
end

But I get for result not number but {"AT"=>100, "BE"=>100}. If I remove the check if payment_type.is_a?(Hash) I get exception Integer does not have #dig method (RuntimeError)

Do you know how I can solve this issue?

Body:
payment_type will be e.g. "AT" - it's the argument you pass into your function, it will never be a Hash.

This rewrite should do what you want:

def amount_for(payment_type, country = nil, currency = nil)
  path = [payment_type, country, currency].compact
  obj = AMOUNT
  obj = obj[path.shift] while Hash === obj && !path.empty?
  return obj || 1
end

Alternately, this is rather similar to the code you wrote:

def amount_for(payment_type, country = nil, currency = nil)
  tmp = AMOUNT.dig(payment_type, country, currency)
  return tmp if tmp
  tmp = AMOUNT.dig(payment_type, country)
  return tmp if tmp
  tmp = AMOUNT.dig(payment_type)
  return tmp if tmp
  return 1
end


来源: stackexchange

问:
Is there a "quick documentation" shortcut for VS code?
In some IDEs, Intellij IDEA for example, pressing control + j will display the docstring like this question. How do I get similar functionality for VS code?

答:
There are 2 ways in Visual Studio Code (version 1.34.0) to show quick documentation:

short version -> mouse hover elements which you want to lookup

long version -> after short version appears, press 'ctrl' key twice (if you press 'ctrl' key once, the long version documentation appears as long as you hold the 'ctrl' key)

ContentLicense: CC BY-SA 3.0

ContentLicense: CC BY-SA 4.0


问:
Xamp on fedora fails to start
I installed xampp and its been working fine, until I started getting the following error whenever I tried to start xampp:

XAMPP is currently only availably as 32 bit application. Please use a 32 bit compatibility librar
  y for your system.

After commenting the lines of code in /opt/lampp/lampp that referenced this error I now get a new error when launching xampp with /opt/lampp/lampp start:

```<code>Starting XAMPP for Linux 7.2.3-0...
XAMPP: Starting Apache...fail.
httpd: Syntax error on line 522 of /opt/lampp/etc/httpd.conf: Syntax error on line 10 of /opt/lam
pp/etc/extra/httpd-xampp.conf: Cannot load modules/libphp7.so into server: libnsl.so.1: cannot op
en shared object file: No such file or directory
XAMPP: Starting MySQL...ok.
XAMPP: Starting ProFTPD...ok.
</code>```

I have php-7.2.3 installed in /opt/lampp/bin and apache and everything else was working before. How do I get Apache to launch?

答:
it seems you're missing the libnsl, install it through this command:

# sudo dnf install libnsl

In case this doesn't work you can then download it manually:

```<code>visit https://pkgs.org/

in the search box (pkgs.org of course) type libnsl.so.1 and choose the appropriate OS. The version shown might be higher e.g libnsl-2.28-9.fc29.x86_64.rpm, but it doesn't matter, the file needed is also included in this very package.

in the terminal, navigate to the directory where the .rpm was downloaded.

then type the following command to install it:
</code>```

# sudo rpm libnsl-2.XX-X.fc29.x86_64.rpm

Upon completion everything should be working fine.

Title: Xamp on fedora fails to start

Body:
I installed xampp and its been working fine, until I started getting the following error whenever I tried to start xampp:

XAMPP is currently only availably as 32 bit application. Please use a 32 bit compatibility librar
  y for your system.

After commenting the lines of code in /opt/lampp/lampp that referenced this error I now get a new error when launching xampp with /opt/lampp/lampp start:

Starting XAMPP for Linux 7.2.3-0...
XAMPP: Starting Apache...fail.
httpd: Syntax error on line 522 of /opt/lampp/etc/httpd.conf: Syntax error on line 10 of /opt/lam
pp/etc/extra/httpd-xampp.conf: Cannot load modules/libphp7.so into server: libnsl.so.1: cannot op
en shared object file: No such file or directory
XAMPP: Starting MySQL...ok.
XAMPP: Starting ProFTPD...ok.

I have php-7.2.3 installed in /opt/lampp/bin and apache and everything else was working before. How do I get Apache to launch?

Body:
it seems you're missing the libnsl, install it through this command:

# sudo dnf install libnsl

In case this doesn't work you can then download it manually:

visit https://pkgs.org/

in the search box (pkgs.org of course) type libnsl.so.1 and choose the appropriate OS. The version shown might be higher e.g libnsl-2.28-9.fc29.x86_64.rpm, but it doesn't matter, the file needed is also included in this very package.

in the terminal, navigate to the directory where the .rpm was downloaded.

then type the following command to install it:

# sudo rpm libnsl-2.XX-X.fc29.x86_64.rpm

Upon completion everything should be working fine.


问:
Tablesorter does not sanitize spaces when filtering, PHP syntax error?
Context :
When I use a PHP echo <?= &var ?> in HTML, it causes white space in my HTML element.
I have already tried to modify the file with another IDE to be sure that it is not an issue of indents but I have the same result. Same result on Chrome or Firefox...

Problem :
The filter of the plugin tablesorter also filters the white spaces and that does not return me the expected result. It works if I manually remove spaces

Question :
Is this a PHP syntax error or something else?

My PHP code :

```<code><td class="hidden-sm hidden-xs date">
    <?php if ($approval['STACODEM'] == '200'):?>
    <span data-toggle="popover" data-placement="top" data-trigger="hover focus" data-container="body" data-content="<?= $imgDuesDaysPopover ?>">
        <img src="<?= $imgDueDays ?>" alt="" name="imgDueDays"/>
    </span>
    <?php endif ?>
    <?= $dueDate ?>
</td>
</code>```

In the Chrome viewer :

The line with a date :

If I filter, no results found :

答:
Thanks to Ozan Kurt, I have stored everything in a variable so the code remains readable.</p>

```<code><?php
    $html = '';
    if ($approval['STACODEM'] == '200') {
        $html .= '<span data-toggle="popover" data-placement="top" data-trigger="hover focus" data-container="body" data-content="' . $imgDuesDaysPopover . '">';
        $html .= '<img src="' . $imgDueDays . '" alt="" name="imgDueDays"/>';
        $html .= '</span>';
    }
    $html .= $dueDate;
?>
<td class="hidden-sm hidden-xs date"><?=$html?></td>
</code>```

Body:
Context :
When I use a PHP echo <?= &var ?> in HTML, it causes white space in my HTML element.
I have already tried to modify the file with another IDE to be sure that it is not an issue of indents but I have the same result. Same result on Chrome or Firefox...

Problem :
The filter of the plugin tablesorter also filters the white spaces and that does not return me the expected result. It works if I manually remove spaces

Question :
Is this a PHP syntax error or something else?

My PHP code :

    <?php if ($approval['STACODEM'] == '200'):?>
    <span data-toggle="popover" data-placement="top" data-trigger="hover focus" data-container="body" data-content="<?= $imgDuesDaysPopover ?>">
        <img src="<?= $imgDueDays ?>" alt="" name="imgDueDays"/>

    <?php endif ?>
    <?= $dueDate ?>

In the Chrome viewer :

The line with a date :

If I filter, no results found :

Body:
Thanks to Ozan Kurt, I have stored everything in a variable so the code remains readable.

<?php
    $html = '';
    if ($approval['STACODEM'] == '200') {
        $html .= '<span data-toggle="popover" data-placement="top" data-trigger="hover focus" data-container="body" data-content="' . $imgDuesDaysPopover . '">';
        $html .= '<img src="' . $imgDueDays . '" alt="" name="imgDueDays"/>';
        $html .= '</span>';
    }
    $html .= $dueDate;
?>
<td class="hidden-sm hidden-xs date"><?=$html?></td>


问:
Remove row having any value 0
I have a dataframe having two columns "Service" and "Value". I want to remove all the rows having "0" under value column.

```<code>service    value

abc         10
def          0
ghi          0
xyz          5
</code>```

I want my dataframe looks like

```<code>service    value

abc         10
xyz          5
</code>```

I tried the following

```<code>df = df[(df != 0).all(1)]

df = pd.DataFrame(list(result.items()),columns=['service', 'value'])
df = df[(df != 0).all(1)]
</code>```

For small Dataframe having 6-7 rows it's working fine but in another Dataframe having 125 rows I am getting the following error.

Illegal instruction

PS:  I checked all the values under "value" column and these are numbers.

答:
You can use the drop function combined with a condition :

```<code>df = pd.DataFrame(
{'service': ['abc', 'def', 'ghi', 'xyz'],
'value': [10,0,0,5]})
df.drop(df[df.value==0].index)
</code>```

Out :

```<code>service value
0   abc 10
3   xyz 5
</code>```

Title: Remove row having any value 0

Body:
I have a dataframe having two columns "Service" and "Value". I want to remove all the rows having "0" under value column.

service    value

abc         10
def          0
ghi          0
xyz          5

I want my dataframe looks like

service    value

abc         10
xyz          5

I tried the following

df = df[(df != 0).all(1)]

df = pd.DataFrame(list(result.items()),columns=['service', 'value'])
df = df[(df != 0).all(1)]

For small Dataframe having 6-7 rows it's working fine but in another Dataframe having 125 rows I am getting the following error.

Illegal instruction

PS:  I checked all the values under "value" column and these are numbers.

Body:
You can use the drop function combined with a condition :

df = pd.DataFrame(
{'service': ['abc', 'def', 'ghi', 'xyz'],
'value': [10,0,0,5]})
df.drop(df[df.value==0].index)

Out :

service value
0   abc 10
3   xyz 5


问:
How to convert a recursive array into a string using PHP?
I have an array with nested arrays inside that I need to convert into a string with a given format.

This is for a PHP website. I get the information from a database, it comes as an array, and I need to pass it to charts.js so that I can plot it.

This is the varDump I get when I query the DB:

```<code>array(4) { [0]=> array(2) { ["date"]=> string(19) "2019-05-19 00:00:00" ["price"]=> string(3) "120" } [1]=> array(2) { ["date"]=> string(19) "2019-05-12 00:00:00" ["price"]=> string(3) "100" } [2]=> array(2) { ["date"]=> string(19) "2019-05-05 00:00:00" ["price"]=> string(3) "120" } [3]=> array(2) { ["date"]=> string(19) "2019-04-28 00:00:00" ["price"]=> string(3) "110" } }
</code>```

This is what I would need as a result in a text string:

```<code>data: [{
    x: 2019-05-19 00:00:00,
    y: 120
}, {
    t: 2019-05-12 00:00:00,
    y: 100
}, {
    t: 2019-05-05 00:00:00,
    y: 120
}, {
    t: 2019-04-28 00:00:00,
    y: 110
}]
</code>```

答:
Just loop through the array and make a new one, and then json_encode it.

```<code>$data = [];
foreach ($rows as $row) {
    $data['x'] = $row['date'];
    $data['y'] = $row['price'];
}

json_encode($data);
</code>```

Body:
I have an array with nested arrays inside that I need to convert into a string with a given format.

This is for a PHP website. I get the information from a database, it comes as an array, and I need to pass it to charts.js so that I can plot it.

This is the varDump I get when I query the DB:

array(4) { [0]=> array(2) { ["date"]=> string(19) "2019-05-19 00:00:00" ["price"]=> string(3) "120" } [1]=> array(2) { ["date"]=> string(19) "2019-05-12 00:00:00" ["price"]=> string(3) "100" } [2]=> array(2) { ["date"]=> string(19) "2019-05-05 00:00:00" ["price"]=> string(3) "120" } [3]=> array(2) { ["date"]=> string(19) "2019-04-28 00:00:00" ["price"]=> string(3) "110" } }

This is what I would need as a result in a text string:

data: [{
    x: 2019-05-19 00:00:00,
    y: 120
}, {
    t: 2019-05-12 00:00:00,
    y: 100
}, {
    t: 2019-05-05 00:00:00,
    y: 120
}, {
    t: 2019-04-28 00:00:00,
    y: 110
}]

Body:
Just loop through the array and make a new one, and then json_encode it.

$data = [];
foreach ($rows as $row) {
    $data['x'] = $row['date'];
    $data['y'] = $row['price'];
}

json_encode($data);


问:
ImageMagick thumbnail not viewable on some browsers
We are using the open source image manipulation tool ImageMagick to take thumbnails of various files. We thought things were running pretty smoothly with all this, until we realized that some browsers (namely Internet Explorer 8 and Chrome) were unable to display the JPEG files.

I can only assume that the output of the ImageMagick conversions are not web safe JPEGs. Why is this the case, and can it be fixed at all?

Incidentally, we are using the command line tool convert and we are using these parameters:

```<code>convert -thumbnail 150x fileToThumb outputPath
</code>```

EDIT:

```<code>Image: 50afd2b1-e42c-4e90-9244-9c5a00c1933d.jpg
  Format: JPEG (Joint Photographic Experts Group JFIF format)
  Class: DirectClass
  Geometry: 150x212+0+0
  Resolution: 72x72
  Print size: 2.08333x2.94444
  Units: PixelsPerInch
  Type: ColorSeparation
  Endianess: Undefined
  Colorspace: CMYK
  Depth: 8-bit
  Channel depth:
    cyan: 8-bit
    magenta: 8-bit
    yellow: 8-bit
    black: 8-bit
  Channel statistics:
    cyan:
      min: 0 (0)
      max: 255 (1)
      mean: 28.492 (0.111734)
      standard deviation: 61.879 (0.242663)
      kurtosis: 5.32422
      skewness: 2.47138
    magenta:
      min: 0 (0)
      max: 255 (1)
      mean: 43.5579 (0.170815)
      standard deviation: 72.7733 (0.285386)
      kurtosis: 1.31682
      skewness: 1.57362
    yellow:
      min: 0 (0)
      max: 255 (1)
      mean: 53.0706 (0.20812)
      standard deviation: 85.3198 (0.334587)
      kurtosis: -0.0841614
      skewness: 1.2581
    black:
      min: 0 (0)
      max: 52 (0.203922)
      mean: 0.149434 (0.000586016)
      standard deviation: 1.78161 (0.00698672)
      kurtosis: 364.996
      skewness: 17.91
  Image statistics:
    Overall:
      min: 0 (0)
      max: 255 (1)
      mean: 25.054 (0.098251)
      standard deviation: 61.3102 (0.240432)
      kurtosis: 5.28177
      skewness: 2.5304
  Total ink density: 300%
  Rendering intent: Undefined
  Interlace: None
  Background color: white
  Border color: cmyk(223,223,223,0)
  Matte color: grey74
  Transparent color: black
  Page geometry: 150x212+0+0
  Dispose: Undefined
  Iterations: 0
  Compression: JPEG
  Quality: 92
  Orientation: Undefined
  Properties:
    create-date: 2009-08-17T11:38:16+01:00
    jpeg:colorspace: 4
    jpeg:sampling-factor: 1x1,1x1,1x1,1x1
    modify-date: 2009-08-17T11:37:48+01:00
    signature: f5e85add196c10f1d73f416482e779245595a644877696fffb2637b5b97f6b9c
  Artifacts:
    verbose: true
  Tainted: False
  Filesize: 20.5kb
  Number pixels: 31.1kb
  Version: ImageMagick 6.5.3-10 2009-06-19 Q16 OpenMP http://www.imagemagick.org
</code>```

Here is the identify output (also noticed that this JPEG image displays as a solid black image on the Mac):

[Where is this image ???]

答:
You can use the following command to convert cmyk to rgb

http://imagemagick.org/Usage/formats/#color_profile

convert cmyk_image.jpg -colorspace
  rgb rgb_image.jpg

ContentLicense: CC BY-SA 2.5

Body:
We are using the open source image manipulation tool ImageMagick to take thumbnails of various files. We thought things were running pretty smoothly with all this, until we realized that some browsers (namely Internet Explorer 8 and Chrome) were unable to display the JPEG files.

I can only assume that the output of the ImageMagick conversions are not web safe JPEGs. Why is this the case, and can it be fixed at all?

Incidentally, we are using the command line tool convert and we are using these parameters:

convert -thumbnail 150x fileToThumb outputPath

EDIT:

Image: 50afd2b1-e42c-4e90-9244-9c5a00c1933d.jpg
  Format: JPEG (Joint Photographic Experts Group JFIF format)
  Class: DirectClass
  Geometry: 150x212+0+0
  Resolution: 72x72
  Print size: 2.08333x2.94444
  Units: PixelsPerInch
  Type: ColorSeparation
  Endianess: Undefined
  Colorspace: CMYK
  Depth: 8-bit
  Channel depth:
    cyan: 8-bit
    magenta: 8-bit
    yellow: 8-bit
    black: 8-bit
  Channel statistics:
    cyan:
      min: 0 (0)
      max: 255 (1)
      mean: 28.492 (0.111734)
      standard deviation: 61.879 (0.242663)
      kurtosis: 5.32422
      skewness: 2.47138
    magenta:
      min: 0 (0)
      max: 255 (1)
      mean: 43.5579 (0.170815)
      standard deviation: 72.7733 (0.285386)
      kurtosis: 1.31682
      skewness: 1.57362
    yellow:
      min: 0 (0)
      max: 255 (1)
      mean: 53.0706 (0.20812)
      standard deviation: 85.3198 (0.334587)
      kurtosis: -0.0841614
      skewness: 1.2581
    black:
      min: 0 (0)
      max: 52 (0.203922)
      mean: 0.149434 (0.000586016)
      standard deviation: 1.78161 (0.00698672)
      kurtosis: 364.996
      skewness: 17.91
  Image statistics:
    Overall:
      min: 0 (0)
      max: 255 (1)
      mean: 25.054 (0.098251)
      standard deviation: 61.3102 (0.240432)
      kurtosis: 5.28177
      skewness: 2.5304
  Total ink density: 300%
  Rendering intent: Undefined
  Interlace: None
  Background color: white
  Border color: cmyk(223,223,223,0)
  Matte color: grey74
  Transparent color: black
  Page geometry: 150x212+0+0
  Dispose: Undefined
  Iterations: 0
  Compression: JPEG
  Quality: 92
  Orientation: Undefined
  Properties:
    create-date: 2009-08-17T11:38:16+01:00
    jpeg:colorspace: 4
    jpeg:sampling-factor: 1x1,1x1,1x1,1x1
    modify-date: 2009-08-17T11:37:48+01:00
    signature: f5e85add196c10f1d73f416482e779245595a644877696fffb2637b5b97f6b9c
  Artifacts:
    verbose: true
  Tainted: False
  Filesize: 20.5kb
  Number pixels: 31.1kb
  Version: ImageMagick 6.5.3-10 2009-06-19 Q16 OpenMP http://www.imagemagick.org

Here is the identify output (also noticed that this JPEG image displays as a solid black image on the Mac):

[Where is this image ???]


问:
How to post a message to the github api using hub api?
I want to use hub to create some automation script but can't figure out how to post a message to the api. More specifically it is this api endpoint I want to post to: https://developer.github.com/v3/users/gpg_keys/#create-a-gpg-key

I've tried the following:

hub api user/gpg_keys -F armored_public_key='-----BEGING PGP ....'

hub api user/gpg_keys --raw-field "body={armored_public_key='-----BEGING PGP ....'}

None of the above work, the response back is:

{"message":"Not Found","documentation_url":"https://developer.github.com/v3/users/gpg_keys/#create-a-gpg-key"}

which is not very helpful. I thought that -F meant fields within the payload, but I guess I'm wrong.

So how do I post a message with a body using hub api?

UPDATE

I did download the repo to create a modified version that has some more logging, but can't figure out what's wrong. Everything looks good from what I understand in how the request is made.

答: Looking through the code I found the reason to why this is. It seems like it is hard coded that you should only get the repo scopes when you log in the first time. If you use a token you've created yourself that has more access everything will work as it should.</p>


问:
Is there a way to ask for autoplay programmaticaly for firefox?
Is there a way to ask for autoplay permission in firefox using javascript ? Autoplay can be activated manually, but what I want is to ask for permission programmatically.
(For example, when I want to use webcam, it asks to the user if webcam can be used, I want to know if there is a way to do like this, but for video/audio autoplay)

```<code><audio autoplay>
   <source src="path/to/the/audio/file.mp3">
</audio>
</code>```

I expect the sound plays automatically, but I get the following error:

NotAllowedError: The play method is not allowed by the user agent or the platform in the current context, possibly because the user denied permission.

答:
Try this:</p>

```<code><audio id='audio'>
    <source src="path/to/the/audio/file.mp3">
</audio>

<script>
    document.querySelector('#audio').autoplay = true;
</script>
</code>```

Body:
Is there a way to ask for autoplay permission in firefox using javascript ? Autoplay can be activated manually, but what I want is to ask for permission programmatically.
(For example, when I want to use webcam, it asks to the user if webcam can be used, I want to know if there is a way to do like this, but for video/audio autoplay)

<audio autoplay>
   <source src="path/to/the/audio/file.mp3">
</audio>

I expect the sound plays automatically, but I get the following error:

NotAllowedError: The play method is not allowed by the user agent or the platform in the current context, possibly because the user denied permission.

Body:
Try this:

<audio id='audio'>
    <source src="path/to/the/audio/file.mp3">
</audio>

<script>
    document.querySelector('#audio').autoplay = true;
</script>


问:
Pulling multiple bits of information and exporting into a report
I'm attempting to create a report to view all users on my system who are currently enabled and disabled along with showing me their last logon time.

I have two different scripts which do each job, however, i'm attempting to merge them into the same script so I can view all this information at the same time but running into issues.

This is my current attempt at gathering information:

```<code>get-aduser -Filter * -Properties CN,samaccountname,AccountExpirationDate,Enabled,lastLogonTimestamp | Select CN,samaccountname,AccountExpirationDate,Enabled,@{n="lastLogonDate";e={[datetime]::FromFileTime,
($_.lastLogonTimestamp)}} |sort Enabled | export-csv "c:\lemon.csv"
</code>```

But the result is I get the last login displaying as static datetime FromFileTime(long fileTime)

what would be the best method to pull last logon date which allows to pull this information in one report?

答:
I managed to modify a script I already had into the following:

```<code>Import-Module ActiveDirectory

Get-ADUser -Filter * -SearchBase "DC=x,DC=x,DC=x" -ResultPageSize 0 -Property CN,Description, Enabled, LastLogonTimestamp |
    Select-Object -Property CN, Description,Enabled, @{ n = "LastLogonDate"; e = { [datetime]::FromFileTime( $_.lastLogonTimestamp ) } } |
    Sort-Object -Property CN, Description, Enabled, LastLogonDate |
    Export-CSV -NoTypeInformation "C:\Users\x\Desktop\results2.csv"
</code>```

This code has resolved the issue, however, still unsure why my original code wasn't completing correctly.

Body:
I'm attempting to create a report to view all users on my system who are currently enabled and disabled along with showing me their last logon time.

I have two different scripts which do each job, however, i'm attempting to merge them into the same script so I can view all this information at the same time but running into issues.

This is my current attempt at gathering information:

get-aduser -Filter * -Properties CN,samaccountname,AccountExpirationDate,Enabled,lastLogonTimestamp | Select CN,samaccountname,AccountExpirationDate,Enabled,@{n="lastLogonDate";e={[datetime]::FromFileTime,
($_.lastLogonTimestamp)}} |sort Enabled | export-csv "c:\lemon.csv"

But the result is I get the last login displaying as static datetime FromFileTime(long fileTime)

what would be the best method to pull last logon date which allows to pull this information in one report?

Body:
I managed to modify a script I already had into the following:

Import-Module ActiveDirectory

Get-ADUser -Filter * -SearchBase "DC=x,DC=x,DC=x" -ResultPageSize 0 -Property CN,Description, Enabled, LastLogonTimestamp |
    Select-Object -Property CN, Description,Enabled, @{ n = "LastLogonDate"; e = { [datetime]::FromFileTime( $_.lastLogonTimestamp ) } } |
    Sort-Object -Property CN, Description, Enabled, LastLogonDate |
    Export-CSV -NoTypeInformation "C:\Users\x\Desktop\results2.csv"

This code has resolved the issue, however, still unsure why my original code wasn't completing correctly.


问:
UITableView some separator line missing
I am using code to build a uitableview like this:

```<code>UITableView *tableView = [[UITableView alloc]initWithFrame:CGRectMake(0, 290, [UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height - 290)];
tableView.delegate = self;
tableView.dataSource = self;
[tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:@"settingtabcell"];
</code>```

And the dataresource and viewdelegate

```<code>- (UITableViewCell *) tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    static NSString *CellIdentifier = @"settingtabcell";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];

    if (cell == nil) {
        cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier];
    }else{
        for(UIView *subview in cell.subviews){
            [subview removeFromSuperview];
        }
    }
    UILabel *label = [[UILabel alloc]initWithFrame:CGRectMake(70, 0, [UIScreen mainScreen].bounds.size.width - 20, 90)];
    UIImageView *imageView = [[UIImageView alloc]initWithFrame:CGRectMake(10, 30, 32, 32)];

    switch (indexPath.row) {
        case 0:
            label.text = @"Copyright information";
            imageView.image = [UIImage imageNamed:@"copyright.png"];
            break;
        case 1:
            label.text = @"Clear cache";
            imageView.image = [UIImage imageNamed:@"clearcache.png"];
            break;
        case 2:
            label.text = @"Feedback";
            imageView.image = [UIImage imageNamed:@"feedback.png"];
            break;
        case 3:
            label.text = @"About us";
            imageView.image = [UIImage imageNamed:@"about.png"];

        default:
            break;
    }
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    [cell addSubview:imageView];
    [cell addSubview:label];
    return cell;
}

-(NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return 4;
}

-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    return 90;
}
</code>```

The thing is some separator line is missing and some are not, this really confusing me.

So what may have caused this problem?

EDIT

To those who may concern, this screenshot is not on a simulator but was captured on an ihpone device.

And the line was originally showed except that after scrolling down and bouncing back, the line was missing.

答:
On my case, it was the Clip To Bounds on the custom UITableViewCell. Accidentally deselected it from the storyboard. Then again setting Clip To Bounds to true resolve this issue. Please do this thing it solve your issue.

Objective-C

```<code>[cell setClipToBound: YES];
</code>```

Swift

```<code>cell.clipToBound = true
</code>```

Storyboard :-

UITableViewCell OR UITableViewCell XIB

Thank You.

Title: UITableView some separator line missing

Body:
I am using code to build a uitableview like this:

UITableView *tableView = [[UITableView alloc]initWithFrame:CGRectMake(0, 290, [UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height - 290)];
tableView.delegate = self;
tableView.dataSource = self;
[tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:@"settingtabcell"];

And the dataresource and viewdelegate

- (UITableViewCell *) tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    static NSString *CellIdentifier = @"settingtabcell";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];

    if (cell == nil) {
        cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier];
    }else{
        for(UIView *subview in cell.subviews){
            [subview removeFromSuperview];
        }
    }
    UILabel *label = [[UILabel alloc]initWithFrame:CGRectMake(70, 0, [UIScreen mainScreen].bounds.size.width - 20, 90)];
    UIImageView *imageView = [[UIImageView alloc]initWithFrame:CGRectMake(10, 30, 32, 32)];

    switch (indexPath.row) {
        case 0:
            label.text = @"Copyright information";
            imageView.image = [UIImage imageNamed:@"copyright.png"];
            break;
        case 1:
            label.text = @"Clear cache";
            imageView.image = [UIImage imageNamed:@"clearcache.png"];
            break;
        case 2:
            label.text = @"Feedback";
            imageView.image = [UIImage imageNamed:@"feedback.png"];
            break;
        case 3:
            label.text = @"About us";
            imageView.image = [UIImage imageNamed:@"about.png"];

        default:
            break;
    }
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    [cell addSubview:imageView];
    [cell addSubview:label];
    return cell;
}

-(NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return 4;
}

-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    return 90;
}

The thing is some separator line is missing and some are not, this really confusing me.

So what may have caused this problem?

EDIT

To those who may concern, this screenshot is not on a simulator but was captured on an ihpone device.

And the line was originally showed except that after scrolling down and bouncing back, the line was missing.

Body:
On my case, it was the Clip To Bounds on the custom UITableViewCell. Accidentally deselected it from the storyboard. Then again setting Clip To Bounds to true resolve this issue. Please do this thing it solve your issue.

Objective-C

[cell setClipToBound: YES];

Swift

cell.clipToBound = true

Storyboard :-

UITableViewCell OR UITableViewCell XIB

Thank You.


问:
I was trying to install autobahn(0.14.1).But it shows like ''No matching distribution found for autobahn==0.14.1''
No matching distribution found for autobahn==0.14.1 </p>

```<code>[pipenv.exceptions.InstallError]:
['Collecting autobahn==0.14.1 (from -r /tmp/pipenv-mUvBAU-requirements/pipenv-hE1ELq-requirement.txt (line 1))', '
Could not fetch URL https://pypi.org/simple/autobahn/:
There was a problem confirming the ssl certificate: HTTPSConnectionPool(host=\'pypi.org\', port=443): Max retries exceeded with url: /simple/autobahn/ (Caused by SSLError("Can\'t connect to HTTPS URL because the SSL module is not available.",)) - skipping']
</code>```

答:
Please change to your python folder and run the following command.

./configure --with-ssl

make

sudo make install

Body:
No matching distribution found for autobahn==0.14.1

[pipenv.exceptions.InstallError]:
['Collecting autobahn==0.14.1 (from -r /tmp/pipenv-mUvBAU-requirements/pipenv-hE1ELq-requirement.txt (line 1))', '
Could not fetch URL https://pypi.org/simple/autobahn/:
There was a problem confirming the ssl certificate: HTTPSConnectionPool(host=\'pypi.org\', port=443): Max retries exceeded with url: /simple/autobahn/ (Caused by SSLError("Can\'t connect to HTTPS URL because the SSL module is not available.",)) - skipping']


问:
Angular 7 Can't bind to after using lazy loading
I got error:

Can't bind to 'dataSource' since it isn't a known property of 'table'.
  ("][dataSource]="ordersList" matSort
  class="table table-bordered mat-elevation-z8 material-table">

and another subsequence errors like qouted above after i implement lazy loading:

This is my code:
app.module.ts

```<code>imports: [
    BrowserModule,
    AppRoutingModule,
    ReactiveFormsModule,
    BrowserAnimationsModule,
    HttpClientModule,
    FormsModule,
    AppRoutingModule,
</code>```

app-routing.module.ts

```<code>import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';

const routes: Routes = [
  { path: 'orders', loadChildren: './orders/orders.module#OrdersModule' },
  { path: '', redirectTo: '/orders', pathMatch: 'full' }

];

@NgModule({
  imports: [RouterModule.forRoot(routes)],
  exports: [RouterModule]
})
export class AppRoutingModule { }
</code>```

orders-routing.modules.ts

```<code>import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { OrdersListComponent } from '../JobOrder/orders-list/orders-list.component';

const routes: Routes = [
  {
    path: '',
    component: OrdersListComponent
  }
];

@NgModule({
  imports: [RouterModule.forChild(routes)],
  exports: [RouterModule]
})
export class OrdersRoutingModule { }
</code>```

Orders.module.ts

```<code>import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';

import { OrdersRoutingModule } from './orders-routing.module';
import { OrdersListComponent } from '../JobOrder/orders-list/orders-list.component';

@NgModule({
  declarations: [OrdersListComponent],
  imports: [
    CommonModule,
    OrdersRoutingModule
  ]
})
export class OrdersModule { }
</code>```

orders-list.component.ts

```<code>import { GetAllOrdersService } from './../../Services/JobOrder/get-all-orders.service';
import { Component, OnInit, ViewChild } from '@angular/core';
import { ToastrService } from 'ngx-toastr';
import { MatTableDataSource, MatSort } from '@angular/material';

@Component({
  selector: 'app-orders-list',
  templateUrl: './orders-list.component.html',
  styleUrls: ['./orders-list.component.css']
})
export class OrdersListComponent implements OnInit {
  ordersList: MatTableDataSource<any>;
  displayColumns: string[] = ['id', 'jobOrderStats', 'customerNameTxt', 'untMdlTxt', 'mobileTxt', 'wrty', 'wrtyDate', 'workshopName', 'createDate', 'actions'];
  @ViewChild(MatSort) sort: MatSort;
  constructor(private _getAllOrdersService: GetAllOrdersService, private _toastr: ToastrService) { }

  ngOnInit() {
    this._getAllOrdersService.GetAllOrders().subscribe(r => {
      if (r["code"] === "200") {
        this.ordersList = r["result"];
        this.ordersList.sort = this.sort;
      }
      else {
        this._toastr.error("Error occurred " + r["result"]);
      }
    });
  }

}
</code>```

The error i got in the console:

ERROR Error: Uncaught (in promise): Error: Template parse errors:
  Can't bind to 'dataSource' since it isn't a known property of 'table'.
  ("][dataSource]="ordersList" matSort
  class="table table-bordered mat-elevation-z8 material-table">

An update to the question !!

When i got an error says:

The pipe 'dateFormat' could not be found

I have declared a shared module:

```<code>import { DateFormatPipe } from './../../Pipes/date-format.pipe';
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';

import { SharedRoutingModule } from './shared-routing.module';
import { ModuleWithProviders } from '@angular/compiler/src/core';

@NgModule({
  imports: [
    CommonModule,
    SharedRoutingModule,
  ],
  declarations: [DateFormatPipe],

  exports: [DateFormatPipe]
})
export class SharedModule {

}
</code>```

and then i add it to the imports of orders module:

```<code>import { SharedModule } from './../Modules/shared/shared.module';
import { DateFormatPipe } from './../Pipes/date-format.pipe';
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';

import { OrdersRoutingModule } from './orders-routing.module';
import { OrdersListComponent } from '../JobOrder/orders-list/orders-list.component';
import { QuillModule } from 'ngx-quill';
import { MatTableModule, MatPaginatorModule, MatSortModule, MatInputModule, MatDialogModule, MatFormFieldModule, MatCheckboxModule } from '@angular/material';
import { NgbModule } from '@ng-bootstrap/ng-bootstrap';

@NgModule({
  declarations: [OrdersListComponent],
  imports: [
    CommonModule,
    OrdersRoutingModule,
    QuillModule,
    MatTableModule,
    MatPaginatorModule,
    MatSortModule,
    MatInputModule,
    MatDialogModule,
    MatFormFieldModule,
    MatCheckboxModule,
    NgbModule,
    SharedModule
  ],
  exports: []
})
export class OrdersModule { }
</code>```

答:
Since you are using Material Table, You should import MatTableModule in AppModule or in the Module where you component is declared.</p>

```<code>@NgModule({
  imports: [
    MatTableModule
    ...
  ]
})
public class AppModule
</code>```

Body:
I got error:

Can't bind to 'dataSource' since it isn't a known property of 'table'.
  ("][dataSource]="ordersList" matSort
  class="table table-bordered mat-elevation-z8 material-table">

and another subsequence errors like qouted above after i implement lazy loading:

This is my code:
app.module.ts

imports: [
    BrowserModule,
    AppRoutingModule,
    ReactiveFormsModule,
    BrowserAnimationsModule,
    HttpClientModule,
    FormsModule,
    AppRoutingModule,

app-routing.module.ts

import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';

const routes: Routes = [
  { path: 'orders', loadChildren: './orders/orders.module#OrdersModule' },
  { path: '', redirectTo: '/orders', pathMatch: 'full' }

];

@NgModule({
  imports: [RouterModule.forRoot(routes)],
  exports: [RouterModule]
})
export class AppRoutingModule { }

orders-routing.modules.ts

import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { OrdersListComponent } from '../JobOrder/orders-list/orders-list.component';

const routes: Routes = [
  {
    path: '',
    component: OrdersListComponent
  }
];

@NgModule({
  imports: [RouterModule.forChild(routes)],
  exports: [RouterModule]
})
export class OrdersRoutingModule { }

Orders.module.ts

import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';

import { OrdersRoutingModule } from './orders-routing.module';
import { OrdersListComponent } from '../JobOrder/orders-list/orders-list.component';

@NgModule({
  declarations: [OrdersListComponent],
  imports: [
    CommonModule,
    OrdersRoutingModule
  ]
})
export class OrdersModule { }

orders-list.component.ts

import { GetAllOrdersService } from './../../Services/JobOrder/get-all-orders.service';
import { Component, OnInit, ViewChild } from '@angular/core';
import { ToastrService } from 'ngx-toastr';
import { MatTableDataSource, MatSort } from '@angular/material';

@Component({
  selector: 'app-orders-list',
  templateUrl: './orders-list.component.html',
  styleUrls: ['./orders-list.component.css']
})
export class OrdersListComponent implements OnInit {
  ordersList: MatTableDataSource<any>;
  displayColumns: string[] = ['id', 'jobOrderStats', 'customerNameTxt', 'untMdlTxt', 'mobileTxt', 'wrty', 'wrtyDate', 'workshopName', 'createDate', 'actions'];
  @ViewChild(MatSort) sort: MatSort;
  constructor(private _getAllOrdersService: GetAllOrdersService, private _toastr: ToastrService) { }

  ngOnInit() {
    this._getAllOrdersService.GetAllOrders().subscribe(r => {
      if (r["code"] === "200") {
        this.ordersList = r["result"];
        this.ordersList.sort = this.sort;
      }
      else {
        this._toastr.error("Error occurred " + r["result"]);
      }
    });
  }

}

The error i got in the console:

ERROR Error: Uncaught (in promise): Error: Template parse errors:
  Can't bind to 'dataSource' since it isn't a known property of 'table'.
  ("][dataSource]="ordersList" matSort
  class="table table-bordered mat-elevation-z8 material-table">

An update to the question !!

When i got an error says:

The pipe 'dateFormat' could not be found

I have declared a shared module:

import { DateFormatPipe } from './../../Pipes/date-format.pipe';
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';

import { SharedRoutingModule } from './shared-routing.module';
import { ModuleWithProviders } from '@angular/compiler/src/core';

@NgModule({
  imports: [
    CommonModule,
    SharedRoutingModule,
  ],
  declarations: [DateFormatPipe],

  exports: [DateFormatPipe]
})
export class SharedModule {

}

and then i add it to the imports of orders module:

import { SharedModule } from './../Modules/shared/shared.module';
import { DateFormatPipe } from './../Pipes/date-format.pipe';
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';

import { OrdersRoutingModule } from './orders-routing.module';
import { OrdersListComponent } from '../JobOrder/orders-list/orders-list.component';
import { QuillModule } from 'ngx-quill';
import { MatTableModule, MatPaginatorModule, MatSortModule, MatInputModule, MatDialogModule, MatFormFieldModule, MatCheckboxModule } from '@angular/material';
import { NgbModule } from '@ng-bootstrap/ng-bootstrap';

@NgModule({
  declarations: [OrdersListComponent],
  imports: [
    CommonModule,
    OrdersRoutingModule,
    QuillModule,
    MatTableModule,
    MatPaginatorModule,
    MatSortModule,
    MatInputModule,
    MatDialogModule,
    MatFormFieldModule,
    MatCheckboxModule,
    NgbModule,
    SharedModule
  ],
  exports: []
})
export class OrdersModule { }

Body:
Since you are using Material Table, You should import MatTableModule in AppModule or in the Module where you component is declared.

@NgModule({
  imports: [
    MatTableModule
    ...
  ]
})
public class AppModule


问:
Why does a macro assigned to a cell fail?
I have a macro assigned to a cell that executes once clicked on. The macro involves SAP scripting, which if ever interrupted (via CTRL+DEL+ALT), also causes my previously clickable cell to stop working.

I can run the macro via Developer yet the cell is not working. Note that the code provided below is pasted in the sheet where the clickable cell is, not in ThisWorkbook.

```<code>Option Explicit

Private Sub Worksheet_SelectionChange(ByVal target As Range)

   If Selection.CountLarge = 1 Then

   If Not Intersect(target, Range("A10")) Is Nothing Then
       Call FolderPicker
   End If

End Sub
</code>```

Any ideas what might be causing the issue?

答:
You need to close all if statements. </p>

```<code>Option Explicit

Private Sub Worksheet_SelectionChange(ByVal target As Range)

   If Selection.CountLarge = 1 Then

      If Not Intersect(target, Range("A10")) Is Nothing Then
       Call FolderPicker
      End If
   End If

End Sub
</code>```

Body:
I have a macro assigned to a cell that executes once clicked on. The macro involves SAP scripting, which if ever interrupted (via CTRL+DEL+ALT), also causes my previously clickable cell to stop working.

I can run the macro via Developer yet the cell is not working. Note that the code provided below is pasted in the sheet where the clickable cell is, not in ThisWorkbook.

Option Explicit

Private Sub Worksheet_SelectionChange(ByVal target As Range)

   If Selection.CountLarge = 1 Then

   If Not Intersect(target, Range("A10")) Is Nothing Then
       Call FolderPicker
   End If

End Sub

Any ideas what might be causing the issue?

Body:
You need to close all if statements.

Option Explicit

Private Sub Worksheet_SelectionChange(ByVal target As Range)

   If Selection.CountLarge = 1 Then

      If Not Intersect(target, Range("A10")) Is Nothing Then
       Call FolderPicker
      End If
   End If

End Sub


问:
How to find what are the permissions a certain app is asking and using?
I know there are a few types of permissions: Normal permissions, Signature permissions, Dangerous permissions and Special permissions.
It seems that packages.xml contains part of the permissions that a certain app is using, but, I’m not sure that it contains all the permissions the app uses.

Where can I find all of those permissions?

Where can I find all the data that an app can receive from my phone by having a specific permission?
i.e. What data can app get from having the following permission android.permission.ACCESS_NETWORK_STATE

This is the output from the packages.xml file:

```<code><perms>
    <item name="com.google.android.c2dm.permission.RECEIVE" granted="true" flags="0" />
    <item name="android.permission.USE_CREDENTIALS" granted="true" flags="0" />
    <item name="android.permission.MODIFY_AUDIO_SETTINGS" granted="true" flags="0" />
    <item name="com.google.android.providers.gsf.permission.READ_GSERVICES" granted="true" flags="0" />
    <item name="android.permission.MANAGE_ACCOUNTS" granted="true" flags="0" />
    <item name="android.permission.WRITE_SYNC_SETTINGS" granted="true" flags="0" />
    <item name="android.permission.RECEIVE_BOOT_COMPLETED" granted="true" flags="0" />
    <item name="android.permission.AUTHENTICATE_ACCOUNTS" granted="true" flags="0" />
    <item name="android.permission.INTERNET" granted="true" flags="0" />
    <item name="android.permission.BROADCAST_STICKY" granted="true" flags="0" />
    <item name="android.permission.CHANGE_WIFI_STATE" granted="true" flags="0" />
    <item name="android.permission.ACCESS_NETWORK_STATE" granted="true" flags="0" />
    <item name="android.permission.USE_FINGERPRINT" granted="true" flags="0" />
    <item name="android.permission.READ_SYNC_STATS" granted="true" flags="0" />
    <item name="android.permission.MANAGE_OWN_CALLS" granted="true" flags="0" />
    <item name="android.permission.READ_SYNC_SETTINGS" granted="true" flags="0" />
    <item name="android.permission.VIBRATE" granted="true" flags="0" />
    <item name="android.permission.ACCESS_WIFI_STATE" granted="true" flags="0" />
    <item name="com.android.launcher.permission.INSTALL_SHORTCUT" granted="true" flags="0" />
    <item name="android.permission.WAKE_LOCK" granted="true" flags="0" />
</perms>
</code>```

答: You can see in the Settings -> APPS -> Managed Apps -> App that you want to see -> Permissions</p>

Body:
I know there are a few types of permissions: Normal permissions, Signature permissions, Dangerous permissions and Special permissions.
It seems that packages.xml contains part of the permissions that a certain app is using, but, I’m not sure that it contains all the permissions the app uses.

Where can I find all of those permissions?

Where can I find all the data that an app can receive from my phone by having a specific permission?
i.e. What data can app get from having the following permission android.permission.ACCESS_NETWORK_STATE

This is the output from the packages.xml file:

<perms>
    <item name="com.google.android.c2dm.permission.RECEIVE" granted="true" flags="0" />
    <item name="android.permission.USE_CREDENTIALS" granted="true" flags="0" />
    <item name="android.permission.MODIFY_AUDIO_SETTINGS" granted="true" flags="0" />
    <item name="com.google.android.providers.gsf.permission.READ_GSERVICES" granted="true" flags="0" />
    <item name="android.permission.MANAGE_ACCOUNTS" granted="true" flags="0" />
    <item name="android.permission.WRITE_SYNC_SETTINGS" granted="true" flags="0" />
    <item name="android.permission.RECEIVE_BOOT_COMPLETED" granted="true" flags="0" />
    <item name="android.permission.AUTHENTICATE_ACCOUNTS" granted="true" flags="0" />
    <item name="android.permission.INTERNET" granted="true" flags="0" />
    <item name="android.permission.BROADCAST_STICKY" granted="true" flags="0" />
    <item name="android.permission.CHANGE_WIFI_STATE" granted="true" flags="0" />
    <item name="android.permission.ACCESS_NETWORK_STATE" granted="true" flags="0" />
    <item name="android.permission.USE_FINGERPRINT" granted="true" flags="0" />
    <item name="android.permission.READ_SYNC_STATS" granted="true" flags="0" />
    <item name="android.permission.MANAGE_OWN_CALLS" granted="true" flags="0" />
    <item name="android.permission.READ_SYNC_SETTINGS" granted="true" flags="0" />
    <item name="android.permission.VIBRATE" granted="true" flags="0" />
    <item name="android.permission.ACCESS_WIFI_STATE" granted="true" flags="0" />
    <item name="com.android.launcher.permission.INSTALL_SHORTCUT" granted="true" flags="0" />
    <item name="android.permission.WAKE_LOCK" granted="true" flags="0" />
</perms>


问:
Applying CSS from an Angular component to a sub-component
We have an in-house Angular component library (one project), each component has basic styling.

We use this library in our App (another project).

A component in the App contains a component from our library.

From the global styles.scss in the App, I can target the elements in the library component just fine.

If I move that global CSS into the App component CSS file, try what may, I cannot target any elements inside the library component.

app-component.html

  <library-component specificityattr></library-component>

```

<p>library-component.html</p>

<pre class="lang-html prettyprint-override"><code><div class="generic-styles">
  <p class="hello">Hello</p>
</div>
</code>```

app-component.scss

```<code>library-component[specificityattr] p.hello {
    background: red;
}
</code>```

styles.scss

```<code>library-component[specificityattr] p.hello {
    background: green;
}
</code>```

Without the selector in styles.scss, I expect the P tag to have a red background.
Only when I put the same selector in styles.scss do I get a green background.

How is this failing?

What is the correct way to style a components sub-components?

答:
Your :host component is th library-component and you want to apply css to some "deep" DOMS so it means :ng-deep

Here is working example

Use

```<code>:host library-component[specificityattr] ::ng-deep p.hello {
    background: green;
}
</code>```

Body:
We have an in-house Angular component library (one project), each component has basic styling.

We use this library in our App (another project).

A component in the App contains a component from our library.

From the global styles.scss in the App, I can target the elements in the library component just fine.

If I move that global CSS into the App component CSS file, try what may, I cannot target any elements inside the library component.

app-component.html

  <library-component specificityattr></library-component>

library-component.html

Hello

app-component.scss

library-component[specificityattr] p.hello {
    background: red;
}

styles.scss

library-component[specificityattr] p.hello {
    background: green;
}

Without the selector in styles.scss, I expect the P tag to have a red background.
Only when I put the same selector in styles.scss do I get a green background.

How is this failing?

What is the correct way to style a components sub-components?

Body:
Your :host component is th library-component and you want to apply css to some "deep" DOMS so it means :ng-deep

Here is working example

Use

:host library-component[specificityattr] ::ng-deep p.hello {
    background: green;
}


问:
Internal networkloadbalancer wont route to instance X when curl from NLB DNS from instance X

I have an internal of a network-load-balancer (NLB) (resolving to private ips)

An NLB listener on port 80 points to a target group. An instance 10.141.80.140 in the target group is the only one.

Problem:

When I am on the instance 10.141.80.140 and curl the DNS of NLB
I get no response.

I expect the NLB to redirect to 10.141.80.140 but it doesnt happen.

The NLB DNS only doesnt redirect, when I am on the 10.141.80.140 - the redirection works from other instances in the same subnet

Details:

The security group around the EC2 10.141.80.140 is world open, inbound and outbound

When I curl the NLB DNS from another instance 10.141.80.122 in the same subnet with the same security group and other settings - NLB resolves correctly to 10.141.80.140

When I curl the NLB DNS from the instance, to which NLB should resolve 10.141.80.140  - NLB DOESNT resolve to 10.141.80.140

When I curl the instance ip 10.141.80.140 from the instance 10.141.80.140 - I get a response

When I curl the instance ip 10.141.80.140 from the instance 10.141.80.122 - I get a response

Question:

Is there something, what prevents NLB to resolve the request of an instance,
which would route back to the instance, within the NLB listeners target group?

答:
that is a well-know behavior that I am going to be glad to explain. Network Load Balancer introduced the source address preservation feature - the original IP addresses and source ports for the incoming connections remains unmodified. When the target answers a request, the VPC internals capture this packet and forwards it to the NLB, which will forward it to its destination.

This behavior has a side effect: when the OS kernel detects that the egress packet has as the destination address one of the local addresses, it will forward this packet directly to the application.

For example, given the following components:

We have an internal NLB and a backend instance. Both are deployed in the subnet 10.0.0.0/24.

The NLB has the IP 10.0.0.10 and a listener on port 80 that forwards the request to the port 8080.

The backend instance has the address 10.0.0.55 and has a web server listening on port 8080. It has a security group that allows all the incoming local traffic.

If the instance tries to establish a communication with the NLB; the flow of the communication would be the following:

The instance wants to telnet the NLB: it does a request for establish a TCP connection against the NLB DNS name on the port 80.

As it is an outgoing communication, it starts from an ephemeral port; the instance sends a SYN packet (1):

Source: 10.0.0.55:40000

Destination: 10.0.0.10:80

The NLB receives the packet and forwards it to the backend instance (10.0.0.55:80).

Due the address preservation feature, the backend instance receives a SYN packet with the following information:

Source: 10.0.0.55:40000

Destination: 10.0.0.55:80

The Operation system routes the packet internally (as its destination is the own machine), and here is when the issue happen:

The initiating socket is expecting the SYN_ACK from 10.0.0.10:80 (the NLB).

However, it receives the SYN_ACK from 10.0.0.55:40000 (the instance itself).

The OS will send several TCP_RETRANSMISSION until it times out.

This will not happen with a public NLB, as the instance will need to do NAT in the VPC to use its public IP address to send the request to the NLB. The kernel will not internally forward the packet.

Finally, a possible workaround is registering the backends as per their IP address, not by their Instance ID; with this method, the traffic forwarded by the NLB will contain the NLB internal IP as the source IP, disabling the "source address preservation" feature. Unfortunately, if you are launching instances with an AutoScaling Group, it will only be able to register the launched instances by its ID. In case of ECS tasks, configuring the network as "awsvpc" forces the NLB to register each target by its IP.


问:
How to enable memory monitoring in Xdebug?
I am trying to use Xdebug for my Drupal project debugging. In some documentations, I saw that the Xdebug is able to find memory leaks as well. I tried to use that facility. But I am not getting any logs regarding that.

I configured my 20-xdebug.ini as follows

```<code>zend_extension=xdebug.so
xdebug.remote_enable=1
xdebug.remote_host = 127.0.0.1
xdebug.remote_enable = 1
xdebug.remote_port = 9000
xdebug.remote_handler = dbgp
xdebug.remote_mode = req
xdebug.profiler_enable=0
xdebug.profiler_enable_trigger=1
xdebug.profiler_output_dir = "/home/myname/Desktop/xdebug/"
xdebug.trace_output_dir="/home/myname/Desktop/xdebug/"
xdebug.remote_log="/home/myname/Desktop/xdebug/xdebug.log"
xdebug.auto_trace=1
xdebug.collect_params=1
xdebug.trace_format=1
xdebug.idekey=netbeans-xdebug
xdebug.remote_autostart=1
</code>```

I am able to connect NetBeans with Xdebug and I can go through each break points. But there are no logs regarding this in the /tmp folder and there are no log files in the above given paths as well.

Am I doing something wrong? Please assist me on this.

答:
maybe you need
xdebug.show_mem_delta = 1

xdebug.show_mem_delta

Type: integer, Default value: 0

When this setting is set to something != 0 Xdebug's human-readable
  generated trace files will show the difference in memory usage between
  function calls. If Xdebug is configured to generate computer-readable
  trace files then they will always show this information.

Body:
I am trying to use Xdebug for my Drupal project debugging. In some documentations, I saw that the Xdebug is able to find memory leaks as well. I tried to use that facility. But I am not getting any logs regarding that.

I configured my 20-xdebug.ini as follows

zend_extension=xdebug.so
xdebug.remote_enable=1
xdebug.remote_host = 127.0.0.1
xdebug.remote_enable = 1
xdebug.remote_port = 9000
xdebug.remote_handler = dbgp
xdebug.remote_mode = req
xdebug.profiler_enable=0
xdebug.profiler_enable_trigger=1
xdebug.profiler_output_dir = "/home/myname/Desktop/xdebug/"
xdebug.trace_output_dir="/home/myname/Desktop/xdebug/"
xdebug.remote_log="/home/myname/Desktop/xdebug/xdebug.log"
xdebug.auto_trace=1
xdebug.collect_params=1
xdebug.trace_format=1
xdebug.idekey=netbeans-xdebug
xdebug.remote_autostart=1

I am able to connect NetBeans with Xdebug and I can go through each break points. But there are no logs regarding this in the /tmp folder and there are no log files in the above given paths as well.

Am I doing something wrong? Please assist me on this.


问:
Trying to use spaces in an array of search variables, but not getting the expected output / results
I cannot seem to get this working. I am trying to modify a very old script (of our late technician and close friend) which we use to be used for searching servers with which OS being used. This consists (as far as I can tell) out PHP and SMARTY.

I already tried escaping the content with slashes and using backticks. But it simply does not work. I really have no idea where to look. Below are the original two pieces of code (I couldn't find more parts for it, or I have overlooked).

Piece of PHP code from the 1st PHP-file:

```<code>$values['osname'] = array( '-' => 'no choice',
                          '5' => 'CentOS 5.x',
                          '6' => 'CentOS 6.x',
                          '7' => 'CentOS 7.x',
                        );
</code>```

Piece of code from the 2nd PHP-file:

```<code>$osname = intval(Common::GPvar('osname'));
$_SESSION['form']['serverselect']['osname'] = $osname;
if ($osname != '-') { $where .= " AND dsh.sumup LIKE '%OS: CentOS ".$osname."%'"; }
</code>```

This is being used in a search form, so when I select "CentOS 6.x" it will display all servers which have the text OS: CentOS 6.10 in it.

Now what I am trying to achieve is to make the following to work:

```<code>$values['osname'] = array( '-' => 'no choice',
                          'CentOS 5' => 'CentOS 5.x',
                          'CentOS 6' => 'CentOS 6.x',
                          'CentOS 7' => 'CentOS 7.x',
                          'Virtuozzo 7' => 'Virtuozzo 7.x',
                        );
</code>```

I tried to escape the content, as I mentioned above, however that didn't work. So I am guessing the coding in the 2nd PHP-file also needs some adjusting. So I tried removing certain stuff, like "CentOS", "%" and several other things. But it does not work. The result is that, on a search, I am getting all servers being displayed (no matter what OS is on them).

I guess I did correctly on escaping the variables in the array, but the 2nd piece of coding is not compatible for some reason with the requested search input?

Anyone has an idea what I am doing wrong here?

答:
You can remove intval(...) because intval will turn strings into integers

https://php.net/manual/en/function.intval.php

```<code>$osname = Common::GPvar('osname');
</code>```

The whole code

```<code>$osname = Common::GPvar('osname');
$_SESSION['form']['serverselect']['osname'] = $osname;
if ($osname != '-') { $where .= " AND dsh.sumup LIKE '".$osname."%'"; }
</code>```

Body:
I cannot seem to get this working. I am trying to modify a very old script (of our late technician and close friend) which we use to be used for searching servers with which OS being used. This consists (as far as I can tell) out PHP and SMARTY.

I already tried escaping the content with slashes and using backticks. But it simply does not work. I really have no idea where to look. Below are the original two pieces of code (I couldn't find more parts for it, or I have overlooked).

Piece of PHP code from the 1st PHP-file:

$values['osname'] = array( '-' => 'no choice',
                          '5' => 'CentOS 5.x',
                          '6' => 'CentOS 6.x',
                          '7' => 'CentOS 7.x',
                        );

Piece of code from the 2nd PHP-file:

$osname = intval(Common::GPvar('osname'));
$_SESSION['form']['serverselect']['osname'] = $osname;
if ($osname != '-') { $where .= " AND dsh.sumup LIKE '%OS: CentOS ".$osname."%'"; }

This is being used in a search form, so when I select "CentOS 6.x" it will display all servers which have the text OS: CentOS 6.10 in it.

Now what I am trying to achieve is to make the following to work:

$values['osname'] = array( '-' => 'no choice',
                          'CentOS 5' => 'CentOS 5.x',
                          'CentOS 6' => 'CentOS 6.x',
                          'CentOS 7' => 'CentOS 7.x',
                          'Virtuozzo 7' => 'Virtuozzo 7.x',
                        );

I tried to escape the content, as I mentioned above, however that didn't work. So I am guessing the coding in the 2nd PHP-file also needs some adjusting. So I tried removing certain stuff, like "CentOS", "%" and several other things. But it does not work. The result is that, on a search, I am getting all servers being displayed (no matter what OS is on them).

I guess I did correctly on escaping the variables in the array, but the 2nd piece of coding is not compatible for some reason with the requested search input?

Anyone has an idea what I am doing wrong here?

Body:
You can remove intval(...) because intval will turn strings into integers

https://php.net/manual/en/function.intval.php

$osname = Common::GPvar('osname');

The whole code

$osname = Common::GPvar('osname');
$_SESSION['form']['serverselect']['osname'] = $osname;
if ($osname != '-') { $where .= " AND dsh.sumup LIKE '".$osname."%'"; }


问:
USB Debugging option on my Android keeps turning off
Every time I restart my Android phone after enabling the USB debugging in Developer Options, the USB Debugging option gets disabled.

How do I keep it enabled even after restarting my Android phone.

答:
I have found a solution on XDA developpers forum for my Honor 7X, Android 8.0.0, EMUI 8.0.0, build BND-L21 8.0.0.302(C432log):

Enable the 'allow debugging in charge only mode' and it should fix the problem

Note that it can already be enabled. You can try to disable and re-enable it to fix the problem.


问:
App keeps crashing when push notification is sent from firebase
I am unable to send notifications to my app from firebase, as it crashes everytime i do so

It previously showed error for latest versions of the firebase_messaging plugin, so i kept it empty so that the ide will get the latest packages.

These are my dependencies in pubspec.yaml file

```<code>dependencies:
  flutter:
    sdk: flutter

  # The following adds the Cupertino Icons font to your application.
  # Use with the CupertinoIcons class for iOS style icons.
  cupertino_icons: ^0.1.2
  #firebase_auth: ^0.10.0+1
  #firebase_core: ^0.4.0
  firebase_database: ^3.0.0
  firebase_messaging:
dev_dependencies:
</code>```

My code for the push notifications is as follows:

```<code>firebaseMessaging.getToken().then((token){
      print("Token: $token");
    });

    firebaseMessaging.configure(
      onMessage: (Map<String, dynamic> message) async {
        print('on message $message');
        final notification=message['notification'];
        setState(() {
          messages.add(Message(
              title: notification['title'],body: notification['body']
          ));
        });
      },
      onResume: (Map<String, dynamic> message) async {
        print('on resume $message');
      },
      onLaunch: (Map<String, dynamic> message) async {
        print('on launch $message');
      },
    );
</code>```

This the logcat summary when i run my program:

```<code> Syncing files to device SM G960F...
    D/ViewRootImpl@df42dca[MainActivity](21660): MSG_WINDOW_FOCUS_CHANGED 1 1
    D/InputMethodManager(21660): prepareNavigationBarInfo() DecorView@b273b3b[MainActivity]
    D/InputMethodManager(21660): getNavigationBarColor() -855310
    D/InputMethodManager(21660): prepareNavigationBarInfo() DecorView@b273b3b[MainActivity]
    D/InputMethodManager(21660): getNavigationBarColor() -855310
    V/InputMethodManager(21660): Starting input: tba=com.kashyap.user_admin ic=null mNaviBarColor -855310 mIsGetNaviBarColorSuccess true , NavVisible : true , NavTrans : false
    D/InputMethodManager(21660): startInputInner - Id : 0
    I/InputMethodManager(21660): startInputInner - mService.startInputOrWindowGainedFocus
    D/InputTransport(21660): Input channel constructed: fd=105
    D/InputMethodManager(21660): prepareNavigationBarInfo() DecorView@b273b3b[MainActivity]
    D/InputMethodManager(21660): getNavigationBarColor() -855310
    V/InputMethodManager(21660): Starting input: tba=com.kashyap.user_admin ic=null mNaviBarColor -855310 mIsGetNaviBarColorSuccess true , NavVisible : true , NavTrans : false
    D/InputMethodManager(21660): startInputInner - Id : 0
    D/ViewRootImpl@df42dca[MainActivity](21660): ViewPostIme pointer 0
    D/ViewRootImpl@df42dca[MainActivity](21660): ViewPostIme pointer 1
    D/ViewRootImpl@df42dca[MainActivity](21660): MSG_WINDOW_FOCUS_CHANGED 0 1
    D/InputMethodManager(21660): prepareNavigationBarInfo() DecorView@b273b3b[MainActivity]
    D/InputMethodManager(21660): getNavigationBarColor() -855310
    D/SurfaceView(21660): windowStopped(true) false 7c74c04 of ViewRootImpl@df42dca[MainActivity]
    D/SurfaceView(21660): show() Surface(name=SurfaceView - com.kashyap.user_admin/com.kashyap.user_admin.MainActivity@7c74c04@0[21660])/@0x81cc5ed io.flutter.view.FlutterView{7c74c04 VFE...... ........ 0,0-1440,2960}
    D/SurfaceView(21660): surfaceDestroyed callback.size 1 #1 io.flutter.view.FlutterView{7c74c04 VFE...... ........ 0,0-1440,2960}
    W/libEGL  (21660): EGLNativeWindowType 0x72580fe010 disconnect failed
    D/SurfaceView(21660): destroy() Surface(name=SurfaceView - com.kashyap.user_admin/com.kashyap.user_admin.MainActivity@7c74c04@0[21660])/@0x81cc5ed io.flutter.view.FlutterView{7c74c04 VFE...... ........ 0,0-1440,2960}
    D/SurfaceView(21660): onWindowVisibilityChanged(4) false 7c74c04 of ViewRootImpl@df42dca[MainActivity]
    W/libEGL  (21660): EGLNativeWindowType 0x726fef2010 disconnect failed
    D/OpenGLRenderer(21660): eglDestroySurface = 0x7266249a00, 0x726fef2000
    D/ViewRootImpl@df42dca[MainActivity](21660): Relayout returned: old=[0,0][1440,2960] new=[0,0][1440,2960] result=0x5 surface={valid=false 0} changed=true
    D/InputTransport(21660): Input channel destroyed: fd=105
    D/SurfaceView(21660): onWindowVisibilityChanged(8) false 7c74c04 of ViewRootImpl@df42dca[MainActivity]
    D/ViewRootImpl@df42dca[MainActivity](21660): Relayout returned: old=[0,0][1440,2960] new=[0,0][1440,2960] result=0x1 surface={valid=false 0} changed=false
    I/hyap.user_admi(21660): Rejecting re-init on previously-failed class java.lang.Class<com.google.firebase.messaging.FirebaseMessagingService>: java.lang.IllegalAccessError: Class com.google.firebase.iid.zzb extended by class com.google.firebase.messaging.FirebaseMessagingService is inaccessible (declaration of 'com.google.firebase.messaging.FirebaseMessagingService' appears in /data/app/com.kashyap.user_admin-P6LJr-bNg8zLx2ZhadHMPA==/base.apk!classes2.dex)
    I/hyap.user_admi(21660):   at java.lang.Class java.lang.VMClassLoader.findLoadedClass(java.lang.ClassLoader, java.lang.String) (VMClassLoader.java:-2)
    I/hyap.user_admi(21660):   at java.lang.Class java.lang.ClassLoader.findLoadedClass(java.lang.String) (ClassLoader.java:738)
    I/hyap.user_admi(21660):   at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String, boolean) (ClassLoader.java:363)
    I/hyap.user_admi(21660):   at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String) (ClassLoader.java:312)
    I/hyap.user_admi(21660):   at android.app.Service android.app.AppComponentFactory.instantiateService(java.lang.ClassLoader, java.lang.String, android.content.Intent) (AppComponentFactory.java:103)
    I/hyap.user_admi(21660):   at android.app.Service androidx.core.app.CoreComponentFactory.instantiateService(java.lang.ClassLoader, java.lang.String, android.content.Intent) (CoreComponentFactory.java:68)
    I/hyap.user_admi(21660):   at void android.app.ActivityThread.handleCreateService(android.app.ActivityThread$CreateServiceData) (ActivityThread.java:3710)
    I/hyap.user_admi(21660):   at void android.app.ActivityThread.access$1400(android.app.ActivityThread, android.app.ActivityThread$CreateServiceData) (ActivityThread.java:235)
    I/hyap.user_admi(21660):   at void android.app.ActivityThread$H.handleMessage(android.os.Message) (ActivityThread.java:1784)
    I/hyap.user_admi(21660):   at void android.os.Handler.dispatchMessage(android.os.Message) (Handler.java:106)
    I/hyap.user_admi(21660):   at void android.os.Looper.loop() (Looper.java:214)
    I/hyap.user_admi(21660):   at void android.app.ActivityThread.main(java.lang.String[]) (ActivityThread.java:6981)
    I/hyap.user_admi(21660):   at java.lang.Object java.lang.reflect.Method.invoke(java.lang.Object, java.lang.Object[]) (Method.java:-2)
    I/hyap.user_admi(21660):   at void com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run() (RuntimeInit.java:493)
    I/hyap.user_admi(21660):   at void com.android.internal.os.ZygoteInit.main(java.lang.String[]) (ZygoteInit.java:1445)
    I/hyap.user_admi(21660):
    I/hyap.user_admi(21660): Rejecting re-init on previously-failed class java.lang.Class<io.flutter.plugins.firebasemessaging.FlutterFirebaseMessagingService>: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/firebase/messaging/FirebaseMessagingService;
    I/hyap.user_admi(21660):   at java.lang.Class java.lang.VMClassLoader.findLoadedClass(java.lang.ClassLoader, java.lang.String) (VMClassLoader.java:-2)
    I/hyap.user_admi(21660):   at java.lang.Class java.lang.ClassLoader.findLoadedClass(java.lang.String) (ClassLoader.java:738)
    I/hyap.user_admi(21660):   at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String, boolean) (ClassLoader.java:363)
    I/hyap.user_admi(21660):   at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String) (ClassLoader.java:312)
    I/hyap.user_admi(21660):   at android.app.Service android.app.AppComponentFactory.instantiateService(java.lang.ClassLoader, java.lang.String, android.content.Intent) (AppComponentFactory.java:103)
    I/hyap.user_admi(21660):   at android.app.Service androidx.core.app.CoreComponentFactory.instantiateService(java.lang.ClassLoader, java.lang.String, android.content.Intent) (CoreComponentFactory.java:68)
    I/hyap.user_admi(21660):   at void android.app.ActivityThread.handleCreateService(android.app.ActivityThread$CreateServiceData) (ActivityThread.java:3710)
    I/hyap.user_admi(21660):   at void android.app.ActivityThread.access$1400(android.app.ActivityThread, android.app.ActivityThread$CreateServiceData) (ActivityThread.java:235)
    I/hyap.user_admi(21660):   at void android.app.ActivityThread$H.handleMessage(android.os.Message) (ActivityThread.java:1784)
    I/hyap.user_admi(21660):   at void android.os.Handler.dispatchMessage(android.os.Message) (Handler.java:106)
    I/hyap.user_admi(21660):   at void android.os.Looper.loop() (Looper.java:214)
    I/hyap.user_admi(21660):   at void android.app.ActivityThread.main(java.lang.String[]) (ActivityThread.java:6981)
    I/hyap.user_admi(21660):   at java.lang.Object java.lang.reflect.Method.invoke(java.lang.Object, java.lang.Object[]) (Method.java:-2)
    I/hyap.user_admi(21660):   at void com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run() (RuntimeInit.java:493)
    I/hyap.user_admi(21660):   at void com.android.internal.os.ZygoteInit.main(java.lang.String[]) (ZygoteInit.java:1445)
    I/hyap.user_admi(21660): Caused by: java.lang.ClassNotFoundException: com.google.firebase.messaging.FirebaseMessagingService
    I/hyap.user_admi(21660):   at java.lang.Class java.lang.VMClassLoader.findLoadedClass(java.lang.ClassLoader, java.lang.String) (VMClassLoader.java:-2)
    I/hyap.user_admi(21660):   at java.lang.Class java.lang.ClassLoader.findLoadedClass(java.lang.String) (ClassLoader.java:738)
    I/hyap.user_admi(21660):   at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String, boolean) (ClassLoader.java:363)
    I/hyap.user_admi(21660):   at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String) (ClassLoader.java:312)
    I/hyap.user_admi(21660):   at java.lang.Class java.lang.VMClassLoader.findLoadedClass(java.lang.ClassLoader, java.lang.String) (VMClassLoader.java:-2)
    I/hyap.user_admi(21660):   at java.lang.Class java.lang.ClassLoader.findLoadedClass(java.lang.String) (ClassLoader.java:738)
    I/hyap.user_admi(21660):   at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String, boolean) (ClassLoader.java:363)
    I/hyap.user_admi(21660):   at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String) (ClassLoader.java:312)
    I/hyap.user_admi(21660):   at android.app.Service android.app.AppComponentFactory.instantiateService(java.lang.ClassLoader, java.lang.String, android.content.Intent) (AppComponentFactory.java:103)
    I/hyap.user_admi(21660):   at android.app.Service androidx.core.app.CoreComponentFactory.instantiateService(java.lang.ClassLoader, java.lang.String, android.content.Intent) (CoreComponentFactory.java:68)
    I/hyap.user_admi(21660):   at void android.app.ActivityThread.handleCreateService(android.app.ActivityThread$CreateServiceData) (ActivityThread.java:3710)
    I/hyap.user_admi(21660):   at void android.app.ActivityThread.access$1400(android.app.ActivityThread, android.app.ActivityThread$CreateServiceData) (ActivityThread.java:235)
    I/hyap.user_admi(21660):   at void android.app.ActivityThread$H.handleMessage(android.os.Message) (ActivityThread.java:1784)
    I/hyap.user_admi(21660):   at void android.os.Handler.dispatchMessage(android.os.Message) (Handler.java:106)
    I/hyap.user_admi(21660):   at void android.os.Looper.loop() (Looper.java:214)
    I/hyap.user_admi(21660):   at void android.app.ActivityThread.main(java.lang.String[]) (ActivityThread.java:6981)
    I/hyap.user_admi(21660):   at java.lang.Object java.lang.reflect.Method.invoke(java.lang.Object, java.lang.Object[]) (Method.java:-2)
    I/hyap.user_admi(21660):   at void com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run() (RuntimeInit.java:493)
    I/hyap.user_admi(21660):   at void com.android.internal.os.ZygoteInit.main(java.lang.String[]) (ZygoteInit.java:1445)
    I/hyap.user_admi(21660):
    D/AndroidRuntime(21660): Shutting down VM
    E/AndroidRuntime(21660): FATAL EXCEPTION: main
    E/AndroidRuntime(21660): Process: com.kashyap.user_admin, PID: 21660
    E/AndroidRuntime(21660): java.lang.RuntimeException: Unable to instantiate service io.flutter.plugins.firebasemessaging.FlutterFirebaseMessagingService: java.lang.ClassNotFoundException: Didn't find class "io.flutter.plugins.firebasemessaging.FlutterFirebaseMessagingService" on path: DexPathList[[zip file "/data/app/com.kashyap.user_admin-P6LJr-bNg8zLx2ZhadHMPA==/base.apk"],nativeLibraryDirectories=[/data/app/com.kashyap.user_admin-P6LJr-bNg8zLx2ZhadHMPA==/lib/arm64, /data/app/com.kashyap.user_admin-P6LJr-bNg8zLx2ZhadHMPA==/base.apk!/lib/arm64-v8a, /system/lib64]]
    E/AndroidRuntime(21660):    at android.app.ActivityThread.handleCreateService(ActivityThread.java:3715)
    E/AndroidRuntime(21660):    at android.app.ActivityThread.access$1400(ActivityThread.java:235)
    E/AndroidRuntime(21660):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1784)
    E/AndroidRuntime(21660):    at android.os.Handler.dispatchMessage(Handler.java:106)
    E/AndroidRuntime(21660):    at android.os.Looper.loop(Looper.java:214)
    E/AndroidRuntime(21660):    at android.app.ActivityThread.main(ActivityThread.java:6981)
    E/AndroidRuntime(21660):    at java.lang.reflect.Method.invoke(Native Method)
    E/AndroidRuntime(21660):    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
    E/AndroidRuntime(21660):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1445)
    E/AndroidRuntime(21660): Caused by: java.lang.ClassNotFoundException: Didn't find class "io.flutter.plugins.firebasemessaging.FlutterFirebaseMessagingService" on path: DexPathList[[zip file "/data/app/com.kashyap.user_admin-P6LJr-bNg8zLx2ZhadHMPA==/base.apk"],nativeLibraryDirectories=[/data/app/com.kashyap.user_admin-P6LJr-bNg8zLx2ZhadHMPA==/lib/arm64, /data/app/com.kashyap.user_admin-P6LJr-bNg8zLx2ZhadHMPA==/base.apk!/lib/arm64-v8a, /system/lib64]]
    E/AndroidRuntime(21660):    at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:134)
    E/AndroidRuntime(21660):    at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
    E/AndroidRuntime(21660):    at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
    E/AndroidRuntime(21660):    at android.app.AppComponentFactory.instantiateService(AppComponentFactory.java:103)
    E/AndroidRuntime(21660):    at androidx.core.app.CoreComponentFactory.instantiateService(CoreComponentFactory.java:68)
    E/AndroidRuntime(21660):    at android.app.ActivityThread.handleCreateService(ActivityThread.java:3710)
    E/AndroidRuntime(21660):    ... 8 more
    E/AndroidRuntime(21660):    Suppressed: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/firebase/messaging/FirebaseMessagingService;
    E/AndroidRuntime(21660):        at java.lang.VMClassLoader.findLoadedClass(Native Method)
    E/AndroidRuntime(21660):        at java.lang.ClassLoader.findLoadedClass(ClassLoader.java:738)
    E/AndroidRuntime(21660):        at java.lang.ClassLoader.loadClass(ClassLoader.java:363)
    E/AndroidRuntime(21660):        ... 12 more
    E/AndroidRuntime(21660):    Caused by: java.lang.ClassNotFoundException: com.google.firebase.messaging.FirebaseMessagingService
    E/AndroidRuntime(21660):        at java.lang.VMClassLoader.findLoadedClass(Native Method)
    E/AndroidRuntime(21660):        at java.lang.ClassLoader.findLoadedClass(ClassLoader.java:738)
    E/AndroidRuntime(21660):        at java.lang.ClassLoader.loadClass(ClassLoader.java:363)
    E/AndroidRuntime(21660):        at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
    E/AndroidRuntime(21660):        ... 15 more
    E/AndroidRuntime(21660):    Caused by: java.lang.IllegalAccessError: Class com.google.firebase.iid.zzb extended by class com.google.firebase.messaging.FirebaseMessagingService is inaccessible (declaration of 'com.google.firebase.messaging.FirebaseMessagingService' appears in /data/app/com.kashyap.user_admin-P6LJr-bNg8zLx2ZhadHMPA==/base.apk!classes2.dex)
    E/AndroidRuntime(21660):        ... 15 more
    I/Process (21660): Sending signal. PID: 21660 SIG: 9
    Lost connection to device.
</code>```

答:
The code started working when i added lates firebase core plugin and enabled androidx along with changing the gradle version from 5.1.1 to 4.10.2 and the gradle dependency in project level build.gradle to

```<code>   classpath 'com.android.tools.build:gradle:3.3.0'
</code>```

instead of:

```<code>classpath 'com.android.tools.build:gradle:3.4.0'
</code>```

Body:
I am unable to send notifications to my app from firebase, as it crashes everytime i do so

It previously showed error for latest versions of the firebase_messaging plugin, so i kept it empty so that the ide will get the latest packages.

These are my dependencies in pubspec.yaml file

dependencies:
  flutter:
    sdk: flutter

  # The following adds the Cupertino Icons font to your application.
  # Use with the CupertinoIcons class for iOS style icons.
  cupertino_icons: ^0.1.2
  #firebase_auth: ^0.10.0+1
  #firebase_core: ^0.4.0
  firebase_database: ^3.0.0
  firebase_messaging:
dev_dependencies:

My code for the push notifications is as follows:

firebaseMessaging.getToken().then((token){
      print("Token: $token");
    });

    firebaseMessaging.configure(
      onMessage: (Map<String, dynamic> message) async {
        print('on message $message');
        final notification=message['notification'];
        setState(() {
          messages.add(Message(
              title: notification['title'],body: notification['body']
          ));
        });
      },
      onResume: (Map<String, dynamic> message) async {
        print('on resume $message');
      },
      onLaunch: (Map<String, dynamic> message) async {
        print('on launch $message');
      },
    );

This the logcat summary when i run my program:

 Syncing files to device SM G960F...
    D/ViewRootImpl@df42dca[MainActivity](21660): MSG_WINDOW_FOCUS_CHANGED 1 1
    D/InputMethodManager(21660): prepareNavigationBarInfo() DecorView@b273b3b[MainActivity]
    D/InputMethodManager(21660): getNavigationBarColor() -855310
    D/InputMethodManager(21660): prepareNavigationBarInfo() DecorView@b273b3b[MainActivity]
    D/InputMethodManager(21660): getNavigationBarColor() -855310
    V/InputMethodManager(21660): Starting input: tba=com.kashyap.user_admin ic=null mNaviBarColor -855310 mIsGetNaviBarColorSuccess true , NavVisible : true , NavTrans : false
    D/InputMethodManager(21660): startInputInner - Id : 0
    I/InputMethodManager(21660): startInputInner - mService.startInputOrWindowGainedFocus
    D/InputTransport(21660): Input channel constructed: fd=105
    D/InputMethodManager(21660): prepareNavigationBarInfo() DecorView@b273b3b[MainActivity]
    D/InputMethodManager(21660): getNavigationBarColor() -855310
    V/InputMethodManager(21660): Starting input: tba=com.kashyap.user_admin ic=null mNaviBarColor -855310 mIsGetNaviBarColorSuccess true , NavVisible : true , NavTrans : false
    D/InputMethodManager(21660): startInputInner - Id : 0
    D/ViewRootImpl@df42dca[MainActivity](21660): ViewPostIme pointer 0
    D/ViewRootImpl@df42dca[MainActivity](21660): ViewPostIme pointer 1
    D/ViewRootImpl@df42dca[MainActivity](21660): MSG_WINDOW_FOCUS_CHANGED 0 1
    D/InputMethodManager(21660): prepareNavigationBarInfo() DecorView@b273b3b[MainActivity]
    D/InputMethodManager(21660): getNavigationBarColor() -855310
    D/SurfaceView(21660): windowStopped(true) false 7c74c04 of ViewRootImpl@df42dca[MainActivity]
    D/SurfaceView(21660): show() Surface(name=SurfaceView - com.kashyap.user_admin/com.kashyap.user_admin.MainActivity@7c74c04@0[21660])/@0x81cc5ed io.flutter.view.FlutterView{7c74c04 VFE...... ........ 0,0-1440,2960}
    D/SurfaceView(21660): surfaceDestroyed callback.size 1 #1 io.flutter.view.FlutterView{7c74c04 VFE...... ........ 0,0-1440,2960}
    W/libEGL  (21660): EGLNativeWindowType 0x72580fe010 disconnect failed
    D/SurfaceView(21660): destroy() Surface(name=SurfaceView - com.kashyap.user_admin/com.kashyap.user_admin.MainActivity@7c74c04@0[21660])/@0x81cc5ed io.flutter.view.FlutterView{7c74c04 VFE...... ........ 0,0-1440,2960}
    D/SurfaceView(21660): onWindowVisibilityChanged(4) false 7c74c04 of ViewRootImpl@df42dca[MainActivity]
    W/libEGL  (21660): EGLNativeWindowType 0x726fef2010 disconnect failed
    D/OpenGLRenderer(21660): eglDestroySurface = 0x7266249a00, 0x726fef2000
    D/ViewRootImpl@df42dca[MainActivity](21660): Relayout returned: old=[0,0][1440,2960] new=[0,0][1440,2960] result=0x5 surface={valid=false 0} changed=true
    D/InputTransport(21660): Input channel destroyed: fd=105
    D/SurfaceView(21660): onWindowVisibilityChanged(8) false 7c74c04 of ViewRootImpl@df42dca[MainActivity]
    D/ViewRootImpl@df42dca[MainActivity](21660): Relayout returned: old=[0,0][1440,2960] new=[0,0][1440,2960] result=0x1 surface={valid=false 0} changed=false
    I/hyap.user_admi(21660): Rejecting re-init on previously-failed class java.lang.Class<com.google.firebase.messaging.FirebaseMessagingService>: java.lang.IllegalAccessError: Class com.google.firebase.iid.zzb extended by class com.google.firebase.messaging.FirebaseMessagingService is inaccessible (declaration of 'com.google.firebase.messaging.FirebaseMessagingService' appears in /data/app/com.kashyap.user_admin-P6LJr-bNg8zLx2ZhadHMPA==/base.apk!classes2.dex)
    I/hyap.user_admi(21660):   at java.lang.Class java.lang.VMClassLoader.findLoadedClass(java.lang.ClassLoader, java.lang.String) (VMClassLoader.java:-2)
    I/hyap.user_admi(21660):   at java.lang.Class java.lang.ClassLoader.findLoadedClass(java.lang.String) (ClassLoader.java:738)
    I/hyap.user_admi(21660):   at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String, boolean) (ClassLoader.java:363)
    I/hyap.user_admi(21660):   at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String) (ClassLoader.java:312)
    I/hyap.user_admi(21660):   at android.app.Service android.app.AppComponentFactory.instantiateService(java.lang.ClassLoader, java.lang.String, android.content.Intent) (AppComponentFactory.java:103)
    I/hyap.user_admi(21660):   at android.app.Service androidx.core.app.CoreComponentFactory.instantiateService(java.lang.ClassLoader, java.lang.String, android.content.Intent) (CoreComponentFactory.java:68)
    I/hyap.user_admi(21660):   at void android.app.ActivityThread.handleCreateService(android.app.ActivityThread$CreateServiceData) (ActivityThread.java:3710)
    I/hyap.user_admi(21660):   at void android.app.ActivityThread.access$1400(android.app.ActivityThread, android.app.ActivityThread$CreateServiceData) (ActivityThread.java:235)
    I/hyap.user_admi(21660):   at void android.app.ActivityThread$H.handleMessage(android.os.Message) (ActivityThread.java:1784)
    I/hyap.user_admi(21660):   at void android.os.Handler.dispatchMessage(android.os.Message) (Handler.java:106)
    I/hyap.user_admi(21660):   at void android.os.Looper.loop() (Looper.java:214)
    I/hyap.user_admi(21660):   at void android.app.ActivityThread.main(java.lang.String[]) (ActivityThread.java:6981)
    I/hyap.user_admi(21660):   at java.lang.Object java.lang.reflect.Method.invoke(java.lang.Object, java.lang.Object[]) (Method.java:-2)
    I/hyap.user_admi(21660):   at void com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run() (RuntimeInit.java:493)
    I/hyap.user_admi(21660):   at void com.android.internal.os.ZygoteInit.main(java.lang.String[]) (ZygoteInit.java:1445)
    I/hyap.user_admi(21660):
    I/hyap.user_admi(21660): Rejecting re-init on previously-failed class java.lang.Class<io.flutter.plugins.firebasemessaging.FlutterFirebaseMessagingService>: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/firebase/messaging/FirebaseMessagingService;
    I/hyap.user_admi(21660):   at java.lang.Class java.lang.VMClassLoader.findLoadedClass(java.lang.ClassLoader, java.lang.String) (VMClassLoader.java:-2)
    I/hyap.user_admi(21660):   at java.lang.Class java.lang.ClassLoader.findLoadedClass(java.lang.String) (ClassLoader.java:738)
    I/hyap.user_admi(21660):   at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String, boolean) (ClassLoader.java:363)
    I/hyap.user_admi(21660):   at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String) (ClassLoader.java:312)
    I/hyap.user_admi(21660):   at android.app.Service android.app.AppComponentFactory.instantiateService(java.lang.ClassLoader, java.lang.String, android.content.Intent) (AppComponentFactory.java:103)
    I/hyap.user_admi(21660):   at android.app.Service androidx.core.app.CoreComponentFactory.instantiateService(java.lang.ClassLoader, java.lang.String, android.content.Intent) (CoreComponentFactory.java:68)
    I/hyap.user_admi(21660):   at void android.app.ActivityThread.handleCreateService(android.app.ActivityThread$CreateServiceData) (ActivityThread.java:3710)
    I/hyap.user_admi(21660):   at void android.app.ActivityThread.access$1400(android.app.ActivityThread, android.app.ActivityThread$CreateServiceData) (ActivityThread.java:235)
    I/hyap.user_admi(21660):   at void android.app.ActivityThread$H.handleMessage(android.os.Message) (ActivityThread.java:1784)
    I/hyap.user_admi(21660):   at void android.os.Handler.dispatchMessage(android.os.Message) (Handler.java:106)
    I/hyap.user_admi(21660):   at void android.os.Looper.loop() (Looper.java:214)
    I/hyap.user_admi(21660):   at void android.app.ActivityThread.main(java.lang.String[]) (ActivityThread.java:6981)
    I/hyap.user_admi(21660):   at java.lang.Object java.lang.reflect.Method.invoke(java.lang.Object, java.lang.Object[]) (Method.java:-2)
    I/hyap.user_admi(21660):   at void com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run() (RuntimeInit.java:493)
    I/hyap.user_admi(21660):   at void com.android.internal.os.ZygoteInit.main(java.lang.String[]) (ZygoteInit.java:1445)
    I/hyap.user_admi(21660): Caused by: java.lang.ClassNotFoundException: com.google.firebase.messaging.FirebaseMessagingService
    I/hyap.user_admi(21660):   at java.lang.Class java.lang.VMClassLoader.findLoadedClass(java.lang.ClassLoader, java.lang.String) (VMClassLoader.java:-2)
    I/hyap.user_admi(21660):   at java.lang.Class java.lang.ClassLoader.findLoadedClass(java.lang.String) (ClassLoader.java:738)
    I/hyap.user_admi(21660):   at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String, boolean) (ClassLoader.java:363)
    I/hyap.user_admi(21660):   at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String) (ClassLoader.java:312)
    I/hyap.user_admi(21660):   at java.lang.Class java.lang.VMClassLoader.findLoadedClass(java.lang.ClassLoader, java.lang.String) (VMClassLoader.java:-2)
    I/hyap.user_admi(21660):   at java.lang.Class java.lang.ClassLoader.findLoadedClass(java.lang.String) (ClassLoader.java:738)
    I/hyap.user_admi(21660):   at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String, boolean) (ClassLoader.java:363)
    I/hyap.user_admi(21660):   at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String) (ClassLoader.java:312)
    I/hyap.user_admi(21660):   at android.app.Service android.app.AppComponentFactory.instantiateService(java.lang.ClassLoader, java.lang.String, android.content.Intent) (AppComponentFactory.java:103)
    I/hyap.user_admi(21660):   at android.app.Service androidx.core.app.CoreComponentFactory.instantiateService(java.lang.ClassLoader, java.lang.String, android.content.Intent) (CoreComponentFactory.java:68)
    I/hyap.user_admi(21660):   at void android.app.ActivityThread.handleCreateService(android.app.ActivityThread$CreateServiceData) (ActivityThread.java:3710)
    I/hyap.user_admi(21660):   at void android.app.ActivityThread.access$1400(android.app.ActivityThread, android.app.ActivityThread$CreateServiceData) (ActivityThread.java:235)
    I/hyap.user_admi(21660):   at void android.app.ActivityThread$H.handleMessage(android.os.Message) (ActivityThread.java:1784)
    I/hyap.user_admi(21660):   at void android.os.Handler.dispatchMessage(android.os.Message) (Handler.java:106)
    I/hyap.user_admi(21660):   at void android.os.Looper.loop() (Looper.java:214)
    I/hyap.user_admi(21660):   at void android.app.ActivityThread.main(java.lang.String[]) (ActivityThread.java:6981)
    I/hyap.user_admi(21660):   at java.lang.Object java.lang.reflect.Method.invoke(java.lang.Object, java.lang.Object[]) (Method.java:-2)
    I/hyap.user_admi(21660):   at void com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run() (RuntimeInit.java:493)
    I/hyap.user_admi(21660):   at void com.android.internal.os.ZygoteInit.main(java.lang.String[]) (ZygoteInit.java:1445)
    I/hyap.user_admi(21660):
    D/AndroidRuntime(21660): Shutting down VM
    E/AndroidRuntime(21660): FATAL EXCEPTION: main
    E/AndroidRuntime(21660): Process: com.kashyap.user_admin, PID: 21660
    E/AndroidRuntime(21660): java.lang.RuntimeException: Unable to instantiate service io.flutter.plugins.firebasemessaging.FlutterFirebaseMessagingService: java.lang.ClassNotFoundException: Didn't find class "io.flutter.plugins.firebasemessaging.FlutterFirebaseMessagingService" on path: DexPathList[[zip file "/data/app/com.kashyap.user_admin-P6LJr-bNg8zLx2ZhadHMPA==/base.apk"],nativeLibraryDirectories=[/data/app/com.kashyap.user_admin-P6LJr-bNg8zLx2ZhadHMPA==/lib/arm64, /data/app/com.kashyap.user_admin-P6LJr-bNg8zLx2ZhadHMPA==/base.apk!/lib/arm64-v8a, /system/lib64]]
    E/AndroidRuntime(21660):    at android.app.ActivityThread.handleCreateService(ActivityThread.java:3715)
    E/AndroidRuntime(21660):    at android.app.ActivityThread.access$1400(ActivityThread.java:235)
    E/AndroidRuntime(21660):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1784)
    E/AndroidRuntime(21660):    at android.os.Handler.dispatchMessage(Handler.java:106)
    E/AndroidRuntime(21660):    at android.os.Looper.loop(Looper.java:214)
    E/AndroidRuntime(21660):    at android.app.ActivityThread.main(ActivityThread.java:6981)
    E/AndroidRuntime(21660):    at java.lang.reflect.Method.invoke(Native Method)
    E/AndroidRuntime(21660):    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
    E/AndroidRuntime(21660):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1445)
    E/AndroidRuntime(21660): Caused by: java.lang.ClassNotFoundException: Didn't find class "io.flutter.plugins.firebasemessaging.FlutterFirebaseMessagingService" on path: DexPathList[[zip file "/data/app/com.kashyap.user_admin-P6LJr-bNg8zLx2ZhadHMPA==/base.apk"],nativeLibraryDirectories=[/data/app/com.kashyap.user_admin-P6LJr-bNg8zLx2ZhadHMPA==/lib/arm64, /data/app/com.kashyap.user_admin-P6LJr-bNg8zLx2ZhadHMPA==/base.apk!/lib/arm64-v8a, /system/lib64]]
    E/AndroidRuntime(21660):    at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:134)
    E/AndroidRuntime(21660):    at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
    E/AndroidRuntime(21660):    at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
    E/AndroidRuntime(21660):    at android.app.AppComponentFactory.instantiateService(AppComponentFactory.java:103)
    E/AndroidRuntime(21660):    at androidx.core.app.CoreComponentFactory.instantiateService(CoreComponentFactory.java:68)
    E/AndroidRuntime(21660):    at android.app.ActivityThread.handleCreateService(ActivityThread.java:3710)
    E/AndroidRuntime(21660):    ... 8 more
    E/AndroidRuntime(21660):    Suppressed: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/firebase/messaging/FirebaseMessagingService;
    E/AndroidRuntime(21660):        at java.lang.VMClassLoader.findLoadedClass(Native Method)
    E/AndroidRuntime(21660):        at java.lang.ClassLoader.findLoadedClass(ClassLoader.java:738)
    E/AndroidRuntime(21660):        at java.lang.ClassLoader.loadClass(ClassLoader.java:363)
    E/AndroidRuntime(21660):        ... 12 more
    E/AndroidRuntime(21660):    Caused by: java.lang.ClassNotFoundException: com.google.firebase.messaging.FirebaseMessagingService
    E/AndroidRuntime(21660):        at java.lang.VMClassLoader.findLoadedClass(Native Method)
    E/AndroidRuntime(21660):        at java.lang.ClassLoader.findLoadedClass(ClassLoader.java:738)
    E/AndroidRuntime(21660):        at java.lang.ClassLoader.loadClass(ClassLoader.java:363)
    E/AndroidRuntime(21660):        at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
    E/AndroidRuntime(21660):        ... 15 more
    E/AndroidRuntime(21660):    Caused by: java.lang.IllegalAccessError: Class com.google.firebase.iid.zzb extended by class com.google.firebase.messaging.FirebaseMessagingService is inaccessible (declaration of 'com.google.firebase.messaging.FirebaseMessagingService' appears in /data/app/com.kashyap.user_admin-P6LJr-bNg8zLx2ZhadHMPA==/base.apk!classes2.dex)
    E/AndroidRuntime(21660):        ... 15 more
    I/Process (21660): Sending signal. PID: 21660 SIG: 9
    Lost connection to device.

Body:
The code started working when i added lates firebase core plugin and enabled androidx along with changing the gradle version from 5.1.1 to 4.10.2 and the gradle dependency in project level build.gradle to

   classpath 'com.android.tools.build:gradle:3.3.0'

instead of:

classpath 'com.android.tools.build:gradle:3.4.0'