问:
Stop Karaf from generating new SSH keys on startup
I've noticed that Karaf keeps generating new SSH keys on each startup. It makes automatic scripts connecting via ssh useless, because new key must be manually accepted each time.

Is it possible to stop that behaviour and generate new keys only once per new installation?

More debug info: I've noticed, that 'etc/host.key' has not changed. However, after stopping and starting karaf I get the message:

ssh -p 8101 localhost -oHostKeyAlgorithms=+ssh-dss

```<code>Offending DSA key in ~/.ssh/known_hosts:5
  remove with:
  ssh-keygen -f "~/.ssh/known_hosts" -R [localhost]:8101
DSA host key for [localhost]:8101 has changed and you have requested strict checking.
Host key verification failed.
</code>```

The fact that DSA keys are generated doesn't match the log message from karaf.log as well:

INFO  | sshd-SshServer[20056f77]-nio2-thread-2 |
  SimpleGeneratorHostKeyProvider   | 48 - org.apache.sshd.core - 1.2.0 |
  generateKeyPair(RSA) generating host key - size=4096

My etc/org.apache.karaf.shell.cfg:

```<code>sshPort=8101
sshHost=0.0.0.0
sshRealm=karaf
hostKey=${karaf.etc}/host.key
algorithm=RSA
keySize=4096
</code>```

After digging in logs I've found out, that host.key file is not loaded properly:

2017-03-29T13:44:58,977 | WARN  |
  sshd-SshServer[18c17f90]-nio2-thread-1 |
  SimpleGeneratorHostKeyProvider   | 48 - org.apache.sshd.core - 1.2.0 |
  resolveKeyPair(~/karaf-docker/apache-karaf-4.1.0/etc/host.key) Failed
  (InvalidKeySpecException) to load: Missing classes:
  org.bouncycastle.jcajce.provider.asymmetric.rsa.BCRSAPrivateCrtKey
  2017-03-29T13:45:00,340 | ERROR |
  sshd-SshServer[18c17f90]-nio2-thread-1 |
  SimpleGeneratorHostKeyProvider   | 48 - org.apache.sshd.core - 1.2.0 |
  Overwriting key (~/karaf-docker/apache-karaf-4.1.0/etc/host.key) is
  disabled: using throwaway ssh-dss:
  SHA256:3yWwxdzoymMvEBYIWMIguQ8G3J7kfapd+avCMoue2R4
  2017-03-29T13:45:00,342 | WARN  |
  sshd-SshServer[18c17f90]-nio2-thread-1 | ServerSessionImpl

The Apache SSHD reads/writes host.key using Java Serialization which might cause issues in OSGi (and, maybe even worse, redeploy of feature might turn the file useless).

答:
I've decided to answer my own question because I've found a solution that doesn't require involving in discussions about karaf implementations etc.

The cause of the problem was because Karaf module org.apache.karaf.shell.ssh is unable either to persist or to read generated keys from host.key, I suppose it was tested only against the scenario below:

Use keys in PEM format by adding the line

hostKeyFormat=PEM

to file etc/org.apache.karaf.shell.cfg

Generate the key using openssl tools:

openssl genrsa -out etc/host.key 4096

After starting, the Karaf will use the key generated by openssl, and not try to generate its own. Tested against karaf 4.1.x

Body:
I've noticed that Karaf keeps generating new SSH keys on each startup. It makes automatic scripts connecting via ssh useless, because new key must be manually accepted each time.

Is it possible to stop that behaviour and generate new keys only once per new installation?

More debug info: I've noticed, that 'etc/host.key' has not changed. However, after stopping and starting karaf I get the message:

ssh -p 8101 localhost -oHostKeyAlgorithms=+ssh-dss

Offending DSA key in ~/.ssh/known_hosts:5
  remove with:
  ssh-keygen -f "~/.ssh/known_hosts" -R [localhost]:8101
DSA host key for [localhost]:8101 has changed and you have requested strict checking.
Host key verification failed.

The fact that DSA keys are generated doesn't match the log message from karaf.log as well:

INFO  | sshd-SshServer[20056f77]-nio2-thread-2 |
  SimpleGeneratorHostKeyProvider   | 48 - org.apache.sshd.core - 1.2.0 |
  generateKeyPair(RSA) generating host key - size=4096

My etc/org.apache.karaf.shell.cfg:

sshPort=8101
sshHost=0.0.0.0
sshRealm=karaf
hostKey=${karaf.etc}/host.key
algorithm=RSA
keySize=4096

After digging in logs I've found out, that host.key file is not loaded properly:

2017-03-29T13:44:58,977 | WARN  |
  sshd-SshServer[18c17f90]-nio2-thread-1 |
  SimpleGeneratorHostKeyProvider   | 48 - org.apache.sshd.core - 1.2.0 |
  resolveKeyPair(~/karaf-docker/apache-karaf-4.1.0/etc/host.key) Failed
  (InvalidKeySpecException) to load: Missing classes:
  org.bouncycastle.jcajce.provider.asymmetric.rsa.BCRSAPrivateCrtKey
  2017-03-29T13:45:00,340 | ERROR |
  sshd-SshServer[18c17f90]-nio2-thread-1 |
  SimpleGeneratorHostKeyProvider   | 48 - org.apache.sshd.core - 1.2.0 |
  Overwriting key (~/karaf-docker/apache-karaf-4.1.0/etc/host.key) is
  disabled: using throwaway ssh-dss:
  SHA256:3yWwxdzoymMvEBYIWMIguQ8G3J7kfapd+avCMoue2R4
  2017-03-29T13:45:00,342 | WARN  |
  sshd-SshServer[18c17f90]-nio2-thread-1 | ServerSessionImpl

The Apache SSHD reads/writes host.key using Java Serialization which might cause issues in OSGi (and, maybe even worse, redeploy of feature might turn the file useless).


来源: stackexchange

问:
Button onClick event
For a study  Project I try to make a sidebar for an interactive map.

I have a button which trigger an onClick() Event which Shows
a
 with an form Input.

So far I have 3 questions.

1) Can I check if the button was already clicked so I can hide my additional Content again? If so, how can I achieve that?

2) At the Moment I only display the content but I would like to have  an Animation. Again, you may give me some Infos to do this or provide an link / tutorial.

3) Is there a better Solution for my Problem, if so. May you give me a hint?

function showDropdown(x) {
  let id = x;

  if (id == 1) {
    document.getElementById("1").style.display = "block";
    console.log(id);
  }

  if (id == 2) {
    document.getElementById("2").style.display = "block";
    console.log(id);
  }

  if (id == 3) {
    document.getElementById("3").style.display = "block";
    console.log(id);
  } else {
    console.log(id);
  }
}```
<pre class="snippet-code-css lang-css prettyprint-override"><code>.nav-sidebar>ul {
  display: none;
}</code>```

        <button type="button" onclick="showDropdown(1)" class="dropdown-header">Einwohner</button>

Feld 1:<input type="text" Placeholder="a" size="2"

Feld 2:<input type="text" Placeholder="b" size="2"

Feld 3:<input type="text" Placeholder="c" size="2"

```

答:
You put jQuery in the tags, so I suppose you could use it, see this fiddle

You can use toggle() or slideToggle() function to show/hide the content.

```<code>$('button').click(function(){
    $('.dropdown-item').slideToggle();
});
</code>```

ContentLicense: CC BY-SA 3.0

Title: Button onClick event

Body:
For a study  Project I try to make a sidebar for an interactive map.

I have a button which trigger an onClick() Event which Shows
a
 with an form Input.

So far I have 3 questions.

1) Can I check if the button was already clicked so I can hide my additional Content again? If so, how can I achieve that?

2) At the Moment I only display the content but I would like to have  an Animation. Again, you may give me some Infos to do this or provide an link / tutorial.

3) Is there a better Solution for my Problem, if so. May you give me a hint?

function showDropdown(x) {
  let id = x;

  if (id == 1) {
    document.getElementById("1").style.display = "block";
    console.log(id);
  }

  if (id == 2) {
    document.getElementById("2").style.display = "block";
    console.log(id);
  }

  if (id == 3) {
    document.getElementById("3").style.display = "block";
    console.log(id);
  } else {
    console.log(id);
  }
}

.nav-sidebar>ul {
  display: none;
}

        <button type="button" onclick="showDropdown(1)" class="dropdown-header">Einwohner</button>

Feld 1:<input type="text" Placeholder="a" size="2"

Feld 2:<input type="text" Placeholder="b" size="2"

Feld 3:<input type="text" Placeholder="c" size="2"

Body:
You put jQuery in the tags, so I suppose you could use it, see this fiddle

You can use toggle() or slideToggle() function to show/hide the content.

$('button').click(function(){
    $('.dropdown-item').slideToggle();
});


问:
System.Data.SqlClient.Exception ( 0x80131904) String or binary would be terminated
i have the following code and when i execute it i get the following error :
System.Data.SqlClient.Exception ( 0x80131904) String or binary would be terminated</p>

```<code>form1.con.Open();
command = new SqlCommand("UPDATE sucursale SET nume_sucursala='" + textBox1.Text.Trim() + "',sucursala_coord='" + textBox3.Text.Trim() + "',mida='" + textBox4.Text.Trim() + "',flex='" + textBox5.Text.Trim() + "',nr_sucursala='" + textBox6.Text.Trim() + "',director='" + textBox7.Text.Trim() + "',tel_director='" + textBox8 + "',director_adj='" + textBox9.Text.Trim() + "',tel_director_adj='" + textBox10.Text.Trim() + "',adresa='" + textBox14.Text.Trim() + "',telefon='" + textBox15.Text.Trim() + "',fax='" + textBox16.Text.Trim() + "',u1_days='" + textBox26.Text.Trim() + "',u1_company='" + textBox17.Text.Trim() + "',u2_days='" + textBox27.Text.Trim() + "',u2_company='" + textBox18.Text.Trim() + "',u3_days='" + textBox28.Text.Trim() + "',u3_company='" + textBox19.Text.Trim() + "',u4_days='" + textBox29.Text.Trim() + "',u4_company='" + textBox20.Text.Trim() + "',u5_days='" + textBox30.Text.Trim() + "',u5_company='" + textBox21.Text.Trim() + "',u6_days='" + textBox31.Text.Trim() + "',u6_company='" + textBox22.Text.Trim() + "',retea_interna='" + textBox23.Text.Trim() + "',timer='" + textBox24.Text.Trim() + "',program_clienti='" + textBox25.Text.Trim() + "',contact_extra='" + textBox11.Text.Trim() + "',functie_contact_extra='" + textBox12.Text.Trim() + "',telefon_contact_extra='" + textBox13.Text.Trim() + "' WHERE nr_sucursala = '" + comboBox3.SelectedItem + "'", form1.con);
form1.da2.UpdateCommand = command;

