qid int64 1 74.7M | question stringlengths 0 58.3k | date stringlengths 10 10 | metadata list | response_j stringlengths 2 48.3k | response_k stringlengths 2 40.5k |
|---|---|---|---|---|---|
58,876,225 | How to integrate screen time/ Parental control API in iOS app. Is screen time api available?
I tried with MDM(Mobile device management) but I am unable to create the MDM CSR. As there is no option for this certificate on developer account.
Please guide me if you have any solution. Basically I want to create an app havi... | 2019/11/15 | [
"https://Stackoverflow.com/questions/58876225",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9858609/"
] | In my case the issue was solved by adding `DEBUG` as the **debug Active Compilation Condition**. I know it's already specified when you create a new project, but I don't remember if me or another team's member removed it (and why!). So I decided to put it here just in case someone else is facing the same scenario
[![D... | `DEBUG` is the only default swift flag on a new project. You can create your own in your project build settings, `Other Swift Flags`.
Otherwise:
```
#if DEBUG
// This code will be run while installing from Xcode
#else
// This code will be run from AppStore, Adhoc ...
#endif
``` |
57,742,783 | I'm new to a large AWS deployment where stuff is mostly deployed through CloudFormation (and some through Terraform). But there are always cases where something has been deployed manually and not through code. Is there a reliable way to quickly figure out if a resource (say, an EC2 instance) already existing in the dep... | 2019/09/01 | [
"https://Stackoverflow.com/questions/57742783",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6629280/"
] | You can identify the resources created by cloudformation. Cloudformation applies few default tags as mentioned here
```
aws:cloudformation:logical-id
aws:cloudformation:stack-id
aws:cloudformation:stack-name
```
You can run a script to check whether the resource contain one/all of these tags to update your count.... | Unfortunately looking at an AWS resource you don't see how it got created. While some resources might have been tagged by CloudFormation indicating that they got created by a CloudFormation stack, that's only valid for a subset of resources.
The only reliable way to figure out whether or not a resource got created via... |
52,767 | I am currently studying for an exam in Quantum Mechanics and came across a solution to a problem I have trouble with understanding.
The Problem:
A Particle sits in an infinite potential well described by
\begin{align}
V(x) &= 0, & 0 \leq x \leq L \\
V(x) &= \infty, & \text{otherwise}
\end{align}
We know that the en... | 2013/02/01 | [
"https://physics.stackexchange.com/questions/52767",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/20486/"
] | The expectation value of the energy stays the same after the doubling of size but it doesn't mean that the spectrum is the same. For a normalized $\psi$, the expectation value of the energy is simply
$$ \int\_{-L}^{+L}dx\,\psi^\* \left( -\frac{\hbar^2}{2m}\frac{\partial^2}{\partial x^2} + V(x) \right) \psi $$
because t... | Under sudden perturbation the state does not change, but the basis does. This state gets expanded in the new basis whose coefficients evolve correspondingly. Normally it is covered in chapters with the time-dependent perturbation theory $\hat{V} = \hat{V}(t)$.
If the potential is time-dependent, the energy is not cons... |
22,020,452 | Suppose this situation, you have a function that return void and the method is mostly gonna be the only statement of a if
```
if(condition)
someVoidMethod();
```
Since certain language will not continue the evaluation of a boolean expression of concatenated and's if any of them return false. We are wondering wha... | 2014/02/25 | [
"https://Stackoverflow.com/questions/22020452",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | The compiler will generate the same code for both alternatives with any reasonable level of optimization. The logic behind both statements is exactly the same, because `&&` produces a branching behavior in both C and C++ for short-circuiting.
I verified this using two programs:
Program 1:
```
#include <stdio.h>
int ... | It would take a smarter compiler to figure out that it can ignore the return value from `someIntMethod` (although I suspect most compilers would do so). But more seriously if the function isn't `inline` it would *have* to take extra cycles to pass the value back even if it's going to be discarded, so the first is possi... |
36,862,683 | I am getting an exception, but it isn't a code problem, it is a settings/dependencies problem.
I have a work and home computer. The project files are synced via OneDrive. Both computers are running Mac OSX 10.11.4, jdk1.8.0\_66.jdk and IntelliJ IDEA 2016.1.1
The code works at my work but at home I get the exception:
... | 2016/04/26 | [
"https://Stackoverflow.com/questions/36862683",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1490306/"
] | There's no proper way to do it if you don't have indication, when row was added. | You can try to access the transaction log and get a list of all insert-transactions sorted by time stamp. Then find the time stamp of the last inserted row of the last month. These will lead you (hopefully) at the end to the last inserted row of last month (all rows with higher ID will be the data your are looking for)... |
1,217,460 | I have a multiline Bash variable: `$WORDS` containing one word on each line.
I have another multiline Bash variable: `$LIST` also containing one word on each line.
I want to purge `$LIST` from any word present into `$WORDS`.
I currently do that with a `while read` and `grep` but this is not sexy.
```
WORDS=$(ec... | 2017/06/08 | [
"https://superuser.com/questions/1217460",
"https://superuser.com",
"https://superuser.com/users/124122/"
] | This should accomplish what you're trying to do.
```
WORDS=$(echo -e 'cat\ntree\nearth\nred')
LIST=$(echo -e 'abcd\n1234\nred\nwater\npage\ncat')
echo "$LIST" | awk -v WORDS="$WORDS" '
BEGIN {
split(WORDS,w1,"\n")
for (w in w1) { w2[w1[w]] = 1 }
}
{
if (w2[$0] != 1) { print $0 }
}'
```
Here's how it works. Fi... | I suggest
```
echo "$LIST" | grep -vf <(echo "$WORDS")
``` |
21,739,350 | When I try to set an adapter to list like `list.setAdapter(adapter);` I get an exception because list is null at this line of execution in FromPageActivity.java. If my understanding is right, since I am using Roboguice, @ViewById should initialize that in R.java.
**FromPageActivity.java**
```
@RoboGuice
@EActivity(R.... | 2014/02/12 | [
"https://Stackoverflow.com/questions/21739350",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1733310/"
] | You should set the id of your ListView with:
```
android:id="@+id/list"
```
The + symbol indicates that this is a new resource to be defined in your application's namespace, i.e. added to R.java. What you currently have:
```
android:id="@android:id/list"
```
...refers to a pre-defined id within the Android framew... | There is a saying that, if you can't create file in R.Java, it means there is a problem with XML.
If you look at your listview, you have "android:id="@android:id/list", this should have been
```
"@+id/your_idname".
```
Hopefully this should resolve the problem.
Let me if its still not working!! |
21,739,350 | When I try to set an adapter to list like `list.setAdapter(adapter);` I get an exception because list is null at this line of execution in FromPageActivity.java. If my understanding is right, since I am using Roboguice, @ViewById should initialize that in R.java.
**FromPageActivity.java**
```
@RoboGuice
@EActivity(R.... | 2014/02/12 | [
"https://Stackoverflow.com/questions/21739350",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1733310/"
] | You should set the id of your ListView with:
```
android:id="@+id/list"
```
The + symbol indicates that this is a new resource to be defined in your application's namespace, i.e. added to R.java. What you currently have:
```
android:id="@android:id/list"
```
...refers to a pre-defined id within the Android framew... | @ViewById is not a RoboGuice annotation. Looks like you're mixing your libraries. You want @InjectView. |
21,739,350 | When I try to set an adapter to list like `list.setAdapter(adapter);` I get an exception because list is null at this line of execution in FromPageActivity.java. If my understanding is right, since I am using Roboguice, @ViewById should initialize that in R.java.
**FromPageActivity.java**
```
@RoboGuice
@EActivity(R.... | 2014/02/12 | [
"https://Stackoverflow.com/questions/21739350",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1733310/"
] | There is a saying that, if you can't create file in R.Java, it means there is a problem with XML.
If you look at your listview, you have "android:id="@android:id/list", this should have been
```
"@+id/your_idname".
```
Hopefully this should resolve the problem.
Let me if its still not working!! | @ViewById is not a RoboGuice annotation. Looks like you're mixing your libraries. You want @InjectView. |
20,488,756 | I use the code below for sending ajax request to get more products on scroll down event. However it also sends ajax request when I scroll up, which is not intended. How can I modify it so that it will send a request only when I scroll it to the bottom?
```
_debug = true;
function dbg(msg) {
if (_debug) console.lo... | 2013/12/10 | [
"https://Stackoverflow.com/questions/20488756",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2667210/"
] | Here is another way using jQuery
```
var checkout = $(".calendar").datepicker({});
$( "#myModal" ).scroll(function() {
$('.calendar').datepicker('place')
});
``` | Solution provided by rab works but still not perfect as the datepicker flickers on scroll of bootstrap modal. So I used the jquery's scroll event to achieve smooth position change of datepicker.
Here's my code:
```
$( document ).scroll(function(){
$('#modal .datepicker').datepicker('place'); //#modal is t... |
20,488,756 | I use the code below for sending ajax request to get more products on scroll down event. However it also sends ajax request when I scroll up, which is not intended. How can I modify it so that it will send a request only when I scroll it to the bottom?
```
_debug = true;
function dbg(msg) {
if (_debug) console.lo... | 2013/12/10 | [
"https://Stackoverflow.com/questions/20488756",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2667210/"
] | Here is another way using jQuery
```
var checkout = $(".calendar").datepicker({});
$( "#myModal" ).scroll(function() {
$('.calendar').datepicker('place')
});
``` | I too faced the same issue while using bootstrap datepicker in my project. I used an alternate method where in i created a hidden transparent layer inside the datepicker template inside *bootstrap-datepicker.js* (with classname *'hidden-layer-datepicker'*) and gave fixed position and occupying full height and width of ... |
20,488,756 | I use the code below for sending ajax request to get more products on scroll down event. However it also sends ajax request when I scroll up, which is not intended. How can I modify it so that it will send a request only when I scroll it to the bottom?
```
_debug = true;
function dbg(msg) {
if (_debug) console.lo... | 2013/12/10 | [
"https://Stackoverflow.com/questions/20488756",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2667210/"
] | There is option `datepicker('place')` to update position . I have updated [jsfiddle](http://jsfiddle.net/csrA5/2/)
```
var datePicker = $(".calendar").datepicker({});
var t ;
$( document ).on(
'DOMMouseScroll mousewheel scroll',
'#myModal',
function(){
window.clearTimeout( t );
t = ... | I dont know why, but positioning is based on scrolling so you need to find this code in bootstrap-datepicker.js
```
scrollTop = $(this.o.container).scrollTop();
```
and rewrite it to
```
scrollTop = 0;
```
This helped me, i hope it will help another people. |
20,488,756 | I use the code below for sending ajax request to get more products on scroll down event. However it also sends ajax request when I scroll up, which is not intended. How can I modify it so that it will send a request only when I scroll it to the bottom?
```
_debug = true;
function dbg(msg) {
if (_debug) console.lo... | 2013/12/10 | [
"https://Stackoverflow.com/questions/20488756",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2667210/"
] | Here is another way using jQuery
```
var checkout = $(".calendar").datepicker({});
$( "#myModal" ).scroll(function() {
$('.calendar').datepicker('place')
});
``` | I ran into this problem aswell with Stefan Petre's version of Bootstrap-datepicker (<https://www.eyecon.ro/bootstrap-datepicker>), the issue is the Datepicker element is attached to the body which means it will scroll with the body, fine in most cases but when you have a scrollable modal you need to attach the Datepick... |
20,488,756 | I use the code below for sending ajax request to get more products on scroll down event. However it also sends ajax request when I scroll up, which is not intended. How can I modify it so that it will send a request only when I scroll it to the bottom?
```
_debug = true;
function dbg(msg) {
if (_debug) console.lo... | 2013/12/10 | [
"https://Stackoverflow.com/questions/20488756",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2667210/"
] | There is option `datepicker('place')` to update position . I have updated [jsfiddle](http://jsfiddle.net/csrA5/2/)
```
var datePicker = $(".calendar").datepicker({});
var t ;
$( document ).on(
'DOMMouseScroll mousewheel scroll',
'#myModal',
function(){
window.clearTimeout( t );
t = ... | Here is another way using jQuery
```
var checkout = $(".calendar").datepicker({});
$( "#myModal" ).scroll(function() {
$('.calendar').datepicker('place')
});
``` |
20,488,756 | I use the code below for sending ajax request to get more products on scroll down event. However it also sends ajax request when I scroll up, which is not intended. How can I modify it so that it will send a request only when I scroll it to the bottom?
```
_debug = true;
function dbg(msg) {
if (_debug) console.lo... | 2013/12/10 | [
"https://Stackoverflow.com/questions/20488756",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2667210/"
] | There is option `datepicker('place')` to update position . I have updated [jsfiddle](http://jsfiddle.net/csrA5/2/)
```
var datePicker = $(".calendar").datepicker({});
var t ;
$( document ).on(
'DOMMouseScroll mousewheel scroll',
'#myModal',
function(){
window.clearTimeout( t );
t = ... | I ran into this problem aswell with Stefan Petre's version of Bootstrap-datepicker (<https://www.eyecon.ro/bootstrap-datepicker>), the issue is the Datepicker element is attached to the body which means it will scroll with the body, fine in most cases but when you have a scrollable modal you need to attach the Datepick... |
20,488,756 | I use the code below for sending ajax request to get more products on scroll down event. However it also sends ajax request when I scroll up, which is not intended. How can I modify it so that it will send a request only when I scroll it to the bottom?
```
_debug = true;
function dbg(msg) {
if (_debug) console.lo... | 2013/12/10 | [
"https://Stackoverflow.com/questions/20488756",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2667210/"
] | There is option `datepicker('place')` to update position . I have updated [jsfiddle](http://jsfiddle.net/csrA5/2/)
```
var datePicker = $(".calendar").datepicker({});
var t ;
$( document ).on(
'DOMMouseScroll mousewheel scroll',
'#myModal',
function(){
window.clearTimeout( t );
t = ... | Try to add the event scroll in bootstrap-datepicker.js, in function "Datepicker.prototype"
```
[$(window), {
resize: $.proxy(this.place, this),
scroll: $.proxy(this.place, this)
}]
``` |
20,488,756 | I use the code below for sending ajax request to get more products on scroll down event. However it also sends ajax request when I scroll up, which is not intended. How can I modify it so that it will send a request only when I scroll it to the bottom?
```
_debug = true;
function dbg(msg) {
if (_debug) console.lo... | 2013/12/10 | [
"https://Stackoverflow.com/questions/20488756",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2667210/"
] | There is option `datepicker('place')` to update position . I have updated [jsfiddle](http://jsfiddle.net/csrA5/2/)
```
var datePicker = $(".calendar").datepicker({});
var t ;
$( document ).on(
'DOMMouseScroll mousewheel scroll',
'#myModal',
function(){
window.clearTimeout( t );
t = ... | I too faced the same issue while using bootstrap datepicker in my project. I used an alternate method where in i created a hidden transparent layer inside the datepicker template inside *bootstrap-datepicker.js* (with classname *'hidden-layer-datepicker'*) and gave fixed position and occupying full height and width of ... |
20,488,756 | I use the code below for sending ajax request to get more products on scroll down event. However it also sends ajax request when I scroll up, which is not intended. How can I modify it so that it will send a request only when I scroll it to the bottom?
```
_debug = true;
function dbg(msg) {
if (_debug) console.lo... | 2013/12/10 | [
"https://Stackoverflow.com/questions/20488756",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2667210/"
] | Here is another way using jQuery
```
var checkout = $(".calendar").datepicker({});
$( "#myModal" ).scroll(function() {
$('.calendar').datepicker('place')
});
``` | I dont know why, but positioning is based on scrolling so you need to find this code in bootstrap-datepicker.js
```
scrollTop = $(this.o.container).scrollTop();
```
and rewrite it to
```
scrollTop = 0;
```
This helped me, i hope it will help another people. |
20,488,756 | I use the code below for sending ajax request to get more products on scroll down event. However it also sends ajax request when I scroll up, which is not intended. How can I modify it so that it will send a request only when I scroll it to the bottom?
```
_debug = true;
function dbg(msg) {
if (_debug) console.lo... | 2013/12/10 | [
"https://Stackoverflow.com/questions/20488756",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2667210/"
] | Here is another way using jQuery
```
var checkout = $(".calendar").datepicker({});
$( "#myModal" ).scroll(function() {
$('.calendar').datepicker('place')
});
``` | Try to add the event scroll in bootstrap-datepicker.js, in function "Datepicker.prototype"
```
[$(window), {
resize: $.proxy(this.place, this),
scroll: $.proxy(this.place, this)
}]
``` |
4,422,664 | (Not to be confused with [Catalan's constant](https://en.wikipedia.org/wiki/Catalan%27s_constant))
>
> Evaluate the infinite sum $$S = \sum\_{n=0}^\infty \frac{(-1)^{T\_n}}{(2n+1)^2} = 1 - \frac1{3^2} - \frac1{5^2} + \frac1{7^2} + \frac1{9^2} - \frac1{11^2} - \frac1{13^2} + \frac1{15^2} + \cdots$$
> where $T\_n = \fr... | 2022/04/07 | [
"https://math.stackexchange.com/questions/4422664",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/170231/"
] | For reference, here is a solution using [dilogarithm identities](https://en.wikipedia.org/wiki/Spence%27s_function#Identities) $$\newcommand{\dilog}{\operatorname{Li}\_2}\dilog(z)+\dilog(-z)=\frac12\dilog(z^2),\qquad\dilog(z)+\dilog(z^{-1})=-\frac{\pi^2}{6}-\frac{\log^2(-z)}{2},$$ with the principal value of the logari... | Just to clarify
$$\sum\limits\_{n=0}^\infty\frac{(-1)^{n (n+1)/2}}{(2 n+1)^s}\tag{1}$$
is equivalent to
$$\sum\limits\_{n=1}^{\infty }\frac{\chi\_{8,2}(n)}{n^s}=L\_{8,2}(s)=8^{-s} \left(\zeta \left(s,\frac{1}{8}\right)-\zeta \left(s,\frac{3}{8}\right)-\zeta \left(s,\frac{5}{8}\right)+\zeta \left(s,\frac{7}{8}\right)... |
4,422,664 | (Not to be confused with [Catalan's constant](https://en.wikipedia.org/wiki/Catalan%27s_constant))
>
> Evaluate the infinite sum $$S = \sum\_{n=0}^\infty \frac{(-1)^{T\_n}}{(2n+1)^2} = 1 - \frac1{3^2} - \frac1{5^2} + \frac1{7^2} + \frac1{9^2} - \frac1{11^2} - \frac1{13^2} + \frac1{15^2} + \cdots$$
> where $T\_n = \fr... | 2022/04/07 | [
"https://math.stackexchange.com/questions/4422664",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/170231/"
] | For reference, here is a solution using [dilogarithm identities](https://en.wikipedia.org/wiki/Spence%27s_function#Identities) $$\newcommand{\dilog}{\operatorname{Li}\_2}\dilog(z)+\dilog(-z)=\frac12\dilog(z^2),\qquad\dilog(z)+\dilog(z^{-1})=-\frac{\pi^2}{6}-\frac{\log^2(-z)}{2},$$ with the principal value of the logari... | Using the function suggested in comments (one of which contains a typo; $29$ should have been $28$), I arrive at the identity
$$\pi^2 \left(\left(x - \frac12\right)^2 - \frac{21}{256}\right) = \\ \cos(2\pi x) \sum\_{k=0}^\infty \frac{(-1)^k}{(8k+1)^2} + \cos(4\pi x) \sum\_{k=0}^\infty \frac{(-1)^k}{(8k+2)^2} + \cdots ... |
4,422,664 | (Not to be confused with [Catalan's constant](https://en.wikipedia.org/wiki/Catalan%27s_constant))
>
> Evaluate the infinite sum $$S = \sum\_{n=0}^\infty \frac{(-1)^{T\_n}}{(2n+1)^2} = 1 - \frac1{3^2} - \frac1{5^2} + \frac1{7^2} + \frac1{9^2} - \frac1{11^2} - \frac1{13^2} + \frac1{15^2} + \cdots$$
> where $T\_n = \fr... | 2022/04/07 | [
"https://math.stackexchange.com/questions/4422664",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/170231/"
] | For reference, here is a solution using [dilogarithm identities](https://en.wikipedia.org/wiki/Spence%27s_function#Identities) $$\newcommand{\dilog}{\operatorname{Li}\_2}\dilog(z)+\dilog(-z)=\frac12\dilog(z^2),\qquad\dilog(z)+\dilog(z^{-1})=-\frac{\pi^2}{6}-\frac{\log^2(-z)}{2},$$ with the principal value of the logari... | I will provide a computation without the need for special functions.
Let us define a complex valued function with the poles and residues necessary to reconstruct our sum of interest. We start with a composition of periodic functions
\begin{equation}
f(z)= \underbrace{\frac{1}{\sin(8 \pi z)}}\_{\substack{\text{provides... |
4,422,664 | (Not to be confused with [Catalan's constant](https://en.wikipedia.org/wiki/Catalan%27s_constant))
>
> Evaluate the infinite sum $$S = \sum\_{n=0}^\infty \frac{(-1)^{T\_n}}{(2n+1)^2} = 1 - \frac1{3^2} - \frac1{5^2} + \frac1{7^2} + \frac1{9^2} - \frac1{11^2} - \frac1{13^2} + \frac1{15^2} + \cdots$$
> where $T\_n = \fr... | 2022/04/07 | [
"https://math.stackexchange.com/questions/4422664",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/170231/"
] | Here's another way to evaluate this series.
Since the series converges absolutely,
$$
\begin{aligned}
S&=\sum\_{n=0}^{\infty}\left(\frac{1}{(8n+1)^2}-\frac{1}{(8n+3)^2}-\frac{1}{(8n+5)^2}+\frac{1}{(8n+7)^2}\right)
\\&=\frac{1}{64} \left(\psi ^{(1)}\left(\frac{1}{8}\right)-\psi ^{(1)}\left(\frac{3}{8}\right)-\psi ^{(1... | Just to clarify
$$\sum\limits\_{n=0}^\infty\frac{(-1)^{n (n+1)/2}}{(2 n+1)^s}\tag{1}$$
is equivalent to
$$\sum\limits\_{n=1}^{\infty }\frac{\chi\_{8,2}(n)}{n^s}=L\_{8,2}(s)=8^{-s} \left(\zeta \left(s,\frac{1}{8}\right)-\zeta \left(s,\frac{3}{8}\right)-\zeta \left(s,\frac{5}{8}\right)+\zeta \left(s,\frac{7}{8}\right)... |
4,422,664 | (Not to be confused with [Catalan's constant](https://en.wikipedia.org/wiki/Catalan%27s_constant))
>
> Evaluate the infinite sum $$S = \sum\_{n=0}^\infty \frac{(-1)^{T\_n}}{(2n+1)^2} = 1 - \frac1{3^2} - \frac1{5^2} + \frac1{7^2} + \frac1{9^2} - \frac1{11^2} - \frac1{13^2} + \frac1{15^2} + \cdots$$
> where $T\_n = \fr... | 2022/04/07 | [
"https://math.stackexchange.com/questions/4422664",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/170231/"
] | Here's another way to evaluate this series.
Since the series converges absolutely,
$$
\begin{aligned}
S&=\sum\_{n=0}^{\infty}\left(\frac{1}{(8n+1)^2}-\frac{1}{(8n+3)^2}-\frac{1}{(8n+5)^2}+\frac{1}{(8n+7)^2}\right)
\\&=\frac{1}{64} \left(\psi ^{(1)}\left(\frac{1}{8}\right)-\psi ^{(1)}\left(\frac{3}{8}\right)-\psi ^{(1... | Using the function suggested in comments (one of which contains a typo; $29$ should have been $28$), I arrive at the identity
$$\pi^2 \left(\left(x - \frac12\right)^2 - \frac{21}{256}\right) = \\ \cos(2\pi x) \sum\_{k=0}^\infty \frac{(-1)^k}{(8k+1)^2} + \cos(4\pi x) \sum\_{k=0}^\infty \frac{(-1)^k}{(8k+2)^2} + \cdots ... |
4,422,664 | (Not to be confused with [Catalan's constant](https://en.wikipedia.org/wiki/Catalan%27s_constant))
>
> Evaluate the infinite sum $$S = \sum\_{n=0}^\infty \frac{(-1)^{T\_n}}{(2n+1)^2} = 1 - \frac1{3^2} - \frac1{5^2} + \frac1{7^2} + \frac1{9^2} - \frac1{11^2} - \frac1{13^2} + \frac1{15^2} + \cdots$$
> where $T\_n = \fr... | 2022/04/07 | [
"https://math.stackexchange.com/questions/4422664",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/170231/"
] | Here's another way to evaluate this series.
Since the series converges absolutely,
$$
\begin{aligned}
S&=\sum\_{n=0}^{\infty}\left(\frac{1}{(8n+1)^2}-\frac{1}{(8n+3)^2}-\frac{1}{(8n+5)^2}+\frac{1}{(8n+7)^2}\right)
\\&=\frac{1}{64} \left(\psi ^{(1)}\left(\frac{1}{8}\right)-\psi ^{(1)}\left(\frac{3}{8}\right)-\psi ^{(1... | I will provide a computation without the need for special functions.
Let us define a complex valued function with the poles and residues necessary to reconstruct our sum of interest. We start with a composition of periodic functions
\begin{equation}
f(z)= \underbrace{\frac{1}{\sin(8 \pi z)}}\_{\substack{\text{provides... |
63,433,654 | I have this test snippet
```
while True:
input("prompt> ")
```
On Windows, when I run this script with "py", I can use the arrow keys as expected. But when I try doing this in my ubuntu command line, it will show the following output:
[](https:/... | 2020/08/16 | [
"https://Stackoverflow.com/questions/63433654",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7579456/"
] | it's about OS -
windows os is working differently from a based Linux-OS like ubuntu.
you can try this:
<https://stackoverflow.com/a/893200/9350669>
by the way, I just install python3 in my VM-ubuntu and run your script and the arrow keys work well, so you can try reinstall python or update the os. [![enter image... | ```
python3 -i script.py
```
Apparently this solves the problem and makes the session interactive. Lol okay. |
210,077 | I am working on sharepoint server 2013 (on-premise & office 365). and sometime i have to write some custom JavaScripts and custom style which hide/relocate certain HTML components. Example of these include the following 2 cases:-
1- Inside the built-in discussion board view there is a link named "What's Hot" and i did... | 2017/03/08 | [
"https://sharepoint.stackexchange.com/questions/210077",
"https://sharepoint.stackexchange.com",
"https://sharepoint.stackexchange.com/users/84413/"
] | It's not the greatest of practises - as you're aware you may come back to the project later and be unable to recall how you hid it - if at all not to mention if anyone else comes to the project or should you leave. You should be able to edit the itemstyle itself and create a custom layout for it so you can select it th... | I'm going to have to disagree with Daniel's answer: not only is it okay, I wish more developers would use Microsoft's OOB classes and IDs. They should be done with caution, and it is good to understand all the other places the classes and IDs might be in use - but that's the power of it: you can implement customization... |
210,077 | I am working on sharepoint server 2013 (on-premise & office 365). and sometime i have to write some custom JavaScripts and custom style which hide/relocate certain HTML components. Example of these include the following 2 cases:-
1- Inside the built-in discussion board view there is a link named "What's Hot" and i did... | 2017/03/08 | [
"https://sharepoint.stackexchange.com/questions/210077",
"https://sharepoint.stackexchange.com",
"https://sharepoint.stackexchange.com/users/84413/"
] | >
> 1. I should avoid writing such a custom javascripts and custom style in
> sharepoint, since the classes i am depending on can change in the
> future?
> 2. Those customizations are valid and i am not doing any thing wrong,,
> but if these custom javascripts and/or cusotm style break after
> installing an update... | I'm going to have to disagree with Daniel's answer: not only is it okay, I wish more developers would use Microsoft's OOB classes and IDs. They should be done with caution, and it is good to understand all the other places the classes and IDs might be in use - but that's the power of it: you can implement customization... |
50,888,280 | I'm having this error multiple times. How to fix it..
I have solved it without command line arguments but now this is giving me an error. How to solve it with `Integer.parseInt()`.
>
>
> ```
> BubbleSort.java:24: error: incompatible types: String[] cannot be converted to String
> int num[] = Integer.parseInt(args... | 2018/06/16 | [
"https://Stackoverflow.com/questions/50888280",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8178732/"
] | The line
```
int num[] = Integer.parseInt(args);
```
is wrong. Look at the error message, it clearly indicates this error: `parseInt(...)` does not take a string array but a single string instead. Replace the line with this:
```
int[] num = new int[args.length];
for (int i = 0; i < args.length; i++) {
num[i] = ... | Try this:
```
int num[];
for (int i = 0; i < len; i++) {
num[i] = Integer.parseInt(args[i]);
}
```
instead of:
```
int num[] = Integer.parseInt(args);
```
This is because `args` variable is an array of strings and the `Integer.parseInt` method take a single string as argument, not an array. |
50,888,280 | I'm having this error multiple times. How to fix it..
I have solved it without command line arguments but now this is giving me an error. How to solve it with `Integer.parseInt()`.
>
>
> ```
> BubbleSort.java:24: error: incompatible types: String[] cannot be converted to String
> int num[] = Integer.parseInt(args... | 2018/06/16 | [
"https://Stackoverflow.com/questions/50888280",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8178732/"
] | The line
```
int num[] = Integer.parseInt(args);
```
is wrong. Look at the error message, it clearly indicates this error: `parseInt(...)` does not take a string array but a single string instead. Replace the line with this:
```
int[] num = new int[args.length];
for (int i = 0; i < args.length; i++) {
num[i] = ... | `args` is not a single String. Its an array of Strings. You can use the following code to parse the String array args into an integer array:
```
int[] num= Arrays.stream(args)
.mapToInt(Integer::parseInt)
.toArray();
``` |
60,744,855 | I have a python program that runs another python script in a subprocess (yes I know this architecture is not ideal but the nature of the project makes it necessary). I am trying to:
**1. send a sigint to the python subprocess (simulate a keyboard kill)**
**2. catch the sigint in the subprocess and perform some cleanu... | 2020/03/18 | [
"https://Stackoverflow.com/questions/60744855",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5360657/"
] | Maybe try:
```
#!/usr/local/cpython-3.8/bin/python3
import signal
import subprocess
import time
proc = subprocess.Popen(['python3', 'B.py'], shell=False)
time.sleep(1)
proc.send_signal(signal.SIGINT)
proc.wait()
```
...as your A.py?
I suspect the shell is ignoring SIGINT rather than passing it down to B.py. | Based on the comment below, I launched a Kubuntu VM and it works if you specify `bash` to be used and `shell=False`. The reason is given in the comment, but `/bin/sh` is aliased to `dash` on Debain/Ubuntu (perhaps other distros as well). To determine what your system uses, open a terminal and type `ls -l /bin/sh`.
A.p... |
175,850 | Hobbyist here. I think my case/when logic needs to be cleaned up a bit. I'd also appreciate critique on the other parts...but I'm more interested in cleaning up the case/when statements...
```
puts "please assign an integer to x:"
x = gets.chomp.to_i
if (x > 0)
value_of_x = true
else
value_of_x = false
end
puts ... | 2017/09/16 | [
"https://codereview.stackexchange.com/questions/175850",
"https://codereview.stackexchange.com",
"https://codereview.stackexchange.com/users/147381/"
] | The following will simplify your boolean logic, remove repetition in your input processing, and better express what you're really doing:
```
puts "please assign an integer to x:"
x = gets.chomp.to_i
puts "now please assign an integer to y:"
y = gets.chomp.to_i
num_positive = (x > 0 ? 1 : 0) + (y > 0 ? 1 : 0)
case ... | `#to_i` is not that picky about trailing whitespace. You don't really need to `#chomp` the input.
Your variables `value_of_x` and `value_of_y` are very misleadingly named. You can also simplify their assignment, since `(x > 0)` is a boolean expression that will evaluate to either `true` or `false`.
I would rearrange ... |
1,725,639 | Looking at a very simple web project, hosted in IIS, with one simple aspx page, executing some code (get some data from a db and populate some controls), which of the following is true:
each page request shares the same instance of the codebehind class.
or each page request runs in its own instance of the codebehin... | 2009/11/12 | [
"https://Stackoverflow.com/questions/1725639",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/209978/"
] | * Each request gets a new instance of the code-behind class.
* One instance of the code-behind class serves one request.
* Two requests at different points in time may run on the same thread from the thread pool.
* Two requests that runs in parallell gets one thread each (I think; not 100% sure on if there are some cor... | Maybe take a look at asynchronous ASP.NET?
<http://msdn.microsoft.com/en-us/magazine/cc163725.aspx>
Normally a new thread is assigned to a new request.
"A normal, or synchronous, page holds onto the thread for the duration of the request, preventing the thread from being used to process other requests." |
1,725,639 | Looking at a very simple web project, hosted in IIS, with one simple aspx page, executing some code (get some data from a db and populate some controls), which of the following is true:
each page request shares the same instance of the codebehind class.
or each page request runs in its own instance of the codebehin... | 2009/11/12 | [
"https://Stackoverflow.com/questions/1725639",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/209978/"
] | * Each request gets a new instance of the code-behind class.
* One instance of the code-behind class serves one request.
* Two requests at different points in time may run on the same thread from the thread pool.
* Two requests that runs in parallell gets one thread each (I think; not 100% sure on if there are some cor... | There is one instance of the code behind class for each request.
Well, actually it's an instance of the aspx page class, that inherits from the code behind class. (That's why you are using the `protected` keyword for event handlers in code behind, so that the inheriting class can access them.)
There is also the case ... |
1,725,639 | Looking at a very simple web project, hosted in IIS, with one simple aspx page, executing some code (get some data from a db and populate some controls), which of the following is true:
each page request shares the same instance of the codebehind class.
or each page request runs in its own instance of the codebehin... | 2009/11/12 | [
"https://Stackoverflow.com/questions/1725639",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/209978/"
] | There is one instance of the code behind class for each request.
Well, actually it's an instance of the aspx page class, that inherits from the code behind class. (That's why you are using the `protected` keyword for event handlers in code behind, so that the inheriting class can access them.)
There is also the case ... | Maybe take a look at asynchronous ASP.NET?
<http://msdn.microsoft.com/en-us/magazine/cc163725.aspx>
Normally a new thread is assigned to a new request.
"A normal, or synchronous, page holds onto the thread for the duration of the request, preventing the thread from being used to process other requests." |
2,923,450 | thanks for checking my work!
A deck of cards has 54 cards: 2,3, . . . ,10, Jacks, Queens, Kings, Aces of all four suits, plustwo Jokers. Jokers are assumed to have no suits. We’ll say that a combination of 5 cards is a **flush** if one ofthe following three conditions hold:
* All five cards are of the same suit, OR
*... | 2018/09/20 | [
"https://math.stackexchange.com/questions/2923450",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/198756/"
] | You have correctly counted combinations for the three favoured cases.
Since you are counting combinations in the numerator, you should do so in the denominator too.
$$\dfrac{\dbinom{4}{1}\left(\dbinom{13}5\dbinom{2}0+\dbinom{13}4\dbinom{2}1+\dbinom{13}3\dbinom{2}2\right)}{\dbinom{54}{5}}$$
---
Another way to count... | Your answer does make sense. But you should have ${54 \choose 5}$ possible combinations. |
45,413,712 | I am using `ImageDataGenerator().flow_from_directory(...)` to generate batches of data from directories.
After the model builds successfully I'd like to get a two column array of True and Predicted class labels. With `model.predict_generator(validation_generator, steps=NUM_STEPS)` I can get a numpy array of predicted ... | 2017/07/31 | [
"https://Stackoverflow.com/questions/45413712",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7175454/"
] | You can get the prediction labels by:
```
y_pred = numpy.rint(predictions)
```
and you can get the true labels by:
```
y_true = validation_generator.classes
```
You should set `shuffle=False` in the validation generator before this.
Finally, you can print confusion matrix by
`print confusion_matrix(y_true, y_... | There's another, slightly "hackier" way, of retrieving the true labels as well. **Note that this approach can handle when setting `shuffle=True` in your generator** (it's generally speaking a good idea to shuffle your data - either if you do this manually where you've stored the data, or through the generator, which is... |
45,413,712 | I am using `ImageDataGenerator().flow_from_directory(...)` to generate batches of data from directories.
After the model builds successfully I'd like to get a two column array of True and Predicted class labels. With `model.predict_generator(validation_generator, steps=NUM_STEPS)` I can get a numpy array of predicted ... | 2017/07/31 | [
"https://Stackoverflow.com/questions/45413712",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7175454/"
] | You can get the prediction labels by:
```
y_pred = numpy.rint(predictions)
```
and you can get the true labels by:
```
y_true = validation_generator.classes
```
You should set `shuffle=False` in the validation generator before this.
Finally, you can print confusion matrix by
`print confusion_matrix(y_true, y_... | Using `np.rint()` method will get one hot coding result like [1., 0., 0.] which once I've tried creating a confusion matrix with `confusion_matrix(y_true, y_pred)` it caused error. Because `validation_generator.classes` returns class labels as a single number.
In order to get a class number for example 0, 1, 2 as clas... |
45,413,712 | I am using `ImageDataGenerator().flow_from_directory(...)` to generate batches of data from directories.
After the model builds successfully I'd like to get a two column array of True and Predicted class labels. With `model.predict_generator(validation_generator, steps=NUM_STEPS)` I can get a numpy array of predicted ... | 2017/07/31 | [
"https://Stackoverflow.com/questions/45413712",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7175454/"
] | There's another, slightly "hackier" way, of retrieving the true labels as well. **Note that this approach can handle when setting `shuffle=True` in your generator** (it's generally speaking a good idea to shuffle your data - either if you do this manually where you've stored the data, or through the generator, which is... | Using `np.rint()` method will get one hot coding result like [1., 0., 0.] which once I've tried creating a confusion matrix with `confusion_matrix(y_true, y_pred)` it caused error. Because `validation_generator.classes` returns class labels as a single number.
In order to get a class number for example 0, 1, 2 as clas... |
172,261 | I'm a relative newcomer to D&D 5th Ed. and am playing a druid fond of Wild Shape. I'd like to know in what ways it can be detected by NPCs (or even fellow PCs). It appears that this is a sort of debated subject, as to how and whether Detect Magic works on it or not.
I read through the question, [Detecting Wild Shape w... | 2020/07/20 | [
"https://rpg.stackexchange.com/questions/172261",
"https://rpg.stackexchange.com",
"https://rpg.stackexchange.com/users/1546/"
] | Truesight
---------
>
> A monster with Truesight can, out to a specific range, [...] perceive the original form of a Shapechanger or a creature that is transformed by magic.
>
>
>
This is supported by [this answer](https://rpg.stackexchange.com/a/96248/56975).
Truesight can be obtained by casting the 6th level s... | It's a special case (it would only apply to some specific animal forms with an INT of 3 or lower), but casting *Detect Thoughts* could reveal that something is abnormal about the creature (though it wouldn't reveal a Druid in Wild Shape, specifically).
Since *Detect Thoughts* has no effect on creatures with INT 3 or l... |
28,259,498 | I need to write logic to break down a 4 digit number into individual digits.
On a reply here at SO to a question regarding 3 digits, someone gave the math below:
```
int first = 321/100;
int second = (321/10)-first*10;
int third = (321/1)-first*100-second*10;
```
Can someone help me?
Thank you in adva... | 2015/02/01 | [
"https://Stackoverflow.com/questions/28259498",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4505832/"
] | Well, using the sample you found, we can quite easily infer a code for you.
The first line says `int first = 321/100;`, which returns 3 (integer division is the euclidian one). 3 is indeed the first integer in 321 so that's a good thing. However, we have a 4 digit number, let's try replacing 100 with 1000:
```
int fi... | This snip of code counts the number of digits input from the user
then breaks down the digits one by one:
```
PRINT "Enter value";
INPUT V#
X# = V#
DO
IF V# < 1 THEN
EXIT DO
END IF
D = D + 1
V# = INT(V#) / 10
LOOP
PRINT "Digits:"; D
FOR L = D - 1 TO 0 STEP -1
M = INT(X# / 10 ^ L)
PRINT ... |
575,880 | In QED, when two photons collide, they can turn into an electron and positron pair. We know from $U(1)$ gauge symmetry that the total charge of the initial and final states must be conserved. On the other hand, I expect that the total spin must also be conserved. But I do not quite get the details of how this works.
I... | 2020/08/27 | [
"https://physics.stackexchange.com/questions/575880",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/105637/"
] | Spin angular momentum is not conserved; only the sum of spin and orbital angular momentum is conserved. As a trivial example of this, consider a hydrogen atom decaying from $2p$ to $1s$ by emitting a photon. The photon carries one unit of angular momentum, but the spin of the electron doesn't change; instead orbital an... | In the Feynman diagram below time runs from left to right. Indeed a 2-spin state for two photons can have eigenvalues 2, 0, and-2. That is three eigenstates at least. I'm sure you are right we have to consider the combined (2-photon) state. If that's the case then this state **got** to have a spin-0, precisely because ... |
41,778,074 | I want to save complete web page asp in local drive by `.htm` from [url](https://www.digikala.com/Search/Category-Motherboard/#!/Category-Electronic-Devices/Category-Computer-Parts/Category-Computer-Devices/Category-Motherboard/) or [url](https://www.digikala.com) but I did not success.
**Code**
```
public StreamRead... | 2017/01/21 | [
"https://Stackoverflow.com/questions/41778074",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7307673/"
] | here is the way
```
string url = "https://www.digikala.com/";
using (HttpClient client = new HttpClient())
{
using (HttpResponseMessage response = client.GetAsync(url).Result)
{
using (HttpContent content = response.Content)
{
string result = content.ReadAsStringAsync().Result;
}
}... | ```
using (WebClient client = new WebClient ())
{
string htmlCode = client.DownloadString("https://www.digikala.com");
}
``` |
41,778,074 | I want to save complete web page asp in local drive by `.htm` from [url](https://www.digikala.com/Search/Category-Motherboard/#!/Category-Electronic-Devices/Category-Computer-Parts/Category-Computer-Devices/Category-Motherboard/) or [url](https://www.digikala.com) but I did not success.
**Code**
```
public StreamRead... | 2017/01/21 | [
"https://Stackoverflow.com/questions/41778074",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7307673/"
] | here is the way
```
string url = "https://www.digikala.com/";
using (HttpClient client = new HttpClient())
{
using (HttpResponseMessage response = client.GetAsync(url).Result)
{
using (HttpContent content = response.Content)
{
string result = content.ReadAsStringAsync().Result;
}
}... | ```
using (WebClient client = new WebClient ())
{
client.DownloadFile("https://www.digikala.com", @"C:\localfile.html");
}
``` |
11,342,371 | I'm using a CDN (maxcdn.com) for js, css and images on a web site. I've noticed that from some ISP's, those resources either completely fail to load or load very slowly. However, local static serving from my server always works fine. Therefore, I want to be able to detect such resource loading failures and respond to t... | 2012/07/05 | [
"https://Stackoverflow.com/questions/11342371",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1491837/"
] | As noted here <https://stackoverflow.com/a/2021325/745190> there's no way to disable a script after starting to load it.
You could try loading a very small (.1kb) script initially from the cdn. Test that script after a very small space of time, if it downloads use javascript to append the other script tags to your pag... | I suspect that your issue will mostly occur with some ISPs.
If your main goal is to achieve performance while keeping the CDN as the main solution, I can see tow options. The first, you try to identify failing ISPs but it might be pretty long and expensive.
Another option is to "learn". Try to load a trivial JS settin... |
89,608 | Suppose I want a line legend for a list plot:
```
dat = RandomReal[{.8, 1.2}, 40]*Range@40;
ListPlot[Transpose@{Range@40, dat},
PlotLegends ->
Placed[LineLegend[{Style["I want a line legend!!!",
18]}], {.4, .8}]]
```
However, the output doesn't show a line legend but something that looks like a point legend:
... | 2015/07/31 | [
"https://mathematica.stackexchange.com/questions/89608",
"https://mathematica.stackexchange.com",
"https://mathematica.stackexchange.com/users/19991/"
] | ~~This is not a bug.~~ I *think* that this is not a bug, see addendum.
Based on my (limited!) experience, I believe that `LineLegend` and `PointLegend` are in fact the very same thing with differing default options. `LineLegend` has `Joined -> True` while `PointLegend` has `Joined -> False` by default, but otherwise t... | ```
$Version
```
>
> "10.2.0 for Mac OS X x86 (64-bit) (July 7, 2015)"
>
>
>
```
dat = Transpose@{Range@40, RandomReal[{.8, 1.2}, 40]*Range@40};
Legended[
ListPlot[dat],
Placed[
LineLegend[{Blue},
{Style["I want a line legend!!!", 14]}],
{.3, .8}]]
```
[ you can do this is iteratively; which means using an rCTE. **Assuming** that `Percentage` can't be a negative value:
```
CREATE TABLE dbo.Table1 (ID int,
[Percentage] int, --Ideally you should store percentages as a decimal, that is what that are after all. E.g. 10... | If the goal is to merely calculate a variable for a given Table2.ID ?
Then that method you used can work for it.
But tables contain unordered sets.
So you need to include an `ORDER BY` to respect the order that the percentages are subtracted.
**Sample data:**
>
>
> ```
> CREATE TABLE Table2 (
> ID INT IDEN... |
59,898,911 | I have installed net-snmp 5.8 on a Ubuntu 16.0.4 machine and then I have checked the correct installation:
snmpget --version
NET-SNMP version: 5.8
Next, I am trying to write and compile my first SNMP C program example.
I have copied the one that is included as example on the tutorial from Ben Rockwood ("The Net-SNM... | 2020/01/24 | [
"https://Stackoverflow.com/questions/59898911",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10528160/"
] | You're looking for the result of this expression since it doesn't matter the order of the multiplication.
```
100 * (0.95 * 0.9 * 0.96)
```
You can emulate chaining the products using `LOG`, `SUM`, and `EXP` to get the desired result
```sql
SELECT
val.ID, EXP(SUM(LOG(0.01*(100-Percentage)))) * MAX(Amount)
FROM
... | If the goal is to merely calculate a variable for a given Table2.ID ?
Then that method you used can work for it.
But tables contain unordered sets.
So you need to include an `ORDER BY` to respect the order that the percentages are subtracted.
**Sample data:**
>
>
> ```
> CREATE TABLE Table2 (
> ID INT IDEN... |
20,580,064 | please help me some error is display for this line:
```
mediaElement1.MediaOpened += new RoutedEventHandler(mediaElement1.MediaOpened);
```
Error:
>
> Error 1 The event ‘System.Windows.Controls.MediaElement.MediaOpened’ can only appear on the left hand side of += or -=
>
>
>
Please help me how to solve the pro... | 2013/12/14 | [
"https://Stackoverflow.com/questions/20580064",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3101564/"
] | As the message says, you're placing `mediaElement1.MediaOpened` on the right-hand side:
```
mediaElement1.MediaOpened += new RoutedEventHandler(mediaElement1.MediaOpened);
^
//Can't place it here
```
You'll need t... | With respect to events, such as MediaOpened, the += operator is used to add a delegate/method to take some action on said event.
In this case you're interested in the MediaOpened event so you'll want something like:
```
mediaElement1.MediaOpened += new RoutedEventHandler(this.OnMediaOpened);
private void OnMediaOpen... |
20,580,064 | please help me some error is display for this line:
```
mediaElement1.MediaOpened += new RoutedEventHandler(mediaElement1.MediaOpened);
```
Error:
>
> Error 1 The event ‘System.Windows.Controls.MediaElement.MediaOpened’ can only appear on the left hand side of += or -=
>
>
>
Please help me how to solve the pro... | 2013/12/14 | [
"https://Stackoverflow.com/questions/20580064",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3101564/"
] | As the message says, you're placing `mediaElement1.MediaOpened` on the right-hand side:
```
mediaElement1.MediaOpened += new RoutedEventHandler(mediaElement1.MediaOpened);
^
//Can't place it here
```
You'll need t... | I am not sure what you are actually trying to do. if you wanna do some logic when mediaElement1.MediaOpened event occur, then you need to create a method and put your code to do the logic in that method.
```
private void mediaElement1_MediaOpened(object sender, RoutedEventArgs e)
{
//Put your logic here
}
```
Th... |
45,336,249 | I have two very large tables (one with over 500 M records and the other with over 1B records)
I need to update status of the record in table one if one of the fields in table two contains more than 4 Char(10) characters in a row.
When I look for the records that meet that criteria it takes approximately 10 min -
``... | 2017/07/26 | [
"https://Stackoverflow.com/questions/45336249",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8372238/"
] | What you are doing wrong is that you are unnecessarily joining the first table twice: once in the subquery (which already does the work needed in `MERGE`) and again in the `ON` clause of `MERGE`.
The `MERGE` statement should be something like this:
```
merge into table_a a
using table_b b
on ( a.id = b.id )
when... | Hmm. Wouldn't it be faster to use `B.TEXT LIKE '%'||CHR(10)||CHR(10)||CHR(10)||CHR(10)||'%'` instead of `REGEXP_COUNT`?
Admittedly, I don't use MERGE very often, but if you're just doing updates, I would write the second statement like this:
```
UPDATE A
SET A.STATUS_CODE = 'FAILED'
WHERE A.CREATED_DATE > TRUNC(SYSDA... |
97,240 | I am trying to hide certain user names from the the lightdm login screen (Ubuntu 11.10) I have found a work round by messing with uid's. In getting this solution I have found in my /etc/passwd file a user name ending in $ sign,what does this mean? | 2012/01/21 | [
"https://askubuntu.com/questions/97240",
"https://askubuntu.com",
"https://askubuntu.com/users/42895/"
] | If you are running [Samba](http://www.samba.org/) in domain controller mode (NT4), usernames ending with a "$" usually mean a (Windows) machine account joined to the domain.
Samba uses this to distinguish machine accounts from user accounts.
<http://www.samba.org/samba/docs/using_samba/ch04.html#FNPTR-2> | Can you past an example ? My guess with your user name would be a typo.
At any rate, to hide users in lightdm, edit `/etc/lightdm/users.conf`
```
# Graphical
gksu gedit /etc/lightdm/users.conf
# command line
sudo -e /etc/lightdm/users.conf
```
To hide only some users add to the "hidden-users" line
```
hidden-use... |
54,812,273 | Using ionic 3 on a desktop. I have a list of items. Each item can be edited and then the changes saved or cancelled. If I hit edit and the input box opens, I want to be able to close the edit/input box by hitting escape. I also have an alert controller to add an item to the list. I would like the alert controller to go... | 2019/02/21 | [
"https://Stackoverflow.com/questions/54812273",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7446623/"
] | If it's viable, you can set `enableBackdropDismiss` to `true`, that would solve your issue. But I guess you have set it for a reason ;)
Otherwise, to make some changes to `JGFMK`'s answer, this is how you can do it,
assign your alert to a variable, so that you can reference it in the `@HostListener` and there dismiss ... | Let me know if this helps.
```
import { HostListener} from '@angular/core';
import { ViewController } from 'ionic-angular';
export class ModalPage {
private exitData = {proceed:false};
constructor(
private view:ViewController
)
...
@HostListener('document:keydown.escape', ['$event'])
onKeydownHandl... |
11,697,557 | I have a section of code in my `$(document).ready(function() {}` that reads:
`getInitial(len);`
Where len is an integer.
```
function getInitial(number){
number--;
if(number < 0) return
var $items = $(balls());
$items.imagesLoaded(function(){
$container
.masonry('reloadItems')
... | 2012/07/28 | [
"https://Stackoverflow.com/questions/11697557",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1452624/"
] | Yes, set it in the loop:
```
$array[ $row['cat_title'] ][ $row['sub_cat_id'] ] = $row['sub_cat_title'];
```
But, `$array[$row['cat_title']]` might not be set yet, so you should add this check beforehand:
```
if( !isset( $array[$row['cat_title']])) {
$array[$row['cat_title']] = array();
}
```
Your original cod... | You could do something like this:
```
foreach($array as $key=>$val){
unset($array[$key]);
$newKey = //New value
$array[$newKey] = $val];
}
``` |
63,927,009 | I am newbie to ruby. Below is my code where I am trying to find a value which has value true and put it into `values`. But getting error
```
possible_values =
[
'ABC',
'DEF',
'GHI',
'JKL',
'MNO',
'PQR'
]
options = {
"environment"=>"dev",
"status"=>"valid",
"ab... | 2020/09/16 | [
"https://Stackoverflow.com/questions/63927009",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2175642/"
] | Three bugs:
1. Your `puts` line is missing a `]`:
```rb
puts "values: #{options['values'}"
# ^ should be here
```
2. You want to remove the `options` key after processing it, but you're always removing `"val"` instead:
```rb
options.delete("val")
# ^ ^ extra quotes maki... | I see you wish to mutate (modify) `options`, as opposed to returning a separate hash, leaving `options` unchanged.
I would be inclined to write the code as follows, in part to facilitate the testing of `true_keys` and `options` (below), after `true_keys` has been computed.
```
true_keys = options.keys.each_with_objec... |
17,574,013 | I have define the following on my Model class:-
```
[DataType(DataType.MultilineText)]
public string Description { get; set; }
```
On the view I have the following:-
```
<span class="f"> Description :- </span>
@Html.EditorFor(model => model.Description)
@Html.ValidationMessageFor(model => model.Description... | 2013/07/10 | [
"https://Stackoverflow.com/questions/17574013",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1917176/"
] | This worked for me, with DataType set to MultilineText in the model:
```
[DataType(DataType.MultilineText)]
public string Description { get; set; }
```
And in the View specifying the HTML attribute "rows":
```
@Html.EditorFor(model => model.Description, new { htmlAttributes = new { rows = "4" } })
```
Generates H... | >
> so how I can control the size of the DataType.MultilineText ?
>
>
>
You could define a class to the textarea:
```
@Html.TextArea("Description", new { @class = "mytextarea" })
```
and then in your CSS file:
```
.mytextarea {
width: 850px;
height: 700px;
}
``` |
20,757,615 | I have a custom ValidationAttribute, it checks if another user exists already.
To so it needs access to my data access layer, an instance injected into my controller by Unity
How can I pass this (or anything for that matter) as a parameter into my custom validator?
Is this possible? i.e where I'm creating Dal, that s... | 2013/12/24 | [
"https://Stackoverflow.com/questions/20757615",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/314963/"
] | You are probably looking for Property Injection. Have a look at [this](https://stackoverflow.com/questions/6121050/mvc-3-unity-2-inject-dependencies-into-a-filter) post.
First solution is to create your custom filter provider that supports dependency injection.
Second solution is to use Service Locator pattern and ge... | yes.you can pass parameter which use in the Model class as below:
```
[EmailIsUnique()]
public string Email {get; set;}
```
so this will automatically pass Email as a parameter and check the value. |
20,757,615 | I have a custom ValidationAttribute, it checks if another user exists already.
To so it needs access to my data access layer, an instance injected into my controller by Unity
How can I pass this (or anything for that matter) as a parameter into my custom validator?
Is this possible? i.e where I'm creating Dal, that s... | 2013/12/24 | [
"https://Stackoverflow.com/questions/20757615",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/314963/"
] | I'm not too sure you'll be able to pass runtime parameters into your attribute.
You could use `DependencyResolver.Current.GetService<DataAccessHelper>()` to resolve your dal (given that you've registered DataAccessHelper)
You're probably more likely to have registered DataAccessHelper as IDataAccessHelper or somethin... | yes.you can pass parameter which use in the Model class as below:
```
[EmailIsUnique()]
public string Email {get; set;}
```
so this will automatically pass Email as a parameter and check the value. |
20,757,615 | I have a custom ValidationAttribute, it checks if another user exists already.
To so it needs access to my data access layer, an instance injected into my controller by Unity
How can I pass this (or anything for that matter) as a parameter into my custom validator?
Is this possible? i.e where I'm creating Dal, that s... | 2013/12/24 | [
"https://Stackoverflow.com/questions/20757615",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/314963/"
] | I'm not too sure you'll be able to pass runtime parameters into your attribute.
You could use `DependencyResolver.Current.GetService<DataAccessHelper>()` to resolve your dal (given that you've registered DataAccessHelper)
You're probably more likely to have registered DataAccessHelper as IDataAccessHelper or somethin... | You are probably looking for Property Injection. Have a look at [this](https://stackoverflow.com/questions/6121050/mvc-3-unity-2-inject-dependencies-into-a-filter) post.
First solution is to create your custom filter provider that supports dependency injection.
Second solution is to use Service Locator pattern and ge... |
55,120,635 | I have declared a static path to the static files such as CSS and javascript files. where there is a single URL path the static files are retrieved successfully but when I add a subpath they are not accessible.
Folders location
```
/static/css
/static/js
```
in HTML
```
<link rel="stylesheet/less" href="css/progr... | 2019/03/12 | [
"https://Stackoverflow.com/questions/55120635",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5199821/"
] | You can not have access to the auth user inside the boot method of AppServiceProvider this method is called before the authentication mechanism.
What you can do is you can create a ViewComposer and pass variables to any views you want.
First create a ServiceProvider lets say `ComposerServiceProvider` , you can use `p... | Based on the comments i guess that your problem can be solved simple by adding an authenticated new route in your `api.php` file.
Try this approach:
```
Route::middleware('auth:api')->get('/webiste/user', function (Request $request) {
return $request->user()->id;
});
``` |
594,931 | I'm maintaining a data-warehousing system that involves a lot of dependent jobs (data import, transform, etc). I've been using Linux's `crontab` to manage them until the dependency between jobs get complicated.
Basically I'm looking for some `cron` replacement that helps me with the following scenario:
* Run job A at... | 2013/05/13 | [
"https://superuser.com/questions/594931",
"https://superuser.com",
"https://superuser.com/users/38887/"
] | As Michael Kjörling suggested in the comments, you should be able to do this with a simple bash script. Something like this:
```
#!/usr/bin/env bash
## Log file to which the "echo" commands bellow will write
logfile="/tmp/$$.log"
## Change "ls /etc >/dev/null " to reflect the actual
## jobs you want to run but keep... | BMC Software makes a product called Control-M which would be a perfect fit for your description of the issue. However, it isn't free :(
We use it to administer around 500 jobs in production, and somewhere close to 400 in test environments. You install clients on whatever machines you need, then set up jobs on the Cont... |
594,931 | I'm maintaining a data-warehousing system that involves a lot of dependent jobs (data import, transform, etc). I've been using Linux's `crontab` to manage them until the dependency between jobs get complicated.
Basically I'm looking for some `cron` replacement that helps me with the following scenario:
* Run job A at... | 2013/05/13 | [
"https://superuser.com/questions/594931",
"https://superuser.com",
"https://superuser.com/users/38887/"
] | These look interesting:
* <https://airflow.incubator.apache.org/>
>
> not so simple but powerful and supported by apache, configured by code, widely used now
>
>
>
* <https://www.digdag.io/>
>
> java airflow like, simpler to configure
>
>
>
* <https://github.com/thieman/dagobah>
>
> Simple DAG-based job sche... | BMC Software makes a product called Control-M which would be a perfect fit for your description of the issue. However, it isn't free :(
We use it to administer around 500 jobs in production, and somewhere close to 400 in test environments. You install clients on whatever machines you need, then set up jobs on the Cont... |
27,992,304 | I'm new to Spring.
The goal is to learn Spring, to use Spring as a production application as it is industry standard.
The requirements of the app:
Hibernate, Security, MVC, RESTful, DI, etc.
The other Spring frameworks might be added in future.
I'm reading "Spring in Action. Third Edition." by Craig Walls.
He gave t... | 2015/01/16 | [
"https://Stackoverflow.com/questions/27992304",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3025055/"
] | >
> Is it possible to avoid using xml in Spring or better to mix xml files and annotations?
>
>
>
Yes, it is. Spring now promotes Java configuration, and it's perfectly doable (I'm doing it) and even easy to only use Java to configure your Spring app. Even without using Boot.
>
> Is it east for Spring developers... | I don't know much about Spring Boot but I know pretty much about spring.
First of all you can use both annotations and xml configuration file/s in the same project. That is the most common way as far as I know.
There is also JavaConfig configuration option in which you don't use any xml files instead you use ordinary... |
27,992,304 | I'm new to Spring.
The goal is to learn Spring, to use Spring as a production application as it is industry standard.
The requirements of the app:
Hibernate, Security, MVC, RESTful, DI, etc.
The other Spring frameworks might be added in future.
I'm reading "Spring in Action. Third Edition." by Craig Walls.
He gave t... | 2015/01/16 | [
"https://Stackoverflow.com/questions/27992304",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3025055/"
] | >
> Is it possible to avoid using xml in Spring or better to mix xml files and annotations?
>
>
>
Yes, it is. Spring now promotes Java configuration, and it's perfectly doable (I'm doing it) and even easy to only use Java to configure your Spring app. Even without using Boot.
>
> Is it east for Spring developers... | You can make a spring webapp without any xml, although spring security was ugly to configure last time I looked at that. For a webapp you need to implement WebApplicationInitializer, create an application context and register your @Configuration file(s) with the context. Then you register the dispatcher servlet and you... |
27,992,304 | I'm new to Spring.
The goal is to learn Spring, to use Spring as a production application as it is industry standard.
The requirements of the app:
Hibernate, Security, MVC, RESTful, DI, etc.
The other Spring frameworks might be added in future.
I'm reading "Spring in Action. Third Edition." by Craig Walls.
He gave t... | 2015/01/16 | [
"https://Stackoverflow.com/questions/27992304",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3025055/"
] | >
> Is it possible to avoid using xml in Spring or better to mix xml files and annotations?
>
>
>
Yes, it is. Spring now promotes Java configuration, and it's perfectly doable (I'm doing it) and even easy to only use Java to configure your Spring app. Even without using Boot.
>
> Is it east for Spring developers... | JB Nizet answered 3 answers very clearly. Just an addition about production readiness from my side. We are currently using Spring Boot for an application which we intend to move to production. There has not been any issue till now in prototyping and testing phase. It is very convenient and avoids boilerplate and gives ... |
27,992,304 | I'm new to Spring.
The goal is to learn Spring, to use Spring as a production application as it is industry standard.
The requirements of the app:
Hibernate, Security, MVC, RESTful, DI, etc.
The other Spring frameworks might be added in future.
I'm reading "Spring in Action. Third Edition." by Craig Walls.
He gave t... | 2015/01/16 | [
"https://Stackoverflow.com/questions/27992304",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3025055/"
] | >
> Is it possible to avoid using xml in Spring or better to mix xml files and annotations?
>
>
>
Yes, it is. Spring now promotes Java configuration, and it's perfectly doable (I'm doing it) and even easy to only use Java to configure your Spring app. Even without using Boot.
>
> Is it east for Spring developers... | I was nearly in the same boat four months ago when I started working on my web app & chose Spring as the platform after evaluating many choices. I also started with Spring in Action but got frustrated when the examples provided by the author didn't work ([Spring basic MVC app not working](https://stackoverflow.com/ques... |
27,992,304 | I'm new to Spring.
The goal is to learn Spring, to use Spring as a production application as it is industry standard.
The requirements of the app:
Hibernate, Security, MVC, RESTful, DI, etc.
The other Spring frameworks might be added in future.
I'm reading "Spring in Action. Third Edition." by Craig Walls.
He gave t... | 2015/01/16 | [
"https://Stackoverflow.com/questions/27992304",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3025055/"
] | JB Nizet answered 3 answers very clearly. Just an addition about production readiness from my side. We are currently using Spring Boot for an application which we intend to move to production. There has not been any issue till now in prototyping and testing phase. It is very convenient and avoids boilerplate and gives ... | I don't know much about Spring Boot but I know pretty much about spring.
First of all you can use both annotations and xml configuration file/s in the same project. That is the most common way as far as I know.
There is also JavaConfig configuration option in which you don't use any xml files instead you use ordinary... |
27,992,304 | I'm new to Spring.
The goal is to learn Spring, to use Spring as a production application as it is industry standard.
The requirements of the app:
Hibernate, Security, MVC, RESTful, DI, etc.
The other Spring frameworks might be added in future.
I'm reading "Spring in Action. Third Edition." by Craig Walls.
He gave t... | 2015/01/16 | [
"https://Stackoverflow.com/questions/27992304",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3025055/"
] | JB Nizet answered 3 answers very clearly. Just an addition about production readiness from my side. We are currently using Spring Boot for an application which we intend to move to production. There has not been any issue till now in prototyping and testing phase. It is very convenient and avoids boilerplate and gives ... | You can make a spring webapp without any xml, although spring security was ugly to configure last time I looked at that. For a webapp you need to implement WebApplicationInitializer, create an application context and register your @Configuration file(s) with the context. Then you register the dispatcher servlet and you... |
27,992,304 | I'm new to Spring.
The goal is to learn Spring, to use Spring as a production application as it is industry standard.
The requirements of the app:
Hibernate, Security, MVC, RESTful, DI, etc.
The other Spring frameworks might be added in future.
I'm reading "Spring in Action. Third Edition." by Craig Walls.
He gave t... | 2015/01/16 | [
"https://Stackoverflow.com/questions/27992304",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3025055/"
] | JB Nizet answered 3 answers very clearly. Just an addition about production readiness from my side. We are currently using Spring Boot for an application which we intend to move to production. There has not been any issue till now in prototyping and testing phase. It is very convenient and avoids boilerplate and gives ... | I was nearly in the same boat four months ago when I started working on my web app & chose Spring as the platform after evaluating many choices. I also started with Spring in Action but got frustrated when the examples provided by the author didn't work ([Spring basic MVC app not working](https://stackoverflow.com/ques... |
14,543,274 | I'm trying to select values from a database, but I need to check another value in another database .
I created this code, but only get 1 result and I don't know why:
```
SELECT `id` FROM `mc_region`
WHERE `is_subregion` = 'false'
AND lastseen < CURDATE() - INTERVAL 20 DAY
AND (SELECT id_region ... | 2013/01/27 | [
"https://Stackoverflow.com/questions/14543274",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1821304/"
] | If it's a globally defined function in some javascript that is loaded via an inline script tag (either locally defined or in an external JS file), you can just redefine it with your own version of that function. Whichever definition comes last will be the active one.
So, it sounds like what you want to do is to provid... | Create a closure that redefines the function, then call the old function whenever your new function is called:
```
hello13 = (function () {
// Keep a reference to the old function
var _hello13 = hello13;
// return a new function, which will be stored in hello13
return function (x, y, z) {
z = ... |
14,543,274 | I'm trying to select values from a database, but I need to check another value in another database .
I created this code, but only get 1 result and I don't know why:
```
SELECT `id` FROM `mc_region`
WHERE `is_subregion` = 'false'
AND lastseen < CURDATE() - INTERVAL 20 DAY
AND (SELECT id_region ... | 2013/01/27 | [
"https://Stackoverflow.com/questions/14543274",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1821304/"
] | If it's a globally defined function in some javascript that is loaded via an inline script tag (either locally defined or in an external JS file), you can just redefine it with your own version of that function. Whichever definition comes last will be the active one.
So, it sounds like what you want to do is to provid... | Redefine it. If you want to use the logic in the original function, store the reference to the original function and then redefine it and call the original from the new one:
```
var originalHello13 = hello13;
hello13 = function( x, y, z ){
z = MyValueOverride.
return originalHello13( x, y, z );
}
``` |
14,543,274 | I'm trying to select values from a database, but I need to check another value in another database .
I created this code, but only get 1 result and I don't know why:
```
SELECT `id` FROM `mc_region`
WHERE `is_subregion` = 'false'
AND lastseen < CURDATE() - INTERVAL 20 DAY
AND (SELECT id_region ... | 2013/01/27 | [
"https://Stackoverflow.com/questions/14543274",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1821304/"
] | Redefine it. If you want to use the logic in the original function, store the reference to the original function and then redefine it and call the original from the new one:
```
var originalHello13 = hello13;
hello13 = function( x, y, z ){
z = MyValueOverride.
return originalHello13( x, y, z );
}
``` | Create a closure that redefines the function, then call the old function whenever your new function is called:
```
hello13 = (function () {
// Keep a reference to the old function
var _hello13 = hello13;
// return a new function, which will be stored in hello13
return function (x, y, z) {
z = ... |
73,689 | I have a data set which looks something like this (not real data):
```
conc Resp
0 5
0.1 18
0.2 20
0.3 23
0.4 24
0.5 24.5
0 5
0.1 17
.. ..
```
which happens to fit perfectly to the Michaelis-Menten equation:
>
> Resp = max\_value \* conc / (conc\_value\_at\_half\_max + conc)
>
> ... | 2013/10/24 | [
"https://stats.stackexchange.com/questions/73689",
"https://stats.stackexchange.com",
"https://stats.stackexchange.com/users/31891/"
] | I think you should rethink the question.
Why would it possibly matter to find the highest concentration where the response is far enough below the maximum plateau to give a P value less than some arbitrary threshold?
If you added more concentrations, or collected replicate values, or obtained cleaner (smaller exper... | You could model it using nonlinear least squares regression, then use the modeled values and SE of the fit to determine the conc level that is "different" than the max. Once you fit the model, you could brute force search progressively lower thresholds until you reach a conc where Resp differs by a pre-specified alpha ... |
20,417,228 | I need to create a list of size N from already given list.
```
N = 3
a_list = [10,4,18,2,6,19,24,1,20]
```
The O/P should be:
```
[10,4,18] [4,18,2] [18,2,6] [2,6,19] [6,19,24] [19,24,1] [24,1,20]
```
It's like a window size of N=3 , which slides one step to its right.
How will I do it? | 2013/12/06 | [
"https://Stackoverflow.com/questions/20417228",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1162512/"
] | A faster way:
```
>>> zip(a_list,a_list[1:],a_list[2:])
[(10, 4, 18), (4, 18, 2), (18, 2, 6), (2, 6, 19), (6, 19, 24), (19, 24, 1), (24, 1, 20)]
```
Comparison:
```
In [6]: %timeit [a_list[i:i+n] for i in xrange(len(a_list)-n+1)]
100000 loops, best of 3: 9.61 us per loop
In [7]: %timeit zip(a_list,a_list[1:],a_lis... | Use list comprehension and slicing:
```
>>> lis = [10,4,18,2,6,19,24,1,20]
>>> n = 3
>>> [lis[i:i+n] for i in xrange(len(lis)-n+1)]
[[10, 4, 18], [4, 18, 2], [18, 2, 6], [2, 6, 19], [6, 19, 24], [19, 24, 1], [24, 1, 20]]
>>> n = 4
>>> [lis[i:i+n] for i in xrange(len(lis)-n+1)]
[[10, 4, 18, 2], [4, 18, 2, 6], [18, 2, 6... |
20,417,228 | I need to create a list of size N from already given list.
```
N = 3
a_list = [10,4,18,2,6,19,24,1,20]
```
The O/P should be:
```
[10,4,18] [4,18,2] [18,2,6] [2,6,19] [6,19,24] [19,24,1] [24,1,20]
```
It's like a window size of N=3 , which slides one step to its right.
How will I do it? | 2013/12/06 | [
"https://Stackoverflow.com/questions/20417228",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1162512/"
] | Use list comprehension and slicing:
```
>>> lis = [10,4,18,2,6,19,24,1,20]
>>> n = 3
>>> [lis[i:i+n] for i in xrange(len(lis)-n+1)]
[[10, 4, 18], [4, 18, 2], [18, 2, 6], [2, 6, 19], [6, 19, 24], [19, 24, 1], [24, 1, 20]]
>>> n = 4
>>> [lis[i:i+n] for i in xrange(len(lis)-n+1)]
[[10, 4, 18, 2], [4, 18, 2, 6], [18, 2, 6... | try this
```
>>> lis = [10,4,18,2,6,19,24,1,20]
>>> n=3
>>> [lis[i:i+n] for i in range(len(lis))][:-2]
```
the output is
```
[[10, 4, 18], [4, 18, 2], [18, 2, 6], [2, 6, 19], [6, 19, 24], [19, 24, 1], [24, 1, 20]]
``` |
20,417,228 | I need to create a list of size N from already given list.
```
N = 3
a_list = [10,4,18,2,6,19,24,1,20]
```
The O/P should be:
```
[10,4,18] [4,18,2] [18,2,6] [2,6,19] [6,19,24] [19,24,1] [24,1,20]
```
It's like a window size of N=3 , which slides one step to its right.
How will I do it? | 2013/12/06 | [
"https://Stackoverflow.com/questions/20417228",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1162512/"
] | A faster way:
```
>>> zip(a_list,a_list[1:],a_list[2:])
[(10, 4, 18), (4, 18, 2), (18, 2, 6), (2, 6, 19), (6, 19, 24), (19, 24, 1), (24, 1, 20)]
```
Comparison:
```
In [6]: %timeit [a_list[i:i+n] for i in xrange(len(a_list)-n+1)]
100000 loops, best of 3: 9.61 us per loop
In [7]: %timeit zip(a_list,a_list[1:],a_lis... | try this
```
>>> lis = [10,4,18,2,6,19,24,1,20]
>>> n=3
>>> [lis[i:i+n] for i in range(len(lis))][:-2]
```
the output is
```
[[10, 4, 18], [4, 18, 2], [18, 2, 6], [2, 6, 19], [6, 19, 24], [19, 24, 1], [24, 1, 20]]
``` |
20,835,808 | I am using 3DESC to decrypt data but i am getting following exception
```
java.security.InvalidKeyException: Invalid key length: 16 bytes
```
My Code:
```
public static byte[] decrypt3DESCBC(byte[] keyBytes, byte[] ivBytes,
byte[] dataBytes) {
try {
AlgorithmParameterSpec ivSpec = new IvParamete... | 2013/12/30 | [
"https://Stackoverflow.com/questions/20835808",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1169180/"
] | DES-EDE cipher can be used with 3 different subkeys therefore the key size should be 24 bytes (3 times 8 bytes). If you want to use only 2 keys (i.e. in this mode first key == last key) then you just have to duplicate the first 8 bytes of the key array.
```
byte[] key;
if (keyBytes.length == 16) {
key = new byte[2... | You are using an older Java version that does not handle 128 bit key lengths. In principle, 3DES always uses three keys - keys ABC - which are 64 bit each when we include the parity bits into the count (for a single DES encrypt with A, then decrypt with B, then encrypt again with C). 128 bit (dual) key however uses A =... |
44,706,737 | So I have a project I'm working on where I have a large excel spreadsheet and I want to search one of the columns/cells and if the cell contains a certain word then I want to add a tag in another column but the same row.
So the cell would have a long description in it and if the description contained a keyword I'm loo... | 2017/06/22 | [
"https://Stackoverflow.com/questions/44706737",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8201484/"
] | It's actually vertically centered, because the bottom offset for letters such as **"j,q,g,p .."** - with a bottom part/descender. Just try to paste any text with those letters in "span" tag, like so:
```
<div>
<span>
<span>Eqpjg combinedqjpg</span>
</span>
</div>
```
I created this example for you <https://j... | You have no letters with descenders in your example. Try it with a word like "Tagcloud" or "Taj Mahal" - (letters g, j) then you'll see that it fills the whole height... |
44,706,737 | So I have a project I'm working on where I have a large excel spreadsheet and I want to search one of the columns/cells and if the cell contains a certain word then I want to add a tag in another column but the same row.
So the cell would have a long description in it and if the description contained a keyword I'm loo... | 2017/06/22 | [
"https://Stackoverflow.com/questions/44706737",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8201484/"
] | It's actually vertically centered, because the bottom offset for letters such as **"j,q,g,p .."** - with a bottom part/descender. Just try to paste any text with those letters in "span" tag, like so:
```
<div>
<span>
<span>Eqpjg combinedqjpg</span>
</span>
</div>
```
I created this example for you <https://j... | Well it would appear that the font (Avenir Pro) just happens to be weirdly baselined. |
44,706,737 | So I have a project I'm working on where I have a large excel spreadsheet and I want to search one of the columns/cells and if the cell contains a certain word then I want to add a tag in another column but the same row.
So the cell would have a long description in it and if the description contained a keyword I'm loo... | 2017/06/22 | [
"https://Stackoverflow.com/questions/44706737",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8201484/"
] | You have no letters with descenders in your example. Try it with a word like "Tagcloud" or "Taj Mahal" - (letters g, j) then you'll see that it fills the whole height... | Well it would appear that the font (Avenir Pro) just happens to be weirdly baselined. |
25,074,075 | For some functions in OpenGL, one must specify a byte offset, such as in `glVertexAttribPointer()`, for stride. At first I would have guessed that it would be a normal number value like an integer. But upon inspection, I realized that it needs to be casted to `void*` (more specifically `GLvoid*`). My question is: what ... | 2014/08/01 | [
"https://Stackoverflow.com/questions/25074075",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1775989/"
] | glVertexAttribPointer() is an older function from before Vertex Buffer Objects.
Before VBO's your vertex data would be stored in client side arrays and you would need to pass a pointer to the data to OpenGL before you could draw.
When VBO's came along they repurposed this function by allowing the pointer to be used... | It's called void pointer and it can point at any type, like char\* does - but it's slightly different. Firstly you have to remember that the pointer is just a number, an address to right location, nothing more. To use data pointed by void pointer you have to explicitly cast it to correct type, they cannot be dereferenc... |
25,074,075 | For some functions in OpenGL, one must specify a byte offset, such as in `glVertexAttribPointer()`, for stride. At first I would have guessed that it would be a normal number value like an integer. But upon inspection, I realized that it needs to be casted to `void*` (more specifically `GLvoid*`). My question is: what ... | 2014/08/01 | [
"https://Stackoverflow.com/questions/25074075",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1775989/"
] | Some OpenGL functions, such as [`glDrawElements`](https://www.opengl.org/sdk/docs/man/html/glDrawElements.xhtml) take a `GLvoid *` parameter that is context dependant. On old GL, pre Vertex Buffers, the programmer would pass an array of integer indexes directly to `glDrawElements`, like this:
```
const GLuint indexes[... | It's called void pointer and it can point at any type, like char\* does - but it's slightly different. Firstly you have to remember that the pointer is just a number, an address to right location, nothing more. To use data pointed by void pointer you have to explicitly cast it to correct type, they cannot be dereferenc... |
25,074,075 | For some functions in OpenGL, one must specify a byte offset, such as in `glVertexAttribPointer()`, for stride. At first I would have guessed that it would be a normal number value like an integer. But upon inspection, I realized that it needs to be casted to `void*` (more specifically `GLvoid*`). My question is: what ... | 2014/08/01 | [
"https://Stackoverflow.com/questions/25074075",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1775989/"
] | glVertexAttribPointer() is an older function from before Vertex Buffer Objects.
Before VBO's your vertex data would be stored in client side arrays and you would need to pass a pointer to the data to OpenGL before you could draw.
When VBO's came along they repurposed this function by allowing the pointer to be used... | Some OpenGL functions, such as [`glDrawElements`](https://www.opengl.org/sdk/docs/man/html/glDrawElements.xhtml) take a `GLvoid *` parameter that is context dependant. On old GL, pre Vertex Buffers, the programmer would pass an array of integer indexes directly to `glDrawElements`, like this:
```
const GLuint indexes[... |
21,354,416 | I need to get rid of words that are duplicated within a column of spreadsheet cells.
I can use Excel or OpenOffice as I have both.
I want to get rid of the any duplicated words within a cell ... for instance ... happy, sad, fun, happy, silly, sad, jokey, - would become - happy, sad, fun, silly, jokey, (duplicate word... | 2014/01/25 | [
"https://Stackoverflow.com/questions/21354416",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3235839/"
] | You can have a RelativeLayout. Place the LinearLayout at the bottom. Place listview above LinearLayout.
```
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<LinearLayout // this can be vartical or horizonta... | I would recommend using a relative layout that holds both the list view and your buttons. Set their layout weight attributes so that they take up the screen. Layout weight of 1 on one object and 7 on the other, for example, makes one take 7/8 of the screen while the other takes 1/8. If you need to be able to see more l... |
152,196 | There seems to have been some interest over the past year around COP within the .NET community (ala [Qi4j](http://www.qi4j.org/)). A few folks have rolled there own COP frameworks (*see links below*) and it would appear .NET 4.0's Dynamic Dispatch and MEF might have a potential role in any .NET COP framework.
On one ... | 2008/09/30 | [
"https://Stackoverflow.com/questions/152196",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5946/"
] | Aku - There is considerable difference between the CAB / Composite WPF guidance and COP which is a fundamentally different approach to the expression of object behavior via the assembly of 'fragments' based on [Domain] context. The appearance of Mixins, Concerns, Constraints, and SideEffects in .NET 4.0 variously might... | >
> Can anyone comment on the whether
> Microsoft is doing any work on COP?
>
>
>
Microsoft released [Composite Application Block](http://msdn.microsoft.com/en-us/library/aa480450.aspx) and [Composite WPF](http://msdn.microsoft.com/en-us/library/cc707819.aspx), They have DI FW (Unity). Now they are working on MEF... |
152,196 | There seems to have been some interest over the past year around COP within the .NET community (ala [Qi4j](http://www.qi4j.org/)). A few folks have rolled there own COP frameworks (*see links below*) and it would appear .NET 4.0's Dynamic Dispatch and MEF might have a potential role in any .NET COP framework.
On one ... | 2008/09/30 | [
"https://Stackoverflow.com/questions/152196",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5946/"
] | >
> Can anyone comment on the whether
> Microsoft is doing any work on COP?
>
>
>
Microsoft released [Composite Application Block](http://msdn.microsoft.com/en-us/library/aa480450.aspx) and [Composite WPF](http://msdn.microsoft.com/en-us/library/cc707819.aspx), They have DI FW (Unity). Now they are working on MEF... | Check MEF <http://mef.codeplex.com>, currently shipped inside .NET 4, more in PDC session <http://microsoftpdc.com/Sessions/FT24> |
152,196 | There seems to have been some interest over the past year around COP within the .NET community (ala [Qi4j](http://www.qi4j.org/)). A few folks have rolled there own COP frameworks (*see links below*) and it would appear .NET 4.0's Dynamic Dispatch and MEF might have a potential role in any .NET COP framework.
On one ... | 2008/09/30 | [
"https://Stackoverflow.com/questions/152196",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5946/"
] | Aku - There is considerable difference between the CAB / Composite WPF guidance and COP which is a fundamentally different approach to the expression of object behavior via the assembly of 'fragments' based on [Domain] context. The appearance of Mixins, Concerns, Constraints, and SideEffects in .NET 4.0 variously might... | Check MEF <http://mef.codeplex.com>, currently shipped inside .NET 4, more in PDC session <http://microsoftpdc.com/Sessions/FT24> |
67,725,991 | I have a list of data frames, and I want to remove all the data frames that have no observations from the list.
```
df.list <- list(structure(list(Date = structure(c(1621814400, 1621900800), class = c("POSIXct", "POSIXt"), tzone = "UTC"), units = c(7,9), dollars = c(41.93, 53.91), margin = c(20.09, 25.83), margin_pct ... | 2021/05/27 | [
"https://Stackoverflow.com/questions/67725991",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6414727/"
] | Try this:
```
import collections
for k, freq in collections.Counter(L).items():
print(f"{k} occurred {freq} times")
``` | If you want to print these out as strings:
```
for i in set(L):
print(f"{i} occurred {L.count(i)} times"
```
If you want to store these counts to use later in the code, use a dictionary:
`d = {i: L.count(i) for i in set(L)` |
50,757,796 | I am reading Multiple JSON Files as such:
```
using (var fbd = new FolderBrowserDialog())
{
DialogResult result = fbd.ShowDialog();
if (result == System.Windows.Forms.DialogResult.OK && !string.IsNullOrWhiteSpace(fbd.SelectedPath))
{
IEnumerable<string> allJSONFiles = GetFileList("*.json", fbd.Sel... | 2018/06/08 | [
"https://Stackoverflow.com/questions/50757796",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1928597/"
] | We will need to have function which will clear brackets
```
private string RemoveBrackets(string content)
{
var openB = content.IndexOf("[");
content = content.Substring(openB + 1, content.Length - openB - 1);
var closeB = content.LastIndexOf("]");
content = content.Substring(0, closeB);
return c... | I'm not sure i understand what you mean, but seems that all the data you need is just into an "array-like" format, so using string manipulation you only need to do something like that:
Read First file (usa a for with a counter that let you know what is the first file), replace last charcater with "," and add the whole... |
52,510,830 | I need to use recursion but I can't seem to figure it out. I need to make a method to call that will convert a binary string into an int decimal form. I need to do this with recursion only. This means no global variables or loops.
Here is what I have:
```
public class Practice {
public static void main( String[] a... | 2018/09/26 | [
"https://Stackoverflow.com/questions/52510830",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10387200/"
] | If the binary string is just one digit long the task is trivial.
For strings of length `n > 1`, split into the first `n-1` digits and the last digit. Find the value of the first `n-1` digits via a recursive call and then multiply that result by two and add the last digit. | ```
public static int convert( String s )
{
int n = s.length();
if(n == 0)
return 0;
else
return Character.getNumericValue(s.charAt(n-1)) + 2*convert(s.substring(0, n-1));
}
```
By the way, `1010111` is 87, not 57. |
52,510,830 | I need to use recursion but I can't seem to figure it out. I need to make a method to call that will convert a binary string into an int decimal form. I need to do this with recursion only. This means no global variables or loops.
Here is what I have:
```
public class Practice {
public static void main( String[] a... | 2018/09/26 | [
"https://Stackoverflow.com/questions/52510830",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10387200/"
] | If you need to use recursion (as homework or exercise), here is the way you can consider:
Pseudo code:
```
int convert(String input) {
if input is empty {
return 0;
}
else {
int lastDigit = last digit of input
String prefix = input excluding last digit
int result = convert(prefix) * 2 + lastDig... | ```
public static int convert( String s )
{
int n = s.length();
if(n == 0)
return 0;
else
return Character.getNumericValue(s.charAt(n-1)) + 2*convert(s.substring(0, n-1));
}
```
By the way, `1010111` is 87, not 57. |
3,600,116 | Let $\Omega$ be an open subset of $\mathbb{R^2}$ and $f$ a continuos function in $\Omega$.
Is it true that, if $$\int\_{\Omega} f(x)g(x) dx = 0$$ $\forall g \in C\_c^{\infty}(\Omega) $ then $f=0$ in $\Omega$? | 2020/03/29 | [
"https://math.stackexchange.com/questions/3600116",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/749205/"
] | Suppose $f\neq 0$, i.e., there is $y\in \Omega $ s.t. $f(y)\neq 0$ (suppose WLOG that $f(y)>0$). By continuity, there is a ball $B(y,r)\subset \Omega $ s.t. $f(x)>0$ for all $x\in \overline{B(y,r)}$. Let $r'>r$ s.t. $B(y,r)\subset B(y,r')\subset \Omega $. Take $g\in \mathcal C^\infty $ s.t.
$$g(x)=\begin{cases}1&x\in... | Under all these assumptions I would say that the answer is yes.
Assume towards contradiction that $f(x)\not \equiv0$, then there exists $x\in \Omega $ such that $f(x\_0)\neq 0$, because $f$ is continuous. Assume without loss of generality that $f(x\_0)=\epsilon>0$. Then there exists $\delta>0$ such that $f(x)>\frac{\... |
61,918,207 | I got following migration in django:
```
# Generated by Django 2.2.12 on 2020-05-20 16:22
from django.db import migrations
import re
def numeric_version(version):
digits = 4
pattern = r"(\d+).(\d+).(\d+)"
major, minor, patch = tuple(map(int, re.findall(pattern, version)[0]))
return patch + pow(10, dig... | 2020/05/20 | [
"https://Stackoverflow.com/questions/61918207",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3608475/"
] | Looking at the [documentation](https://docs.djangoproject.com/en/3.0/ref/migration-operations/#runpython) i guess you should change:
```
operations = [insert_numeric_software_version]
```
to:
```
operations = [migrations.RunPython(insert_numeric_software_version)]
``` | This error also occurs when declaring a second operation in the list instead of the tuple.
eg mistakenly using this
```
class Migration(migrations.Migration):
dependencies = [('app', '0001_initial'),]
operations = [migrations.RunPython(load_fixture), clear_fixture_files]
```
Instead of
```
class... |
28,767,287 | I've tried generating multiple solutions with cplex using
```
option solver cplexamp;
option cplex_options 'poolstub=solfile populate=1 poolintensity=4';
...
for {k in K_mach_RESOURCES} {
solve SUB1[k];
for {l in 1..SUB1[k].npool}{
solution ("solfile" & l & ".sol");
display _varname, _var;
... | 2015/02/27 | [
"https://Stackoverflow.com/questions/28767287",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2391384/"
] | It seems as if the problem arose because the problem wasn't defined to be an INTEGER problem, but a LP-relaxation of an integer problem.
For some reason, CPLEX doesn't seem to support the populate method for linear programs. | I think you forgot the "solve" command
ampl: solve;
and then you can display the results. |
67,986,590 | I always get this error when I start node. please reply to me where I am going wrong.
**Error : creating application: failed to initialize ORM: initializeORM#NewORM: unable to init DB: unable to open ?application\_name=Chainlink+0.10.7+%7C+ORM+%7C+98d78e80-6fa0-4e2f-a9a4-c51199bf9d2a for gorm DB conn &{0 0xc0004a93e0 ... | 2021/06/15 | [
"https://Stackoverflow.com/questions/67986590",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14842966/"
] | The problem lies in the syntax of your configuration variable `DATABASE_URL`
To connect to the database you need a specially created `USER` with a `PASSWORD`, which then locks this database by starting the chainlink node. The default `postgres` user will not work because it is used for administrative purposes.
These c... | Make sure that these environment variables are also saved in your `.zprofile` or `.bash_profile` depending on what shell you are running.
You can check if these files are present with this command in your home directory:
`ls -al`
If the there is no such file you can create one:
`touch ~/.zprofile`
Then write all the... |
20,815,470 | I try to do a notepad in c#,
I have some problems at delete function,
I want to delete selected text...
```
private void deleteToolStripMenuItem_Click(object sender, EventArgs e)
{
int a;
a = textBox1.SelectionLength;
textBox1.Text.Remove(textBox1.SelectionStart,a);
}
```
what is wrong? | 2013/12/28 | [
"https://Stackoverflow.com/questions/20815470",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3142035/"
] | `Remove` will return the truncated string, so you just need to reassign to the `TextBox`:
```
private void deleteToolStripMenuItem_Click(object sender, EventArgs e)
{
int a = textBox1.SelectionLength;
textBox1.Text = textBox1.Text.Remove(textBox1.SelectionStart,a);
}
``` | Use SelectedText like this :
```
textbox1.SelectedText = "";
``` |
3,398,555 | I have a WCF webservice using the WebServiceHost class.
new WebServiceHost(typeof(MyServiceClass));
If I use a blocking call like Thread.Sleep (just an example) in one of my webservice methods and i call this method the whole service is not usable while the blocking call is active.
Is that normal behaviour or is the... | 2010/08/03 | [
"https://Stackoverflow.com/questions/3398555",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/409890/"
] | What's the [InstanceContextMode](http://msdn.microsoft.com/en-us/library/system.servicemodel.instancecontextmode.aspx) and [ConcurrencyMode](http://msdn.microsoft.com/en-us/library/system.servicemodel.concurrencymode.aspx) settings on your service? If it's set to Single then there's only one instance of your service an... | Ok, I got it. If you start the service in a windows forms GUI thread you can add
```
UseSynchronizationContext = false
```
to the ServiceBehavior and the requests get handled in parallel. :) |
9,035,548 | I'm currently writing a REST service within a Symfony2 application. This is (roughly) how one of my controllers look like:
```
/**
* @Route("/account", defaults={"_format" = "json"})
*/
class AccountController extends APIController
{
/**
* @Route("/")
* @Method("get")
*/
public function listAc... | 2012/01/27 | [
"https://Stackoverflow.com/questions/9035548",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/305532/"
] | A **Function declaration** *may/may* not not include the function arguments.
While a **Function Prototype** *must* include the function arguments.
From **[Wikipedia](http://en.wikipedia.org/wiki/Function_prototype)**:
Consider the following function prototype:
```
int fac(int n);
```
This prototype specifies ... | A prototype is a declaration, but a declaration not always is a prototype. If you don't specify the parameters, then that's only a declaration and not a prototype. That means the compiler won't reject a call to that function complaining it wasn't declared, but won't be able to check if the parameters passed are correct... |
9,035,548 | I'm currently writing a REST service within a Symfony2 application. This is (roughly) how one of my controllers look like:
```
/**
* @Route("/account", defaults={"_format" = "json"})
*/
class AccountController extends APIController
{
/**
* @Route("/")
* @Method("get")
*/
public function listAc... | 2012/01/27 | [
"https://Stackoverflow.com/questions/9035548",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/305532/"
] | A **Function declaration** *may/may* not not include the function arguments.
While a **Function Prototype** *must* include the function arguments.
From **[Wikipedia](http://en.wikipedia.org/wiki/Function_prototype)**:
Consider the following function prototype:
```
int fac(int n);
```
This prototype specifies ... | A function prototype is a function declaration that specifies the number and types of parameters.
```
T foo(); // non-prototype declaration
T foo(int, char *); // prototype declaration
T foo(int a, char *b); // prototype declaration
``` |
9,035,548 | I'm currently writing a REST service within a Symfony2 application. This is (roughly) how one of my controllers look like:
```
/**
* @Route("/account", defaults={"_format" = "json"})
*/
class AccountController extends APIController
{
/**
* @Route("/")
* @Method("get")
*/
public function listAc... | 2012/01/27 | [
"https://Stackoverflow.com/questions/9035548",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/305532/"
] | A **Function declaration** *may/may* not not include the function arguments.
While a **Function Prototype** *must* include the function arguments.
From **[Wikipedia](http://en.wikipedia.org/wiki/Function_prototype)**:
Consider the following function prototype:
```
int fac(int n);
```
This prototype specifies ... | The prototype tells the compiler hey there is a function that looks like this and this is its name `int getanint()`. When you use that function the compiler puts the code calls that function and leaves a place to insert the address to the code that defines what that function does.
So in File Header A;
```
int getani... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.