问:
Better way to search character in vector of vectors in scala
I have a requirement where I have to search a character in vector of vectors. I have written a method which is very crude. What is a better way to search an element in vector of vectors.

Here is my code:

```<code>def search( xs: Vector[Vector[Char]], char: Char, rowIndex: Int): Pos = xs.headOption match {
  case None =>  Pos(-1, -1)
  case Some(row) => {
    val tuple = searchHelper(row, char, 0)
    if(tuple._1)
      Pos(rowIndex, tuple._2)
    else
      search(xs.tail, char, rowIndex +1)
  }
}

def searchHelper(xs: Vector[Char], char: Char, colIndex: Int): (Boolean, Int) = xs.headOption match {
  case None => (false, colIndex)
  case Some(col) =>
    if(col == char)
      (true, colIndex)
    else
      searchHelper(xs.tail, char, colIndex +1)
}

search(vector, c, 0)
</code>```

Here is the input:

```<code>val input =
  """ooo-------
    |oSoooo----
    |ooooooooo-
    |-ooooooooo
    |-----ooToo
    |------ooo-""".stripMargin

val vector =
  Vector(input.split("\n").map(str => Vector(str: _*)): _*)

val c = 'S'
</code>```

答:
Something like this, perhaps?

```<code>xs
 .iterator
 .zipWithIndex
 .map { case (chars, idx) => (idx, chars.indexOf(c)) }
 .collectFirst {
    case (outer, inner) if(inner >= 0) => Pos(outer, inner)
 }.getOrElse(Pos(-1, 1))
</code>```

To address a concern from the comments: this is not iterating through the entire list multiple times (not even once completely, as long as it finds a match earlier). Scala iterators are wonderful that way: you can write a chain of calls, that conceptually looks like a bunch of sequential transformations to the entire list, but is really executed lazily, element by element: the first element is is extracted from list, converted to a tuple (chars, 0), fed to the map, then the result of that is sent to collectFirst, if the condition matches there, it stops and returns right away, otherwise, next element is taken from list, made into a tuple (chars, 1), fed to the .map, etc ...

Body:
I have a requirement where I have to search a character in vector of vectors. I have written a method which is very crude. What is a better way to search an element in vector of vectors.

Here is my code:

def search( xs: Vector[Vector[Char]], char: Char, rowIndex: Int): Pos = xs.headOption match {
  case None =>  Pos(-1, -1)
  case Some(row) => {
    val tuple = searchHelper(row, char, 0)
    if(tuple._1)
      Pos(rowIndex, tuple._2)
    else
      search(xs.tail, char, rowIndex +1)
  }
}

def searchHelper(xs: Vector[Char], char: Char, colIndex: Int): (Boolean, Int) = xs.headOption match {
  case None => (false, colIndex)
  case Some(col) =>
    if(col == char)
      (true, colIndex)
    else
      searchHelper(xs.tail, char, colIndex +1)
}

search(vector, c, 0)

Here is the input:

val input =
  """ooo-------
    |oSoooo----
    |ooooooooo-
    |-ooooooooo
    |-----ooToo
    |------ooo-""".stripMargin

val vector =
  Vector(input.split("\n").map(str => Vector(str: _*)): _*)

val c = 'S'

Body:
Something like this, perhaps?

xs
 .iterator
 .zipWithIndex
 .map { case (chars, idx) => (idx, chars.indexOf(c)) }
 .collectFirst {
    case (outer, inner) if(inner >= 0) => Pos(outer, inner)
 }.getOrElse(Pos(-1, 1))

To address a concern from the comments: this is not iterating through the entire list multiple times (not even once completely, as long as it finds a match earlier). Scala iterators are wonderful that way: you can write a chain of calls, that conceptually looks like a bunch of sequential transformations to the entire list, but is really executed lazily, element by element: the first element is is extracted from list, converted to a tuple (chars, 0), fed to the map, then the result of that is sent to collectFirst, if the condition matches there, it stops and returns right away, otherwise, next element is taken from list, made into a tuple (chars, 1), fed to the .map, etc ...


来源: stackexchange

问:
if or condition produce "integer expression expected"
The following code produce error "integer expression expected":

```<code>for SOURCE_PATH in work/sources/*; do
    git diff --exit-code &>/dev/null || SOMETHING_TO_COMMIT=$?
    if [ "$SOMETHING_TO_COMMIT" -eq "0" ] || [ "$SOMETHING_TO_COMMIT" -eq "" ] ; then
        echo "NOTHING TO COMMIT FOR $SOURCE_PATH";
    else
        echo "COMMIT FOR $SOURCE_PATH"
        git -C "$DIR/$SOURCE_PATH" commit -F ${COMMIT_MESSAGE_FILE}
    fi
done
</code>```

Error is on line if [ "$SOMETHING_TO_COMMIT" -eq "0" ] || [ "$SOMETHING_TO_COMMIT" -eq "" ] ; then. It seems [ "$SOMETHING_TO_COMMIT" -eq "0" ]or [ "$SOMETHING_TO_COMMIT" -eq "" ] should produce integer.

How to fix that ?

答:
Between the two current answers, there is the realization that you don't have to make a conditional assignment to SOMETHING_TO_COMMIT. Just assign the exit status, zero or not, to the parameter; then it is guaranteed to have some non-empty integer value.

```<code>git diff --exit-code &>/dev/null; SOMETHING_TO_COMMIT=$?
if [ "$SOMETHING_TO_COMMIT" -eq 0 ]; then
    echo "NOTHING TO COMMIT FOR $SOURCE_PATH";
else
    echo "COMMIT FOR $SOURCE_PATH"
    git -C "$DIR/$SOURCE_PATH" commit -F ${COMMIT_MESSAGE_FILE}
fi
</code>```

As Inian points out, you don't need to save the exit status if you are only going to make one comparison; you can use the git command itself as the if condition. Saving the value is useful when you might need to make multiple comparisons:

```<code>some_command; status=$?
if [ "$status" -eq 0 ]; then
  ...
elif [ "$status" -eq 1 ]; then
  ...
else
  ...
fi
</code>```

ContentLicense: CC BY-SA 3.0

Body:
The following code produce error "integer expression expected":