form1.da2.Update(form1.ds2, "sucursale");
form1.con.Close();
</code>```

答:
Firstly; don't concatenate user input; that should be parameterized:

```<code>using(var cmd = conn.CreateCommand()) {
    cmd.CommandText = @"
UPDATE [SomeTable]
SET [SomeColumn] = @someColumn
WHERE [Id] = @id";
    cmd.Parameters.AddWithValue("someColumn", usersNastyText);
    cmd.Parameters.AddWithValue("id", recordId);
    cmd.ExecuteNonQuery();
}
</code>```

The error means that the text in one of the boxes is longer than the declared column. Either expand the column in the database, or validate the length of the text in the boxes before sending to the server.

Obligatory XKCD reference

ContentLicense: CC BY-SA 2.5

Body:
i have the following code and when i execute it i get the following error :
System.Data.SqlClient.Exception ( 0x80131904) String or binary would be terminated

form1.con.Open();
command = new SqlCommand("UPDATE sucursale SET nume_sucursala='" + textBox1.Text.Trim() + "',sucursala_coord='" + textBox3.Text.Trim() + "',mida='" + textBox4.Text.Trim() + "',flex='" + textBox5.Text.Trim() + "',nr_sucursala='" + textBox6.Text.Trim() + "',director='" + textBox7.Text.Trim() + "',tel_director='" + textBox8 + "',director_adj='" + textBox9.Text.Trim() + "',tel_director_adj='" + textBox10.Text.Trim() + "',adresa='" + textBox14.Text.Trim() + "',telefon='" + textBox15.Text.Trim() + "',fax='" + textBox16.Text.Trim() + "',u1_days='" + textBox26.Text.Trim() + "',u1_company='" + textBox17.Text.Trim() + "',u2_days='" + textBox27.Text.Trim() + "',u2_company='" + textBox18.Text.Trim() + "',u3_days='" + textBox28.Text.Trim() + "',u3_company='" + textBox19.Text.Trim() + "',u4_days='" + textBox29.Text.Trim() + "',u4_company='" + textBox20.Text.Trim() + "',u5_days='" + textBox30.Text.Trim() + "',u5_company='" + textBox21.Text.Trim() + "',u6_days='" + textBox31.Text.Trim() + "',u6_company='" + textBox22.Text.Trim() + "',retea_interna='" + textBox23.Text.Trim() + "',timer='" + textBox24.Text.Trim() + "',program_clienti='" + textBox25.Text.Trim() + "',contact_extra='" + textBox11.Text.Trim() + "',functie_contact_extra='" + textBox12.Text.Trim() + "',telefon_contact_extra='" + textBox13.Text.Trim() + "' WHERE nr_sucursala = '" + comboBox3.SelectedItem + "'", form1.con);
form1.da2.UpdateCommand = command;

form1.da2.Update(form1.ds2, "sucursale");
form1.con.Close();

Body:
Firstly; don't concatenate user input; that should be parameterized:

using(var cmd = conn.CreateCommand()) {
    cmd.CommandText = @"
UPDATE [SomeTable]
SET [SomeColumn] = @someColumn
WHERE [Id] = @id";
    cmd.Parameters.AddWithValue("someColumn", usersNastyText);
    cmd.Parameters.AddWithValue("id", recordId);
    cmd.ExecuteNonQuery();
}

The error means that the text in one of the boxes is longer than the declared column. Either expand the column in the database, or validate the length of the text in the boxes before sending to the server.

Obligatory XKCD reference


问:
Android - when ever my app is installed, by default "No permission allowed" is set?
My app when-ever is installed via Google Play or USB
(which use microphone, camera just like all other general app), by default the app gets "No permission allowed".

As a result it never works after the installation as fresh install.

Unless someone manually go in the app settings and change it.

What am i doing wrong? why its causing default into permission denied mode?

AndroidManifest.xml:

```<code><uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.CAMERA" />
</code>```

EDIT:

```<code>C:\cordova\tpt>cordova plugin add cordova.plugins.diagnostic
Fetching plugin "cordova.plugins.diagnostic" via npm
Installing "cordova.plugins.diagnostic" for android
ANDROID_HOME=C:\Users\tpt\AppData\Local\Android\sdk
JAVA_HOME=C:\Program Files\Java\jdk1.8.0_121
Subproject Path: CordovaLib
null
org.xwalk:xwalk_core_library:23+
Incremental java compilation is an incubating feature.
:clean FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':clean'.
> Unable to delete directory: C:\cordova\tpt\platforms\android\build\outputs\apk

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

BUILD FAILED

