qid int64 1 74.7M | question stringlengths 0 58.3k | date stringlengths 10 10 | metadata list | response_j stringlengths 2 48.3k | response_k stringlengths 2 40.5k |
|---|---|---|---|---|---|
4,170,185 | Let $Y\_n \sim \text{Gamma}(n, λ)$ where $n$ is an integer. As $n$ goes to infinity, find the asymptotic distribution of
\begin{equation\*}
\sqrt{n}(\log(Y\_n/n) - \log(1/\lambda))
\end{equation\*}
I tried to write Gamma as a sum of exponential random variables as a tool but still have no thoughts on this problem... I... | 2021/06/11 | [
"https://math.stackexchange.com/questions/4170185",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/940008/"
] | Yes, you are right. Let $X\_1,...,X\_n$ be and iid $Exp(\lambda)$r.v.s, hence
$$
Y\_n/n = \frac{1}{n}\sum\_{i=1}^n X\_i \sim Gamma(n, \lambda)
$$
thus by the CLT
$$
\sqrt{n} ( Y\_n/n - E[X]) \xrightarrow{D}N(0, Var(X)).
$$
Note that $E[X] = 1/\lambda$, and $Var(X) = 1/\lambda^2$. Using the delta method with $g(x) = \l... | From the central limit theorem $\frac Yn\approx \mathcal N(\frac 1 \lambda, \frac 1 {n\lambda^2})$ so $\sqrt n \lambda\left(\frac Yn-\frac 1 \lambda\right)\approx \mathcal N(0, 1)$. We apply the delta method with $\alpha(\mu)=\log \mu$. Then $\alpha'(\mu)=\frac 1\mu$ and $\alpha'(\frac 1 \lambda)=\lambda$. So the delta... |
10,019,201 | I get a large list of data to populate into a jqGrid on my clientside.
```
List<MyData> lotsOfRecords = getData();
```
Which I then store in cache, since a lot of people will be using it:
```
Cache["SharedData"].Add(lotsOfRecords);
```
This grid allows users to check records for processing. I want to persist whic... | 2012/04/04 | [
"https://Stackoverflow.com/questions/10019201",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/186643/"
] | D3 allows to use zoom and it's fairly easy to implement. You'll only need to wrap your graph inside a "g" element that I'll call "viewport". Then you'll assign to the zoom event of the svg element:
```
svg.call(d3.behavior.zoom().on("zoom", redraw))
```
the following function:
```
function redraw() {
d3.select(... | ```
var x, y, k;
if (d && centered !== d) {
var centroid = path.centroid(d);
x = centroid[0];
y = centroid[1];
k = 4;
centered = d;
} else {
x = w / 2;
y = h / 2;
k = 1... |
83,045 | Let's say I have some layers and a single different one, or a group of layers I want to export merged together, in a way that every single exported layer is merged with a specific layer or group of layers.
In the example below I have some layers which need to be exported into JPG or PNG, merged with the very top layer... | 2017/01/11 | [
"https://graphicdesign.stackexchange.com/questions/83045",
"https://graphicdesign.stackexchange.com",
"https://graphicdesign.stackexchange.com/users/33194/"
] | How about this method:
We have a text layer on top and 3 coloured layers beneath:
[](https://i.stack.imgur.com/b3jBD.png)
Open the Timeline panel and select "Make Frames From Layers" from the menu.
Delete the last frame, select all the remaining frames and turn on t... | [](https://i.stack.imgur.com/wSwFV.png)
Maybe you can create groups for both layers "layer 10" and "Jan 8" and copy paste Blurred layer inside of them, that way if you make a change in blurred smart object it gonna appear on both groups, then just... |
7,171,570 | I have been working on an application, which was running absolutely fine before i switched to another application. After few days when i came to work on my previous application, I am getting this particular error while launching the emulator for it. This error is as follows:
```
[2011-08-24 11:46:06 - Emulator] invali... | 2011/08/24 | [
"https://Stackoverflow.com/questions/7171570",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/820443/"
] | Spaces may be contained in the installation path of Android SDK.
You may move it under a path with no space in it.
[unable-to-start-the-android-virtual-avd-device](https://stackoverflow.com/questions/7156463/unable-to-start-the-android-virtual-avd-device/7156528#7156528) | change the path of the SDK. put SDK directly in the drive ie. **"d:\Android\android-sdk-tools"**
note: make sure that there is no space in parent path |
7,171,570 | I have been working on an application, which was running absolutely fine before i switched to another application. After few days when i came to work on my previous application, I am getting this particular error while launching the emulator for it. This error is as follows:
```
[2011-08-24 11:46:06 - Emulator] invali... | 2011/08/24 | [
"https://Stackoverflow.com/questions/7171570",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/820443/"
] | Spaces may be contained in the installation path of Android SDK.
You may move it under a path with no space in it.
[unable-to-start-the-android-virtual-avd-device](https://stackoverflow.com/questions/7156463/unable-to-start-the-android-virtual-avd-device/7156528#7156528) | This really was a little but extremely teasing one, but i got the answer myself.
Just got to eclipse > open android sdk and avd manager > select the required avd > start and check the wipe userdata box.
This worked for me, hope this works for others as well...:-) |
107,341 | <https://www.google.com/search?q=western+musical+instruments>
Will it be very few western musical instruments that can be played by human beings with one hand only?
Example : Mouth organ. | 2020/11/07 | [
"https://music.stackexchange.com/questions/107341",
"https://music.stackexchange.com",
"https://music.stackexchange.com/users/71313/"
] | Bugles are one-handed. Trumpets, tenor and French horns would be playable to *some* extent. The pipe of a pipe and tabor! Flexatones are lovely things. I've seen virtuoso bass guitarists play whole pieces with one hand.
At [OHMI](https://www.ohmi.org.uk/instruments.html) (One handed musical Instruments) there are all ... | Keyboard instruments such as piano, plucking instruments such as harp, .... many can be played with one hand only. |
107,341 | <https://www.google.com/search?q=western+musical+instruments>
Will it be very few western musical instruments that can be played by human beings with one hand only?
Example : Mouth organ. | 2020/11/07 | [
"https://music.stackexchange.com/questions/107341",
"https://music.stackexchange.com",
"https://music.stackexchange.com/users/71313/"
] | Bugles are one-handed. Trumpets, tenor and French horns would be playable to *some* extent. The pipe of a pipe and tabor! Flexatones are lovely things. I've seen virtuoso bass guitarists play whole pieces with one hand.
At [OHMI](https://www.ohmi.org.uk/instruments.html) (One handed musical Instruments) there are all ... | Drums. Rick Allen, the drummer with Def Leppard, lost an arm in a car crash may years ago, but has carried on ever since (using an adapted kit, but nothing that any drummer couldn't put together using midi) |
107,341 | <https://www.google.com/search?q=western+musical+instruments>
Will it be very few western musical instruments that can be played by human beings with one hand only?
Example : Mouth organ. | 2020/11/07 | [
"https://music.stackexchange.com/questions/107341",
"https://music.stackexchange.com",
"https://music.stackexchange.com/users/71313/"
] | Bugles are one-handed. Trumpets, tenor and French horns would be playable to *some* extent. The pipe of a pipe and tabor! Flexatones are lovely things. I've seen virtuoso bass guitarists play whole pieces with one hand.
At [OHMI](https://www.ohmi.org.uk/instruments.html) (One handed musical Instruments) there are all ... | Three hole pipe. Usually used in conjunction with a drum to form the pipe and tabor, but the pipe part is a one-hander |
107,341 | <https://www.google.com/search?q=western+musical+instruments>
Will it be very few western musical instruments that can be played by human beings with one hand only?
Example : Mouth organ. | 2020/11/07 | [
"https://music.stackexchange.com/questions/107341",
"https://music.stackexchange.com",
"https://music.stackexchange.com/users/71313/"
] | Keyboard instruments such as piano, plucking instruments such as harp, .... many can be played with one hand only. | Three hole pipe. Usually used in conjunction with a drum to form the pipe and tabor, but the pipe part is a one-hander |
107,341 | <https://www.google.com/search?q=western+musical+instruments>
Will it be very few western musical instruments that can be played by human beings with one hand only?
Example : Mouth organ. | 2020/11/07 | [
"https://music.stackexchange.com/questions/107341",
"https://music.stackexchange.com",
"https://music.stackexchange.com/users/71313/"
] | Drums. Rick Allen, the drummer with Def Leppard, lost an arm in a car crash may years ago, but has carried on ever since (using an adapted kit, but nothing that any drummer couldn't put together using midi) | Three hole pipe. Usually used in conjunction with a drum to form the pipe and tabor, but the pipe part is a one-hander |
35,330,576 | I'm trying to use ng-switch in AngularJS to expand a row in a table list to show another table (containing more details about that list item) when it's clicked.
However, I'm having trouble displaying the nested table. I've noticed that the problem only happens with nested tables. If I'm using ng-switch to expand a td ... | 2016/02/11 | [
"https://Stackoverflow.com/questions/35330576",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2478019/"
] | Check the article about the [Test Context](http://blog.roboblob.com/2014/01/16/introducing-the-unit-testing-context-pattern/) pattern. You can have mocks as local variables and customize their setup in the test context class. Then it's safe to run them in parallel. I use this pattern in Java with JUnit+Mockito and in .... | You need to use the parameterized unit testing. InlineData attribute of xUnit test framework can be used. The mock doesn't need to be set in the setup method in this case. It can be set directly in the actual test method. Your test method would look like below
```
[Theory]
[InlineData(false)]
[InlineData(true)]
public... |
48,488,211 | I'm newbie to JPA world and have a misunderstanding of JPA and HIBERNATE and its relationships with Spring Data, can you guys tell me is the Spring Data is a specification like JPA or a implementation of JPA, if this is true where is HIBERNATE ? and why we have this (springframwork)
```
import org.springframework.data... | 2018/01/28 | [
"https://Stackoverflow.com/questions/48488211",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9264350/"
] | The problem is that even though the `.Hats` divs *are* correctly styled, that is, they are 200x200px as you say in the CSS, the image elements you're putting inside of them are larger.
[](https://i.stack.imgur.com/TnHJl.png)
Even though the images ar... | This would not work.
```
$(tblRow).appendTo(".Hats2");
```
You are supposed to put
```
$(tblRow).appendTo($(".Hats2"));
``` |
48,488,211 | I'm newbie to JPA world and have a misunderstanding of JPA and HIBERNATE and its relationships with Spring Data, can you guys tell me is the Spring Data is a specification like JPA or a implementation of JPA, if this is true where is HIBERNATE ? and why we have this (springframwork)
```
import org.springframework.data... | 2018/01/28 | [
"https://Stackoverflow.com/questions/48488211",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9264350/"
] | The problem is that even though the `.Hats` divs *are* correctly styled, that is, they are 200x200px as you say in the CSS, the image elements you're putting inside of them are larger.
[](https://i.stack.imgur.com/TnHJl.png)
Even though the images ar... | You should assign the Hats class to img instead, like this:
```
$(function() {
var products = []
$.getJSON('test.json', function(data) {
$.each(data.products, function(i, f) {
var tblRow = '<div><img class="Hats" src=' + f.imUrl + '></div>'
$(tblRow).appendTo(".Hats2");
})
$(".Hats").css(... |
19,202,320 | We are using JIRA and Github together. Now we found out some code we can see in the JIRA tickets has already been pushed to Github at sometime before, and we can click on link, it goes to Github and we can see the changes we made there. But all the code are not in our current branches. And even I go to the local projec... | 2013/10/05 | [
"https://Stackoverflow.com/questions/19202320",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2664450/"
] | You can simplify your search:
```
git branch --remote --contains <commit-id>
```
(See [How to list branches that contain a given commit?](https://stackoverflow.com/questions/1419623/how-to-list-branches-that-contain-a-given-commit))
To get those changes, you can merge that commit into a working branch (`git merge <... | It can happen when:
* you rebase a branch, which rewrites all the sha1 (you keep the old sha1 in your reflogs)
* you delete a branch (and push the deletion of that branch)
* you [`merge --squash` a branch](https://stackoverflow.com/a/2427520/6309) in (for instance) `master`, and then delete that branch locally
If you... |
30,483,489 | I have a asn.1 file whose content is unknown as I am unable to read it properly.
I found some answer in stackoverflow but i have some doubt regarding this.
```
public static void main(String[] args) throws IOException {
ASN1InputStream ais = new ASN1InputStream( new FileInputStream(new File("asnfile")));
while... | 2015/05/27 | [
"https://Stackoverflow.com/questions/30483489",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3556061/"
] | You appear to be using the Bouncy Castle ASN1 reading class. That is a very well-regarded library; it's quite unlikely that it produces the wrong answer. So, it seems, the answer to your question is that you are already using the right tool. Why don't you find a tool that just dumps ASN.1 files outside of Java and comp... | You got a string dump of encoded stream and just use the following cod snippet (i have not altered as per your answer just understand the following code then you can do it)
While writing this code i use to read a block of 2048 stream every time
```
ASN1InputStream bIn = null;
Object decodedObj = null;
while ((len ... |
24,029,581 | Working through The Swift Programming Language, I was surprised to see that, unlike structures and enumerations, classes do not support stored type properties.
This is a common feature of other OO languages so I assume there was a good reason they decided not to allow it. But I'm not able to guess what that reason is,... | 2014/06/04 | [
"https://Stackoverflow.com/questions/24029581",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1321120/"
] | The compiler error is "Class variables not yet supported" so it seems like they just haven't implemented it yet. | >
> “For value types (that is, structures and enumerations), you can define stored and computed type properties. For classes, you can define computed type properties only."
>
>
> Excerpt From: Apple Inc. “The Swift Programming Language.” iBooks. <https://itun.es/cn/jEUH0.l>
>
>
>
I think it's easy for Apple's En... |
24,029,581 | Working through The Swift Programming Language, I was surprised to see that, unlike structures and enumerations, classes do not support stored type properties.
This is a common feature of other OO languages so I assume there was a good reason they decided not to allow it. But I'm not able to guess what that reason is,... | 2014/06/04 | [
"https://Stackoverflow.com/questions/24029581",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1321120/"
] | The compiler error is "Class variables not yet supported" so it seems like they just haven't implemented it yet. | Extending the OP's *nested struct trick* for simulating *stored type properties*, you can go further and make it look like a pure *stored type property* from outside the class.
Use a computed *getter* and *setter* pair like:
```
class ClassWithTypeProperty
{
struct StoredTypeProperties
{
static var aT... |
24,029,581 | Working through The Swift Programming Language, I was surprised to see that, unlike structures and enumerations, classes do not support stored type properties.
This is a common feature of other OO languages so I assume there was a good reason they decided not to allow it. But I'm not able to guess what that reason is,... | 2014/06/04 | [
"https://Stackoverflow.com/questions/24029581",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1321120/"
] | Extending the OP's *nested struct trick* for simulating *stored type properties*, you can go further and make it look like a pure *stored type property* from outside the class.
Use a computed *getter* and *setter* pair like:
```
class ClassWithTypeProperty
{
struct StoredTypeProperties
{
static var aT... | >
> “For value types (that is, structures and enumerations), you can define stored and computed type properties. For classes, you can define computed type properties only."
>
>
> Excerpt From: Apple Inc. “The Swift Programming Language.” iBooks. <https://itun.es/cn/jEUH0.l>
>
>
>
I think it's easy for Apple's En... |
849,215 | I have several thousand files in one directory that I would like to collate in directories like so:
From this:
```
└── Files
├── AAA.mkv
├── AAA.nfo
├── AAA-picture.jpg
├── BBB.mp4
├── BBB.srt
├── BBB-clip.mp4
├── CCC.avi
├── CCC.srt
├── CCC-clip.mov
└── CCC.nfo
```
To this:
... | 2016/11/14 | [
"https://askubuntu.com/questions/849215",
"https://askubuntu.com",
"https://askubuntu.com/users/618840/"
] | While your question is tagged with `bash`, this would be somewhat troublesome ( in my humble opinion ) to use `bash` for such task. I'd suggest using python because it has a lot of good functions for complex tasks and this answer provides a solution using that language.
Essentially what occurs here is that we use rege... | On a small python script:
```py
#!/usr/bin/env python3
import shutil
import os
import sys
dr = sys.argv[1]
for f in os.listdir(dr):
split = f.rfind("."); short = f.find("-")
if split != -1:
extension = f[split:]
newname = f[:short] if short != -1 else f[:split]
target = os.path.join(d... |
849,215 | I have several thousand files in one directory that I would like to collate in directories like so:
From this:
```
└── Files
├── AAA.mkv
├── AAA.nfo
├── AAA-picture.jpg
├── BBB.mp4
├── BBB.srt
├── BBB-clip.mp4
├── CCC.avi
├── CCC.srt
├── CCC-clip.mov
└── CCC.nfo
```
To this:
... | 2016/11/14 | [
"https://askubuntu.com/questions/849215",
"https://askubuntu.com",
"https://askubuntu.com/users/618840/"
] | While your question is tagged with `bash`, this would be somewhat troublesome ( in my humble opinion ) to use `bash` for such task. I'd suggest using python because it has a lot of good functions for complex tasks and this answer provides a solution using that language.
Essentially what occurs here is that we use rege... | I made a small bash script to do this, simplified and improved thanks to comments from OP, @dannysauer, @Arronical and @Scott
```
#!/bin/bash
for file in *
do mkdir -p "${file%%[.-]*}" 2>/dev/null
if [[ -d "${file%%[.-]*}" ]]; then
if [[ -f "$file" ]]; then
echo mv -v -- "$file" "${file%%[.-]*}"
... |
67,276,071 | I want to combine two random number generator.
I want to generate *size = 20* random integers between [-5,5] and a fixed integer -999.
I tried following code:
```
from random import randint, choice
import numpy as np
np.random.seed(1)
dd = np.array([choice([randint(-999,-999),randint(-5,5)]) for _ in range(20)])
p... | 2021/04/27 | [
"https://Stackoverflow.com/questions/67276071",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9942021/"
] | Your solution yields approximately 50% of the cases -999 and the rest a number in [-5, 5]. This is because choice has to choose between -999 and X (where X is a number previously defined by randint, between -5 and 5). If you want every number to have the same probability of being chosen try the following proposed solut... | Currently its choosing between -999 and random number between -5 and 5 on each iteration. So you would expect 50% of results to be -999.
One way would be to first define a list of choices
```
choices = list(range(-5,5))+ [-999]
```
Then, do the sampling using np.random.choice instead of a for loop list comprehensio... |
7,644,361 | I have made a control which has a property that is calculated by using a few other properties as input. When any of these input properties change, the property needs to be updated. I already have made this possible through implementing property-changed events for them, marking the dependent property as updated. Changin... | 2011/10/04 | [
"https://Stackoverflow.com/questions/7644361",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/977918/"
] | You can postpone raising the property changed event. Or create a method that will stop propagating this event (i.e. `StartUpdating`) and another method that will fire all the events (i.e. `EndUpdating`).
```
private bool _isUpdating;
private List<string> _properties = ...;
private void RaisePropertyChanged(string pro... | Take a look at the binding's [IsAsync](http://msdn.microsoft.com/en-us/library/system.windows.data.binding.isasync.aspx) property. I imagine it could work in combination with a [debounce](http://ajaxian.com/archives/debounce-your-javascript-functions) like pattern. |
30,876,396 | I am busy writing a javascript/jquery based version of the game Battleship. In my overview-screen I have a list of games. What I would like to do, is that every time when I select (click on) a list-item, the background-color of the list-item changes and the selected item is saved in a variable and when I select another... | 2015/06/16 | [
"https://Stackoverflow.com/questions/30876396",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3473161/"
] | You don't need to [`.each()`](http://api.jquery.com/each/) to bind event and use `.css()`. jQuery doest it for you. Also since `.css()` is a jQuery method you need to convert `this` into jQuery object.
```
this.setListenerForElementsInGameList = function() {
$('#game-list li').click(this.event_selectGameFromList);... | This is a better way to solve the problem, since using css classes is better than modifying css directly in javascript. Also you would be able to do more styling than just change the background for the selected item.
I have also modified some of the javascript eliminating unnecessary foreach loops.
```
this.setListen... |
30,876,396 | I am busy writing a javascript/jquery based version of the game Battleship. In my overview-screen I have a list of games. What I would like to do, is that every time when I select (click on) a list-item, the background-color of the list-item changes and the selected item is saved in a variable and when I select another... | 2015/06/16 | [
"https://Stackoverflow.com/questions/30876396",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3473161/"
] | You don't need to [`.each()`](http://api.jquery.com/each/) to bind event and use `.css()`. jQuery doest it for you. Also since `.css()` is a jQuery method you need to convert `this` into jQuery object.
```
this.setListenerForElementsInGameList = function() {
$('#game-list li').click(this.event_selectGameFromList);... | Use an immediate function with a closure to store the reference:
```js
(function() {
var prevLi = null;
$('li').on('click', function() {
var that = $(this);
that.css("background-color", "#39B7CD");
if (prevLi) {
prevLi.css("background-color", "#FFF");
};
prevLi = that;
});
}()... |
30,876,396 | I am busy writing a javascript/jquery based version of the game Battleship. In my overview-screen I have a list of games. What I would like to do, is that every time when I select (click on) a list-item, the background-color of the list-item changes and the selected item is saved in a variable and when I select another... | 2015/06/16 | [
"https://Stackoverflow.com/questions/30876396",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3473161/"
] | Use an immediate function with a closure to store the reference:
```js
(function() {
var prevLi = null;
$('li').on('click', function() {
var that = $(this);
that.css("background-color", "#39B7CD");
if (prevLi) {
prevLi.css("background-color", "#FFF");
};
prevLi = that;
});
}()... | This is a better way to solve the problem, since using css classes is better than modifying css directly in javascript. Also you would be able to do more styling than just change the background for the selected item.
I have also modified some of the javascript eliminating unnecessary foreach loops.
```
this.setListen... |
179,113 | I am currently studying for an exam and trying to check a message (binary) for errors using a polynomial, I would like if somebody could verify that my results below are (in)valid.
Thanks.
```
Message: 11110101 11110101
Polynomial: X4 + x2 + 1
Divisor (Derived from polynomial): 10101
Remainder:111
Result: There is an... | 2012/08/05 | [
"https://math.stackexchange.com/questions/179113",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/37271/"
] | ```
1111010111110101 | 10101
+10101 | 11001011101
10111 |
+10101 |
10011 |
+10101 |
11011 |
+10101 |
11101 |
+10101 |
10000 |
+10101 |
10110 |
+10101 |
111 ... | Mathematica gave me the same result:
>
> În[1]:=s=x^7+x^6+x^5+x^4+x^2+1;
>
>
> In[2]:=PolynomialRemainder[(1+x^8)s, 1+x^2+x^4,x]
>
>
> Out[2]:= 1+x+x^2
>
>
>
So there wasn't even any need to reduce the coefficients modulo two in the end.
I don't know whether Wolfram Alpha supports this. Anyway, you got it rig... |
6,449,524 | I'm using the bash and vim that come with msysgit. I've added the `.vimrc` file to my home folder and most of the commands there are executing. But `syntax on` is not.
This is the contents of my `~/.vimrc` file:
```
set cul
hi CursorLine cterm=none ctermbg=darkgray ctermfg=white
syntax on
```
The current line and h... | 2011/06/23 | [
"https://Stackoverflow.com/questions/6449524",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1864976/"
] | 1. search and download [`sh.vim`](http://www.vim.org/scripts/script.php?script_id=1632) via google or anything else you prefer to.
2. move sh.vim to `$HOME/vimfiles/syntax/` directory, then when you open a shell script it'll take effect for that.
<http://vimdoc.sourceforge.net/htmldoc/usr_44.html#44.11> | Have you tried enabling the filetype plugin?
```
:filetype plugin on
```
Then, if your script syntax still doesn't colorize properly, try manual override:
```
:set ft=sh
``` |
6,449,524 | I'm using the bash and vim that come with msysgit. I've added the `.vimrc` file to my home folder and most of the commands there are executing. But `syntax on` is not.
This is the contents of my `~/.vimrc` file:
```
set cul
hi CursorLine cterm=none ctermbg=darkgray ctermfg=white
syntax on
```
The current line and h... | 2011/06/23 | [
"https://Stackoverflow.com/questions/6449524",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1864976/"
] | 1. search and download [`sh.vim`](http://www.vim.org/scripts/script.php?script_id=1632) via google or anything else you prefer to.
2. move sh.vim to `$HOME/vimfiles/syntax/` directory, then when you open a shell script it'll take effect for that.
<http://vimdoc.sourceforge.net/htmldoc/usr_44.html#44.11> | I'm not familiar with msysgit, but to answer your final question:
>
> how can I change my .vimrc file to load up a bash.vim file
>
>
>
you should be able to add:
```
if filereadable(expand("$HOME/some/path/bash.vim"))
execute "source " . "$HOME/some/path/bash.vim"
endif
```
This might be useful if you have... |
6,449,524 | I'm using the bash and vim that come with msysgit. I've added the `.vimrc` file to my home folder and most of the commands there are executing. But `syntax on` is not.
This is the contents of my `~/.vimrc` file:
```
set cul
hi CursorLine cterm=none ctermbg=darkgray ctermfg=white
syntax on
```
The current line and h... | 2011/06/23 | [
"https://Stackoverflow.com/questions/6449524",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1864976/"
] | 1. search and download [`sh.vim`](http://www.vim.org/scripts/script.php?script_id=1632) via google or anything else you prefer to.
2. move sh.vim to `$HOME/vimfiles/syntax/` directory, then when you open a shell script it'll take effect for that.
<http://vimdoc.sourceforge.net/htmldoc/usr_44.html#44.11> | In my case deleting everything in ~/.vim/view helped. I had `mkview` under `autocmd`, so when I did not shut down vim and bash properly, I think some files got corrupted. I found this problem by moving the files that were giving me trouble in another directory and finding out that vim had no problem showing their synta... |
6,449,524 | I'm using the bash and vim that come with msysgit. I've added the `.vimrc` file to my home folder and most of the commands there are executing. But `syntax on` is not.
This is the contents of my `~/.vimrc` file:
```
set cul
hi CursorLine cterm=none ctermbg=darkgray ctermfg=white
syntax on
```
The current line and h... | 2011/06/23 | [
"https://Stackoverflow.com/questions/6449524",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1864976/"
] | Have you tried enabling the filetype plugin?
```
:filetype plugin on
```
Then, if your script syntax still doesn't colorize properly, try manual override:
```
:set ft=sh
``` | I'm not familiar with msysgit, but to answer your final question:
>
> how can I change my .vimrc file to load up a bash.vim file
>
>
>
you should be able to add:
```
if filereadable(expand("$HOME/some/path/bash.vim"))
execute "source " . "$HOME/some/path/bash.vim"
endif
```
This might be useful if you have... |
6,449,524 | I'm using the bash and vim that come with msysgit. I've added the `.vimrc` file to my home folder and most of the commands there are executing. But `syntax on` is not.
This is the contents of my `~/.vimrc` file:
```
set cul
hi CursorLine cterm=none ctermbg=darkgray ctermfg=white
syntax on
```
The current line and h... | 2011/06/23 | [
"https://Stackoverflow.com/questions/6449524",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1864976/"
] | Have you tried enabling the filetype plugin?
```
:filetype plugin on
```
Then, if your script syntax still doesn't colorize properly, try manual override:
```
:set ft=sh
``` | In my case deleting everything in ~/.vim/view helped. I had `mkview` under `autocmd`, so when I did not shut down vim and bash properly, I think some files got corrupted. I found this problem by moving the files that were giving me trouble in another directory and finding out that vim had no problem showing their synta... |
6,449,524 | I'm using the bash and vim that come with msysgit. I've added the `.vimrc` file to my home folder and most of the commands there are executing. But `syntax on` is not.
This is the contents of my `~/.vimrc` file:
```
set cul
hi CursorLine cterm=none ctermbg=darkgray ctermfg=white
syntax on
```
The current line and h... | 2011/06/23 | [
"https://Stackoverflow.com/questions/6449524",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1864976/"
] | I'm not familiar with msysgit, but to answer your final question:
>
> how can I change my .vimrc file to load up a bash.vim file
>
>
>
you should be able to add:
```
if filereadable(expand("$HOME/some/path/bash.vim"))
execute "source " . "$HOME/some/path/bash.vim"
endif
```
This might be useful if you have... | In my case deleting everything in ~/.vim/view helped. I had `mkview` under `autocmd`, so when I did not shut down vim and bash properly, I think some files got corrupted. I found this problem by moving the files that were giving me trouble in another directory and finding out that vim had no problem showing their synta... |
26,018,629 | So I have already exported data using a CSV file, but as of now it is just raw data. I am trying to dsiplay the file name that it is from and the Sheet name. Here is my code so far from exporting the data. The following macro exports the data from an open excel sheet, I just run the macro and exports the data into a ne... | 2014/09/24 | [
"https://Stackoverflow.com/questions/26018629",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4075015/"
] | I wrote this a while ago. It uses a Stack. It's generic, so it can be used for other sequences as well.
```
static IEnumerable<T[]> CombinationsAnyLength<T>(params T[] values)
{
Stack<int> stack = new Stack<int>(values.Length);
int i = 0;
while (stack.Count > 0 || i < values.Length) {
if (i < value... | Why not treat this as bits and generate the set from the bits?
```
IEnumberable<List<int>> MakeSets()
{
// count from 1 to 2^10 - 1 (if you want the empty set, start at 0
for (uint i=1; i < (1 << 10); i++) {
// enumerate the bits as elements in a set
List<int> set = BitsIn(i);
yield ret... |
26,018,629 | So I have already exported data using a CSV file, but as of now it is just raw data. I am trying to dsiplay the file name that it is from and the Sheet name. Here is my code so far from exporting the data. The following macro exports the data from an open excel sheet, I just run the macro and exports the data into a ne... | 2014/09/24 | [
"https://Stackoverflow.com/questions/26018629",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4075015/"
] | I wrote this a while ago. It uses a Stack. It's generic, so it can be used for other sequences as well.
```
static IEnumerable<T[]> CombinationsAnyLength<T>(params T[] values)
{
Stack<int> stack = new Stack<int>(values.Length);
int i = 0;
while (stack.Count > 0 || i < values.Length) {
if (i < value... | here is a algorithm for generating sub-sets.
let you have a set `S = [a,b,c,d,e,f]`.
and you want to generate all the subsets then length of the array containing all the sub-sets will be
`2^n` where `n` is number of elements in `S`.
```
int A = [] // array containing all sub-sets
for i = 0 --- 2^n
x = bina... |
26,018,629 | So I have already exported data using a CSV file, but as of now it is just raw data. I am trying to dsiplay the file name that it is from and the Sheet name. Here is my code so far from exporting the data. The following macro exports the data from an open excel sheet, I just run the macro and exports the data into a ne... | 2014/09/24 | [
"https://Stackoverflow.com/questions/26018629",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4075015/"
] | I wrote this a while ago. It uses a Stack. It's generic, so it can be used for other sequences as well.
```
static IEnumerable<T[]> CombinationsAnyLength<T>(params T[] values)
{
Stack<int> stack = new Stack<int>(values.Length);
int i = 0;
while (stack.Count > 0 || i < values.Length) {
if (i < value... | Using Dennis signature:
```
public static IEnumerable<T[]> CombinationsAnyLength<T>(params T[] values)
{
for(var i = 0; i < (1 << values.Length); i++)
{
var result = new List<T>();
for(var j = 0; j < values.Length; j++)
{
if(((1 << j) & i) != ... |
26,018,629 | So I have already exported data using a CSV file, but as of now it is just raw data. I am trying to dsiplay the file name that it is from and the Sheet name. Here is my code so far from exporting the data. The following macro exports the data from an open excel sheet, I just run the macro and exports the data into a ne... | 2014/09/24 | [
"https://Stackoverflow.com/questions/26018629",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4075015/"
] | Why not treat this as bits and generate the set from the bits?
```
IEnumberable<List<int>> MakeSets()
{
// count from 1 to 2^10 - 1 (if you want the empty set, start at 0
for (uint i=1; i < (1 << 10); i++) {
// enumerate the bits as elements in a set
List<int> set = BitsIn(i);
yield ret... | here is a algorithm for generating sub-sets.
let you have a set `S = [a,b,c,d,e,f]`.
and you want to generate all the subsets then length of the array containing all the sub-sets will be
`2^n` where `n` is number of elements in `S`.
```
int A = [] // array containing all sub-sets
for i = 0 --- 2^n
x = bina... |
26,018,629 | So I have already exported data using a CSV file, but as of now it is just raw data. I am trying to dsiplay the file name that it is from and the Sheet name. Here is my code so far from exporting the data. The following macro exports the data from an open excel sheet, I just run the macro and exports the data into a ne... | 2014/09/24 | [
"https://Stackoverflow.com/questions/26018629",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4075015/"
] | Why not treat this as bits and generate the set from the bits?
```
IEnumberable<List<int>> MakeSets()
{
// count from 1 to 2^10 - 1 (if you want the empty set, start at 0
for (uint i=1; i < (1 << 10); i++) {
// enumerate the bits as elements in a set
List<int> set = BitsIn(i);
yield ret... | Using Dennis signature:
```
public static IEnumerable<T[]> CombinationsAnyLength<T>(params T[] values)
{
for(var i = 0; i < (1 << values.Length); i++)
{
var result = new List<T>();
for(var j = 0; j < values.Length; j++)
{
if(((1 << j) & i) != ... |
26,018,629 | So I have already exported data using a CSV file, but as of now it is just raw data. I am trying to dsiplay the file name that it is from and the Sheet name. Here is my code so far from exporting the data. The following macro exports the data from an open excel sheet, I just run the macro and exports the data into a ne... | 2014/09/24 | [
"https://Stackoverflow.com/questions/26018629",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4075015/"
] | here is a algorithm for generating sub-sets.
let you have a set `S = [a,b,c,d,e,f]`.
and you want to generate all the subsets then length of the array containing all the sub-sets will be
`2^n` where `n` is number of elements in `S`.
```
int A = [] // array containing all sub-sets
for i = 0 --- 2^n
x = bina... | Using Dennis signature:
```
public static IEnumerable<T[]> CombinationsAnyLength<T>(params T[] values)
{
for(var i = 0; i < (1 << values.Length); i++)
{
var result = new List<T>();
for(var j = 0; j < values.Length; j++)
{
if(((1 << j) & i) != ... |
46,381,483 | How come you can set a get-only auto-property from a constructor? The code below shows how you can set the property from the constructor but using reflection shows that there really isn't a setter behind the scenes. How does it get set from the constructor call if the setter method doesn't even exist in the IL?
```
vo... | 2017/09/23 | [
"https://Stackoverflow.com/questions/46381483",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3832895/"
] | A read-only automatically-implemented property is converted by the compiler into a read-only field and a read-only property. Assignments to the property in the constructor are compiled as assignments to the underlying field.
So your code here:
```
public class GetOnlyProperty
{
public string Thing { get; }
p... | Because a read-only property should be assigned at a time or another, otherwise its value would always be the default value of the type, and it would be completely useless.
This is what constructors are for (beside other obvious reasons), to assign values to read-only fields. |
46,381,483 | How come you can set a get-only auto-property from a constructor? The code below shows how you can set the property from the constructor but using reflection shows that there really isn't a setter behind the scenes. How does it get set from the constructor call if the setter method doesn't even exist in the IL?
```
vo... | 2017/09/23 | [
"https://Stackoverflow.com/questions/46381483",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3832895/"
] | A read-only property (get only) has a backing `readonly` field, which as you probably know, can only be set in the constructor.
hence when you have `object Property { get; }`
this translates to
```
private readonly object _property;
public object get_Property(){return _property;}
```
and the compiler knows that if... | Because a read-only property should be assigned at a time or another, otherwise its value would always be the default value of the type, and it would be completely useless.
This is what constructors are for (beside other obvious reasons), to assign values to read-only fields. |
46,381,483 | How come you can set a get-only auto-property from a constructor? The code below shows how you can set the property from the constructor but using reflection shows that there really isn't a setter behind the scenes. How does it get set from the constructor call if the setter method doesn't even exist in the IL?
```
vo... | 2017/09/23 | [
"https://Stackoverflow.com/questions/46381483",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3832895/"
] | A read-only automatically-implemented property is converted by the compiler into a read-only field and a read-only property. Assignments to the property in the constructor are compiled as assignments to the underlying field.
So your code here:
```
public class GetOnlyProperty
{
public string Thing { get; }
p... | A read-only property (get only) has a backing `readonly` field, which as you probably know, can only be set in the constructor.
hence when you have `object Property { get; }`
this translates to
```
private readonly object _property;
public object get_Property(){return _property;}
```
and the compiler knows that if... |
19,217,465 | I'm tesitng a callback and it's adding unnecessary slashes which is impeding upon the API's ability to successfuly communicate with my server. Why is it appending these slashes and how can I remedy the situation? Code below:
```
<?php
$real_secret = 'cantletyousee';
$my_address = '16qVmcFj6EergwQuiXLqHucBC2BZzdpMfo'... | 2013/10/07 | [
"https://Stackoverflow.com/questions/19217465",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2825738/"
] | `\` is escape character , this won't affect your output.
From [PHP escape sequences](http://php.net/manual/en/regexp.reference.escape.php)
>
> The backslash character has several uses. Firstly, if it is followed
> by a non-alphanumeric character, it takes away any special meaning
> that character may have. This u... | If you want to remove the backslashes, you can use [str\_replace()](http://www.php.net/manual/en/function.str-replace.php)
```
$str2 = str_replace ('\\', '', $response);
```
By the way, I tried decoding your string with `json_decode()` and received the correct information (without the extra `\`) when doing var\_dump... |
3,211,105 | I cant find any clue, but I hope if I am able to show the sequence is monotone decreasing and bdd below then we are done.
**I can see the sequence us monotone decreasing, the only disturbing part which I can't is how to bdd below.**
*I've also checked that $f(1)=-1$, $f(2)>-1$ and so on.
But I'm unable to show for all... | 2019/05/02 | [
"https://math.stackexchange.com/questions/3211105",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/639336/"
] | Note that
\begin{align\*}
f(n)
&= \sum\_{k=1}^{n} \left( \frac{1}{\sqrt{k}} - 2(\sqrt{k} - \sqrt{k-1}) \right) \\
&= \sum\_{k=1}^{n} \left( \frac{1}{\sqrt{k}} - \frac{2}{\sqrt{k} + \sqrt{k-1}} \right) \\
&= \sum\_{k=1}^{n} \frac{\sqrt{k-1} - \sqrt{k}}{\sqrt{k}(\sqrt{k} + \sqrt{k-1})} \\
&= - \sum\_{k=1}^{n} \frac{1}{\... | HINT.-$f(x+h)-f(x)=2\sqrt x+\dfrac{1}{\sqrt{x+1}}+\dfrac{1}{\sqrt{x+2}}+\cdots+\dfrac{1}{\sqrt{x+h}}-2\sqrt{x+h}$.
It is easy enough to prove that $\lim\_{x\to\infty}(2\sqrt x-2\sqrt {x+h})=0$.
Then $\{f(n)\}\_{n\in\mathbb N}$ is a Cauchy sequence so it have a limit in $\mathbb R$. |
3,211,105 | I cant find any clue, but I hope if I am able to show the sequence is monotone decreasing and bdd below then we are done.
**I can see the sequence us monotone decreasing, the only disturbing part which I can't is how to bdd below.**
*I've also checked that $f(1)=-1$, $f(2)>-1$ and so on.
But I'm unable to show for all... | 2019/05/02 | [
"https://math.stackexchange.com/questions/3211105",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/639336/"
] | Note that
\begin{align\*}
f(n)
&= \sum\_{k=1}^{n} \left( \frac{1}{\sqrt{k}} - 2(\sqrt{k} - \sqrt{k-1}) \right) \\
&= \sum\_{k=1}^{n} \left( \frac{1}{\sqrt{k}} - \frac{2}{\sqrt{k} + \sqrt{k-1}} \right) \\
&= \sum\_{k=1}^{n} \frac{\sqrt{k-1} - \sqrt{k}}{\sqrt{k}(\sqrt{k} + \sqrt{k-1})} \\
&= - \sum\_{k=1}^{n} \frac{1}{\... | **Approach $\bf{1}$**
One way to bound such series is to note that
$$
\int\_n^{n+1}\frac{\mathrm{d}x}{\sqrt{x}}\le\frac1{\sqrt{n}}\le\int\_{n-1}^n\frac{\mathrm{d}x}{\sqrt{x}}
$$
Adding up the integrals is simple.
---
**Approach $\bf{2}$**
Another way is to note that
$$
2\sqrt{n+1}-2\sqrt{n\vphantom{+1}}=\frac2{\sqr... |
3,211,105 | I cant find any clue, but I hope if I am able to show the sequence is monotone decreasing and bdd below then we are done.
**I can see the sequence us monotone decreasing, the only disturbing part which I can't is how to bdd below.**
*I've also checked that $f(1)=-1$, $f(2)>-1$ and so on.
But I'm unable to show for all... | 2019/05/02 | [
"https://math.stackexchange.com/questions/3211105",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/639336/"
] | Note that
\begin{align\*}
f(n)
&= \sum\_{k=1}^{n} \left( \frac{1}{\sqrt{k}} - 2(\sqrt{k} - \sqrt{k-1}) \right) \\
&= \sum\_{k=1}^{n} \left( \frac{1}{\sqrt{k}} - \frac{2}{\sqrt{k} + \sqrt{k-1}} \right) \\
&= \sum\_{k=1}^{n} \frac{\sqrt{k-1} - \sqrt{k}}{\sqrt{k}(\sqrt{k} + \sqrt{k-1})} \\
&= - \sum\_{k=1}^{n} \frac{1}{\... | $\newcommand{\bbx}[1]{\,\bbox[15px,border:1px groove navy]{\displaystyle{#1}}\,}
\newcommand{\braces}[1]{\left\lbrace\,{#1}\,\right\rbrace}
\newcommand{\bracks}[1]{\left\lbrack\,{#1}\,\right\rbrack}
\newcommand{\dd}{\mathrm{d}}
\newcommand{\ds}[1]{\displaystyle{#1}}
\newcommand{\expo}[1]{\,\mathrm{e}^{#1}\,}
\new... |
3,211,105 | I cant find any clue, but I hope if I am able to show the sequence is monotone decreasing and bdd below then we are done.
**I can see the sequence us monotone decreasing, the only disturbing part which I can't is how to bdd below.**
*I've also checked that $f(1)=-1$, $f(2)>-1$ and so on.
But I'm unable to show for all... | 2019/05/02 | [
"https://math.stackexchange.com/questions/3211105",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/639336/"
] | Your expression is bounded below because it is decreasing, while
$$g(n)=1+1/\sqrt2+1/\sqrt3+\cdots +1/\sqrt n-2\sqrt { n +1 }$$
is smaller and increasing. You must prove the increasing and decreasing claims, of course.
The limit of both sequences is roughly $\; \; -1.46035 \; \; \; $ You can see this value early by pr... | HINT.-$f(x+h)-f(x)=2\sqrt x+\dfrac{1}{\sqrt{x+1}}+\dfrac{1}{\sqrt{x+2}}+\cdots+\dfrac{1}{\sqrt{x+h}}-2\sqrt{x+h}$.
It is easy enough to prove that $\lim\_{x\to\infty}(2\sqrt x-2\sqrt {x+h})=0$.
Then $\{f(n)\}\_{n\in\mathbb N}$ is a Cauchy sequence so it have a limit in $\mathbb R$. |
3,211,105 | I cant find any clue, but I hope if I am able to show the sequence is monotone decreasing and bdd below then we are done.
**I can see the sequence us monotone decreasing, the only disturbing part which I can't is how to bdd below.**
*I've also checked that $f(1)=-1$, $f(2)>-1$ and so on.
But I'm unable to show for all... | 2019/05/02 | [
"https://math.stackexchange.com/questions/3211105",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/639336/"
] | HINT.-$f(x+h)-f(x)=2\sqrt x+\dfrac{1}{\sqrt{x+1}}+\dfrac{1}{\sqrt{x+2}}+\cdots+\dfrac{1}{\sqrt{x+h}}-2\sqrt{x+h}$.
It is easy enough to prove that $\lim\_{x\to\infty}(2\sqrt x-2\sqrt {x+h})=0$.
Then $\{f(n)\}\_{n\in\mathbb N}$ is a Cauchy sequence so it have a limit in $\mathbb R$. | $\newcommand{\bbx}[1]{\,\bbox[15px,border:1px groove navy]{\displaystyle{#1}}\,}
\newcommand{\braces}[1]{\left\lbrace\,{#1}\,\right\rbrace}
\newcommand{\bracks}[1]{\left\lbrack\,{#1}\,\right\rbrack}
\newcommand{\dd}{\mathrm{d}}
\newcommand{\ds}[1]{\displaystyle{#1}}
\newcommand{\expo}[1]{\,\mathrm{e}^{#1}\,}
\new... |
3,211,105 | I cant find any clue, but I hope if I am able to show the sequence is monotone decreasing and bdd below then we are done.
**I can see the sequence us monotone decreasing, the only disturbing part which I can't is how to bdd below.**
*I've also checked that $f(1)=-1$, $f(2)>-1$ and so on.
But I'm unable to show for all... | 2019/05/02 | [
"https://math.stackexchange.com/questions/3211105",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/639336/"
] | Your expression is bounded below because it is decreasing, while
$$g(n)=1+1/\sqrt2+1/\sqrt3+\cdots +1/\sqrt n-2\sqrt { n +1 }$$
is smaller and increasing. You must prove the increasing and decreasing claims, of course.
The limit of both sequences is roughly $\; \; -1.46035 \; \; \; $ You can see this value early by pr... | **Approach $\bf{1}$**
One way to bound such series is to note that
$$
\int\_n^{n+1}\frac{\mathrm{d}x}{\sqrt{x}}\le\frac1{\sqrt{n}}\le\int\_{n-1}^n\frac{\mathrm{d}x}{\sqrt{x}}
$$
Adding up the integrals is simple.
---
**Approach $\bf{2}$**
Another way is to note that
$$
2\sqrt{n+1}-2\sqrt{n\vphantom{+1}}=\frac2{\sqr... |
3,211,105 | I cant find any clue, but I hope if I am able to show the sequence is monotone decreasing and bdd below then we are done.
**I can see the sequence us monotone decreasing, the only disturbing part which I can't is how to bdd below.**
*I've also checked that $f(1)=-1$, $f(2)>-1$ and so on.
But I'm unable to show for all... | 2019/05/02 | [
"https://math.stackexchange.com/questions/3211105",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/639336/"
] | Your expression is bounded below because it is decreasing, while
$$g(n)=1+1/\sqrt2+1/\sqrt3+\cdots +1/\sqrt n-2\sqrt { n +1 }$$
is smaller and increasing. You must prove the increasing and decreasing claims, of course.
The limit of both sequences is roughly $\; \; -1.46035 \; \; \; $ You can see this value early by pr... | $\newcommand{\bbx}[1]{\,\bbox[15px,border:1px groove navy]{\displaystyle{#1}}\,}
\newcommand{\braces}[1]{\left\lbrace\,{#1}\,\right\rbrace}
\newcommand{\bracks}[1]{\left\lbrack\,{#1}\,\right\rbrack}
\newcommand{\dd}{\mathrm{d}}
\newcommand{\ds}[1]{\displaystyle{#1}}
\newcommand{\expo}[1]{\,\mathrm{e}^{#1}\,}
\new... |
3,211,105 | I cant find any clue, but I hope if I am able to show the sequence is monotone decreasing and bdd below then we are done.
**I can see the sequence us monotone decreasing, the only disturbing part which I can't is how to bdd below.**
*I've also checked that $f(1)=-1$, $f(2)>-1$ and so on.
But I'm unable to show for all... | 2019/05/02 | [
"https://math.stackexchange.com/questions/3211105",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/639336/"
] | **Approach $\bf{1}$**
One way to bound such series is to note that
$$
\int\_n^{n+1}\frac{\mathrm{d}x}{\sqrt{x}}\le\frac1{\sqrt{n}}\le\int\_{n-1}^n\frac{\mathrm{d}x}{\sqrt{x}}
$$
Adding up the integrals is simple.
---
**Approach $\bf{2}$**
Another way is to note that
$$
2\sqrt{n+1}-2\sqrt{n\vphantom{+1}}=\frac2{\sqr... | $\newcommand{\bbx}[1]{\,\bbox[15px,border:1px groove navy]{\displaystyle{#1}}\,}
\newcommand{\braces}[1]{\left\lbrace\,{#1}\,\right\rbrace}
\newcommand{\bracks}[1]{\left\lbrack\,{#1}\,\right\rbrack}
\newcommand{\dd}{\mathrm{d}}
\newcommand{\ds}[1]{\displaystyle{#1}}
\newcommand{\expo}[1]{\,\mathrm{e}^{#1}\,}
\new... |
7,452,065 | I'm trying to figure out why this PHP script isn't creating the map I specify in the HTML. any ideas?
```
<!doctype html>
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<style>
html { height: 100% }
body { height: 100%; margin: 0; pa... | 2011/09/17 | [
"https://Stackoverflow.com/questions/7452065",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1382299/"
] | You also missing a bracket on the google js link. | I don't use PHP so I can't tell if there's anything wrong with that code. If you removed the PHP and hardcoded lat/lon values, does the map work? Maybe one problem could be just what values the form is posting with the latitude and longitude. You're not doing any sort of validation to ensure they are within acceptable ... |
7,452,065 | I'm trying to figure out why this PHP script isn't creating the map I specify in the HTML. any ideas?
```
<!doctype html>
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<style>
html { height: 100% }
body { height: 100%; margin: 0; pa... | 2011/09/17 | [
"https://Stackoverflow.com/questions/7452065",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1382299/"
] | Your `options` declaration syntax is messed up:
```
var options = {
zoom: 5,
center: latlng,
mapTypeId = google.maps.MapTypeId.TERRAIN // ERROR
};
```
Should be
```
var options = {
zoom: 5,
center: latlng,
mapTypeId: google.maps.MapTypeId.TERRAIN
};
``` | You also missing a bracket on the google js link. |
7,452,065 | I'm trying to figure out why this PHP script isn't creating the map I specify in the HTML. any ideas?
```
<!doctype html>
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<style>
html { height: 100% }
body { height: 100%; margin: 0; pa... | 2011/09/17 | [
"https://Stackoverflow.com/questions/7452065",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1382299/"
] | Your `options` declaration syntax is messed up:
```
var options = {
zoom: 5,
center: latlng,
mapTypeId = google.maps.MapTypeId.TERRAIN // ERROR
};
```
Should be
```
var options = {
zoom: 5,
center: latlng,
mapTypeId: google.maps.MapTypeId.TERRAIN
};
``` | I don't use PHP so I can't tell if there's anything wrong with that code. If you removed the PHP and hardcoded lat/lon values, does the map work? Maybe one problem could be just what values the form is posting with the latitude and longitude. You're not doing any sort of validation to ensure they are within acceptable ... |
58,535,494 | I have a URL `(https://example.com/myfile.txt)` of a file and I want to upload it to my bucket `(gs://my-sample-bucket)` on Google Cloud Storage.
What I am currently doing is:
1. Downloading the file to my system using the requests library.
2. Uploading that file to my bucket using python function.
Is there any wa... | 2019/10/24 | [
"https://Stackoverflow.com/questions/58535494",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6049429/"
] | You could use a positive lookahead to check for either a number with a decimal place with up to 6 digits after it or a string of 12 digits) and then match up to 13 characters in total:
```
^(?=\d*\.\d{0,6}$|\d{1,12}$).{1,13}$
```
For this input, the 2nd and 5th values will match:
```
1234567890123
123456.789012
123... | We could try using negative lookaheads:
```
^(?:(?!.*\.)(?!\d{13})|(?=.*\.)(?![0-9.]{14}))\d+(?:\.\d{1,6})?$
```
[Demo
----](https://regex101.com/r/GEMn0m/1)
Here is an explanation of the regex:
```
^(?: from the start of the string
(?!.*\.)(?!\d{13}) assert that no more than 12 dig... |
58,535,494 | I have a URL `(https://example.com/myfile.txt)` of a file and I want to upload it to my bucket `(gs://my-sample-bucket)` on Google Cloud Storage.
What I am currently doing is:
1. Downloading the file to my system using the requests library.
2. Uploading that file to my bucket using python function.
Is there any wa... | 2019/10/24 | [
"https://Stackoverflow.com/questions/58535494",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6049429/"
] | We could try using negative lookaheads:
```
^(?:(?!.*\.)(?!\d{13})|(?=.*\.)(?![0-9.]{14}))\d+(?:\.\d{1,6})?$
```
[Demo
----](https://regex101.com/r/GEMn0m/1)
Here is an explanation of the regex:
```
^(?: from the start of the string
(?!.*\.)(?!\d{13}) assert that no more than 12 dig... | **TL;DR;**
```
^(?!(?:\D*\d){13})\d*[.]?\d{0,6}$
^(?=(?:\D*\d){0,12}\D*$)\d*[.]?\d{0,6}$
```
You can use a simple positive lookahead approach: keep your pattern (if it works as you expect) and insert
```
(?=(?:\D*\d){0,x}\D*$)
```
right after `^` and change the `x` to the required amount of digits.
So, you may ... |
58,535,494 | I have a URL `(https://example.com/myfile.txt)` of a file and I want to upload it to my bucket `(gs://my-sample-bucket)` on Google Cloud Storage.
What I am currently doing is:
1. Downloading the file to my system using the requests library.
2. Uploading that file to my bucket using python function.
Is there any wa... | 2019/10/24 | [
"https://Stackoverflow.com/questions/58535494",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6049429/"
] | You could use a positive lookahead to check for either a number with a decimal place with up to 6 digits after it or a string of 12 digits) and then match up to 13 characters in total:
```
^(?=\d*\.\d{0,6}$|\d{1,12}$).{1,13}$
```
For this input, the 2nd and 5th values will match:
```
1234567890123
123456.789012
123... | **TL;DR;**
```
^(?!(?:\D*\d){13})\d*[.]?\d{0,6}$
^(?=(?:\D*\d){0,12}\D*$)\d*[.]?\d{0,6}$
```
You can use a simple positive lookahead approach: keep your pattern (if it works as you expect) and insert
```
(?=(?:\D*\d){0,x}\D*$)
```
right after `^` and change the `x` to the required amount of digits.
So, you may ... |
35,351,176 | I am trying to place my text in center of 5 concentric circle! Can anyone please help me! Below is my code. Suggest me what changes i am supposed to do to get it at the centre of circle. Thanks.
```
function circle(e, color, x, y, radius, startAngle, endAngle, clockwise) {
if (arguments.length < 9) re... | 2016/02/11 | [
"https://Stackoverflow.com/questions/35351176",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5915911/"
] | [](https://i.stack.imgur.com/VlOTr.png)
**Example code and a demo:**
1. Move to concentric centerpoint
2. Rotate from the centerpoint
3. Move x-right to the radius
4. Unrotate (so letters are upright);
5. Draw the number.
6. Reset all transforms to d... | I tried your code. First I realized that `radius` isn't defined anywhere. Well it's defined in `circle()` but your code at the bottom would not have access to it. The scope of a function parameter is limited to the function.
Also
```
e.fillText(num, radius, e);
```
I'm not sure what you're trying to do but you mig... |
11,658,526 | I have a list of 17 flat files that I'm trying to import into different data sets. All of the files have the same data step, so I'm trying to write a do while loop to import all the files.
I've been trying to adapt some code from here without success:
<http://www.sas.com/offices/europe/uk/support/sas-hints-tips/tips-e... | 2012/07/25 | [
"https://Stackoverflow.com/questions/11658526",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1552837/"
] | Welcome to SAS programming! The error message you got is a clue. "Open code" refers to statements that are executed directly by the SAS system. A `%do` statment is part of the **SAS Macro Language**, not "normal" SAS. A `%let` statement can be executed in open code and is use to create a `macro variable` (distinct from... | To convert your progma to macro, turn your macro variables declared by `LET` statement into macro arguments:
```
%macro readfile(n, pathin);
data retention&n;
infile &pathin;
<data step-->
run;
%mend;
```
A data step to repetitively call your macro.
Here the data included in `CARDS` statement, but also... |
53,007,905 | I'm using the latest version (16.6) of React with `react-router` (4.3.1) and trying to use code splitting using `React.Suspense`.
Although my routing is working and the code did split into several bundles loaded dynamically, I'm getting a warning about not returning a function, but an object to `Route`. My code:
```
... | 2018/10/26 | [
"https://Stackoverflow.com/questions/53007905",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1339219/"
] | Try using `render` prop instead of `component`
```
<Route path="/" render={()=> <Prime />} exact />
<Route path="/demo" render={()=> <Demo />} />
``` | This will be fixed in `react-router-dom` version 4.4+ as this [issue](https://github.com/ReactTraining/react-router/issues/6420) suggests
You can wait for the final release or if you don't want to change your code today,
you can install the beta version now by `yarn add react-router-dom@next` |
53,007,905 | I'm using the latest version (16.6) of React with `react-router` (4.3.1) and trying to use code splitting using `React.Suspense`.
Although my routing is working and the code did split into several bundles loaded dynamically, I'm getting a warning about not returning a function, but an object to `Route`. My code:
```
... | 2018/10/26 | [
"https://Stackoverflow.com/questions/53007905",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1339219/"
] | Try using `render` prop instead of `component`
```
<Route path="/" render={()=> <Prime />} exact />
<Route path="/demo" render={()=> <Demo />} />
``` | I know this answer do not respond the original question, but as I have experienced a similar issue, maybe my solution will help another people.
My Error:
```
Failed prop type: Invalid prop `component` of type `object` supplied to "link", expected function.
```
Alike the accepted answer, this could be fixed with:
`... |
53,007,905 | I'm using the latest version (16.6) of React with `react-router` (4.3.1) and trying to use code splitting using `React.Suspense`.
Although my routing is working and the code did split into several bundles loaded dynamically, I'm getting a warning about not returning a function, but an object to `Route`. My code:
```
... | 2018/10/26 | [
"https://Stackoverflow.com/questions/53007905",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1339219/"
] | This will be fixed in `react-router-dom` version 4.4+ as this [issue](https://github.com/ReactTraining/react-router/issues/6420) suggests
You can wait for the final release or if you don't want to change your code today,
you can install the beta version now by `yarn add react-router-dom@next` | I know this answer do not respond the original question, but as I have experienced a similar issue, maybe my solution will help another people.
My Error:
```
Failed prop type: Invalid prop `component` of type `object` supplied to "link", expected function.
```
Alike the accepted answer, this could be fixed with:
`... |
30,743,744 | This template has a spelling error in the first `if` statement, and it returns nothing. When I place a `debugger` statement in this template, it gets to the first `if` statement, then dies. Examining \_\_p shows me valid javascript, so I'm confused on why the whole templating function is returning nothing.
If `identif... | 2015/06/09 | [
"https://Stackoverflow.com/questions/30743744",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2860622/"
] | Change this line in the template from <% if (identifer === "something") { %> to <% if (identifier === "something") { %> | It turns out that my Firefox Developer console (on 38.05 currently) was **not** set up to log javascript errors to the console. I had to open the console, click the disclosure triangle on the 'JS' button, and the put a check mark next to 'Errors'.
I'm assuming that this was something that I turned off in the past, by ... |
6,124,897 | I have some Python code that's receiving a string with bad unicode in it. When I try to ignore the bad characters, Python still chokes (version 2.6.1). Here's how to reproduce it:
```
s = 'ad\xc2-ven\xc2-ture'
s.encode('utf8', 'ignore')
```
It throws
```
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc2 in p... | 2011/05/25 | [
"https://Stackoverflow.com/questions/6124897",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/52509/"
] | Converting a string to a unicode instance is `str.decode()` in Python 2.x:
```
>>> s.decode("ascii", "ignore")
u'ad-ven-ture'
``` | You are confusing "unicode" and "utf-8". Your string `s` is not unicode; it's a bytestring in a particular encoding (but not UTF-8, more likely iso-8859-1 or such.) Going from a bytestring to `unicode` is done by *decoding* the data, not *encoding*. Going from unicode to bytestring is encoding. Perhaps you meant to mak... |
1,647,497 | Suppose that $z+\frac{1}{z}=2cos\theta$, where $\theta$ is a real number. Then show that, for any integer $n$, $$z^n+\frac{1}{z^n}=2cos(n\theta)$$
My first thought was to use induction to achieve the conclusion but the manipulation does not reach the conclusion. | 2016/02/09 | [
"https://math.stackexchange.com/questions/1647497",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/306593/"
] | You can remark that $$(z^n+\frac{1}{z^n})(z+\frac{1}{z}) = (z^{n+1}+\frac{1}{z^{n+1}}) + (z^{n-1}+\frac{1}{z^{n-1}})$$
Hence, by induction $$(z^{n+1}+\frac{1}{z^{n+1}}) = 4\cos(n\theta)\cos(\theta)-2\cos((n-1)\theta).$$
Thanks to simpson's formula, you can see that this expression is equal to $2\cos((n+1)\theta).$ | **HINT:** Write $z=r(\cos \alpha+i\sin \alpha$).
Find $\displaystyle z+\frac{1}{z}$ and compare with $2\cos \theta$ (you will learn that $r=1$).
Now consider $z^n=(\cos \alpha+i\sin \alpha)^n$ using De Moivre.
**Note:** I see the real analysis tag... do you want $z$ to be real? The only real $z$ that do this are $\... |
1,647,497 | Suppose that $z+\frac{1}{z}=2cos\theta$, where $\theta$ is a real number. Then show that, for any integer $n$, $$z^n+\frac{1}{z^n}=2cos(n\theta)$$
My first thought was to use induction to achieve the conclusion but the manipulation does not reach the conclusion. | 2016/02/09 | [
"https://math.stackexchange.com/questions/1647497",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/306593/"
] | If $z+\frac1z=2\cos\theta$, then (since necessarily $z\neq 0$) $$z^2-2z\cos\theta+1=0$$ so that $$z=\cos\theta\pm\sqrt{\cos^2\theta-1}=\cos\theta\pm i\sin\theta = e^{\pm i\theta}$$
Then (by DeMoivre)
$$z^n=e^{\pm in\theta}=\cos n\theta \pm i\sin n\theta$$
and $$z^{-n}=e^{\mp in\theta}=\cos n\theta \mp i\sin n\theta$$ s... | **HINT:** Write $z=r(\cos \alpha+i\sin \alpha$).
Find $\displaystyle z+\frac{1}{z}$ and compare with $2\cos \theta$ (you will learn that $r=1$).
Now consider $z^n=(\cos \alpha+i\sin \alpha)^n$ using De Moivre.
**Note:** I see the real analysis tag... do you want $z$ to be real? The only real $z$ that do this are $\... |
1,647,497 | Suppose that $z+\frac{1}{z}=2cos\theta$, where $\theta$ is a real number. Then show that, for any integer $n$, $$z^n+\frac{1}{z^n}=2cos(n\theta)$$
My first thought was to use induction to achieve the conclusion but the manipulation does not reach the conclusion. | 2016/02/09 | [
"https://math.stackexchange.com/questions/1647497",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/306593/"
] | You can remark that $$(z^n+\frac{1}{z^n})(z+\frac{1}{z}) = (z^{n+1}+\frac{1}{z^{n+1}}) + (z^{n-1}+\frac{1}{z^{n-1}})$$
Hence, by induction $$(z^{n+1}+\frac{1}{z^{n+1}}) = 4\cos(n\theta)\cos(\theta)-2\cos((n-1)\theta).$$
Thanks to simpson's formula, you can see that this expression is equal to $2\cos((n+1)\theta).$ | Let $ z = e^{i \theta} $
It satisfies the given equations with and without exponentiation (through $n$). |
1,647,497 | Suppose that $z+\frac{1}{z}=2cos\theta$, where $\theta$ is a real number. Then show that, for any integer $n$, $$z^n+\frac{1}{z^n}=2cos(n\theta)$$
My first thought was to use induction to achieve the conclusion but the manipulation does not reach the conclusion. | 2016/02/09 | [
"https://math.stackexchange.com/questions/1647497",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/306593/"
] | You can remark that $$(z^n+\frac{1}{z^n})(z+\frac{1}{z}) = (z^{n+1}+\frac{1}{z^{n+1}}) + (z^{n-1}+\frac{1}{z^{n-1}})$$
Hence, by induction $$(z^{n+1}+\frac{1}{z^{n+1}}) = 4\cos(n\theta)\cos(\theta)-2\cos((n-1)\theta).$$
Thanks to simpson's formula, you can see that this expression is equal to $2\cos((n+1)\theta).$ | Because the product of $z$ by its inverse $\frac 1z$ is equal to $1$ we have
$z^2-2\cos \theta z+1=0\Rightarrow z=\cos \theta \pm\sqrt{\cos^2 \theta-1}=\cos \theta\pm i\sin \theta$.
Hence by Moivre $$z^n+\frac{1}{z^n}=\cos n\theta$$ |
1,647,497 | Suppose that $z+\frac{1}{z}=2cos\theta$, where $\theta$ is a real number. Then show that, for any integer $n$, $$z^n+\frac{1}{z^n}=2cos(n\theta)$$
My first thought was to use induction to achieve the conclusion but the manipulation does not reach the conclusion. | 2016/02/09 | [
"https://math.stackexchange.com/questions/1647497",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/306593/"
] | If $z+\frac1z=2\cos\theta$, then (since necessarily $z\neq 0$) $$z^2-2z\cos\theta+1=0$$ so that $$z=\cos\theta\pm\sqrt{\cos^2\theta-1}=\cos\theta\pm i\sin\theta = e^{\pm i\theta}$$
Then (by DeMoivre)
$$z^n=e^{\pm in\theta}=\cos n\theta \pm i\sin n\theta$$
and $$z^{-n}=e^{\mp in\theta}=\cos n\theta \mp i\sin n\theta$$ s... | Let $ z = e^{i \theta} $
It satisfies the given equations with and without exponentiation (through $n$). |
1,647,497 | Suppose that $z+\frac{1}{z}=2cos\theta$, where $\theta$ is a real number. Then show that, for any integer $n$, $$z^n+\frac{1}{z^n}=2cos(n\theta)$$
My first thought was to use induction to achieve the conclusion but the manipulation does not reach the conclusion. | 2016/02/09 | [
"https://math.stackexchange.com/questions/1647497",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/306593/"
] | If $z+\frac1z=2\cos\theta$, then (since necessarily $z\neq 0$) $$z^2-2z\cos\theta+1=0$$ so that $$z=\cos\theta\pm\sqrt{\cos^2\theta-1}=\cos\theta\pm i\sin\theta = e^{\pm i\theta}$$
Then (by DeMoivre)
$$z^n=e^{\pm in\theta}=\cos n\theta \pm i\sin n\theta$$
and $$z^{-n}=e^{\mp in\theta}=\cos n\theta \mp i\sin n\theta$$ s... | Because the product of $z$ by its inverse $\frac 1z$ is equal to $1$ we have
$z^2-2\cos \theta z+1=0\Rightarrow z=\cos \theta \pm\sqrt{\cos^2 \theta-1}=\cos \theta\pm i\sin \theta$.
Hence by Moivre $$z^n+\frac{1}{z^n}=\cos n\theta$$ |
2,046,856 | Evaluate $\lim\_{x\to \infty}(1+\frac{1}{\sqrt{x}})^x$
This is an exercise in my analysis book and I'm having trouble solving it. It's clearly related to the limit of $e$. I've tried rewriting:
Evaluate $\lim\_{x\to \infty}((1+\frac{1}{\sqrt{x}})^\sqrt{x})^\sqrt{x}$.
Now I sadly cannot rewrite this as $\lim\_{x\to \... | 2016/12/06 | [
"https://math.stackexchange.com/questions/2046856",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/378977/"
] | Suppose $x\in [n,n+1),$ where $n$ is a positive integer. Using the binomial theorem we have
$$(1+1/\sqrt x)^x > (1+1/\sqrt {n+1})^n = 1^n + n\cdot 1^{n-1}\cdot (1/\sqrt {n+1})^1 + \cdots > n/\sqrt {n+1}.$$
Since $n/\sqrt {n+1} \to \infty,$ the desired limit is $\infty.$ | Note that
$$\lim\_{x\to \infty}\left(1+\frac1{\sqrt{x}}\right)^{\sqrt{x}}=e $$
Therefore, for sufficiently large $x$, $\left(1+\frac1{\sqrt{x}}\right)^{\sqrt{x}}\ge 2$ (i.e., take $\epsilon = e-2>0$).
Hence, for sufficiently large $x$, we have
$$\left(1+\frac1{\sqrt{x}}\right)^{x}\ge 2^{\sqrt{x}}\to \infty\,\,\te... |
2,046,856 | Evaluate $\lim\_{x\to \infty}(1+\frac{1}{\sqrt{x}})^x$
This is an exercise in my analysis book and I'm having trouble solving it. It's clearly related to the limit of $e$. I've tried rewriting:
Evaluate $\lim\_{x\to \infty}((1+\frac{1}{\sqrt{x}})^\sqrt{x})^\sqrt{x}$.
Now I sadly cannot rewrite this as $\lim\_{x\to \... | 2016/12/06 | [
"https://math.stackexchange.com/questions/2046856",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/378977/"
] | $y= (1+\frac{1}{\sqrt{x}})^x$ then $\ln y=\ln(1+\frac{1}{\sqrt{x}})^x=x\ln(1+\frac{1}{\sqrt{x}})$.
We have
$$\lim\_{x\to\infty} x\ln(1+\frac{1}{\sqrt{x}})=\lim\_{x\to\infty}=\frac{\ln (1+\frac{1}{\sqrt{x}})}{\frac{1}{x}}=^H\lim\_{x\to\infty}\frac{ \frac{\frac{-1}{2x\sqrt{x}}}{\frac{\sqrt{x}+1}{\sqrt{x}}}}{\frac{-1}{x^... | Evaluate $\lim\_{x\to \infty}((1+\frac{1}{\sqrt{x}})^\sqrt{x})^\sqrt{x}$.
Well you know that this simplifies to:
$$e^{\sqrt{x}} = e^{\sqrt{\infty}}$$
Square root of infinity is just infinity really, and any number other then 1 raised to infinity is infinity. If you think of infinity as a really large number ... then ... |
2,046,856 | Evaluate $\lim\_{x\to \infty}(1+\frac{1}{\sqrt{x}})^x$
This is an exercise in my analysis book and I'm having trouble solving it. It's clearly related to the limit of $e$. I've tried rewriting:
Evaluate $\lim\_{x\to \infty}((1+\frac{1}{\sqrt{x}})^\sqrt{x})^\sqrt{x}$.
Now I sadly cannot rewrite this as $\lim\_{x\to \... | 2016/12/06 | [
"https://math.stackexchange.com/questions/2046856",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/378977/"
] | Note that
$$\lim\_{x\to \infty}\left(1+\frac1{\sqrt{x}}\right)^{\sqrt{x}}=e $$
Therefore, for sufficiently large $x$, $\left(1+\frac1{\sqrt{x}}\right)^{\sqrt{x}}\ge 2$ (i.e., take $\epsilon = e-2>0$).
Hence, for sufficiently large $x$, we have
$$\left(1+\frac1{\sqrt{x}}\right)^{x}\ge 2^{\sqrt{x}}\to \infty\,\,\te... | It is not hard to show that for $x>1$, $$\left(1+\frac1{\sqrt x}\right)^{\sqrt x}>2$$ and your limit is $\infty$. |
2,046,856 | Evaluate $\lim\_{x\to \infty}(1+\frac{1}{\sqrt{x}})^x$
This is an exercise in my analysis book and I'm having trouble solving it. It's clearly related to the limit of $e$. I've tried rewriting:
Evaluate $\lim\_{x\to \infty}((1+\frac{1}{\sqrt{x}})^\sqrt{x})^\sqrt{x}$.
Now I sadly cannot rewrite this as $\lim\_{x\to \... | 2016/12/06 | [
"https://math.stackexchange.com/questions/2046856",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/378977/"
] | Note that
$$\lim\_{x\to \infty}\left(1+\frac1{\sqrt{x}}\right)^{\sqrt{x}}=e $$
Therefore, for sufficiently large $x$, $\left(1+\frac1{\sqrt{x}}\right)^{\sqrt{x}}\ge 2$ (i.e., take $\epsilon = e-2>0$).
Hence, for sufficiently large $x$, we have
$$\left(1+\frac1{\sqrt{x}}\right)^{x}\ge 2^{\sqrt{x}}\to \infty\,\,\te... | Compute first the limit of the (natural) logarithm:
$$
\lim\_{x\to\infty}\log\left(\left(1+\frac{1}{\sqrt{x}}\right)^{\!x}\right)=
\lim\_{x\to\infty}x\log\left(1+\frac{1}{\sqrt{x}}\right)=
\lim\_{t\to0^+}\frac{\log(1+t)}{t^2}
$$
after the substitution $\sqrt{x}=1/t$, with $t>0$. Now
$$
\lim\_{t\to0^+}\frac{\log(1+t)}{t... |
2,046,856 | Evaluate $\lim\_{x\to \infty}(1+\frac{1}{\sqrt{x}})^x$
This is an exercise in my analysis book and I'm having trouble solving it. It's clearly related to the limit of $e$. I've tried rewriting:
Evaluate $\lim\_{x\to \infty}((1+\frac{1}{\sqrt{x}})^\sqrt{x})^\sqrt{x}$.
Now I sadly cannot rewrite this as $\lim\_{x\to \... | 2016/12/06 | [
"https://math.stackexchange.com/questions/2046856",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/378977/"
] | Note that
$$\lim\_{x\to \infty}\left(1+\frac1{\sqrt{x}}\right)^{\sqrt{x}}=e $$
Therefore, for sufficiently large $x$, $\left(1+\frac1{\sqrt{x}}\right)^{\sqrt{x}}\ge 2$ (i.e., take $\epsilon = e-2>0$).
Hence, for sufficiently large $x$, we have
$$\left(1+\frac1{\sqrt{x}}\right)^{x}\ge 2^{\sqrt{x}}\to \infty\,\,\te... | For $\alpha\ge1, t\ge-1$, $(1+t)^\alpha\ge1+\alpha t$
We can see this by considering the tangent at the origin and convexity. (This is Bernoulli's inequality.)
Take $t=\frac{1}{\sqrt{x}},\alpha=x$ to see $(1+\frac{1}{\sqrt{x}})^x\ge1+\sqrt{x}\to\infty$. |
2,046,856 | Evaluate $\lim\_{x\to \infty}(1+\frac{1}{\sqrt{x}})^x$
This is an exercise in my analysis book and I'm having trouble solving it. It's clearly related to the limit of $e$. I've tried rewriting:
Evaluate $\lim\_{x\to \infty}((1+\frac{1}{\sqrt{x}})^\sqrt{x})^\sqrt{x}$.
Now I sadly cannot rewrite this as $\lim\_{x\to \... | 2016/12/06 | [
"https://math.stackexchange.com/questions/2046856",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/378977/"
] | Suppose $x\in [n,n+1),$ where $n$ is a positive integer. Using the binomial theorem we have
$$(1+1/\sqrt x)^x > (1+1/\sqrt {n+1})^n = 1^n + n\cdot 1^{n-1}\cdot (1/\sqrt {n+1})^1 + \cdots > n/\sqrt {n+1}.$$
Since $n/\sqrt {n+1} \to \infty,$ the desired limit is $\infty.$ | Compute first the limit of the (natural) logarithm:
$$
\lim\_{x\to\infty}\log\left(\left(1+\frac{1}{\sqrt{x}}\right)^{\!x}\right)=
\lim\_{x\to\infty}x\log\left(1+\frac{1}{\sqrt{x}}\right)=
\lim\_{t\to0^+}\frac{\log(1+t)}{t^2}
$$
after the substitution $\sqrt{x}=1/t$, with $t>0$. Now
$$
\lim\_{t\to0^+}\frac{\log(1+t)}{t... |
2,046,856 | Evaluate $\lim\_{x\to \infty}(1+\frac{1}{\sqrt{x}})^x$
This is an exercise in my analysis book and I'm having trouble solving it. It's clearly related to the limit of $e$. I've tried rewriting:
Evaluate $\lim\_{x\to \infty}((1+\frac{1}{\sqrt{x}})^\sqrt{x})^\sqrt{x}$.
Now I sadly cannot rewrite this as $\lim\_{x\to \... | 2016/12/06 | [
"https://math.stackexchange.com/questions/2046856",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/378977/"
] | Hint. Note that as $x\to +\infty$,
$$\left(1+\frac{1}{\sqrt{x}}\right)^x=\exp\left(x\ln\left(1+\frac{1}{\sqrt{x}}\right)\right)\sim \exp\left(\frac{x}{\sqrt{x}}\right)=\exp\left(\sqrt{x}\right)$$
wher we use the fact that $\ln(1+t)\sim t$ as $t\to 0$. | It is not hard to show that for $x>1$, $$\left(1+\frac1{\sqrt x}\right)^{\sqrt x}>2$$ and your limit is $\infty$. |
2,046,856 | Evaluate $\lim\_{x\to \infty}(1+\frac{1}{\sqrt{x}})^x$
This is an exercise in my analysis book and I'm having trouble solving it. It's clearly related to the limit of $e$. I've tried rewriting:
Evaluate $\lim\_{x\to \infty}((1+\frac{1}{\sqrt{x}})^\sqrt{x})^\sqrt{x}$.
Now I sadly cannot rewrite this as $\lim\_{x\to \... | 2016/12/06 | [
"https://math.stackexchange.com/questions/2046856",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/378977/"
] | Note that
$$\lim\_{x\to \infty}\left(1+\frac1{\sqrt{x}}\right)^{\sqrt{x}}=e $$
Therefore, for sufficiently large $x$, $\left(1+\frac1{\sqrt{x}}\right)^{\sqrt{x}}\ge 2$ (i.e., take $\epsilon = e-2>0$).
Hence, for sufficiently large $x$, we have
$$\left(1+\frac1{\sqrt{x}}\right)^{x}\ge 2^{\sqrt{x}}\to \infty\,\,\te... | Evaluate $\lim\_{x\to \infty}((1+\frac{1}{\sqrt{x}})^\sqrt{x})^\sqrt{x}$.
Well you know that this simplifies to:
$$e^{\sqrt{x}} = e^{\sqrt{\infty}}$$
Square root of infinity is just infinity really, and any number other then 1 raised to infinity is infinity. If you think of infinity as a really large number ... then ... |
2,046,856 | Evaluate $\lim\_{x\to \infty}(1+\frac{1}{\sqrt{x}})^x$
This is an exercise in my analysis book and I'm having trouble solving it. It's clearly related to the limit of $e$. I've tried rewriting:
Evaluate $\lim\_{x\to \infty}((1+\frac{1}{\sqrt{x}})^\sqrt{x})^\sqrt{x}$.
Now I sadly cannot rewrite this as $\lim\_{x\to \... | 2016/12/06 | [
"https://math.stackexchange.com/questions/2046856",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/378977/"
] | $y= (1+\frac{1}{\sqrt{x}})^x$ then $\ln y=\ln(1+\frac{1}{\sqrt{x}})^x=x\ln(1+\frac{1}{\sqrt{x}})$.
We have
$$\lim\_{x\to\infty} x\ln(1+\frac{1}{\sqrt{x}})=\lim\_{x\to\infty}=\frac{\ln (1+\frac{1}{\sqrt{x}})}{\frac{1}{x}}=^H\lim\_{x\to\infty}\frac{ \frac{\frac{-1}{2x\sqrt{x}}}{\frac{\sqrt{x}+1}{\sqrt{x}}}}{\frac{-1}{x^... | It is not hard to show that for $x>1$, $$\left(1+\frac1{\sqrt x}\right)^{\sqrt x}>2$$ and your limit is $\infty$. |
2,046,856 | Evaluate $\lim\_{x\to \infty}(1+\frac{1}{\sqrt{x}})^x$
This is an exercise in my analysis book and I'm having trouble solving it. It's clearly related to the limit of $e$. I've tried rewriting:
Evaluate $\lim\_{x\to \infty}((1+\frac{1}{\sqrt{x}})^\sqrt{x})^\sqrt{x}$.
Now I sadly cannot rewrite this as $\lim\_{x\to \... | 2016/12/06 | [
"https://math.stackexchange.com/questions/2046856",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/378977/"
] | $y= (1+\frac{1}{\sqrt{x}})^x$ then $\ln y=\ln(1+\frac{1}{\sqrt{x}})^x=x\ln(1+\frac{1}{\sqrt{x}})$.
We have
$$\lim\_{x\to\infty} x\ln(1+\frac{1}{\sqrt{x}})=\lim\_{x\to\infty}=\frac{\ln (1+\frac{1}{\sqrt{x}})}{\frac{1}{x}}=^H\lim\_{x\to\infty}\frac{ \frac{\frac{-1}{2x\sqrt{x}}}{\frac{\sqrt{x}+1}{\sqrt{x}}}}{\frac{-1}{x^... | For $\alpha\ge1, t\ge-1$, $(1+t)^\alpha\ge1+\alpha t$
We can see this by considering the tangent at the origin and convexity. (This is Bernoulli's inequality.)
Take $t=\frac{1}{\sqrt{x}},\alpha=x$ to see $(1+\frac{1}{\sqrt{x}})^x\ge1+\sqrt{x}\to\infty$. |
41,498,313 | I have tried the other questions like this but none seem to match it. I want it to repeat if the user enters Y after the numbers are sorted in the console.
Here is the code:
```
package compsorter;
import java.util.Scanner;
public class Ascending_Order
{
public static void main(String[] args)
{
int n, te... | 2017/01/06 | [
"https://Stackoverflow.com/questions/41498313",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7381880/"
] | The only problem with the recursive solution is the stack over flow problem. A way to do it without recursion is
```
Observable<ArtistsCursorPager> allPages = Observable.defer(() ->
{
BehaviorSubject<Object> pagecontrol = BehaviorSubject.create("start");
Observable<ArtistsCursorPager> ret = pageControl.asObser... | There´s not unique way to do this.
In my case what I did was make some recursive calls using `mergeWith`
```
private Observable<String> getUUIDsQuery(JsonObject response) {
final Observable<String> uuidsQuery = createUuidsQuery(response);
return hasPagination(response) ? paginate(response, uuidsQuery) : uuids... |
41,498,313 | I have tried the other questions like this but none seem to match it. I want it to repeat if the user enters Y after the numbers are sorted in the console.
Here is the code:
```
package compsorter;
import java.util.Scanner;
public class Ascending_Order
{
public static void main(String[] args)
{
int n, te... | 2017/01/06 | [
"https://Stackoverflow.com/questions/41498313",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7381880/"
] | There´s not unique way to do this.
In my case what I did was make some recursive calls using `mergeWith`
```
private Observable<String> getUUIDsQuery(JsonObject response) {
final Observable<String> uuidsQuery = createUuidsQuery(response);
return hasPagination(response) ? paginate(response, uuidsQuery) : uuids... | Thanks for opening my eyes that I didn't read your question properly. Here is the best solution i can suggest you without using the normal recursive function but the RxJava way.
```
PublishSubject<Integer> limit = PublishSubject.create();
limit.concatMap(integer -> Observable.just(integer + 1)) // Assuming t... |
41,498,313 | I have tried the other questions like this but none seem to match it. I want it to repeat if the user enters Y after the numbers are sorted in the console.
Here is the code:
```
package compsorter;
import java.util.Scanner;
public class Ascending_Order
{
public static void main(String[] args)
{
int n, te... | 2017/01/06 | [
"https://Stackoverflow.com/questions/41498313",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7381880/"
] | The only problem with the recursive solution is the stack over flow problem. A way to do it without recursion is
```
Observable<ArtistsCursorPager> allPages = Observable.defer(() ->
{
BehaviorSubject<Object> pagecontrol = BehaviorSubject.create("start");
Observable<ArtistsCursorPager> ret = pageControl.asObser... | Thanks for opening my eyes that I didn't read your question properly. Here is the best solution i can suggest you without using the normal recursive function but the RxJava way.
```
PublishSubject<Integer> limit = PublishSubject.create();
limit.concatMap(integer -> Observable.just(integer + 1)) // Assuming t... |
7,828,119 | I'm having trouble getting MsCharts to work when deploying on my production environment.
The application is a .NET 4 ASP.NET MVC 2 site with IIS 7.5.
**Everything works fine when I'm running on Visual Studio's development server** however I get the following error when trying to run the page with the chart on the liv... | 2011/10/19 | [
"https://Stackoverflow.com/questions/7828119",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/161735/"
] | If you want to do the formatting in an SQL query, you can use the [DATE\_FORMAT() function](http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html#function_date-format) in MySQL.
```
SELECT DATE_FORMAT(columnName, '%b %D %Y') AS my_date
FROM tableName;
```
Formatting the date in PHP, you'll want to use ... | I'm assuming you're talking exclusively in mysql and not other language that connects to mysql. I hope this helps:
```
DATE_FORMAT(columnName, '%b %D %Y')
``` |
7,828,119 | I'm having trouble getting MsCharts to work when deploying on my production environment.
The application is a .NET 4 ASP.NET MVC 2 site with IIS 7.5.
**Everything works fine when I'm running on Visual Studio's development server** however I get the following error when trying to run the page with the chart on the liv... | 2011/10/19 | [
"https://Stackoverflow.com/questions/7828119",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/161735/"
] | If you want to do the formatting in an SQL query, you can use the [DATE\_FORMAT() function](http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html#function_date-format) in MySQL.
```
SELECT DATE_FORMAT(columnName, '%b %D %Y') AS my_date
FROM tableName;
```
Formatting the date in PHP, you'll want to use ... | You're definitely on the right track!
The difference from your example is that you need to specify the date format as a string - you can do this by surrounding it in single quotes (`'`) and remove the hyphens (`-`):
```sql
DATE_FORMAT(columnName, '%b %D %Y')
```
By the way, if you're just using this in a normal `SE... |
7,828,119 | I'm having trouble getting MsCharts to work when deploying on my production environment.
The application is a .NET 4 ASP.NET MVC 2 site with IIS 7.5.
**Everything works fine when I'm running on Visual Studio's development server** however I get the following error when trying to run the page with the chart on the liv... | 2011/10/19 | [
"https://Stackoverflow.com/questions/7828119",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/161735/"
] | You're definitely on the right track!
The difference from your example is that you need to specify the date format as a string - you can do this by surrounding it in single quotes (`'`) and remove the hyphens (`-`):
```sql
DATE_FORMAT(columnName, '%b %D %Y')
```
By the way, if you're just using this in a normal `SE... | I'm assuming you're talking exclusively in mysql and not other language that connects to mysql. I hope this helps:
```
DATE_FORMAT(columnName, '%b %D %Y')
``` |
25,220,340 | I found this code from another question
```
private void updateLine(String toUpdate, String updated) throws IOException {
BufferedReader file = new BufferedReader(new FileReader(data));
String line;
String input = "";
while ((line = file.readLine()) != null)
input += line + "\n";
input = ... | 2014/08/09 | [
"https://Stackoverflow.com/questions/25220340",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3879542/"
] | Use [`System.lineSeparator()`](http://docs.oracle.com/javase/7/docs/api/java/lang/System.html#lineSeparator()) instead of `\n`.
```
while ((line = file.readLine()) != null)
input += line + System.lineSeparator();
```
The issue is that on Unix systems, the line separator is `\n` while on Windows systems, it's `\r... | This is because you use OutputStream which is better for handling binary data. Try using PrintWriter and don't add any line terminator at the end of the lines. Example is [here](https://stackoverflow.com/questions/2885173/java-how-to-create-and-write-to-a-file) |
25,220,340 | I found this code from another question
```
private void updateLine(String toUpdate, String updated) throws IOException {
BufferedReader file = new BufferedReader(new FileReader(data));
String line;
String input = "";
while ((line = file.readLine()) != null)
input += line + "\n";
input = ... | 2014/08/09 | [
"https://Stackoverflow.com/questions/25220340",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3879542/"
] | Use [`System.lineSeparator()`](http://docs.oracle.com/javase/7/docs/api/java/lang/System.html#lineSeparator()) instead of `\n`.
```
while ((line = file.readLine()) != null)
input += line + System.lineSeparator();
```
The issue is that on Unix systems, the line separator is `\n` while on Windows systems, it's `\r... | If you read and modify line by line this has the advantage, that you dont need to fit the whole file in memory. Not sure if this is possible in your case, but it is generally a good thing to aim for streaming. In your case this would in addition remove the need for concatenate the string and you don't need to select a ... |
25,220,340 | I found this code from another question
```
private void updateLine(String toUpdate, String updated) throws IOException {
BufferedReader file = new BufferedReader(new FileReader(data));
String line;
String input = "";
while ((line = file.readLine()) != null)
input += line + "\n";
input = ... | 2014/08/09 | [
"https://Stackoverflow.com/questions/25220340",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3879542/"
] | If you read and modify line by line this has the advantage, that you dont need to fit the whole file in memory. Not sure if this is possible in your case, but it is generally a good thing to aim for streaming. In your case this would in addition remove the need for concatenate the string and you don't need to select a ... | This is because you use OutputStream which is better for handling binary data. Try using PrintWriter and don't add any line terminator at the end of the lines. Example is [here](https://stackoverflow.com/questions/2885173/java-how-to-create-and-write-to-a-file) |
36,269,063 | I have created a directive because I want to do some DOM manipulation when page loads. But it simply won't trigger. Here is my directive function:
**Directive**
```
function onLoadFixes(){
return function (scope,element,attrs){
$(element).on('load',function(event){
console.log("element load... | 2016/03/28 | [
"https://Stackoverflow.com/questions/36269063",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3336178/"
] | you don't have to use load event in angularjs,
here is an example, you should try to follow,
```
(function (angular) {
'use strict';
var uponLoadFixes = function () {
function controller() {
}
function link(scope, element, attrs) {
//here do somet... | **Run Blocks**
Run blocks are the closest thing in Angular to the main method. A run block is the code which needs to run to kickstart the application. It is executed after all of the services have been configured and the injector has been created.
```
angular.module('myModule', []).
run(function(injectab... |
36,269,063 | I have created a directive because I want to do some DOM manipulation when page loads. But it simply won't trigger. Here is my directive function:
**Directive**
```
function onLoadFixes(){
return function (scope,element,attrs){
$(element).on('load',function(event){
console.log("element load... | 2016/03/28 | [
"https://Stackoverflow.com/questions/36269063",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3336178/"
] | you don't have to use load event in angularjs,
here is an example, you should try to follow,
```
(function (angular) {
'use strict';
var uponLoadFixes = function () {
function controller() {
}
function link(scope, element, attrs) {
//here do somet... | **Thanks to z.a**. By moving my directive to breadcrumb list in header.html and using it as an element, it started working as expected (need to fix the display though). I have included the modified code for the directive (for element selection) should anyone is looking for it. |
7,833,497 | i need to add columns one by one in asp.net by click on plus symbol then one textbox and dropdown will appear dynamically and when click on minus that will disappear .
whenever user enter the data in textbox and dropdown and clickon plus symbol the that row will save in db and new empty textbox and dropdown will appea... | 2011/10/20 | [
"https://Stackoverflow.com/questions/7833497",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/371991/"
] | You need to call mImage.setBounds(...); otherwise the canvas doesn't know where to draw the Drawable. | I think the main problem you have is that as soon as you start the thread with `.start();` the boolean `mRunning` is false and the thread will finish immediately. When you try to call `.setRunning(true);` after the thread has started it won't have any effect because the thread already finished. |
17,144,953 | I have a class/structure as follows:
```
struct MyStruct {
std::string member_one;
std::string member_two;
};
```
I create a vector of `MyStruct`, `std::vector<MyStruct>` of some length `N` with the members set to custom values:
```
std::vector<MyStruct> my_struct_vect(10);
// initialize class instances
```
N... | 2013/06/17 | [
"https://Stackoverflow.com/questions/17144953",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1085548/"
] | You could use [`std::transform`](http://en.cppreference.com/w/cpp/algorithm/transform):
```
#include <algorithm> // Necessary for std::transform()
// ...
std::vector<std::string> member_one_vect(my_struct_vect.size());
std::transform(
my_struct_vect.begin(), my_struct_vect.end(), member_one_vect.begin(),
[]... | You can use algorithms.
```
std::vector<std::string> member_one_vect(my_struct_vect.size());
std::transform(my_struct_vect.begin(), my_struct_vect.end(),
member_one_vect.begin(),
[](const MyStruct& m) { return m.member_one; });
```
Also, you can use `boost::adaptors::transformed`.
```
#include <boost/range/adaptor/... |
13,854,671 | If we allow only chars and spaces we usually compare ASCII values in javascript. But what if we support multiple language, the check fails to work. Please advise me on this, any other way considering other languages too...
The javascript we usually use is like that -->
```
function charAndSpacesOnly(objEvent) {
... | 2012/12/13 | [
"https://Stackoverflow.com/questions/13854671",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/805643/"
] | Never put `ListView` inside a `ScrollView`. `ListView` handles scrolling, and wrapping it in a `ScrollView` can cause problems with focus, touch-events etc. If you want other `Views` added to the top or bottom of you list, simply use [`ListView.addHeaderView()`](http://developer.android.com/reference/android/widget/Lis... | Scroll view can have only one child, put your button and listview in common layout and try out. |
9,486,024 | Is there is way to implement Async method call in java Other than thread and Executor ? If it is implementing by Executor will it introduce any delay ? | 2012/02/28 | [
"https://Stackoverflow.com/questions/9486024",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/767769/"
] | Using `Threads` *is* the way in Java. `Executors` is just a way to wrap thread management in a nicer container.
It *might* introduce a delay. If the thread(s) are busy working another task there will be a delay. Otherwise the delay is based on the OS context-switching mechanism which generally is quite responsive (wh... | You could use the DynamicProxy (core java feature) to introduce a layer inbetween the caller and the callee. In the proxy you have the method call represented as an object. Return immediately and call the method in a separate thread. A question remains how to return values to the caller. Do you plan to have return valu... |
9,486,024 | Is there is way to implement Async method call in java Other than thread and Executor ? If it is implementing by Executor will it introduce any delay ? | 2012/02/28 | [
"https://Stackoverflow.com/questions/9486024",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/767769/"
] | Using `Threads` *is* the way in Java. `Executors` is just a way to wrap thread management in a nicer container.
It *might* introduce a delay. If the thread(s) are busy working another task there will be a delay. Otherwise the delay is based on the OS context-switching mechanism which generally is quite responsive (wh... | You can pass in a class that implements your callback.
```
new A(instanceOfB);
someMethodOfA() {
doSomething();
instanceOfB.callback();
}
``` |
9,486,024 | Is there is way to implement Async method call in java Other than thread and Executor ? If it is implementing by Executor will it introduce any delay ? | 2012/02/28 | [
"https://Stackoverflow.com/questions/9486024",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/767769/"
] | You could use the DynamicProxy (core java feature) to introduce a layer inbetween the caller and the callee. In the proxy you have the method call represented as an object. Return immediately and call the method in a separate thread. A question remains how to return values to the caller. Do you plan to have return valu... | You can pass in a class that implements your callback.
```
new A(instanceOfB);
someMethodOfA() {
doSomething();
instanceOfB.callback();
}
``` |
74,009,031 | I'm trying to understand the [AngularFireFunctions](https://github.com/angular/angularfire/blob/master/docs/functions/functions.md) documentation. I made a new Angular project and a new Firestore database, installed AngularFire and Firebase, hooked up the Firebase credentials to `environments.ts`, and initialized `fire... | 2022/10/09 | [
"https://Stackoverflow.com/questions/74009031",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5153354/"
] | You could use self non-equijoins:
```
data[,start:=date-2]
data[data,.(ind_id,date = x.date,job_id=i.job_id),on=.(ind_id, start<= date, date>=date)][
,.(job_id=list(unique(job_id))),.(ind_id,date)]
ind_id date job_id
<num> <num> <list>
1: 1 1 A
2: 1 2 A
3: 1 3 ... | Thanks Waldi for your solution. I actually managed to figure out my own solution to my question with a combination of helper columns and `mapply`. So I've included my method as an answer and also benchmarked both methods. Waldi's solution with non-equi joins is about 20 per cent faster than my method with `mapply`, but... |
577,427 | In c# how do I evenly divide 100 into 7?
So the result would be
1. 16
2. 14
3. 14
4. 14
5. 14
6. 14
7. 14
The code below is incorrect as all 7 values are set to 15 (totalling 105).
```
double [] vals = new double[7];
for (int i = 0; i < vals.Length; i++)
{
vals[i] = Math.Ceiling... | 2009/02/23 | [
"https://Stackoverflow.com/questions/577427",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Here you go:
```
Func<int, int, IEnumerable<int>> f = (a, b) =>
Enumerable.Range(0,a/b).Select((n) => a / b + ((a % b) <= n ? 0 : 1))
```
Good luck explaining it in class though :) | Not sure if this is exactly what you are after, but I would think that if you use Math.ceiling you will always end up with too big a total. Math.floor would underestimate and leave you with a difference that can be added to one of your pieces as you see fit.
For example by this method you might end up with 7 lots of 1... |
577,427 | In c# how do I evenly divide 100 into 7?
So the result would be
1. 16
2. 14
3. 14
4. 14
5. 14
6. 14
7. 14
The code below is incorrect as all 7 values are set to 15 (totalling 105).
```
double [] vals = new double[7];
for (int i = 0; i < vals.Length; i++)
{
vals[i] = Math.Ceiling... | 2009/02/23 | [
"https://Stackoverflow.com/questions/577427",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | To get my suggested result of 15, 15, 14, 14, 14, 14, 14:
```
// This doesn't try to cope with negative numbers :)
public static IEnumerable<int> DivideEvenly(int numerator, int denominator)
{
int rem;
int div = Math.DivRem(numerator, denominator, out rem);
for (int i=0; i < denominator; i++)
{
... | Since this seems to be homework, here is a hint and not the full code.
You are doing Math.Ceiling and it converts 14.28 into 15. |
577,427 | In c# how do I evenly divide 100 into 7?
So the result would be
1. 16
2. 14
3. 14
4. 14
5. 14
6. 14
7. 14
The code below is incorrect as all 7 values are set to 15 (totalling 105).
```
double [] vals = new double[7];
for (int i = 0; i < vals.Length; i++)
{
vals[i] = Math.Ceiling... | 2009/02/23 | [
"https://Stackoverflow.com/questions/577427",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | To get my suggested result of 15, 15, 14, 14, 14, 14, 14:
```
// This doesn't try to cope with negative numbers :)
public static IEnumerable<int> DivideEvenly(int numerator, int denominator)
{
int rem;
int div = Math.DivRem(numerator, denominator, out rem);
for (int i=0; i < denominator; i++)
{
... | Not sure if this is exactly what you are after, but I would think that if you use Math.ceiling you will always end up with too big a total. Math.floor would underestimate and leave you with a difference that can be added to one of your pieces as you see fit.
For example by this method you might end up with 7 lots of 1... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.