qid int64 1 74.7M | question stringlengths 15 58.3k | date stringlengths 10 10 | metadata list | response_j stringlengths 4 30.2k | response_k stringlengths 11 36.5k |
|---|---|---|---|---|---|
47,024,099 | I get this error with a little arrow pointing at decimal integers. Are decimals allowed? What do I have to write to make decimals acceptable? This is my code:
```
public class BinarySearch {
public static final int NOT_FOUND = -1;
public static int search(int[] arr, int searchValue) {
int left = 0;
... | 2017/10/30 | [
"https://Stackoverflow.com/questions/47024099",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8858781/"
] | This isn't an Angular issue, it's just how CSS and Javascript interact. You need to use `getComputedStyle` to read style properties that were defined in a CSS file.
```js
// This will work (because it's an inline style)
console.log(document.getElementById('a').style.width)
// This won't work (because the style was ... | You cannot get css template rule values of elements calling style properties unless they were set
\*1. using inline style on html element level; or
\*2. the style property has been set using JavaScript
which does the same: writes to inline html style property of the target element.
the solution is to use the comput... |
274 | According to [Wikipedia](https://en.wikipedia.org/wiki/Chaos_Monkey), ChoasMonkey is used to test resilience of IT infrastructure. What about creating a [resilience](https://devops.stackexchange.com/questions/tagged/resilience "show questions tagged 'resilience'") or [resilience-testing](https://devops.stackexchange.co... | 2018/04/27 | [
"https://devops.meta.stackexchange.com/questions/274",
"https://devops.meta.stackexchange.com",
"https://devops.meta.stackexchange.com/users/210/"
] | The generalized term being used in the industry is "chaos engineering", see <https://principlesofchaos.org/>, writing from Netflix, writing from Gremlin. Tag should be chaos-engineering. | I would like a chaos-monkey tag or "failure as a service". I work with that occasionally. Validating stuff and failing it. |
19,506,988 | Using some simple JavaScript, I'm getting what seems to be an incorrect value returned for one of my two pieces of similar code. For `browserName` I am getting Netscape as the value returned regardless of what browser I test the code on. `browserVer`, however, seems to return the correct value, shown below using Google... | 2013/10/22 | [
"https://Stackoverflow.com/questions/19506988",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2262393/"
] | A quick Google of what `navigator.appName` actually means returns [this MDN page](https://developer.mozilla.org/en-US/docs/Web/API/NavigatorID.appName) which includes the fact that:
>
> The HTML5 specification also allows any browser to return "Netscape" here, for compatibility reasons.
>
>
>
Instead, you should ... | A better search revealed the answer ([Why does JavaScript navigator.appName return Netscape for Safari, Firefox and Chrome?](https://stackoverflow.com/questions/14573881/why-the-javascript-navigator-appname-returns-netscape-for-safari-firefox-and-ch))
*"MDN says: "This was originally part of DOM Level 0, but has been ... |
51,242 | **Introduction**
This challenge is about three (bad) sorting algorithms: [`Bogosort`](http://en.wikipedia.org/wiki/Bogosort), and two others variants that I came up with (but have probably been thought of by others at some point in time): `Bogoswap` (AKA Bozosort) and `Bogosmart`.
`Bogosort` works by completely shuf... | 2015/06/04 | [
"https://codegolf.stackexchange.com/questions/51242",
"https://codegolf.stackexchange.com",
"https://codegolf.stackexchange.com/users/40857/"
] | Pyth, ~~62~~ 60 bytes
=====================
```
VTjd[jkKJ=boO0=ZS8fqZ=KoO0K0fqZ=XJO.CJ2)0fqZ=Xb*>F=NO.Cb2N)0
```
This was quite fun. Not sure if this is valid, I'm probably using some unwritten loopholes.
A sample output would be:
```
23187456 22604 23251 110
42561378 125642 115505 105
62715843 10448 35799 69
72... | JavaScript (*ES6*), 319 ~~345~~
===============================
Unsurprisingly this is quite long.
For Random shuffle, credits to [@core1024](https://codegolf.stackexchange.com/a/45453/21348) (better than mine for the same chellenge)
Test running the snippet (Firefox only as usual)
```js
// FOR TEST : redefine cons... |
27,202,860 | Why we use json and xml for web api rather then othen platform like jquery and array.
Its interview based question and I was enable to response . | 2014/11/29 | [
"https://Stackoverflow.com/questions/27202860",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3790663/"
] | JSON and XML are ways to format and data-interchange.
JQuery is a library was built on top of javascript. so it has nothing to do in data-interchange.
Array by its definition: its a method for storing information. in other words you can use arrays in any format you want to store data.
In Conclusion, Web API is a servi... | This is not compulsory that you have to return the result in JSON or XML, but most of the time we are returning values in these format because there are media type formatter for JSON and XML, the capability of media type formatter is to read the CLR object from HTTP message and to write the CLR object into HTTP message... |
27,787,842 | I have a code that will connect to several routers, using the telentlib, run some code within those, and finally write the output to a file. It runs smoothly.
However, when I had to access lots of routers (+50) the task consumes a lot of time (the code runs serially, one router at a time). I thought then on implementi... | 2015/01/05 | [
"https://Stackoverflow.com/questions/27787842",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4421575/"
] | So after some digging, the error was found.
Before, the function writeTelnet() was declared outside the class. Once moved inside of it and properly being referenced by the rest (ie: self.writeTelnet()) everything worked so far as expected.
Here's the snippet of the new code:
```
class MiThread(threading.Thread):
... | From past experience, you need to start all of the threads and have them join after they have all started.
```
thread_list = []
for i in range(routers):
t = MiThread(i, routers[i])
threadlist.append(t)
t.start()
for i in thread_list:
i.join()
```
This will start every thread and then wait for all th... |
27,787,842 | I have a code that will connect to several routers, using the telentlib, run some code within those, and finally write the output to a file. It runs smoothly.
However, when I had to access lots of routers (+50) the task consumes a lot of time (the code runs serially, one router at a time). I thought then on implementi... | 2015/01/05 | [
"https://Stackoverflow.com/questions/27787842",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4421575/"
] | From past experience, you need to start all of the threads and have them join after they have all started.
```
thread_list = []
for i in range(routers):
t = MiThread(i, routers[i])
threadlist.append(t)
t.start()
for i in thread_list:
i.join()
```
This will start every thread and then wait for all th... | I think you can bunch them up. something like below. (not tried)
```
count=20
start=1
for i in range(len(routers)):
if start == count :
for _myth in range(1,i+1):
thread_list[_myth].join()
start+=1
FileOutCsv = "00_log.csv"
# creating output file
fc = open(FileOutCsv,"a")
# running routine
t = MiTh... |
27,787,842 | I have a code that will connect to several routers, using the telentlib, run some code within those, and finally write the output to a file. It runs smoothly.
However, when I had to access lots of routers (+50) the task consumes a lot of time (the code runs serially, one router at a time). I thought then on implementi... | 2015/01/05 | [
"https://Stackoverflow.com/questions/27787842",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4421575/"
] | So after some digging, the error was found.
Before, the function writeTelnet() was declared outside the class. Once moved inside of it and properly being referenced by the rest (ie: self.writeTelnet()) everything worked so far as expected.
Here's the snippet of the new code:
```
class MiThread(threading.Thread):
... | I think you can bunch them up. something like below. (not tried)
```
count=20
start=1
for i in range(len(routers)):
if start == count :
for _myth in range(1,i+1):
thread_list[_myth].join()
start+=1
FileOutCsv = "00_log.csv"
# creating output file
fc = open(FileOutCsv,"a")
# running routine
t = MiTh... |
3,545,259 | I am currently using the following code but its very slow for large numbers
```
static int divisor(int number)
{
int i;
for (i = number / 2; i >= 1; i--)
{
if (number % i == 0)
{
break;
}
... | 2010/08/23 | [
"https://Stackoverflow.com/questions/3545259",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/301012/"
] | First thought you can find the smallest divisor d (not equal to 1 of course), then N/d will be the largest divisor you're looking for.
For example if N is divisible by 3 then you'll need 2 iterations to find the answer - in your case it would be about N/6 iterations.
**Edit:** To further improve your algorithm you ... | Java implementation of the solution:
```
static int highestDivisor(int n) {
if ((n & 1) == 0)
return n / 2;
int i = 3;
while (i * i <= n) {
if (n % i == 0) {
return n / i;
}
i = i + 2;
}
return 1;
}
``` |
3,545,259 | I am currently using the following code but its very slow for large numbers
```
static int divisor(int number)
{
int i;
for (i = number / 2; i >= 1; i--)
{
if (number % i == 0)
{
break;
}
... | 2010/08/23 | [
"https://Stackoverflow.com/questions/3545259",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/301012/"
] | First thought you can find the smallest divisor d (not equal to 1 of course), then N/d will be the largest divisor you're looking for.
For example if N is divisible by 3 then you'll need 2 iterations to find the answer - in your case it would be about N/6 iterations.
**Edit:** To further improve your algorithm you ... | You've basically hit the "factorization of large numbers" problem, which is the basis of today's Public Key encryption and is known (or hoped) to be a computationally hard problem. I indeed hope that you will not find a much better solution, otherwise the whole security infrastructure of the world will collapse... :) |
3,545,259 | I am currently using the following code but its very slow for large numbers
```
static int divisor(int number)
{
int i;
for (i = number / 2; i >= 1; i--)
{
if (number % i == 0)
{
break;
}
... | 2010/08/23 | [
"https://Stackoverflow.com/questions/3545259",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/301012/"
] | Don't know if it's the optimal solution but you'd probably be better starting at 2 then going upwards such as:
```
static int divisor(int number)
{
int i;
for (i = 2; i <sqrt(number); i++)
{
if (number % i == 0)
{
break;
}
}
... | A huge optimization (not sure if it's completely optimal - you'd have to ask a mathematician for that) is to search upwards using only prime numbers. As Vladimir and Bunnit said, it is better to search upwards, because you'll find it to be much faster. Then, return the inverse (`number / i`). However, if you've already... |
3,545,259 | I am currently using the following code but its very slow for large numbers
```
static int divisor(int number)
{
int i;
for (i = number / 2; i >= 1; i--)
{
if (number % i == 0)
{
break;
}
... | 2010/08/23 | [
"https://Stackoverflow.com/questions/3545259",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/301012/"
] | In order to limit your search space, you should start at 2 and work up to the square root of the number. There are far more numbers (in a finite search space) divisible by 2 than by 27 so you're more likely to get a low divisor than a high one, statistically speaking.
You'll find a big difference when using the square... | The best algorithm will depend on how huge your numbers will really be.
This problem is basically as hard as factoring integers - if have some factoring algorithm, it will be rather easy to use it to construct the greatest non-trivial divisor. Again, which of all the known factoring algorithms you employ for a number ... |
3,545,259 | I am currently using the following code but its very slow for large numbers
```
static int divisor(int number)
{
int i;
for (i = number / 2; i >= 1; i--)
{
if (number % i == 0)
{
break;
}
... | 2010/08/23 | [
"https://Stackoverflow.com/questions/3545259",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/301012/"
] | Optimization: An odd number can't have even number as largest divisor.
Use this filter on number early.
So if odd number is given.
* First do division with 2.
* Then decrement i by 2 everytime in
loop
This is will improve speed for odd numbers. | The best algorithm will depend on how huge your numbers will really be.
This problem is basically as hard as factoring integers - if have some factoring algorithm, it will be rather easy to use it to construct the greatest non-trivial divisor. Again, which of all the known factoring algorithms you employ for a number ... |
3,545,259 | I am currently using the following code but its very slow for large numbers
```
static int divisor(int number)
{
int i;
for (i = number / 2; i >= 1; i--)
{
if (number % i == 0)
{
break;
}
... | 2010/08/23 | [
"https://Stackoverflow.com/questions/3545259",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/301012/"
] | Don't know if it's the optimal solution but you'd probably be better starting at 2 then going upwards such as:
```
static int divisor(int number)
{
int i;
for (i = 2; i <sqrt(number); i++)
{
if (number % i == 0)
{
break;
}
}
... | * Find the *first prime* which divides the number *N*.
* Let's say that prime is *d*.
* Divide *N* by *d*.
* This is the required result that you want. |
3,545,259 | I am currently using the following code but its very slow for large numbers
```
static int divisor(int number)
{
int i;
for (i = number / 2; i >= 1; i--)
{
if (number % i == 0)
{
break;
}
... | 2010/08/23 | [
"https://Stackoverflow.com/questions/3545259",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/301012/"
] | One of the industry standard methods for finding factors of large numbers is the Quadratic Sieve algorithm.
Have a read of this:
<http://en.wikipedia.org/wiki/Quadratic_sieve>
P.S. you should also consider how big your numbers are. Different factorisation algorithms tend to perform well for a certain size, and not f... | The best algorithm will depend on how huge your numbers will really be.
This problem is basically as hard as factoring integers - if have some factoring algorithm, it will be rather easy to use it to construct the greatest non-trivial divisor. Again, which of all the known factoring algorithms you employ for a number ... |
3,545,259 | I am currently using the following code but its very slow for large numbers
```
static int divisor(int number)
{
int i;
for (i = number / 2; i >= 1; i--)
{
if (number % i == 0)
{
break;
}
... | 2010/08/23 | [
"https://Stackoverflow.com/questions/3545259",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/301012/"
] | In order to limit your search space, you should start at 2 and work up to the square root of the number. There are far more numbers (in a finite search space) divisible by 2 than by 27 so you're more likely to get a low divisor than a high one, statistically speaking.
You'll find a big difference when using the square... | Optimization: An odd number can't have even number as largest divisor.
Use this filter on number early.
So if odd number is given.
* First do division with 2.
* Then decrement i by 2 everytime in
loop
This is will improve speed for odd numbers. |
3,545,259 | I am currently using the following code but its very slow for large numbers
```
static int divisor(int number)
{
int i;
for (i = number / 2; i >= 1; i--)
{
if (number % i == 0)
{
break;
}
... | 2010/08/23 | [
"https://Stackoverflow.com/questions/3545259",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/301012/"
] | In order to limit your search space, you should start at 2 and work up to the square root of the number. There are far more numbers (in a finite search space) divisible by 2 than by 27 so you're more likely to get a low divisor than a high one, statistically speaking.
You'll find a big difference when using the square... | Java implementation of the solution:
```
static int highestDivisor(int n) {
if ((n & 1) == 0)
return n / 2;
int i = 3;
while (i * i <= n) {
if (n % i == 0) {
return n / i;
}
i = i + 2;
}
return 1;
}
``` |
3,545,259 | I am currently using the following code but its very slow for large numbers
```
static int divisor(int number)
{
int i;
for (i = number / 2; i >= 1; i--)
{
if (number % i == 0)
{
break;
}
... | 2010/08/23 | [
"https://Stackoverflow.com/questions/3545259",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/301012/"
] | First thought you can find the smallest divisor d (not equal to 1 of course), then N/d will be the largest divisor you're looking for.
For example if N is divisible by 3 then you'll need 2 iterations to find the answer - in your case it would be about N/6 iterations.
**Edit:** To further improve your algorithm you ... | A huge optimization (not sure if it's completely optimal - you'd have to ask a mathematician for that) is to search upwards using only prime numbers. As Vladimir and Bunnit said, it is better to search upwards, because you'll find it to be much faster. Then, return the inverse (`number / i`). However, if you've already... |
51,549,554 | I want to completely disconnect my app from Firebase. This question has been asked several times (e.g [here](https://stackoverflow.com/questions/37486516/how-do-i-delete-remove-an-app-from-a-firebase-project/37487344)). Most of the answers focus on disconnecting an app from Firebase **within the Firebase console** and ... | 2018/07/27 | [
"https://Stackoverflow.com/questions/51549554",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5670752/"
] | Try these steps to remove Fire-base from Android Studio project.
>
> Delete `google-services.json` file from the Project (Find the file by Project view)
>
>
> Remove dependencies from Project-level `build.gradle` (/build.gradle)
>
>
>
```
buildscript {
dependencies {
// Remove this line
classpath 'com... | Try shutting down the Firebase project created with the package name of the connected application; although it doesn't delete at the same time and is scheduled for later. Don't link your android app with any other firebase app till the previous connected app has been deleted completely. |
51,549,554 | I want to completely disconnect my app from Firebase. This question has been asked several times (e.g [here](https://stackoverflow.com/questions/37486516/how-do-i-delete-remove-an-app-from-a-firebase-project/37487344)). Most of the answers focus on disconnecting an app from Firebase **within the Firebase console** and ... | 2018/07/27 | [
"https://Stackoverflow.com/questions/51549554",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5670752/"
] | Try this, On the project level, delete the google-services.json file
[](https://i.stack.imgur.com/Aytkm.png)
and then sync the project
[](https://i.stack.imgur.com/ZfEdS.png) | Try shutting down the Firebase project created with the package name of the connected application; although it doesn't delete at the same time and is scheduled for later. Don't link your android app with any other firebase app till the previous connected app has been deleted completely. |
51,549,554 | I want to completely disconnect my app from Firebase. This question has been asked several times (e.g [here](https://stackoverflow.com/questions/37486516/how-do-i-delete-remove-an-app-from-a-firebase-project/37487344)). Most of the answers focus on disconnecting an app from Firebase **within the Firebase console** and ... | 2018/07/27 | [
"https://Stackoverflow.com/questions/51549554",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5670752/"
] | Try these steps to remove Fire-base from Android Studio project.
>
> Delete `google-services.json` file from the Project (Find the file by Project view)
>
>
> Remove dependencies from Project-level `build.gradle` (/build.gradle)
>
>
>
```
buildscript {
dependencies {
// Remove this line
classpath 'com... | Do the following (If you want to Switch Firebase Data Sources):
In Android Studio, Go to Tools>Firebase, Choose any of the options such as Real time-database
Click Connect to Firebase.
You will get a warning that the App is already connected to Firebase.
Click okay.
Android Studio will open a Firebase console on a br... |
51,549,554 | I want to completely disconnect my app from Firebase. This question has been asked several times (e.g [here](https://stackoverflow.com/questions/37486516/how-do-i-delete-remove-an-app-from-a-firebase-project/37487344)). Most of the answers focus on disconnecting an app from Firebase **within the Firebase console** and ... | 2018/07/27 | [
"https://Stackoverflow.com/questions/51549554",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5670752/"
] | Try these steps to remove Fire-base from Android Studio project.
>
> Delete `google-services.json` file from the Project (Find the file by Project view)
>
>
> Remove dependencies from Project-level `build.gradle` (/build.gradle)
>
>
>
```
buildscript {
dependencies {
// Remove this line
classpath 'com... | You should undo all the steps that you are instructed to perform in the [manual integration](https://firebase.google.com/docs/android/setup). So, remove all Firebase dependencies from build.gradle, remove the Google Services plugin from the bottom of build.gradle, and remove the google-services.json file. |
51,549,554 | I want to completely disconnect my app from Firebase. This question has been asked several times (e.g [here](https://stackoverflow.com/questions/37486516/how-do-i-delete-remove-an-app-from-a-firebase-project/37487344)). Most of the answers focus on disconnecting an app from Firebase **within the Firebase console** and ... | 2018/07/27 | [
"https://Stackoverflow.com/questions/51549554",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5670752/"
] | You should undo all the steps that you are instructed to perform in the [manual integration](https://firebase.google.com/docs/android/setup). So, remove all Firebase dependencies from build.gradle, remove the Google Services plugin from the bottom of build.gradle, and remove the google-services.json file. | Do the following (If you want to Switch Firebase Data Sources):
In Android Studio, Go to Tools>Firebase, Choose any of the options such as Real time-database
Click Connect to Firebase.
You will get a warning that the App is already connected to Firebase.
Click okay.
Android Studio will open a Firebase console on a br... |
51,549,554 | I want to completely disconnect my app from Firebase. This question has been asked several times (e.g [here](https://stackoverflow.com/questions/37486516/how-do-i-delete-remove-an-app-from-a-firebase-project/37487344)). Most of the answers focus on disconnecting an app from Firebase **within the Firebase console** and ... | 2018/07/27 | [
"https://Stackoverflow.com/questions/51549554",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5670752/"
] | Try this, On the project level, delete the google-services.json file
[](https://i.stack.imgur.com/Aytkm.png)
and then sync the project
[](https://i.stack.imgur.com/ZfEdS.png) | On the main menu, select app ,select ,google-services.json' and then right click then delete |
51,549,554 | I want to completely disconnect my app from Firebase. This question has been asked several times (e.g [here](https://stackoverflow.com/questions/37486516/how-do-i-delete-remove-an-app-from-a-firebase-project/37487344)). Most of the answers focus on disconnecting an app from Firebase **within the Firebase console** and ... | 2018/07/27 | [
"https://Stackoverflow.com/questions/51549554",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5670752/"
] | You should undo all the steps that you are instructed to perform in the [manual integration](https://firebase.google.com/docs/android/setup). So, remove all Firebase dependencies from build.gradle, remove the Google Services plugin from the bottom of build.gradle, and remove the google-services.json file. | On the main menu, select app ,select ,google-services.json' and then right click then delete |
51,549,554 | I want to completely disconnect my app from Firebase. This question has been asked several times (e.g [here](https://stackoverflow.com/questions/37486516/how-do-i-delete-remove-an-app-from-a-firebase-project/37487344)). Most of the answers focus on disconnecting an app from Firebase **within the Firebase console** and ... | 2018/07/27 | [
"https://Stackoverflow.com/questions/51549554",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5670752/"
] | You should undo all the steps that you are instructed to perform in the [manual integration](https://firebase.google.com/docs/android/setup). So, remove all Firebase dependencies from build.gradle, remove the Google Services plugin from the bottom of build.gradle, and remove the google-services.json file. | Try shutting down the Firebase project created with the package name of the connected application; although it doesn't delete at the same time and is scheduled for later. Don't link your android app with any other firebase app till the previous connected app has been deleted completely. |
51,549,554 | I want to completely disconnect my app from Firebase. This question has been asked several times (e.g [here](https://stackoverflow.com/questions/37486516/how-do-i-delete-remove-an-app-from-a-firebase-project/37487344)). Most of the answers focus on disconnecting an app from Firebase **within the Firebase console** and ... | 2018/07/27 | [
"https://Stackoverflow.com/questions/51549554",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5670752/"
] | Try these steps to remove Fire-base from Android Studio project.
>
> Delete `google-services.json` file from the Project (Find the file by Project view)
>
>
> Remove dependencies from Project-level `build.gradle` (/build.gradle)
>
>
>
```
buildscript {
dependencies {
// Remove this line
classpath 'com... | Try this, On the project level, delete the google-services.json file
[](https://i.stack.imgur.com/Aytkm.png)
and then sync the project
[](https://i.stack.imgur.com/ZfEdS.png) |
51,549,554 | I want to completely disconnect my app from Firebase. This question has been asked several times (e.g [here](https://stackoverflow.com/questions/37486516/how-do-i-delete-remove-an-app-from-a-firebase-project/37487344)). Most of the answers focus on disconnecting an app from Firebase **within the Firebase console** and ... | 2018/07/27 | [
"https://Stackoverflow.com/questions/51549554",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5670752/"
] | Try this, On the project level, delete the google-services.json file
[](https://i.stack.imgur.com/Aytkm.png)
and then sync the project
[](https://i.stack.imgur.com/ZfEdS.png) | Do the following (If you want to Switch Firebase Data Sources):
In Android Studio, Go to Tools>Firebase, Choose any of the options such as Real time-database
Click Connect to Firebase.
You will get a warning that the App is already connected to Firebase.
Click okay.
Android Studio will open a Firebase console on a br... |
48,442,661 | Using [`deal`](https://mathworks.com/help/matlab/ref/deal.html) we can write anonymous functions that have multiple output arguments, like for example
```
minmax = @(x)deal(min(x),max(x));
[u,v] = minmax([1,2,3,4]); % outputs u = 1, v = 4
```
But if you want to provide a function with its gradient to the optimizatio... | 2018/01/25 | [
"https://Stackoverflow.com/questions/48442661",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2913106/"
] | The [OP's solution](https://stackoverflow.com/a/48442667/3372061) is good in that it's concise and useful in many cases.
However, it has one main shortcoming, in that it's less scalable than otherwise possible. This claim is made because all functions (`{x^2,2*x,2}`) are evaluated, regardless of whether they're needed... | Yes there is, it involves a technique used in [this question](https://stackoverflow.com/questions/32237198/recursive-anonymous-function-matlab) about recursive anonymous functions. First we define a helper function
```
helper = @(c,n)deal(c{1:n});
```
which accepts a cell array `c` of the possible outputs as well as... |
3,474 | I understand that you should use an amp that was meant to be used with your instrument, but sometimes maybe you just don't have the money, or your amp is not around when you need it, or for whatever reason you would like to make use of what you do have at the moment..
So, how safe is it to plug an electric bass guita... | 2011/07/19 | [
"https://music.stackexchange.com/questions/3474",
"https://music.stackexchange.com",
"https://music.stackexchange.com/users/935/"
] | With regard to hi-fis, one option that's not yet been discussed here is to use an amp-modelling pedal, such as the ones made by Line 6 and Zoom.
These take instrument-level inputs, and have line-level outputs. So you can safely connect them to the phono inputs of a hi-fi, or PC speakers, etc, while getting the sound o... | Keep the volume low if your using a guitar amp for a bass. Last thing you want to do is crack the speakers in your amp if your playing the bass with high volume. Try to lower the bass on the amp as well. |
3,474 | I understand that you should use an amp that was meant to be used with your instrument, but sometimes maybe you just don't have the money, or your amp is not around when you need it, or for whatever reason you would like to make use of what you do have at the moment..
So, how safe is it to plug an electric bass guita... | 2011/07/19 | [
"https://music.stackexchange.com/questions/3474",
"https://music.stackexchange.com",
"https://music.stackexchange.com/users/935/"
] | It is actually nowhere near as dangerous as you might think, as long as you keep the volume relatively low. You won't get an ideal frequency response, as a guitar amp is designed for the frequencies a guitar produces, but it will do as a stop-gap until you get a suitable amp.
The reason for keeping the volume lower th... | I used a Line 6 Pod and a Midi-Man 6 channel mixer to get `Line Out` and piped it into my stereo system for over 10 years when I didn't have room for an amp for my Bass.
It sounded awesome with the sub that I have, it would shake the walls of the house. And a bonus I was able to run my drum machine and a few other th... |
3,474 | I understand that you should use an amp that was meant to be used with your instrument, but sometimes maybe you just don't have the money, or your amp is not around when you need it, or for whatever reason you would like to make use of what you do have at the moment..
So, how safe is it to plug an electric bass guita... | 2011/07/19 | [
"https://music.stackexchange.com/questions/3474",
"https://music.stackexchange.com",
"https://music.stackexchange.com/users/935/"
] | It is actually nowhere near as dangerous as you might think, as long as you keep the volume relatively low. You won't get an ideal frequency response, as a guitar amp is designed for the frequencies a guitar produces, but it will do as a stop-gap until you get a suitable amp.
The reason for keeping the volume lower th... | With regard to hi-fis, one option that's not yet been discussed here is to use an amp-modelling pedal, such as the ones made by Line 6 and Zoom.
These take instrument-level inputs, and have line-level outputs. So you can safely connect them to the phono inputs of a hi-fi, or PC speakers, etc, while getting the sound o... |
3,474 | I understand that you should use an amp that was meant to be used with your instrument, but sometimes maybe you just don't have the money, or your amp is not around when you need it, or for whatever reason you would like to make use of what you do have at the moment..
So, how safe is it to plug an electric bass guita... | 2011/07/19 | [
"https://music.stackexchange.com/questions/3474",
"https://music.stackexchange.com",
"https://music.stackexchange.com/users/935/"
] | With regard to hi-fis, one option that's not yet been discussed here is to use an amp-modelling pedal, such as the ones made by Line 6 and Zoom.
These take instrument-level inputs, and have line-level outputs. So you can safely connect them to the phono inputs of a hi-fi, or PC speakers, etc, while getting the sound o... | I used a Line 6 Pod and a Midi-Man 6 channel mixer to get `Line Out` and piped it into my stereo system for over 10 years when I didn't have room for an amp for my Bass.
It sounded awesome with the sub that I have, it would shake the walls of the house. And a bonus I was able to run my drum machine and a few other th... |
3,474 | I understand that you should use an amp that was meant to be used with your instrument, but sometimes maybe you just don't have the money, or your amp is not around when you need it, or for whatever reason you would like to make use of what you do have at the moment..
So, how safe is it to plug an electric bass guita... | 2011/07/19 | [
"https://music.stackexchange.com/questions/3474",
"https://music.stackexchange.com",
"https://music.stackexchange.com/users/935/"
] | It is actually nowhere near as dangerous as you might think, as long as you keep the volume relatively low. You won't get an ideal frequency response, as a guitar amp is designed for the frequencies a guitar produces, but it will do as a stop-gap until you get a suitable amp.
The reason for keeping the volume lower th... | Keep the volume low if your using a guitar amp for a bass. Last thing you want to do is crack the speakers in your amp if your playing the bass with high volume. Try to lower the bass on the amp as well. |
3,474 | I understand that you should use an amp that was meant to be used with your instrument, but sometimes maybe you just don't have the money, or your amp is not around when you need it, or for whatever reason you would like to make use of what you do have at the moment..
So, how safe is it to plug an electric bass guita... | 2011/07/19 | [
"https://music.stackexchange.com/questions/3474",
"https://music.stackexchange.com",
"https://music.stackexchange.com/users/935/"
] | With regard to hi-fis, one option that's not yet been discussed here is to use an amp-modelling pedal, such as the ones made by Line 6 and Zoom.
These take instrument-level inputs, and have line-level outputs. So you can safely connect them to the phono inputs of a hi-fi, or PC speakers, etc, while getting the sound o... | I was rehearsing at either guitar amp or home hi-fi.
First of all, you should low down all your switches, and only after that slowly add all of them. You should decide for yourself then to stop, generally you should simply avoid extraneous sounds from your hi-fi or amp.
I've switched into small Fender amp, something l... |
3,474 | I understand that you should use an amp that was meant to be used with your instrument, but sometimes maybe you just don't have the money, or your amp is not around when you need it, or for whatever reason you would like to make use of what you do have at the moment..
So, how safe is it to plug an electric bass guita... | 2011/07/19 | [
"https://music.stackexchange.com/questions/3474",
"https://music.stackexchange.com",
"https://music.stackexchange.com/users/935/"
] | Keyboard amps and Electronic Drum Amps will work fine for bass. They both produce frequencies in the same range that a bass does. I'll leave the discussion of guitar amps and hifi's to what has already been contributed. | I was rehearsing at either guitar amp or home hi-fi.
First of all, you should low down all your switches, and only after that slowly add all of them. You should decide for yourself then to stop, generally you should simply avoid extraneous sounds from your hi-fi or amp.
I've switched into small Fender amp, something l... |
3,474 | I understand that you should use an amp that was meant to be used with your instrument, but sometimes maybe you just don't have the money, or your amp is not around when you need it, or for whatever reason you would like to make use of what you do have at the moment..
So, how safe is it to plug an electric bass guita... | 2011/07/19 | [
"https://music.stackexchange.com/questions/3474",
"https://music.stackexchange.com",
"https://music.stackexchange.com/users/935/"
] | It is actually nowhere near as dangerous as you might think, as long as you keep the volume relatively low. You won't get an ideal frequency response, as a guitar amp is designed for the frequencies a guitar produces, but it will do as a stop-gap until you get a suitable amp.
The reason for keeping the volume lower th... | I was rehearsing at either guitar amp or home hi-fi.
First of all, you should low down all your switches, and only after that slowly add all of them. You should decide for yourself then to stop, generally you should simply avoid extraneous sounds from your hi-fi or amp.
I've switched into small Fender amp, something l... |
3,474 | I understand that you should use an amp that was meant to be used with your instrument, but sometimes maybe you just don't have the money, or your amp is not around when you need it, or for whatever reason you would like to make use of what you do have at the moment..
So, how safe is it to plug an electric bass guita... | 2011/07/19 | [
"https://music.stackexchange.com/questions/3474",
"https://music.stackexchange.com",
"https://music.stackexchange.com/users/935/"
] | With regard to hi-fis, one option that's not yet been discussed here is to use an amp-modelling pedal, such as the ones made by Line 6 and Zoom.
These take instrument-level inputs, and have line-level outputs. So you can safely connect them to the phono inputs of a hi-fi, or PC speakers, etc, while getting the sound o... | Keyboard amps and Electronic Drum Amps will work fine for bass. They both produce frequencies in the same range that a bass does. I'll leave the discussion of guitar amps and hifi's to what has already been contributed. |
3,474 | I understand that you should use an amp that was meant to be used with your instrument, but sometimes maybe you just don't have the money, or your amp is not around when you need it, or for whatever reason you would like to make use of what you do have at the moment..
So, how safe is it to plug an electric bass guita... | 2011/07/19 | [
"https://music.stackexchange.com/questions/3474",
"https://music.stackexchange.com",
"https://music.stackexchange.com/users/935/"
] | It is actually nowhere near as dangerous as you might think, as long as you keep the volume relatively low. You won't get an ideal frequency response, as a guitar amp is designed for the frequencies a guitar produces, but it will do as a stop-gap until you get a suitable amp.
The reason for keeping the volume lower th... | Keyboard amps and Electronic Drum Amps will work fine for bass. They both produce frequencies in the same range that a bass does. I'll leave the discussion of guitar amps and hifi's to what has already been contributed. |
1,667,269 | I have 5 views in my ASP.NET MVC application. Some data were captured from these views and I am navigating through these views using 2 buttons: the Previous and Next buttons.
So I fill the data in View 1 and I go to view 2 and enter the data there and so on.. till View 5.
Now the question is: If I come back again to ... | 2009/11/03 | [
"https://Stackoverflow.com/questions/1667269",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/200507/"
] | I can think of a number of approaches to your issue. You could create a single view with a number of 'panels' which are hidden or revealed depending on which step you are on in the process, like a wizard control. You could try and use a cookie but that's not very clean. Ideally, you embrace the statelessness of the MVC... | If you only want to submit the content once all pages are filled, you will probably need to store entered data into a cookie on the client machine. You can do this with javascript:
<http://www.quirksmode.org/js/cookies.html> |
2,624,575 | I have found a proof:
Let $x=ab$ with $|x|=n$. If we can show that $n=pq$ then we will have a generator for G. Since G is abelian, $x^{pq} = (ab)^{pq} = (a^p)^q (b^q)^p=e$. This only tells us that $n|pq$. Now, $a^n = a^n b^n b^{-n}=(ab)^n(b^{-1})^n=(b^{-1})^n$. We also know that $|b^{-1}| = |b|$.
Now, $|a^n| = \frac... | 2018/01/28 | [
"https://math.stackexchange.com/questions/2624575",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/365321/"
] | First we prove that $\langle a\rangle\cap\langle b\rangle={e}.$ If $x=a^{m}=b^{n}$, then $\mathrm{ord}(x)|gcd(p,q)=1,$ thus $x=e.$
Then we show that $G$ is a cyclic group generated by $ab$. Let $\mathrm{ord}(ab)=t.$ We have $e=(ab)^{t}=a^{t}b^{t},$ hence $a^{t}=b^{-t}.$ However $\langle a\rangle\cap\langle b\rangle={e... | $|a^n| = \frac{p}{gcd(p,n)}$ is true by the proposition (Dummit and Foote page 57):
>
> **Proposition.** Let $G$ be a group, let $x\in G$ and let $a\in \mathbb{Z}-\{0\}$.
> If $|x|=n<\infty$, then $|x^{a}|=\frac{n}{(n,a)}$.
>
>
>
$p|n$ is true because $p|(p,n)$ and $(p,n)|n$. |
36,763,842 | I am trying to come up with a build system for a large project that has a structure like this:
```
├── deploy
├── docs
├── libs
│ ├── lib1
│ └── lib2
├── scripts
└── tools
├── prog1
└── prog2
```
My problem is that libs and programs may depend on each other in an order that may change very often. I have ... | 2016/04/21 | [
"https://Stackoverflow.com/questions/36763842",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2235928/"
] | I am in the *don't lie to make* camp.
Here,
fine-grained dependencies are your friend.
Get away from thinking that you need to express that *prog1* depends on *lib2*. What you really want to say to *make* is something like:
"To link *prog1* you need all the `.o` files, and all the appropriate `.a` files."
If you can ... | I'm not in the recursive makefiles are evil camp -- while it's true that recursive makefiles are not as efficient (they don't maximize concurrency, etc), it's usually negligible. On the flip side, using recursive makefiles makes your project more scalable -- it's simpler to move modules in and out, share with other gro... |
157,464 | I would like to fit a `LogNormalDistribution[μ,σ]` based on some data that I have. Roughly speaking, would I need to take the `Log` of these data's *y*-values before calculating the mean and standard deviation in order to determine $\mu$ and $\sigma$ above, or can I calculate $\mu$ and $\sigma$ directly from the data a... | 2017/10/10 | [
"https://mathematica.stackexchange.com/questions/157464",
"https://mathematica.stackexchange.com",
"https://mathematica.stackexchange.com/users/38354/"
] | **Update:** Added in @gwr 's suggestion about using `SeedRandom` so the one can obtain exactly the same answers as below.
It's not clear that your question has anything to do with *Mathematica* but rather should you use maximum likelihood or method of moments (which would be best asked at CrossValidated).
Consider a ... | There are slight variations in the distribution obtained depending on the specific approach taken
Generating data
```
SeedRandom[0]
data = RandomVariate[LogNormalDistribution[3, 1.5], 1000];
```
[`FindDistribution`](http://reference.wolfram.com/language/ref/FindDistribution.html) will conclude that this data has a... |
19,985,306 | How can I get text from a node so that it returns it with whitespace formatting like "innerText" does, but excludes descendant nodes that are hidden (style display:none)? | 2013/11/14 | [
"https://Stackoverflow.com/questions/19985306",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/97786/"
] | **UPDATE**: As the OP points out in comments below, even though [MDN clearly states that IE introduced `innerText` to exclude hidden content](https://developer.mozilla.org/en-US/docs/Web/API/Node.textContent), testing in IE indicates that is not the case. To summarize:
* Chrome: `innerText` returns text only from *vis... | This is interesting, I came here because I was looking for why the text of `display:none` elements was omitted in Chrome.
So, this was ultimately my solution.
Basically, I clone the node and remove the classes/styling that set `display:none`.
How to add hidden element's `innerText`
================================... |
24,431 | Da gibt es (laut Google) nur eine Frage (auf Gutefrage.de) mit unbefriedigenden Antworten. Ich bin im englischen StackExchange darauf gestoßen und ich weiß nicht einmal, wie man es auf Deutsch beschreibt.
Am liebsten wäre mir ein zutreffendes Wort (ein Adjektiv wäre gut, wenn es das gibt).
Ich unterscheide hier zwis... | 2015/07/15 | [
"https://german.stackexchange.com/questions/24431",
"https://german.stackexchange.com",
"https://german.stackexchange.com/users/15848/"
] | Eventuell "sein ganzes [eigenes] Leben verplanen"
>
> Er hat sein ganzes Leben verplant.
>
>
>
(im Gegensatz zu jemandem , der jemand anderes Leben verplant)
>
> Sein Vater hat sein ganzes Leben verplant.
>
>
>
Beispiel aus [der FAZ](http://www.faz.net/aktuell/wirtschaft/kommentar-wo-ist-nur-die-ganze-zeit-... | So wie du den Personentypus beschreibst, würde ich
>
> Sicherheitsfanatiker
>
>
>
dazu sagen. Das Wort verwendet man zwar auch (und an erster Stelle) für Leute, die ihr Haus, ihr Wohnung, ihr Land oder was auch immer gegen jegliche mögliche Unbill schützen wollen; doch in zweiter Linie meint man damit auch Leut... |
24,065,268 | I want to show the image aligned to the top in the relative layout and the shadow should be around the image and not around the layout. What is going wrong I can't understand.
```
<RelativeLayout
android:layout_width="117dp"
android:layout_height="162dp">
<ImageView
android:layout_... | 2014/06/05 | [
"https://Stackoverflow.com/questions/24065268",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1147094/"
] | ```
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/selector">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:src="... | Looks like you just need add the adjustViewBounds property. That property defaults to false...
```
<RelativeLayout
android:layout_width="117dp"
android:layout_height="162dp">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignPa... |
14,214,830 | I am using Liferay 6.1.1 CE.
How can i disable add,manage and edit control (Dockbar) of a user's "My Public Pages" and "My Private Pages"?
Please find me some ideas? | 2013/01/08 | [
"https://Stackoverflow.com/questions/14214830",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1651564/"
] | <http://vir-liferay.blogspot.in/2012/05/how-to-configure-dockbar-based-on-roles.html>
this works for me....I fix it | try this thing. write this code in your **portal-ext.properties**
```
layout.user.public.layouts.enabled=false
layout.user.public.layouts.modifiable=false
layout.user.public.layouts.auto.create=false
```
similarly you found other options also. |
14,214,830 | I am using Liferay 6.1.1 CE.
How can i disable add,manage and edit control (Dockbar) of a user's "My Public Pages" and "My Private Pages"?
Please find me some ideas? | 2013/01/08 | [
"https://Stackoverflow.com/questions/14214830",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1651564/"
] | <http://vir-liferay.blogspot.in/2012/05/how-to-configure-dockbar-based-on-roles.html>
this works for me....I fix it | I have the same problem and I looked for disable access to public and private pages.
The solution is to add these lines in your portal-ext.properties :
To disable access to private pages :
```
layout.user.private.layouts.enabled=false
layout.user.private.layouts.modifiable=false
layout.user.private.layouts.auto.creat... |
35,069,691 | Hey I have started using Cloudfront. In my application I have images in s3 bucket.
User can update these images .When user update the image ,image get created in the s3bucket and replaces the older image with the new image .After the image get still the older image get dispalyed to user as for GET operations I am using... | 2016/01/28 | [
"https://Stackoverflow.com/questions/35069691",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5644924/"
] | It seems to be an issue with using a fragment context instead of an activity context. The way I fixed the problem was to do the following in my fragment.
```
getActivity().startActivity(intent);
```
I get no recorded intents if I leave off the getActivty() part and use the fragment's context to start the new activit... | It's an issue that Google is working on fixing, see this [issue](https://code.google.com/p/android/issues/detail?id=202217&q=espresso&sort=-opened&colspec=ID%20Status%20Priority%20Owner%20Summary%20Stars%20Reporter%20Opened). |
79,918 | I have a wireless garage door remote and looking to turn it into a wifi opener.
I am looking for something to act as a switch.
I was hoping i could connect a wire to 0v side of the switch and feed it 3.3v from the PI but manually doing it to the opener doesn't seem to give the desired result.
bridging a wire across ... | 2018/03/04 | [
"https://raspberrypi.stackexchange.com/questions/79918",
"https://raspberrypi.stackexchange.com",
"https://raspberrypi.stackexchange.com/users/81803/"
] | Connecting unknown electronic devices to the Pi (or anything else) is fraught with difficulty.
There is **NO WAY** the Pi can "short out the pin".
You **may** be able to drive a transistor or MOSFET to simulate a button press. This requires at the minimum a common ground connection.
The only SAFE way is with an opto... | I have done this with a remote power point controller. If activating the button on the controller grounds the controller IC input pins you could remove the buttons and connect GPIO to the controller input pins. Relays avoid the need to remove the buttons. |
79,918 | I have a wireless garage door remote and looking to turn it into a wifi opener.
I am looking for something to act as a switch.
I was hoping i could connect a wire to 0v side of the switch and feed it 3.3v from the PI but manually doing it to the opener doesn't seem to give the desired result.
bridging a wire across ... | 2018/03/04 | [
"https://raspberrypi.stackexchange.com/questions/79918",
"https://raspberrypi.stackexchange.com",
"https://raspberrypi.stackexchange.com/users/81803/"
] | I ended up soldering NPN transistors to the roller door remote either side of the manual switches.
the base of the transistor had a 1k resistor that was attached to my PI GPIO pins.
i made a common ground from the remote to the ground GPIO pin
then created a script to turn the gpio pins on for 1 second then back off.... | Connecting unknown electronic devices to the Pi (or anything else) is fraught with difficulty.
There is **NO WAY** the Pi can "short out the pin".
You **may** be able to drive a transistor or MOSFET to simulate a button press. This requires at the minimum a common ground connection.
The only SAFE way is with an opto... |
79,918 | I have a wireless garage door remote and looking to turn it into a wifi opener.
I am looking for something to act as a switch.
I was hoping i could connect a wire to 0v side of the switch and feed it 3.3v from the PI but manually doing it to the opener doesn't seem to give the desired result.
bridging a wire across ... | 2018/03/04 | [
"https://raspberrypi.stackexchange.com/questions/79918",
"https://raspberrypi.stackexchange.com",
"https://raspberrypi.stackexchange.com/users/81803/"
] | I ended up soldering NPN transistors to the roller door remote either side of the manual switches.
the base of the transistor had a 1k resistor that was attached to my PI GPIO pins.
i made a common ground from the remote to the ground GPIO pin
then created a script to turn the gpio pins on for 1 second then back off.... | I have done this with a remote power point controller. If activating the button on the controller grounds the controller IC input pins you could remove the buttons and connect GPIO to the controller input pins. Relays avoid the need to remove the buttons. |
68,378,889 | I've just started with [mcpi](https://pypi.org/project/mcpi/) and I want to have custom commands to capture chat posts starting with `/`.
How can I use custom commands to accomplish this? | 2021/07/14 | [
"https://Stackoverflow.com/questions/68378889",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16447728/"
] | So the original code I used was wrong. With the help of [this post](https://stackoverflow.com/questions/64693789/system-invalidcastexception-unable-to-cast-object-was-received-when-retriev)
I got to the following code which is correct:
```
ILocalStorage webStorage = ((IHasWebStorage)webDriver).WebStorage.LocalStorage... | In Visual Studio, when I drill down through the ChromeDriver base classes, I eventually get to OpenQA.Selenium.Webdriver. Many of the properties there are deprecated with a helpful message. For example:
```
[Obsolete("Use JavaScript instead for managing localStorage and sessionStorage. This property will be remove... |
15,599,160 | The question asked to write a function split() that copies the contents of a linked list into two other linked lists. The function copies nodes with even indices (0,2,etc)to EvenList and nodes with odd indices to oddList. The original linked list should not be modified. Assume that evenlist and oddlist will be passed i... | 2013/03/24 | [
"https://Stackoverflow.com/questions/15599160",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2201968/"
] | ```
void split(ListNode *head, ListNode **ptrOddList, ListNode **ptrEvenList){
for( ; head ; head= head->next) {
ListNode *temp;
temp = malloc(sizeof *temp );
memcpy (temp, head, sizeof *temp);
if (temp->item %2) { *ptrOddList = temp; ptrOddList = &temp->next;}
else { *p... | You're always allocating your nodes one step too early. Notice that at the beginning you're always allocating one node for both lists -- but what if there are no odd numbers in the list? Then your list is already too long at this point. You keep doing this every time you allocate a new node.
What you need to do is to ... |
15,599,160 | The question asked to write a function split() that copies the contents of a linked list into two other linked lists. The function copies nodes with even indices (0,2,etc)to EvenList and nodes with odd indices to oddList. The original linked list should not be modified. Assume that evenlist and oddlist will be passed i... | 2013/03/24 | [
"https://Stackoverflow.com/questions/15599160",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2201968/"
] | ```
void split(ListNode *head, ListNode **ptrOddList, ListNode **ptrEvenList){
for( ; head ; head= head->next) {
ListNode *temp;
temp = malloc(sizeof *temp );
memcpy (temp, head, sizeof *temp);
if (temp->item %2) { *ptrOddList = temp; ptrOddList = &temp->next;}
else { *p... | ```
void split(ListNode *head,ListNode **ptrOddList,ListNode **ptrEvenList){
int remainder;
int countO=0;
int countE=0;
ListNode *tempO,*tempE;
if (head==NULL)
return;
else{
(*ptrOddList)=(struct node*)malloc(sizeof(ListNode));
(*ptrEvenList)=(struct node*)malloc(sizeof(ListNode));
while(head!=NULL){
... |
15,599,160 | The question asked to write a function split() that copies the contents of a linked list into two other linked lists. The function copies nodes with even indices (0,2,etc)to EvenList and nodes with odd indices to oddList. The original linked list should not be modified. Assume that evenlist and oddlist will be passed i... | 2013/03/24 | [
"https://Stackoverflow.com/questions/15599160",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2201968/"
] | ```
void split(ListNode *head, ListNode **ptrOddList, ListNode **ptrEvenList){
for( ; head ; head= head->next) {
ListNode *temp;
temp = malloc(sizeof *temp );
memcpy (temp, head, sizeof *temp);
if (temp->item %2) { *ptrOddList = temp; ptrOddList = &temp->next;}
else { *p... | I think here the question is to split the list into 2 halves based on the indices. But I can see the implementations on the `values(item%2)`.
So in the list the first node should have index of 1 and second node is of 2 and so on.
Use a count variable, which sets to 0 initially.
```
int node_count = 0;
while(head !=... |
15,599,160 | The question asked to write a function split() that copies the contents of a linked list into two other linked lists. The function copies nodes with even indices (0,2,etc)to EvenList and nodes with odd indices to oddList. The original linked list should not be modified. Assume that evenlist and oddlist will be passed i... | 2013/03/24 | [
"https://Stackoverflow.com/questions/15599160",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2201968/"
] | ```
void split(ListNode *head, ListNode **ptrOddList, ListNode **ptrEvenList){
for( ; head ; head= head->next) {
ListNode *temp;
temp = malloc(sizeof *temp );
memcpy (temp, head, sizeof *temp);
if (temp->item %2) { *ptrOddList = temp; ptrOddList = &temp->next;}
else { *p... | ```
void split(ListNode *head, ListNode **pOddList, ListNode **pEvenList)
{
int remainder;
ListNode *tmpO = NULL, *tmpE= NULL, *tmp;
if (head == NULL)
{
*pEvenList = NULL;
*pOddList = NULL;
}
else
{
tmp = head;
while (tmp != NULL)
{
re... |
44,051,035 | From q for mortals, i'm struggling to understand how to read this, and understand it logically.
```
1 2 3,/:\:10 20
```
I understand the result is a cross product when in full form: `raze 1 2 3,/:\:10 20`.
But reading from left to right, I'm currently lost at understanding what this yields (in my head)
```
\:10 ... | 2017/05/18 | [
"https://Stackoverflow.com/questions/44051035",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I found myself saying the following in my head whilst I program the syntax in q. q works from right to left.
```
Internal Monologue -> Join the string on the right onto each of the strings on the left
code -> "ABC",\:"-D"
result -> "A-D"
"B-D"
... | Firstly, q is executed (and hence generally read) right to left. This means that it's interpreting the `\:` as a modifier to be applied to the previous function, which itself is a simple join modified by the `/:` adverb. So the way to read this is "Apply join each-right to each of the left-hand arguments."
In this cas... |
56,969,572 | So I basically have a huge dataset to work with, its almost made up of 1,200,000 rows, and my target class count is about 20,000 labels.
I am performing text classifiaction on my data, so I first cleaned it, and then performed tfidf vectorzation on it.
The problem lies whenever I try to pick a model and fit the data,... | 2019/07/10 | [
"https://Stackoverflow.com/questions/56969572",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11154881/"
] | Go to Android Studio Preferences.
[](https://i.stack.imgur.com/3Xiek.png)
Go to Editor -> Inspections -> Lint
[](https://i.stack.imgur.com/5AVYw.png)
Then search for Timber and unc... | add `exclude group: "com.jakewharton.timber", module: 'timber'` to the dependency that uses Timber
For example:
```
implementation("com.raygun:raygun4android:4.0.1") {
exclude group: "com.jakewharton.timber", module: 'timber'
}
``` |
106,543 | We are planning to convert some of our VF pages to Lightning apps. Some our VF pages, particularly surveys are URL parameter-driven, since we send survey links directly to users, i.e. `https://[vf_instance].force.com/apex/CaseSurvey?caseid=xxxxx`
Say we convert the VF page to an Lightning app, we would probably be sen... | 2016/01/25 | [
"https://salesforce.stackexchange.com/questions/106543",
"https://salesforce.stackexchange.com",
"https://salesforce.stackexchange.com/users/24838/"
] | In lightning whatever attribute you define can be passed as a query parameter .
Lets take a look with sample example
```
<aura:application>
<aura:attribute name="whom" type="String" default="world"/>
Hello {!v.whom}!
</aura:application>
```
Here is how the result will look like
[![enter image description here... | Just adding this answer for completion of the thread with the latest release. After Summer 18 release (API version 43 and up) we can utilise `lightning:isUrlAddressable` interface.
Implement `lightning:isUrlAddressable` interface and use `pageReference` attribute.
Example. - Component
Assume url is *<https://<instanc... |
106,543 | We are planning to convert some of our VF pages to Lightning apps. Some our VF pages, particularly surveys are URL parameter-driven, since we send survey links directly to users, i.e. `https://[vf_instance].force.com/apex/CaseSurvey?caseid=xxxxx`
Say we convert the VF page to an Lightning app, we would probably be sen... | 2016/01/25 | [
"https://salesforce.stackexchange.com/questions/106543",
"https://salesforce.stackexchange.com",
"https://salesforce.stackexchange.com/users/24838/"
] | In lightning whatever attribute you define can be passed as a query parameter .
Lets take a look with sample example
```
<aura:application>
<aura:attribute name="whom" type="String" default="world"/>
Hello {!v.whom}!
</aura:application>
```
Here is how the result will look like
[![enter image description here... | There isn't any documented way of doing that, but I was able to do so using a hack.
The Salesforce Lightning URL is something like "/one/one.app#\_\_\_\_\_\_\_" . The blank contains some encoded value in the URL. The encoded value is nothing but the details of the Component/Page in Base64 encoded form.
Use the below ... |
106,543 | We are planning to convert some of our VF pages to Lightning apps. Some our VF pages, particularly surveys are URL parameter-driven, since we send survey links directly to users, i.e. `https://[vf_instance].force.com/apex/CaseSurvey?caseid=xxxxx`
Say we convert the VF page to an Lightning app, we would probably be sen... | 2016/01/25 | [
"https://salesforce.stackexchange.com/questions/106543",
"https://salesforce.stackexchange.com",
"https://salesforce.stackexchange.com/users/24838/"
] | Just adding this answer for completion of the thread with the latest release. After Summer 18 release (API version 43 and up) we can utilise `lightning:isUrlAddressable` interface.
Implement `lightning:isUrlAddressable` interface and use `pageReference` attribute.
Example. - Component
Assume url is *<https://<instanc... | There isn't any documented way of doing that, but I was able to do so using a hack.
The Salesforce Lightning URL is something like "/one/one.app#\_\_\_\_\_\_\_" . The blank contains some encoded value in the URL. The encoded value is nothing but the details of the Component/Page in Base64 encoded form.
Use the below ... |
11,141,312 | I recently bought the SuperBible 5th edition book.
I use Ubuntu 12.04 LTS. I use Code::Blocks. I'm not very proficient with C++ libraries and setting up.
I wanted a book that will guide me from scratch.
I was disappointed when I saw that the book doesn't help us set up projects in Linux.
They use 2 libraries ,freeglut... | 2012/06/21 | [
"https://Stackoverflow.com/questions/11141312",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1418853/"
] | Right now you are telling all the elements with a class of 'inline' that you want with the selector '#inline\_content-1'.
Try this instead:
```
$(document).ready(function(){
$(".inline").colorbox({inline:true, width:"440px"});
$.colorbox({inline:true, href:"#inline_content_1", open:true, width:"330px", height:"... | Change your selector to use the id of the div you want to come up at `onload`?
```
$(document).ready(function(){
$(".inline #inline_content-1").colorbox({inline:true, width:"440px"});
$(".inline #inline_content-1").colorbox({href:"#inline_content_1", open:true, width:"330px", height:"640px"});
});
```
Thank ... |
69,258,753 | I have an html page with a search field that can have a name typed in which returns a table of Names and IDs (from Steam, specifically). The leftmost column, the names, are hyperlinks that I want to, when clicked, take the user to said player's profile (profile.php) and I want to send the "name" and "steamid" to that p... | 2021/09/20 | [
"https://Stackoverflow.com/questions/69258753",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16959530/"
] | The ajax is used to, `post` or `get` parameters/info from/to URL without redirecting/refreshing/navigating to a particular page.
Please note down **without redirecting/refreshing/navigating**
In your case you want to send 2 parameters to `profile.php` and you also want to navigate to it, yes..? but for that you are u... | A hyperlink may be causing the page navigation, which you dont want.
Page navigation will make a get request but your endpoint is expecting a post request.
You can stop the navigation by setting the href to # or by removing the `<a>` altogether.
You could also try calling the `preventDefault` on the event obje... |
41,586,474 | I am trying to use file\_get\_contents to "post" to a url and get auth token. The problem I am having is that it returns a error.
`Message: file_get_contents(something): failed to open stream: HTTP request failed! HTTP/1.1 411 Length Required.`
I am not sure what is causing this but need help. Here is the function.... | 2017/01/11 | [
"https://Stackoverflow.com/questions/41586474",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3495940/"
] | Cannot command so i will do it this way. If you use Postman why don't you let Postman generate the code for you. In postman you can click code at a request and you can even select in what coding language you wanne have it. Like PHP with cURL:
```
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "... | I can not comment because of my reputation;
In some servers file\_get\_content is not available...
You may try with CURL like [this](https://stackoverflow.com/questions/2138527/php-curl-http-post-sample-code) |
41,586,474 | I am trying to use file\_get\_contents to "post" to a url and get auth token. The problem I am having is that it returns a error.
`Message: file_get_contents(something): failed to open stream: HTTP request failed! HTTP/1.1 411 Length Required.`
I am not sure what is causing this but need help. Here is the function.... | 2017/01/11 | [
"https://Stackoverflow.com/questions/41586474",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3495940/"
] | Cannot command so i will do it this way. If you use Postman why don't you let Postman generate the code for you. In postman you can click code at a request and you can even select in what coding language you wanne have it. Like PHP with cURL:
```
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "... | Your request havent any data and content length is missing.
You can try this:
```
public function ForToken(){
$username = 'gettoken';
$password = 'something';
$url = 'https://something.com';
$data = array('foo' => 'some data');
$data = http_build_query($data);
$context_options = array (
... |
41,586,474 | I am trying to use file\_get\_contents to "post" to a url and get auth token. The problem I am having is that it returns a error.
`Message: file_get_contents(something): failed to open stream: HTTP request failed! HTTP/1.1 411 Length Required.`
I am not sure what is causing this but need help. Here is the function.... | 2017/01/11 | [
"https://Stackoverflow.com/questions/41586474",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3495940/"
] | Cannot command so i will do it this way. If you use Postman why don't you let Postman generate the code for you. In postman you can click code at a request and you can even select in what coding language you wanne have it. Like PHP with cURL:
```
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "... | RFC2616 10.4.12
<https://www.rfc-editor.org/rfc/rfc2616#section-10.4.12>
Code: (Doesn't work, see below)
```
public function ForToken(){
$username = 'gettoken';
$password = 'something';
$url = 'https://something.com';
$context = stream_context_create(array (
'http' => array (
'header' => 'Authorization: Basic ' . bas... |
749,247 | Given a polynomial $p(x) = x^3-bx^2+cx-d = 0 $ such that all three roots are **real positive integers**. How does one figure out if the three roots are distinct? The coefficient of $x^3$ is 1. In the case of a quadratic equation, we can determine that the roots are distinct if $b^2-4ac != 0$ for the equation $ax^2+bx+c... | 2014/04/11 | [
"https://math.stackexchange.com/questions/749247",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/142369/"
] | One way to do it is to check if the discriminant of the cubic is positive. The roots are distinct $\iff$ the discriminant is nonzero.
For a cubic, our discriminant is $\Delta = b^2c^2-4ac^3-4b^3d-27a^2d^2+18abcd$. Yuck!
<http://en.wikipedia.org/wiki/Discriminant> | In this special case one may be able to avoid computing the discriminant. If you know all roots are natural numbers, the roots must be divisors of $d$. In fact, from $d=x\_1x\_2x\_3$ and $c=x\_1x\_2+x\_1x\_3+x\_2x\_3$ we see that a multiple root must divide $\gcd(c,d)$. In simple cases one may simply try all these divi... |
65,314,732 | Declaring classes
```
class A
{
public string a;
public static implicit operator A(B b) => new A() { a = b.b };
}
class B
{
public string b;
}
```
comparison `?:` and `if-else`
```
static public A Method1(B b)
{
return (b is null) ? null : b; //equally return b;
}
static public A Method2(B b)
{
... | 2020/12/15 | [
"https://Stackoverflow.com/questions/65314732",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14832315/"
] | When using a ternary operator in `Method1`, the type of the return value must be the same in both branches (`B`, in your case). That value has to be cast to `A` later to match the return type of the method. So, a `NullReferenceException` is thrown in your implicit operator (because `b` is null).
In `Method2`, on the o... | `Method1`
For the ternary operator type of return values should be equal.
So `null` is actually returned as `(B)null`, which then uses implicit operator to get converted to type `A`
`Method2`
The return value is directly converted to `(A)null`, and implicit operator is not used.
`Bonus`
Try changing return type of... |
56,773,826 | I'm wondering if it's possible to concatenate PLyResults somehow inside a function. For example, let's say that firstly I have a function \_get\_data that, given a tuple (id, index) returns a table of values:
```
CREATE OR REPLACE FUNCTION _get_data(id bigint, index bigint):
RETURNS TABLE(oid bigint, id bigint, val do... | 2019/06/26 | [
"https://Stackoverflow.com/questions/56773826",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6400144/"
] | Perhaps I am missing something, but the answer you gave looks like a slower, more complicated version of this query:
```
SELECT oid, id, val
FROM generate_series(your_lower_bound, your_upper_bound) AS g(i),
_get_data(your_id, i);
```
You could put that in a simple SQL function with no loops or temporary tables:
``... | Although I wasn't able to find a way to concatenate the results from the PL/Python documentation, and as of 06-2019, I'm not sure if the language supports this resource, I could solve it by creating a temp table, inserting the records in it for each iteration and then returning the full table:
```
CREATE OR REPLACE FU... |
69,151,455 | I am trying to generate a list of urls by looping two word lists. I can do it one through f-string but I am not so sure how to do two at the same time. Any suggestion?
```py
tag_names = ['business', 'science', 'technology']
domain_names = ['bbc', 'cnn', 'nytimes']
for domain in domain_names:
print(f'www.{domain}.... | 2021/09/12 | [
"https://Stackoverflow.com/questions/69151455",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13236293/"
] | You can use `itertools.product` and a list comprehension:
```py
import itertools
tag_names = ['business', 'science', 'technology']
domain_names = ['bbc', 'cnn', 'nytimes']
[f'www.{domain}.com/{tag}' for domain, tag in itertools.product(domain_names, tag_names)]
```
output:
```
['www.bbc.com/business',
'www.bbc.c... | Or use a nested loop:
```
tag_names = ['business', 'science', 'technology']
domain_names = ['bbc', 'cnn', 'nytimes']
print([f'www.{domain}.com/{tag}' for domain in domain_names for tag in tag_names])
```
Output:
```
['www.bbc.com/business',
'www.bbc.com/science',
'www.bbc.com/technology',
'www.cnn.com/business'... |
69,151,455 | I am trying to generate a list of urls by looping two word lists. I can do it one through f-string but I am not so sure how to do two at the same time. Any suggestion?
```py
tag_names = ['business', 'science', 'technology']
domain_names = ['bbc', 'cnn', 'nytimes']
for domain in domain_names:
print(f'www.{domain}.... | 2021/09/12 | [
"https://Stackoverflow.com/questions/69151455",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13236293/"
] | You can use `itertools.product` and a list comprehension:
```py
import itertools
tag_names = ['business', 'science', 'technology']
domain_names = ['bbc', 'cnn', 'nytimes']
[f'www.{domain}.com/{tag}' for domain, tag in itertools.product(domain_names, tag_names)]
```
output:
```
['www.bbc.com/business',
'www.bbc.c... | ```py
res=zip(tag_names,domain_names)
for i in res:
print(f'www.{i[1]}.com/{i[0]}')
``` |
69,151,455 | I am trying to generate a list of urls by looping two word lists. I can do it one through f-string but I am not so sure how to do two at the same time. Any suggestion?
```py
tag_names = ['business', 'science', 'technology']
domain_names = ['bbc', 'cnn', 'nytimes']
for domain in domain_names:
print(f'www.{domain}.... | 2021/09/12 | [
"https://Stackoverflow.com/questions/69151455",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13236293/"
] | Or use a nested loop:
```
tag_names = ['business', 'science', 'technology']
domain_names = ['bbc', 'cnn', 'nytimes']
print([f'www.{domain}.com/{tag}' for domain in domain_names for tag in tag_names])
```
Output:
```
['www.bbc.com/business',
'www.bbc.com/science',
'www.bbc.com/technology',
'www.cnn.com/business'... | ```py
res=zip(tag_names,domain_names)
for i in res:
print(f'www.{i[1]}.com/{i[0]}')
``` |
17,172,510 | ok so I have a graph that has a steady increasing slope, much like an exponential graph. It then hits a point where the slope changes to a steep line, much steeper than a y=x graph. My question is, how do I find the point where the slope changes, whether it's VBA or just a function graph, I don't care, I just have no i... | 2013/06/18 | [
"https://Stackoverflow.com/questions/17172510",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2460293/"
] | I am the developer working on the other side of this web service. There was indeed a circular reference in the WSDL. I have since fixed that issue and Mike is no longer seeing the recursion error.
On my side, the service is being built on the .NET framework using WCF. The issue was due to my attempt to get rid of the ... | Alternatively if you know you are working with a .NET WCF service you can just change your .svc?wsdl to .svc?singleWsdl and the WCF server will take care of the recursion for you. |
12,874,153 | I created an MVC 4 application in .net 4.5 and installed the Identity and Access tool so that I could create a claims aware application. I configured the application so that it uses the new LocalSTS that comes with 2012, so it doesn't create an STS website like it used to in 2010.
How do I support a log off scenario i... | 2012/10/13 | [
"https://Stackoverflow.com/questions/12874153",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/143919/"
] | The `s.c_str()` returns a pointer to the const char to prevent you from modifying the backing up memory. You need to make a writable copy of this constant string say with `strdup()` function as `strtok()` really modifies the string that you are scanning for tokens. | `strtok` modifies its argument. This is not allowed with `string.c_str()` since it is a *const* char\*
Also, even if it worked your `if( tok == "&" )` will not work since tok is a char\*, not a string, and you will thus be doing pointer and not content comparisons.
You would need to use `strcmp()`
Since you are usin... |
12,874,153 | I created an MVC 4 application in .net 4.5 and installed the Identity and Access tool so that I could create a claims aware application. I configured the application so that it uses the new LocalSTS that comes with 2012, so it doesn't create an STS website like it used to in 2010.
How do I support a log off scenario i... | 2012/10/13 | [
"https://Stackoverflow.com/questions/12874153",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/143919/"
] | The `s.c_str()` returns a pointer to the const char to prevent you from modifying the backing up memory. You need to make a writable copy of this constant string say with `strdup()` function as `strtok()` really modifies the string that you are scanning for tokens. | Your code is mixing C++ `string`s and `cout`s with the C `strtok_r` function. It's not a good combination.
The immediate cause of your error is that `c_str()` returns a `const char *` while `strtok()` asks for a non-const `char *`. It wants to modify the string you pass as an argument, and you're not allowed to modify... |
12,874,153 | I created an MVC 4 application in .net 4.5 and installed the Identity and Access tool so that I could create a claims aware application. I configured the application so that it uses the new LocalSTS that comes with 2012, so it doesn't create an STS website like it used to in 2010.
How do I support a log off scenario i... | 2012/10/13 | [
"https://Stackoverflow.com/questions/12874153",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/143919/"
] | `strtok` modifies its argument. This is not allowed with `string.c_str()` since it is a *const* char\*
Also, even if it worked your `if( tok == "&" )` will not work since tok is a char\*, not a string, and you will thus be doing pointer and not content comparisons.
You would need to use `strcmp()`
Since you are usin... | Your code is mixing C++ `string`s and `cout`s with the C `strtok_r` function. It's not a good combination.
The immediate cause of your error is that `c_str()` returns a `const char *` while `strtok()` asks for a non-const `char *`. It wants to modify the string you pass as an argument, and you're not allowed to modify... |
42,655 | The Lamport signature scheme is faster, less complex and considerably safer than ECDSA. It's only downside - being only usable once - isn't really a downside when signing transactions, since you could just include your next public key whenever signing it. Why isn't, thus, the Lamport signature scheme used in crypto cur... | 2016/12/30 | [
"https://crypto.stackexchange.com/questions/42655",
"https://crypto.stackexchange.com",
"https://crypto.stackexchange.com/users/38444/"
] | The major issue will be size difference. The size of ECDSA in bitcoin is much less than the Lamport Signature.
For [ECDSA in bitcoin](https://en.bitcoin.it/wiki/Elliptic_Curve_Digital_Signature_Algorithm)
* The public key is only 33 Bytes (1 byte for prefix, and 32 bytes for 256-bit integer x)
* Signature is at maxi... | I know this question is really old, but you should look into IOTA (iota.org), they use Winternitz one time signature instead of ECDSA. There's also a paper about Winternitz OTS here: <http://eprint.iacr.org/2011/191.pdf> |
42,655 | The Lamport signature scheme is faster, less complex and considerably safer than ECDSA. It's only downside - being only usable once - isn't really a downside when signing transactions, since you could just include your next public key whenever signing it. Why isn't, thus, the Lamport signature scheme used in crypto cur... | 2016/12/30 | [
"https://crypto.stackexchange.com/questions/42655",
"https://crypto.stackexchange.com",
"https://crypto.stackexchange.com/users/38444/"
] | The major issue will be size difference. The size of ECDSA in bitcoin is much less than the Lamport Signature.
For [ECDSA in bitcoin](https://en.bitcoin.it/wiki/Elliptic_Curve_Digital_Signature_Algorithm)
* The public key is only 33 Bytes (1 byte for prefix, and 32 bytes for 256-bit integer x)
* Signature is at maxi... | The Capitalisk (<https://capitalisk.com/>) blockchain uses the Lamport OTS Scheme in conjunction with the Merkle Signature Scheme (MSS) to produce signatures. MSS provides some degree of key reuse which is useful for signing multiple transactions concurrently.
Here are some pros and cons of using Lamport OTS with MSS ... |
10,082,949 | Hi all it's been sometime since I've touched C so I'm really rusty on it. I wrote a small program to create a matrix using two dynamic arrays. However, I'm getting this warning and I don't understand why? I guess I'm not quite sure about pointers to pointers. Can someone help me point out where my problem is? Thanks.
... | 2012/04/10 | [
"https://Stackoverflow.com/questions/10082949",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1119141/"
] | You've got some problems here:
```
typedef int (**intptr) ();
intptr makeMatrix(int n);
...
int **A = makeMatrix(n);
```
The `intptr` typedef declares a pointer to a pointer to a function that takes an indeterminate number of arguments and returns an `int`. `A` is not an `int`.
You need to write:
```
int **mak... | Your typedef has an extra `()`, making it a zero argument function type. Remove that and you should be good. |
29,821,792 | I use an HTML `button` to run a function called `start_KEMT` in my `recorder.js` script.
```js
var recording = false;
var button = document.getElementById('button');
function start_KEMT() {
if(!recording)
{
init();
toggleRecording(button);
}
toggleRecordin... | 2015/04/23 | [
"https://Stackoverflow.com/questions/29821792",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4465075/"
] | You are passing the `button` in the HTML - `onclick="start_KEMT(this)"`. `this` is button element. But you are not defining it in the function.
Change your function `start_KEMT` to
```
function start_KEMT(button) {
if(!recording)
{
init();
toggleRecording(button);
}
toggleRecording(button);
r... | In your `recorder.js` ,change your function signature from `start_KEMT()` to `start_KEMT(**button**)` .That will solve your problem , as it (i.e. button variable) is undefined right now. |
11,782,961 | I've got the following structure (in reality, it is much bigger):
```
$param_hash = {
'param1' => [0, 1],
'param2' => [0, 1, 2],
'param3' => 0,
};
```
And I'd like to print all the possible combinations of different parameters in the line, like this:
```
param1='0' param2='0' p... | 2012/08/02 | [
"https://Stackoverflow.com/questions/11782961",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1016937/"
] | It means there is an open connection to that database somewhere. It could be in a different tab than the one that's calling deleteDatabase. That connection received a versionchange event notifying it that a call to deleteDatabase had been made and that it needs to close.
You can add such a handler when the database is... | The problem was in the accessing the database from the web workers. In this line of code:
```
database.close();//closing the database
self.close();//closing the web worker
```
There is probably some bug in Google chrome if database closing needs more time than usual and you close the web worker, then the database is... |
36,731,378 | I am working on a project that will have any number of HTML cards, and the format and positioning of the cards is the same, but the content of them will differ.
My plan was to implement the content of each card as an angular directive, and then using ngRepeat, loop through my array of directives which can be in any or... | 2016/04/19 | [
"https://Stackoverflow.com/questions/36731378",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5136485/"
] | The posted code works just fine under ksh.
```
$ contract=c
$ fld1=c
$ if [[ $contract = "$fld1" ]];then
> read position?"Enter the position of Contract number in m-n format,m should be less than n " <
> fi
Enter the position of Contract number in m-n format,m should be less than n 1-2
$ echo $... | this is the working version of your code:
```
if [[ $contract = "$fld1" ]];then
echo "Enter the position of Contract number in m-n format,m should be less than n"
read position
fi
```
if you want the terminal to wait the user for a reply you have to add the echo and the read seperately.
This works fine for you.
Thi... |
48,863,030 | With this code I enable a button if any form value is not `nil`:
```
myButton.isEnabled = !myForm.values.contains(where: { $0 == nil })
```
Is there any way to add multiple checks? I want to enable my button:
* if the value of any field is nil (done, as you can see above);
* if the value of any field is > 0;
* if t... | 2018/02/19 | [
"https://Stackoverflow.com/questions/48863030",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | As wrote in the comment - I can see two solutions
1) add a space after the variable
```
($email_body =~ s/\{REGISTRATION URL\}/$registration_url.' '/ieg;)
```
2) replace with space everything that is not a whitespace
```
($email_body =~ s/\{REGISTRATION URL\}\S+/$registration_url/ieg)
``` | Perhaps the best approach would be to check your file before starting the process of replacing those variables. If you expect that line to be `finish your registration here: {REGISTRATION URL}`, then you can check if that line is what you were expecting like this: `$checkEmailTag =~ /\s\{REGISTRATION URL\}$/`. In this ... |
48,863,030 | With this code I enable a button if any form value is not `nil`:
```
myButton.isEnabled = !myForm.values.contains(where: { $0 == nil })
```
Is there any way to add multiple checks? I want to enable my button:
* if the value of any field is nil (done, as you can see above);
* if the value of any field is > 0;
* if t... | 2018/02/19 | [
"https://Stackoverflow.com/questions/48863030",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | As wrote in the comment - I can see two solutions
1) add a space after the variable
```
($email_body =~ s/\{REGISTRATION URL\}/$registration_url.' '/ieg;)
```
2) replace with space everything that is not a whitespace
```
($email_body =~ s/\{REGISTRATION URL\}\S+/$registration_url/ieg)
``` | A common convention is to embed URLs in `<brokets>` in plain text to show exactly where the URL begins and ends.
```
No misunderstanding: <http://stackoverflow.com/>!
``` |
48,863,030 | With this code I enable a button if any form value is not `nil`:
```
myButton.isEnabled = !myForm.values.contains(where: { $0 == nil })
```
Is there any way to add multiple checks? I want to enable my button:
* if the value of any field is nil (done, as you can see above);
* if the value of any field is > 0;
* if t... | 2018/02/19 | [
"https://Stackoverflow.com/questions/48863030",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | A common convention is to embed URLs in `<brokets>` in plain text to show exactly where the URL begins and ends.
```
No misunderstanding: <http://stackoverflow.com/>!
``` | Perhaps the best approach would be to check your file before starting the process of replacing those variables. If you expect that line to be `finish your registration here: {REGISTRATION URL}`, then you can check if that line is what you were expecting like this: `$checkEmailTag =~ /\s\{REGISTRATION URL\}$/`. In this ... |
3,746 | I don't know if Gus Van Sant has admitted it but it seems clear that this movie has been inspired by the shooting in Columbine High School.
Is there a link between this event and an elephant?
Why is the movie [*Elephant*](https://www.imdb.com/title/tt0363589/) (2003) called that? | 2012/08/11 | [
"https://movies.stackexchange.com/questions/3746",
"https://movies.stackexchange.com",
"https://movies.stackexchange.com/users/1872/"
] | From the [IMDb link](http://www.imdb.com/title/tt0363589/) in the question:
>
> Gus Van Sant borrowed the title from Alan Clarke's film of the same name, and thought that it referred to the Chinese proverb about five blind men who were each led to a different part of an elephant. Each man thinks that it is a differen... | I always thought it was because of the treatment of elephants in the circus. Time and time again these elephants are abused, beaten, and whipped, which creates an inevitable breaking point and they end up stampeding over everyone. Much in the same way, these pariahs who have been bullied far too long finally explode... |
3,746 | I don't know if Gus Van Sant has admitted it but it seems clear that this movie has been inspired by the shooting in Columbine High School.
Is there a link between this event and an elephant?
Why is the movie [*Elephant*](https://www.imdb.com/title/tt0363589/) (2003) called that? | 2012/08/11 | [
"https://movies.stackexchange.com/questions/3746",
"https://movies.stackexchange.com",
"https://movies.stackexchange.com/users/1872/"
] | From the [IMDb link](http://www.imdb.com/title/tt0363589/) in the question:
>
> Gus Van Sant borrowed the title from Alan Clarke's film of the same name, and thought that it referred to the Chinese proverb about five blind men who were each led to a different part of an elephant. Each man thinks that it is a differen... | It's an homage to this film: <http://www.screenonline.org.uk/tv/id/439410/>
Elephant is without question Alan Clarke's bleakest film. Essentially a compilation of eighteen murders on the streets of Belfast, without explanatory narrative or characterisation and shot in a cold, dispassionate documentary style, the film s... |
3,746 | I don't know if Gus Van Sant has admitted it but it seems clear that this movie has been inspired by the shooting in Columbine High School.
Is there a link between this event and an elephant?
Why is the movie [*Elephant*](https://www.imdb.com/title/tt0363589/) (2003) called that? | 2012/08/11 | [
"https://movies.stackexchange.com/questions/3746",
"https://movies.stackexchange.com",
"https://movies.stackexchange.com/users/1872/"
] | I always thought it was because of the treatment of elephants in the circus. Time and time again these elephants are abused, beaten, and whipped, which creates an inevitable breaking point and they end up stampeding over everyone. Much in the same way, these pariahs who have been bullied far too long finally explode... | It's an homage to this film: <http://www.screenonline.org.uk/tv/id/439410/>
Elephant is without question Alan Clarke's bleakest film. Essentially a compilation of eighteen murders on the streets of Belfast, without explanatory narrative or characterisation and shot in a cold, dispassionate documentary style, the film s... |
9,613,676 | I am using hazelcast 1.9.4 version...
I started run.bat from the bin directory, but it doesn't seem to be started..
Mar 8, 2012 11:46:38 AM com.hazelcast.impl.LifecycleServiceImpl
INFO: /10.50.26.189:5704 [dev] Address[10.50.26.189:5704] is STARTING---> It stuck here..
Any idea what would have gone wrong.! | 2012/03/08 | [
"https://Stackoverflow.com/questions/9613676",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/854190/"
] | I see that your member started with port 5704? It may be that some of the members that you previously started were not properly shutdown. Make sure that you don't have any hanging java(running hazelcast) process. | Exit already running Hazelcast nodes . (this seems to be the fourth node :5704)The other nodes might have crashed.
Restarting Hazelcast should fix your problem.! |
2,777,843 | I have to show that $\operatorname{SO}(2)$ defined as:
$$\operatorname{SO}(2)=\{ \left(\begin{array}{cc}
\cos\phi& -\sin\phi\\
\sin\phi&\cos\phi
\end{array}\right)\in M\_2(\mathbb R)\,|\, \phi \in [0,2\pi]\}$$
is an abelian group by proving these points:
1. $A^{-1}$ exists $\forall A \in \operatorname{SO}(2),$
2. if... | 2018/05/12 | [
"https://math.stackexchange.com/questions/2777843",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/561203/"
] | You haven't really proved 1., you've shown that $A$ is invertible matrix, you didn't show that the inverse is contained in $\operatorname{SO}(2)$.
For all three points, the same **hint** applies, write
$$A = \begin{pmatrix}
\cos \alpha & -\sin\alpha\\
\sin \alpha & \cos\alpha
\end{pmatrix},\ B = \begin{pmatrix}
\cos ... | I think the easiest way is realising $\mathbb{C} \cong \mathbb{R}^2$ and identifying $z=a+bi$ as
$$
Z=\begin{pmatrix}a & -b \\ b & a \end{pmatrix}.
$$
Also note that $\det{Z}=a^2+b^2=|z|^2$. Next, one can identify $SO(2)$ as the unit circle $S^1=\{z=\exp{ix}:0 \leq x <2\pi\}$, which is clearly abelian. |
2,777,843 | I have to show that $\operatorname{SO}(2)$ defined as:
$$\operatorname{SO}(2)=\{ \left(\begin{array}{cc}
\cos\phi& -\sin\phi\\
\sin\phi&\cos\phi
\end{array}\right)\in M\_2(\mathbb R)\,|\, \phi \in [0,2\pi]\}$$
is an abelian group by proving these points:
1. $A^{-1}$ exists $\forall A \in \operatorname{SO}(2),$
2. if... | 2018/05/12 | [
"https://math.stackexchange.com/questions/2777843",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/561203/"
] | Convince yourself that the rotation around the origin by an angle $\alpha$ in the counterclockwise sense is given by multiplying a vector in the plane by
$$R\_{\alpha}=\begin{pmatrix} \cos \alpha & -\sin \alpha \\\sin\alpha & \cos \alpha\end{pmatrix}. $$
Rotation by $-\alpha$ is the inverse of rotation by $\alpha$, so... | I think the easiest way is realising $\mathbb{C} \cong \mathbb{R}^2$ and identifying $z=a+bi$ as
$$
Z=\begin{pmatrix}a & -b \\ b & a \end{pmatrix}.
$$
Also note that $\det{Z}=a^2+b^2=|z|^2$. Next, one can identify $SO(2)$ as the unit circle $S^1=\{z=\exp{ix}:0 \leq x <2\pi\}$, which is clearly abelian. |
1,952,225 | I have no formal education in computer science but I have been programming in Java, Ruby, jQuery for a long time.
I was checking out macruby project. I keep running into statements which are similar to "In MacRuby objective-c runtime is same as ruby runtime".
I understand what MRI is. I understand what ruby 1.9 is br... | 2009/12/23 | [
"https://Stackoverflow.com/questions/1952225",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/175838/"
] | Well,
The simplest explanation is that MacRuby is a ruby 1.9 VM. During earlier versions it was a modified version of the YARV (ruby 1.9's official VM) which instead of using custom types for things like ruby strings, hashes etc. made use of equivalents found within apples foundation classes such as NString. With the ... | Just a note on the
>
> However I fail to understand how the VM for one language can support another language.
>
>
>
part.
A VM represents a middle layer between the machine and your programming language. E.g. the Java Virtual Machine (JVM) execute so called java bytecode. The `javac` compiler takes the source c... |
15,623,996 | I need help, I'm just learning C, have no idea what is wrong:
Here I call `set_opts` function :
```
char * tmploc ;
tmploc=set_opts("windir","\\temp.rte");
printf(tmploc);
```
( I know , that printf is not formated, just used it for testing purposes)
function looks like this :
```
char * set_opts(char * env,char... | 2013/03/25 | [
"https://Stackoverflow.com/questions/15623996",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2209077/"
] | Be careful what you are doing with [`getenv()`](http://linux.die.net/man/3/getenv), because:
>
> The getenv() function returns a pointer to the value in the environment, or NULL if there is no match.
>
>
>
So if you pass a name that does not correspond to an existing environment variable then you get NULL returne... | One possible reason: malloc returns `NULL` and you never check for it. Same for getenv().
And it must be
```
malloc(strlen(getenv(env))+strlen(path)+1);
```
If the actual contents of getenv("windir") is longer than 6 characters, you write past the malloced buffer, which invokes *undefined behavior*. |
15,623,996 | I need help, I'm just learning C, have no idea what is wrong:
Here I call `set_opts` function :
```
char * tmploc ;
tmploc=set_opts("windir","\\temp.rte");
printf(tmploc);
```
( I know , that printf is not formated, just used it for testing purposes)
function looks like this :
```
char * set_opts(char * env,char... | 2013/03/25 | [
"https://Stackoverflow.com/questions/15623996",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2209077/"
] | You allocate the length of the string using `env`, but then populate it with `getenv(env)`. If `getenv(env)` is longer than `env` then you have a good chance of a segfault. Did you mean to use `strlen(getenv(env))`?
You really ought to add some error checking to your code:
```
char *set_opts(char *env, char *path)
{
... | One possible reason: malloc returns `NULL` and you never check for it. Same for getenv().
And it must be
```
malloc(strlen(getenv(env))+strlen(path)+1);
```
If the actual contents of getenv("windir") is longer than 6 characters, you write past the malloced buffer, which invokes *undefined behavior*. |
15,623,996 | I need help, I'm just learning C, have no idea what is wrong:
Here I call `set_opts` function :
```
char * tmploc ;
tmploc=set_opts("windir","\\temp.rte");
printf(tmploc);
```
( I know , that printf is not formated, just used it for testing purposes)
function looks like this :
```
char * set_opts(char * env,char... | 2013/03/25 | [
"https://Stackoverflow.com/questions/15623996",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2209077/"
] | You allocate the length of the string using `env`, but then populate it with `getenv(env)`. If `getenv(env)` is longer than `env` then you have a good chance of a segfault. Did you mean to use `strlen(getenv(env))`?
You really ought to add some error checking to your code:
```
char *set_opts(char *env, char *path)
{
... | Be careful what you are doing with [`getenv()`](http://linux.die.net/man/3/getenv), because:
>
> The getenv() function returns a pointer to the value in the environment, or NULL if there is no match.
>
>
>
So if you pass a name that does not correspond to an existing environment variable then you get NULL returne... |
15,623,996 | I need help, I'm just learning C, have no idea what is wrong:
Here I call `set_opts` function :
```
char * tmploc ;
tmploc=set_opts("windir","\\temp.rte");
printf(tmploc);
```
( I know , that printf is not formated, just used it for testing purposes)
function looks like this :
```
char * set_opts(char * env,char... | 2013/03/25 | [
"https://Stackoverflow.com/questions/15623996",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2209077/"
] | Be careful what you are doing with [`getenv()`](http://linux.die.net/man/3/getenv), because:
>
> The getenv() function returns a pointer to the value in the environment, or NULL if there is no match.
>
>
>
So if you pass a name that does not correspond to an existing environment variable then you get NULL returne... | Try getting rid of `getenv(env)`. Just put `strcpy(opt,env);`. `getenv()` is probably returning `NULL`. |
15,623,996 | I need help, I'm just learning C, have no idea what is wrong:
Here I call `set_opts` function :
```
char * tmploc ;
tmploc=set_opts("windir","\\temp.rte");
printf(tmploc);
```
( I know , that printf is not formated, just used it for testing purposes)
function looks like this :
```
char * set_opts(char * env,char... | 2013/03/25 | [
"https://Stackoverflow.com/questions/15623996",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2209077/"
] | Be careful what you are doing with [`getenv()`](http://linux.die.net/man/3/getenv), because:
>
> The getenv() function returns a pointer to the value in the environment, or NULL if there is no match.
>
>
>
So if you pass a name that does not correspond to an existing environment variable then you get NULL returne... | Are you sure:
getenv(env)
will fit into "opt" ?
I don't think so. And if it doesn't fit, then the strcpy could kill your program.
A correction:
char \* set\_opts(char \* env,char \* path){
char \* opt;
char \* value = getenv(env);
opt=malloc(strlen(value)+strlen(path)+1);
strcpy(opt,value);
strcat(opt,path);
r... |
15,623,996 | I need help, I'm just learning C, have no idea what is wrong:
Here I call `set_opts` function :
```
char * tmploc ;
tmploc=set_opts("windir","\\temp.rte");
printf(tmploc);
```
( I know , that printf is not formated, just used it for testing purposes)
function looks like this :
```
char * set_opts(char * env,char... | 2013/03/25 | [
"https://Stackoverflow.com/questions/15623996",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2209077/"
] | You allocate the length of the string using `env`, but then populate it with `getenv(env)`. If `getenv(env)` is longer than `env` then you have a good chance of a segfault. Did you mean to use `strlen(getenv(env))`?
You really ought to add some error checking to your code:
```
char *set_opts(char *env, char *path)
{
... | Try getting rid of `getenv(env)`. Just put `strcpy(opt,env);`. `getenv()` is probably returning `NULL`. |
15,623,996 | I need help, I'm just learning C, have no idea what is wrong:
Here I call `set_opts` function :
```
char * tmploc ;
tmploc=set_opts("windir","\\temp.rte");
printf(tmploc);
```
( I know , that printf is not formated, just used it for testing purposes)
function looks like this :
```
char * set_opts(char * env,char... | 2013/03/25 | [
"https://Stackoverflow.com/questions/15623996",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2209077/"
] | You allocate the length of the string using `env`, but then populate it with `getenv(env)`. If `getenv(env)` is longer than `env` then you have a good chance of a segfault. Did you mean to use `strlen(getenv(env))`?
You really ought to add some error checking to your code:
```
char *set_opts(char *env, char *path)
{
... | Are you sure:
getenv(env)
will fit into "opt" ?
I don't think so. And if it doesn't fit, then the strcpy could kill your program.
A correction:
char \* set\_opts(char \* env,char \* path){
char \* opt;
char \* value = getenv(env);
opt=malloc(strlen(value)+strlen(path)+1);
strcpy(opt,value);
strcat(opt,path);
r... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.