Total time: 3.83 secs
Failed to install 'cordova.plugins.diagnostic':Error: cmd: Command failed with exit code 1
    at ChildProcess.whenDone (C:\cordova\tpt\platforms\android\cordova\node_modules\cordova-common\src\superspawn.js:169:23)
    at emitTwo (events.js:106:13)
    at ChildProcess.emit (events.js:191:7)
    at maybeClose (internal/child_process.js:886:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
Error: cmd: Command failed with exit code 1
</code>```

答:
You need to set permissions for Marshmallow and above devices in code. Plugin provides this capability as well.

Sample reference mentioning the same Even if it is mentioned for ionic, same methodology needs to be used in cordova projects

To get permission status , replicate like following.

```<code>cordova.plugins.diagnostic.getPermissionAuthorizationStatus(function (status) {
  console.log(status);
  switch (status) {
    case cordova.plugins.diagnostic.runtimePermissionStatus.GRANTED:
      //call the target method
      break;
    case cordova.plugins.diagnostic.runtimePermissionStatus.NOT_REQUESTED:
      setPermission();
      break;
    case cordova.plugins.diagnostic.runtimePermissionStatus.DENIED:
      setPermission();
      break;
    case cordova.plugins.diagnostic.runtimePermissionStatus.DENIED_ALWAYS:
      setPermission();
      break;
  }
}, this.errorCallback, cordova.plugins.diagnostic.runtimePermission.ACCESS_COARSE_LOCATION);
</code>```

And to request authorization

```<code>function setPermission() {
  cordova.plugins.diagnostic.requestLocationAuthorization(function (status) {
    switch (status) {
      case cordova.plugins.diagnostic.permissionStatus.NOT_REQUESTED:
        break;
      case cordova.plugins.diagnostic.permissionStatus.DENIED:
        break;
      case cordova.plugins.diagnostic.permissionStatus.GRANTED:
        //TODO : Call native plugin.
        break;
      case cordova.plugins.diagnostic.permissionStatus.GRANTED_WHEN_IN_USE:
        break;
    }
  }, function (error) { }, cordova.plugins.diagnostic.locationAuthorizationMode.ALWAYS);
}
</code>```

Body:
My app when-ever is installed via Google Play or USB
(which use microphone, camera just like all other general app), by default the app gets "No permission allowed".

As a result it never works after the installation as fresh install.

Unless someone manually go in the app settings and change it.

What am i doing wrong? why its causing default into permission denied mode?

AndroidManifest.xml:

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.CAMERA" />

EDIT:

C:\cordova\tpt>cordova plugin add cordova.plugins.diagnostic
Fetching plugin "cordova.plugins.diagnostic" via npm
Installing "cordova.plugins.diagnostic" for android
ANDROID_HOME=C:\Users\tpt\AppData\Local\Android\sdk
JAVA_HOME=C:\Program Files\Java\jdk1.8.0_121
Subproject Path: CordovaLib
null
org.xwalk:xwalk_core_library:23+
Incremental java compilation is an incubating feature.
:clean FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':clean'.
> Unable to delete directory: C:\cordova\tpt\platforms\android\build\outputs\apk

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

BUILD FAILED

Total time: 3.83 secs
Failed to install 'cordova.plugins.diagnostic':Error: cmd: Command failed with exit code 1
    at ChildProcess.whenDone (C:\cordova\tpt\platforms\android\cordova\node_modules\cordova-common\src\superspawn.js:169:23)
    at emitTwo (events.js:106:13)
    at ChildProcess.emit (events.js:191:7)
    at maybeClose (internal/child_process.js:886:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
Error: cmd: Command failed with exit code 1

Body:
You need to set permissions for Marshmallow and above devices in code. Plugin provides this capability as well.

Sample reference mentioning the same Even if it is mentioned for ionic, same methodology needs to be used in cordova projects

To get permission status , replicate like following.

cordova.plugins.diagnostic.getPermissionAuthorizationStatus(function (status) {
  console.log(status);
  switch (status) {
    case cordova.plugins.diagnostic.runtimePermissionStatus.GRANTED:
      //call the target method
      break;
    case cordova.plugins.diagnostic.runtimePermissionStatus.NOT_REQUESTED:
      setPermission();
      break;
    case cordova.plugins.diagnostic.runtimePermissionStatus.DENIED:
      setPermission();
      break;
    case cordova.plugins.diagnostic.runtimePermissionStatus.DENIED_ALWAYS:
      setPermission();
      break;
  }
}, this.errorCallback, cordova.plugins.diagnostic.runtimePermission.ACCESS_COARSE_LOCATION);

And to request authorization

function setPermission() {
  cordova.plugins.diagnostic.requestLocationAuthorization(function (status) {
    switch (status) {
      case cordova.plugins.diagnostic.permissionStatus.NOT_REQUESTED:
        break;
      case cordova.plugins.diagnostic.permissionStatus.DENIED:
        break;
      case cordova.plugins.diagnostic.permissionStatus.GRANTED:
        //TODO : Call native plugin.
        break;
      case cordova.plugins.diagnostic.permissionStatus.GRANTED_WHEN_IN_USE:
        break;
    }
  }, function (error) { }, cordova.plugins.diagnostic.locationAuthorizationMode.ALWAYS);
}


问:
Convert an if & vlookup combination formula to arrayformula - Google Sheets
I have this formula working in Google Sheets:

```<code>=if(B3="",0,IF(ISERROR(VLOOKUP(E3,E4:E,1,FALSE)),1,0))
</code>```

The logic is pretty straight forward:
if B3 is NOT NULL and there is no duplicate of E3 in range E4:E, write 1 else write 0

I tried to convert it to ARRAYFORMULA, coz it should be applied to all columns in E as and when the number of rows increase (via form submission), by doing this:

```<code>=ARRAYFORMULA(if(B3="",0,IF(ISERROR(VLOOKUP(E3:E,E4:E,1,FALSE)),1,0)))
</code>```

But, it wrote 0 to all columns of E.

The reason here is that, the VLOOKUP should look in the E column range excluding the current row. I'm not sure how to achieve this.

Here is the Google Spreadsheet (please refer to Sheet2)

Can someone please correct my ARRAYFORMULA? Thank you.

答:
You can't offset range used in ArrayFormula, so your original formula cannot be converted into ArrayFormula and remain result. But you may use this workaround:

=ArrayFormula(IFERROR(--(VLOOKUP(OFFSET(E3,,,COUNTA(A3:A)),QUERY({ROW(INDIRECT("A1:A"&COUNTA(A3:A))), OFFSET(E3,,,COUNTA(A3:A))},"select Col2, max(Col1) where Col2 <> '' group by Col2 label Col2 '', max(Col1) ''"),2,0)=ROW(INDIRECT("A1:A"&COUNTA(A3:A)))),0))

I used row function in this formula to compare it with maximum row when certain value appears.

Your sample file

Body:
I have this formula working in Google Sheets:

=if(B3="",0,IF(ISERROR(VLOOKUP(E3,E4:E,1,FALSE)),1,0))

The logic is pretty straight forward:
if B3 is NOT NULL and there is no duplicate of E3 in range E4:E, write 1 else write 0

I tried to convert it to ARRAYFORMULA, coz it should be applied to all columns in E as and when the number of rows increase (via form submission), by doing this:

=ARRAYFORMULA(if(B3="",0,IF(ISERROR(VLOOKUP(E3:E,E4:E,1,FALSE)),1,0)))

But, it wrote 0 to all columns of E.

The reason here is that, the VLOOKUP should look in the E column range excluding the current row. I'm not sure how to achieve this.

Here is the Google Spreadsheet (please refer to Sheet2)

Can someone please correct my ARRAYFORMULA? Thank you.


问:
External method from an AJAX callback in JavaScript & jQuery
I have a function in JS & jQuery that fires an AJAX call and it has a callback block to let me know when it's finished:

```<code>function ajaxCall(url, type, dataType, dataToSend, callback) {

    if (dataType == undefined) dataType = "json";
    if (dataToSend == undefined) dataToSend = null;

    $.ajax({
        url: url,
        type: type,
        dataType: dataType,
        contentType: "application/json",
        data: dataToSend,
        async: true,
        success: function (result) {
            callback(result);
        },
        error: function (data, status) {
            console.error("Server Error: " + status);
        }
    });
}
</code>```

I am accessing it like so, but using external functions like showAjaxLoader() just doesn't work! it says this function is undefined:

```<code>function registerUser(data) {

    ajaxCall(pathServiceRegister, "POST", undefined, JSON.stringify(data), function (result) {

        // SOME CODE THAT RUNS WHEN IT'S COMPLETE

        // External method:
        showAjaxLoader(false); // Doesn't work

    });
});

function showAjaxLoader(show) {
    var loader = $('.ajax-loader');
    if (show) {
        loader.fadeIn("fast");
    } else {
        loader.fadeOut("fast");
    }
}
</code>```

What am I doing wrong?

Thanks :)

答:
Have you tried to do something like:</p>

```<code>var that = this;