for SOURCE_PATH in work/sources/*; do
    git diff --exit-code &>/dev/null || SOMETHING_TO_COMMIT=$?
    if [ "$SOMETHING_TO_COMMIT" -eq "0" ] || [ "$SOMETHING_TO_COMMIT" -eq "" ] ; then
        echo "NOTHING TO COMMIT FOR $SOURCE_PATH";
    else
        echo "COMMIT FOR $SOURCE_PATH"
        git -C "$DIR/$SOURCE_PATH" commit -F ${COMMIT_MESSAGE_FILE}
    fi
done

Error is on line if [ "$SOMETHING_TO_COMMIT" -eq "0" ] || [ "$SOMETHING_TO_COMMIT" -eq "" ] ; then. It seems [ "$SOMETHING_TO_COMMIT" -eq "0" ]or [ "$SOMETHING_TO_COMMIT" -eq "" ] should produce integer.

How to fix that ?

Body:
Between the two current answers, there is the realization that you don't have to make a conditional assignment to SOMETHING_TO_COMMIT. Just assign the exit status, zero or not, to the parameter; then it is guaranteed to have some non-empty integer value.

git diff --exit-code &>/dev/null; SOMETHING_TO_COMMIT=$?
if [ "$SOMETHING_TO_COMMIT" -eq 0 ]; then
    echo "NOTHING TO COMMIT FOR $SOURCE_PATH";
else
    echo "COMMIT FOR $SOURCE_PATH"
    git -C "$DIR/$SOURCE_PATH" commit -F ${COMMIT_MESSAGE_FILE}
fi

As Inian points out, you don't need to save the exit status if you are only going to make one comparison; you can use the git command itself as the if condition. Saving the value is useful when you might need to make multiple comparisons:

some_command; status=$?
if [ "$status" -eq 0 ]; then
  ...
elif [ "$status" -eq 1 ]; then
  ...
else
  ...
fi


问:
Python could not import the module virtualenvwrapper.hook_loader?
If Python could not import the module virtualenvwrapper.hook_loader,
and I get this message

```<code>check that virtualenvwrapper has been installed for
VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3 and that PATH is
set properly.
</code>```

How do I start to set it up in Debian 9?

答:
You have to install virtualenvwrapper separately for different versions of Python:

```<code>pip install virtualenvwrapper
pip3 install virtualenvwrapper
</code>```

The first one is for Python 2.7, the second for Python 3.

Body:
If Python could not import the module virtualenvwrapper.hook_loader,
and I get this message

check that virtualenvwrapper has been installed for
VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3 and that PATH is
set properly.

How do I start to set it up in Debian 9?

Body:
You have to install virtualenvwrapper separately for different versions of Python:

pip install virtualenvwrapper
pip3 install virtualenvwrapper

The first one is for Python 2.7, the second for Python 3.


问:
Get UPN or email for logged in user in a .NET web application
I'm not a .NET developer, and I have a feeling this would be trivial for someone who is:

I have a C# web application that makes user of the user credentials of the logged in user. Currently it uses the SID which comes from

```<code>System.Security.Principal.WindowsIdentity.GetCurrent().User.Value
</code>```

I need to get either the users UPN login or email address (as defined in active directory) instead of the SID.  GetCurrent() returns an object of type WindowsIdentity; looking in the details for WindowsIdentity Members:

MSDN: WindowsIdentity Members

I can't see anything that looks like it would give me either the UPN or email in there.  How can I pull up that information to use, either by feeding the SID into some other function or calling something different in the first place.

答:
Meanwhile (.NET 3.5) this is a one-liner:

```<code>System.DirectoryServices.AccountManagement.UserPrincipal.Current.EmailAddress
</code>```

for the email, or

```<code>System.DirectoryServices.AccountManagement.UserPrincipal.Current.UserPrincipalName
</code>```

for the UPN.

ContentLicense: CC BY-SA 2.5

Body:
I'm not a .NET developer, and I have a feeling this would be trivial for someone who is:

I have a C# web application that makes user of the user credentials of the logged in user. Currently it uses the SID which comes from

System.Security.Principal.WindowsIdentity.GetCurrent().User.Value

I need to get either the users UPN login or email address (as defined in active directory) instead of the SID.  GetCurrent() returns an object of type WindowsIdentity; looking in the details for WindowsIdentity Members:

MSDN: WindowsIdentity Members

I can't see anything that looks like it would give me either the UPN or email in there.  How can I pull up that information to use, either by feeding the SID into some other function or calling something different in the first place.

Body:
Meanwhile (.NET 3.5) this is a one-liner:

System.DirectoryServices.AccountManagement.UserPrincipal.Current.EmailAddress

for the email, or

System.DirectoryServices.AccountManagement.UserPrincipal.Current.UserPrincipalName

for the UPN.


问:
Is it possible to create child/split edges using JGraphx
In HelloWorld example of JGraphx, if we insert two edges between the vertices, the edges are overlapped. Is there a way to make them split, like shown in this image:

答: It is not possible :( (atleast as of now).</p>


问:
Capture Android Emulator traffic using Fiddler
I've been trying to capture the network traffic populated from the browser and an app hosted inside the Android emulator, using Fiddler.

I've been unsuccessful even after following the workarounds of adding proxy to the emulator (Settings - More - Cellular Networks - Access Point Names - adding the system IP and port).

答:
You should enter this ip-address: 10.0.2.2 as a Proxy-address. You should use it cause of Android emulator haven't direct access to your local network and can't connect to local computer.
But Android Emulator has a virtual router, so you can connect to your computer by address 10.0.2.2. You can read more here

-OR-

You can use Visual Studio Android Emulator. There's using Hyper-V virtual network adapter that can connect directly to your local network


问:
GooglePlayServices Admob issue : "Failed to load ad : 0"
I have a problem with the new admob.

Here is my code, trying to create and load an ad in my main activity :

```<code>private void createAndLoadAd(String adUnitID, RelativeLayout rlRoot, View upperView){
    adView = new AdView(this);
    adView.setAdUnitId(adUnitID);
    adView.setAdSize(AdSize.BANNER);
    adView.setId(R.id.ad_view);

    RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(AdView.LayoutParams.WRAP_CONTENT, AdView.LayoutParams.WRAP_CONTENT);
    params.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
    params.addRule(RelativeLayout.CENTER_HORIZONTAL, RelativeLayout.TRUE);

    rlRoot.addView(adView, params);

    RelativeLayout.LayoutParams upperViewParams = (RelativeLayout.LayoutParams) upperView.getLayoutParams();
    upperViewParams.addRule(RelativeLayout.ABOVE, R.id.ad_view);
    upperView.setLayoutParams(upperViewParams);

    AdRequest adRequest = new AdRequest.Builder().build();
    adView.loadAd(adRequest);
    checkGooglePlayServices(this);
}
</code>```

I have a RelativeLayout in my XML, and I'm trying to place the ad just below an ExpandableListView (only child).

Here is what I get :

W/Ads﹕ There was a problem getting an ad response. ErrorCode: 0 W/Ads﹕

Failed to load ad: 0

I precise that I have all the permission needed in my AndroidManifest.xml :

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

<meta-data android:name="com.google.android.gms.version"
               android:value="@integer/google_play_services_version" />

<activity android:name="com.google.android.gms.ads.AdActivity"
              android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"
              android:theme="@android:style/Theme.Translucent" />
</code>```

And here is the gradle line :

```<code>compile 'com.google.android.gms:play-services:6.+'
</code>```

I read that the error may come from the adUnitID, I tried to recreate a new one but didn't work.

Maybe there is some new rules that if the application is not released in the market, ads won't work ?

Here is the log concerning the problem :

```<code>01-31 09:48:37.687  19580-19580/me.frozened.rappel I/Ads﹕ Starting ad request.
01-31 09:48:37.872  19580-19580/me.frozened.rappel E/﹕ file /data/data/com.nvidia.NvCPLSvc/files/driverlist.txt: not found!
01-31 09:48:37.872  19580-19580/me.frozened.rappel I/﹕ Attempting to load EGL implementation /system/lib//egl/libEGL_tegra_impl
01-31 09:48:37.887  19580-19580/me.frozened.rappel I/﹕ Loaded EGL implementation /system/lib//egl/libEGL_tegra_impl
01-31 09:48:37.912  19580-19580/me.frozened.rappel I/﹕ Loading GLESv2 implementation /system/lib//egl/libGLESv2_tegra_impl
01-31 09:48:40.767  19580-19580/me.frozened.rappel W/KeyCharacterMap﹕ Load KCM of non-default device may incur unexpected result
01-31 09:48:48.217  19580-19617/me.frozened.rappel W/Ads﹕ There was a problem getting an ad response. ErrorCode: 0
01-31 09:48:48.222  19580-19580/me.frozened.rappel W/dalvikvm﹕ VFY: unable to resolve virtual method 3114: Landroid/webkit/WebView;.evaluateJavascript (Ljava/lang/String;Landroid/webkit/ValueCallback;)V
01-31 09:48:48.302  19580-19833/me.frozened.rappel W/﹕ init htc webcore
01-31 09:48:48.337  19580-19580/me.frozened.rappel W/Ads﹕ Failed to load ad: 0
</code>```

Edit :

The problem seems to be not isolated. I did a lot of tests, and from my ten tests, only two worked. I don't understand, maybe the new admob is not working very well ?

I tested these applications on the following devices :

HTC One X <- Not working (the logs are for this one)

Nexus 5 <- Working

Samsung Galaxy Note 10.1 <- Not working

Sasmung Galaxy Ace <- Not working

Samsung Galaxy Note 3 <- Not working

Sony Xperia Z <- Working

Samsung Galaxy Alpha <- Not Working

Samsung Galaxy S3 <- Not working

Some of theses phones are using the latest version of Google Play Services (my HTC One X, my Nexus 5, the Galaxy Note 3). I don't know for the other ones.

Here are the two apps I tested :
 - Rappel <- The first problematic app
 - My Word Book <- An old app whom I'm sure the ads worked before
 - BMI <- A friend app in the same situation

So I have two hypothesis : either I tested these applications on phones who are not working very well (I would belive it...), or there is some permission/code I forgot to add.

Plus, my HTC One X doesn't have a SIM card (I only use Internet). May this be the problem for this phone ?

答:
In My case i forget to use

.addTestDevice("1C51F744DXXXXXXXX64F06586C84EF")

You will get your device id in the log.

Body:
I have a problem with the new admob.

Here is my code, trying to create and load an ad in my main activity :

private void createAndLoadAd(String adUnitID, RelativeLayout rlRoot, View upperView){
    adView = new AdView(this);
    adView.setAdUnitId(adUnitID);
    adView.setAdSize(AdSize.BANNER);
    adView.setId(R.id.ad_view);

    RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(AdView.LayoutParams.WRAP_CONTENT, AdView.LayoutParams.WRAP_CONTENT);
    params.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
    params.addRule(RelativeLayout.CENTER_HORIZONTAL, RelativeLayout.TRUE);

    rlRoot.addView(adView, params);

    RelativeLayout.LayoutParams upperViewParams = (RelativeLayout.LayoutParams) upperView.getLayoutParams();
    upperViewParams.addRule(RelativeLayout.ABOVE, R.id.ad_view);
    upperView.setLayoutParams(upperViewParams);

    AdRequest adRequest = new AdRequest.Builder().build();
    adView.loadAd(adRequest);
    checkGooglePlayServices(this);
}

I have a RelativeLayout in my XML, and I'm trying to place the ad just below an ExpandableListView (only child).

Here is what I get :

W/Ads﹕ There was a problem getting an ad response. ErrorCode: 0 W/Ads﹕

Failed to load ad: 0

I precise that I have all the permission needed in my AndroidManifest.xml :

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

<meta-data android:name="com.google.android.gms.version"
               android:value="@integer/google_play_services_version" />

<activity android:name="com.google.android.gms.ads.AdActivity"
              android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"
              android:theme="@android:style/Theme.Translucent" />

And here is the gradle line :

compile 'com.google.android.gms:play-services:6.+'

I read that the error may come from the adUnitID, I tried to recreate a new one but didn't work.

Maybe there is some new rules that if the application is not released in the market, ads won't work ?

Here is the log concerning the problem :

01-31 09:48:37.687  19580-19580/me.frozened.rappel I/Ads﹕ Starting ad request.
01-31 09:48:37.872  19580-19580/me.frozened.rappel E/﹕ file /data/data/com.nvidia.NvCPLSvc/files/driverlist.txt: not found!
01-31 09:48:37.872  19580-19580/me.frozened.rappel I/﹕ Attempting to load EGL implementation /system/lib//egl/libEGL_tegra_impl
01-31 09:48:37.887  19580-19580/me.frozened.rappel I/﹕ Loaded EGL implementation /system/lib//egl/libEGL_tegra_impl
01-31 09:48:37.912  19580-19580/me.frozened.rappel I/﹕ Loading GLESv2 implementation /system/lib//egl/libGLESv2_tegra_impl
01-31 09:48:40.767  19580-19580/me.frozened.rappel W/KeyCharacterMap﹕ Load KCM of non-default device may incur unexpected result
01-31 09:48:48.217  19580-19617/me.frozened.rappel W/Ads﹕ There was a problem getting an ad response. ErrorCode: 0
01-31 09:48:48.222  19580-19580/me.frozened.rappel W/dalvikvm﹕ VFY: unable to resolve virtual method 3114: Landroid/webkit/WebView;.evaluateJavascript (Ljava/lang/String;Landroid/webkit/ValueCallback;)V
01-31 09:48:48.302  19580-19833/me.frozened.rappel W/﹕ init htc webcore
01-31 09:48:48.337  19580-19580/me.frozened.rappel W/Ads﹕ Failed to load ad: 0

Edit :

The problem seems to be not isolated. I did a lot of tests, and from my ten tests, only two worked. I don't understand, maybe the new admob is not working very well ?

I tested these applications on the following devices :

HTC One X <- Not working (the logs are for this one)

Nexus 5 <- Working

Samsung Galaxy Note 10.1 <- Not working

Sasmung Galaxy Ace <- Not working

Samsung Galaxy Note 3 <- Not working

Sony Xperia Z <- Working

Samsung Galaxy Alpha <- Not Working

Samsung Galaxy S3 <- Not working

Some of theses phones are using the latest version of Google Play Services (my HTC One X, my Nexus 5, the Galaxy Note 3). I don't know for the other ones.

Here are the two apps I tested :
 - Rappel <- The first problematic app
 - My Word Book <- An old app whom I'm sure the ads worked before
 - BMI <- A friend app in the same situation

So I have two hypothesis : either I tested these applications on phones who are not working very well (I would belive it...), or there is some permission/code I forgot to add.

Plus, my HTC One X doesn't have a SIM card (I only use Internet). May this be the problem for this phone ?


问:
How to prevent background image being squeezed when the keyboard opens?
I'm using Xamarin.Forms and is targeting iOS and Android.

Default view

Keyboard opened and the background image squeezed

Background image squeezed as well in landscape mode

XAML

```<code><?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             x:Class="XilnexOTM.Views.LoginPage"
             BackgroundImage="bg1.png" >
    <ScrollView>
        <StackLayout Orientation="Vertical">
            <Label Text="PICTURE"  />
            <Label Text="PIC 2" />

            <Entry Placeholder="Username" />
            <Entry Placeholder="Password" IsPassword="true"/>

            <Button x:Name="btn_Login"
                    Text="Login"
                    BackgroundColor="#FF0000"/>

        </StackLayout>
    </ScrollView>
</ContentPage>
</code>```

Is there any possible way by applying the concept in CSS to Xamarin.Forms ?

```<code>xx {
 background-size: cover;
 background-position: right bottom;
}
</code>```

答:
I prefer doing by code, here is my solution:

I always have my Device Screen like this in my App.xaml:

```<code>    public static double ScreenWidth { get; set; }
    public static double ScreenHeight { get; set; }
</code>```

Then in my Android Main Activity:

```<code>        Passapp.App.ScreenWidth = (double)(Resources.DisplayMetrics.WidthPixels / Resources.DisplayMetrics.Density);
        Passapp.App.ScreenHeight = (double)(Resources.DisplayMetrics.HeightPixels / Resources.DisplayMetrics.Density);
</code>```

And in my iOS AppDelegate:

```<code>App.ScreenWidth = UIScreen.MainScreen.Bounds.Width;
        App.ScreenHeight = UIScreen.MainScreen.Bounds.Height;
</code>```

So when You have your Screen Width and Height you can do this in whatever page you have:

```<code>public partial class MyPage : ContentPage
{

    public MyPage()
    {
        InitializeComponent();

        NavigationPage.SetHasNavigationBar(this, false);

        var layout = new AbsoluteLayout();

#if __ANDROID__

        BackgroundImage = "Background";
#endif

#if __IOS__
        Image img = new Image()
        {
            Source = "Background",
            Aspect = Aspect.Fill
        };

        layout.Children.Add(img, new Rectangle(0, 0, App.ScreenWidth, App.ScreenHeight));
#endif

        Content = layout;
    }
}
</code>```

Body:
I'm using Xamarin.Forms and is targeting iOS and Android.

Default view

Keyboard opened and the background image squeezed

Background image squeezed as well in landscape mode

XAML

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             x:Class="XilnexOTM.Views.LoginPage"
             BackgroundImage="bg1.png" >
    <ScrollView>
        <StackLayout Orientation="Vertical">

            <Entry Placeholder="Username" />
            <Entry Placeholder="Password" IsPassword="true"/>

            <Button x:Name="btn_Login"
                    Text="Login"
                    BackgroundColor="#FF0000"/>

        </StackLayout>
    </ScrollView>
</ContentPage>

Is there any possible way by applying the concept in CSS to Xamarin.Forms ?

xx {
 background-size: cover;
 background-position: right bottom;
}

Body:
I prefer doing by code, here is my solution:

I always have my Device Screen like this in my App.xaml:

    public static double ScreenWidth { get; set; }
    public static double ScreenHeight { get; set; }

Then in my Android Main Activity:

        Passapp.App.ScreenWidth = (double)(Resources.DisplayMetrics.WidthPixels / Resources.DisplayMetrics.Density);
        Passapp.App.ScreenHeight = (double)(Resources.DisplayMetrics.HeightPixels / Resources.DisplayMetrics.Density);

And in my iOS AppDelegate:

App.ScreenWidth = UIScreen.MainScreen.Bounds.Width;
        App.ScreenHeight = UIScreen.MainScreen.Bounds.Height;

So when You have your Screen Width and Height you can do this in whatever page you have:

public partial class MyPage : ContentPage
{

    public MyPage()
    {
        InitializeComponent();

        NavigationPage.SetHasNavigationBar(this, false);

        var layout = new AbsoluteLayout();

#if __ANDROID__

        BackgroundImage = "Background";
#endif

#if __IOS__
        Image img = new Image()
        {
            Source = "Background",
            Aspect = Aspect.Fill
        };

        layout.Children.Add(img, new Rectangle(0, 0, App.ScreenWidth, App.ScreenHeight));
#endif

        Content = layout;
    }
}


问:
Win32_DiskDrive Signature property
Does anybody know what is the Signature property of the Win32_DiskDrive WMI class?
Is it unique or users can change it like disk volume serial number?

Thanks.

答:
i can help you with by giving some important details about "Win32_DiskDrive WMI class".

copy following code to your c# project.

```<code>    public static string HardDiskID()
    {
        ManagementClass partionsClass = new ManagementClass("Win32_DiskDrive");
        ManagementObjectCollection partions = partionsClass.GetInstances();

        string hdd = string.Empty;

        foreach (ManagementObject partion in partions)
        {
            hdd = Convert.ToString(partion["SerialNumber"]);

            if (hdd != string.Empty)
                return hdd;
        }

        return hdd;
    }
</code>```

Note--above code's "SerialNumber" string can replace with following any hard disk attributes.

```<code>  uint16   Availability;
  uint32   BytesPerSector;
  uint16   Capabilities[];
  string   CapabilityDescriptions[];
  string   Caption;
  string   CompressionMethod;
  uint32   ConfigManagerErrorCode;
  boolean  ConfigManagerUserConfig;
  string   CreationClassName;
  uint64   DefaultBlockSize;
  string   Description;
  string   DeviceID;
  boolean  ErrorCleared;
  string   ErrorDescription;
  string   ErrorMethodology;
  string   FirmwareRevision;
  uint32   Index;
  datetime InstallDate;
  string   InterfaceType;
  uint32   LastErrorCode;
  string   Manufacturer;
  uint64   MaxBlockSize;
  uint64   MaxMediaSize;
  boolean  MediaLoaded;
  string   MediaType;
  uint64   MinBlockSize;
  string   Model;
  string   Name;
  boolean  NeedsCleaning;
  uint32   NumberOfMediaSupported;
  uint32   Partitions;
  string   PNPDeviceID;
  uint16   PowerManagementCapabilities[];
  boolean  PowerManagementSupported;
  uint32   SCSIBus;
  uint16   SCSILogicalUnit;
  uint16   SCSIPort;
  uint16   SCSITargetId;
  uint32   SectorsPerTrack;
  string   SerialNumber;
  uint32   Signature;
  uint64   Size;
  string   Status;
  uint16   StatusInfo;
  string   SystemCreationClassName;
  string   SystemName;
  uint64   TotalCylinders;
  uint32   TotalHeads;
  uint64   TotalSectors;
  uint64   TotalTracks;
  uint32   TracksPerCylinder
</code>```

Title: Win32_DiskDrive Signature property

Body:
i can help you with by giving some important details about "Win32_DiskDrive WMI class".

copy following code to your c# project.

    public static string HardDiskID()
    {
        ManagementClass partionsClass = new ManagementClass("Win32_DiskDrive");
        ManagementObjectCollection partions = partionsClass.GetInstances();

        string hdd = string.Empty;

        foreach (ManagementObject partion in partions)
        {
            hdd = Convert.ToString(partion["SerialNumber"]);

            if (hdd != string.Empty)
                return hdd;
        }

        return hdd;
    }

Note--above code's "SerialNumber" string can replace with following any hard disk attributes.

  uint16   Availability;
  uint32   BytesPerSector;
  uint16   Capabilities[];
  string   CapabilityDescriptions[];
  string   Caption;
  string   CompressionMethod;
  uint32   ConfigManagerErrorCode;
  boolean  ConfigManagerUserConfig;
  string   CreationClassName;
  uint64   DefaultBlockSize;
  string   Description;
  string   DeviceID;
  boolean  ErrorCleared;
  string   ErrorDescription;
  string   ErrorMethodology;
  string   FirmwareRevision;
  uint32   Index;
  datetime InstallDate;
  string   InterfaceType;
  uint32   LastErrorCode;
  string   Manufacturer;
  uint64   MaxBlockSize;
  uint64   MaxMediaSize;
  boolean  MediaLoaded;
  string   MediaType;
  uint64   MinBlockSize;
  string   Model;
  string   Name;
  boolean  NeedsCleaning;
  uint32   NumberOfMediaSupported;
  uint32   Partitions;
  string   PNPDeviceID;
  uint16   PowerManagementCapabilities[];
  boolean  PowerManagementSupported;
  uint32   SCSIBus;
  uint16   SCSILogicalUnit;
  uint16   SCSIPort;
  uint16   SCSITargetId;
  uint32   SectorsPerTrack;
  string   SerialNumber;
  uint32   Signature;
  uint64   Size;
  string   Status;
  uint16   StatusInfo;
  string   SystemCreationClassName;
  string   SystemName;
  uint64   TotalCylinders;
  uint32   TotalHeads;
  uint64   TotalSectors;
  uint64   TotalTracks;
  uint32   TracksPerCylinder


问:
Current country's emergency telephone numbers using location
I have been trying to find an API which gives the current country's emergency contact number (i.e. for US 911, India 100,101,102).

Is there any way to get the emergency call number using my current location?

I already checked Programmatically making an emergency call on iPhone, but it does not return the current county's emergency number.

答: There is no API in Cocoa Touch to get such information based on user's location</p>


问:
libgdx how to split the screen to 4 parts
This is how I want my screen to look like:

In the left up corner I need to have 6 3d models So I will do that using the PerspectiveCamera. the right up corner jest need to present some data so I will do that using the scene2d. The bottom left corner need a combination when the 3d models will be drown with a batch.dra() and the PerspectiveCamera and the data about the models will be a scene2d. In the right bottom I jest need a scene2d table to show all the connected users. My question is how do I split my screen to 4 so every part of the screen will be rendered differently.

答:
You can try offsetting the viewport with setScreenX, setScreenY and screenBounds. You do need to use 2 viewports now.

Otherwise it is possible to alter the viewport directly. Gdx.gl.glViewport( 0,Gdx.graphics.getHeight() / 2,Gdx.graphics.getWidth()/2,Gdx.graphics.getHeight() / 2 ); should draw everything in the upper corner. In update it will look like this:

```<code>`Gdx.gl.glViewport( 0,Gdx.graphics.getHeight() / 2,Gdx.graphics.getWidth()/2,Gdx.graphics.getHeight() / 2 );
//Draw upper right window stuff

Gdx.gl.glViewport( 0,0, Gdx.graphics.getWidth(),Gdx.graphics.getHeight());
//Draw your stage and just leave the upper right window/table cell transparent
</code>```

I didn't test out either solution so I'm not sure if it will work for you.

Body:
You can try offsetting the viewport with setScreenX, setScreenY and screenBounds. You do need to use 2 viewports now.

Otherwise it is possible to alter the viewport directly. Gdx.gl.glViewport( 0,Gdx.graphics.getHeight() / 2,Gdx.graphics.getWidth()/2,Gdx.graphics.getHeight() / 2 ); should draw everything in the upper corner. In update it will look like this:

`Gdx.gl.glViewport( 0,Gdx.graphics.getHeight() / 2,Gdx.graphics.getWidth()/2,Gdx.graphics.getHeight() / 2 );
//Draw upper right window stuff

Gdx.gl.glViewport( 0,0, Gdx.graphics.getWidth(),Gdx.graphics.getHeight());
//Draw your stage and just leave the upper right window/table cell transparent

I didn't test out either solution so I'm not sure if it will work for you.


问:
MySQL crashes with "buffer overflow detected" when Spring Boot connects
I'm having this hair-pulling issue that has me completely stumped, where spring boot causes mysql to crash. The second my spring-boot app connects to the MySQL, mysqld immediately crashes, with the MySQL logs complaining of a buffer overflow.

This is the spring boot log output:

```<code>:: JHipster  :: Running Spring Boot 1.3.1.RELEASE ::
:: http://jhipster.github.io ::
2017-05-24 17:54:37.811 INFO 5 --- [ main] com.REDACTED.Application : Starting Application on 79ec0626388d with PID 5 (started by root in /)
2017-05-24 17:54:37.815 DEBUG 5 --- [ main] com.REDACTED.Application : Running with Spring Boot v1.3.1.RELEASE, Spring v4.2.4.RELEASE
2017-05-24 17:54:37.815 INFO 5 --- [ main] com.REDACTED.Application : The following profiles are active: aws
2017-05-24 17:54:41.162 DEBUG 5 --- [ main] c.REDACTED.config.AsyncConfiguration : Creating Async Task Executor
2017-05-24 17:54:41.479 DEBUG 5 --- [ main] c.REDACTED.config.MetricsConfiguration : Registering JVM gauges
2017-05-24 17:54:41.564 DEBUG 5 --- [ main] c.REDACTED.config.MetricsConfiguration : Initializing Metrics JMX reporting
2017-05-24 17:54:41.817 DEBUG 5 --- [ main] c.REDACTED.config.CacheConfiguration : Configuring Hazelcast
2017-05-24 17:54:41.859 INFO 5 --- [ main] c.h.instance.DefaultAddressPicker : [LOCAL] [dev] [3.5.4] Prefer IPv4 stack is true.
2017-05-24 17:54:41.868 INFO 5 --- [ main] c.h.instance.DefaultAddressPicker : [LOCAL] [dev] [3.5.4] Picked Address[10.255.0.6]:5701, using socket ServerSocket[addr=/0:0:0:0:0:0:0:0,localport=5701], bind any local is true
2017-05-24 17:54:42.086 INFO 5 --- [ main] com.hazelcast.spi.OperationService : [10.255.0.6]:5701 [dev] [3.5.4] Backpressure is disabled
2017-05-24 17:54:42.294 INFO 5 --- [ main] c.h.s.i.o.c.ClassicOperationExecutor : [10.255.0.6]:5701 [dev] [3.5.4] Starting with 2 generic operation threads and 2 partition operation threads.
2017-05-24 17:54:42.618 INFO 5 --- [ main] com.hazelcast.system : [10.255.0.6]:5701 [dev] [3.5.4] Hazelcast 3.5.4 (20151125 - 56676b2) starting at Address[10.255.0.6]:5701
2017-05-24 17:54:42.619 INFO 5 --- [ main] com.hazelcast.system : [10.255.0.6]:5701 [dev] [3.5.4] Copyright (c) 2008-2015, Hazelcast, Inc. All Rights Reserved.
2017-05-24 17:54:42.627 INFO 5 --- [ main] com.hazelcast.instance.Node : [10.255.0.6]:5701 [dev] [3.5.4] Creating MulticastJoiner
2017-05-24 17:54:42.631 INFO 5 --- [ main] com.hazelcast.core.LifecycleService : [10.255.0.6]:5701 [dev] [3.5.4] Address[10.255.0.6]:5701 is STARTING
2017-05-24 17:54:45.355 INFO 5 --- [ main] c.h.cluster.impl.MulticastJoiner : [10.255.0.6]:5701 [dev] [3.5.4]
Members [1] {
Member [10.255.0.6]:5701 this
}
2017-05-24 17:54:45.384 INFO 5 --- [ main] com.hazelcast.core.LifecycleService : [10.255.0.6]:5701 [dev] [3.5.4] Address[10.255.0.6]:5701 is STARTED
2017-05-24 17:54:45.468 DEBUG 5 --- [ cached3] s.n.www.protocol.http.HttpURLConnection : sun.net.www.MessageHeader@2c50466c5 pairs: {GET /version.jsp?version=3.5.4&m=a366cca8-f169-457f-8220-48a80ed9cad2&e=false&l=NULL&p=maven&c=552bbbc9-7e70-4d67-a550-c6f31ad43aa3&crsz=A&cssz=A&hdgb=0&ccpp=0&cdn=0&cjv=0&cuptm=27&nuptm=9368 HTTP/1.1: null}{User-Agent: Mozilla/5.0}{Host: versioncheck.hazelcast.com}{Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2}{Connection: keep-alive}
2017-05-24 17:54:45.470 DEBUG 5 --- [ cached3] s.n.www.protocol.http.HttpURLConnection : sun.net.www.MessageHeader@7202deab5 pairs: {null: HTTP/1.1 200 OK}{Server: Apache-Coyote/1.1}{Content-Type: text/xml;charset=UTF-8}{Transfer-Encoding: chunked}{Date: Wed, 24 May 2017 17:54:45 GMT}
2017-05-24 17:54:45.662 WARN 5 --- [ main] io.undertow.websockets.jsr : UT026009: XNIO worker was not set on WebSocketDeploymentInfo, the default worker will be used
2017-05-24 17:54:45.756 WARN 5 --- [ main] io.undertow.websockets.jsr : UT026010: Buffer pool was not set on WebSocketDeploymentInfo, the default pool will be used
2017-05-24 17:54:46.289 INFO 5 --- [ main] com.REDACTED.config.WebConfigurer : Web application configuration, using profiles: [aws]
2017-05-24 17:54:46.289 DEBUG 5 --- [ main] com.REDACTED.config.WebConfigurer : Registering Clustered Http Session Filter
2017-05-24 17:54:46.294 DEBUG 5 --- [ main] com.REDACTED.config.WebConfigurer : Initializing Metrics registries
2017-05-24 17:54:46.297 DEBUG 5 --- [ main] com.REDACTED.config.WebConfigurer : Registering Metrics Filter
2017-05-24 17:54:46.298 DEBUG 5 --- [ main] com.REDACTED.config.WebConfigurer : Registering Metrics Servlet
2017-05-24 17:54:46.301 INFO 5 --- [ main] com.REDACTED.config.WebConfigurer : Web application fully configured
2017-05-24 17:54:46.428 DEBUG 5 --- [ main] c.REDACTED.config.CacheConfiguration : Starting HazelcastCacheManager
2017-05-24 17:54:46.434 DEBUG 5 --- [ main] c.REDACTED.config.DatabaseConfiguration : Configuring Datasource
2017-05-24 17:54:46.995 WARN 5 --- [ main] ationConfigEmbeddedWebApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private javax.sql.DataSource org.springframework.boot.autoconfigure.orm.jpa.JpaBaseConfiguration.dataSource; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [com/REDACTED/config/DatabaseConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [javax.sql.DataSource]: Factory method 'dataSource' threw exception; nested exception is com.zaxxer.hikari.pool.PoolInitializationException: Exception during pool initialization: Communications link failure
</code>```

And the mysql output:

```<code>2017-05-24 17:53:57 1 [Note] Plugin 'FEDERATED' is disabled.
2017-05-24 17:53:57 1 [Note] InnoDB: Using atomics to ref count buffer pool pages
2017-05-24 17:53:57 1 [Note] InnoDB: The InnoDB memory heap is disabled
2017-05-24 17:53:57 1 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2017-05-24 17:53:57 1 [Note] InnoDB: Memory barrier is not used
2017-05-24 17:53:57 1 [Note] InnoDB: Compressed tables use zlib 1.2.7
2017-05-24 17:53:57 1 [Note] InnoDB: Using Linux native AIO
2017-05-24 17:53:57 1 [Note] InnoDB: Using CPU crc32 instructions
2017-05-24 17:53:57 1 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2017-05-24 17:53:57 1 [Note] InnoDB: Completed initialization of buffer pool
2017-05-24 17:53:57 1 [Note] InnoDB: Highest supported file format is Barracuda.
2017-05-24 17:53:57 1 [Note] InnoDB: 128 rollback segment(s) are active.
2017-05-24 17:53:57 1 [Note] InnoDB: Waiting for purge to start
2017-05-24 17:53:57 1 [Note] InnoDB: 5.6.23 started; log sequence number 28560957
2017-05-24 17:53:57 1 [Note] Server hostname (bind-address): '*'; port: 3306
2017-05-24 17:53:57 1 [Note] IPv6 is available.
2017-05-24 17:53:57 1 [Note] - '::' resolves to '::';
2017-05-24 17:53:57 1 [Note] Server socket created on IP: '::'.
2017-05-24 17:53:57 1 [Note] Event Scheduler: Loaded 0 events
2017-05-24 17:53:57 1 [Note] mysqld: ready for connections.
Version: '5.6.23' socket: '/var/run/mysqld/mysqld.sock' port: 3306 MySQL Community Server (GPL)
*** buffer overflow detected ***: mysqld terminated
======= Backtrace: =========
/lib/x86_64-linux-gnu/libc.so.6(__fortify_fail+0x37)[0x7ffb11e380e7]
/lib/x86_64-linux-gnu/libc.so.6(+0xeefa0)[0x7ffb11e36fa0]
mysqld(_Z19find_or_create_hostP10PFS_threadPKcj+0x1d3)[0xac1473]
mysqld(_Z22find_or_create_accountP10PFS_threadPKcjS2_j+0x301)[0xabbc21]
mysqld(_Z18set_thread_accountP10PFS_thread+0x3d)[0xac5afd]
mysqld[0xae6e1d]
mysqld(_Z16acl_authenticateP3THDj+0xba4)[0x6b9814]
mysqld[0x6dd17b]
mysqld(_Z16login_connectionP3THD+0x45)[0x6de055]
mysqld(_Z22thd_prepare_connectionP3THD+0x24)[0x6de5c4]
mysqld(_Z24do_handle_one_connectionP3THD+0x11c)[0x6de8cc]
mysqld(handle_one_connection+0x47)[0x6de997]
mysqld(pfs_spawn_thread+0x143)[0xae5183]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x6b50)[0x7ffb132d4b50]
/lib/x86_64-linux-gnu/libc.so.6(clone+0x6d)[0x7ffb11e2395d]
======= Memory map: ========
00400000-00f54000 r-xp 00000000 ca:11 761 /usr/sbin/mysqld
01154000-01201000 r--p 00b54000 ca:11 761 /usr/sbin/mysqld
01201000-01301000 rw-p 00c01000 ca:11 761 /usr/sbin/mysqld
01301000-01354000 rw-p 00000000 00:00 0
01a22000-021bf000 rw-p 00000000 00:00 0 [heap]
7ffae3bab000-7ffae3bbe000 r-xp 00000000 ca:11 1175287 /lib/x86_64-linux-gnu/libresolv-2.13.so
7ffae3bbe000-7ffae3dbd000 ---p 00013000 ca:11 1175287 /lib/x86_64-linux-gnu/libresolv-2.13.so
7ffae3dbd000-7ffae3dbe000 r--p 00012000 ca:11 1175287 /lib/x86_64-linux-gnu/libresolv-2.13.so
7ffae3dbe000-7ffae3dbf000 rw-p 00013000 ca:11 1175287 /lib/x86_64-linux-gnu/libresolv-2.13.so
7ffae3dbf000-7ffae3dc1000 rw-p 00000000 00:00 0
7ffae3dc1000-7ffae3dc2000 ---p 00000000 00:00 0
7ffae3dc2000-7ffae45c2000 rw-p 00000000 00:00 0
7ffae45c2000-7ffae45c3000 ---p 00000000 00:00 0
7ffae45c3000-7ffae4dc3000 rw-p 00000000 00:00 0
7ffae4dc3000-7ffae4dc4000 ---p 00000000 00:00 0
7ffae4dc4000-7ffae55c4000 rw-p 00000000 00:00 0
7ffae55c4000-7ffae55c5000 ---p 00000000 00:00 0
7ffae55c5000-7ffae5dc5000 rw-p 00000000 00:00 0
7ffae5dc5000-7ffae5dc6000 ---p 00000000 00:00 0
7ffae5dc6000-7ffae65c6000 rw-p 00000000 00:00 0
7ffae65c6000-7ffae65c7000 ---p 00000000 00:00 0
7ffae65c7000-7ffae6dc7000 rw-p 00000000 00:00 0
7ffae6dc7000-7ffae6dc8000 ---p 00000000 00:00 0
7ffae6dc8000-7ffae75c8000 rw-p 00000000 00:00 0
7ffae75c8000-7ffae75c9000 ---p 00000000 00:00 0
7ffae75c9000-7ffae7dc9000 rw-p 00000000 00:00 0
7ffae7dc9000-7ffae7dca000 ---p 00000000 00:00 0
7ffae7dca000-7ffae8858000 rw-p 00000000 00:00 0
7ffae89ec000-7ffae89f1000 r-xp 00000000 ca:11 1175266 /lib/x86_64-linux-gnu/libnss_dns-2.13.so
7ffae89f1000-7ffae8bf0000 ---p 00005000 ca:11 1175266 /lib/x86_64-linux-gnu/libnss_dns-2.13.so
7ffae8bf0000-7ffae8bf1000 r--p 00004000 ca:11 1175266 /lib/x86_64-linux-gnu/libnss_dns-2.13.so
7ffae8bf1000-7ffae8bf2000 rw-p 00005000 ca:11 1175266 /lib/x86_64-linux-gnu/libnss_dns-2.13.so
7ffae8bf4000-7ffae8bf5000 ---p 00000000 00:00 0
7ffae8bf5000-7ffae8c35000 rw-p 00000000 00:00 0
7ffae8c35000-7ffae8c36000 ---p 00000000 00:00 0
7ffae8c36000-7ffae8c76000 rw-p 00000000 00:00 0
7ffae8c76000-7ffae8c77000 ---p 00000000 00:00 0
7ffae8c77000-7ffae9477000 rw-p 00000000 00:00 0
7ffae9477000-7ffae9478000 ---p 00000000 00:00 0
7ffae9478000-7ffae9c78000 rw-p 00000000 00:00 0
7ffae9c78000-7ffae9c79000 ---p 00000000 00:00 0
7ffae9c79000-7ffaea479000 rw-p 00000000 00:00 0
7ffaea479000-7ffaea47a000 ---p 00000000 00:00 0
7ffaea47a000-7ffaeac7a000 rw-p 00000000 00:00 0
7ffaeac7a000-7ffaeac7b000 ---p 00000000 00:00 0
7ffaeac7b000-7ffaeb47b000 rw-p 00000000 00:00 0
7ffaeb47b000-7ffaeb47c000 ---p 00000000 00:00 0
7ffaeb47c000-7ffaebc7c000 rw-p 00000000 00:00 0
7ffaebc7c000-7ffaebc7d000 ---p 00000000 00:00 0
7ffaebc7d000-7ffaec47d000 rw-p 00000000 00:00 0
7ffaec47d000-7ffaec47e000 ---p 00000000 00:00 0
7ffaec47e000-7ffaecc7e000 rw-p 00000000 00:00 0
7ffaecc7e000-7ffaecc7f000 ---p 00000000 00:00 0
7ffaecc7f000-7ffaed47f000 rw-p 00000000 00:00 0
7ffaed47f000-7ffaed480000 ---p 00000000 00:00 0
7ffaed480000-7ffaf6afd000 rw-p 00000000 00:00 0
7ffaf6afd000-7ffaf6aff000 rw-s 00000000 00:0d 2794746 /[aio] (deleted)
7ffaf6aff000-7ffaf6b04000 rw-s 00000000 00:0d 2794745 /[aio] (deleted)
7ffaf6b04000-7ffaf6b09000 rw-s 00000000 00:0d 2794744 /[aio] (deleted)
7ffaf6b09000-7ffaf6b0e000 rw-s 00000000 00:0d 2794743 /[aio] (deleted)
7ffaf6b0e000-7ffaf6b13000 rw-s 00000000 00:0d 2794742 /[aio] (deleted)
7ffaf6b13000-7ffaf6b40000 rw-p 00000000 00:00 0
7ffaf6b40000-7ffaf6b45000 rw-s 00000000 00:0d 2794741 /[aio] (deleted)
7ffaf6b45000-7ffaf6b4a000 rw-s 00000000 00:0d 2794740 /[aio] (deleted)
7ffaf6b4a000-7ffaf6b4f000 rw-s 00000000 00:0d 2794739 /[aio] (deleted)
7ffaf6b4f000-7ffaf6b54000 rw-s 00000000 00:0d 2794738 /[aio] (deleted)
7ffaf6b54000-7ffaf6b59000 rw-s 00000000 00:0d 2794737 /[aio] (deleted)
7ffaf6b59000-7ffaf6b5e000 rw-s 00000000 00:0d 2794736 /[aio] (deleted)
7ffaf6b5e000-7ffaf6b8b000 rw-p 00000000 00:00 0
7ffaf6b8b000-7ffaf6b8c000 rw-s 00000000 00:0d 2794734 /[aio] (deleted)
7ffaf6b8c000-7ffaf74b3000 rw-p 00000000 00:00 0
7ffaf74b3000-7ffaf74be000 r-xp 00000000 ca:11 1175268 /lib/x86_64-linux-gnu/libnss_files-2.13.so
7ffaf74be000-7ffaf76bd000 ---p 0000b000 ca:11 1175268 /lib/x86_64-linux-gnu/libnss_files-2.13.so
7ffaf76bd000-7ffaf76be000 r--p 0000a000 ca:11 1175268 /lib/x86_64-linux-gnu/libnss_files-2.13.so
7ffaf76be000-7ffaf76bf000 rw-p 0000b000 ca:11 1175268 /lib/x86_64-linux-gnu/libnss_files-2.13.so
7ffaf76bf000-7ffaf76c9000 r-xp 00000000 ca:11 1175272 /lib/x86_64-linux-gnu/libnss_nis-2.13.so
7ffaf76c9000-7ffaf78c8000 ---p 0000a000 ca:11 1175272 /lib/x86_64-linux-gnu/libnss_nis-2.13.so
7ffaf78c8000-7ffaf78c9000 r--p 00009000 ca:11 1175272 /lib/x86_64-linux-gnu/libnss_nis-2.13.so
7ffaf78c9000-7ffaf78ca000 rw-p 0000a000 ca:11 1175272 /lib/x86_64-linux-gnu/libnss_nis-2.13.so
7ffaf78ca000-7ffaf78df000 r-xp 00000000 ca:11 1175262 /lib/x86_64-linux-gnu/libnsl-2.13.so
7ffaf78df000-7ffaf7ade000 ---p 00015000 ca:11 1175262 /lib/x86_64-linux-gnu/libnsl-2.13.so
7ffaf7ade000-7ffaf7adf000 r--p 00014000 ca:11 1175262 /lib/x86_64-linux-gnu/libnsl-2.13.so
7ffaf7adf000-7ffaf7ae0000 rw-p 00015000 ca:11 1175262 /lib/x86_64-linux-gnu/libnsl-2.13.so
7ffaf7ae0000-7ffaf7ae2000 rw-p 00000000 00:00 0
7ffaf7ae2000-7ffaf7ae9000 r-xp 00000000 ca:11 1175264 /lib/x86_64-linux-gnu/libnss_compat-2.13.so
7ffaf7ae9000-7ffaf7ce8000 ---p 00007000 ca:11 1175264 /lib/x86_64-linux-gnu/libnss_compat-2.13.so
7ffaf7ce8000-7ffaf7ce9000 r--p 00006000 ca:11 1175264 /lib/x86_64-linux-gnu/libnss_compat-2.13.so
7ffaf7ce9000-7ffaf7cea000 rw-p 00007000 ca:11 1175264 /lib/x86_64-linux-gnu/libnss_compat-2.13.so
7ffaf7cea000-7ffb11d48000 rw-p 00000000 00:00 0
7ffb11d48000-7ffb11ec9000 r-xp 00000000 ca:11 1175236 /lib/x86_64-linux-gnu/libc-2.13.so
7ffb11ec9000-7ffb120c9000 ---p 00181000 ca:11 1175236 /lib/x86_64-linux-gnu/libc-2.13.so
7ffb120c9000-7ffb120cd000 r--p 00181000 ca:11 1175236 /lib/x86_64-linux-gnu/libc-2.13.so
7ffb120cd000-7ffb120ce000 rw-p 00185000 ca:11 1175236 /lib/x86_64-linux-gnu/libc-2.13.so
7ffb120ce000-7ffb120d3000 rw-p 00000000 00:00 0
7ffb120d3000-7ffb120e8000 r-xp 00000000 ca:11 1175250 /lib/x86_64-linux-gnu/libgcc_s.so.1
7ffb120e8000-7ffb122e8000 ---p 00015000 ca:11 1175250 /lib/x86_64-linux-gnu/libgcc_s.so.1
7ffb122e8000-7ffb122e9000 rw-p 00015000 ca:11 1175250 /lib/x86_64-linux-gnu/libgcc_s.so.1
7ffb122e9000-7ffb1236a000 r-xp 00000000 ca:11 1175255 /lib/x86_64-linux-gnu/libm-2.13.so
7ffb1236a000-7ffb12569000 ---p 00081000 ca:11 1175255 /lib/x86_64-linux-gnu/libm-2.13.so
7ffb12569000-7ffb1256a000 r--p 00080000 ca:11 1175255 /lib/x86_64-linux-gnu/libm-2.13.so
7ffb1256a000-7ffb1256b000 rw-p 00081000 ca:11 1175255 /lib/x86_64-linux-gnu/libm-2.13.so
7ffb1256b000-7ffb12653000 r-xp 00000000 ca:11 1176097 /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.17
7ffb12653000-7ffb12853000 ---p 000e8000 ca:11 1176097 /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.17
7ffb12853000-7ffb1285b000 r--p 000e8000 ca:11 1176097 /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.17
7ffb1285b000-7ffb1285d000 rw-p 000f0000 ca:11 1176097 /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.17
7ffb1285d000-7ffb12872000 rw-p 00000000 00:00 0
7ffb12872000-7ffb12874000 r-xp 00000000 ca:11 1175244 /lib/x86_64-linux-gnu/libdl-2.13.so
7ffb12874000-7ffb12a74000 ---p 00002000 ca:11 1175244 /lib/x86_64-linux-gnu/libdl-2.13.so
7ffb12a74000-7ffb12a75000 r--p 00002000 ca:11 1175244 /lib/x86_64-linux-gnu/libdl-2.13.so
7ffb12a75000-7ffb12a76000 rw-p 00003000 ca:11 1175244 /lib/x86_64-linux-gnu/libdl-2.13.so
7ffb12a76000-7ffb12a7e000 r-xp 00000000 ca:11 1175242 /lib/x86_64-linux-gnu/libcrypt-2.13.so
7ffb12a7e000-7ffb12c7d000 ---p 00008000 ca:11 1175242 /lib/x86_64-linux-gnu/libcrypt-2.13.so
7ffb12c7d000-7ffb12c7e000 r--p 00007000 ca:11 1175242 /lib/x86_64-linux-gnu/libcrypt-2.13.so
7ffb12c7e000-7ffb12c7f000 rw-p 00008000 ca:11 1175242 /lib/x86_64-linux-gnu/libcrypt-2.13.so
7ffb12c7f000-7ffb12cad000 rw-p 00000000 00:00 0
7ffb12cad000-7ffb12cb4000 r-xp 00000000 ca:11 1175289 /lib/x86_64-linux-gnu/librt-2.13.so
7ffb12cb4000-7ffb12eb3000 ---p 00007000 ca:11 1175289 /lib/x86_64-linux-gnu/librt-2.13.so
7ffb12eb3000-7ffb12eb4000 r--p 00006000 ca:11 1175289 /lib/x86_64-linux-gnu/librt-2.13.so
7ffb12eb4000-7ffb12eb5000 rw-p 00007000 ca:11 1175289 /lib/x86_64-linux-gnu/librt-2.13.so
7ffb12eb5000-7ffb12ecb000 r-xp 00000000 ca:11 1175308 /lib/x86_64-linux-gnu/libz.so.1.2.7
7ffb12ecb000-7ffb130ca000 ---p 00016000 ca:11 1175308 /lib/x86_64-linux-gnu/libz.so.1.2.7
7ffb130ca000-7ffb130cb000 r--p 00015000 ca:11 1175308 /lib/x86_64-linux-gnu/libz.so.1.2.7
7ffb130cb000-7ffb130cc000 rw-p 00016000 ca:11 1175308 /lib/x86_64-linux-gnu/libz.so.1.2.7
7ffb130cc000-7ffb130cd000 r-xp 00000000 ca:11 674 /lib/x86_64-linux-gnu/libaio.so.1.0.1
7ffb130cd000-7ffb132cc000 ---p 00001000 ca:11 674 /lib/x86_64-linux-gnu/libaio.so.1.0.1
7ffb132cc000-7ffb132cd000 r--p 00000000 ca:11 674 /lib/x86_64-linux-gnu/libaio.so.1.0.1
7ffb132cd000-7ffb132ce000 rw-p 00001000 ca:11 674 /lib/x86_64-linux-gnu/libaio.so.1.0.1
7ffb132ce000-7ffb132e5000 r-xp 00000000 ca:11 1175283 /lib/x86_64-linux-gnu/libpthread-2.13.so
7ffb132e5000-7ffb134e4000 ---p 00017000 ca:11 1175283 /lib/x86_64-linux-gnu/libpthread-2.13.so
7ffb134e4000-7ffb134e5000 r--p 00016000 ca:11 1175283 /lib/x86_64-linux-gnu/libpthread-2.13.so
7ffb134e5000-7ffb134e6000 rw-p 00017000 ca:11 1175283 /lib/x86_64-linux-gnu/libpthread-2.13.so
7ffb134e6000-7ffb134ea000 rw-p 00000000 00:00 0
7ffb134ea000-7ffb1350a000 r-xp 00000000 ca:11 1175220 /lib/x86_64-linux-gnu/ld-2.13.so
7ffb1350a000-7ffb13706000 rw-p 00000000 00:00 0
7ffb13706000-7ffb13709000 rw-p 00000000 00:00 0
7ffb13709000-7ffb1370a000 r--p 0001f000 ca:11 1175220 /lib/x86_64-linux-gnu/ld-2.13.so
7ffb1370a000-7ffb1370b000 rw-p 00020000 ca:11 1175220 /lib/x86_64-linux-gnu/ld-2.13.so
7ffb1370b000-7ffb1370c000 rw-p 00000000 00:00 0
7ffdf7c05000-7ffdf7c26000 rw-p 00000000 00:00 0 [stack]
7ffdf7d83000-7ffdf7d85000 r--p 00000000 00:00 0 [vvar]
7ffdf7d85000-7ffdf7d87000 r-xp 00000000 00:00 0 [vdso]
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0 [vsyscall]
17:54:46 UTC - mysqld got signal 6 ;
This could be because you hit a bug. It is also possible that this binary
or one of the libraries it was linked against is corrupt, improperly built,
or misconfigured. This error can also be caused by malfunctioning hardware.
We will try our best to scrape up some info that will hopefully help
diagnose the problem, but since we have already crashed,
something is definitely wrong and this may fail.
key_buffer_size=8388608
read_buffer_size=131072
max_used_connections=1
max_threads=151
thread_count=1
connection_count=1
It is possible that mysqld could use up to
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 68245 K bytes of memory
Hope that's ok; if not, decrease some variables in the equation.
Thread pointer: 0x1f8ac70
Attempting backtrace. You can use the following information to find out
where mysqld died. If you see no messages after this, something went
terribly wrong...
stack_bottom = 7ffae8c33e40 thread_stack 0x40000
mysqld(my_print_stacktrace+0x2e)[0x8bda5e]
mysqld(handle_fatal_signal+0x471)[0x6984e1]
/lib/x86_64-linux-gnu/libpthread.so.0(+0xf0a0)[0x7ffb132dd0a0]
/lib/x86_64-linux-gnu/libc.so.6(gsignal+0x35)[0x7ffb11d7a165]
/lib/x86_64-linux-gnu/libc.so.6(abort+0x180)[0x7ffb11d7d3e0]
/lib/x86_64-linux-gnu/libc.so.6(+0x6c39b)[0x7ffb11db439b]
/lib/x86_64-linux-gnu/libc.so.6(__fortify_fail+0x37)[0x7ffb11e380e7]
/lib/x86_64-linux-gnu/libc.so.6(+0xeefa0)[0x7ffb11e36fa0]
mysqld(_Z19find_or_create_hostP10PFS_threadPKcj+0x1d3)[0xac1473]
mysqld(_Z22find_or_create_accountP10PFS_threadPKcjS2_j+0x301)[0xabbc21]
mysqld(_Z18set_thread_accountP10PFS_thread+0x3d)[0xac5afd]
mysqld[0xae6e1d]
mysqld(_Z16acl_authenticateP3THDj+0xba4)[0x6b9814]
mysqld[0x6dd17b]
mysqld(_Z16login_connectionP3THD+0x45)[0x6de055]
mysqld(_Z22thd_prepare_connectionP3THD+0x24)[0x6de5c4]
mysqld(_Z24do_handle_one_connectionP3THD+0x11c)[0x6de8cc]
mysqld(handle_one_connection+0x47)[0x6de997]
mysqld(pfs_spawn_thread+0x143)[0xae5183]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x6b50)[0x7ffb132d4b50]
/lib/x86_64-linux-gnu/libc.so.6(clone+0x6d)[0x7ffb11e2395d]
Trying to get some variables.
Some pointers may be invalid and cause the dump to abort.
Query (0): is an invalid pointer
Connection ID (thread ID): 1
Status: NOT_KILLED
The manual page at http://dev.mysql.com/doc/mysql/en/crashing.html contains
information that should help you find out what is causing the crash.
</code>```

The MySQL "buffer overflow detected" line occurs at exactly 17:54:46 (I checked), the exact same time that the exception is thrown in the Spring boot logs, so one is causing the other.

Here's the spring config file:

```<code>spring:
    profiles:
        active: aws
    devtools:
        restart:
            enabled: true
        livereload:
            enabled: false
    datasource:
        driver-class-name: com.mysql.jdbc.jdbc2.optional.MysqlDataSource
        url: jdbc:mysql://REDACTED:3306/REDACTED?useUnicode=true&characterEncoding=utf8
        # add &rewriteBatchedStatements=true to enable rewriting statements into batches - but requires further jpa properties below (MySQL specific)
        # add &profileSQL=true to profile sql statements
        name:
        username: REDACTED
        password: REDACTED
    jpa:
        database-platform: org.hibernate.dialect.MySQLInnoDBDialect
        database: MYSQL
        show_sql: true
        properties:
            hibernate.cache.use_second_level_cache: true
            hibernate.cache.use_query_cache: false
            hibernate.generate_statistics: true
            hibernate.cache.region.factory_class: com.REDACTED.config.hazelcast.HazelcastCacheRegionFactory
            hibernate.cache.use_minimal_puts: true
            hibernate.cache.hazelcast.use_lite_member: true
            # Enable the following for batch rewriting
            # hibernate.jdbc.batch_size: 50
            # hibernate.order_inserts: true
            # hibernate.order_updates: true
    mail:
        host: REDACTED
    messages:
        cache-seconds: 1
    thymeleaf:
        cache: false

liquibase:
    contexts: dev

server:
    port: 8080
    session:
        timeout: 28800 # 8 hours

# ===================================================================
# JHipster specific properties
# ===================================================================

jhipster:
    datasource: # JHipster-specific configuration, in addition to the standard spring.datasource properties
        cachePrepStmts: true
        prepStmtCacheSize: 250
        prepStmtCacheSqlLimit: 2048
        useServerPrepStmts: true
    cache: # Hibernate 2nd level cache, used by CacheConfiguration
        timeToLiveSeconds: 3600
        hazelcast:
            backupCount: 1
    mail: # specific JHipster mail property, for standard properties see MailProperties
        from: REDACTED@localhost
    metrics: # DropWizard Metrics configuration, used by MetricsConfiguration
        jmx.enabled: true
        spark:
            enabled: false
            host: localhost
            port: 9999
        graphite:
            enabled: false
            host: localhost
            port: 2003
            prefix: REDACTED
    tableHistory:
        queryLog: /queryLog.txt
        bookUpdate: /update_book.php
        bookTag: /update_book_modifications.php
    security:
        authentication:
            oauth:
                # Token is valid 8 hours
                tokenValidityInSeconds: 28800

bridgeresource:
    communityCredentials:
        url: https://REDACTED/REDACTED/rest/v1/
        username: REDACTED
        password: REDACTED
    version: 30

ga:
    path: /assets/bundles/REDACTED/js/ga/ga.dev.js
</code>```

EDIT: Some more info.. I'm running these services in Docker containers. This error happens when I try to run them as a Docker Stack.. but here's what's strange--when I run them 'manually' (ie. through simple "docker run" commands) it works fine.

答:
The most possible reason is a very long container name. It is composed from a project directory name and the service name in docker-compose.yml file.

The solution would be to make one or both of them shorter. The example:

«Access denied for user 'mysql'@'somelongnamethatwillbreakmysql_web_run_2.somelongnamethatwillbre'.

Source: https://github.com/docker-library/mysql/issues/243#issuecomment-277965384

Body:
I'm having this hair-pulling issue that has me completely stumped, where spring boot causes mysql to crash. The second my spring-boot app connects to the MySQL, mysqld immediately crashes, with the MySQL logs complaining of a buffer overflow.

This is the spring boot log output:

:: JHipster  :: Running Spring Boot 1.3.1.RELEASE ::
:: http://jhipster.github.io ::
2017-05-24 17:54:37.811 INFO 5 --- [ main] com.REDACTED.Application : Starting Application on 79ec0626388d with PID 5 (started by root in /)
2017-05-24 17:54:37.815 DEBUG 5 --- [ main] com.REDACTED.Application : Running with Spring Boot v1.3.1.RELEASE, Spring v4.2.4.RELEASE
2017-05-24 17:54:37.815 INFO 5 --- [ main] com.REDACTED.Application : The following profiles are active: aws
2017-05-24 17:54:41.162 DEBUG 5 --- [ main] c.REDACTED.config.AsyncConfiguration : Creating Async Task Executor
2017-05-24 17:54:41.479 DEBUG 5 --- [ main] c.REDACTED.config.MetricsConfiguration : Registering JVM gauges
2017-05-24 17:54:41.564 DEBUG 5 --- [ main] c.REDACTED.config.MetricsConfiguration : Initializing Metrics JMX reporting
2017-05-24 17:54:41.817 DEBUG 5 --- [ main] c.REDACTED.config.CacheConfiguration : Configuring Hazelcast
2017-05-24 17:54:41.859 INFO 5 --- [ main] c.h.instance.DefaultAddressPicker : [LOCAL] [dev] [3.5.4] Prefer IPv4 stack is true.
2017-05-24 17:54:41.868 INFO 5 --- [ main] c.h.instance.DefaultAddressPicker : [LOCAL] [dev] [3.5.4] Picked Address[10.255.0.6]:5701, using socket ServerSocket[addr=/0:0:0:0:0:0:0:0,localport=5701], bind any local is true
2017-05-24 17:54:42.086 INFO 5 --- [ main] com.hazelcast.spi.OperationService : [10.255.0.6]:5701 [dev] [3.5.4] Backpressure is disabled
2017-05-24 17:54:42.294 INFO 5 --- [ main] c.h.s.i.o.c.ClassicOperationExecutor : [10.255.0.6]:5701 [dev] [3.5.4] Starting with 2 generic operation threads and 2 partition operation threads.
2017-05-24 17:54:42.618 INFO 5 --- [ main] com.hazelcast.system : [10.255.0.6]:5701 [dev] [3.5.4] Hazelcast 3.5.4 (20151125 - 56676b2) starting at Address[10.255.0.6]:5701
2017-05-24 17:54:42.619 INFO 5 --- [ main] com.hazelcast.system : [10.255.0.6]:5701 [dev] [3.5.4] Copyright (c) 2008-2015, Hazelcast, Inc. All Rights Reserved.
2017-05-24 17:54:42.627 INFO 5 --- [ main] com.hazelcast.instance.Node : [10.255.0.6]:5701 [dev] [3.5.4] Creating MulticastJoiner
2017-05-24 17:54:42.631 INFO 5 --- [ main] com.hazelcast.core.LifecycleService : [10.255.0.6]:5701 [dev] [3.5.4] Address[10.255.0.6]:5701 is STARTING
2017-05-24 17:54:45.355 INFO 5 --- [ main] c.h.cluster.impl.MulticastJoiner : [10.255.0.6]:5701 [dev] [3.5.4]
Members [1] {
Member [10.255.0.6]:5701 this
}
2017-05-24 17:54:45.384 INFO 5 --- [ main] com.hazelcast.core.LifecycleService : [10.255.0.6]:5701 [dev] [3.5.4] Address[10.255.0.6]:5701 is STARTED
2017-05-24 17:54:45.468 DEBUG 5 --- [ cached3] s.n.www.protocol.http.HttpURLConnection : sun.net.www.MessageHeader@2c50466c5 pairs: {GET /version.jsp?version=3.5.4&m=a366cca8-f169-457f-8220-48a80ed9cad2&e=false&l=NULL&p=maven&c=552bbbc9-7e70-4d67-a550-c6f31ad43aa3&crsz=A&cssz=A&hdgb=0&ccpp=0&cdn=0&cjv=0&cuptm=27&nuptm=9368 HTTP/1.1: null}{User-Agent: Mozilla/5.0}{Host: versioncheck.hazelcast.com}{Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2}{Connection: keep-alive}
2017-05-24 17:54:45.470 DEBUG 5 --- [ cached3] s.n.www.protocol.http.HttpURLConnection : sun.net.www.MessageHeader@7202deab5 pairs: {null: HTTP/1.1 200 OK}{Server: Apache-Coyote/1.1}{Content-Type: text/xml;charset=UTF-8}{Transfer-Encoding: chunked}{Date: Wed, 24 May 2017 17:54:45 GMT}
2017-05-24 17:54:45.662 WARN 5 --- [ main] io.undertow.websockets.jsr : UT026009: XNIO worker was not set on WebSocketDeploymentInfo, the default worker will be used
2017-05-24 17:54:45.756 WARN 5 --- [ main] io.undertow.websockets.jsr : UT026010: Buffer pool was not set on WebSocketDeploymentInfo, the default pool will be used
2017-05-24 17:54:46.289 INFO 5 --- [ main] com.REDACTED.config.WebConfigurer : Web application configuration, using profiles: [aws]
2017-05-24 17:54:46.289 DEBUG 5 --- [ main] com.REDACTED.config.WebConfigurer : Registering Clustered Http Session Filter
2017-05-24 17:54:46.294 DEBUG 5 --- [ main] com.REDACTED.config.WebConfigurer : Initializing Metrics registries
2017-05-24 17:54:46.297 DEBUG 5 --- [ main] com.REDACTED.config.WebConfigurer : Registering Metrics Filter
2017-05-24 17:54:46.298 DEBUG 5 --- [ main] com.REDACTED.config.WebConfigurer : Registering Metrics Servlet
2017-05-24 17:54:46.301 INFO 5 --- [ main] com.REDACTED.config.WebConfigurer : Web application fully configured
2017-05-24 17:54:46.428 DEBUG 5 --- [ main] c.REDACTED.config.CacheConfiguration : Starting HazelcastCacheManager
2017-05-24 17:54:46.434 DEBUG 5 --- [ main] c.REDACTED.config.DatabaseConfiguration : Configuring Datasource
2017-05-24 17:54:46.995 WARN 5 --- [ main] ationConfigEmbeddedWebApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private javax.sql.DataSource org.springframework.boot.autoconfigure.orm.jpa.JpaBaseConfiguration.dataSource; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [com/REDACTED/config/DatabaseConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [javax.sql.DataSource]: Factory method 'dataSource' threw exception; nested exception is com.zaxxer.hikari.pool.PoolInitializationException: Exception during pool initialization: Communications link failure

And the mysql output:

2017-05-24 17:53:57 1 [Note] Plugin 'FEDERATED' is disabled.
2017-05-24 17:53:57 1 [Note] InnoDB: Using atomics to ref count buffer pool pages
2017-05-24 17:53:57 1 [Note] InnoDB: The InnoDB memory heap is disabled
2017-05-24 17:53:57 1 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2017-05-24 17:53:57 1 [Note] InnoDB: Memory barrier is not used
2017-05-24 17:53:57 1 [Note] InnoDB: Compressed tables use zlib 1.2.7
2017-05-24 17:53:57 1 [Note] InnoDB: Using Linux native AIO
2017-05-24 17:53:57 1 [Note] InnoDB: Using CPU crc32 instructions
2017-05-24 17:53:57 1 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2017-05-24 17:53:57 1 [Note] InnoDB: Completed initialization of buffer pool
2017-05-24 17:53:57 1 [Note] InnoDB: Highest supported file format is Barracuda.
2017-05-24 17:53:57 1 [Note] InnoDB: 128 rollback segment(s) are active.
2017-05-24 17:53:57 1 [Note] InnoDB: Waiting for purge to start
2017-05-24 17:53:57 1 [Note] InnoDB: 5.6.23 started; log sequence number 28560957
2017-05-24 17:53:57 1 [Note] Server hostname (bind-address): '*'; port: 3306
2017-05-24 17:53:57 1 [Note] IPv6 is available.
2017-05-24 17:53:57 1 [Note] - '::' resolves to '::';
2017-05-24 17:53:57 1 [Note] Server socket created on IP: '::'.
2017-05-24 17:53:57 1 [Note] Event Scheduler: Loaded 0 events
2017-05-24 17:53:57 1 [Note] mysqld: ready for connections.
Version: '5.6.23' socket: '/var/run/mysqld/mysqld.sock' port: 3306 MySQL Community Server (GPL)
*** buffer overflow detected ***: mysqld terminated
======= Backtrace: =========
/lib/x86_64-linux-gnu/libc.so.6(__fortify_fail+0x37)[0x7ffb11e380e7]
/lib/x86_64-linux-gnu/libc.so.6(+0xeefa0)[0x7ffb11e36fa0]
mysqld(_Z19find_or_create_hostP10PFS_threadPKcj+0x1d3)[0xac1473]
mysqld(_Z22find_or_create_accountP10PFS_threadPKcjS2_j+0x301)[0xabbc21]
mysqld(_Z18set_thread_accountP10PFS_thread+0x3d)[0xac5afd]
mysqld[0xae6e1d]
mysqld(_Z16acl_authenticateP3THDj+0xba4)[0x6b9814]
mysqld[0x6dd17b]
mysqld(_Z16login_connectionP3THD+0x45)[0x6de055]
mysqld(_Z22thd_prepare_connectionP3THD+0x24)[0x6de5c4]
mysqld(_Z24do_handle_one_connectionP3THD+0x11c)[0x6de8cc]
mysqld(handle_one_connection+0x47)[0x6de997]
mysqld(pfs_spawn_thread+0x143)[0xae5183]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x6b50)[0x7ffb132d4b50]
/lib/x86_64-linux-gnu/libc.so.6(clone+0x6d)[0x7ffb11e2395d]
======= Memory map: ========
00400000-00f54000 r-xp 00000000 ca:11 761 /usr/sbin/mysqld
01154000-01201000 r--p 00b54000 ca:11 761 /usr/sbin/mysqld
01201000-01301000 rw-p 00c01000 ca:11 761 /usr/sbin/mysqld
01301000-01354000 rw-p 00000000 00:00 0
01a22000-021bf000 rw-p 00000000 00:00 0 [heap]
7ffae3bab000-7ffae3bbe000 r-xp 00000000 ca:11 1175287 /lib/x86_64-linux-gnu/libresolv-2.13.so
7ffae3bbe000-7ffae3dbd000 ---p 00013000 ca:11 1175287 /lib/x86_64-linux-gnu/libresolv-2.13.so
7ffae3dbd000-7ffae3dbe000 r--p 00012000 ca:11 1175287 /lib/x86_64-linux-gnu/libresolv-2.13.so
7ffae3dbe000-7ffae3dbf000 rw-p 00013000 ca:11 1175287 /lib/x86_64-linux-gnu/libresolv-2.13.so
7ffae3dbf000-7ffae3dc1000 rw-p 00000000 00:00 0
7ffae3dc1000-7ffae3dc2000 ---p 00000000 00:00 0
7ffae3dc2000-7ffae45c2000 rw-p 00000000 00:00 0
7ffae45c2000-7ffae45c3000 ---p 00000000 00:00 0
7ffae45c3000-7ffae4dc3000 rw-p 00000000 00:00 0
7ffae4dc3000-7ffae4dc4000 ---p 00000000 00:00 0
7ffae4dc4000-7ffae55c4000 rw-p 00000000 00:00 0
7ffae55c4000-7ffae55c5000 ---p 00000000 00:00 0
7ffae55c5000-7ffae5dc5000 rw-p 00000000 00:00 0
7ffae5dc5000-7ffae5dc6000 ---p 00000000 00:00 0
7ffae5dc6000-7ffae65c6000 rw-p 00000000 00:00 0
7ffae65c6000-7ffae65c7000 ---p 00000000 00:00 0
7ffae65c7000-7ffae6dc7000 rw-p 00000000 00:00 0
7ffae6dc7000-7ffae6dc8000 ---p 00000000 00:00 0
7ffae6dc8000-7ffae75c8000 rw-p 00000000 00:00 0
7ffae75c8000-7ffae75c9000 ---p 00000000 00:00 0
7ffae75c9000-7ffae7dc9000 rw-p 00000000 00:00 0
7ffae7dc9000-7ffae7dca000 ---p 00000000 00:00 0
7ffae7dca000-7ffae8858000 rw-p 00000000 00:00 0
7ffae89ec000-7ffae89f1000 r-xp 00000000 ca:11 1175266 /lib/x86_64-linux-gnu/libnss_dns-2.13.so
7ffae89f1000-7ffae8bf0000 ---p 00005000 ca:11 1175266 /lib/x86_64-linux-gnu/libnss_dns-2.13.so
7ffae8bf0000-7ffae8bf1000 r--p 00004000 ca:11 1175266 /lib/x86_64-linux-gnu/libnss_dns-2.13.so
7ffae8bf1000-7ffae8bf2000 rw-p 00005000 ca:11 1175266 /lib/x86_64-linux-gnu/libnss_dns-2.13.so
7ffae8bf4000-7ffae8bf5000 ---p 00000000 00:00 0
7ffae8bf5000-7ffae8c35000 rw-p 00000000 00:00 0
7ffae8c35000-7ffae8c36000 ---p 00000000 00:00 0
7ffae8c36000-7ffae8c76000 rw-p 00000000 00:00 0
7ffae8c76000-7ffae8c77000 ---p 00000000 00:00 0
7ffae8c77000-7ffae9477000 rw-p 00000000 00:00 0
7ffae9477000-7ffae9478000 ---p 00000000 00:00 0
7ffae9478000-7ffae9c78000 rw-p 00000000 00:00 0
7ffae9c78000-7ffae9c79000 ---p 00000000 00:00 0
7ffae9c79000-7ffaea479000 rw-p 00000000 00:00 0
7ffaea479000-7ffaea47a000 ---p 00000000 00:00 0
7ffaea47a000-7ffaeac7a000 rw-p 00000000 00:00 0
7ffaeac7a000-7ffaeac7b000 ---p 00000000 00:00 0
7ffaeac7b000-7ffaeb47b000 rw-p 00000000 00:00 0
7ffaeb47b000-7ffaeb47c000 ---p 00000000 00:00 0
7ffaeb47c000-7ffaebc7c000 rw-p 00000000 00:00 0
7ffaebc7c000-7ffaebc7d000 ---p 00000000 00:00 0
7ffaebc7d000-7ffaec47d000 rw-p 00000000 00:00 0
7ffaec47d000-7ffaec47e000 ---p 00000000 00:00 0
7ffaec47e000-7ffaecc7e000 rw-p 00000000 00:00 0
7ffaecc7e000-7ffaecc7f000 ---p 00000000 00:00 0
7ffaecc7f000-7ffaed47f000 rw-p 00000000 00:00 0
7ffaed47f000-7ffaed480000 ---p 00000000 00:00 0
7ffaed480000-7ffaf6afd000 rw-p 00000000 00:00 0
7ffaf6afd000-7ffaf6aff000 rw-s 00000000 00:0d 2794746 /[aio] (deleted)
7ffaf6aff000-7ffaf6b04000 rw-s 00000000 00:0d 2794745 /[aio] (deleted)
7ffaf6b04000-7ffaf6b09000 rw-s 00000000 00:0d 2794744 /[aio] (deleted)
7ffaf6b09000-7ffaf6b0e000 rw-s 00000000 00:0d 2794743 /[aio] (deleted)
7ffaf6b0e000-7ffaf6b13000 rw-s 00000000 00:0d 2794742 /[aio] (deleted)
7ffaf6b13000-7ffaf6b40000 rw-p 00000000 00:00 0
7ffaf6b40000-7ffaf6b45000 rw-s 00000000 00:0d 2794741 /[aio] (deleted)
7ffaf6b45000-7ffaf6b4a000 rw-s 00000000 00:0d 2794740 /[aio] (deleted)
7ffaf6b4a000-7ffaf6b4f000 rw-s 00000000 00:0d 2794739 /[aio] (deleted)
7ffaf6b4f000-7ffaf6b54000 rw-s 00000000 00:0d 2794738 /[aio] (deleted)
7ffaf6b54000-7ffaf6b59000 rw-s 00000000 00:0d 2794737 /[aio] (deleted)
7ffaf6b59000-7ffaf6b5e000 rw-s 00000000 00:0d 2794736 /[aio] (deleted)
7ffaf6b5e000-7ffaf6b8b000 rw-p 00000000 00:00 0
7ffaf6b8b000-7ffaf6b8c000 rw-s 00000000 00:0d 2794734 /[aio] (deleted)
7ffaf6b8c000-7ffaf74b3000 rw-p 00000000 00:00 0
7ffaf74b3000-7ffaf74be000 r-xp 00000000 ca:11 1175268 /lib/x86_64-linux-gnu/libnss_files-2.13.so
7ffaf74be000-7ffaf76bd000 ---p 0000b000 ca:11 1175268 /lib/x86_64-linux-gnu/libnss_files-2.13.so
7ffaf76bd000-7ffaf76be000 r--p 0000a000 ca:11 1175268 /lib/x86_64-linux-gnu/libnss_files-2.13.so
7ffaf76be000-7ffaf76bf000 rw-p 0000b000 ca:11 1175268 /lib/x86_64-linux-gnu/libnss_files-2.13.so
7ffaf76bf000-7ffaf76c9000 r-xp 00000000 ca:11 1175272 /lib/x86_64-linux-gnu/libnss_nis-2.13.so
7ffaf76c9000-7ffaf78c8000 ---p 0000a000 ca:11 1175272 /lib/x86_64-linux-gnu/libnss_nis-2.13.so
7ffaf78c8000-7ffaf78c9000 r--p 00009000 ca:11 1175272 /lib/x86_64-linux-gnu/libnss_nis-2.13.so
7ffaf78c9000-7ffaf78ca000 rw-p 0000a000 ca:11 1175272 /lib/x86_64-linux-gnu/libnss_nis-2.13.so
7ffaf78ca000-7ffaf78df000 r-xp 00000000 ca:11 1175262 /lib/x86_64-linux-gnu/libnsl-2.13.so
7ffaf78df000-7ffaf7ade000 ---p 00015000 ca:11 1175262 /lib/x86_64-linux-gnu/libnsl-2.13.so
7ffaf7ade000-7ffaf7adf000 r--p 00014000 ca:11 1175262 /lib/x86_64-linux-gnu/libnsl-2.13.so
7ffaf7adf000-7ffaf7ae0000 rw-p 00015000 ca:11 1175262 /lib/x86_64-linux-gnu/libnsl-2.13.so
7ffaf7ae0000-7ffaf7ae2000 rw-p 00000000 00:00 0
7ffaf7ae2000-7ffaf7ae9000 r-xp 00000000 ca:11 1175264 /lib/x86_64-linux-gnu/libnss_compat-2.13.so
7ffaf7ae9000-7ffaf7ce8000 ---p 00007000 ca:11 1175264 /lib/x86_64-linux-gnu/libnss_compat-2.13.so
7ffaf7ce8000-7ffaf7ce9000 r--p 00006000 ca:11 1175264 /lib/x86_64-linux-gnu/libnss_compat-2.13.so
7ffaf7ce9000-7ffaf7cea000 rw-p 00007000 ca:11 1175264 /lib/x86_64-linux-gnu/libnss_compat-2.13.so
7ffaf7cea000-7ffb11d48000 rw-p 00000000 00:00 0
7ffb11d48000-7ffb11ec9000 r-xp 00000000 ca:11 1175236 /lib/x86_64-linux-gnu/libc-2.13.so
7ffb11ec9000-7ffb120c9000 ---p 00181000 ca:11 1175236 /lib/x86_64-linux-gnu/libc-2.13.so
7ffb120c9000-7ffb120cd000 r--p 00181000 ca:11 1175236 /lib/x86_64-linux-gnu/libc-2.13.so
7ffb120cd000-7ffb120ce000 rw-p 00185000 ca:11 1175236 /lib/x86_64-linux-gnu/libc-2.13.so
7ffb120ce000-7ffb120d3000 rw-p 00000000 00:00 0
7ffb120d3000-7ffb120e8000 r-xp 00000000 ca:11 1175250 /lib/x86_64-linux-gnu/libgcc_s.so.1
7ffb120e8000-7ffb122e8000 ---p 00015000 ca:11 1175250 /lib/x86_64-linux-gnu/libgcc_s.so.1
7ffb122e8000-7ffb122e9000 rw-p 00015000 ca:11 1175250 /lib/x86_64-linux-gnu/libgcc_s.so.1
7ffb122e9000-7ffb1236a000 r-xp 00000000 ca:11 1175255 /lib/x86_64-linux-gnu/libm-2.13.so
7ffb1236a000-7ffb12569000 ---p 00081000 ca:11 1175255 /lib/x86_64-linux-gnu/libm-2.13.so
7ffb12569000-7ffb1256a000 r--p 00080000 ca:11 1175255 /lib/x86_64-linux-gnu/libm-2.13.so
7ffb1256a000-7ffb1256b000 rw-p 00081000 ca:11 1175255 /lib/x86_64-linux-gnu/libm-2.13.so
7ffb1256b000-7ffb12653000 r-xp 00000000 ca:11 1176097 /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.17
7ffb12653000-7ffb12853000 ---p 000e8000 ca:11 1176097 /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.17
7ffb12853000-7ffb1285b000 r--p 000e8000 ca:11 1176097 /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.17
7ffb1285b000-7ffb1285d000 rw-p 000f0000 ca:11 1176097 /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.17
7ffb1285d000-7ffb12872000 rw-p 00000000 00:00 0
7ffb12872000-7ffb12874000 r-xp 00000000 ca:11 1175244 /lib/x86_64-linux-gnu/libdl-2.13.so
7ffb12874000-7ffb12a74000 ---p 00002000 ca:11 1175244 /lib/x86_64-linux-gnu/libdl-2.13.so
7ffb12a74000-7ffb12a75000 r--p 00002000 ca:11 1175244 /lib/x86_64-linux-gnu/libdl-2.13.so
7ffb12a75000-7ffb12a76000 rw-p 00003000 ca:11 1175244 /lib/x86_64-linux-gnu/libdl-2.13.so
7ffb12a76000-7ffb12a7e000 r-xp 00000000 ca:11 1175242 /lib/x86_64-linux-gnu/libcrypt-2.13.so
7ffb12a7e000-7ffb12c7d000 ---p 00008000 ca:11 1175242 /lib/x86_64-linux-gnu/libcrypt-2.13.so
7ffb12c7d000-7ffb12c7e000 r--p 00007000 ca:11 1175242 /lib/x86_64-linux-gnu/libcrypt-2.13.so
7ffb12c7e000-7ffb12c7f000 rw-p 00008000 ca:11 1175242 /lib/x86_64-linux-gnu/libcrypt-2.13.so
7ffb12c7f000-7ffb12cad000 rw-p 00000000 00:00 0
7ffb12cad000-7ffb12cb4000 r-xp 00000000 ca:11 1175289 /lib/x86_64-linux-gnu/librt-2.13.so
7ffb12cb4000-7ffb12eb3000 ---p 00007000 ca:11 1175289 /lib/x86_64-linux-gnu/librt-2.13.so
7ffb12eb3000-7ffb12eb4000 r--p 00006000 ca:11 1175289 /lib/x86_64-linux-gnu/librt-2.13.so
7ffb12eb4000-7ffb12eb5000 rw-p 00007000 ca:11 1175289 /lib/x86_64-linux-gnu/librt-2.13.so
7ffb12eb5000-7ffb12ecb000 r-xp 00000000 ca:11 1175308 /lib/x86_64-linux-gnu/libz.so.1.2.7
7ffb12ecb000-7ffb130ca000 ---p 00016000 ca:11 1175308 /lib/x86_64-linux-gnu/libz.so.1.2.7
7ffb130ca000-7ffb130cb000 r--p 00015000 ca:11 1175308 /lib/x86_64-linux-gnu/libz.so.1.2.7
7ffb130cb000-7ffb130cc000 rw-p 00016000 ca:11 1175308 /lib/x86_64-linux-gnu/libz.so.1.2.7
7ffb130cc000-7ffb130cd000 r-xp 00000000 ca:11 674 /lib/x86_64-linux-gnu/libaio.so.1.0.1
7ffb130cd000-7ffb132cc000 ---p 00001000 ca:11 674 /lib/x86_64-linux-gnu/libaio.so.1.0.1
7ffb132cc000-7ffb132cd000 r--p 00000000 ca:11 674 /lib/x86_64-linux-gnu/libaio.so.1.0.1
7ffb132cd000-7ffb132ce000 rw-p 00001000 ca:11 674 /lib/x86_64-linux-gnu/libaio.so.1.0.1
7ffb132ce000-7ffb132e5000 r-xp 00000000 ca:11 1175283 /lib/x86_64-linux-gnu/libpthread-2.13.so
7ffb132e5000-7ffb134e4000 ---p 00017000 ca:11 1175283 /lib/x86_64-linux-gnu/libpthread-2.13.so
7ffb134e4000-7ffb134e5000 r--p 00016000 ca:11 1175283 /lib/x86_64-linux-gnu/libpthread-2.13.so
7ffb134e5000-7ffb134e6000 rw-p 00017000 ca:11 1175283 /lib/x86_64-linux-gnu/libpthread-2.13.so
7ffb134e6000-7ffb134ea000 rw-p 00000000 00:00 0
7ffb134ea000-7ffb1350a000 r-xp 00000000 ca:11 1175220 /lib/x86_64-linux-gnu/ld-2.13.so
7ffb1350a000-7ffb13706000 rw-p 00000000 00:00 0
7ffb13706000-7ffb13709000 rw-p 00000000 00:00 0
7ffb13709000-7ffb1370a000 r--p 0001f000 ca:11 1175220 /lib/x86_64-linux-gnu/ld-2.13.so
7ffb1370a000-7ffb1370b000 rw-p 00020000 ca:11 1175220 /lib/x86_64-linux-gnu/ld-2.13.so
7ffb1370b000-7ffb1370c000 rw-p 00000000 00:00 0
7ffdf7c05000-7ffdf7c26000 rw-p 00000000 00:00 0 [stack]
7ffdf7d83000-7ffdf7d85000 r--p 00000000 00:00 0 [vvar]
7ffdf7d85000-7ffdf7d87000 r-xp 00000000 00:00 0 [vdso]
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0 [vsyscall]
17:54:46 UTC - mysqld got signal 6 ;
This could be because you hit a bug. It is also possible that this binary
or one of the libraries it was linked against is corrupt, improperly built,
or misconfigured. This error can also be caused by malfunctioning hardware.
We will try our best to scrape up some info that will hopefully help
diagnose the problem, but since we have already crashed,
something is definitely wrong and this may fail.
key_buffer_size=8388608
read_buffer_size=131072
max_used_connections=1
max_threads=151
thread_count=1
connection_count=1
It is possible that mysqld could use up to
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 68245 K bytes of memory
Hope that's ok; if not, decrease some variables in the equation.
Thread pointer: 0x1f8ac70
Attempting backtrace. You can use the following information to find out
where mysqld died. If you see no messages after this, something went
terribly wrong...
stack_bottom = 7ffae8c33e40 thread_stack 0x40000
mysqld(my_print_stacktrace+0x2e)[0x8bda5e]
mysqld(handle_fatal_signal+0x471)[0x6984e1]
/lib/x86_64-linux-gnu/libpthread.so.0(+0xf0a0)[0x7ffb132dd0a0]
/lib/x86_64-linux-gnu/libc.so.6(gsignal+0x35)[0x7ffb11d7a165]
/lib/x86_64-linux-gnu/libc.so.6(abort+0x180)[0x7ffb11d7d3e0]
/lib/x86_64-linux-gnu/libc.so.6(+0x6c39b)[0x7ffb11db439b]
/lib/x86_64-linux-gnu/libc.so.6(__fortify_fail+0x37)[0x7ffb11e380e7]
/lib/x86_64-linux-gnu/libc.so.6(+0xeefa0)[0x7ffb11e36fa0]
mysqld(_Z19find_or_create_hostP10PFS_threadPKcj+0x1d3)[0xac1473]
mysqld(_Z22find_or_create_accountP10PFS_threadPKcjS2_j+0x301)[0xabbc21]
mysqld(_Z18set_thread_accountP10PFS_thread+0x3d)[0xac5afd]
mysqld[0xae6e1d]
mysqld(_Z16acl_authenticateP3THDj+0xba4)[0x6b9814]
mysqld[0x6dd17b]
mysqld(_Z16login_connectionP3THD+0x45)[0x6de055]
mysqld(_Z22thd_prepare_connectionP3THD+0x24)[0x6de5c4]
mysqld(_Z24do_handle_one_connectionP3THD+0x11c)[0x6de8cc]
mysqld(handle_one_connection+0x47)[0x6de997]
mysqld(pfs_spawn_thread+0x143)[0xae5183]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x6b50)[0x7ffb132d4b50]
/lib/x86_64-linux-gnu/libc.so.6(clone+0x6d)[0x7ffb11e2395d]
Trying to get some variables.
Some pointers may be invalid and cause the dump to abort.
Query (0): is an invalid pointer
Connection ID (thread ID): 1
Status: NOT_KILLED
The manual page at http://dev.mysql.com/doc/mysql/en/crashing.html contains
information that should help you find out what is causing the crash.

The MySQL "buffer overflow detected" line occurs at exactly 17:54:46 (I checked), the exact same time that the exception is thrown in the Spring boot logs, so one is causing the other.

Here's the spring config file:

spring:
    profiles:
        active: aws
    devtools:
        restart:
            enabled: true
        livereload:
            enabled: false
    datasource:
        driver-class-name: com.mysql.jdbc.jdbc2.optional.MysqlDataSource
        url: jdbc:mysql://REDACTED:3306/REDACTED?useUnicode=true&characterEncoding=utf8
        # add &rewriteBatchedStatements=true to enable rewriting statements into batches - but requires further jpa properties below (MySQL specific)
        # add &profileSQL=true to profile sql statements
        name:
        username: REDACTED
        password: REDACTED
    jpa:
        database-platform: org.hibernate.dialect.MySQLInnoDBDialect
        database: MYSQL
        show_sql: true
        properties:
            hibernate.cache.use_second_level_cache: true
            hibernate.cache.use_query_cache: false
            hibernate.generate_statistics: true
            hibernate.cache.region.factory_class: com.REDACTED.config.hazelcast.HazelcastCacheRegionFactory
            hibernate.cache.use_minimal_puts: true
            hibernate.cache.hazelcast.use_lite_member: true
            # Enable the following for batch rewriting
            # hibernate.jdbc.batch_size: 50
            # hibernate.order_inserts: true
            # hibernate.order_updates: true
    mail:
        host: REDACTED
    messages:
        cache-seconds: 1
    thymeleaf:
        cache: false

liquibase:
    contexts: dev

server:
    port: 8080
    session:
        timeout: 28800 # 8 hours

# ===================================================================
# JHipster specific properties
# ===================================================================

jhipster:
    datasource: # JHipster-specific configuration, in addition to the standard spring.datasource properties
        cachePrepStmts: true
        prepStmtCacheSize: 250
        prepStmtCacheSqlLimit: 2048
        useServerPrepStmts: true
    cache: # Hibernate 2nd level cache, used by CacheConfiguration
        timeToLiveSeconds: 3600
        hazelcast:
            backupCount: 1
    mail: # specific JHipster mail property, for standard properties see MailProperties
        from: REDACTED@localhost
    metrics: # DropWizard Metrics configuration, used by MetricsConfiguration
        jmx.enabled: true
        spark:
            enabled: false
            host: localhost
            port: 9999
        graphite:
            enabled: false
            host: localhost
            port: 2003
            prefix: REDACTED
    tableHistory:
        queryLog: /queryLog.txt
        bookUpdate: /update_book.php
        bookTag: /update_book_modifications.php
    security:
        authentication:
            oauth:
                # Token is valid 8 hours
                tokenValidityInSeconds: 28800

bridgeresource:
    communityCredentials:
        url: https://REDACTED/REDACTED/rest/v1/
        username: REDACTED
        password: REDACTED
    version: 30

ga:
    path: /assets/bundles/REDACTED/js/ga/ga.dev.js

EDIT: Some more info.. I'm running these services in Docker containers. This error happens when I try to run them as a Docker Stack.. but here's what's strange--when I run them 'manually' (ie. through simple "docker run" commands) it works fine.


问:
How to ignore Servlet Filters for public resources (.js .css files)
I have a spring boot project with a JWT Filter in the the security configuration. Basically this filter extracts the jwt token from the request and add the Principal to the SecurityContext.

I also have static files (.css / .js / .ttf ...) in the folder src/main/resources/static, so I can access the files without authentication.

It works perfectly, but before serving theses files it executes the jwt filter which is useless because I don't need to extract the jwt token for these requests. It takes some extra milliseconds for nothing.

I would like to ignore the jwt filter for the static resources.

I ended up with this solution : overriding the configure method in the spring security configuration

```<code>@Override
public void configure( WebSecurity web ) throws Exception
{
    web.ignoring().antMatchers( "/**/*.js", "/**/*.css" );
}
</code>```

Now when I request a js file, the filter is no longer executed. The main problem here is to list all the ant pattern for the static resources (images/fonts/audio...).

Is there a better solution to resolve this problem rather than listing all the static files extensions in the configure method ?

答:
You can try something like:

web.ignoring().antMatchers( "/**/*.*" );

Body:
I have a spring boot project with a JWT Filter in the the security configuration. Basically this filter extracts the jwt token from the request and add the Principal to the SecurityContext.

I also have static files (.css / .js / .ttf ...) in the folder src/main/resources/static, so I can access the files without authentication.

It works perfectly, but before serving theses files it executes the jwt filter which is useless because I don't need to extract the jwt token for these requests. It takes some extra milliseconds for nothing.

I would like to ignore the jwt filter for the static resources.

I ended up with this solution : overriding the configure method in the spring security configuration

@Override
public void configure( WebSecurity web ) throws Exception
{
    web.ignoring().antMatchers( "/**/*.js", "/**/*.css" );
}

Now when I request a js file, the filter is no longer executed. The main problem here is to list all the ant pattern for the static resources (images/fonts/audio...).

Is there a better solution to resolve this problem rather than listing all the static files extensions in the configure method ?


问:
How can I make private static field of the static class thread safe?
I have a static class which has a private Dictionary. I have written public methods to add and remove objects to it. Now I want to ensure that when I remove one of the items from dictionary, noone else is using it.

How can I achieve this?

答: Have a look at using lock Statement (C# Reference)</p>


问:
Loading spinner (ng-show = loading) always true after form submission. Need to make it false after receiving data
I am having problem with scope variable. I initiate the loading spinner by setting ng-show property to true, as soon someone clicks the submit button on my contact form. After that, I send form data to my back end and after processing I should be able to set the loading spinners ng-show property to false. However the property is not chaging to false after receiving data from backend.

here is my code.

```<code> $scope.submit = function(){
    $scope.loading = true; //at this point loading spinner appears
    //pass them to api that handles mail sending and
    var contact_name = $('#name').val();
    var contact_email = $('#email').val();
    //var contact_body = $('#contact_body').html();
    console.log(contact_name +" " +contact_email );

    if(contact_name != "" && contact_email != "")
     {

        $.ajaxSetup({
          headers: {
            'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
          }
        });
        $.ajax({
            url: baseUrl+'api/mail',
            type:'POST',
            dataType:'json',
            data: $('#contactFormId').serialize(),
            success:function(data)
            {

                $scope.loading = false;
                console.log("1: Scope loading is set to "+ $scope.loading);
                if(data)
                {

                        $('.msgHolder').css({
                            'border':'1px solid #9e9c9c',
                            'text-align':'center',
                            'padding':'8px',
                            'color':'green'
                        });

                       $('.msgHolder').html(data.message);
                        $scope.loading = false;
                        console.log("2 Scope loading is set to "+ $scope.loading);  //this is the PROBLEM, conse says $scope.loading is false but the spinner does not go away.

                }
                else
                {

                //default bg
                        $('.msgHolder').css({
                            'border':'1px solid #9e9c9c',
                            'text-align':'center',
                            'padding':'8px',
                            'color':'red'
                        });
                       $('.msgHolder').html("Email Was not sent. There was an Error.");
                       vcRecaptchaService.reload($scope.widgetId)

                }
            }
        });
      }
      else
      {
        $scope.loading = false;
        console.log("2: Scope loading is set to "+ $scope.loading); // this actually works. and spinner disappears
         $('.msgHolder').css({
            'border':'1px solid #9e9c9c',
            'text-align':'center',
            'padding':'8px',
            'color':'red'
        });
        $('.msgHolder').html("Email Was not sent. Required data missing");
      }

    }
