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 |
|---|---|---|---|---|---|
19,087,013 | If suppose, I have a `List` of type `Schedule` on my JSP page. I iterate through it and wants to send a particular object of the list to the action class. Is this possible to do that using Struts 2? What I have explored is that I can send the value of the identifier variable of the object to the action class and then f... | 2013/09/30 | [
"https://Stackoverflow.com/questions/19087013",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2818245/"
] | The try/finally blocks should be *inside* the function, like so:
```
public void GravaBanco(String nome, String telefone) {
try {
...
} finally {
...
}
}
``` | Use below code, you are missing braces.
```
public void GravaBanco(String nome, String telefone){
try{ //Syntax error on token “try”, delete this token
BancoDados = openOrCreateDatabase(NomeBanco, MODE_WORLD_READABLE, null);
String SQL = "INSERT INTO tabcadastropessoa (nomepessoa, tele... |
19,087,013 | If suppose, I have a `List` of type `Schedule` on my JSP page. I iterate through it and wants to send a particular object of the list to the action class. Is this possible to do that using Struts 2? What I have explored is that I can send the value of the identifier variable of the object to the action class and then f... | 2013/09/30 | [
"https://Stackoverflow.com/questions/19087013",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2818245/"
] | The try/finally blocks should be *inside* the function, like so:
```
public void GravaBanco(String nome, String telefone) {
try {
...
} finally {
...
}
}
``` | I Think u missed the braces after method name try this code
```
public void GravaBanco(String nome, String telefone) {
try { // Syntax error on token “try”, delete this token
BancoDados = openOrCreateDatabase(NomeBanco, MODE_WORLD_READABLE,
null);
String SQL = "INSERT INTO tabca... |
41,489,682 | I am a new python user, and I have just been getting familiar with restructuring data with the zip function, however I am now faced with a challenging data set that i have to restructure. I have 3 json responses that I have to merge from my end, the data sets are identical in design and would have the same length, they... | 2017/01/05 | [
"https://Stackoverflow.com/questions/41489682",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4971053/"
] | I don't have a lot of time so I'm posting what I believe is a working solution to your problem even if it's slightly messy. If I have time I'll edit it.
**Code**
```
import json
data = """
[
{
"elements": [{
"keyword": "Scenario",
"name": "valid user can login site",
"steps": [{
... | Because each object in the `list` is a `dict` you can use `dict.update` mehthod to update a `dict`.
f.e.
```
a = [{'one': 1}, {'three': 3}]
b = [{'one': 1}, {'two': 2}] # {'one': 1} is duplicate with same value
c = [{'a': 'aaa'}, {'two': 22}] # {'two': 22} is duplicate with different value
for x, y, z in zip(a, b,... |
41,489,682 | I am a new python user, and I have just been getting familiar with restructuring data with the zip function, however I am now faced with a challenging data set that i have to restructure. I have 3 json responses that I have to merge from my end, the data sets are identical in design and would have the same length, they... | 2017/01/05 | [
"https://Stackoverflow.com/questions/41489682",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4971053/"
] | I don't have a lot of time so I'm posting what I believe is a working solution to your problem even if it's slightly messy. If I have time I'll edit it.
**Code**
```
import json
data = """
[
{
"elements": [{
"keyword": "Scenario",
"name": "valid user can login site",
"steps": [{
... | This is a recursive merge implementation. It will merge arbitrary types of Python objects, such that anything but `dicts` must be equal when merged.
For `dicts`, it will allow merging if the same keys are associated with mergable values in those where the key is present. Any `dict` keys equalling the parameter `fieldn... |
65,601,635 | With [`pandas.date_range`](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.date_range.html) one can create time columns for one's dataframe with ease such as
```
df["Data"] = pd.date_range(start='2020-01-01 00:00', end='2020-01-05 02:00', freq='H')
```
Which something like this
[![enter image desc... | 2021/01/06 | [
"https://Stackoverflow.com/questions/65601635",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7109869/"
] | You can spread props onto the component:
```
renderInput = () => {
const props = {
autoComplete: 'off',
id: 'unique-id-2',
'aria-autocomplete': 'off'
};
if (isLoading) {
return (
<Input
iconRight={(
<Spinner />
)}
{...props}
... | I think your function can be shortened to the following;
```
renderInput = () => (
<Input
iconRight={isLoading ? (<Spinner />) : null}
autoComplete="off"
id="unique-id-2"
aria-autocomplete="both"
/>
)
```
If you don't already, inside your `Input` component, you should check i... |
65,601,635 | With [`pandas.date_range`](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.date_range.html) one can create time columns for one's dataframe with ease such as
```
df["Data"] = pd.date_range(start='2020-01-01 00:00', end='2020-01-05 02:00', freq='H')
```
Which something like this
[![enter image desc... | 2021/01/06 | [
"https://Stackoverflow.com/questions/65601635",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7109869/"
] | You can spread props onto the component:
```
renderInput = () => {
const props = {
autoComplete: 'off',
id: 'unique-id-2',
'aria-autocomplete': 'off'
};
if (isLoading) {
return (
<Input
iconRight={(
<Spinner />
)}
{...props}
... | You can try this:
```
renderInput = () =>(
<Input
iconRight={
isLoading && (
<Spinner />
)}
autoComplete="off"
id="unique-id-2"
aria-autocomplete="both"
/>
)
``` |
47,723,253 | When I run:
javascript:
```
var inputs = document.getElementsByClassName('subscribe_follow');
for(var i=0;i<inputs.length;i++) {
inputs[i].click();
}
```
to click all buttons with the class `class="subscribe_follow"`,
it also clicks all buttons with the class `class="subscribe_follow ng-hide"`.
How do I onl... | 2017/12/08 | [
"https://Stackoverflow.com/questions/47723253",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9074654/"
] | You can use the `not` operator.
```
document.querySelectorAll('.subscribe_follow:not(.ng-hide)');
```
`.subscribe_follow:not(.ng-hide)` selector selects all the elements with the class `subscribe_fellow` but which do not have the `ng-hide` class.
**jQuery**
```
$('.subscribe_follow:not(.ng-hide)');
``` | You could use the `not` operator as suggested by Sushanth. The disadvantage here is that you'd have to mention every class that is supposed to be excluded, which may be a pain depending on the number of different classes that you might be using on the same elements.
**I recommend declaring classes with the sole purpos... |
4,215,066 | This is easy for me to perform in TSQL, but I'm just sitting here banging my head against the desk trying to get it to work in EF4!
I have a table, lets call it TestData. It has fields, say: DataTypeID, Name, DataValue.
```
DataTypeID, Name, DataValue
1,"Data 1","Value1"
1,"Data 1","Value2"
2,"Data 1","Value3"
3,"Dat... | 2010/11/18 | [
"https://Stackoverflow.com/questions/4215066",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/496083/"
] | You are so very close already. Try this:
```
var query = (from t in context.TestData
group h by new { DataTypeID = h.DataTypeID, Name = h.Name } into g
select new
{
DataTypeID = g.Key.DataTypeID,
Name = g.Key.Name,
DataValues = String.Join(",", g),
}).ToList()
```
Alternatively, you could do this, if ... | Maybe it's a good idea to create a view for this on the database (which concatenates the fields for you) and then make EF use this view instead of the original table?
I'm quite sure it's not possible in a LINQ statement or in the Mapping Details. |
4,215,066 | This is easy for me to perform in TSQL, but I'm just sitting here banging my head against the desk trying to get it to work in EF4!
I have a table, lets call it TestData. It has fields, say: DataTypeID, Name, DataValue.
```
DataTypeID, Name, DataValue
1,"Data 1","Value1"
1,"Data 1","Value2"
2,"Data 1","Value3"
3,"Dat... | 2010/11/18 | [
"https://Stackoverflow.com/questions/4215066",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/496083/"
] | If the `ToList()` is part of your original query and not just added for this example, then use LINQ to Objects on the resulting list to do the aggregation:
```
var query = (from t in context.TestData
group t by new { DataTypeID = t.DataTypeID, Name = t.Name } into g
select new { DataTypeID = g... | Maybe it's a good idea to create a view for this on the database (which concatenates the fields for you) and then make EF use this view instead of the original table?
I'm quite sure it's not possible in a LINQ statement or in the Mapping Details. |
4,215,066 | This is easy for me to perform in TSQL, but I'm just sitting here banging my head against the desk trying to get it to work in EF4!
I have a table, lets call it TestData. It has fields, say: DataTypeID, Name, DataValue.
```
DataTypeID, Name, DataValue
1,"Data 1","Value1"
1,"Data 1","Value2"
2,"Data 1","Value3"
3,"Dat... | 2010/11/18 | [
"https://Stackoverflow.com/questions/4215066",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/496083/"
] | Thanks to moi\_meme for the answer. What I was hoping to do is NOT POSSIBLE with LINQ to Entities. As others have suggested, you have to use LINQ to Objects to get access to string manipulation methods.
See the link posted by moi\_meme for more info.
**Update 8/27/2018** - Updated Link (again) - <https://web.archive.... | Maybe it's a good idea to create a view for this on the database (which concatenates the fields for you) and then make EF use this view instead of the original table?
I'm quite sure it's not possible in a LINQ statement or in the Mapping Details. |
4,215,066 | This is easy for me to perform in TSQL, but I'm just sitting here banging my head against the desk trying to get it to work in EF4!
I have a table, lets call it TestData. It has fields, say: DataTypeID, Name, DataValue.
```
DataTypeID, Name, DataValue
1,"Data 1","Value1"
1,"Data 1","Value2"
2,"Data 1","Value3"
3,"Dat... | 2010/11/18 | [
"https://Stackoverflow.com/questions/4215066",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/496083/"
] | Some of the Answers suggest calling ToList() and then perform the calculation as LINQ to OBJECT. That's fine for a little amount of data, but what if I have a huge amount of data that I do not want to load into memory too early, then, ToList() may not be an option.
So, the better idea would be to process/format the da... | Maybe it's a good idea to create a view for this on the database (which concatenates the fields for you) and then make EF use this view instead of the original table?
I'm quite sure it's not possible in a LINQ statement or in the Mapping Details. |
4,215,066 | This is easy for me to perform in TSQL, but I'm just sitting here banging my head against the desk trying to get it to work in EF4!
I have a table, lets call it TestData. It has fields, say: DataTypeID, Name, DataValue.
```
DataTypeID, Name, DataValue
1,"Data 1","Value1"
1,"Data 1","Value2"
2,"Data 1","Value3"
3,"Dat... | 2010/11/18 | [
"https://Stackoverflow.com/questions/4215066",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/496083/"
] | If the `ToList()` is part of your original query and not just added for this example, then use LINQ to Objects on the resulting list to do the aggregation:
```
var query = (from t in context.TestData
group t by new { DataTypeID = t.DataTypeID, Name = t.Name } into g
select new { DataTypeID = g... | You are so very close already. Try this:
```
var query = (from t in context.TestData
group h by new { DataTypeID = h.DataTypeID, Name = h.Name } into g
select new
{
DataTypeID = g.Key.DataTypeID,
Name = g.Key.Name,
DataValues = String.Join(",", g),
}).ToList()
```
Alternatively, you could do this, if ... |
4,215,066 | This is easy for me to perform in TSQL, but I'm just sitting here banging my head against the desk trying to get it to work in EF4!
I have a table, lets call it TestData. It has fields, say: DataTypeID, Name, DataValue.
```
DataTypeID, Name, DataValue
1,"Data 1","Value1"
1,"Data 1","Value2"
2,"Data 1","Value3"
3,"Dat... | 2010/11/18 | [
"https://Stackoverflow.com/questions/4215066",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/496083/"
] | Thanks to moi\_meme for the answer. What I was hoping to do is NOT POSSIBLE with LINQ to Entities. As others have suggested, you have to use LINQ to Objects to get access to string manipulation methods.
See the link posted by moi\_meme for more info.
**Update 8/27/2018** - Updated Link (again) - <https://web.archive.... | You are so very close already. Try this:
```
var query = (from t in context.TestData
group h by new { DataTypeID = h.DataTypeID, Name = h.Name } into g
select new
{
DataTypeID = g.Key.DataTypeID,
Name = g.Key.Name,
DataValues = String.Join(",", g),
}).ToList()
```
Alternatively, you could do this, if ... |
4,215,066 | This is easy for me to perform in TSQL, but I'm just sitting here banging my head against the desk trying to get it to work in EF4!
I have a table, lets call it TestData. It has fields, say: DataTypeID, Name, DataValue.
```
DataTypeID, Name, DataValue
1,"Data 1","Value1"
1,"Data 1","Value2"
2,"Data 1","Value3"
3,"Dat... | 2010/11/18 | [
"https://Stackoverflow.com/questions/4215066",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/496083/"
] | Some of the Answers suggest calling ToList() and then perform the calculation as LINQ to OBJECT. That's fine for a little amount of data, but what if I have a huge amount of data that I do not want to load into memory too early, then, ToList() may not be an option.
So, the better idea would be to process/format the da... | You are so very close already. Try this:
```
var query = (from t in context.TestData
group h by new { DataTypeID = h.DataTypeID, Name = h.Name } into g
select new
{
DataTypeID = g.Key.DataTypeID,
Name = g.Key.Name,
DataValues = String.Join(",", g),
}).ToList()
```
Alternatively, you could do this, if ... |
4,215,066 | This is easy for me to perform in TSQL, but I'm just sitting here banging my head against the desk trying to get it to work in EF4!
I have a table, lets call it TestData. It has fields, say: DataTypeID, Name, DataValue.
```
DataTypeID, Name, DataValue
1,"Data 1","Value1"
1,"Data 1","Value2"
2,"Data 1","Value3"
3,"Dat... | 2010/11/18 | [
"https://Stackoverflow.com/questions/4215066",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/496083/"
] | If the `ToList()` is part of your original query and not just added for this example, then use LINQ to Objects on the resulting list to do the aggregation:
```
var query = (from t in context.TestData
group t by new { DataTypeID = t.DataTypeID, Name = t.Name } into g
select new { DataTypeID = g... | Some of the Answers suggest calling ToList() and then perform the calculation as LINQ to OBJECT. That's fine for a little amount of data, but what if I have a huge amount of data that I do not want to load into memory too early, then, ToList() may not be an option.
So, the better idea would be to process/format the da... |
4,215,066 | This is easy for me to perform in TSQL, but I'm just sitting here banging my head against the desk trying to get it to work in EF4!
I have a table, lets call it TestData. It has fields, say: DataTypeID, Name, DataValue.
```
DataTypeID, Name, DataValue
1,"Data 1","Value1"
1,"Data 1","Value2"
2,"Data 1","Value3"
3,"Dat... | 2010/11/18 | [
"https://Stackoverflow.com/questions/4215066",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/496083/"
] | Thanks to moi\_meme for the answer. What I was hoping to do is NOT POSSIBLE with LINQ to Entities. As others have suggested, you have to use LINQ to Objects to get access to string manipulation methods.
See the link posted by moi\_meme for more info.
**Update 8/27/2018** - Updated Link (again) - <https://web.archive.... | Some of the Answers suggest calling ToList() and then perform the calculation as LINQ to OBJECT. That's fine for a little amount of data, but what if I have a huge amount of data that I do not want to load into memory too early, then, ToList() may not be an option.
So, the better idea would be to process/format the da... |
33,232,940 | ```
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
int reverse(int a[20],int n);
int main()
{
int a[20];
int n;
printf("enter the number of elements \n");
scanf("%d",&n);
printf("enter the array elements\n");
for(int i=0;i<n... | 2015/10/20 | [
"https://Stackoverflow.com/questions/33232940",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5450448/"
] | You should save your file as .php and run it on a server with php installed on it.
check [XAMP](https://www.apachefriends.org/index.html) to install a local server
EDIT
Just saw that you're running Tomcat, just make sure php is installed, that your server is running, you're running your file from the server And you... | You change file name from trial.html to trial.php |
33,232,940 | ```
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
int reverse(int a[20],int n);
int main()
{
int a[20];
int n;
printf("enter the number of elements \n");
scanf("%d",&n);
printf("enter the array elements\n");
for(int i=0;i<n... | 2015/10/20 | [
"https://Stackoverflow.com/questions/33232940",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5450448/"
] | Rename "Trial.html" to "Trial.php" this is essential when you try to run php code. | You change file name from trial.html to trial.php |
23,164,933 | So I want to write a small app for my e-ink Kindle. I know it's possible -- Amazon has released a [Kindle Developer's Kit](http://kdk.amazon.com/gp/public/gateway), but I can't figure out how to signup (I followed a signup link on another SO post that redirected to the useless homepage).
I've also seen people doing it... | 2014/04/19 | [
"https://Stackoverflow.com/questions/23164933",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2714746/"
] | It's written in Java, specifically Java 1.4.2. | Personal Basis Profile 1.1 and Java 1.4
It seams you cannot register as a developer for the old Kindle anymore, so you need to jailbreak it and use a key (that you create yourself) to sign your jars.
You can find instructions what to do and several resources at the URL mentioned below.
There is also a tool to create... |
41,848,678 | How do i pass additional arguments to next "step" of promise?
```
new Promise((resolve, reject) => {
const a = // do stuff and return a string
return Promise.all([
// execute another promise,
// execute yet another promise
])
})
.then(([resultFromPromise_1, resultFromPromise_2]) => {
// how do i pass `... | 2017/01/25 | [
"https://Stackoverflow.com/questions/41848678",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4845952/"
] | >
> I can add something like `new Promise(resolve => resolve(a))` into `Promise.all` array, but this looks ugly. Is there better way to pass data in such cases?
>
>
>
Yes: Use `then`. If you already have a promise, using `new Promise` is never needed. `then` creates a promise, which waits for the resolution of the... | First off, your first promise has an error, you're not resolving it. You should do something like this:
```
new Promise((resolve, reject) => {
const a = 1;
resolve(Promise.all([
...
]))
})
```
And as for your question, instead of `new Promise(resolve => resolve(a))` you can just pass `a` directly to the... |
28,536,876 | When trying to compile a class, I am getting the following error;
```
ExcelReportServlet.java:341: error: not a statement
/* 302 */ for (Iterator localIterator = keyset.iterator();localIterator.hasNext(); i < j)
^
1 error
``... | 2015/02/16 | [
"https://Stackoverflow.com/questions/28536876",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3017739/"
] | If `(i<j)` is a condition that controls the termination of the for loop, it should be in the second part of the for statement.
For example (not sure if that's the required logic) :
```
for (Iterator localIterator = keyset.iterator(); localIterator.hasNext() && i < j;)
``` | One of the for sintax is `for(declaration; condition; statement)` where the third argument must be a statement that will be executed in each loop.
In your case, the third argument is a condition (i is lower than j). This is the reason for you compile error. It should be like `for (Iterator localIterator = keyset.itera... |
28,536,876 | When trying to compile a class, I am getting the following error;
```
ExcelReportServlet.java:341: error: not a statement
/* 302 */ for (Iterator localIterator = keyset.iterator();localIterator.hasNext(); i < j)
^
1 error
``... | 2015/02/16 | [
"https://Stackoverflow.com/questions/28536876",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3017739/"
] | If `(i<j)` is a condition that controls the termination of the for loop, it should be in the second part of the for statement.
For example (not sure if that's the required logic) :
```
for (Iterator localIterator = keyset.iterator(); localIterator.hasNext() && i < j;)
``` | `i < j` is not a *StatementExpression*. And according to [JLS(§14.14)](http://docs.oracle.com/javase/specs/jls/se7/html/jls-14.html#jls-14.14), the rightmost part of for loop is defined as [ForUpdate](http://docs.oracle.com/javase/specs/jls/se8/html/jls-14.html#jls-ForUpdate) which is in return a [StatementExpressionLi... |
28,536,876 | When trying to compile a class, I am getting the following error;
```
ExcelReportServlet.java:341: error: not a statement
/* 302 */ for (Iterator localIterator = keyset.iterator();localIterator.hasNext(); i < j)
^
1 error
``... | 2015/02/16 | [
"https://Stackoverflow.com/questions/28536876",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3017739/"
] | `i < j` is not a *StatementExpression*. And according to [JLS(§14.14)](http://docs.oracle.com/javase/specs/jls/se7/html/jls-14.html#jls-14.14), the rightmost part of for loop is defined as [ForUpdate](http://docs.oracle.com/javase/specs/jls/se8/html/jls-14.html#jls-ForUpdate) which is in return a [StatementExpressionLi... | One of the for sintax is `for(declaration; condition; statement)` where the third argument must be a statement that will be executed in each loop.
In your case, the third argument is a condition (i is lower than j). This is the reason for you compile error. It should be like `for (Iterator localIterator = keyset.itera... |
9,067,196 | When I run a feature file in RubyMine it will randomly crash with this error. Sometimes it will run one scenario other times it will run a couple before giving this error but it always does. We thought it had something to do with the version of IE we were using but it seems to occur with all versions. Also this issue d... | 2012/01/30 | [
"https://Stackoverflow.com/questions/9067196",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/214162/"
] | There shoudn't be any crashes in Ruby. If that's the case then there is a bug deep down in the Ruby Interpreter of your choice where there shouldn't be one. Try to get a debug report for this and report on Ruby Redmine or the equivalent issue tracker. | I don't think that this is the solution but so far it seems to have fixed my code... In my hooks file I have an after block that among other things has the line @browser.quit I've tracked the failure down to this line and when I comment this line out I don't get the error. Like I said I don't know if this is actually t... |
1,445,354 | >
> Evaluation of $\displaystyle \int\frac{1}{\sin^2 x+\sin x+1}dx$
>
>
>
$\bf{My\; Try::}$ Using $$\; \bullet\; x^2+x+1 = (x-\omega)\cdot (x-\omega^2)\;,$$ where $\omega,\omega^2$ are cube root of unity
So we can write Integal $$\displaystyle I = \int\frac{1}{(\sin x-\omega)\cdot (\sin x-\omega^2)}dx$$
So we ge... | 2015/09/21 | [
"https://math.stackexchange.com/questions/1445354",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/14311/"
] | There are $\binom{98}{50}$ committees that *do not* represent California, hence the answer is given by:
$$ 1-\frac{\binom{98}{50}}{\binom{100}{50}}=1-\frac{50\cdot 49}{100\cdot 99}=\frac{149}{198}\approx\color{red}{75,25\%}. $$ | I'm not sure why you have $\_2C\_1$. I am a little bit inclined to suspect it has to do with choosing one senator from California. But in fact it is possible that both are chosen. Not taking into account the possibility that both are chosen is an error.
One way to proceed is as in Jack d'Aurizio's answer. Here's anoth... |
46,622,752 | I have xml file which I am trying to parse:
>
> This is the xml file content
>
>
>
```xml
<MYSTUFF>
<COMPANYNAMES>
<COMPANYNAME>JUMPIN (JIMMY) LIMITED</COMPANYNAME>
<COMPANYNAME>BLADE RUNNER'S TRANSPORT</COMPANYNAME>
<COMPANYNAME>P Griffiths & Sons</COMPANYNAME>
<COMPANYNAME>SOMETIMES, NEVER</COMPANYNAME>
<COMPA... | 2017/10/07 | [
"https://Stackoverflow.com/questions/46622752",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7713366/"
] | Your XML file doesn't load correctly.
a) I suppose your XML file starts with something like `<?xml version="1.0" encoding="utf-8"?>`, so that it can be identified as XML.
b) It's preferable to declare your object settings (always use `Option Explicit` in the declaration head). As you are using so called late bindin... | Your code ran fine for me. As @FlorentB. suggested, the document probably failed to parse. I suspect their is an error in the file name. Adding some error handling will help catch these errors.
```vb
Sub PrintXML()
Dim FilePath As String
Dim XDoc As Object
FilePath = ThisWorkbook.Path & "\test.xml"
... |
41,277,193 | [](https://i.stack.imgur.com/dxol7.png)
From the above image i have added more functionality,
So my question is for every skill GD (or) PI (or) both checkboxes has to be mandatory.(Atleast one checkbox has to be selected)
how can i achieve that.?
this is ... | 2016/12/22 | [
"https://Stackoverflow.com/questions/41277193",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6382509/"
] | Give same class name to all checkbox and try this one
```
$(document).ready(function() {
$("#submitBTN").click(function(e) {
if($('.case:checkbox:checked').length==0){
alert("Please select");
}
});
});
``` | **If Both checkboxes are empty for every skill say select atleast on checkbox**
```
var rows = document.getElementsByTagName('tr');
var isTableValid = true;
for(var i=0;i<rows.length;i++) {
var checkboxs=rows[i].getElementsByClassName("selectGdSkill");//add "selectPiSkill" class in this
var o... |
41,277,193 | [](https://i.stack.imgur.com/dxol7.png)
From the above image i have added more functionality,
So my question is for every skill GD (or) PI (or) both checkboxes has to be mandatory.(Atleast one checkbox has to be selected)
how can i achieve that.?
this is ... | 2016/12/22 | [
"https://Stackoverflow.com/questions/41277193",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6382509/"
] | Here Your HTML I have changed input box IDs and put your table
`<div id="myDiv">
<table id="tableID">
<tr>
GD<input class="selectGdSkill" type="checkbox" id="selectGdSkill_0">
PI<input class="selectPiSkill" type="checkbox" id="selectPiSkill_1">
</tr>
<br>
<tr>
GD<input class="selectGdSkill" type="checkbox" id... | **If Both checkboxes are empty for every skill say select atleast on checkbox**
```
var rows = document.getElementsByTagName('tr');
var isTableValid = true;
for(var i=0;i<rows.length;i++) {
var checkboxs=rows[i].getElementsByClassName("selectGdSkill");//add "selectPiSkill" class in this
var o... |
63,719,614 | I have a date object `1/10/2021` and when I set date minus 1. It will return `31/10/2021`.
What I expect here is 30/9/2021.
Here is my simulate of code:
```js
const _date = new Date(2021, 10, 1);
_date.setDate(_date.getDate() - 1);
console.log(_date) // Sun Oct 31 2021 00:00:00 GMT+0800 (Singapore Standard Time)
```... | 2020/09/03 | [
"https://Stackoverflow.com/questions/63719614",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4344732/"
] | Months are 0-indexed. Your first statement initiates the date to be November 1st.
```js
const _date = new Date(2021, 10, 1);
console.log(_date) // Nov 1, 2021
```
More documentation on the Date object here: <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date> | Months are 0-indexed, so you need to change this to 9 for October.
Or use something more intuitive like this:
```
var _date = new Date('October 1 2021');
```
Also consider using toString() methods.
```js
var _date = new Date(2021, 9, 1);
_date.setDate(_date.getDate() - 1);
console.log(_date.toLocaleString());
``` |
41,291,351 | I have a route that just shows some form:
```
Route::get('/form/{form}', 'FormController@show');
```
In the `FormController`, thanks to type injection I automagically convert form id (from `{form}`) to `App\Form` object and display it in the view:
```
public function show(Form $form){
return view('form', compac... | 2016/12/22 | [
"https://Stackoverflow.com/questions/41291351",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/177167/"
] | To automatically lazy load the subform when it is resolved in a route you can customize your route model binding. Define the custom resolution in the `boot()` method of `App\Providers\RouteServiceProvider` like:
```
public function boot()
{
parent::boot();
Route::bind('form', function ($id) {
return A... | You can add relation by using [`load()`](https://laravel.com/docs/5.3/eloquent-relationships#lazy-eager-loading) method:
```
public function show(Form $form)
{
return view('form', ['form' => $form->load('subform')]);
}
``` |
30,295 | Why is the phrase [Across the pond](http://en.wiktionary.org/wiki/across_the_pond) used to refer to the opposite side of the Atlantic Ocean? Considering the size of the Atlantic Ocean is vast, is it suggesting the ocean is only a small hindrance? Considering that in the modern world it has become easier to communicate ... | 2011/06/17 | [
"https://english.stackexchange.com/questions/30295",
"https://english.stackexchange.com",
"https://english.stackexchange.com/users/5693/"
] | I feel that the aspect "the world is smaller now" is really not that relevant: indeed, the phrase is far too old for that to be the case.
Rather, it's a perfect example of typical understated, dry, English humour.
I'm afraid I don't know about earliest usage although PHenry mentioned it could have been used as early ... | It's a humorous understatement, like calling the United States "the colonies."
The expression seems to have come into being in the late 19th century. On Google Books I find [a use of it from 1885](http://books.google.com/books?id=CskhAQAAIAAJ&printsec=frontcover#v=onepage&q=%22across%20the%20pond%22&f=false), but noth... |
30,295 | Why is the phrase [Across the pond](http://en.wiktionary.org/wiki/across_the_pond) used to refer to the opposite side of the Atlantic Ocean? Considering the size of the Atlantic Ocean is vast, is it suggesting the ocean is only a small hindrance? Considering that in the modern world it has become easier to communicate ... | 2011/06/17 | [
"https://english.stackexchange.com/questions/30295",
"https://english.stackexchange.com",
"https://english.stackexchange.com/users/5693/"
] | It's a humorous understatement, like calling the United States "the colonies."
The expression seems to have come into being in the late 19th century. On Google Books I find [a use of it from 1885](http://books.google.com/books?id=CskhAQAAIAAJ&printsec=frontcover#v=onepage&q=%22across%20the%20pond%22&f=false), but noth... | As an aviator, we refer to the Pacific as the "pond" and the Atlantic as the "puddle". A girlfriend of mine, most recently a captain on American Eagle, now retired, used to ferry planes across the Pacific, aka the pond, to NZ or Aus from California and she also ferried quite a few across the puddle from California to t... |
30,295 | Why is the phrase [Across the pond](http://en.wiktionary.org/wiki/across_the_pond) used to refer to the opposite side of the Atlantic Ocean? Considering the size of the Atlantic Ocean is vast, is it suggesting the ocean is only a small hindrance? Considering that in the modern world it has become easier to communicate ... | 2011/06/17 | [
"https://english.stackexchange.com/questions/30295",
"https://english.stackexchange.com",
"https://english.stackexchange.com/users/5693/"
] | I feel that the aspect "the world is smaller now" is really not that relevant: indeed, the phrase is far too old for that to be the case.
Rather, it's a perfect example of typical understated, dry, English humour.
I'm afraid I don't know about earliest usage although PHenry mentioned it could have been used as early ... | The reason phenry couldn't find matches from before 1885 in a Google Books search for "the pond" may have been that in many early references the expression contains a qualifying modifier: "the big pond," "the great pond," "the herring pond," "the salt pond," or some combination of these characterizations. At least one ... |
30,295 | Why is the phrase [Across the pond](http://en.wiktionary.org/wiki/across_the_pond) used to refer to the opposite side of the Atlantic Ocean? Considering the size of the Atlantic Ocean is vast, is it suggesting the ocean is only a small hindrance? Considering that in the modern world it has become easier to communicate ... | 2011/06/17 | [
"https://english.stackexchange.com/questions/30295",
"https://english.stackexchange.com",
"https://english.stackexchange.com/users/5693/"
] | I feel that the aspect "the world is smaller now" is really not that relevant: indeed, the phrase is far too old for that to be the case.
Rather, it's a perfect example of typical understated, dry, English humour.
I'm afraid I don't know about earliest usage although PHenry mentioned it could have been used as early ... | Put quite simply, "the Pond" is an expression of the relationship that exists, still to this day, between the United States of America and Great Britain. It's a linguistic way of reducing the 3000 miles that physically exist between our two countries and recognising how much we actually have in common. By far and away ... |
30,295 | Why is the phrase [Across the pond](http://en.wiktionary.org/wiki/across_the_pond) used to refer to the opposite side of the Atlantic Ocean? Considering the size of the Atlantic Ocean is vast, is it suggesting the ocean is only a small hindrance? Considering that in the modern world it has become easier to communicate ... | 2011/06/17 | [
"https://english.stackexchange.com/questions/30295",
"https://english.stackexchange.com",
"https://english.stackexchange.com/users/5693/"
] | It's a humorous understatement, like calling the United States "the colonies."
The expression seems to have come into being in the late 19th century. On Google Books I find [a use of it from 1885](http://books.google.com/books?id=CskhAQAAIAAJ&printsec=frontcover#v=onepage&q=%22across%20the%20pond%22&f=false), but noth... | I first saw it myself from Brits when speaking of America. I believe it was probably originally a jokey reference to how easy it was for them to cross large bodies of water, back in the day when their Navy ruled the world's oceans. Now that the US Navy is in that position, I've seen a few of us USAsians using back at t... |
30,295 | Why is the phrase [Across the pond](http://en.wiktionary.org/wiki/across_the_pond) used to refer to the opposite side of the Atlantic Ocean? Considering the size of the Atlantic Ocean is vast, is it suggesting the ocean is only a small hindrance? Considering that in the modern world it has become easier to communicate ... | 2011/06/17 | [
"https://english.stackexchange.com/questions/30295",
"https://english.stackexchange.com",
"https://english.stackexchange.com/users/5693/"
] | The reason phenry couldn't find matches from before 1885 in a Google Books search for "the pond" may have been that in many early references the expression contains a qualifying modifier: "the big pond," "the great pond," "the herring pond," "the salt pond," or some combination of these characterizations. At least one ... | Put quite simply, "the Pond" is an expression of the relationship that exists, still to this day, between the United States of America and Great Britain. It's a linguistic way of reducing the 3000 miles that physically exist between our two countries and recognising how much we actually have in common. By far and away ... |
30,295 | Why is the phrase [Across the pond](http://en.wiktionary.org/wiki/across_the_pond) used to refer to the opposite side of the Atlantic Ocean? Considering the size of the Atlantic Ocean is vast, is it suggesting the ocean is only a small hindrance? Considering that in the modern world it has become easier to communicate ... | 2011/06/17 | [
"https://english.stackexchange.com/questions/30295",
"https://english.stackexchange.com",
"https://english.stackexchange.com/users/5693/"
] | I feel that the aspect "the world is smaller now" is really not that relevant: indeed, the phrase is far too old for that to be the case.
Rather, it's a perfect example of typical understated, dry, English humour.
I'm afraid I don't know about earliest usage although PHenry mentioned it could have been used as early ... | I first saw it myself from Brits when speaking of America. I believe it was probably originally a jokey reference to how easy it was for them to cross large bodies of water, back in the day when their Navy ruled the world's oceans. Now that the US Navy is in that position, I've seen a few of us USAsians using back at t... |
30,295 | Why is the phrase [Across the pond](http://en.wiktionary.org/wiki/across_the_pond) used to refer to the opposite side of the Atlantic Ocean? Considering the size of the Atlantic Ocean is vast, is it suggesting the ocean is only a small hindrance? Considering that in the modern world it has become easier to communicate ... | 2011/06/17 | [
"https://english.stackexchange.com/questions/30295",
"https://english.stackexchange.com",
"https://english.stackexchange.com/users/5693/"
] | It's a humorous understatement, like calling the United States "the colonies."
The expression seems to have come into being in the late 19th century. On Google Books I find [a use of it from 1885](http://books.google.com/books?id=CskhAQAAIAAJ&printsec=frontcover#v=onepage&q=%22across%20the%20pond%22&f=false), but noth... | Put quite simply, "the Pond" is an expression of the relationship that exists, still to this day, between the United States of America and Great Britain. It's a linguistic way of reducing the 3000 miles that physically exist between our two countries and recognising how much we actually have in common. By far and away ... |
30,295 | Why is the phrase [Across the pond](http://en.wiktionary.org/wiki/across_the_pond) used to refer to the opposite side of the Atlantic Ocean? Considering the size of the Atlantic Ocean is vast, is it suggesting the ocean is only a small hindrance? Considering that in the modern world it has become easier to communicate ... | 2011/06/17 | [
"https://english.stackexchange.com/questions/30295",
"https://english.stackexchange.com",
"https://english.stackexchange.com/users/5693/"
] | I feel that the aspect "the world is smaller now" is really not that relevant: indeed, the phrase is far too old for that to be the case.
Rather, it's a perfect example of typical understated, dry, English humour.
I'm afraid I don't know about earliest usage although PHenry mentioned it could have been used as early ... | As an aviator, we refer to the Pacific as the "pond" and the Atlantic as the "puddle". A girlfriend of mine, most recently a captain on American Eagle, now retired, used to ferry planes across the Pacific, aka the pond, to NZ or Aus from California and she also ferried quite a few across the puddle from California to t... |
30,295 | Why is the phrase [Across the pond](http://en.wiktionary.org/wiki/across_the_pond) used to refer to the opposite side of the Atlantic Ocean? Considering the size of the Atlantic Ocean is vast, is it suggesting the ocean is only a small hindrance? Considering that in the modern world it has become easier to communicate ... | 2011/06/17 | [
"https://english.stackexchange.com/questions/30295",
"https://english.stackexchange.com",
"https://english.stackexchange.com/users/5693/"
] | I first saw it myself from Brits when speaking of America. I believe it was probably originally a jokey reference to how easy it was for them to cross large bodies of water, back in the day when their Navy ruled the world's oceans. Now that the US Navy is in that position, I've seen a few of us USAsians using back at t... | As an aviator, we refer to the Pacific as the "pond" and the Atlantic as the "puddle". A girlfriend of mine, most recently a captain on American Eagle, now retired, used to ferry planes across the Pacific, aka the pond, to NZ or Aus from California and she also ferried quite a few across the puddle from California to t... |
45,343,814 | Hi I am developing print functionality in angularjs. I followed [this](http://jsfiddle.net/95ezN/121/). I have one button and clicking on that i want to take print. For example i want to print below content.
```
<div id="printThis" >
This should BE printed!
<div class="modifyMe">old</div>
</div>
```
The prob... | 2017/07/27 | [
"https://Stackoverflow.com/questions/45343814",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4542527/"
] | You can either use Bootstrap class **.hidden-print** to hide div from print or you can use following css code:
```
@media print
{
.no-print, .no-print *
{
display: none !important;
}
}
```
You have to use **.no-print** class to div which you want to hide. | this is complete solution(snippet will not work here because i think SO doesn't allow to open popup windows from snippet):
```js
var app = angular.module("myApp", []);
app.controller("myCtrl", function($scope) {
$scope.printDiv = function(divName) {
var printContents = document.getElementById(divNam... |
45,343,814 | Hi I am developing print functionality in angularjs. I followed [this](http://jsfiddle.net/95ezN/121/). I have one button and clicking on that i want to take print. For example i want to print below content.
```
<div id="printThis" >
This should BE printed!
<div class="modifyMe">old</div>
</div>
```
The prob... | 2017/07/27 | [
"https://Stackoverflow.com/questions/45343814",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4542527/"
] | You can use `ng-click` to toggle like this
```
<div id="printThis" ng-if="showPrint" ng-init="showPrint=false">
This should BE printed!
<div class="modifyMe">old</div>
</div>
<button type="button" ng-click="showPrint=!showPrint"></button>
```
If you don't want to use angular, try this
**HTML**
```
<div cl... | this is complete solution(snippet will not work here because i think SO doesn't allow to open popup windows from snippet):
```js
var app = angular.module("myApp", []);
app.controller("myCtrl", function($scope) {
$scope.printDiv = function(divName) {
var printContents = document.getElementById(divNam... |
297,061 | Usually we say that the partition function of CFTs on a torus is modular invariant, because we define theory on a torus. If I have a non-conformal field the theory on a torus, is its partition function still modular invariant? | 2016/12/07 | [
"https://physics.stackexchange.com/questions/297061",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/45232/"
] | No, a generic theory on a torus is not modular invariant.
A conformal field theory cannot depend on the metric of the space it is defined on but only on its conformal equivalence class. It is a fact that the space of such classes for the torus is given by a complex parameter $\tau$, the (conformal) modulus, defining ... | Let $T = \mathbb{C}/\left( {\mathbb{Z} \oplus \tau \mathbb{Z}} \right)$. This torus is conformally equivalent to any torus $T' = \mathbb{C}/\left( {\mathbb{Z} \oplus \tau '\mathbb{Z}} \right)$ with $\tau ' = \frac{{a\tau + b}}{{c\tau + \operatorname{d} }}$ such that a,b,c,d integral and $\left| {\begin{array}{\*{20}{c}... |
42,441,914 | I'm working with files with this format:
```
=Cluster=
SPEC PRD000681;PRIDE_Exp_Complete_Ac_22491.xml;spectrum=1074 true
SPEC PRD000681;PRIDE_Exp_Complete_Ac_22498.xml;spectrum=2950 true
=Cluster=
SPEC PRD000681;PRIDE_Exp_Complete_Ac_22498.xml;spectrum=1876 true
SPEC PRD000681;PRIDE_Exp_Complete_Ac_22498.xml;spectrum... | 2017/02/24 | [
"https://Stackoverflow.com/questions/42441914",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5794310/"
] | This will open your file containing your original code as well as a new file that will output the unique lines per group.
`seen` is a `set` and is great for seeing if something exists within it already.
`data` is a `list` and will keep track of the iterations of `"=Cluster="` groups.
Then you simply review each line... | The solution using [***re.search()***](https://docs.python.org/3/library/re.html#re.search) function and custom `spectrums` set object for keeping only unique `spectrum` numbers:
```
with open('f_input.txt') as oldfile, open('new_file.txt', 'w') as newfile:
spectrums = set()
for line in oldfile:
if '=C... |
42,441,914 | I'm working with files with this format:
```
=Cluster=
SPEC PRD000681;PRIDE_Exp_Complete_Ac_22491.xml;spectrum=1074 true
SPEC PRD000681;PRIDE_Exp_Complete_Ac_22498.xml;spectrum=2950 true
=Cluster=
SPEC PRD000681;PRIDE_Exp_Complete_Ac_22498.xml;spectrum=1876 true
SPEC PRD000681;PRIDE_Exp_Complete_Ac_22498.xml;spectrum... | 2017/02/24 | [
"https://Stackoverflow.com/questions/42441914",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5794310/"
] | This is how I would do it.
```
file_in = r'someFile.txt'
file_out = r'someOtherFile.txt'
with open(file_in, 'r') as f_in, open(file_out, 'w') as f_out:
seen_spectra = set()
for line in f_in:
if '=Cluster=' in line or line.strip() == '':
seen_spectra = set()
f_out.write(line)
... | The solution using [***re.search()***](https://docs.python.org/3/library/re.html#re.search) function and custom `spectrums` set object for keeping only unique `spectrum` numbers:
```
with open('f_input.txt') as oldfile, open('new_file.txt', 'w') as newfile:
spectrums = set()
for line in oldfile:
if '=C... |
42,441,914 | I'm working with files with this format:
```
=Cluster=
SPEC PRD000681;PRIDE_Exp_Complete_Ac_22491.xml;spectrum=1074 true
SPEC PRD000681;PRIDE_Exp_Complete_Ac_22498.xml;spectrum=2950 true
=Cluster=
SPEC PRD000681;PRIDE_Exp_Complete_Ac_22498.xml;spectrum=1876 true
SPEC PRD000681;PRIDE_Exp_Complete_Ac_22498.xml;spectrum... | 2017/02/24 | [
"https://Stackoverflow.com/questions/42441914",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5794310/"
] | Shortest solution in Python :p
```
import os
os.system("""awk 'line != $0; { line = $0 }' originalfile.txt > dedup.txt""")
```
output:
```
=Cluster=
SPEC PRD000681;PRIDE_Exp_Complete_Ac_22491.xml;spectrum=1074 true
SPEC PRD000681;PRIDE_Exp_Complete_Ac_22498.xml;spectrum=2950 true
=Cluster=
SPEC PRD000681;PRIDE_Exp... | The solution using [***re.search()***](https://docs.python.org/3/library/re.html#re.search) function and custom `spectrums` set object for keeping only unique `spectrum` numbers:
```
with open('f_input.txt') as oldfile, open('new_file.txt', 'w') as newfile:
spectrums = set()
for line in oldfile:
if '=C... |
50,194,629 | javascript newbie here again.
I don't need to know *how* to do something, I just need help *understanding* something.
I just completed a coding challenge in a beginner book I am reading that asks you to make a game in which the user has to search for the "buried treasure" on a treasure map. The game calculates the di... | 2018/05/05 | [
"https://Stackoverflow.com/questions/50194629",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9616976/"
] | You aren't assigning the function to the variable inside the event handler....you are assigning what the call of that function ***returns***.
In the case of the function reference assigned to variable `getDistance` when you call that function and pass in an `event` and a `target` it *returns* a calculated number. It i... | The variables `distance` and `distanceHint` are saved or to be more specific, assigned inside the event handler, not `getDistance` and `hints`.
In the following, `distance` and `distanceHint` are the new variables here and the following simply means their values are assigned to `getDistance`'s and `hints`'s value and ... |
71,439,776 | I have a function that takes a vector
```
function foo(x::Vector{Int64})
x
end
```
How can I make it work also for scalars (i.e. turn them into one-element vectors)?
I know that I can do this:
```
foo(x::Int64) = foo([x])
```
but this stops being cool when there are more arguments, because you're writing mul... | 2022/03/11 | [
"https://Stackoverflow.com/questions/71439776",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7210250/"
] | You can assign new title to the document like this:
```
document.getElementById("titleSumbitBtn").onclick = function (){
var newTitle = document.getElementById("newTitle").value;
document.title = newTitle;
}
```
This is actual implementation but keep in mind that it must run after the DOM element with id `ne... | try this:
```
document.getElementById("titleSumbitBtn").addEventListener("click", function (){
var newTitle = document.getElementById("newTitle").value;
document.getElementById("title").innerText = newTitle;
```
}) |
52,318,615 | In my Spring Boot web app, there is an HTML form, which populates a `Blueprint` object:
```
data class Blueprint(
// relevant part, validation omitted
var items: List<Long> = emptyList() // List of ids
// ...
)
```
Later on, I intend to use this `Blueprint` to create a `Product`, which would be a data ... | 2018/09/13 | [
"https://Stackoverflow.com/questions/52318615",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8041935/"
] | Try using a Handler().postDelayed() like below -
```
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
//hide progressbar
onBackPressed();
}
}, 5000);
``` | onBackPressed() should be called from the UI Thread. What Darshan has suggested is the correct answer. When you want to update UI from a background thread (in this case the thread that waits for your timer to finish) you should use Handler. In place of the thread, replace
```
new Handler().postDelayed(new Runnable() ... |
60,044,584 | On [FreeBSD](https://www.freebsd.org/), I need `NODE_ENV=production` and other systemwide environment variables to be set on startup, before nginx fires up.
Which is the right place i.e. file I do that? | 2020/02/03 | [
"https://Stackoverflow.com/questions/60044584",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/716568/"
] | One option could be to add your environment variables to `/etc/login.conf` in the `setenv` capability, for example:
```
default:\
:passwd_format=sha512:\
:copyright=/etc/COPYRIGHT:\
:welcome=/etc/motd:\
:setenv=MAIL=/var/mail/$,BLOCKSIZE=K,NODE_ENV=production:\
...
```
From the [login.conf](https... | Also, if you'd like to set some environment variables for an [rc(8)](https://www.freebsd.org/cgi/man.cgi?rc) service then you might also take a look at the `${name}_env` and `${name}_env_file` variables described in [rc.subr(8)](https://www.freebsd.org/cgi/man.cgi?rc.subr). They allow you to set environment variables f... |
694,413 | I'd like to know how to convert prices -- $\$20$ per month is how much in one year? For example: "Tim pays $\$20$ a month for his cell phone bill. How much will he pay in one year?" | 2014/02/28 | [
"https://math.stackexchange.com/questions/694413",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/109399/"
] | In science classes at least, there's a concept called dimensional analysis, which lets you get from one set of units to another set of units.
$$\require{cancel} \frac{\$20}{1\text{ month}}=\frac{\$20}{1\cancel{\text{ month}}}\times \frac{12\cancel{\text{ months}}}{1\text{ year}}=\frac{\$20\times12}{1\text{ year}}=\fra... | Multiply the the amount of change per unit(change in money, per month) by total units (12 months) |
8,186,299 | When I need to view a table's schema, I use `sp_help`, which will give me something like:
```
Column Name Type Length
My_COLUMN nvarchar 50
```
But if I open up the table in Design Mode, I'll get
```
MY_COLUMN nvarchar(25)
```
Why? | 2011/11/18 | [
"https://Stackoverflow.com/questions/8186299",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/194931/"
] | 25 is the maximum length in characters.
50 is the maximum length in bytes.
`n[var]char` columns consume 2 bytes per character. | The "length" you're seeing in the `sp_help` listing is the length in bytes and, since nvarchar is a double-byte data type, it is double what was declared in the table creation. |
18,282,210 | I have a CSV file of ID numbers that I need as an `IEnumberable<int>`. I was trying to get from A to B as simply as possible, and came up with the following idea:
```
Global.migrated = File.ReadAllText(Global.migrationList).Split(',').Cast<int>().ToList<int>();
```
When I run this, though, I'm told that the Cast is ... | 2013/08/16 | [
"https://Stackoverflow.com/questions/18282210",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1638627/"
] | Instead of property/value pair implement this structure as an array of objects. Arrays you can sort by any property of objects it contains. | One way to get the keys in sorted order would be to use the method defined here to generate an array of the keys:
[Getting JavaScript object key list](https://stackoverflow.com/questions/3068534/getting-javascript-object-key-list)
Then you could use the javascript `sort` function:
<http://www.w3schools.com/jsref/jsr... |
18,282,210 | I have a CSV file of ID numbers that I need as an `IEnumberable<int>`. I was trying to get from A to B as simply as possible, and came up with the following idea:
```
Global.migrated = File.ReadAllText(Global.migrationList).Split(',').Cast<int>().ToList<int>();
```
When I run this, though, I'm told that the Cast is ... | 2013/08/16 | [
"https://Stackoverflow.com/questions/18282210",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1638627/"
] | Because objects are unordered collections, it's up to you to enforce the ordering you want.
One way is to get an Array of the object properties, sort them, then iterate the Array.
```
Object.keys(data)
.sort(function(a, b) {
return +b - +a;
})
.forEach(function(key) {
var item =... | One way to get the keys in sorted order would be to use the method defined here to generate an array of the keys:
[Getting JavaScript object key list](https://stackoverflow.com/questions/3068534/getting-javascript-object-key-list)
Then you could use the javascript `sort` function:
<http://www.w3schools.com/jsref/jsr... |
18,282,210 | I have a CSV file of ID numbers that I need as an `IEnumberable<int>`. I was trying to get from A to B as simply as possible, and came up with the following idea:
```
Global.migrated = File.ReadAllText(Global.migrationList).Split(',').Cast<int>().ToList<int>();
```
When I run this, though, I'm told that the Cast is ... | 2013/08/16 | [
"https://Stackoverflow.com/questions/18282210",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1638627/"
] | When you iterate over object properties, there is no guarantee on the order. You can add your objects to an array, and sort the array instead:
```
var obj = {"2012" : {}, "2011" : {}, "2013" : {}};
var arr = [];
for (var year in obj) {
arr.push({year : year, data : obj[year]});
}
arr.sort(function(a,b) {
retur... | One way to get the keys in sorted order would be to use the method defined here to generate an array of the keys:
[Getting JavaScript object key list](https://stackoverflow.com/questions/3068534/getting-javascript-object-key-list)
Then you could use the javascript `sort` function:
<http://www.w3schools.com/jsref/jsr... |
21,281,212 | I have a little problem with my binary search function inside a class definition:
```
def searchExactIndex(self, key):
bottom = 0
top = self.keyc
found = False
while bottom <= top and not found:
middle = (bottom+top)/2
if self.keys[middle] == key:
found = True
elif self.keys[... | 2014/01/22 | [
"https://Stackoverflow.com/questions/21281212",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3223137/"
] | With the error you are seeing,
```
IndentationError: unexpected indent
```
Python is trying to tell you that something is wrong with the way you indented your code, and indeed there is, you need to look at the indentation before the first three lines in the `searchExactIndex` method.
Your code looks fine, except fo... | How do you enter this code in python ?
According to your code, you should have thoses syntax errors:
If enter in a file :
```
File "test.py", line 4
bottom = 0
^
IndentationError: expected an indented block
```
If enter in interactive python:
```
>>> def searchExactIndex(self, key):
...
File "<s... |
25,640,719 | I am trying to write an app, that will be scheduled to autodownload one page from a Sharepoint server every hour. It is an xml file. Everything works so far, except I do not like storing the password needed to connect to Sharepoint in plaintext in my app. Sample code here:
```
WebClient client = new WebClient();
Strin... | 2014/09/03 | [
"https://Stackoverflow.com/questions/25640719",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4003279/"
] | In fact you'd better not use passwords. If the service runs under the right credentials, you can use that one by using the [`DefaultNetworkCredentials`](http://msdn.microsoft.com/en-us/library/system.net.credentialcache.defaultnetworkcredentials(v=vs.110).aspx):
So in your sample:
```
client.Credentials = CredentialC... | If you must store the password with the app, put it in the config file and then encrypt the appropriate section(s) of that using [Protected Configuration](http://msdn.microsoft.com/en-us/library/53tyfkaw.aspx). |
3,025,763 | Suppose a is an integer. If 5|2a then 5|a. Prove
So i just suppose that 5|2a and so 2a=5b for some b in the integers but i dont know where to go from here.
Thanks for help | 2018/12/04 | [
"https://math.stackexchange.com/questions/3025763",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/622342/"
] | The integral that you actually computed corresponds to the area of a rectangle. You should actually compute$$\int\_0^t\int\_0^{\frac x2}\,\mathrm dy\,\mathrm dx.$$ | I think you made a mistake, the bounds on the inner integral should not be constant:
$$
\int\_0^t \int\_0^{v/2} dudv
= \int\_0^t \frac{v}{2} dv
= \left. \frac{v^2}{4} \right|\_0^t = \frac{t^2}{4}.
$$ |
64,127,200 | I have navlink defined as follows
`<NavLink href="/intro"></NavLink>`
In dev it works fine as the root of the site is at the same level as the blazor app.
In prod I have to put the blazor site inside a folder in the default iis website.
So my url becomes something like this
`http://something/apps/cor/`
So the `<Nav... | 2020/09/29 | [
"https://Stackoverflow.com/questions/64127200",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2501497/"
] | Dot before the path. `./intro` is how you do it | on `index.html` you should have `<base href="/apps/cor/" />` |
64,127,200 | I have navlink defined as follows
`<NavLink href="/intro"></NavLink>`
In dev it works fine as the root of the site is at the same level as the blazor app.
In prod I have to put the blazor site inside a folder in the default iis website.
So my url becomes something like this
`http://something/apps/cor/`
So the `<Nav... | 2020/09/29 | [
"https://Stackoverflow.com/questions/64127200",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2501497/"
] | Dot before the path. `./intro` is how you do it | I had to do this trick in `_Layout.cshtml`:
```
@inject IWebHostEnvironment Environment;
// in <head> :
@if (Environment.IsDevelopment())
{
<base href="~/" />
}
else
{
<base href="~/myApp" />
}
```
then either `<NavLink href="page"></NavLink>` or `<NavLink href="./page"></NavLink>` works.
* On localhost: `... |
64,127,200 | I have navlink defined as follows
`<NavLink href="/intro"></NavLink>`
In dev it works fine as the root of the site is at the same level as the blazor app.
In prod I have to put the blazor site inside a folder in the default iis website.
So my url becomes something like this
`http://something/apps/cor/`
So the `<Nav... | 2020/09/29 | [
"https://Stackoverflow.com/questions/64127200",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2501497/"
] | on `index.html` you should have `<base href="/apps/cor/" />` | I had to do this trick in `_Layout.cshtml`:
```
@inject IWebHostEnvironment Environment;
// in <head> :
@if (Environment.IsDevelopment())
{
<base href="~/" />
}
else
{
<base href="~/myApp" />
}
```
then either `<NavLink href="page"></NavLink>` or `<NavLink href="./page"></NavLink>` works.
* On localhost: `... |
14,240,003 | * No `websockets` on [Heroku](http://www.heroku.com/),
* no `thin` on [Engineyard](http://www.engineyard.com/),
* gave [OpenShift](https://openshift.redhat.com/) a try, but they are quite far from being ready for production.
If I want to host a Ruby/Rails app which uses `websockets` via `faye`, where can I do that? | 2013/01/09 | [
"https://Stackoverflow.com/questions/14240003",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/341929/"
] | Not sure what you are trying to spend, but your best option is proably going to be looking into a VPS hosting solution, such as [Linode](http://www.linode.com/). This way you have the freedom to install the software that you need.
**Edit:** (based on your comment)
You could also try [the free tier of Amazon EC2](ht... | Roll your own vserver, costs just a few bucks nowadays. You can run there everything you want and have full control over it. |
14,240,003 | * No `websockets` on [Heroku](http://www.heroku.com/),
* no `thin` on [Engineyard](http://www.engineyard.com/),
* gave [OpenShift](https://openshift.redhat.com/) a try, but they are quite far from being ready for production.
If I want to host a Ruby/Rails app which uses `websockets` via `faye`, where can I do that? | 2013/01/09 | [
"https://Stackoverflow.com/questions/14240003",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/341929/"
] | Roll your own vserver, costs just a few bucks nowadays. You can run there everything you want and have full control over it. | There's a company called Blue Box in Seattle you might look into.
I work there, so there's that shameless plug aspect going on. But I think they'll be your best bet. |
14,240,003 | * No `websockets` on [Heroku](http://www.heroku.com/),
* no `thin` on [Engineyard](http://www.engineyard.com/),
* gave [OpenShift](https://openshift.redhat.com/) a try, but they are quite far from being ready for production.
If I want to host a Ruby/Rails app which uses `websockets` via `faye`, where can I do that? | 2013/01/09 | [
"https://Stackoverflow.com/questions/14240003",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/341929/"
] | Roll your own vserver, costs just a few bucks nowadays. You can run there everything you want and have full control over it. | Here's an [example OpenShift DIY instance](https://github.com/jweissman/zephyr-faye-diy) that's currently running a prod Faye instance in the cloud for me.
As you say, OpenShift isn't really ready for primetime -- so I'm actually talking to this box from my main app running on Heroku! One note here might be that webs... |
14,240,003 | * No `websockets` on [Heroku](http://www.heroku.com/),
* no `thin` on [Engineyard](http://www.engineyard.com/),
* gave [OpenShift](https://openshift.redhat.com/) a try, but they are quite far from being ready for production.
If I want to host a Ruby/Rails app which uses `websockets` via `faye`, where can I do that? | 2013/01/09 | [
"https://Stackoverflow.com/questions/14240003",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/341929/"
] | Heroku now supports WebSockets (finally!): <https://devcenter.heroku.com/articles/heroku-labs-websockets> | Roll your own vserver, costs just a few bucks nowadays. You can run there everything you want and have full control over it. |
14,240,003 | * No `websockets` on [Heroku](http://www.heroku.com/),
* no `thin` on [Engineyard](http://www.engineyard.com/),
* gave [OpenShift](https://openshift.redhat.com/) a try, but they are quite far from being ready for production.
If I want to host a Ruby/Rails app which uses `websockets` via `faye`, where can I do that? | 2013/01/09 | [
"https://Stackoverflow.com/questions/14240003",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/341929/"
] | Not sure what you are trying to spend, but your best option is proably going to be looking into a VPS hosting solution, such as [Linode](http://www.linode.com/). This way you have the freedom to install the software that you need.
**Edit:** (based on your comment)
You could also try [the free tier of Amazon EC2](ht... | There's a company called Blue Box in Seattle you might look into.
I work there, so there's that shameless plug aspect going on. But I think they'll be your best bet. |
14,240,003 | * No `websockets` on [Heroku](http://www.heroku.com/),
* no `thin` on [Engineyard](http://www.engineyard.com/),
* gave [OpenShift](https://openshift.redhat.com/) a try, but they are quite far from being ready for production.
If I want to host a Ruby/Rails app which uses `websockets` via `faye`, where can I do that? | 2013/01/09 | [
"https://Stackoverflow.com/questions/14240003",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/341929/"
] | Not sure what you are trying to spend, but your best option is proably going to be looking into a VPS hosting solution, such as [Linode](http://www.linode.com/). This way you have the freedom to install the software that you need.
**Edit:** (based on your comment)
You could also try [the free tier of Amazon EC2](ht... | Here's an [example OpenShift DIY instance](https://github.com/jweissman/zephyr-faye-diy) that's currently running a prod Faye instance in the cloud for me.
As you say, OpenShift isn't really ready for primetime -- so I'm actually talking to this box from my main app running on Heroku! One note here might be that webs... |
14,240,003 | * No `websockets` on [Heroku](http://www.heroku.com/),
* no `thin` on [Engineyard](http://www.engineyard.com/),
* gave [OpenShift](https://openshift.redhat.com/) a try, but they are quite far from being ready for production.
If I want to host a Ruby/Rails app which uses `websockets` via `faye`, where can I do that? | 2013/01/09 | [
"https://Stackoverflow.com/questions/14240003",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/341929/"
] | Heroku now supports WebSockets (finally!): <https://devcenter.heroku.com/articles/heroku-labs-websockets> | There's a company called Blue Box in Seattle you might look into.
I work there, so there's that shameless plug aspect going on. But I think they'll be your best bet. |
14,240,003 | * No `websockets` on [Heroku](http://www.heroku.com/),
* no `thin` on [Engineyard](http://www.engineyard.com/),
* gave [OpenShift](https://openshift.redhat.com/) a try, but they are quite far from being ready for production.
If I want to host a Ruby/Rails app which uses `websockets` via `faye`, where can I do that? | 2013/01/09 | [
"https://Stackoverflow.com/questions/14240003",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/341929/"
] | Heroku now supports WebSockets (finally!): <https://devcenter.heroku.com/articles/heroku-labs-websockets> | Here's an [example OpenShift DIY instance](https://github.com/jweissman/zephyr-faye-diy) that's currently running a prod Faye instance in the cloud for me.
As you say, OpenShift isn't really ready for primetime -- so I'm actually talking to this box from my main app running on Heroku! One note here might be that webs... |
36,169,360 | I'm trying to learn VIM editor , and I'm going to test some small code
for ruby
here is question..
When I compile and launch my small ruby code,
1. Command-mode,
`:!ruby %`
2. Or Open another terminal,
`$ruby filename.rb`
I did ,
but.. its really stressful and I cannot focus....
Is there any magical thing... | 2016/03/23 | [
"https://Stackoverflow.com/questions/36169360",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6048318/"
] | If your vim distribution has `ruby` support, can be confirmed using `vim --version |grep ruby`, Then
```
nnoremap <F9> :rubyfile %<CR>
```
This is will be more faster as this does not invoke an external command using `!ruby` and hence no shell launch. More details at `:help ruby`.
Another way to complete the work... | You can try doing this to your `.vimrc`. It's not exactly sophisticated, but may be good enough for your needs:
```
" Run current file as Ruby program
nnoremap <C-r> :!ruby %<CR>
``` |
36,169,360 | I'm trying to learn VIM editor , and I'm going to test some small code
for ruby
here is question..
When I compile and launch my small ruby code,
1. Command-mode,
`:!ruby %`
2. Or Open another terminal,
`$ruby filename.rb`
I did ,
but.. its really stressful and I cannot focus....
Is there any magical thing... | 2016/03/23 | [
"https://Stackoverflow.com/questions/36169360",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6048318/"
] | You can use `:!!` to repeat the last `:!{cmd}`.
You can type `:!ruby %` once, and then run `:!!`, which can of course be mapped to a key like:
```
nnoremap <F8> :!!<CR>
```
Or to write and run it (saves typing `:w`):
```
nnoremap <F8> :w<CR>:!!<CR>
```
This is a flexible solution, since you can replace `:!ruby %... | You can try doing this to your `.vimrc`. It's not exactly sophisticated, but may be good enough for your needs:
```
" Run current file as Ruby program
nnoremap <C-r> :!ruby %<CR>
``` |
36,169,360 | I'm trying to learn VIM editor , and I'm going to test some small code
for ruby
here is question..
When I compile and launch my small ruby code,
1. Command-mode,
`:!ruby %`
2. Or Open another terminal,
`$ruby filename.rb`
I did ,
but.. its really stressful and I cannot focus....
Is there any magical thing... | 2016/03/23 | [
"https://Stackoverflow.com/questions/36169360",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6048318/"
] | You can use `:!!` to repeat the last `:!{cmd}`.
You can type `:!ruby %` once, and then run `:!!`, which can of course be mapped to a key like:
```
nnoremap <F8> :!!<CR>
```
Or to write and run it (saves typing `:w`):
```
nnoremap <F8> :w<CR>:!!<CR>
```
This is a flexible solution, since you can replace `:!ruby %... | If your vim distribution has `ruby` support, can be confirmed using `vim --version |grep ruby`, Then
```
nnoremap <F9> :rubyfile %<CR>
```
This is will be more faster as this does not invoke an external command using `!ruby` and hence no shell launch. More details at `:help ruby`.
Another way to complete the work... |
123,336 | i want select query for multiple checkbox but I am getting an error
>
> System.QueryException: unexpected token: 'true' Error is in expression
> '{!dochar}' in component in page cc:
> Class.actionSupportController.dochar: line 24, column 1
>
>
>
```
public class actionSupportController {
public List<PCS_Ho... | 2016/05/25 | [
"https://salesforce.stackexchange.com/questions/123336",
"https://salesforce.stackexchange.com",
"https://salesforce.stackexchange.com/users/-1/"
] | There is already another answer with shorter solution but I still wanted to answer. Below validation rule should work for your situation, too.
```
OR(
OR(
LEN( Phone ) <= 9 ,
LEN( Phone ) >= 13
),
NOT(
OR(
REGEX(Phone, "[0-9 ]+"),
REGEX(Phone, "\\+[0-9 ]+"))
)
)
``` | You can use following RegEx for making sure the phone number has 10 to 12 digits and starts with a `+` sign,
```
REGEX(<Phone Field Name>, "\\+{0,1}[0-9]{10,12}")
```
Hope this helps.
Best Regards! |
123,336 | i want select query for multiple checkbox but I am getting an error
>
> System.QueryException: unexpected token: 'true' Error is in expression
> '{!dochar}' in component in page cc:
> Class.actionSupportController.dochar: line 24, column 1
>
>
>
```
public class actionSupportController {
public List<PCS_Ho... | 2016/05/25 | [
"https://salesforce.stackexchange.com/questions/123336",
"https://salesforce.stackexchange.com",
"https://salesforce.stackexchange.com/users/-1/"
] | You can use following RegEx for making sure the phone number has 10 to 12 digits and starts with a `+` sign,
```
REGEX(<Phone Field Name>, "\\+{0,1}[0-9]{10,12}")
```
Hope this helps.
Best Regards! | ```
not(isnumber(your phone number field))||len(your phone number field)<>**10**)
```
As I'm an Indian My mobile number should be equal to 10 you can add any number over there |
123,336 | i want select query for multiple checkbox but I am getting an error
>
> System.QueryException: unexpected token: 'true' Error is in expression
> '{!dochar}' in component in page cc:
> Class.actionSupportController.dochar: line 24, column 1
>
>
>
```
public class actionSupportController {
public List<PCS_Ho... | 2016/05/25 | [
"https://salesforce.stackexchange.com/questions/123336",
"https://salesforce.stackexchange.com",
"https://salesforce.stackexchange.com/users/-1/"
] | There is already another answer with shorter solution but I still wanted to answer. Below validation rule should work for your situation, too.
```
OR(
OR(
LEN( Phone ) <= 9 ,
LEN( Phone ) >= 13
),
NOT(
OR(
REGEX(Phone, "[0-9 ]+"),
REGEX(Phone, "\\+[0-9 ]+"))
)
)
``` | ```
not(isnumber(your phone number field))||len(your phone number field)<>**10**)
```
As I'm an Indian My mobile number should be equal to 10 you can add any number over there |
2,162,953 | Evaluate $$\int\_0^\infty xI\_0(2x)e^{-x^2}\,dx$$ where $$I\_0(x) = \frac 1\pi \int\_0^\pi e^{x\cos\theta}\,d\theta$$ is a Bessel Function.
Source: Berkeley Math Tournament
This question was on a math contest for high school students, so I am looking for other methods that preferably do not involve higher mathemati... | 2017/02/26 | [
"https://math.stackexchange.com/questions/2162953",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/190244/"
] | A simpler way is to exploit Fubini's theorem and polar coordinates:
$$ \int\_{0}^{+\infty}x\,I\_0(2x) e^{-x^2}\,dx = \frac{1}{\pi}\int\_{0}^{\pi}\int\_{0}^{+\infty}\rho e^{-2\rho\cos\theta} e^{-\rho^2}\,d\rho\,d\theta $$
where the last integral equals:
$$ \frac{1}{\pi}\int\_{0}^{+\infty}\int\_{-\infty}^{+\infty} e^{-2... | $$I = \int\_0^\infty xI\_0(2x)e^{-x^2}\,dx$$
$$I\_0(x)=\frac 1\pi\int\_0^\pi e^{x\cos\theta}d\theta \stackrel{\theta\rightarrow\theta/2}{=}\frac 1{2\pi}\int\_0^{2\pi} e^{x\cos(\theta/2)}d\theta \stackrel{z=\exp(i\theta/2)}{=}\frac 1{2\pi i}\int\_{|z|=1} \frac{xe^{[z+1/z]/2}}{z}dz$$
To evaluate this, we proceed by exp... |
2,162,953 | Evaluate $$\int\_0^\infty xI\_0(2x)e^{-x^2}\,dx$$ where $$I\_0(x) = \frac 1\pi \int\_0^\pi e^{x\cos\theta}\,d\theta$$ is a Bessel Function.
Source: Berkeley Math Tournament
This question was on a math contest for high school students, so I am looking for other methods that preferably do not involve higher mathemati... | 2017/02/26 | [
"https://math.stackexchange.com/questions/2162953",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/190244/"
] | Note that $$I=\int\_{0}^{\infty}xI\_{0}\left(2x\right)e^{-x^{2}}dx\stackrel{e^{-x^{2}}=u}{=}\frac{1}{2}\int\_{0}^{1}I\_{0}\left(2\sqrt{-\log\left(u\right)}\right)du$$ $$=\frac{1}{2}\sum\_{k\geq0}\frac{\left(-1\right)^{k}}{\left(k!\right)^{2}}\int\_{0}^{1}\log^{k}\left(u\right)du=\frac{1}{2}\sum\_{k\geq0}\frac{1}{k!}=\c... | $$I = \int\_0^\infty xI\_0(2x)e^{-x^2}\,dx$$
$$I\_0(x)=\frac 1\pi\int\_0^\pi e^{x\cos\theta}d\theta \stackrel{\theta\rightarrow\theta/2}{=}\frac 1{2\pi}\int\_0^{2\pi} e^{x\cos(\theta/2)}d\theta \stackrel{z=\exp(i\theta/2)}{=}\frac 1{2\pi i}\int\_{|z|=1} \frac{xe^{[z+1/z]/2}}{z}dz$$
To evaluate this, we proceed by exp... |
2,162,953 | Evaluate $$\int\_0^\infty xI\_0(2x)e^{-x^2}\,dx$$ where $$I\_0(x) = \frac 1\pi \int\_0^\pi e^{x\cos\theta}\,d\theta$$ is a Bessel Function.
Source: Berkeley Math Tournament
This question was on a math contest for high school students, so I am looking for other methods that preferably do not involve higher mathemati... | 2017/02/26 | [
"https://math.stackexchange.com/questions/2162953",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/190244/"
] | A simpler way is to exploit Fubini's theorem and polar coordinates:
$$ \int\_{0}^{+\infty}x\,I\_0(2x) e^{-x^2}\,dx = \frac{1}{\pi}\int\_{0}^{\pi}\int\_{0}^{+\infty}\rho e^{-2\rho\cos\theta} e^{-\rho^2}\,d\rho\,d\theta $$
where the last integral equals:
$$ \frac{1}{\pi}\int\_{0}^{+\infty}\int\_{-\infty}^{+\infty} e^{-2... | Note that $$I=\int\_{0}^{\infty}xI\_{0}\left(2x\right)e^{-x^{2}}dx\stackrel{e^{-x^{2}}=u}{=}\frac{1}{2}\int\_{0}^{1}I\_{0}\left(2\sqrt{-\log\left(u\right)}\right)du$$ $$=\frac{1}{2}\sum\_{k\geq0}\frac{\left(-1\right)^{k}}{\left(k!\right)^{2}}\int\_{0}^{1}\log^{k}\left(u\right)du=\frac{1}{2}\sum\_{k\geq0}\frac{1}{k!}=\c... |
2,162,953 | Evaluate $$\int\_0^\infty xI\_0(2x)e^{-x^2}\,dx$$ where $$I\_0(x) = \frac 1\pi \int\_0^\pi e^{x\cos\theta}\,d\theta$$ is a Bessel Function.
Source: Berkeley Math Tournament
This question was on a math contest for high school students, so I am looking for other methods that preferably do not involve higher mathemati... | 2017/02/26 | [
"https://math.stackexchange.com/questions/2162953",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/190244/"
] | A simpler way is to exploit Fubini's theorem and polar coordinates:
$$ \int\_{0}^{+\infty}x\,I\_0(2x) e^{-x^2}\,dx = \frac{1}{\pi}\int\_{0}^{\pi}\int\_{0}^{+\infty}\rho e^{-2\rho\cos\theta} e^{-\rho^2}\,d\rho\,d\theta $$
where the last integral equals:
$$ \frac{1}{\pi}\int\_{0}^{+\infty}\int\_{-\infty}^{+\infty} e^{-2... | >
> I thought it might be instructive to present a way forward the relies on only the series expansion of the exponential function, evaluating two integrals using reduction formulae, and straightforward arithmetic. To that end, we proceed.
>
>
>
Using the Taylor series for $e^t=\sum\_{n=0}^\infty \frac{t^n}{n!}$, ... |
2,162,953 | Evaluate $$\int\_0^\infty xI\_0(2x)e^{-x^2}\,dx$$ where $$I\_0(x) = \frac 1\pi \int\_0^\pi e^{x\cos\theta}\,d\theta$$ is a Bessel Function.
Source: Berkeley Math Tournament
This question was on a math contest for high school students, so I am looking for other methods that preferably do not involve higher mathemati... | 2017/02/26 | [
"https://math.stackexchange.com/questions/2162953",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/190244/"
] | Note that $$I=\int\_{0}^{\infty}xI\_{0}\left(2x\right)e^{-x^{2}}dx\stackrel{e^{-x^{2}}=u}{=}\frac{1}{2}\int\_{0}^{1}I\_{0}\left(2\sqrt{-\log\left(u\right)}\right)du$$ $$=\frac{1}{2}\sum\_{k\geq0}\frac{\left(-1\right)^{k}}{\left(k!\right)^{2}}\int\_{0}^{1}\log^{k}\left(u\right)du=\frac{1}{2}\sum\_{k\geq0}\frac{1}{k!}=\c... | >
> I thought it might be instructive to present a way forward the relies on only the series expansion of the exponential function, evaluating two integrals using reduction formulae, and straightforward arithmetic. To that end, we proceed.
>
>
>
Using the Taylor series for $e^t=\sum\_{n=0}^\infty \frac{t^n}{n!}$, ... |
28,618,037 | I'm trying to combine if else inside my regular expression, basically if some patterns exists in the string, capture one pattern, if not, capture another.
The string is:
'<https://www.searchpage.com/searchcompany.aspx?companyId=41490234&page=0&leftlink=true>" and I want to extract staff around the '?"
So if '?' is de... | 2015/02/19 | [
"https://Stackoverflow.com/questions/28618037",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2209904/"
] | This regex:
```
(^[^?]*$|(?<=\?).*)
```
captures:
* `^[^?]*$` everything, if there's no `?`, or
* `(?<=\?).*` everything after the `?`, if there is one
However, you should look into [`urllib.parse`](https://docs.python.org/3/library/urllib.parse.html) (Python 3) or [`urlparse`](https://docs.python.org/2/library/ur... | regex might not be the best solution to this problem ...why not just
`my_url.split("?",1)`
if that is truly all you wish to do
or as others have suggested
```
from urlparse import urlparse
print urlparse(my_url)
``` |
28,618,037 | I'm trying to combine if else inside my regular expression, basically if some patterns exists in the string, capture one pattern, if not, capture another.
The string is:
'<https://www.searchpage.com/searchcompany.aspx?companyId=41490234&page=0&leftlink=true>" and I want to extract staff around the '?"
So if '?' is de... | 2015/02/19 | [
"https://Stackoverflow.com/questions/28618037",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2209904/"
] | Use [urlparse](https://docs.python.org/2/library/urlparse.html):
```
>>> import urlparse
>>> parse_result = urlparse.urlparse('https://www.searchpage.com/searchcompany.aspx?
companyId=41490234&page=0&leftlink=true')
>>> parse_result
ParseResult(scheme='https', netloc='www.searchpage.com',
path='/searchcompany.aspx',... | regex might not be the best solution to this problem ...why not just
`my_url.split("?",1)`
if that is truly all you wish to do
or as others have suggested
```
from urlparse import urlparse
print urlparse(my_url)
``` |
967,634 | Is there a way to get a standard Windows Forms application to detect if the `Shift` key is being held down on application startup - without using Windows hooks?
I ideally would like the workflow to change from normal if the shift key is held down when the EXE file is run. | 2009/06/09 | [
"https://Stackoverflow.com/questions/967634",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/96854/"
] | Check Control.ModifierKeys ...
```
[STAThread]
static void Main(string[] args)
{
if (Control.ModifierKeys == Keys.ShiftKey)
{
// Do something special
}
}
``` | [Here is an article](http://www.switchonthecode.com/tutorials/winforms-accessing-mouse-and-keyboard-state) about reading the key states (and mouse) directly. |
967,634 | Is there a way to get a standard Windows Forms application to detect if the `Shift` key is being held down on application startup - without using Windows hooks?
I ideally would like the workflow to change from normal if the shift key is held down when the EXE file is run. | 2009/06/09 | [
"https://Stackoverflow.com/questions/967634",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/96854/"
] | The ModifierKeys property looks ideal:
```
private void Form1_Load(object sender, EventArgs e)
{
if ( (ModifierKeys & Keys.Shift) != 0)
{
MessageBox.Show("Shift is pressed");
}
}
``` | [Here is an article](http://www.switchonthecode.com/tutorials/winforms-accessing-mouse-and-keyboard-state) about reading the key states (and mouse) directly. |
967,634 | Is there a way to get a standard Windows Forms application to detect if the `Shift` key is being held down on application startup - without using Windows hooks?
I ideally would like the workflow to change from normal if the shift key is held down when the EXE file is run. | 2009/06/09 | [
"https://Stackoverflow.com/questions/967634",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/96854/"
] | I know this post is rather old but I ran into this issue and fixed it by modifying Jamie's code:
```
[STAThread]
static void Main(string[] args)
{
if (Control.ModifierKeys.ToString() == "Shift")
{
// Do something special
}
}
``` | [Here is an article](http://www.switchonthecode.com/tutorials/winforms-accessing-mouse-and-keyboard-state) about reading the key states (and mouse) directly. |
967,634 | Is there a way to get a standard Windows Forms application to detect if the `Shift` key is being held down on application startup - without using Windows hooks?
I ideally would like the workflow to change from normal if the shift key is held down when the EXE file is run. | 2009/06/09 | [
"https://Stackoverflow.com/questions/967634",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/96854/"
] | I realize this is super old, but it bothered me a little bit to see people struggling with this. ModifierKeys is a bit field, so relying on .ToString() or == to see if the Shift key is pressed is, at best, unreliable and isn't the correct use of a bit field:
```
public enum ModifierKeys
{
/// <summary>No modifiers... | [Here is an article](http://www.switchonthecode.com/tutorials/winforms-accessing-mouse-and-keyboard-state) about reading the key states (and mouse) directly. |
967,634 | Is there a way to get a standard Windows Forms application to detect if the `Shift` key is being held down on application startup - without using Windows hooks?
I ideally would like the workflow to change from normal if the shift key is held down when the EXE file is run. | 2009/06/09 | [
"https://Stackoverflow.com/questions/967634",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/96854/"
] | The ModifierKeys property looks ideal:
```
private void Form1_Load(object sender, EventArgs e)
{
if ( (ModifierKeys & Keys.Shift) != 0)
{
MessageBox.Show("Shift is pressed");
}
}
``` | Check Control.ModifierKeys ...
```
[STAThread]
static void Main(string[] args)
{
if (Control.ModifierKeys == Keys.ShiftKey)
{
// Do something special
}
}
``` |
967,634 | Is there a way to get a standard Windows Forms application to detect if the `Shift` key is being held down on application startup - without using Windows hooks?
I ideally would like the workflow to change from normal if the shift key is held down when the EXE file is run. | 2009/06/09 | [
"https://Stackoverflow.com/questions/967634",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/96854/"
] | Check Control.ModifierKeys ...
```
[STAThread]
static void Main(string[] args)
{
if (Control.ModifierKeys == Keys.ShiftKey)
{
// Do something special
}
}
``` | I know this post is rather old but I ran into this issue and fixed it by modifying Jamie's code:
```
[STAThread]
static void Main(string[] args)
{
if (Control.ModifierKeys.ToString() == "Shift")
{
// Do something special
}
}
``` |
967,634 | Is there a way to get a standard Windows Forms application to detect if the `Shift` key is being held down on application startup - without using Windows hooks?
I ideally would like the workflow to change from normal if the shift key is held down when the EXE file is run. | 2009/06/09 | [
"https://Stackoverflow.com/questions/967634",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/96854/"
] | I realize this is super old, but it bothered me a little bit to see people struggling with this. ModifierKeys is a bit field, so relying on .ToString() or == to see if the Shift key is pressed is, at best, unreliable and isn't the correct use of a bit field:
```
public enum ModifierKeys
{
/// <summary>No modifiers... | Check Control.ModifierKeys ...
```
[STAThread]
static void Main(string[] args)
{
if (Control.ModifierKeys == Keys.ShiftKey)
{
// Do something special
}
}
``` |
967,634 | Is there a way to get a standard Windows Forms application to detect if the `Shift` key is being held down on application startup - without using Windows hooks?
I ideally would like the workflow to change from normal if the shift key is held down when the EXE file is run. | 2009/06/09 | [
"https://Stackoverflow.com/questions/967634",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/96854/"
] | The ModifierKeys property looks ideal:
```
private void Form1_Load(object sender, EventArgs e)
{
if ( (ModifierKeys & Keys.Shift) != 0)
{
MessageBox.Show("Shift is pressed");
}
}
``` | I know this post is rather old but I ran into this issue and fixed it by modifying Jamie's code:
```
[STAThread]
static void Main(string[] args)
{
if (Control.ModifierKeys.ToString() == "Shift")
{
// Do something special
}
}
``` |
967,634 | Is there a way to get a standard Windows Forms application to detect if the `Shift` key is being held down on application startup - without using Windows hooks?
I ideally would like the workflow to change from normal if the shift key is held down when the EXE file is run. | 2009/06/09 | [
"https://Stackoverflow.com/questions/967634",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/96854/"
] | The ModifierKeys property looks ideal:
```
private void Form1_Load(object sender, EventArgs e)
{
if ( (ModifierKeys & Keys.Shift) != 0)
{
MessageBox.Show("Shift is pressed");
}
}
``` | I realize this is super old, but it bothered me a little bit to see people struggling with this. ModifierKeys is a bit field, so relying on .ToString() or == to see if the Shift key is pressed is, at best, unreliable and isn't the correct use of a bit field:
```
public enum ModifierKeys
{
/// <summary>No modifiers... |
967,634 | Is there a way to get a standard Windows Forms application to detect if the `Shift` key is being held down on application startup - without using Windows hooks?
I ideally would like the workflow to change from normal if the shift key is held down when the EXE file is run. | 2009/06/09 | [
"https://Stackoverflow.com/questions/967634",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/96854/"
] | I realize this is super old, but it bothered me a little bit to see people struggling with this. ModifierKeys is a bit field, so relying on .ToString() or == to see if the Shift key is pressed is, at best, unreliable and isn't the correct use of a bit field:
```
public enum ModifierKeys
{
/// <summary>No modifiers... | I know this post is rather old but I ran into this issue and fixed it by modifying Jamie's code:
```
[STAThread]
static void Main(string[] args)
{
if (Control.ModifierKeys.ToString() == "Shift")
{
// Do something special
}
}
``` |
39,197,849 | I added a dependency to my pom.xml file but cannot find the option to import the dependency. I'm not able to use the library in my program.
I've looked online and many suggest going to Settings -> Maven -> .... but this option simply does not exist for me.
I have also seen other solutions of simply right clicking t... | 2016/08/29 | [
"https://Stackoverflow.com/questions/39197849",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4364070/"
] | You might need to configure Auto-Import for Maven projects. You can enable such feature going to `File > Settings > Maven > Importing`. There is a checkbox that says "Import Maven projects automatically". If you can't find that option, try using `Ctrl+Shift+A` that helps you to find actions by name. Just write "maven" ... | The maven will automatically download the jar file from public repository after you save the pom file.
If you find that it doesn't exist in your maven dependencies, you can try to check below:
1. Check your network connectivity, whether it's able to connect to public repository.
2. Check whether the required dependen... |
39,197,849 | I added a dependency to my pom.xml file but cannot find the option to import the dependency. I'm not able to use the library in my program.
I've looked online and many suggest going to Settings -> Maven -> .... but this option simply does not exist for me.
I have also seen other solutions of simply right clicking t... | 2016/08/29 | [
"https://Stackoverflow.com/questions/39197849",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4364070/"
] | You might need to configure Auto-Import for Maven projects. You can enable such feature going to `File > Settings > Maven > Importing`. There is a checkbox that says "Import Maven projects automatically". If you can't find that option, try using `Ctrl+Shift+A` that helps you to find actions by name. Just write "maven" ... | IntelliJ should download and add all your dependencies to the project's classpath automatically as long as your POM is compliant and all the dependencies are available.
When importing Maven projects into IntelliJ an information box usually comes up asking you if you want to configure Auto-Import for Maven projects. Th... |
204,277 | I have a card game, where I'd like to be able to zoom in on a card if it's right clicked. I coded to make sure that if the zoomed card would go over a screen boundary, instead we would anchor it such that the full card is displayed. I initially hardcoded everything for 1920x1080 resolution, then I wanted to get it to w... | 2023/01/28 | [
"https://gamedev.stackexchange.com/questions/204277",
"https://gamedev.stackexchange.com",
"https://gamedev.stackexchange.com/users/78465/"
] | I have no idea what answer is expected but if I'm asked on an interview I would say the "problem" is that GC requires freezing of the state of the program but games are usually very dynamic. This makes those freezes much easier to spot with games where there are constant movements on the screen (stuttering).
Until rec... | Garbage collection in Unity refers to the .NET GC. There is no "problem" with GC other than what you would expect to find with the pros and cons of a GC, and you can read about .NET GC on the web easily.
What they are probably expecting to hear, is that Unity does not do a garbage collection cycle until you call LoadS... |
204,277 | I have a card game, where I'd like to be able to zoom in on a card if it's right clicked. I coded to make sure that if the zoomed card would go over a screen boundary, instead we would anchor it such that the full card is displayed. I initially hardcoded everything for 1920x1080 resolution, then I wanted to get it to w... | 2023/01/28 | [
"https://gamedev.stackexchange.com/questions/204277",
"https://gamedev.stackexchange.com",
"https://gamedev.stackexchange.com/users/78465/"
] | Based on the documentation for [memory management & garbage collection](https://docs.unity3d.com/Manual/webgl-memory.html#garbage):
Allocating managed memory is time-consuming for the CPU, so memory management (including garbage collection) impacts runtime performance. At an extreme, garbage collection can prevent the... | Garbage collection in Unity refers to the .NET GC. There is no "problem" with GC other than what you would expect to find with the pros and cons of a GC, and you can read about .NET GC on the web easily.
What they are probably expecting to hear, is that Unity does not do a garbage collection cycle until you call LoadS... |
204,277 | I have a card game, where I'd like to be able to zoom in on a card if it's right clicked. I coded to make sure that if the zoomed card would go over a screen boundary, instead we would anchor it such that the full card is displayed. I initially hardcoded everything for 1920x1080 resolution, then I wanted to get it to w... | 2023/01/28 | [
"https://gamedev.stackexchange.com/questions/204277",
"https://gamedev.stackexchange.com",
"https://gamedev.stackexchange.com/users/78465/"
] | I have no idea what answer is expected but if I'm asked on an interview I would say the "problem" is that GC requires freezing of the state of the program but games are usually very dynamic. This makes those freezes much easier to spot with games where there are constant movements on the screen (stuttering).
Until rec... | Based on the documentation for [memory management & garbage collection](https://docs.unity3d.com/Manual/webgl-memory.html#garbage):
Allocating managed memory is time-consuming for the CPU, so memory management (including garbage collection) impacts runtime performance. At an extreme, garbage collection can prevent the... |
14,012,272 | I have a jaxws WebService which allows to downloadImage (or atleast it should...)
The cod of webservice:
```
@WebService(name = "SimpleWebService")
@MTOM
@SOAPBinding(style = Style.RPC)
public class SimpleWebService {
@WebMethod
public Image getImage(String imgName) throws IOException{
System.out.println(... | 2012/12/23 | [
"https://Stackoverflow.com/questions/14012272",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1909775/"
] | I think the error is in
```
byte[] imageIS = port.getImage("rainbow.jpg");
```
Should be
```
byte[] imageIS = port.getImage("/rainbow.jpg");
```
otherwise it will be interpreted as a path relative to the startup directory of the application server. | check if the `imgName` is correct path to a file:
```
log.info("File exists?: " + new File(imgName).exists()); //or System.out.println(...);
log.info(imgName);
log.info(new File(imgName).getAbsolutePath());
```
If everything is ok - then your image is probably corrupted. If you can open this file in your favourite i... |
2,502,590 | Question
--------
>
> Let $n = m!$. Which of the following is TRUE?
>
>
>
$a)m = \Theta (\frac{\log n}{\log \log n})$
$b)m = \Omega (\frac{\log n}{\log \log n})$ but not $m = O(\frac{\log n}{\log \log n})$
$c)m = \Theta (\log^2 n)$
$m = \Omega (\log^2 n)$ but not $m = Ο( (\log^2 n)$
$d)m = \Theta (\log^{1.5} n... | 2017/11/03 | [
"https://math.stackexchange.com/questions/2502590",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/384817/"
] | The first issue with what you wrote is that you write an equality instead of an asymptotic equivalence: you *cannot* write $\log m! = m\log m$. You *can* write $$\log m! \operatorname\*{\sim}\_{m\to\infty} m\log m$$, which is equivalent to writing $\log m! = m\log m + o(m\log m)$; or, more precise,
$$
\ln m! = m\ln m -... | Well, we first observe that (c) is incorrect because $m = \mathcal{O}(m^2 \log^2 m) = \mathcal{O}((m \log m)^2) = \mathcal{O}(\log^2 m!) = \mathcal{O}(\log^2 n)$ using the fact that $\log m! = \Theta(m \log m)$.
Similarly, one can show $\Theta(\log^{1.5}n) = \Theta(m^{1.5} \log^{1.5} m)$ using similar method. But we k... |
30,196,145 | I'm trying to build a very simple Angular app in order to learn the ropes.
I'm using Yeoman's `angular-generator` for scaffolding, which uses a predefined `.config` with `$routeProvider`, that I adapted to my needs as follows:
```
angular
.module('raidersApp', [
'ngRoute',
'ngTouch'
])
.config(function ... | 2015/05/12 | [
"https://Stackoverflow.com/questions/30196145",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2887078/"
] | In your controller, change this line:
```
$scope.langID = data.getLang();
```
to
```
$scope.langID = function () {
return data.getLang();
}
```
Then change the binding in your header to:
`{{langID()}}`
This will cause it to get the value from the factory on every $digest.
What I believe is happening here i... | Because you need to set the $scope.language property every time the value updates, one way you could do it is to set a $watch on the value in the factory. Whenever it changes, you can have your header controller grab the new value. Here is some example code:
HTML:
```
<div ng-controller="HeaderCtrl">Language: {{langu... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.