function registerUser(data) {

    ajaxCall(pathServiceRegister, "POST", undefined, JSON.stringify(data), function (result) {

        // SOME CODE THAT RUNS WHEN IT'S COMPLETE

        // External method:
        that.showAjaxLoader(false);

    });
});
</code>```

Body:
I have a function in JS & jQuery that fires an AJAX call and it has a callback block to let me know when it's finished:

function ajaxCall(url, type, dataType, dataToSend, callback) {

    if (dataType == undefined) dataType = "json";
    if (dataToSend == undefined) dataToSend = null;

    $.ajax({
        url: url,
        type: type,
        dataType: dataType,
        contentType: "application/json",
        data: dataToSend,
        async: true,
        success: function (result) {
            callback(result);
        },
        error: function (data, status) {
            console.error("Server Error: " + status);
        }
    });
}

I am accessing it like so, but using external functions like showAjaxLoader() just doesn't work! it says this function is undefined:

function registerUser(data) {

    ajaxCall(pathServiceRegister, "POST", undefined, JSON.stringify(data), function (result) {

        // SOME CODE THAT RUNS WHEN IT'S COMPLETE

        // External method:
        showAjaxLoader(false); // Doesn't work

    });
});

function showAjaxLoader(show) {
    var loader = $('.ajax-loader');
    if (show) {
        loader.fadeIn("fast");
    } else {
        loader.fadeOut("fast");
    }
}

What am I doing wrong?

Thanks :)

Body:
Have you tried to do something like:

var that = this;

function registerUser(data) {

    ajaxCall(pathServiceRegister, "POST", undefined, JSON.stringify(data), function (result) {

        // SOME CODE THAT RUNS WHEN IT'S COMPLETE

        // External method:
        that.showAjaxLoader(false);

    });
});


问:
Java book for experienced programmers (PHP)
I searched on few questions earlier asked here but my context is not matching exactly to them.
I am working on LAMP from past few years. I recently learnt Java SL-314 Syllabus thinking my knowledge in PHP and other PLUS some knowledge in core Java from Oracle website can be helpful.
I saw Java document is very poor compared to PHP. In PHP, one can get everything basic from the php.net site itself. For a simple thing like showing the resultset data to servlet or JSP from plain java code, I need to search a lot and still I cannot get past ArrayList etc. I was looking for a code in Java like this in PHP:

```<code>while ($row = mysql_fetch_assoc($result)) {
    echo $row["userid"];
    echo $row["fullname"];
    echo $row["userstatus"];
}
</code>```

I mean I want to use all fields the way I want.

I have a book, Java in Nutshell but that seems too theoretical. I need small book so that I can read it soon. I want to develop web app using Java. For getting help from core java, I want simple example codes to do all normal work I used to do in PHP.

Please help me find simple Java book with example code which can help me do all normal stuff one do in PHP.

答:
I strongly suggest you don't just try to do what you've been doing in PHP. Learn Java properly instead. You say that Java in a Nutshell is too theoretical - but I'm afraid it sounds like you're just being impatient.

It's well worth learning these fundamentals properly, rather than making assumptions about Java working like PHP. It will take you a bit of extra time in the short term, but will pay huge dividends later on. If you try to write Java like it's PHP, you'll end up with mongrel code which will be horrible to read and debug.

Learn the Java idioms. Learn about how the language works, in terms of classes, primitives, inheritance, methods etc. Learn the core areas of the frameworks - text, numbers, collections, IO. (Don't use the built-in classes for date/time manipulation though; use Joda Time for that.)

Once you've got the basics down, then you'll be in a good position to start learning more specific technologies, such as web frameworks. If you don't know the basics though, then as soon as you hit a problem you won't know whether it's an issue in the web framework or your core understanding.

Body:
I searched on few questions earlier asked here but my context is not matching exactly to them.
I am working on LAMP from past few years. I recently learnt Java SL-314 Syllabus thinking my knowledge in PHP and other PLUS some knowledge in core Java from Oracle website can be helpful.
I saw Java document is very poor compared to PHP. In PHP, one can get everything basic from the php.net site itself. For a simple thing like showing the resultset data to servlet or JSP from plain java code, I need to search a lot and still I cannot get past ArrayList etc. I was looking for a code in Java like this in PHP:

while ($row = mysql_fetch_assoc($result)) {
    echo $row["userid"];
    echo $row["fullname"];
    echo $row["userstatus"];
}

I mean I want to use all fields the way I want.

I have a book, Java in Nutshell but that seems too theoretical. I need small book so that I can read it soon. I want to develop web app using Java. For getting help from core java, I want simple example codes to do all normal work I used to do in PHP.

Please help me find simple Java book with example code which can help me do all normal stuff one do in PHP.


问:
html 5 DATE doesn't work in Windows Exploror and Firefox
i been working on ticker reservation system and i used date function in forms but , which works fine on chrome but does not work on windows explorer and Firefox. what should i do?</p>

```<code>departure date: <input type="date" name="departuredate"> departure time : <input type="time" name="departuretime"> arrival date : <input type="date" name="arrivaldate"> arrival time : <input type="time" name="arrivaltime">
</code>```

答:
Neither Firefox (desktop) not Internet Explorer implement any date/time input control. You can see this in the Browser compatibility table found at <input> documentation on MDN.

It probably wasn't a priority for either teams given how powerful an ubiquitous JavaScript selectors have become.

Body:
i been working on ticker reservation system and i used date function in forms but , which works fine on chrome but does not work on windows explorer and Firefox. what should i do?

departure date: <input type="date" name="departuredate"> departure time : <input type="time" name="departuretime"> arrival date : <input type="date" name="arrivaldate"> arrival time : <input type="time" name="arrivaltime">


问:
ckeditor does not replace umlauts
I encountered a problem with the ckeditor regarding escaping umlauts. It is reproducable with the example editor on http://sdk.ckeditor.com/samples/classic.html

When I take the word Bühnenpräsenz and copy-paste it into the editor and click "source" it is converted to
Bühnenpräsenz
, though I expect the umlauts to be replaced with html entities.

But when I type in Bühnenpräsenz and not copy-paste it, the click on source shows
Bühnenpräsenz
 which is correct.

Can anyone reproduce this behavior or does know why pasting and typing behaves differently?

答: Ok, thing is, the "ü" from the keyboard is a U+00FC while the "ü" pasted is a "u" U+0075 with diaeresis U+0308. String.normalize() solves the issue or unorm.nfkc() (see unorm)</p>

Title: ckeditor does not replace umlauts


问:
Ionic 2 foreground or background
I am an ionic2 beginner.

I need check my app is foreground or background currently running.

I refer this https://ionicframework.com/docs/v2/native/local-notifications/

I need notification received only at app is run on background.

答:
You can use pause and resume Cordova events.
Subscribe your functions to them (taken from the link) :</p>

```<code>document.addEventListener("pause", onPause, false);
function onPause() {
// Handle the pause event
}
document.addEventListener("resume", onResume, false);

function onResume() {
// Handle the resume event
}
</code>```

ContentLicense: CC BY-SA 4.0

Title: Ionic 2 foreground or background

Body:
You can use pause and resume Cordova events.
Subscribe your functions to them (taken from the link) :

document.addEventListener("pause", onPause, false);
function onPause() {
// Handle the pause event
}
document.addEventListener("resume", onResume, false);

function onResume() {
// Handle the resume event
}


问:
Android theme/compatibility Issue: "No resource found that matches the given name"
I'm having difficulty compiling my for SDK 17. It compiles just fine for SDK 25. I've tried using build tools (19.1.0) so that it matches the compileSdkVersion as well as change the versions of the com.android... packages to match the compileSdkVersion. I've tried a few other things but none worked. I would really really appreciate any help!

Here's my Manifest:

```<code>apply plugin: 'com.android.application'

android {
    compileSdkVersion 17
    buildToolsVersion '25.0.2'
    defaultConfig {
        applicationId "com.example.android.notmyrealappid"
        minSdkVersion 16
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
        vectorDrawables.useSupportLibrary = true
        multiDexEnabled true

    }
dexOptions {
    javaMaxHeapSize "5g"
}
}
dependencies {

compile 'com.google.android.gms:play-services-basement:10.2.0'
compile 'com.google.android.gms:play-services-tasks:10.2.0'*/

compile 'com.google.android.gms:play-services:10.2.0'
compile 'com.android.support:appcompat-v7:25.2.0'

compile 'com.android.support:design:25.2.0'
compile 'com.android.support:cardview-v7:25.2.0'
compile 'com.android.support:recyclerview-v7:25.2.0'
compile 'com.google.firebase:firebase-core:10.2.0'
compile 'com.google.firebase:firebase-database:10.2.0'
compile 'com.google.firebase:firebase-auth:10.2.0'
compile 'com.google.firebase:firebase-messaging:10.2.0'
compile 'com.firebaseui:firebase-ui:1.2.0'
compile 'com.google.android.gms:play-services-auth:10.2.0'
compile 'com.firebaseui:firebase-ui-database:1.2.0'
compile 'com.firebaseui:firebase-ui-storage:1.2.0'
compile 'de.hdodenhof:circleimageview:2.1.0'

compile 'com.android.support:support-v4:25.2.0'
compile 'com.android.support:support-vector-drawable:25.2.0'

compile 'com.android.support.constraint:constraint-layout:1.0.2'

//Added due to issue with android.support 25.2.0 update
compile 'com.android.support:customtabs:25.2.0'
compile 'com.android.support:palette-v7:25.2.0'
compile 'com.android.support:mediarouter-v7:25.2.0'

//Glide for images
compile 'com.github.bumptech.glide:glide:3.7.0'
//multi dex - should refactor code so that isnt necessary
compile 'com.android.support:multidex:1.0.1'
}

apply plugin: 'com.google.gms.google-services'
</code>```

Here's styles.xml file:

```<code><resources>
    <!-- Base application theme. -->
    <style name="AppTheme.Base" parent="Theme.AppCompat.Light.NoActionBar">
        <!-- Theme Colors -->
        <item name="colorPrimary">#568B3E</item>
        <!-- Light Green 800 -->
        <item name="colorPrimaryDark">#AED580</item>
        <!-- Light Green 300 -->
        <item name="colorAccent">#F57F20</item>
        <!-- Amber 800-->
    </style>

    <style name="AppTheme" parent="AppTheme.Base"></style>

    <style name="SplashTheme" parent="Theme.AppCompat.NoActionBar">
        <item name="android:windowBackground">@drawable/background_splash</item>
    </style>

    <!-- Activity with no Title -->
    <style name="ThemeOverlay.MyNoTitleActivity" parent="AppTheme">
        <item name="windowActionBar">false</item>
        <item name="windowNoTitle">true</item>
    </style>

    <!-- Dark Buttons -->
    <style name="ThemeOverlay.MyDarkButton" parent="ThemeOverlay.AppCompat.Dark">
        <item name="colorButtonNormal">@color/grey_100</item>
        <item name="android:layout_marginRight">4dp</item>
        <item name="android:layout_marginLeft">4dp</item>
        <item name="android:textColor">@color/white</item>
    </style>

    <!-- Light EditTexts -->
    <style name="ThemeOverlay.MyLightEditText" parent="ThemeOverlay.AppCompat.Dark" />

    <style name="ThemeOverlay.MyTextDetail" parent="AppTheme">
        <item name="android:layout_width">wrap_content</item>
        <item name="android:layout_height">wrap_content</item>
        <item name="android:fadeScrollbars">true</item>
        <item name="android:gravity">center</item>
        <item name="android:maxLines">5</item>
        <item name="android:padding">4dp</item>
        <item name="android:scrollbars">vertical</item>
        <item name="android:textSize">14sp</item>
    </style>

    <style name="ThemeOverlay.FirebaseIcon" parent="AppTheme">
        <item name="android:layout_marginTop">@dimen/icon_top_margin</item>
        <item name="android:layout_marginBottom">@dimen/icon_bottom_margin</item>
    </style>

    <style name="ThemeOverlay.MyTitleText" parent="AppTheme">
        <item name="android:gravity">center</item>
        <item name="android:textSize">36sp</item>
    </style>

    <style name="AppTheme.Base.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />

    <style name="AppTheme.Base.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />

</resources>
</code>```

And here's the contense of my styles.xml(v21):

```<code><?xml version="1.0" encoding="utf-8"?>
<resources>

    <style name="AppTheme" parent="AppTheme.Base">
        <item name="windowActionBar">false</item>
        <item name="windowNoTitle">true</item>
        <item name="android:windowDrawsSystemBarBackgrounds">true</item>
        <item name="android:statusBarColor">@android:color/transparent</item>
    </style>