</code>```

答:
You should use the $http service that Angular provides. Otherwise you'll have to tell Angular yourself that the data has changed:

```<code>$scope.$apply(function() {
    $scope.loading = false;
});
</code>```

By the way, you seem to be doing a lot of things that are not really the Angular way (touching the DOM, for example). Is there a reason?

Body:
I am having problem with scope variable. I initiate the loading spinner by setting ng-show property to true, as soon someone clicks the submit button on my contact form. After that, I send form data to my back end and after processing I should be able to set the loading spinners ng-show property to false. However the property is not chaging to false after receiving data from backend.

here is my code.

 $scope.submit = function(){
    $scope.loading = true; //at this point loading spinner appears
    //pass them to api that handles mail sending and
    var contact_name = $('#name').val();
    var contact_email = $('#email').val();
    //var contact_body = $('#contact_body').html();
    console.log(contact_name +" " +contact_email );

    if(contact_name != "" && contact_email != "")
     {

        $.ajaxSetup({
          headers: {
            'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
          }
        });
        $.ajax({
            url: baseUrl+'api/mail',
            type:'POST',
            dataType:'json',
            data: $('#contactFormId').serialize(),
            success:function(data)
            {

                $scope.loading = false;
                console.log("1: Scope loading is set to "+ $scope.loading);
                if(data)
                {

                        $('.msgHolder').css({
                            'border':'1px solid #9e9c9c',
                            'text-align':'center',
                            'padding':'8px',
                            'color':'green'
                        });

                       $('.msgHolder').html(data.message);
                        $scope.loading = false;
                        console.log("2 Scope loading is set to "+ $scope.loading);  //this is the PROBLEM, conse says $scope.loading is false but the spinner does not go away.

                }
                else
                {

                //default bg
                        $('.msgHolder').css({
                            'border':'1px solid #9e9c9c',
                            'text-align':'center',
                            'padding':'8px',
                            'color':'red'
                        });
                       $('.msgHolder').html("Email Was not sent. There was an Error.");
                       vcRecaptchaService.reload($scope.widgetId)

                }
            }
        });
      }
      else
      {
        $scope.loading = false;
        console.log("2: Scope loading is set to "+ $scope.loading); // this actually works. and spinner disappears
         $('.msgHolder').css({
            'border':'1px solid #9e9c9c',
            'text-align':'center',
            'padding':'8px',
            'color':'red'
        });
        $('.msgHolder').html("Email Was not sent. Required data missing");
      }

    }

Body:
You should use the $http service that Angular provides. Otherwise you'll have to tell Angular yourself that the data has changed:

$scope.$apply(function() {
    $scope.loading = false;
});

By the way, you seem to be doing a lot of things that are not really the Angular way (touching the DOM, for example). Is there a reason?