qid int64 1 74.7M | question stringlengths 15 58.3k | date stringlengths 10 10 | metadata list | response_j stringlengths 4 30.2k | response_k stringlengths 11 36.5k |
|---|---|---|---|---|---|
364,304 | I am interested in Fourier Analysis. But I don't get why the coefficients are choosen that way and why the Fourier series will converge to a given function?
Can someone provide me simple information or do you know an easy source for a beginner?
Regards,
Kevin | 2013/04/17 | [
"https://math.stackexchange.com/questions/364304",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/73030/"
] | You can try to read something in Rudin's book (pg 185).
<http://www.scribd.com/doc/9654478/Principles-of-Mathematical-Analysis-Third-Edition-Walter-Rudin>
In my opinion Stein and Shakarchi Fourier Analysis is a clear and perfectly written textbook.
<http://press.princeton.edu/titles/7562.html> | The Fourier series converges given that the $f\in L^2(-l,l)$ for the given interval. That is $f$ is a function that satisfies $\int\_{-l}^{l}f^2 \, dx<+\infty$.
There is a proof that shows that the series converges with this condition.
The way to understant why coefficients are calculated as they are is to think that... |
364,304 | I am interested in Fourier Analysis. But I don't get why the coefficients are choosen that way and why the Fourier series will converge to a given function?
Can someone provide me simple information or do you know an easy source for a beginner?
Regards,
Kevin | 2013/04/17 | [
"https://math.stackexchange.com/questions/364304",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/73030/"
] | You ask some pretty profound questions. I will answer them as simply as I can. Before I do that, (and by now I seem like a shill for my old professor), I recommend the book from which I learned all of this, [Applied Analysis by the Hilbert Space Method](http://rads.stackoverflow.com/amzn/click/0486458016) by Samuel S. ... | The Fourier series converges given that the $f\in L^2(-l,l)$ for the given interval. That is $f$ is a function that satisfies $\int\_{-l}^{l}f^2 \, dx<+\infty$.
There is a proof that shows that the series converges with this condition.
The way to understant why coefficients are calculated as they are is to think that... |
364,304 | I am interested in Fourier Analysis. But I don't get why the coefficients are choosen that way and why the Fourier series will converge to a given function?
Can someone provide me simple information or do you know an easy source for a beginner?
Regards,
Kevin | 2013/04/17 | [
"https://math.stackexchange.com/questions/364304",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/73030/"
] | The best way I've found to think about Fourier analysis is: as the linear algebra of the vector space $L^2(S^1)$ in the basis $e\_k(x) = e^{2\pi ikx}$. In this perspective, as Myke Arya points out, you have an inner product
$$\langle f,g\rangle = \int\_{S^1} f(x)g(x)dx$$
and Fourier series are just an orthonormal basis... | The Fourier series converges given that the $f\in L^2(-l,l)$ for the given interval. That is $f$ is a function that satisfies $\int\_{-l}^{l}f^2 \, dx<+\infty$.
There is a proof that shows that the series converges with this condition.
The way to understant why coefficients are calculated as they are is to think that... |
364,304 | I am interested in Fourier Analysis. But I don't get why the coefficients are choosen that way and why the Fourier series will converge to a given function?
Can someone provide me simple information or do you know an easy source for a beginner?
Regards,
Kevin | 2013/04/17 | [
"https://math.stackexchange.com/questions/364304",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/73030/"
] | It seems to me, that you are interested in the identity
\begin{equation}
f(x) = \sum\_{k=-\infty}^\infty \frac{1}{2\pi} \int\_{-\pi}^\pi f(t) e^{-ikt} dt e^{ikx} \ ,
\end{equation}
that is true for example if $f$ is $2\pi$-periodic and piecewise differentiable with finite number of pieces on the interval $[-\pi,\pi]$ a... | The Fourier series converges given that the $f\in L^2(-l,l)$ for the given interval. That is $f$ is a function that satisfies $\int\_{-l}^{l}f^2 \, dx<+\infty$.
There is a proof that shows that the series converges with this condition.
The way to understant why coefficients are calculated as they are is to think that... |
364,304 | I am interested in Fourier Analysis. But I don't get why the coefficients are choosen that way and why the Fourier series will converge to a given function?
Can someone provide me simple information or do you know an easy source for a beginner?
Regards,
Kevin | 2013/04/17 | [
"https://math.stackexchange.com/questions/364304",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/73030/"
] | You ask some pretty profound questions. I will answer them as simply as I can. Before I do that, (and by now I seem like a shill for my old professor), I recommend the book from which I learned all of this, [Applied Analysis by the Hilbert Space Method](http://rads.stackoverflow.com/amzn/click/0486458016) by Samuel S. ... | You can try to read something in Rudin's book (pg 185).
<http://www.scribd.com/doc/9654478/Principles-of-Mathematical-Analysis-Third-Edition-Walter-Rudin>
In my opinion Stein and Shakarchi Fourier Analysis is a clear and perfectly written textbook.
<http://press.princeton.edu/titles/7562.html> |
364,304 | I am interested in Fourier Analysis. But I don't get why the coefficients are choosen that way and why the Fourier series will converge to a given function?
Can someone provide me simple information or do you know an easy source for a beginner?
Regards,
Kevin | 2013/04/17 | [
"https://math.stackexchange.com/questions/364304",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/73030/"
] | You ask some pretty profound questions. I will answer them as simply as I can. Before I do that, (and by now I seem like a shill for my old professor), I recommend the book from which I learned all of this, [Applied Analysis by the Hilbert Space Method](http://rads.stackoverflow.com/amzn/click/0486458016) by Samuel S. ... | The best way I've found to think about Fourier analysis is: as the linear algebra of the vector space $L^2(S^1)$ in the basis $e\_k(x) = e^{2\pi ikx}$. In this perspective, as Myke Arya points out, you have an inner product
$$\langle f,g\rangle = \int\_{S^1} f(x)g(x)dx$$
and Fourier series are just an orthonormal basis... |
364,304 | I am interested in Fourier Analysis. But I don't get why the coefficients are choosen that way and why the Fourier series will converge to a given function?
Can someone provide me simple information or do you know an easy source for a beginner?
Regards,
Kevin | 2013/04/17 | [
"https://math.stackexchange.com/questions/364304",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/73030/"
] | You ask some pretty profound questions. I will answer them as simply as I can. Before I do that, (and by now I seem like a shill for my old professor), I recommend the book from which I learned all of this, [Applied Analysis by the Hilbert Space Method](http://rads.stackoverflow.com/amzn/click/0486458016) by Samuel S. ... | It seems to me, that you are interested in the identity
\begin{equation}
f(x) = \sum\_{k=-\infty}^\infty \frac{1}{2\pi} \int\_{-\pi}^\pi f(t) e^{-ikt} dt e^{ikx} \ ,
\end{equation}
that is true for example if $f$ is $2\pi$-periodic and piecewise differentiable with finite number of pieces on the interval $[-\pi,\pi]$ a... |
61,997,720 | I know the recomended way to know in Android if a location is a fake point is something like this:
```
boolean isMock = false;
if (android.os.Build.VERSION.SDK_INT >= 18) {
isMock = location.isFromMockProvider();
} else { // Old Android versions (<6)
isMock = !Settings.Secure.getString(context.getContentResolv... | 2020/05/25 | [
"https://Stackoverflow.com/questions/61997720",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1073310/"
] | I haven't tested this but this looks legit. I spent an hour or so trying to come up with my own solution and it was right there on GitHub.
<https://github.com/GantMan/jail-monkey/blob/master/android/src/main/java/com/gantix/JailMonkey/MockLocation/MockLocationCheck.java> | So first of all... by using the following code
```
boolean isMock = false;
if (android.os.Build.VERSION.SDK_INT >= 18) {
isMock = location.isFromMockProvider();
} else { // Old Android versions (<6)
isMock = !Settings.Secure.getString(context.getContentResolver(), Settings.Secure.ALLOW_MOCK_LOCATION).equals("... |
5,817,080 | what's wrong with this code?
```
module Main where
import System.Environment
main :: IO ()
main = do
args <- getArgs
putStrLn ("Hello, " ++ args !! 0 ++ ", " ++ args !! 1)
putStrLn(add (read args !! 0) (read args !! 1))
add x y = x + y
```
Here are the error messages:
```
main.hs:8:15:
No instance f... | 2011/04/28 | [
"https://Stackoverflow.com/questions/5817080",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/457261/"
] | `read args !! 0` should be `read (args !! 0)` and `add x y = x +` should be `add x y = x + y`. Also `putStrLn` takes a string only, so use `print` instead which also prints numbers.
---
However, seeing you are new to haskell. I rewrote part of your program to demonstrate a more haskellish way.
```
main = do
(arg... | Just to add a little elaboration on the error messages and the solution given. Looking at the first error:
```
No instance for (Num String)
...
In the first argument of `putStrLn'
```
This might be a bit unclear. Have a look at the type signature for putStrLn:
```
putStrLn :: String -> IO ()
```
So,... |
61,800,783 | I am having a CSV file like this:
```
Adult literacy rate, population 15+ years, female (%),United Republic of Tanzania,2015,76.08978
Adult literacy rate, population 15+ years, female (%),Zimbabwe,2015,85.28513
Adult literacy rate, population 15+ years, male (%),Honduras,2014,87.39595
Adult literacy rate, population 1... | 2020/05/14 | [
"https://Stackoverflow.com/questions/61800783",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5639775/"
] | You can double-check like this :
```
if (props.data && props.data.length)
``` | Check to see if the data exists
```
if (props?.data)
``` |
29,898,105 | So I've tried to custom make a navbar that is set right below a border around a page. I've made an illustration to help explain:

On the page, I have a border (blue) around the whole page, then the navbar (red) which scrolls with the page until it hit... | 2015/04/27 | [
"https://Stackoverflow.com/questions/29898105",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4795788/"
] | Your code is very close to what you need.
The glitch is due to changing from `position: relative` to `position: fixed` in `.main-nav`.
Fixed elements widths are computed with respect to the viewport, not the parent container.
First, zero-out the margin on `body` (if needed, depends on your design).
For illustratio... | define a `max-width:` to your nav element itself or parent wrapper.
You should have a div wrapper around the middle of the page outside of the full width wrapper - that I am seeing. *Eg something like below.*
```
#middle_page_wrap {
width: 960px;
max-width: 960px;
margin: 0 auto;
position: relative;
... |
396,044 | Need move files with multiple, defined patterns, like:
```
Z_*ana_bwk_na_N*.png
Z_*ana_bwk_dwda*.png
Z_*ana_bwkman_dwdna*
Z_*ana_bwkman_dwdc*
Z_*EDZW*_nwv01*_p00_na_N*WV11.png
Z_*EDZW*_nwv01*_p00_nh_N*WV11.png
Z_*nwv01*_hsy_NA*.png
Z_*EDZW_*_htp_na_N_*_WV11SW.png
Z_*_rft_na_*.png
Z_*_r12*
```
from one defined folder... | 2017/10/04 | [
"https://unix.stackexchange.com/questions/396044",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/254067/"
] | It's simple:
```
mv Z_*ana_bwk_na_N*.png Z_*ana_bwk_dwda*.png Z_*ana_bwkman_dwdna* -t /your/directory/
```
If you want it more elegant with input from file:
```
PATTERNS=`cat input.txt | paste -sd " " - ` && mv $PATTERNS -t /your/directory/
``` | The most efficient, but possibly the least legible, approach is to just enumerate everything in one big happy `mv` command.
```
mv Z_*ana_bwk_na_N*.png \
Z_*ana_bwk_dwda*.png \
Z_*ana_bwkman_dwdna* \
Z_*ana_bwkman_dwdc* \
Z_*EDZW*_nwv01*_p00_na_N*WV11.png \
Z_*EDZW*_nwv01*_p00_nh_N*WV11.png \
Z... |
396,044 | Need move files with multiple, defined patterns, like:
```
Z_*ana_bwk_na_N*.png
Z_*ana_bwk_dwda*.png
Z_*ana_bwkman_dwdna*
Z_*ana_bwkman_dwdc*
Z_*EDZW*_nwv01*_p00_na_N*WV11.png
Z_*EDZW*_nwv01*_p00_nh_N*WV11.png
Z_*nwv01*_hsy_NA*.png
Z_*EDZW_*_htp_na_N_*_WV11SW.png
Z_*_rft_na_*.png
Z_*_r12*
```
from one defined folder... | 2017/10/04 | [
"https://unix.stackexchange.com/questions/396044",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/254067/"
] | It's simple:
```
mv Z_*ana_bwk_na_N*.png Z_*ana_bwk_dwda*.png Z_*ana_bwkman_dwdna* -t /your/directory/
```
If you want it more elegant with input from file:
```
PATTERNS=`cat input.txt | paste -sd " " - ` && mv $PATTERNS -t /your/directory/
``` | assume your patterns in a file called patterns
```
mapfile -t arr < patterns && mv -t destination "${arr[@]}"
``` |
396,044 | Need move files with multiple, defined patterns, like:
```
Z_*ana_bwk_na_N*.png
Z_*ana_bwk_dwda*.png
Z_*ana_bwkman_dwdna*
Z_*ana_bwkman_dwdc*
Z_*EDZW*_nwv01*_p00_na_N*WV11.png
Z_*EDZW*_nwv01*_p00_nh_N*WV11.png
Z_*nwv01*_hsy_NA*.png
Z_*EDZW_*_htp_na_N_*_WV11SW.png
Z_*_rft_na_*.png
Z_*_r12*
```
from one defined folder... | 2017/10/04 | [
"https://unix.stackexchange.com/questions/396044",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/254067/"
] | assume your patterns in a file called patterns
```
mapfile -t arr < patterns && mv -t destination "${arr[@]}"
``` | The most efficient, but possibly the least legible, approach is to just enumerate everything in one big happy `mv` command.
```
mv Z_*ana_bwk_na_N*.png \
Z_*ana_bwk_dwda*.png \
Z_*ana_bwkman_dwdna* \
Z_*ana_bwkman_dwdc* \
Z_*EDZW*_nwv01*_p00_na_N*WV11.png \
Z_*EDZW*_nwv01*_p00_nh_N*WV11.png \
Z... |
39,748,327 | I wrote a batch file which should find and copy the latest build file bigger than a 3.5 GB.
```
set source=D:\src
set tmp_dir="D:\tmp"
set "file="
for /f "delims=|" %%a in ('
dir /b /o-d "%source%\*.zip" 2^>nul
^| cmd /q /v /c"set /p .=&if defined . (echo(!.!)"
') do set "file=%%a"
echo %file%
robocopy %sou... | 2016/09/28 | [
"https://Stackoverflow.com/questions/39748327",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6649535/"
] | You almost have it. Instead of using the `dir` command to retrieve the initial list of files, we can use `robocopy` to get a list (`/l`) of files in the source folder with the required minimum size (`/min`). This list should not include job header, job footer, nor directory list (`/njh`, `/njf`, `/ndl`). For each file ... | You can get the size of a file in bit using the following line
```
for /f "usebackq" %%a in ('%file%') d set filesize=%%~za
```
Add
```
set /a filesize+=0
```
to make sure it is treated like a numeric variable.
Then use an `if`-statement to check if filesize exceeds 3500000000 byte -> 3.5 GB.
```
if filesize L... |
18,659,279 | I am trying to remove certain functionality when the screen is at certain widths. I was wondering if you could tell me why this doesn't work?
<http://jsbin.com/ALAYOru/1/edit>
I remove the 'has-sub-menu' class when the screen goes below 700px but it still executes the mouseover event.
Thanks! | 2013/09/06 | [
"https://Stackoverflow.com/questions/18659279",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1160811/"
] | Or this.
```
function isWindowSmall()
{
if(window.innerWidth < 700px) return true;
else return false;
}
$(".some-btn").on('click',function()
{
if(isWindowSmall()){
//do something for small windows
}
else{
//do something else for big windows
}
});
``` | try this.
```
window.onresize = function () {
if(window.innerWidth < 700) {
// your code here
}
}
``` |
18,659,279 | I am trying to remove certain functionality when the screen is at certain widths. I was wondering if you could tell me why this doesn't work?
<http://jsbin.com/ALAYOru/1/edit>
I remove the 'has-sub-menu' class when the screen goes below 700px but it still executes the mouseover event.
Thanks! | 2013/09/06 | [
"https://Stackoverflow.com/questions/18659279",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1160811/"
] | That is becauase what this is doing is.
```
$(".has-sub-menu").mouseenter(function(){
$(this).css('background-color','red');
}).mouseleave(function(){
$(this).css('background-color','transparent');
});
```
This goes and finds all of the elements with the class of `.has-sub-menu` and then it attaches the event ... | try this.
```
window.onresize = function () {
if(window.innerWidth < 700) {
// your code here
}
}
``` |
18,659,279 | I am trying to remove certain functionality when the screen is at certain widths. I was wondering if you could tell me why this doesn't work?
<http://jsbin.com/ALAYOru/1/edit>
I remove the 'has-sub-menu' class when the screen goes below 700px but it still executes the mouseover event.
Thanks! | 2013/09/06 | [
"https://Stackoverflow.com/questions/18659279",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1160811/"
] | Or this.
```
function isWindowSmall()
{
if(window.innerWidth < 700px) return true;
else return false;
}
$(".some-btn").on('click',function()
{
if(isWindowSmall()){
//do something for small windows
}
else{
//do something else for big windows
}
});
``` | You can add a function to check the screen size and remove the onmouseover event listener.
```
function check_screen() {
if(window.innerWidth < 700px)
{
whateveryourelementiscalled.removeEventListner('onmouseover', //whatever your mouseover function was);
}
}
``` |
18,659,279 | I am trying to remove certain functionality when the screen is at certain widths. I was wondering if you could tell me why this doesn't work?
<http://jsbin.com/ALAYOru/1/edit>
I remove the 'has-sub-menu' class when the screen goes below 700px but it still executes the mouseover event.
Thanks! | 2013/09/06 | [
"https://Stackoverflow.com/questions/18659279",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1160811/"
] | That is becauase what this is doing is.
```
$(".has-sub-menu").mouseenter(function(){
$(this).css('background-color','red');
}).mouseleave(function(){
$(this).css('background-color','transparent');
});
```
This goes and finds all of the elements with the class of `.has-sub-menu` and then it attaches the event ... | You can add a function to check the screen size and remove the onmouseover event listener.
```
function check_screen() {
if(window.innerWidth < 700px)
{
whateveryourelementiscalled.removeEventListner('onmouseover', //whatever your mouseover function was);
}
}
``` |
39,561,806 | I have a list of lists and I want to merge them to sum the inner `index[1]` values where the `index[0]` values match. My list looks like this:
```
lists = [
['Gifts', [4]],
['Gifts', [4]],
['Politics', [3]],
['Supply', [4]],
['Supply', [4]],
['Prints', [1]],
['Prints', [1]],
['Prints', [1]],
['Politics', [3]],
['Polit... | 2016/09/18 | [
"https://Stackoverflow.com/questions/39561806",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5652029/"
] | You can use [`defaultdict(int)`](https://docs.python.org/3/library/collections.html#collections.defaultdict) from `collections` module:
```
>>> from collections import defaultdict
>>> d = defaultdict(int)
>>> for key, value in lists:
... d[key] += value[0]
...
>>> dict(d)
{'Gifts': 8, 'Prints': 3, 'Accounts': 6, ... | Use a `defaultdict`:
```
In [52]: from collections import defaultdict
In [53]: d = defaultdict(int)
In [54]: for name, (val,) in lists:
....: d[name] += val
....:
In [55]: d.items()
Out[55]: dict_items([('Politics', 9), ('Supply', 8), ('Prints', 3), ('Features', 5), ('Gifts', 8), ('Accounts', 6)])
`... |
39,561,806 | I have a list of lists and I want to merge them to sum the inner `index[1]` values where the `index[0]` values match. My list looks like this:
```
lists = [
['Gifts', [4]],
['Gifts', [4]],
['Politics', [3]],
['Supply', [4]],
['Supply', [4]],
['Prints', [1]],
['Prints', [1]],
['Prints', [1]],
['Politics', [3]],
['Polit... | 2016/09/18 | [
"https://Stackoverflow.com/questions/39561806",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5652029/"
] | Or, use a [`Counter`](https://docs.python.org/3/library/collections.html#collections.Counter) from [`collections`](https://docs.python.org/3/library/collections.html). You can initialize it either manually by incrementing the values for every key:
```
from collections import Counter
c = Counter()
for i, j in lists:
... | Use a `defaultdict`:
```
In [52]: from collections import defaultdict
In [53]: d = defaultdict(int)
In [54]: for name, (val,) in lists:
....: d[name] += val
....:
In [55]: d.items()
Out[55]: dict_items([('Politics', 9), ('Supply', 8), ('Prints', 3), ('Features', 5), ('Gifts', 8), ('Accounts', 6)])
`... |
39,561,806 | I have a list of lists and I want to merge them to sum the inner `index[1]` values where the `index[0]` values match. My list looks like this:
```
lists = [
['Gifts', [4]],
['Gifts', [4]],
['Politics', [3]],
['Supply', [4]],
['Supply', [4]],
['Prints', [1]],
['Prints', [1]],
['Prints', [1]],
['Politics', [3]],
['Polit... | 2016/09/18 | [
"https://Stackoverflow.com/questions/39561806",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5652029/"
] | You can use [`defaultdict(int)`](https://docs.python.org/3/library/collections.html#collections.defaultdict) from `collections` module:
```
>>> from collections import defaultdict
>>> d = defaultdict(int)
>>> for key, value in lists:
... d[key] += value[0]
...
>>> dict(d)
{'Gifts': 8, 'Prints': 3, 'Accounts': 6, ... | Or, use a [`Counter`](https://docs.python.org/3/library/collections.html#collections.Counter) from [`collections`](https://docs.python.org/3/library/collections.html). You can initialize it either manually by incrementing the values for every key:
```
from collections import Counter
c = Counter()
for i, j in lists:
... |
11,244,235 | I am building this C# windows application. On a certain Form, I am using maskedtextbox to enter upto 3 numerical digits, then I convert it into int as I have to send all these data to database with an insert query, but the problem is that these maskedtextboxes give error when left empty:
```
int scd_user_comm = Conver... | 2012/06/28 | [
"https://Stackoverflow.com/questions/11244235",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1479153/"
] | You could try the Int32.TryParse() method
```
int scd_user_comm;
if(Int32.TryParse(maskedTextBox1.Text, out scd_user_comm) == false)
scd_user_comm = 0;
```
this will give you all the flexiblity required to work with your integer var and your maschedTextBox-
To force your maskTextBox to accept only numeric val... | You could use the TryParse instead:
```
int scd_user_comm;
if(!Int32.TryParse(maskedTextBox1.Text, out scd_user_comm))
{
// Do something to notify the user that the text isn't a number.
}
``` |
2,132,440 | I have a set of python scripts that I run frequently on different machines that depend on a few external libraries as well as some other applications spawned via `subprocess.Popen`.
As expected depending on the version of the installed modules and applications the output varies. To address this I would like to keep tr... | 2010/01/25 | [
"https://Stackoverflow.com/questions/2132440",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/125801/"
] | Two years passed and some new tools came into play.
To take care of point 1 and 2 there is now `pip freeze` specially when coupled with `virtualenv`.
For external applications I had to resource to the package manager (apt-file, dpkg, qlist, emerge,... depending on the system) on the system which included all the expe... | Instead of directly investigating your dependencies in python, and if you are running in Linux/Unix, you can wrapper your program with `[memoize.py](http://benno.id.au/blog/2008/06/06/memoize-build-framework)`. `memoize.py` uses `[strace](http://en.wikipedia.org/wiki/Strace)`, or "system trace", to watch all system rea... |
168,221 | In my testing (in Bash and Z Shell), I saw no problems with defining functions or aliases or executable shell scripts which have hyphens in the name, but I'm not confident that this will be okay in all shells and in all use cases.
The reason I would like to do this is that a hyphen is easier to type than an underscore... | 2014/11/16 | [
"https://unix.stackexchange.com/questions/168221",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/3358/"
] | ### POSIX and Hyphens: No Guarantee
According to the POSIX standard, [a function name](http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_09_05) must be a valid name and [a name](http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_231) can consist of:
>
> **3.2... | I know this is really late, but perhaps you can work around your issue of making the underscore more accessible.
```
xmodmap -e "keycode 20 = underscore minus"
```
This will switch underscore with hyphen (minus).
So now, you hold shift for hyphen, but an underscore is typed without shift.
Your keycode may be dif... |
13,504,814 | Does an operator, when I overload it, lose its ability to operator for types it was defined for before, or does the new definition only apply when I call
```
cout << that_specific_class_type_variable
```
If I write `cout << that_specific_class_type_variabe->Left()` will it be overloaded function or normal cout state... | 2012/11/22 | [
"https://Stackoverflow.com/questions/13504814",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1722022/"
] | It will only change the behaviour for the specific type it's overloaded for, in your case, `TreeNode *`. Existing versions of the operator will continue to function as normal.
For the recursive calls: It will use your new definition of the operator if `Left` and `Right` are of type `TreeNode *` (or pointer to a class ... | Operator Overloading does not mean changing the function and behavior of that particular operator forever or for the built in data types.
It only facilitates you to perform operations on your user defined data types similar to the ones you do on integral types.
For example if you have two integer variables, you can a... |
3,047,756 | I'm just preparing the release of a library site builded in asp.net:
<http://213.133.103.5/gramma_prod/Site/Index.aspx>
All it's working great on FF and Chrome but on IE the asp button click event is not working.
Please notice the most important buttons: "Adauga in cos" (Add to basket)...
I'm just struggling to find... | 2010/06/15 | [
"https://Stackoverflow.com/questions/3047756",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/174349/"
] | Both of your `if` statements are getting executed one after each other, as you change the value and then immediately read it again and change it back:
```
function toggle(button)
{
if(document.getElementById("1").value=="OFF"){
document.getElementById("1").value="ON";}
else if(document.getElementById("1").valu... | Another method to do this is:
```
var button = document.querySelector("button");
var body = document.querySelector("body");
var isOrange = true;
button.addEventListener("click", function() {
if(isOrange) {
body.style.background = "orange";
}else {
body.style.background = "none";
}
isOrange = !isOrange;
});
`... |
3,047,756 | I'm just preparing the release of a library site builded in asp.net:
<http://213.133.103.5/gramma_prod/Site/Index.aspx>
All it's working great on FF and Chrome but on IE the asp button click event is not working.
Please notice the most important buttons: "Adauga in cos" (Add to basket)...
I'm just struggling to find... | 2010/06/15 | [
"https://Stackoverflow.com/questions/3047756",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/174349/"
] | Both of your `if` statements are getting executed one after each other, as you change the value and then immediately read it again and change it back:
```
function toggle(button)
{
if(document.getElementById("1").value=="OFF"){
document.getElementById("1").value="ON";}
else if(document.getElementById("1").valu... | ```
<html>
<head>
<script type="text/javascript">
function toggle(button)
{
if(document.getElementById("1").value=="OFF")
{
document.getElementById("1").value="ON";
}
else
{
document.... |
3,047,756 | I'm just preparing the release of a library site builded in asp.net:
<http://213.133.103.5/gramma_prod/Site/Index.aspx>
All it's working great on FF and Chrome but on IE the asp button click event is not working.
Please notice the most important buttons: "Adauga in cos" (Add to basket)...
I'm just struggling to find... | 2010/06/15 | [
"https://Stackoverflow.com/questions/3047756",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/174349/"
] | Another method to do this is:
```
var button = document.querySelector("button");
var body = document.querySelector("body");
var isOrange = true;
button.addEventListener("click", function() {
if(isOrange) {
body.style.background = "orange";
}else {
body.style.background = "none";
}
isOrange = !isOrange;
});
`... | This will resolve your issue.
```
let isOn = true;
function toggle(button) {
isOn = !isOn;
if (isOn) {
document.getElementById("1").value = "ON";
} else {
document.getElementById("1").value = "OFF";
}
}
``` |
3,047,756 | I'm just preparing the release of a library site builded in asp.net:
<http://213.133.103.5/gramma_prod/Site/Index.aspx>
All it's working great on FF and Chrome but on IE the asp button click event is not working.
Please notice the most important buttons: "Adauga in cos" (Add to basket)...
I'm just struggling to find... | 2010/06/15 | [
"https://Stackoverflow.com/questions/3047756",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/174349/"
] | Both of your `if` statements are getting executed one after each other, as you change the value and then immediately read it again and change it back:
```
function toggle(button)
{
if(document.getElementById("1").value=="OFF"){
document.getElementById("1").value="ON";}
else if(document.getElementById("1").valu... | Why are you passing the button if you're going to look it up?
Also, since you know the possible values, you only need to check if it's OFF, otherwise, you know it's ON.
```
// Toggles the passed button from OFF to ON and vice-versa.
function toggle(button) {
if (button.value == "OFF") {
button.value = "ON";
}... |
3,047,756 | I'm just preparing the release of a library site builded in asp.net:
<http://213.133.103.5/gramma_prod/Site/Index.aspx>
All it's working great on FF and Chrome but on IE the asp button click event is not working.
Please notice the most important buttons: "Adauga in cos" (Add to basket)...
I'm just struggling to find... | 2010/06/15 | [
"https://Stackoverflow.com/questions/3047756",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/174349/"
] | Both of your `if` statements are getting executed one after each other, as you change the value and then immediately read it again and change it back:
```
function toggle(button)
{
if(document.getElementById("1").value=="OFF"){
document.getElementById("1").value="ON";}
else if(document.getElementById("1").valu... | This will resolve your issue.
```
let isOn = true;
function toggle(button) {
isOn = !isOn;
if (isOn) {
document.getElementById("1").value = "ON";
} else {
document.getElementById("1").value = "OFF";
}
}
``` |
3,047,756 | I'm just preparing the release of a library site builded in asp.net:
<http://213.133.103.5/gramma_prod/Site/Index.aspx>
All it's working great on FF and Chrome but on IE the asp button click event is not working.
Please notice the most important buttons: "Adauga in cos" (Add to basket)...
I'm just struggling to find... | 2010/06/15 | [
"https://Stackoverflow.com/questions/3047756",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/174349/"
] | Another method to do this is:
```
var button = document.querySelector("button");
var body = document.querySelector("body");
var isOrange = true;
button.addEventListener("click", function() {
if(isOrange) {
body.style.background = "orange";
}else {
body.style.background = "none";
}
isOrange = !isOrange;
});
`... | Why not use a switch?
```
function toggle(button)
{
switch(button.value)
{
case "ON":
button.value = "OFF";
break;
case "OFF":
button.value = "ON";
break;
}
}
``` |
3,047,756 | I'm just preparing the release of a library site builded in asp.net:
<http://213.133.103.5/gramma_prod/Site/Index.aspx>
All it's working great on FF and Chrome but on IE the asp button click event is not working.
Please notice the most important buttons: "Adauga in cos" (Add to basket)...
I'm just struggling to find... | 2010/06/15 | [
"https://Stackoverflow.com/questions/3047756",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/174349/"
] | Why are you passing the button if you're going to look it up?
Also, since you know the possible values, you only need to check if it's OFF, otherwise, you know it's ON.
```
// Toggles the passed button from OFF to ON and vice-versa.
function toggle(button) {
if (button.value == "OFF") {
button.value = "ON";
}... | This will resolve your issue.
```
let isOn = true;
function toggle(button) {
isOn = !isOn;
if (isOn) {
document.getElementById("1").value = "ON";
} else {
document.getElementById("1").value = "OFF";
}
}
``` |
3,047,756 | I'm just preparing the release of a library site builded in asp.net:
<http://213.133.103.5/gramma_prod/Site/Index.aspx>
All it's working great on FF and Chrome but on IE the asp button click event is not working.
Please notice the most important buttons: "Adauga in cos" (Add to basket)...
I'm just struggling to find... | 2010/06/15 | [
"https://Stackoverflow.com/questions/3047756",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/174349/"
] | Both of your `if` statements are getting executed one after each other, as you change the value and then immediately read it again and change it back:
```
function toggle(button)
{
if(document.getElementById("1").value=="OFF"){
document.getElementById("1").value="ON";}
else if(document.getElementById("1").valu... | Why not use a switch?
```
function toggle(button)
{
switch(button.value)
{
case "ON":
button.value = "OFF";
break;
case "OFF":
button.value = "ON";
break;
}
}
``` |
3,047,756 | I'm just preparing the release of a library site builded in asp.net:
<http://213.133.103.5/gramma_prod/Site/Index.aspx>
All it's working great on FF and Chrome but on IE the asp button click event is not working.
Please notice the most important buttons: "Adauga in cos" (Add to basket)...
I'm just struggling to find... | 2010/06/15 | [
"https://Stackoverflow.com/questions/3047756",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/174349/"
] | Why are you passing the button if you're going to look it up?
Also, since you know the possible values, you only need to check if it's OFF, otherwise, you know it's ON.
```
// Toggles the passed button from OFF to ON and vice-versa.
function toggle(button) {
if (button.value == "OFF") {
button.value = "ON";
}... | Another method to do this is:
```
var button = document.querySelector("button");
var body = document.querySelector("body");
var isOrange = true;
button.addEventListener("click", function() {
if(isOrange) {
body.style.background = "orange";
}else {
body.style.background = "none";
}
isOrange = !isOrange;
});
`... |
3,047,756 | I'm just preparing the release of a library site builded in asp.net:
<http://213.133.103.5/gramma_prod/Site/Index.aspx>
All it's working great on FF and Chrome but on IE the asp button click event is not working.
Please notice the most important buttons: "Adauga in cos" (Add to basket)...
I'm just struggling to find... | 2010/06/15 | [
"https://Stackoverflow.com/questions/3047756",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/174349/"
] | Why are you passing the button if you're going to look it up?
Also, since you know the possible values, you only need to check if it's OFF, otherwise, you know it's ON.
```
// Toggles the passed button from OFF to ON and vice-versa.
function toggle(button) {
if (button.value == "OFF") {
button.value = "ON";
}... | Why not use a switch?
```
function toggle(button)
{
switch(button.value)
{
case "ON":
button.value = "OFF";
break;
case "OFF":
button.value = "ON";
break;
}
}
``` |
325,031 | I have been studying software architecture and design patterns for the past weeks, and for a week now I can't stop thinking about the performance problems that come with the flexibility of the data mapper pattern. In the book written by Martin Fowler, he gives an example of the pattern with some find methods and just o... | 2016/07/17 | [
"https://softwareengineering.stackexchange.com/questions/325031",
"https://softwareengineering.stackexchange.com",
"https://softwareengineering.stackexchange.com/users/237117/"
] | [Eugene Philipov ran a benchmark](https://www.simple-talk.com/sql/performance/comparing-multiple-rows-insert-vs-single-row-insert-with-three-data-load-methods/) on multiple `INSERT`s in one query and found out that they are really faster than running many sequential inserts after each other. This really did not come as... | Keep in mind if the is a network between your program and the database, it is very easy to write code that becomes IO bound.
Also, if you are processing transactions you may have to take several trips to the database depending on the mechanism used to track transactions. |
59,335,936 | I have a function component which uses two states and both are changed based on event triggered.
I've read on react [docs](https://reactjs.org/docs/hooks-rules.html#only-call-hooks-at-the-top-level) that is a bad idea to change states in nested function or condition. I also seen some examples using useEffects, but I ... | 2019/12/14 | [
"https://Stackoverflow.com/questions/59335936",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6242613/"
] | >
> Are there any tools (or a description of a workflow) that would allow me to have two differently formatted versions of source-code?
>
>
>
As commented, using a common convention is easier.
For example, any program written in **[Go](https://golang.org)** would use [`go fmt`](https://golang.org/pkg/fmt/), [in... | Thank you @VonC,
Here I just wanted to post a quick and ready to use implementation of your idea with Git content filter driver.
### In `.git/config` add
```
[filter "clangformat"]
smudge = .git/clang-formatter.sh .clang-format-my
clean = .git/clang-formatter.sh .clang-format-company
```
Explanation:
* `s... |
2,214 | First i hope that my question isn't off topic here, i'm sorry if it's the case but i don't know where i should ask if it's not here.
I'm asking a question about security risks and what i should do when adding a particular fonctionnality, yet my post has been moved to SO without any comments of why it should belong to ... | 2016/03/01 | [
"https://security.meta.stackexchange.com/questions/2214",
"https://security.meta.stackexchange.com",
"https://security.meta.stackexchange.com/users/98400/"
] | I understand why it was closed - the question seems very unclear. I read it a number of times and am not sure what you are asking. But I'm not sure why it was moved to SO. It's still unclear there...
One thing to remember is that the system takes the majority view on closing, so there may have been 4 different Vote to... | I'm one of the folks who voted to move it to SO. In in initial version of the question, it appeared to me that your primary question was about adding a button to your application to test a printer. It was somewhat unclear, but the security component appeared to me to be peripheral, and I thought I understood the questi... |
11,732,977 | Can you count the results of a query and make part of the query dynamic if it doesn't meet a count threshold? Maybe using a case? As you can see below I have a big silly sql query that has a lot going on (ignore the date adjust part, sorry). Sometimes it returns less than 12 results out of a database of over 10k items,... | 2012/07/31 | [
"https://Stackoverflow.com/questions/11732977",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/541164/"
] | The suspect code apparently needs to be nested inside the inside the previous describe
```
describe "after saving the user" do
before { click_button submit }
let(:user) { User.find_by_email('user@example.com') }
it { should have_selector('title', text: user.name) }
... | The `before` block in the last describe hasn't yet created the user. This is why the user (which doesn't exist yet) isn't currently signed in, thus no "sign out" link.
One possible solution is to `click_button 'submit'` in the before block. Another is to skip the sign out in the `before` block altogether, since there ... |
11,732,977 | Can you count the results of a query and make part of the query dynamic if it doesn't meet a count threshold? Maybe using a case? As you can see below I have a big silly sql query that has a lot going on (ignore the date adjust part, sorry). Sometimes it returns less than 12 results out of a database of over 10k items,... | 2012/07/31 | [
"https://Stackoverflow.com/questions/11732977",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/541164/"
] | The `before` block in the last describe hasn't yet created the user. This is why the user (which doesn't exist yet) isn't currently signed in, thus no "sign out" link.
One possible solution is to `click_button 'submit'` in the before block. Another is to skip the sign out in the `before` block altogether, since there ... | Yes, it should be nested inside the previous describe. I can confirm this also works for the Rails 4 version of the tutorial. |
11,732,977 | Can you count the results of a query and make part of the query dynamic if it doesn't meet a count threshold? Maybe using a case? As you can see below I have a big silly sql query that has a lot going on (ignore the date adjust part, sorry). Sometimes it returns less than 12 results out of a database of over 10k items,... | 2012/07/31 | [
"https://Stackoverflow.com/questions/11732977",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/541164/"
] | The suspect code apparently needs to be nested inside the inside the previous describe
```
describe "after saving the user" do
before { click_button submit }
let(:user) { User.find_by_email('user@example.com') }
it { should have_selector('title', text: user.name) }
... | Yes, it should be nested inside the previous describe. I can confirm this also works for the Rails 4 version of the tutorial. |
34,846,900 | I am very new to this whole world of "big data" tech, and recently started reading about Spark. One thing that keeps coming up is SparkSQL, yet I consistently fail to comprehend was exactly it is.
Is it supposed to convert SQL queries to MapReduce that do operations on the data you give it? But aren't dataframes alrea... | 2016/01/18 | [
"https://Stackoverflow.com/questions/34846900",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Your first answer is essentially correct, it's a API in Spark where you can write queries in SQL and they will be converted to a parallelised Spark job (Spark can do more complex types of operations than just map and reduce). Spark Data frames actually are just a wrapper around this API, it's just an alternative way of... | **Spark**
=========
**Spark** is a Framework or very big set of components using for Scalable, efficient analysis of Big Data.
**For example**: People are uploading a petabyte of video to YouTube every day. Now the time it takes to read one terabyte from a disk is about three hours at 100 megabytes per second. That's... |
47,410,340 | I am using the [tablesorter](https://github.com/Mottie/tablesorter) from motti for sorting the html table.I am unable to find way to sort a certain column depend on another column value.
In my case ,wanna sort the FULLNAME column depend on the LASTNAME column value which is basically hidden.Is this possible ? Thanks :... | 2017/11/21 | [
"https://Stackoverflow.com/questions/47410340",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3928461/"
] | You can use a fixed size array and up count appropriate index each time:
It is hour[item-1] since list indexing starts at 0.
```
hour = [0] * 24
for i in range(0,24):
item = int(input("please enter login hour: "))
if item == -1:
break
else:
hour[item] += 1
``` | I have added a while loop to count the number of elements in the list.
Hope you do not want to add -1 to the list.
Included if statement to not append `-1` and break when user inputs `-1`
Before the second loop, I have created another list which will contain unique values from `hour` to print number of attempts for on... |
47,410,340 | I am using the [tablesorter](https://github.com/Mottie/tablesorter) from motti for sorting the html table.I am unable to find way to sort a certain column depend on another column value.
In my case ,wanna sort the FULLNAME column depend on the LASTNAME column value which is basically hidden.Is this possible ? Thanks :... | 2017/11/21 | [
"https://Stackoverflow.com/questions/47410340",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3928461/"
] | You can use a fixed size array and up count appropriate index each time:
It is hour[item-1] since list indexing starts at 0.
```
hour = [0] * 24
for i in range(0,24):
item = int(input("please enter login hour: "))
if item == -1:
break
else:
hour[item] += 1
``` | ```
# We will maintain a list with 24 entries
# Each entry in the list will maintain a count for the number
# of logins in that hour. Finally, we will print all the entries
# from the list that will output number of logins for each hour
# Creating a list with one entry for each hour
records = [0] * 24
# Asking user 2... |
18,247 | When I add some lisp program in the init.el. I don't want to restart emacs in order to make effect. Then how can I do that? | 2015/11/20 | [
"https://emacs.stackexchange.com/questions/18247",
"https://emacs.stackexchange.com",
"https://emacs.stackexchange.com/users/9923/"
] | In addition to Drew's answer, if you add more than one expression, and don't want to have to evaluate them all individually, there's `eval-region`. Its docstring:
>
> Execute the region as Lisp code.
>
>
>
Select the region (move point to before the first expression, press `C-space`, move point to after the expre... | Evaluate it: call it with its arguments, using, for example `C-x C-e`. If the function `foo` takes arguments `arg1` and `arg2`, type `(foo arg1 arg2)`, put the cursor after `)`, and hit `C-x C-e`.
But if you are going to use some Emacs Lisp you really should start to read the Intro to Emacs Lisp manual - use `C-h i` t... |
18,247 | When I add some lisp program in the init.el. I don't want to restart emacs in order to make effect. Then how can I do that? | 2015/11/20 | [
"https://emacs.stackexchange.com/questions/18247",
"https://emacs.stackexchange.com",
"https://emacs.stackexchange.com/users/9923/"
] | Evaluate it: call it with its arguments, using, for example `C-x C-e`. If the function `foo` takes arguments `arg1` and `arg2`, type `(foo arg1 arg2)`, put the cursor after `)`, and hit `C-x C-e`.
But if you are going to use some Emacs Lisp you really should start to read the Intro to Emacs Lisp manual - use `C-h i` t... | If your function has defvar or defcustom and you want those reset as part of the eval, then consider C-M-x (eval-defun). A plain eval will not reset previous values of the defvars, if any. |
18,247 | When I add some lisp program in the init.el. I don't want to restart emacs in order to make effect. Then how can I do that? | 2015/11/20 | [
"https://emacs.stackexchange.com/questions/18247",
"https://emacs.stackexchange.com",
"https://emacs.stackexchange.com/users/9923/"
] | In addition to Drew's answer, if you add more than one expression, and don't want to have to evaluate them all individually, there's `eval-region`. Its docstring:
>
> Execute the region as Lisp code.
>
>
>
Select the region (move point to before the first expression, press `C-space`, move point to after the expre... | If your function has defvar or defcustom and you want those reset as part of the eval, then consider C-M-x (eval-defun). A plain eval will not reset previous values of the defvars, if any. |
47,418,881 | I'm new to the java language and have just learned basic stuff as of yet. I have to write an application that asks a user to enter an integer, and then display a statement that indicates whether an integer is even or odd. This is what I have done:
```
import java.util.Scanner;
public class EvenOdd
{
public static ... | 2017/11/21 | [
"https://Stackoverflow.com/questions/47418881",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8981016/"
] | In your first example you are assigning the variable correctly when you do
```
double divisibleByTwo = num % 2;
```
and then using that value that was returned you check
```
if(divisibleByTwo == 0)...
```
which returns true or false. However in the next sample of code you do
```
isEven(num); //NO asignment!!!!
... | Your goal is to do all the calculation in the `isEven` method, your main method will only be used to get the number from the user and call the other method. No need to do calculations there.
In other words something like the following :
```
import java.util.Scanner;
class EvenOdd
{
public static void main(String[... |
47,418,881 | I'm new to the java language and have just learned basic stuff as of yet. I have to write an application that asks a user to enter an integer, and then display a statement that indicates whether an integer is even or odd. This is what I have done:
```
import java.util.Scanner;
public class EvenOdd
{
public static ... | 2017/11/21 | [
"https://Stackoverflow.com/questions/47418881",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8981016/"
] | In your first example you are assigning the variable correctly when you do
```
double divisibleByTwo = num % 2;
```
and then using that value that was returned you check
```
if(divisibleByTwo == 0)...
```
which returns true or false. However in the next sample of code you do
```
isEven(num); //NO asignment!!!!
... | You don't need to overcomplicate things. You just need cleaner and simple code:
```
public class OddEven {
public static void main(String[] args) {
// accept user input and check if number is even or odd
Scanner input = new Scanner(System.in);
System.out.print("Enter an integer >> ");
... |
47,418,881 | I'm new to the java language and have just learned basic stuff as of yet. I have to write an application that asks a user to enter an integer, and then display a statement that indicates whether an integer is even or odd. This is what I have done:
```
import java.util.Scanner;
public class EvenOdd
{
public static ... | 2017/11/21 | [
"https://Stackoverflow.com/questions/47418881",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8981016/"
] | In your first example you are assigning the variable correctly when you do
```
double divisibleByTwo = num % 2;
```
and then using that value that was returned you check
```
if(divisibleByTwo == 0)...
```
which returns true or false. However in the next sample of code you do
```
isEven(num); //NO asignment!!!!
... | Write an application that reads in two integers and determines and prints whether the first is a multiple of the second. For example, if the user inputs 15 and 3, the first number is a multiple of the second. If the user inputs 2 and 4, the first number is not a multiple of the second. |
47,418,881 | I'm new to the java language and have just learned basic stuff as of yet. I have to write an application that asks a user to enter an integer, and then display a statement that indicates whether an integer is even or odd. This is what I have done:
```
import java.util.Scanner;
public class EvenOdd
{
public static ... | 2017/11/21 | [
"https://Stackoverflow.com/questions/47418881",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8981016/"
] | You don't need to overcomplicate things. You just need cleaner and simple code:
```
public class OddEven {
public static void main(String[] args) {
// accept user input and check if number is even or odd
Scanner input = new Scanner(System.in);
System.out.print("Enter an integer >> ");
... | Your goal is to do all the calculation in the `isEven` method, your main method will only be used to get the number from the user and call the other method. No need to do calculations there.
In other words something like the following :
```
import java.util.Scanner;
class EvenOdd
{
public static void main(String[... |
47,418,881 | I'm new to the java language and have just learned basic stuff as of yet. I have to write an application that asks a user to enter an integer, and then display a statement that indicates whether an integer is even or odd. This is what I have done:
```
import java.util.Scanner;
public class EvenOdd
{
public static ... | 2017/11/21 | [
"https://Stackoverflow.com/questions/47418881",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8981016/"
] | You don't need to overcomplicate things. You just need cleaner and simple code:
```
public class OddEven {
public static void main(String[] args) {
// accept user input and check if number is even or odd
Scanner input = new Scanner(System.in);
System.out.print("Enter an integer >> ");
... | Write an application that reads in two integers and determines and prints whether the first is a multiple of the second. For example, if the user inputs 15 and 3, the first number is a multiple of the second. If the user inputs 2 and 4, the first number is not a multiple of the second. |
13,088,993 | I wanted to select all of the elements in the DOM that have a border-radius !== 0.
Do you guys know a way of doing that? | 2012/10/26 | [
"https://Stackoverflow.com/questions/13088993",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/462403/"
] | Yes. Use the [.filter()](http://api.jquery.com/filter/) function.
```
$(elements).filter(function(){
return parseInt($(this).css("border-radius"),10) != 0;
});
``` | Use a CSS class to define your border radius, then use jQuery to select them.
CSS:
```
.border-radius {
border-radius: 4px;
}
```
JS:
```
$('.border-radius')
``` |
13,088,993 | I wanted to select all of the elements in the DOM that have a border-radius !== 0.
Do you guys know a way of doing that? | 2012/10/26 | [
"https://Stackoverflow.com/questions/13088993",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/462403/"
] | Yes. Use the [.filter()](http://api.jquery.com/filter/) function.
```
$(elements).filter(function(){
return parseInt($(this).css("border-radius"),10) != 0;
});
``` | Because I like to be thorough, we ought to consider the fact that `border-radius` can accept multiple values to describe all four corners individually:
```
$('*').filter(function() {
var br = $(this).css("border-radius").split(' '),
test = false;
for (var i = 0, j = br.length; i < j; i++) {
tes... |
37,222,895 | I'm new to the forms, so excuse me.
For some odd reason, it may just be because it's 1 AM I just can't link CSS properly!They are in the same folder, no sub-folders or anything (on mac btw) and it's just not linking up. Any help would be appreciated. Thanks.
```
<html>
<head>
<title></title>
<link rel="stylesh... | 2016/05/14 | [
"https://Stackoverflow.com/questions/37222895",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6333258/"
] | The most efficient way to improve performance in your case is to a add a **INDEX** to your **sort** column in this case message\_id for better performance.
In this way , your query will perform an **index scan instead of a full table** scan which hampers the performance.
You can create an index by using following sta... | Yes.
If message\_id is not the leading column in the primary key or a secondary index, then create an index:
```
... ON MESSAGES (message_id)
```
And eliminate the inline view:
```
SELECT m.*
FROM MESSAGES m
WHERE m.message_id > ?
ORDER BY m.message_id
``` |
37,222,895 | I'm new to the forms, so excuse me.
For some odd reason, it may just be because it's 1 AM I just can't link CSS properly!They are in the same folder, no sub-folders or anything (on mac btw) and it's just not linking up. Any help would be appreciated. Thanks.
```
<html>
<head>
<title></title>
<link rel="stylesh... | 2016/05/14 | [
"https://Stackoverflow.com/questions/37222895",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6333258/"
] | The most efficient way to improve performance in your case is to a add a **INDEX** to your **sort** column in this case message\_id for better performance.
In this way , your query will perform an **index scan instead of a full table** scan which hampers the performance.
You can create an index by using following sta... | Create a B-Tree Index :
You can adjust the ordering of a B-tree index by including the options ASC, DESC, NULLS FIRST, and/or NULLS LAST when creating the index; for example:
CREATE INDEX test2\_info\_nulls\_low ON test2 (info NULLS FIRST);
CREATE INDEX test3\_desc\_index ON test3 (id DESC NULLS LAST); |
16,297,485 | i have an index page that contain div content. i load contents from other divs in other pages via ajax inside index page content div. the content successfully loaded but without its css and scripts. How can i load the content with its css and scripts to work inside content div.
```
$(document).ready(function () {
... | 2013/04/30 | [
"https://Stackoverflow.com/questions/16297485",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2331047/"
] | ok do one thing load your css and js externally using code
```
$("<link/>", {
rel: "stylesheet",
type: "text/css",
href: "/styles/yourcss.css"
}).appendTo("head");
```
same for js | either declare css on index page or declare css within div on other page(ajax page) |
16,297,485 | i have an index page that contain div content. i load contents from other divs in other pages via ajax inside index page content div. the content successfully loaded but without its css and scripts. How can i load the content with its css and scripts to work inside content div.
```
$(document).ready(function () {
... | 2013/04/30 | [
"https://Stackoverflow.com/questions/16297485",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2331047/"
] | ok do one thing load your css and js externally using code
```
$("<link/>", {
rel: "stylesheet",
type: "text/css",
href: "/styles/yourcss.css"
}).appendTo("head");
```
same for js | Put Css and Js inside target `div` which you want to load. |
42,987,199 | Node Class
As part of the tree implementation you should implement a Node class. Each node should contain a Customer object, pointers to left and right children and (optionally) the parent.
So, currently I have a customer class such that:
```
class Customer {
public:
Customer(void);
Customer(string,char,in... | 2017/03/23 | [
"https://Stackoverflow.com/questions/42987199",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7537349/"
] | >
> Do I just include the following in my node header file?
>
>
>
No. You just use an object of type `Customer` in `Node`.
```
#include "Customer.h"
class Node {
public:
Node(void); //default constructor
Node(string,char,int); //Node constructor with customer details
Node* left;
Node... | You simply include the header as you did and then declare a Customer object in your Node class (private / protected / public, as you wish). When you'll declare a Node object, the first thing that is constructed are the objects inside your class, and only then the class itself. So, if you would have a `cout`in both cons... |
276,493 | anyone knows how to change the default width for shell window in Linux(Ubuntu), so that I don't have to re-size it every time I open it up? Thanks | 2011/04/28 | [
"https://superuser.com/questions/276493",
"https://superuser.com",
"https://superuser.com/users/-1/"
] | Run `gconf-editor`, navigate to `/apps/gnome-terminal/profiles/Default` and set the `default_size_columns` and `default_size_rows` keys. The columns & rows are measured in characters, not in pixels. | If you are on gnome:
```
gnome-terminal --geometry 120x60
```
Will explicitly state the window size. `konsole` sounds like KDE's variant. The same argument should work there. |
4,870,828 | i have published android app but not appearing in android market.i m using android 2.2 and i have tried in samsung galaxy that is not showing my application so just give me some idea to fix this problem.
this is my manifest.xml file:
```
<activity android:name=".Full"
android:screenOrientation="landscape"
... | 2011/02/02 | [
"https://Stackoverflow.com/questions/4870828",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/591790/"
] | If I understand you correctly you just want to get the most recent transaction for all users.
```
SELECT user_id, trans_date, trans_credit
FROM `table`
GROUP BY user_id
ORDER BY trans_date DESC;
``` | How about something like
```
SELECT t.*
FROM table t INNER JOIN
(
SELECT user_id,
MAX(trans_date) max_trans_date
FROM table
GROUP BY user_id
) MaxDates ON t.user_id = MaxDates.max_trans_date
``` |
743,792 | I'm setting up Email Authentication and I'm seeing conflicting info on the format.
[Some say](http://help.campaignmonitor.com/topic.aspx?t=100) that the value should be surrounded in `"` `"`
But other services have told me to leave out the surrounding `"`
Does it just vary by ESP (email service provider)? | 2015/12/17 | [
"https://serverfault.com/questions/743792",
"https://serverfault.com",
"https://serverfault.com/users/2181/"
] | The formatting of `TXT` record data doesn't really have to do with Email. Ie, it doesn't have to do with the Email Service Provider, rather the DNS server software / DNS Service provider if anything.
`TXT` records [can have multiple string values](https://www.rfc-editor.org/rfc/rfc1035#section-3.3.14).
In the standar... | Yes surround the whole shabang in quotes! Fun fact, dig returns results in bind-ok format, so you can always try digging someone else's dkim record:
```
[d...@o... ~]$ dig @sjc-dns1.ebaydns.com -t TXT dkim1k._domainkey.ebay.com
```
[snip]
```
dkim1k._domainkey.ebay.com. 3600 IN TXT "v=DKIM1; k=rsa; p=MIGfMA0GCSqGSI... |
82,730 | I'm trying to compare two diagrams in pdf format side by side.
I have this post - [Two figures side by side](https://tex.stackexchange.com/questions/5769/two-figures-side-by-side) to get some hint.
This is the code that I'm coming up with.
```
\begin{figure}
\begin{minipage}[t]{0.45\linewidth}
\includegraphics[scal... | 2012/11/14 | [
"https://tex.stackexchange.com/questions/82730",
"https://tex.stackexchange.com",
"https://tex.stackexchange.com/users/379/"
] | Although you can solve perfectly the problem with `minipages`, for sub-figures with captions enumerated with letters (a,b,..) you can use also the package `subcaption` to simplify a little your code, as you do not need write "(a)" and "(b)", but mainly because the flexibility that you have with this package, as listing... | Thanks to egreg and Vincent, I could make the correction.
The problem was the empty line that caused the wrong alignment, and I replaced `caption` with `centering` to remove the `Figure`

```
\begin{figure}
\begin{minipage}[t]{0.49\linewidth}
\cente... |
14,184,802 | I have encountered an example of HTML5 that has an absence of a number in the heading tag unlike the normal `<h1>` to `<h6>` tags.
Is this an incorrect use of HTML? I believe that this use of the heading tag is incorrect, I did want to verify though.
```
<article>
<h>Subheading</h>
This is some content
</ar... | 2013/01/06 | [
"https://Stackoverflow.com/questions/14184802",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1554264/"
] | There is no `<h>` element in HTML. There was one proposed for XHTML 2, but that never took off. | He can "create" new tags in HTML and then put as selector in CSS. But this is not a header though. |
43,818,109 | I am appending output to a `ul` element using `li` elements. I am able to generate the output as desired but I have no idea on how to use transitions and transform, as Javascript is creating those `li` elements.
I want to transform `li` elements as they appear from Javascript in the DOM.
Vanilla Javascript is preferr... | 2017/05/06 | [
"https://Stackoverflow.com/questions/43818109",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7897366/"
] | You need convert to `str` first and select first `2` values which are compared with [`isin`](http://pandas.pydata.org/pandas-docs/stable/generated/pandas.Series.isin.html) and filter with [`boolean indexing`](http://pandas.pydata.org/pandas-docs/stable/indexing.html#boolean-indexing):
```
print (df.B.astype(str).str[:... | ```
>>> df[df['B'].map(lambda x: str(x[:2]) in ['15', '16', '60'])]
A B D
0 d 151 M
1 d 152 a
2 d 153 M
3 d 161 z
4 d 164 M
5 d 169 g
9 d 605 j
10 d 603 d
11 d 607 e
``` |
22,363,070 | I want my .ejs files to have html syntax, however, it always opens the files as Plain Text.
In sublime you can choose "Open all with current extension as..." then choose your syntax.

I see that you can change the syntax in the left bottom corner![syntax c... | 2014/03/12 | [
"https://Stackoverflow.com/questions/22363070",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1258121/"
] | This is now [in Atom core](https://flight-manual.atom.io/using-atom/sections/basic-customization/#customizing-language-recognition), you don't need that file-types package any more.
Where I work, we use .phl for a certain kind of PHP file. To tell Atom about this, first [find the language's Scope Name](https://flight-... | *Edit:* since the time I wrote this answer, this functionality has been added to Atom core, see [this answer](https://stackoverflow.com/a/32508353/2315334) for details.
### file-types Atom package
(<https://atom.io/packages/file-types>)
It does exactly what the title question asks for: you can define new file exten... |
22,363,070 | I want my .ejs files to have html syntax, however, it always opens the files as Plain Text.
In sublime you can choose "Open all with current extension as..." then choose your syntax.

I see that you can change the syntax in the left bottom corner![syntax c... | 2014/03/12 | [
"https://Stackoverflow.com/questions/22363070",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1258121/"
] | For individual files you can use the Grammar Selector; `Ctrl`+`Shift`+`L` to set which language you're using on that file. Not the same as auto-detect but useful for those times when you're using a file that you don't want to set a default for. | For example if you want to open all `.jsx` files with javascript syntax, you need to add this to your `config.cson`
```
"*":
core:
customFileTypes:
"source.js": [
"jsx"
]
```
This maps all .jsx files to open with js syntax. |
22,363,070 | I want my .ejs files to have html syntax, however, it always opens the files as Plain Text.
In sublime you can choose "Open all with current extension as..." then choose your syntax.

I see that you can change the syntax in the left bottom corner![syntax c... | 2014/03/12 | [
"https://Stackoverflow.com/questions/22363070",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1258121/"
] | *Edit:* since the time I wrote this answer, this functionality has been added to Atom core, see [this answer](https://stackoverflow.com/a/32508353/2315334) for details.
### file-types Atom package
(<https://atom.io/packages/file-types>)
It does exactly what the title question asks for: you can define new file exten... | As Dave Andersen mentions in a buried comment, it is now possible to do this without any extra packages and it's documented [here](http://flight-manual.atom.io/using-atom/sections/basic-customization/#customizing-language-recognition). |
22,363,070 | I want my .ejs files to have html syntax, however, it always opens the files as Plain Text.
In sublime you can choose "Open all with current extension as..." then choose your syntax.

I see that you can change the syntax in the left bottom corner![syntax c... | 2014/03/12 | [
"https://Stackoverflow.com/questions/22363070",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1258121/"
] | This is now [in Atom core](https://flight-manual.atom.io/using-atom/sections/basic-customization/#customizing-language-recognition), you don't need that file-types package any more.
Where I work, we use .phl for a certain kind of PHP file. To tell Atom about this, first [find the language's Scope Name](https://flight-... | As Dave Andersen mentions in a buried comment, it is now possible to do this without any extra packages and it's documented [here](http://flight-manual.atom.io/using-atom/sections/basic-customization/#customizing-language-recognition). |
22,363,070 | I want my .ejs files to have html syntax, however, it always opens the files as Plain Text.
In sublime you can choose "Open all with current extension as..." then choose your syntax.

I see that you can change the syntax in the left bottom corner![syntax c... | 2014/03/12 | [
"https://Stackoverflow.com/questions/22363070",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1258121/"
] | For individual files you can use the Grammar Selector; `Ctrl`+`Shift`+`L` to set which language you're using on that file. Not the same as auto-detect but useful for those times when you're using a file that you don't want to set a default for. | As Dave Andersen mentions in a buried comment, it is now possible to do this without any extra packages and it's documented [here](http://flight-manual.atom.io/using-atom/sections/basic-customization/#customizing-language-recognition). |
22,363,070 | I want my .ejs files to have html syntax, however, it always opens the files as Plain Text.
In sublime you can choose "Open all with current extension as..." then choose your syntax.

I see that you can change the syntax in the left bottom corner![syntax c... | 2014/03/12 | [
"https://Stackoverflow.com/questions/22363070",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1258121/"
] | Easy mode: include
==================
If your language really is just HTML, you can set up a simple package to handle this.
Create a package called `langugage-ejs` and in `grammars/ejs.cson` you can include HTML as having the patterns you care about:
```
'fileTypes': [
'ejs'
]
'name': 'Embedded JavaScript'
'patt... | It looks likes there's a brand new package has been released for this. <https://atom.io/packages/language-ejs>. |
22,363,070 | I want my .ejs files to have html syntax, however, it always opens the files as Plain Text.
In sublime you can choose "Open all with current extension as..." then choose your syntax.

I see that you can change the syntax in the left bottom corner![syntax c... | 2014/03/12 | [
"https://Stackoverflow.com/questions/22363070",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1258121/"
] | This is now [in Atom core](https://flight-manual.atom.io/using-atom/sections/basic-customization/#customizing-language-recognition), you don't need that file-types package any more.
Where I work, we use .phl for a certain kind of PHP file. To tell Atom about this, first [find the language's Scope Name](https://flight-... | It looks likes there's a brand new package has been released for this. <https://atom.io/packages/language-ejs>. |
22,363,070 | I want my .ejs files to have html syntax, however, it always opens the files as Plain Text.
In sublime you can choose "Open all with current extension as..." then choose your syntax.

I see that you can change the syntax in the left bottom corner![syntax c... | 2014/03/12 | [
"https://Stackoverflow.com/questions/22363070",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1258121/"
] | *Edit:* since the time I wrote this answer, this functionality has been added to Atom core, see [this answer](https://stackoverflow.com/a/32508353/2315334) for details.
### file-types Atom package
(<https://atom.io/packages/file-types>)
It does exactly what the title question asks for: you can define new file exten... | It looks likes there's a brand new package has been released for this. <https://atom.io/packages/language-ejs>. |
22,363,070 | I want my .ejs files to have html syntax, however, it always opens the files as Plain Text.
In sublime you can choose "Open all with current extension as..." then choose your syntax.

I see that you can change the syntax in the left bottom corner![syntax c... | 2014/03/12 | [
"https://Stackoverflow.com/questions/22363070",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1258121/"
] | For individual files you can use the Grammar Selector; `Ctrl`+`Shift`+`L` to set which language you're using on that file. Not the same as auto-detect but useful for those times when you're using a file that you don't want to set a default for. | It looks likes there's a brand new package has been released for this. <https://atom.io/packages/language-ejs>. |
22,363,070 | I want my .ejs files to have html syntax, however, it always opens the files as Plain Text.
In sublime you can choose "Open all with current extension as..." then choose your syntax.

I see that you can change the syntax in the left bottom corner![syntax c... | 2014/03/12 | [
"https://Stackoverflow.com/questions/22363070",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1258121/"
] | This is now [in Atom core](https://flight-manual.atom.io/using-atom/sections/basic-customization/#customizing-language-recognition), you don't need that file-types package any more.
Where I work, we use .phl for a certain kind of PHP file. To tell Atom about this, first [find the language's Scope Name](https://flight-... | For individual files you can use the Grammar Selector; `Ctrl`+`Shift`+`L` to set which language you're using on that file. Not the same as auto-detect but useful for those times when you're using a file that you don't want to set a default for. |
67,237,574 | m beginner at react i have a little problem i want to change a bool value which is isApproved so the admin click a button and approve the post so it can be displayed here is my code . can anyone help me
this is the function that change the value of isApproved
```
//@route put api/posts/approve/:id
//@desc approve pos... | 2021/04/23 | [
"https://Stackoverflow.com/questions/67237574",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15221448/"
] | The [`std::filesystem`](https://en.cppreference.com/w/cpp/filesystem/exists) library evolved out directly from the corresponding [Boost library](https://www.boost.org/doc/libs/1_75_0/libs/filesystem/doc/index.htm). As several functions in the Boost libraries (such as Boost ASIO) it offers [two interfaces](https://subsc... | From cppreference:
>
> The overload taking a `std::error_code&` parameter sets it to the OS API error code if an OS API call fails, and executes `ec.clear()` if no errors occur.
>
>
>
No, you don't *need* to. It's better to only use it if the call fails. Any other time `ec` will not have any useful information in... |
43,477,483 | I'm working with a lot of Option and I need to use pattern match/case almost every call to check if object is None or not.
Is possible to write cleaner code when you use a lot of match cases?
```
def process(schema: Option[String], body: String, token:String, queueInfo: Map[String, String]) = {
jsonSchemaService.fi... | 2017/04/18 | [
"https://Stackoverflow.com/questions/43477483",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | use `.map` and `.flatMap` to avoid pattern matching on Options:
```
jsonSchemaService
.findByDescriptionFromCache(schema)
.map { jsonSchema =>
jsonSchema.schema.map { s =>
val ku = buildKinesisUtils(token, queueInfo)
validateAndPublish(body, s, ku)
}.getOrElse(Future(Left(SchemaNotD... | What you're doing is actually a `fold`.
```
option.fold(noneCase)(s => someCase(s))
``` |
43,477,483 | I'm working with a lot of Option and I need to use pattern match/case almost every call to check if object is None or not.
Is possible to write cleaner code when you use a lot of match cases?
```
def process(schema: Option[String], body: String, token:String, queueInfo: Map[String, String]) = {
jsonSchemaService.fi... | 2017/04/18 | [
"https://Stackoverflow.com/questions/43477483",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Using pattern matching isn't really an idiomatic way of dealing with options. It's better to use the methods like map and flatmap and take advantage of for comprehensions to work with options. If you are checking everytime if an option is None, it's not much better than a null check.
Since your methods are returning O... | What you're doing is actually a `fold`.
```
option.fold(noneCase)(s => someCase(s))
``` |
55,942,990 | Semantic's Transition.Group example shown here <https://react.semantic-ui.com/modules/transition/#types-group> only animates the bottom most element. How would I change it so the top most element gets animated instead.
If I press the add or subtract button in the example above the animation only applies to the last e... | 2019/05/01 | [
"https://Stackoverflow.com/questions/55942990",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5021627/"
] | If you read the sample code you realize all it does is to display a slice of the array based on the current length in the state. It appears to be appending / removing from the bottom because it's taking elements starting from the index 0. If you want to show it as if it's animating at the top, you just need to take the... | An easier solution using `reverse` would be to just reverse the array when you map through it and create the children.
```
render() {
const { items } = this.state;
return (<div>
{items.clone().reverse().map((item, index) => <div key={item}>
{ /* Stuff */ }
</div>)}
</div>);
}
... |
2,464,661 | I was wondering how can I factor this equation: $x^3-2x+1$ by grouping, I have this doubt because the solution is $(x-1)(x^2+x-1)$ and this seems clearly obtain by factoring by grouping but I have always thought that this method was possible only for 4 terms equations.
So I tried to do my best and I factored it in thi... | 2017/10/09 | [
"https://math.stackexchange.com/questions/2464661",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/486458/"
] | Note that
$$\frac{\sqrt{n+1}-\sqrt n}{n}=\frac{1}{n(\sqrt{n+1}+\sqrt n)}\le \frac{1}{2n^{3/2}}$$ | $\sum\_{n=1}^{\infty}\frac{\sqrt{n+1}-\sqrt{n}}{n} = \sum\_{n=1}^{\infty}\frac{\sqrt{n+1}-\sqrt{n}}{n} \frac{\sqrt{n+1}+\sqrt{n}}{\sqrt{n+1}+\sqrt{n}} = \sum\_{n=1}^{\infty}\frac{1}{n(\sqrt{n+1}+\sqrt{n})} < \sum\_{n=1}^{\infty}\frac{1}{2n(\sqrt{n})}
\\ and
\\ \sum\_{n=1}^{\infty}\frac{1}{n(\sqrt{n+1}+\sqrt{n})} > \sum... |
2,464,661 | I was wondering how can I factor this equation: $x^3-2x+1$ by grouping, I have this doubt because the solution is $(x-1)(x^2+x-1)$ and this seems clearly obtain by factoring by grouping but I have always thought that this method was possible only for 4 terms equations.
So I tried to do my best and I factored it in thi... | 2017/10/09 | [
"https://math.stackexchange.com/questions/2464661",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/486458/"
] | Note that
$$\frac{\sqrt{n+1}-\sqrt n}{n}=\frac{1}{n(\sqrt{n+1}+\sqrt n)}\le \frac{1}{2n^{3/2}}$$ | More generally,
consider
$\sum\_{n=1}^{\infty}\frac{(n+1)^a-n^a}{n}
$
where
$1 >a > 0$.
This problem is the case
$a = \frac12$.
Since $x^a$ is monotonic,
and
$(x^a)' = a x^{a-1}
$,
$(n+1)^a-n^a
=\int\_n^{n+1} (x^a)' dx
=\int\_n^{n+1} ax^{a-1} dx
\lt a n^{a-1}
$
so
$\frac{(n+1)^a-n^a}{n}
\lt \frac{a n^{a-1}}{n}
= \frac... |
2,464,661 | I was wondering how can I factor this equation: $x^3-2x+1$ by grouping, I have this doubt because the solution is $(x-1)(x^2+x-1)$ and this seems clearly obtain by factoring by grouping but I have always thought that this method was possible only for 4 terms equations.
So I tried to do my best and I factored it in thi... | 2017/10/09 | [
"https://math.stackexchange.com/questions/2464661",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/486458/"
] | $\sum\_{n=1}^{\infty}\frac{\sqrt{n+1}-\sqrt{n}}{n} = \sum\_{n=1}^{\infty}\frac{\sqrt{n+1}-\sqrt{n}}{n} \frac{\sqrt{n+1}+\sqrt{n}}{\sqrt{n+1}+\sqrt{n}} = \sum\_{n=1}^{\infty}\frac{1}{n(\sqrt{n+1}+\sqrt{n})} < \sum\_{n=1}^{\infty}\frac{1}{2n(\sqrt{n})}
\\ and
\\ \sum\_{n=1}^{\infty}\frac{1}{n(\sqrt{n+1}+\sqrt{n})} > \sum... | More generally,
consider
$\sum\_{n=1}^{\infty}\frac{(n+1)^a-n^a}{n}
$
where
$1 >a > 0$.
This problem is the case
$a = \frac12$.
Since $x^a$ is monotonic,
and
$(x^a)' = a x^{a-1}
$,
$(n+1)^a-n^a
=\int\_n^{n+1} (x^a)' dx
=\int\_n^{n+1} ax^{a-1} dx
\lt a n^{a-1}
$
so
$\frac{(n+1)^a-n^a}{n}
\lt \frac{a n^{a-1}}{n}
= \frac... |
29,550,723 | I have the use case, where I need to allow for processing an arbitrary array of strings, by an arbitrary regex, which is created either by a regex literal, or through the `new RegExp()` constructor.
It all works fine, until the global `g` flag is used with capturing groups.
I read a few answers on SO, and the propose... | 2015/04/09 | [
"https://Stackoverflow.com/questions/29550723",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2445063/"
] | It's not working because when '-' is reached, exec() fails to match the '-' character, but does match 0 characters (because of \*), so it doesn't skip it, and thus it gets stuck. If you use `-|([^-]*)`, then it will skip the '-' character. You will need to then check the 'match.index' property to see if you've reach th... | The `match` object has an `index` property that contains the position of the current match. If that stays the same between two calls in the loop, it means you're stuck.
```js
var regexString = '([^-]*)';
var flags = 'ig';
var regex = new RegExp(regexString, flags);
var arr = ['some-property-image.png', 'another-pr... |
29,550,723 | I have the use case, where I need to allow for processing an arbitrary array of strings, by an arbitrary regex, which is created either by a regex literal, or through the `new RegExp()` constructor.
It all works fine, until the global `g` flag is used with capturing groups.
I read a few answers on SO, and the propose... | 2015/04/09 | [
"https://Stackoverflow.com/questions/29550723",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2445063/"
] | It's not working because when '-' is reached, exec() fails to match the '-' character, but does match 0 characters (because of \*), so it doesn't skip it, and thus it gets stuck. If you use `-|([^-]*)`, then it will skip the '-' character. You will need to then check the 'match.index' property to see if you've reach th... | Why it's crashing: an infinite loop was created by using a RegExp object with a global flag and [`exec`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/exec) in a loop with a zero-width match. The loop hits the first '-' but doesn't match that character because of the negated ch... |
42,485,605 | I was programming in Android Studio, on MAC OS X macOS Sierra.
I was debugging code on one emulator, then I started next emulator with different phone. Then accidentally laptop restarted (with the grey screen <https://i.kinja-img.com/gawker-media/image/upload/s--HPvl05ih--/c_scale,f_auto,fl_progressive,q_80,w_800/18mf... | 2017/02/27 | [
"https://Stackoverflow.com/questions/42485605",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6314640/"
] | Okay.
After that post I also tried cleaning cache, logs and again reinstall Java JDK. Nothing helped.
Unfortunately the only solution which helped - format and reinstall system. | Try File -> Invalidate caches / Restart... in android studio. |
42,485,605 | I was programming in Android Studio, on MAC OS X macOS Sierra.
I was debugging code on one emulator, then I started next emulator with different phone. Then accidentally laptop restarted (with the grey screen <https://i.kinja-img.com/gawker-media/image/upload/s--HPvl05ih--/c_scale,f_auto,fl_progressive,q_80,w_800/18mf... | 2017/02/27 | [
"https://Stackoverflow.com/questions/42485605",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6314640/"
] | Okay.
After that post I also tried cleaning cache, logs and again reinstall Java JDK. Nothing helped.
Unfortunately the only solution which helped - format and reinstall system. | you must remove ".gradle" folder into your root project and restart your android
studio. |
35,934,583 | The title says it all. Just to irritate DRY purists, I'll say it again.
Is it possible to get a list of instances my application is running on via **gcloud**? | 2016/03/11 | [
"https://Stackoverflow.com/questions/35934583",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/339838/"
] | App Engine can mean traditional App Engine or Managed VMs, depending on the context. There is only one App Engine app per project, but you can have multiple modules (although only one of those module will serve web traffic, the rest are backend only) and multiple versions of each module.
As pgiecek mention,
```
gclou... | It seems that currently it is not possible. At the moment gcloud tool supports App Engine (via Preview CLI command groups) but provides only limited number of operations and furthermore they are in BETA. You can check documentation [here](https://cloud.google.com/sdk/gcloud/reference/preview/app/).
You can only list y... |
35,934,583 | The title says it all. Just to irritate DRY purists, I'll say it again.
Is it possible to get a list of instances my application is running on via **gcloud**? | 2016/03/11 | [
"https://Stackoverflow.com/questions/35934583",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/339838/"
] | In 2019, You can check the newest document : [gcloud app services list - list your existing services](https://cloud.google.com/sdk/gcloud/reference/app/services/list)
The newest command is:
```
gcloud app services list
```
The result will be something like this.
```
SERVICE NUM_VERSIONS
default 7
``` | It seems that currently it is not possible. At the moment gcloud tool supports App Engine (via Preview CLI command groups) but provides only limited number of operations and furthermore they are in BETA. You can check documentation [here](https://cloud.google.com/sdk/gcloud/reference/preview/app/).
You can only list y... |
35,934,583 | The title says it all. Just to irritate DRY purists, I'll say it again.
Is it possible to get a list of instances my application is running on via **gcloud**? | 2016/03/11 | [
"https://Stackoverflow.com/questions/35934583",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/339838/"
] | App Engine can mean traditional App Engine or Managed VMs, depending on the context. There is only one App Engine app per project, but you can have multiple modules (although only one of those module will serve web traffic, the rest are backend only) and multiple versions of each module.
As pgiecek mention,
```
gclou... | In 2019, You can check the newest document : [gcloud app services list - list your existing services](https://cloud.google.com/sdk/gcloud/reference/app/services/list)
The newest command is:
```
gcloud app services list
```
The result will be something like this.
```
SERVICE NUM_VERSIONS
default 7
``` |
35,934,583 | The title says it all. Just to irritate DRY purists, I'll say it again.
Is it possible to get a list of instances my application is running on via **gcloud**? | 2016/03/11 | [
"https://Stackoverflow.com/questions/35934583",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/339838/"
] | App Engine can mean traditional App Engine or Managed VMs, depending on the context. There is only one App Engine app per project, but you can have multiple modules (although only one of those module will serve web traffic, the rest are backend only) and multiple versions of each module.
As pgiecek mention,
```
gclou... | As of Sep 2019 (Google Cloud SDK 237.0.0):
`gcloud app instances list`
[](https://i.stack.imgur.com/J9CAH.png) |
35,934,583 | The title says it all. Just to irritate DRY purists, I'll say it again.
Is it possible to get a list of instances my application is running on via **gcloud**? | 2016/03/11 | [
"https://Stackoverflow.com/questions/35934583",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/339838/"
] | In 2019, You can check the newest document : [gcloud app services list - list your existing services](https://cloud.google.com/sdk/gcloud/reference/app/services/list)
The newest command is:
```
gcloud app services list
```
The result will be something like this.
```
SERVICE NUM_VERSIONS
default 7
``` | As of Sep 2019 (Google Cloud SDK 237.0.0):
`gcloud app instances list`
[](https://i.stack.imgur.com/J9CAH.png) |
124,697 | I was confused about the difference between a commit operation and a checkpoint. I referred to some of the articles like [This Article](https://community.oracle.com/thread/463791?start=0&tstart=0)
But they are advanced for my understanding. I mean both appear to be same i.e. saving data like a "Save" action. If we rol... | 2015/12/28 | [
"https://dba.stackexchange.com/questions/124697",
"https://dba.stackexchange.com",
"https://dba.stackexchange.com/users/34059/"
] | A [commit](https://docs.oracle.com/cd/B19306_01/server.102/b14200/statements_4010.htm) is a user initiated action that tells the database (Oracle in this case) that the transaction is completed and that the changes may be committed and any locks/resources released. Normally the changes are committed to in memory data b... | Commit: its an **action performed by user** to let database instance know that transaction is completed and correct, and it can not be rolled back.
Checkpoint: after performing a commit, instance will perform action to change system change number (SCN) that already committed to store it (data ) in a block(s) and dataf... |
124,697 | I was confused about the difference between a commit operation and a checkpoint. I referred to some of the articles like [This Article](https://community.oracle.com/thread/463791?start=0&tstart=0)
But they are advanced for my understanding. I mean both appear to be same i.e. saving data like a "Save" action. If we rol... | 2015/12/28 | [
"https://dba.stackexchange.com/questions/124697",
"https://dba.stackexchange.com",
"https://dba.stackexchange.com/users/34059/"
] | Commit: its an **action performed by user** to let database instance know that transaction is completed and correct, and it can not be rolled back.
Checkpoint: after performing a commit, instance will perform action to change system change number (SCN) that already committed to store it (data ) in a block(s) and dataf... | To complete some of the previous answers:
A commit will end the current transaction in the current section. It will guarantee the consistency of the data that was "touched" during the transaction.
A checkpoint writes all commited changes to disk up to some SCN that willl be kept in the control file and datafile head... |
124,697 | I was confused about the difference between a commit operation and a checkpoint. I referred to some of the articles like [This Article](https://community.oracle.com/thread/463791?start=0&tstart=0)
But they are advanced for my understanding. I mean both appear to be same i.e. saving data like a "Save" action. If we rol... | 2015/12/28 | [
"https://dba.stackexchange.com/questions/124697",
"https://dba.stackexchange.com",
"https://dba.stackexchange.com/users/34059/"
] | A [commit](https://docs.oracle.com/cd/B19306_01/server.102/b14200/statements_4010.htm) is a user initiated action that tells the database (Oracle in this case) that the transaction is completed and that the changes may be committed and any locks/resources released. Normally the changes are committed to in memory data b... | To complete some of the previous answers:
A commit will end the current transaction in the current section. It will guarantee the consistency of the data that was "touched" during the transaction.
A checkpoint writes all commited changes to disk up to some SCN that willl be kept in the control file and datafile head... |
45,179 | I understand how those tree's work separately, but i can't imagine how to put it in one structure.
From ethereum's wiki:
>
> All substantial quantities of data in Ethereum are stored in a data structure known as the Patricia Merkle tree, a tree structure where each node in the tree is the hash of its children. Each ... | 2018/04/09 | [
"https://ethereum.stackexchange.com/questions/45179",
"https://ethereum.stackexchange.com",
"https://ethereum.stackexchange.com/users/37559/"
] | In Ethereum, the data structure is a Modified Merkle Patricia Trie
**Merkle**:
===========
The merkle part of the tree means that the hash of the children used by the parent to ensure the entire tree is cryptographically proven to be immutable.
In the above example,
1. the rootHash points to hashA
2. hashA, in tur... | All nodes from modified patricia tree are stored in flat key value LevelDB like so sha3(rlp(node)). Then extension node store hash from levelDB in value as reference to other node. Very good explanation [here](https://easythereentropy.wordpress.com/2014/06/04/understanding-the-ethereum-trie/) |
20,668,496 | I am following [this](http://www.androidhive.info/2013/08/android-working-with-google-maps-v2/) tutorial. Here are all my related files:
activity\_main.xml
```
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
an... | 2013/12/18 | [
"https://Stackoverflow.com/questions/20668496",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1662800/"
] | You need to have two `meta-data` fields. One is required for google play services in general, the second one on top for using maps.
Example snippet from the sample application you should have in `[android-sdk]/extras/google/google_play_services/samples/maps/AndroidManifest.xml`
```
<application
android:icon="@d... | you need
```
<application..>
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="KEY" />
...
</application>
``` |
20,668,496 | I am following [this](http://www.androidhive.info/2013/08/android-working-with-google-maps-v2/) tutorial. Here are all my related files:
activity\_main.xml
```
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
an... | 2013/12/18 | [
"https://Stackoverflow.com/questions/20668496",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1662800/"
] | you need
```
<application..>
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="KEY" />
...
</application>
``` | You need do give External Storage permission with both meta-data:
```
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<application
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
<meta... |
20,668,496 | I am following [this](http://www.androidhive.info/2013/08/android-working-with-google-maps-v2/) tutorial. Here are all my related files:
activity\_main.xml
```
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
an... | 2013/12/18 | [
"https://Stackoverflow.com/questions/20668496",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1662800/"
] | You need to have two `meta-data` fields. One is required for google play services in general, the second one on top for using maps.
Example snippet from the sample application you should have in `[android-sdk]/extras/google/google_play_services/samples/maps/AndroidManifest.xml`
```
<application
android:icon="@d... | You need do give External Storage permission with both meta-data:
```
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<application
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
<meta... |
72,291,901 | I am trying to change a column's datatype. The column of type VARCHAR has thousands of GUID values like look those shown below:
```
b1f4ff32-48d4-494e-a32c-044014cea9
bc5a1158-b310-49ff-a1f3-09d4f8707f69
4b7ebc9d-9fa1-42d9-811e-0b7b4b7297a
fc7ba848-98ea-4bc6-add7-11f0ee9c6917a21
485741ff-2ab2-4705-91b3-136389948b7c
`... | 2022/05/18 | [
"https://Stackoverflow.com/questions/72291901",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19026985/"
] | If you change the data type SQL Server will first check if *all* the values in the columns can be implicitly converted to the new data type; if they cannot then the `ALTER` will fail. If they can, then they will be implicitly converted and the `ALTER` will be successful (assuming no dependencies of course).
For a `uni... | The **uniqueidentifier** type is considered a character type for the purposes of conversion from a character expression, and therefore is subject to the truncation rules for converting to a character type.
**Also there are limitations, uniqueidentifier type is limited to 36 char**
So if you decide to truncate the tab... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.