</resources>
</code>```

Lastly here is error that I receive:

```D:\Dev files\android-design-library-master\app\build\intermediates\res\merged\debug\values-ldltr-v21\values-ldltr-v21.xml
Error:(3) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Spinner.Underlined'.
Error:(3) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Spinner.Underlined'.

D:\Dev files\android-design-library-master\app\build\intermediates\res\merged\debug\values-v21\values-v21.xml
Error:(23) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Inverse'.
Error:(25) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Large.Inverse'.
Error:(31) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Medium.Inverse'.
Error:(38) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Small.Inverse'.
Error:(222) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ProgressBar'.
Error:(224) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ProgressBar.Horizontal'.
Error:(232) Error retrieving parent for item: No resource found that matches the given name '@android:style/Theme.Material.NoActionBar'.
Error:(238) Error retrieving parent for item: No resource found that matches the given name '@android:style/Theme.Material.Light.NoActionBar'.
Error:(273) Error retrieving parent for item: No resource found that matches the given name '@android:style/Theme.Material.NoActionBar'.
Error:(330) Error retrieving parent for item: No resource found that matches the given name '@android:style/Theme.Material.Light.DialogWhenLarge.NoActionBar'.
Error:(182) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.AutoCompleteTextView'.
Error:(195) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.EditText'.
Error:(16) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Button'.
Error:(314) Error retrieving parent for item: No resource found that matches the given name '@android:style/TextAppearance.Material.Notification'.
Error:(326) Error retrieving parent for item: No resource found that matches the given name '@android:style/TextAppearance.Material.Notification.Title'.
Error:(11, 21) No resource found that matches the given name: attr 'android:statusBarColor'.
Error:(10, 21) No resource found that matches the given name: attr 'android:windowDrawsSystemBarBackgrounds'.
Error:(13) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material'.
Error:(14) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Body1'.
Error:(15) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Body2'.
Error:(17) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Caption'.
Error:(18) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Display1'.
Error:(19) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Display2'.
Error:(20) Error retrieving parent for item: No resource found that matches
Error:(22) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Headline'.
Error:(24) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Large'.
Error:(26) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.PopupMenu.Large'.
Error:(28) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.PopupMenu.Small'.
Error:(30) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Medium'.
Error:(32) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Menu'.
Error:(33) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.SearchResult.Subtitle'.
Error:(35) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.SearchResult.Title'.
Error:(37) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Small'.
Error:(39) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Subhead'.
Error:(40) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Title'.
Error:(41) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionBar.Subtitle'.
Error:(43) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionBar.Subtitle.Inverse'.
Error:(45) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionBar.Title'.
Error:(47) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionBar.Title.Inverse'.
Error:(49) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionMode.Subtitle'.
Error:(51) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionMode.Title'.
Error:(53) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button'.
Error:(59) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.PopupMenu.Large'.
Error:(61) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.PopupMenu.Small'.
Error:(63) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Button'.
Error:(64) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.TextView.SpinnerItem'.
Error:(65) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionBar.Subtitle'.
Error:(67) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionBar.Title'.
Error:(112, 21) No resource found that matches the given name: attr 'android:colorAccent'.
Error:(116, 21) No resource found that matches the given name: attr 'android:colorButtonNormal'.
Error:(114, 21) No resource found that matches the given name: attr 'android:colorControlActivated'.
Error:(115, 21) No resource found that matches the given name: attr 'android:colorControlHighlight'.
Error:(113, 21) No resource found that matches the given name: attr 'android:colorControlNormal'.
Error:(110, 21) No resource found that matches the given name: attr 'android:colorPrimary'.
Error:(111, 21) No resource found that matches the given name: attr 'android:colorPrimaryDark'.
Error:(119, 21) No resource found that matches the given name: attr 'android:windowElevation'.
Error:(159, 21) No resource found that matches the given name: attr 'android:colorAccent'.
Error:(163, 21) No resource found that matches the given name: attr 'android:colorButtonNormal'.
Error:(161, 21) No resource found that matches the given name: attr 'android:colorControlActivated'.
Error:(162, 21) No resource found that matches the given name: attr 'android:colorControlHighlight'.
Error:(160, 21) No resource found that matches the given name: attr 'android:colorControlNormal'.
Error:(157, 21) No resource found that matches the given name: attr 'android:colorPrimary'.
Error:(158, 21) No resource found that matches the given name: attr 'android:colorPrimaryDark'.
Error:(166, 21) No resource found that matches the given name: attr 'android:windowElevation'.
Error:(169, 21) No resource found that matches the given name: attr 'android:windowElevation'.
Error:(171) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ActionBar.TabText'.
Error:(173) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ActionBar.TabView'.
Error:(175) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ActionButton'.
Error:(177) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ActionButton.CloseMode'.
Error:(180) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ActionButton.Overflow'.
Error:(185) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Button'.
Error:(186) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Button.Borderless'.
Error:(187) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Button.Borderless.Colored'.
Error:(190) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Button.Small'.
Error:(191) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ButtonBar'.
Error:(192) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.CompoundButton.CheckBox'.
Error:(193) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.CompoundButton.RadioButton'.
Error:(194) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.DropDownItem.Spinner'.
Error:(198) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ImageButton'.
Error:(199) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Light.ActionBar.TabText'.
Error:(201) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Light.ActionBar.TabText'.
Error:(203) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Light.ActionBar.TabView'.
Error:(205) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Light.PopupMenu'.
Error:(209, 21) No resource found that matches the given name: attr 'android:overlapAnchor'.
Error:(211) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ListPopupWindow'.
Error:(213) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ListView'.
Error:(214) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ListView.DropDown'.
Error:(216) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.PopupMenu'.
Error:(220, 21) No resource found that matches the given name: attr 'android:overlapAnchor'.
Error:(226) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.RatingBar'.
Error:(227) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.SeekBar'.
Error:(228) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Spinner'.
Error:(229) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.TextView.SpinnerItem'.
Error:(230) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Toolbar.Button.Navigation'.
Error:(282, 21) No resource found that matches the given name: attr 'android:colorAccent'.
Error:(286, 21) No resource found that matches the given name: attr 'android:colorButtonNormal'.
Error:(284, 21) No resource found that matches the given name: attr 'android:colorControlActivated'.
Error:(285, 21) No resource found that matches the given name: attr 'android:colorControlHighlight'.
Error:(283, 21) No resource found that matches the given name: attr 'android:colorControlNormal'.
Error:(280, 21) No resource found that matches the given name: attr 'android:colorPrimary'.
Error:(281, 21) No resource found that matches the given name: attr 'android:colorPrimaryDark'.
Error:(290) Error retrieving parent for item: No resource found that matches the given name 'android:Theme.Material.NoActionBar'.
Error:(302) Error retrieving parent for item: No resource found that matches the given name 'android:Theme.Material.Light.NoActionBar'.
Error:(315) Error retrieving parent for item: No resource found that matches the given name '@android:style/TextAppearance.Material.Notification.Info'.
Error:(322) Error retrieving parent for item: No resource found that matches the given name '@android:style/TextAppearance.Material.Notification.Time'.
Error:(341, 21) No resource found that matches the given name: attr 'android:stateListAnimator'.
Error:(23) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Inverse'.
Error:(25) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Large.Inverse'.
Error:(31) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Medium.Inverse'.
Error:(38) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Small.Inverse'.
Error:(222) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ProgressBar'.
Error:(224) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ProgressBar.Horizontal'.
Error:(232) Error retrieving parent for item: No resource found that matches the given name '@android:style/Theme.Material.NoActionBar'.
Error:(238) Error retrieving parent for item: No resource found that matches the given name '@android:style/Theme.Material.Light.NoActionBar'.
Error:(273) Error retrieving parent for item: No resource found that matches the given name '@android:style/Theme.Material.NoActionBar'.
Error:(330) Error retrieving parent for item: No resource found that matches the given name '@android:style/Theme.Material.Light.DialogWhenLarge.NoActionBar'.
Error:(182) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.AutoCompleteTextView'.
Error:(195) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.EditText'.
Error:(16) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Button'.
Error:(314) Error retrieving parent for item: No resource found that matches the given name '@android:style/TextAppearance.Material.Notification'.
Error:(326) Error retrieving parent for item: No resource found that matches the given name '@android:style/TextAppearance.Material.Notification.Title'.
Error:(11, 21) No resource found that matches the given name: attr 'android:statusBarColor'.
Error:(10, 21) No resource found that matches the given name: attr 'android:windowDrawsSystemBarBackgrounds'.
Error:(13) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material'.
Error:(14) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Body1'.
Error:(15) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Body2'.
Error:(17) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Caption'.
Error:(18) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Display1'.
Error:(19) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Display2'.
Error:(20) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Display3'.
Error:(21) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Display4'.
Error:(22) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Headline'.
Error:(24) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Large'.
Error:(26) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.PopupMenu.Large'.
Error:(28) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.PopupMenu.Small'.
Error:(30) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Medium'.
Error:(32) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Menu'.
Error:(33) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.SearchResult.Subtitle'.
Error:(35) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.SearchResult.Title'.
Error:(37) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Small'.
Error:(39) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Subhead'.
Error:(40) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Title'.
Error:(41) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionBar.Subtitle'.
Error:(43) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionBar.Subtitle.Inverse'.
Error:(45) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionBar.Title'.
Error:(47) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionBar.Title.Inverse'.
Error:(49) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionMode.Subtitle'.
Error:(51) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionMode.Title'.
Error:(53) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button'.
Error:(59) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.PopupMenu.Large'.
Error:(61) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.PopupMenu.Small'.
Error:(63) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Button'.
Error:(64) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.TextView.SpinnerItem'.
Error:(65) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionBar.Subtitle'.
Error:(67) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionBar.Title'.
Error:(112, 21) No resource found that matches the given name: attr 'android:colorAccent'.
Error:(116, 21) No resource found that matches the given name: attr 'android:colorButtonNormal'.
Error:(114, 21) No resource found that matches the given name: attr 'android:colorControlActivated'.
Error:(115, 21) No resource found that matches the given name: attr 'android:colorControlHighlight'.
Error:(113, 21) No resource found that matches the given name: attr 'android:colorControlNormal'.
Error:(110, 21) No resource found that matches the given name: attr 'android:colorPrimary'.
Error:(111, 21) No resource found that matches the given name: attr 'android:colorPrimaryDark'.
Error:(119, 21) No resource found that matches the given name: attr 'android:windowElevation'.
Error:(159, 21) No resource found that matches the given name: attr 'android:colorAccent'.
Error:(163, 21) No resource found that matches the given name: attr 'android:colorButtonNormal'.
Error:(161, 21) No resource found that matches the given name: attr 'android:colorControlActivated'.
Error:(162, 21) No resource found that matches the given name: attr 'android:colorControlHighlight'.
Error:(160, 21) No resource found that matches the given name: attr 'android:colorControlNormal'.
Error:(157, 21) No resource found that matches the given name: attr 'android:colorPrimary'.
Error:(158, 21) No resource found that matches the given name: attr 'android:colorPrimaryDark'.
Error:(166, 21) No resource found that matches the given name: attr 'android:windowElevation'.
Error:(169, 21) No resource found that matches the given name: attr 'android:windowElevation'.
Error:(171) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ActionBar.TabText'.
Error:(173) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ActionBar.TabView'.
Error:(175) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ActionButton'
```

答:
The solution is to update the compileSdkVersion to match the targetSdkVersion:

compileSdkVersion 17 does not compile

compileSdkVersion 25 does

The configuration should be minSdkVersion <= targetSdkVersion <= compileSdkVersion

Body:
I'm having difficulty compiling my for SDK 17. It compiles just fine for SDK 25. I've tried using build tools (19.1.0) so that it matches the compileSdkVersion as well as change the versions of the com.android... packages to match the compileSdkVersion. I've tried a few other things but none worked. I would really really appreciate any help!

Here's my Manifest:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 17
    buildToolsVersion '25.0.2'
    defaultConfig {
        applicationId "com.example.android.notmyrealappid"
        minSdkVersion 16
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
        vectorDrawables.useSupportLibrary = true
        multiDexEnabled true

    }
dexOptions {
    javaMaxHeapSize "5g"
}
}
dependencies {

compile 'com.google.android.gms:play-services-basement:10.2.0'
compile 'com.google.android.gms:play-services-tasks:10.2.0'*/

compile 'com.google.android.gms:play-services:10.2.0'
compile 'com.android.support:appcompat-v7:25.2.0'

compile 'com.android.support:design:25.2.0'
compile 'com.android.support:cardview-v7:25.2.0'
compile 'com.android.support:recyclerview-v7:25.2.0'
compile 'com.google.firebase:firebase-core:10.2.0'
compile 'com.google.firebase:firebase-database:10.2.0'
compile 'com.google.firebase:firebase-auth:10.2.0'
compile 'com.google.firebase:firebase-messaging:10.2.0'
compile 'com.firebaseui:firebase-ui:1.2.0'
compile 'com.google.android.gms:play-services-auth:10.2.0'
compile 'com.firebaseui:firebase-ui-database:1.2.0'
compile 'com.firebaseui:firebase-ui-storage:1.2.0'
compile 'de.hdodenhof:circleimageview:2.1.0'

compile 'com.android.support:support-v4:25.2.0'
compile 'com.android.support:support-vector-drawable:25.2.0'

compile 'com.android.support.constraint:constraint-layout:1.0.2'

//Added due to issue with android.support 25.2.0 update
compile 'com.android.support:customtabs:25.2.0'
compile 'com.android.support:palette-v7:25.2.0'
compile 'com.android.support:mediarouter-v7:25.2.0'

//Glide for images
compile 'com.github.bumptech.glide:glide:3.7.0'
//multi dex - should refactor code so that isnt necessary
compile 'com.android.support:multidex:1.0.1'
}

apply plugin: 'com.google.gms.google-services'

Here's styles.xml file:

<resources>

</resources>

Lastly here is error that I receive:

D:\Dev files\android-design-library-master\app\build\intermediates\res\merged\debug\values-ldltr-v21\values-ldltr-v21.xml
Error:(3) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Spinner.Underlined'.
Error:(3) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Spinner.Underlined'.

D:\Dev files\android-design-library-master\app\build\intermediates\res\merged\debug\values-v21\values-v21.xml
Error:(23) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Inverse'.
Error:(25) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Large.Inverse'.
Error:(31) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Medium.Inverse'.
Error:(38) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Small.Inverse'.
Error:(222) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ProgressBar'.
Error:(224) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ProgressBar.Horizontal'.
Error:(232) Error retrieving parent for item: No resource found that matches the given name '@android:style/Theme.Material.NoActionBar'.
Error:(238) Error retrieving parent for item: No resource found that matches the given name '@android:style/Theme.Material.Light.NoActionBar'.
Error:(273) Error retrieving parent for item: No resource found that matches the given name '@android:style/Theme.Material.NoActionBar'.
Error:(330) Error retrieving parent for item: No resource found that matches the given name '@android:style/Theme.Material.Light.DialogWhenLarge.NoActionBar'.
Error:(182) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.AutoCompleteTextView'.
Error:(195) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.EditText'.
Error:(16) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Button'.
Error:(314) Error retrieving parent for item: No resource found that matches the given name '@android:style/TextAppearance.Material.Notification'.
Error:(326) Error retrieving parent for item: No resource found that matches the given name '@android:style/TextAppearance.Material.Notification.Title'.
Error:(11, 21) No resource found that matches the given name: attr 'android:statusBarColor'.
Error:(10, 21) No resource found that matches the given name: attr 'android:windowDrawsSystemBarBackgrounds'.
Error:(13) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material'.
Error:(14) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Body1'.
Error:(15) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Body2'.
Error:(17) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Caption'.
Error:(18) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Display1'.
Error:(19) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Display2'.
Error:(20) Error retrieving parent for item: No resource found that matches
Error:(22) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Headline'.
Error:(24) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Large'.
Error:(26) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.PopupMenu.Large'.
Error:(28) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.PopupMenu.Small'.
Error:(30) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Medium'.
Error:(32) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Menu'.
Error:(33) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.SearchResult.Subtitle'.
Error:(35) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.SearchResult.Title'.
Error:(37) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Small'.
Error:(39) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Subhead'.
Error:(40) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Title'.
Error:(41) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionBar.Subtitle'.
Error:(43) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionBar.Subtitle.Inverse'.
Error:(45) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionBar.Title'.
Error:(47) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionBar.Title.Inverse'.
Error:(49) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionMode.Subtitle'.
Error:(51) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionMode.Title'.
Error:(53) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button'.
Error:(59) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.PopupMenu.Large'.
Error:(61) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.PopupMenu.Small'.
Error:(63) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Button'.
Error:(64) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.TextView.SpinnerItem'.
Error:(65) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionBar.Subtitle'.
Error:(67) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionBar.Title'.
Error:(112, 21) No resource found that matches the given name: attr 'android:colorAccent'.
Error:(116, 21) No resource found that matches the given name: attr 'android:colorButtonNormal'.
Error:(114, 21) No resource found that matches the given name: attr 'android:colorControlActivated'.
Error:(115, 21) No resource found that matches the given name: attr 'android:colorControlHighlight'.
Error:(113, 21) No resource found that matches the given name: attr 'android:colorControlNormal'.
Error:(110, 21) No resource found that matches the given name: attr 'android:colorPrimary'.
Error:(111, 21) No resource found that matches the given name: attr 'android:colorPrimaryDark'.
Error:(119, 21) No resource found that matches the given name: attr 'android:windowElevation'.
Error:(159, 21) No resource found that matches the given name: attr 'android:colorAccent'.
Error:(163, 21) No resource found that matches the given name: attr 'android:colorButtonNormal'.
Error:(161, 21) No resource found that matches the given name: attr 'android:colorControlActivated'.
Error:(162, 21) No resource found that matches the given name: attr 'android:colorControlHighlight'.
Error:(160, 21) No resource found that matches the given name: attr 'android:colorControlNormal'.
Error:(157, 21) No resource found that matches the given name: attr 'android:colorPrimary'.
Error:(158, 21) No resource found that matches the given name: attr 'android:colorPrimaryDark'.
Error:(166, 21) No resource found that matches the given name: attr 'android:windowElevation'.
Error:(169, 21) No resource found that matches the given name: attr 'android:windowElevation'.
Error:(171) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ActionBar.TabText'.
Error:(173) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ActionBar.TabView'.
Error:(175) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ActionButton'.
Error:(177) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ActionButton.CloseMode'.
Error:(180) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ActionButton.Overflow'.
Error:(185) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Button'.
Error:(186) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Button.Borderless'.
Error:(187) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Button.Borderless.Colored'.
Error:(190) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Button.Small'.
Error:(191) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ButtonBar'.
Error:(192) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.CompoundButton.CheckBox'.
Error:(193) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.CompoundButton.RadioButton'.
Error:(194) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.DropDownItem.Spinner'.
Error:(198) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ImageButton'.
Error:(199) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Light.ActionBar.TabText'.
Error:(201) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Light.ActionBar.TabText'.
Error:(203) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Light.ActionBar.TabView'.
Error:(205) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Light.PopupMenu'.
Error:(209, 21) No resource found that matches the given name: attr 'android:overlapAnchor'.
Error:(211) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ListPopupWindow'.
Error:(213) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ListView'.
Error:(214) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ListView.DropDown'.
Error:(216) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.PopupMenu'.
Error:(220, 21) No resource found that matches the given name: attr 'android:overlapAnchor'.
Error:(226) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.RatingBar'.
Error:(227) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.SeekBar'.
Error:(228) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Spinner'.
Error:(229) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.TextView.SpinnerItem'.
Error:(230) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Toolbar.Button.Navigation'.
Error:(282, 21) No resource found that matches the given name: attr 'android:colorAccent'.
Error:(286, 21) No resource found that matches the given name: attr 'android:colorButtonNormal'.
Error:(284, 21) No resource found that matches the given name: attr 'android:colorControlActivated'.
Error:(285, 21) No resource found that matches the given name: attr 'android:colorControlHighlight'.
Error:(283, 21) No resource found that matches the given name: attr 'android:colorControlNormal'.
Error:(280, 21) No resource found that matches the given name: attr 'android:colorPrimary'.
Error:(281, 21) No resource found that matches the given name: attr 'android:colorPrimaryDark'.
Error:(290) Error retrieving parent for item: No resource found that matches the given name 'android:Theme.Material.NoActionBar'.
Error:(302) Error retrieving parent for item: No resource found that matches the given name 'android:Theme.Material.Light.NoActionBar'.
Error:(315) Error retrieving parent for item: No resource found that matches the given name '@android:style/TextAppearance.Material.Notification.Info'.
Error:(322) Error retrieving parent for item: No resource found that matches the given name '@android:style/TextAppearance.Material.Notification.Time'.
Error:(341, 21) No resource found that matches the given name: attr 'android:stateListAnimator'.
Error:(23) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Inverse'.
Error:(25) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Large.Inverse'.
Error:(31) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Medium.Inverse'.
Error:(38) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Small.Inverse'.
Error:(222) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ProgressBar'.
Error:(224) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ProgressBar.Horizontal'.
Error:(232) Error retrieving parent for item: No resource found that matches the given name '@android:style/Theme.Material.NoActionBar'.
Error:(238) Error retrieving parent for item: No resource found that matches the given name '@android:style/Theme.Material.Light.NoActionBar'.
Error:(273) Error retrieving parent for item: No resource found that matches the given name '@android:style/Theme.Material.NoActionBar'.
Error:(330) Error retrieving parent for item: No resource found that matches the given name '@android:style/Theme.Material.Light.DialogWhenLarge.NoActionBar'.
Error:(182) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.AutoCompleteTextView'.
Error:(195) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.EditText'.
Error:(16) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Button'.
Error:(314) Error retrieving parent for item: No resource found that matches the given name '@android:style/TextAppearance.Material.Notification'.
Error:(326) Error retrieving parent for item: No resource found that matches the given name '@android:style/TextAppearance.Material.Notification.Title'.
Error:(11, 21) No resource found that matches the given name: attr 'android:statusBarColor'.
Error:(10, 21) No resource found that matches the given name: attr 'android:windowDrawsSystemBarBackgrounds'.
Error:(13) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material'.
Error:(14) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Body1'.
Error:(15) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Body2'.
Error:(17) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Caption'.
Error:(18) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Display1'.
Error:(19) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Display2'.
Error:(20) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Display3'.
Error:(21) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Display4'.
Error:(22) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Headline'.
Error:(24) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Large'.
Error:(26) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.PopupMenu.Large'.
Error:(28) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.PopupMenu.Small'.
Error:(30) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Medium'.
Error:(32) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Menu'.
Error:(33) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.SearchResult.Subtitle'.
Error:(35) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.SearchResult.Title'.
Error:(37) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Small'.
Error:(39) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Subhead'.
Error:(40) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Title'.
Error:(41) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionBar.Subtitle'.
Error:(43) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionBar.Subtitle.Inverse'.
Error:(45) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionBar.Title'.
Error:(47) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionBar.Title.Inverse'.
Error:(49) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionMode.Subtitle'.
Error:(51) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionMode.Title'.
Error:(53) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button'.
Error:(59) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.PopupMenu.Large'.
Error:(61) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.PopupMenu.Small'.
Error:(63) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Button'.
Error:(64) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.TextView.SpinnerItem'.
Error:(65) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionBar.Subtitle'.
Error:(67) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionBar.Title'.
Error:(112, 21) No resource found that matches the given name: attr 'android:colorAccent'.
Error:(116, 21) No resource found that matches the given name: attr 'android:colorButtonNormal'.
Error:(114, 21) No resource found that matches the given name: attr 'android:colorControlActivated'.
Error:(115, 21) No resource found that matches the given name: attr 'android:colorControlHighlight'.
Error:(113, 21) No resource found that matches the given name: attr 'android:colorControlNormal'.
Error:(110, 21) No resource found that matches the given name: attr 'android:colorPrimary'.
Error:(111, 21) No resource found that matches the given name: attr 'android:colorPrimaryDark'.
Error:(119, 21) No resource found that matches the given name: attr 'android:windowElevation'.
Error:(159, 21) No resource found that matches the given name: attr 'android:colorAccent'.
Error:(163, 21) No resource found that matches the given name: attr 'android:colorButtonNormal'.
Error:(161, 21) No resource found that matches the given name: attr 'android:colorControlActivated'.
Error:(162, 21) No resource found that matches the given name: attr 'android:colorControlHighlight'.
Error:(160, 21) No resource found that matches the given name: attr 'android:colorControlNormal'.
Error:(157, 21) No resource found that matches the given name: attr 'android:colorPrimary'.
Error:(158, 21) No resource found that matches the given name: attr 'android:colorPrimaryDark'.
Error:(166, 21) No resource found that matches the given name: attr 'android:windowElevation'.
Error:(169, 21) No resource found that matches the given name: attr 'android:windowElevation'.
Error:(171) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ActionBar.TabText'.
Error:(173) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ActionBar.TabView'.
Error:(175) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ActionButton'


问:
How to check if a user is authenticated on 2 different web apps?
I've been looking around the Internet but I cannot find anything related to my specific case online.

Let's assume there are 2 web applications. wa1 and wa2. wa1 is written in PHP, located on domain1.com and wa2 is written in Python, located on domain2.com. There is a common database user_info which stores user information such as usernames and passwords, and another database user_logged_in which lists users and their sessions.

The user will authenticate through wa1. How can I check if the user is authenticated in wa2, if I cannot use remote MySQL to access the user_logged_in database? Is it possible to set a cookie such that the site on domain2.com can read the cookie set by domain1.com?

答:
If I got it right, I believe that you need a Single Sign On solution.

I'd recommend that you take a look at OpenID Connect specifications.

In this scenario you will need to add a third "app", which is going to be the responsible for issuing tokens to authenticated users (some sort of Identity Server). All the user related information will be stored and managed by this service.

The apps themselves will rely on the Tokens in order to check if there's a valid user and they can fetch user information from the Identity Server.

A great option for that is IdentityServer, which is open-source: https://identityserver.github.io/Documentation/

Their documentation is very good and will give you a more in-depth explanation.

Hope it helps.


答:
You can achieve all of this using jQuery's .slideToggle() function.

```<code>function showDropdown(x) {
  let id = x;

  if (id == 1) {
    $("#1").slideToggle();
    console.log(id);
  }

  if (id == 2) {
     $("#2").slideToggle();
    console.log(id);
  }

  if (id == 3) {
    $("#3").slideToggle();
    console.log(id);
  } else {
    console.log(id);
  }
}
</code>```

By using slideToggle you are checking to see what the current state is, toggling it to the opposite state and it will also animate.

Edit; Another user has beat me to it.

Title: Button onClick event

Body:
You can achieve all of this using jQuery's .slideToggle() function.

function showDropdown(x) {
  let id = x;

  if (id == 1) {
    $("#1").slideToggle();
    console.log(id);
  }

  if (id == 2) {
     $("#2").slideToggle();
    console.log(id);
  }

  if (id == 3) {
    $("#3").slideToggle();
    console.log(id);
  } else {
    console.log(id);
  }
}

By using slideToggle you are checking to see what the current state is, toggling it to the opposite state and it will also animate.

Edit; Another user has beat me to it.


问:
How to access the nested JSON objects
I want to access nested JSON object values by iterating.

I tried console.log(test[0].Invoice[0].Cost.NO[0]); but it's not working.

var test = [{
  "Invoice": {
    "NO": "869",
    "$$hashKey": "object:186"
  },
  "Cost": [{
    "NO": 183,
    "Amnt": 100
  }, {
    "NO": 184,
    "Amnt": 200
  }]
}, {
  "Invoice": {
    "NO": "698",
    "$$hashKey": "object:189"
  },
  "Cost": [{
    "NO": 110,
    "Amnt": 150
  }, {
    "NO": 142,
    "Amnt": 263
  }]
}];

console.log(test[0].Invoice[0].Cost.NO[0]);```

答:
Your code console.log(test[0].Invoice[0].Cost.NO[0]); won't work.

Because Invoice and Cost are same level objects (Cost isn't nested in Invoice).

Check below example on how to access them.

You would need to understand Arrays [] and Objects {}.

var test = [{
  "Invoice": {
    "NO": "869",
    "$$hashKey": "object:186"
  },
  "Cost": [{
    "NO": 183,
    "Amnt": 100
  }, {
    "NO": 184,
    "Amnt": 200
  }]
}, {
  "Invoice": {
    "NO": "698",
    "$$hashKey": "object:189"
  },
  "Cost": [{
    "NO": 110,
    "Amnt": 150
  }, {
    "NO": 142,
    "Amnt": 263
  }]
}];

// To access COST
console.log(test[0].Cost[0].NO);

// To access Invoice
console.log(test[0].Invoice.NO);```

Title: How to access the nested JSON objects


问:
How to convert clob to string using Groovy?
i want to select data from a table with datatype clob.
so the resut is like oracle.sql.CLOB@12fe54d
I want to display the data as string as they appear in the table.

in groovy i tried this:

```<code>rowTest = sql.firstRow("select name from table where id=10")
clobTest = (oracle.sql.CLOB)rowTest[0]

byte_stream_test = clobTest.getBinaryStream()
if( byte_stream_test == null ) {  println "Test: Received null stream!"  }

byte[] byte_array_test = new byte[10]
int bytes_read_test = byte_stream_test.read(byte_array_test)

print "Read $bytes_read_test bytes from the clob!"

sql.connection.close()
</code>```

I have the following error:

```<code>---- A working test of writing and then reading a blob into an Oracle DB ---
Exception in thread "main" groovy.lang.MissingMethodException: No signature of method: oracle.sql.CLOB.getBinaryStream() is applicable for argument types: () values: []
    at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:56)
    at org.codehaus.groovy.runtime.callsite.PojoMetaClassSite.call(PojoMetaClassSite.java:46)
    at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:112)
    at Test2.run(Test2.groovy:10)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
    at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:324)
    at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1207)
    at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1016)
    at org.codehaus.groovy.runtime.InvokerHelper.invokePogoMethod(InvokerHelper.java:901)
    at org.codehaus.groovy.runtime.InvokerHelper.invokeMethod(InvokerHelper.java:884)
    at org.codehaus.groovy.runtime.InvokerHelper.runScript(InvokerHelper.java:406)
    at org.codehaus.groovy.runtime.InvokerHelper$runScript.call(Unknown Source)
    at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:120)
    at Test2.main(Test2.groovy)
</code>```

Can you help me to resolve this problem, thank you

答:
Use characterStream instead of asciiStream to support Unicode characters:</p>

```<code>String unicode = "äö"
Clob clob = new ClobImpl(unicode)
String strClob = clob?.characterStream?.text
assertEquals(strClob, unicode)
</code>```

Body:
i want to select data from a table with datatype clob.
so the resut is like oracle.sql.CLOB@12fe54d
I want to display the data as string as they appear in the table.

in groovy i tried this:

rowTest = sql.firstRow("select name from table where id=10")
clobTest = (oracle.sql.CLOB)rowTest[0]

byte_stream_test = clobTest.getBinaryStream()
if( byte_stream_test == null ) {  println "Test: Received null stream!"  }

byte[] byte_array_test = new byte[10]
int bytes_read_test = byte_stream_test.read(byte_array_test)

print "Read $bytes_read_test bytes from the clob!"

sql.connection.close()

I have the following error:

---- A working test of writing and then reading a blob into an Oracle DB ---
Exception in thread "main" groovy.lang.MissingMethodException: No signature of method: oracle.sql.CLOB.getBinaryStream() is applicable for argument types: () values: []
    at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:56)
    at org.codehaus.groovy.runtime.callsite.PojoMetaClassSite.call(PojoMetaClassSite.java:46)
    at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:112)
    at Test2.run(Test2.groovy:10)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
    at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:324)
    at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1207)
    at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1016)
    at org.codehaus.groovy.runtime.InvokerHelper.invokePogoMethod(InvokerHelper.java:901)
    at org.codehaus.groovy.runtime.InvokerHelper.invokeMethod(InvokerHelper.java:884)
    at org.codehaus.groovy.runtime.InvokerHelper.runScript(InvokerHelper.java:406)
    at org.codehaus.groovy.runtime.InvokerHelper$runScript.call(Unknown Source)
    at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:120)
    at Test2.main(Test2.groovy)

Can you help me to resolve this problem, thank you

Body:
Use characterStream instead of asciiStream to support Unicode characters:

String unicode = "äö"
Clob clob = new ClobImpl(unicode)
String strClob = clob?.characterStream?.text
assertEquals(strClob, unicode)


问:
Getting HTML form elements to be in line
I am using some bootstrap elements along with some buttons and have issues getting them all to show up in one line! I have something like:

```<code><span><input class="form-control" id="filename" value="Select a ZIP file to upload..." disabled style="display: inline" ></span>
<span><input type="button" id="get_file" class="btn btn-primary" value="Browse" style="display: inline"></span>
<span><input type="button" id="get_file" class="btn btn-success" value="Upload" style="display: inline"></span>
<input type="file" id="my_file" accept=".zip" style="display: none">
</code>```

This should basically show a text field with two buttons and I get an output like:

What i would like is for the two buttons to be on the same row as well...

答:
```<code><form class="form-inline">
<span><input class="form-control" id="filename" value="Select a ZIP file to upload..." disabled></span>
<span><input type="button" id="get_file" class="btn btn-primary" value="Browse"></span>
<span><input type="button" id="get_file2" class="btn btn-success" value="Upload"></span>
<input type="file" id="my_file" accept=".zip" style="display: none">
</code>```

try it.

check this document.

Body:
I am using some bootstrap elements along with some buttons and have issues getting them all to show up in one line! I have something like:

<input class="form-control" id="filename" value="Select a ZIP file to upload..." disabled style="display: inline" >
<input type="button" id="get_file" class="btn btn-primary" value="Browse" style="display: inline">
<input type="button" id="get_file" class="btn btn-success" value="Upload" style="display: inline">
<input type="file" id="my_file" accept=".zip" style="display: none">

This should basically show a text field with two buttons and I get an output like:

What i would like is for the two buttons to be on the same row as well...

Body:
<form class="form-inline">
<span><input class="form-control" id="filename" value="Select a ZIP file to upload..." disabled></span>
<span><input type="button" id="get_file" class="btn btn-primary" value="Browse"></span>
<span><input type="button" id="get_file2" class="btn btn-success" value="Upload"></span>
<input type="file" id="my_file" accept=".zip" style="display: none">

try it.

check this document.


问:
How to show electron window on top of the screen?
I already have browser window which is running on background. I want to show that window on top of the screen When i call a function. But my initial window should be on background. if i use alwaysontop : true keeps my window always visible.

// my initial window
var electron = require('electron');
mainWindow = new BrowserWindow({width:265,height:420,resizable:false,alwaysOnTop:false,frame:false})

ipcMain.on('showontop', function (event) {
 //it doesn't work
  mainWindow({alwaysOnTop:false});
})

function showwin()
{
ipcMain.on('showontop', function (event) {
 //it doesn't work
  mainWindow({alwaysOnTop:false});
})
}```
<pre class="snippet-code-html lang-html prettyprint-override"><code><button onclick="showwin();"> Click </button></code>```

答:
I want to show my window on top when click event occurs, simply make it by mainwin.setalwaysOnTop(true);

// in electron

mainwindow.setalwaysontop("true");
// once show then it leaves from top when click outside
settimeout(funtion()
{
  mainwindow.setalwaysontop("false");
},1000)```

Body:
I already have browser window which is running on background. I want to show that window on top of the screen When i call a function. But my initial window should be on background. if i use alwaysontop : true keeps my window always visible.

// my initial window
var electron = require('electron');
mainWindow = new BrowserWindow({width:265,height:420,resizable:false,alwaysOnTop:false,frame:false})

ipcMain.on('showontop', function (event) {
 //it doesn't work
  mainWindow({alwaysOnTop:false});
})

function showwin()
{
ipcMain.on('showontop', function (event) {
 //it doesn't work
  mainWindow({alwaysOnTop:false});
})
}

<button onclick="showwin();"> Click </button>