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 |
|---|---|---|---|---|---|
37,469,918 | Sorry for the poor titling. Basically what I want to do is the following:
I have a drop-down menu that has a couple selections in it, and I want to make a 'checklist' of sorts appear beneath it, with options dependant on what was selected in the drop-down.
So for example, if I selected "Water" from the drop-down menu... | 2016/05/26 | [
"https://Stackoverflow.com/questions/37469918",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4109017/"
] | If you create all of the checkbox menus (assuming you know them all), and initialize them as hidden, then you can create on OnChange event for the dropdown, and show the appropriate checkbox menu. | For your select menus, use the Jquery .change function to determine whether your select menu has changed.
```
$('#beverageSelect').change(function(){
// Logic here
});
```
Inside the change function, have an if statement to determine the value of the selected drop-down. This will check if it was "water" or "soda... |
77,936 | I have heard it said (but have no source) that the obligation to wear tefillin covers the entire day, and that people used to actually wear their tefillin all day long. (Various passages that I have seen in the gemara, of people removing tefillin to go to the toilet and replacing them afterwards would support this). No... | 2016/12/01 | [
"https://judaism.stackexchange.com/questions/77936",
"https://judaism.stackexchange.com",
"https://judaism.stackexchange.com/users/1659/"
] | I have also heard that our Jewish ancestors, specifically during the time of the Temple, used to wear tefillin throughout the day.
Looking at the Kitzer Shulchan Aruch, as well as related questions, gives a good idea as to why the idea of wearing tefillin throughout the day is possible but not overtly practical.
Kitz... | The [M"A 37:2](https://www.sefaria.org/Magen_Avraham.37?lang=he) brings a shita that holds one should indeed put on Tefillin by Mincha. The [Beer Heitiv 37:3](https://www.sefaria.org/Ba%27er_Hetev_on_Shulchan_Arukh%2C_Orach_Chayim.37?lang=he) brings it as well and adds that the Shle"a says not to wear it on Erev Shabbo... |
67,131,565 | On Linux, the `ld.so(8)` man page discusses the search order for dynamic libraries. It says that `DT_RPATH` is deprecated, and also mentions `DT_RUNPATH`. There is no mention of the `-rpath` linker option.
The `ld(1)` man page mentions the `-rpath` and `-rpath-link` options, but never mentions `DT_RPATH` or `DT_RUNPAT... | 2021/04/16 | [
"https://Stackoverflow.com/questions/67131565",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2150289/"
] | When you are **compiling** a program, you create object files and then **link** them together. You may use GNU ld(1) to link them, there are also other linkers, LLVM linker. A linker combines object files into executable. GNU ld(1) is part of binutils with [documentation available here](https://www.gnu.org/software/bin... | The `-rpath` command line option used to create a `DT_RPATH` entry in the `.dynamic` section, but since `DT_RPATH` was deprecated in favor of `DT_RUNPATH`, modern linker versions use `DT_RUNPATH` instead. This means that using `-rpath` on a really old linker, you will create a dynamic section entry with `.d_val = DT_RP... |
149,803 | I have to solve the following complex number exercise: calculate $(1 + i)^n\forall n\in\mathbb{N}$ giving the result in $a + ib$ notation.
Basically what I have done is calculate $(1 + i)^n$ for some $n$ values.
$$(1 + i)^1 = 1 + i$$
$$(1 + i)^2 = 2i$$
$$(1 + i)^3 = - 2 + 2i$$
$$\boxed{(1 + i)^4 = - 4}$$
$$(1 + i)^5 =... | 2012/05/25 | [
"https://math.stackexchange.com/questions/149803",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/28679/"
] | Write $1+i$ in modulus argument notation ($\rho e^{i \theta}$). Then $(1+i)^n = \rho^n e^{i n \theta}$ will be pretty easy to compute. | Perhaps, proceed via the trigonometric form using De Moivre's formula:
$$\left(1+i\right)^{n}=2^{\frac{n}{2}}\left(\cos\frac{\pi}{4}+i\sin\frac{\pi}{4}\right)^{n}=2^{\frac{n}{2}}\cos\frac{\pi n}{4}+i2^{\frac{n}{2}}\sin\frac{\pi n}{4}$$ |
149,803 | I have to solve the following complex number exercise: calculate $(1 + i)^n\forall n\in\mathbb{N}$ giving the result in $a + ib$ notation.
Basically what I have done is calculate $(1 + i)^n$ for some $n$ values.
$$(1 + i)^1 = 1 + i$$
$$(1 + i)^2 = 2i$$
$$(1 + i)^3 = - 2 + 2i$$
$$\boxed{(1 + i)^4 = - 4}$$
$$(1 + i)^5 =... | 2012/05/25 | [
"https://math.stackexchange.com/questions/149803",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/28679/"
] | Write $1+i$ in modulus argument notation ($\rho e^{i \theta}$). Then $(1+i)^n = \rho^n e^{i n \theta}$ will be pretty easy to compute. | Fair enough, you could then try binomial expansion
$$\left(1+i\right)^{n}=\sum\_{k=0}^{n}\left(\begin{array}{c}n\\k
\end{array}\right)1^{k}i^{n-k}=\sum\_{k=0}^{n}\left(\begin{array}{c}
n\\k\end{array}\right)i^{n-k}=\sum\_{k=0}^{n}\left(\begin{array}{c}n\\n-k
\end{array}\right)i^{k}$$
(changing the summation variable $n... |
149,803 | I have to solve the following complex number exercise: calculate $(1 + i)^n\forall n\in\mathbb{N}$ giving the result in $a + ib$ notation.
Basically what I have done is calculate $(1 + i)^n$ for some $n$ values.
$$(1 + i)^1 = 1 + i$$
$$(1 + i)^2 = 2i$$
$$(1 + i)^3 = - 2 + 2i$$
$$\boxed{(1 + i)^4 = - 4}$$
$$(1 + i)^5 =... | 2012/05/25 | [
"https://math.stackexchange.com/questions/149803",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/28679/"
] | Write $1+i$ in modulus argument notation ($\rho e^{i \theta}$). Then $(1+i)^n = \rho^n e^{i n \theta}$ will be pretty easy to compute. | ```
Mine works, but you have to find q and r in order to do the calculation,
and I think it is not "calculate" technically speaking which was what the
exercise is asking (although I am not sure what they mean by calculate).
```
To be honest, the form you worked out is probably the best form of the answer for the spec... |
149,803 | I have to solve the following complex number exercise: calculate $(1 + i)^n\forall n\in\mathbb{N}$ giving the result in $a + ib$ notation.
Basically what I have done is calculate $(1 + i)^n$ for some $n$ values.
$$(1 + i)^1 = 1 + i$$
$$(1 + i)^2 = 2i$$
$$(1 + i)^3 = - 2 + 2i$$
$$\boxed{(1 + i)^4 = - 4}$$
$$(1 + i)^5 =... | 2012/05/25 | [
"https://math.stackexchange.com/questions/149803",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/28679/"
] | Write $1+i$ in modulus argument notation ($\rho e^{i \theta}$). Then $(1+i)^n = \rho^n e^{i n \theta}$ will be pretty easy to compute. | How about setting L = lim\_n/rarrow (1 + i) ^n |
149,803 | I have to solve the following complex number exercise: calculate $(1 + i)^n\forall n\in\mathbb{N}$ giving the result in $a + ib$ notation.
Basically what I have done is calculate $(1 + i)^n$ for some $n$ values.
$$(1 + i)^1 = 1 + i$$
$$(1 + i)^2 = 2i$$
$$(1 + i)^3 = - 2 + 2i$$
$$\boxed{(1 + i)^4 = - 4}$$
$$(1 + i)^5 =... | 2012/05/25 | [
"https://math.stackexchange.com/questions/149803",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/28679/"
] | Perhaps, proceed via the trigonometric form using De Moivre's formula:
$$\left(1+i\right)^{n}=2^{\frac{n}{2}}\left(\cos\frac{\pi}{4}+i\sin\frac{\pi}{4}\right)^{n}=2^{\frac{n}{2}}\cos\frac{\pi n}{4}+i2^{\frac{n}{2}}\sin\frac{\pi n}{4}$$ | Fair enough, you could then try binomial expansion
$$\left(1+i\right)^{n}=\sum\_{k=0}^{n}\left(\begin{array}{c}n\\k
\end{array}\right)1^{k}i^{n-k}=\sum\_{k=0}^{n}\left(\begin{array}{c}
n\\k\end{array}\right)i^{n-k}=\sum\_{k=0}^{n}\left(\begin{array}{c}n\\n-k
\end{array}\right)i^{k}$$
(changing the summation variable $n... |
149,803 | I have to solve the following complex number exercise: calculate $(1 + i)^n\forall n\in\mathbb{N}$ giving the result in $a + ib$ notation.
Basically what I have done is calculate $(1 + i)^n$ for some $n$ values.
$$(1 + i)^1 = 1 + i$$
$$(1 + i)^2 = 2i$$
$$(1 + i)^3 = - 2 + 2i$$
$$\boxed{(1 + i)^4 = - 4}$$
$$(1 + i)^5 =... | 2012/05/25 | [
"https://math.stackexchange.com/questions/149803",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/28679/"
] | Perhaps, proceed via the trigonometric form using De Moivre's formula:
$$\left(1+i\right)^{n}=2^{\frac{n}{2}}\left(\cos\frac{\pi}{4}+i\sin\frac{\pi}{4}\right)^{n}=2^{\frac{n}{2}}\cos\frac{\pi n}{4}+i2^{\frac{n}{2}}\sin\frac{\pi n}{4}$$ | How about setting L = lim\_n/rarrow (1 + i) ^n |
149,803 | I have to solve the following complex number exercise: calculate $(1 + i)^n\forall n\in\mathbb{N}$ giving the result in $a + ib$ notation.
Basically what I have done is calculate $(1 + i)^n$ for some $n$ values.
$$(1 + i)^1 = 1 + i$$
$$(1 + i)^2 = 2i$$
$$(1 + i)^3 = - 2 + 2i$$
$$\boxed{(1 + i)^4 = - 4}$$
$$(1 + i)^5 =... | 2012/05/25 | [
"https://math.stackexchange.com/questions/149803",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/28679/"
] | ```
Mine works, but you have to find q and r in order to do the calculation,
and I think it is not "calculate" technically speaking which was what the
exercise is asking (although I am not sure what they mean by calculate).
```
To be honest, the form you worked out is probably the best form of the answer for the spec... | Fair enough, you could then try binomial expansion
$$\left(1+i\right)^{n}=\sum\_{k=0}^{n}\left(\begin{array}{c}n\\k
\end{array}\right)1^{k}i^{n-k}=\sum\_{k=0}^{n}\left(\begin{array}{c}
n\\k\end{array}\right)i^{n-k}=\sum\_{k=0}^{n}\left(\begin{array}{c}n\\n-k
\end{array}\right)i^{k}$$
(changing the summation variable $n... |
149,803 | I have to solve the following complex number exercise: calculate $(1 + i)^n\forall n\in\mathbb{N}$ giving the result in $a + ib$ notation.
Basically what I have done is calculate $(1 + i)^n$ for some $n$ values.
$$(1 + i)^1 = 1 + i$$
$$(1 + i)^2 = 2i$$
$$(1 + i)^3 = - 2 + 2i$$
$$\boxed{(1 + i)^4 = - 4}$$
$$(1 + i)^5 =... | 2012/05/25 | [
"https://math.stackexchange.com/questions/149803",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/28679/"
] | Fair enough, you could then try binomial expansion
$$\left(1+i\right)^{n}=\sum\_{k=0}^{n}\left(\begin{array}{c}n\\k
\end{array}\right)1^{k}i^{n-k}=\sum\_{k=0}^{n}\left(\begin{array}{c}
n\\k\end{array}\right)i^{n-k}=\sum\_{k=0}^{n}\left(\begin{array}{c}n\\n-k
\end{array}\right)i^{k}$$
(changing the summation variable $n... | How about setting L = lim\_n/rarrow (1 + i) ^n |
149,803 | I have to solve the following complex number exercise: calculate $(1 + i)^n\forall n\in\mathbb{N}$ giving the result in $a + ib$ notation.
Basically what I have done is calculate $(1 + i)^n$ for some $n$ values.
$$(1 + i)^1 = 1 + i$$
$$(1 + i)^2 = 2i$$
$$(1 + i)^3 = - 2 + 2i$$
$$\boxed{(1 + i)^4 = - 4}$$
$$(1 + i)^5 =... | 2012/05/25 | [
"https://math.stackexchange.com/questions/149803",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/28679/"
] | ```
Mine works, but you have to find q and r in order to do the calculation,
and I think it is not "calculate" technically speaking which was what the
exercise is asking (although I am not sure what they mean by calculate).
```
To be honest, the form you worked out is probably the best form of the answer for the spec... | How about setting L = lim\_n/rarrow (1 + i) ^n |
8,495,835 | I have a problem with my JDBC code. This is the relevant code:
```
/** method for checking password into the Oracle database */
public String CheckUserDB(String userToCheck) throws SQLException {
String storedPassword;
if (ds == null) throw new SQLException("No data source");
Connection conn = ds.getConnec... | 2011/12/13 | [
"https://Stackoverflow.com/questions/8495835",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1103606/"
] | ```
result.next();
storedPassword = result.getString("passwd");
```
You are not checking the return value of next. If you have no rows you get into trouble...
```
if(result.next()){
storedPassword = result.getString("passwd");
}
``` | The problem might not be with the code but instead could be the database. Double check that the TABLE IS NOT EMPTY. You get this error if the table is empty. Keep in mind that databases like Oracle require a `commit` after all your `insert, update, alter statements` .Your changes might not be visible outside the databa... |
8,495,835 | I have a problem with my JDBC code. This is the relevant code:
```
/** method for checking password into the Oracle database */
public String CheckUserDB(String userToCheck) throws SQLException {
String storedPassword;
if (ds == null) throw new SQLException("No data source");
Connection conn = ds.getConnec... | 2011/12/13 | [
"https://Stackoverflow.com/questions/8495835",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1103606/"
] | ```
result.next();
storedPassword = result.getString("passwd");
```
You are not checking the return value of next. If you have no rows you get into trouble...
```
if(result.next()){
storedPassword = result.getString("passwd");
}
``` | use the **varchar** data type instead of **char** in the oracle database.
if you use char then actual size with blank space of database is compared with query parameter
and query doesnt get exucuted that is result gets false.
So use the varchar datatype in oracle database. |
596,554 | Let $R$ be a principal ideal domain with identity and $I$, $J$ be distinct prime ideals of $R$. Prove that $1 \in \langle I, J\rangle$ hence $\langle I, J\rangle = R$. How to prove? | 2013/12/07 | [
"https://math.stackexchange.com/questions/596554",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/92728/"
] | Hint: Think of maximality (why does prime imply maximality in a PID?) | Without words:
$$1\in\langle I,J\rangle\implies\;\exists\,i\in I\,,\,j\in J\;\;s.t.\;\; i+j=1\implies$$
$$\forall\,x\in R\;,\;\;x=x\cdot1=x(i+j)=xi+xj\in\langle I,J\rangle$$ |
596,554 | Let $R$ be a principal ideal domain with identity and $I$, $J$ be distinct prime ideals of $R$. Prove that $1 \in \langle I, J\rangle$ hence $\langle I, J\rangle = R$. How to prove? | 2013/12/07 | [
"https://math.stackexchange.com/questions/596554",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/92728/"
] | Hint: Think of maximality (why does prime imply maximality in a PID?) | Let $I=\langle p\rangle$ and $J=\langle q\rangle$ be two distinct prime ideals in the PID $R$. Therefore neither $p\mid q$ nor $q\mid p$.
Consider the ideal $\langle I,J\rangle=\langle c\rangle$. Since $p,q\in\langle c\rangle$ we have $c\mid p,q$, and since primes are irreducible, then either $c$ is $p$ times a unit (... |
48,883 | The US Constitution reserves to the states all powers not expressly delegated to the Federal government. What is the Constitutional provision that allows for Federal laws such as the law that felons may not possess firearms?
This appears to be USC 922(g).
So, the argument is that because a gun was at one time transp... | 2020/02/07 | [
"https://law.stackexchange.com/questions/48883",
"https://law.stackexchange.com",
"https://law.stackexchange.com/users/2609/"
] | The [Interstate Commerce Clause](https://en.wikipedia.org/wiki/Commerce_Clause) effectively means all economic activity in the US is under Federal jurisdiction because even something that's not directly involved in interstate commerce, even something not involved in commerce at all, can have an indirect effect on inter... | The justification for federal jurisdiction is the commerce clause. But it doesn't automatically apply to every firearm; the connection to interstate commerce must be real for the law to apply.
In [United States v. Lopez](https://supreme.justia.com/cases/federal/us/514/549/) (1995), the Supreme Court held the following... |
18,446,311 | I have an AdvancedDatagrid with two columns: Code (strings), and Value (numbers). I use the same sort function for each column. What I want to do is to sort both columns based on the Value column (numeric data), but where there is no number available, I want the sorting to be done alphabetically for the Code column.
I... | 2013/08/26 | [
"https://Stackoverflow.com/questions/18446311",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/271012/"
] | Try this:
```
private function numericValueSort(obj1:Object, obj2:Object):int
{
var o1:NameValueObject = obj1 as NameValueObject;
var o2:NameValueObject = obj2 as NameValueObject;
var ret:int = 0;
if (isNaN(o1.value) || isNaN(o2.value)) {
if (o1.code > o2.code) {
ret = 1;
}... | The following compare function will give priority to numeric values and sort NaN values based on the codes. The approach is to compose a new string for each object and prefix the string with a value indicating the priority (A > B):
```
private function numericValueSort(obj1:NameValueObject, obj2:NameValueObject):int {... |
18,446,311 | I have an AdvancedDatagrid with two columns: Code (strings), and Value (numbers). I use the same sort function for each column. What I want to do is to sort both columns based on the Value column (numeric data), but where there is no number available, I want the sorting to be done alphabetically for the Code column.
I... | 2013/08/26 | [
"https://Stackoverflow.com/questions/18446311",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/271012/"
] | Try this:
```
private function numericValueSort(obj1:Object, obj2:Object):int
{
var o1:NameValueObject = obj1 as NameValueObject;
var o2:NameValueObject = obj2 as NameValueObject;
var ret:int = 0;
if (isNaN(o1.value) || isNaN(o2.value)) {
if (o1.code > o2.code) {
ret = 1;
}... | I want all the NaN values to be at the bottom, irrespective of the sorting. Other than Nan values it should be sorted(keeping all the NaN values at the bottom)? |
18,446,311 | I have an AdvancedDatagrid with two columns: Code (strings), and Value (numbers). I use the same sort function for each column. What I want to do is to sort both columns based on the Value column (numeric data), but where there is no number available, I want the sorting to be done alphabetically for the Code column.
I... | 2013/08/26 | [
"https://Stackoverflow.com/questions/18446311",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/271012/"
] | I figured it out, and this is the sortCompareFunction I ended up using:
It checks for the 3 possible conditions of a value/s being invalid.
If the only one is NaN, returns 1 or -1, otherwise does a sort based on the
code column.
Then if both values are valid (not NaN), does a regualar compare:
```
private function ... | The following compare function will give priority to numeric values and sort NaN values based on the codes. The approach is to compose a new string for each object and prefix the string with a value indicating the priority (A > B):
```
private function numericValueSort(obj1:NameValueObject, obj2:NameValueObject):int {... |
18,446,311 | I have an AdvancedDatagrid with two columns: Code (strings), and Value (numbers). I use the same sort function for each column. What I want to do is to sort both columns based on the Value column (numeric data), but where there is no number available, I want the sorting to be done alphabetically for the Code column.
I... | 2013/08/26 | [
"https://Stackoverflow.com/questions/18446311",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/271012/"
] | I figured it out, and this is the sortCompareFunction I ended up using:
It checks for the 3 possible conditions of a value/s being invalid.
If the only one is NaN, returns 1 or -1, otherwise does a sort based on the
code column.
Then if both values are valid (not NaN), does a regualar compare:
```
private function ... | I want all the NaN values to be at the bottom, irrespective of the sorting. Other than Nan values it should be sorted(keeping all the NaN values at the bottom)? |
67,414,100 | What is the problem with my JQuery code when I click on the button it does not work, I searched a lot and tried many ways but my problem not solved. I used this code in other files, on there it works correctly but it not work in this file.
**this my table:**
```
<table class="table table-bordered">
<tbody>
... | 2021/05/06 | [
"https://Stackoverflow.com/questions/67414100",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11283695/"
] | I solved my problem, I put my table inside a dive like below, I don't know what happens when I put it inside a dive. but it works now.
```
<div id="apended_tb">
<table class="table table-bordered">
<tbody>
<?php
$insideOrders = \App\OutsideModel::where('total_id', '=', $order->order_id)->get();
... | Replace this
```
$('table tbody').on('click', 'button', function () {
```
with following:
```
$(document).on('click', '#send_order', function () {
```
And there is a mistake change order\_id with
```
data-order_id
``` |
65,864,609 | I have such html files.
Basically it has div containing texts with one inner span and the rest text part has pretty arbitrary format.
```
<html>
<div>
<span class="c1">Text1</span><br/>
Text4<br/>
Text5
</div>
<div>
<span class="c1">TextA</span><a href="...">TextD</a>
</div>
</html>
```
it is trivial to select/print... | 2021/01/23 | [
"https://Stackoverflow.com/questions/65864609",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/104897/"
] | I've tested some xpath's so the best one which I found is
```
//div/descendant-or-self::*/text()[normalize-space()]
```

It indicates the context node and all of its descendants, get text values that aren't empty.
about [XPath axis](https://developer.mozilla.org/... | Somehow I found a solution with `substring-after`
```
xml sel -t -m "/html/div" -v "span[@class='c1']" -o '|' -v "substring-after(.,span[@class='c1'])" -n
```
but I would like to know if there is a better way than substr method. |
65,864,609 | I have such html files.
Basically it has div containing texts with one inner span and the rest text part has pretty arbitrary format.
```
<html>
<div>
<span class="c1">Text1</span><br/>
Text4<br/>
Text5
</div>
<div>
<span class="c1">TextA</span><a href="...">TextD</a>
</div>
</html>
```
it is trivial to select/print... | 2021/01/23 | [
"https://Stackoverflow.com/questions/65864609",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/104897/"
] | It's been a while but you said,
>
> I would like to know if there is a better way than substr method
>
>
>
Here's a version which produces output in document order by using
a template matching the union of desired elements inside an `/html/div`.
Other elements than `br` are output
with their text value followed b... | I've tested some xpath's so the best one which I found is
```
//div/descendant-or-self::*/text()[normalize-space()]
```

It indicates the context node and all of its descendants, get text values that aren't empty.
about [XPath axis](https://developer.mozilla.org/... |
65,864,609 | I have such html files.
Basically it has div containing texts with one inner span and the rest text part has pretty arbitrary format.
```
<html>
<div>
<span class="c1">Text1</span><br/>
Text4<br/>
Text5
</div>
<div>
<span class="c1">TextA</span><a href="...">TextD</a>
</div>
</html>
```
it is trivial to select/print... | 2021/01/23 | [
"https://Stackoverflow.com/questions/65864609",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/104897/"
] | I think there is a better way to do the job, but I have this one. I have tested it in scrapy xpath.I think its help you.
```
print(data.xpath("concat(string(//div[1]/span[contains(@class, 'c1')]),'|', '\n',substring-before(substring-after(//div[1], 'Text1'), 'Text5'),'\n',substring-after(substring-after(//div[1], 'Tex... | Somehow I found a solution with `substring-after`
```
xml sel -t -m "/html/div" -v "span[@class='c1']" -o '|' -v "substring-after(.,span[@class='c1'])" -n
```
but I would like to know if there is a better way than substr method. |
65,864,609 | I have such html files.
Basically it has div containing texts with one inner span and the rest text part has pretty arbitrary format.
```
<html>
<div>
<span class="c1">Text1</span><br/>
Text4<br/>
Text5
</div>
<div>
<span class="c1">TextA</span><a href="...">TextD</a>
</div>
</html>
```
it is trivial to select/print... | 2021/01/23 | [
"https://Stackoverflow.com/questions/65864609",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/104897/"
] | It's been a while but you said,
>
> I would like to know if there is a better way than substr method
>
>
>
Here's a version which produces output in document order by using
a template matching the union of desired elements inside an `/html/div`.
Other elements than `br` are output
with their text value followed b... | I think there is a better way to do the job, but I have this one. I have tested it in scrapy xpath.I think its help you.
```
print(data.xpath("concat(string(//div[1]/span[contains(@class, 'c1')]),'|', '\n',substring-before(substring-after(//div[1], 'Text1'), 'Text5'),'\n',substring-after(substring-after(//div[1], 'Tex... |
65,864,609 | I have such html files.
Basically it has div containing texts with one inner span and the rest text part has pretty arbitrary format.
```
<html>
<div>
<span class="c1">Text1</span><br/>
Text4<br/>
Text5
</div>
<div>
<span class="c1">TextA</span><a href="...">TextD</a>
</div>
</html>
```
it is trivial to select/print... | 2021/01/23 | [
"https://Stackoverflow.com/questions/65864609",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/104897/"
] | It's been a while but you said,
>
> I would like to know if there is a better way than substr method
>
>
>
Here's a version which produces output in document order by using
a template matching the union of desired elements inside an `/html/div`.
Other elements than `br` are output
with their text value followed b... | Somehow I found a solution with `substring-after`
```
xml sel -t -m "/html/div" -v "span[@class='c1']" -o '|' -v "substring-after(.,span[@class='c1'])" -n
```
but I would like to know if there is a better way than substr method. |
56,994,591 | I have a numpy boolean `selector` array which I can apply to array `a`. *(not actually random in the problem domain, this is just convenient for the example)*. But I actually want to select using only the first n True entries of `selector` *(up to n=3 in the example)*. So given `selector` plus a parameter `n`, how do I... | 2019/07/11 | [
"https://Stackoverflow.com/questions/56994591",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3265562/"
] | **Approach #1**
One approach would be using cumsum and argmax to get the extent and then slice thereafter to set `False` -
```
In [40]: n = 3
In [41]: selector
Out[41]:
array([ True, False, True, True, True, False, True, False, True,
False])
In [42]: selector[(selector.cumsum()>n).argmax():] = 0
In [4... | Get the all the choosen indices in a list and slice this list.
Then use list comprehension to retrieve the data at those choosen indices.
```
import numpy as np
selector = np.random.random(10) > 0.5
data = np.arange(10)
choosen_indices = np.where(selector)
#select first 3 choosen
choosen_few_indices = choosen_indice... |
48,607,385 | I need to loop using jQuery. Sometimes my query returns more than one row, so I want to check if the query returned more than one. I want to view all outputs in `p` tags (one by one). I wrote my code and it gives only the last row in my query. How can I return all rows in `<p>` tags? What is the error in my code?
```h... | 2018/02/04 | [
"https://Stackoverflow.com/questions/48607385",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9293963/"
] | You can use each method <https://api.jquery.com/each/>
```
$("p").each(function(element) {
console.log(element.text);
});
```
This will print out the contents of all p elements in your code. | guess the problem is here,you didn't accumulate;
```
$("#slsNo").keyup(function () {
$("#hsCode").val(null);
$("#slsiUnit").val(null);
var slsNo = $("#slsNo").val();
$.ajax({
type: 'GET',
url: '${pageContext.request.contextPath}/restservice/ViewProd/' + slsNo... |
48,607,385 | I need to loop using jQuery. Sometimes my query returns more than one row, so I want to check if the query returned more than one. I want to view all outputs in `p` tags (one by one). I wrote my code and it gives only the last row in my query. How can I return all rows in `<p>` tags? What is the error in my code?
```h... | 2018/02/04 | [
"https://Stackoverflow.com/questions/48607385",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9293963/"
] | You have some issues in your code
=================================
**Let's analyze them :-)**
You're using a condition when the array `jdata`'s length === 1 within the `for-loop`. Move that logic outside from the `for-loop`.
```
for (var x = 0; x < jdata.length; x++) {
if (1 < jdata.length) {
^
```
You'r... | You can use each method <https://api.jquery.com/each/>
```
$("p").each(function(element) {
console.log(element.text);
});
```
This will print out the contents of all p elements in your code. |
48,607,385 | I need to loop using jQuery. Sometimes my query returns more than one row, so I want to check if the query returned more than one. I want to view all outputs in `p` tags (one by one). I wrote my code and it gives only the last row in my query. How can I return all rows in `<p>` tags? What is the error in my code?
```h... | 2018/02/04 | [
"https://Stackoverflow.com/questions/48607385",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9293963/"
] | ```
$.ajax({
type: 'GET',
url: '${pageContext.request.contextPath}/restservice/ViewProd/' + slsNo,
dataType: "json",//if you return json data you don't need var jString = JSON.stringify(result);var jdata = JSON.parse(jString);
beforeSend: function () {
$("#prodDeccarea").html("");//this will cl... | guess the problem is here,you didn't accumulate;
```
$("#slsNo").keyup(function () {
$("#hsCode").val(null);
$("#slsiUnit").val(null);
var slsNo = $("#slsNo").val();
$.ajax({
type: 'GET',
url: '${pageContext.request.contextPath}/restservice/ViewProd/' + slsNo... |
48,607,385 | I need to loop using jQuery. Sometimes my query returns more than one row, so I want to check if the query returned more than one. I want to view all outputs in `p` tags (one by one). I wrote my code and it gives only the last row in my query. How can I return all rows in `<p>` tags? What is the error in my code?
```h... | 2018/02/04 | [
"https://Stackoverflow.com/questions/48607385",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9293963/"
] | You have some issues in your code
=================================
**Let's analyze them :-)**
You're using a condition when the array `jdata`'s length === 1 within the `for-loop`. Move that logic outside from the `for-loop`.
```
for (var x = 0; x < jdata.length; x++) {
if (1 < jdata.length) {
^
```
You'r... | guess the problem is here,you didn't accumulate;
```
$("#slsNo").keyup(function () {
$("#hsCode").val(null);
$("#slsiUnit").val(null);
var slsNo = $("#slsNo").val();
$.ajax({
type: 'GET',
url: '${pageContext.request.contextPath}/restservice/ViewProd/' + slsNo... |
48,607,385 | I need to loop using jQuery. Sometimes my query returns more than one row, so I want to check if the query returned more than one. I want to view all outputs in `p` tags (one by one). I wrote my code and it gives only the last row in my query. How can I return all rows in `<p>` tags? What is the error in my code?
```h... | 2018/02/04 | [
"https://Stackoverflow.com/questions/48607385",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9293963/"
] | You have some issues in your code
=================================
**Let's analyze them :-)**
You're using a condition when the array `jdata`'s length === 1 within the `for-loop`. Move that logic outside from the `for-loop`.
```
for (var x = 0; x < jdata.length; x++) {
if (1 < jdata.length) {
^
```
You'r... | ```
$.ajax({
type: 'GET',
url: '${pageContext.request.contextPath}/restservice/ViewProd/' + slsNo,
dataType: "json",//if you return json data you don't need var jString = JSON.stringify(result);var jdata = JSON.parse(jString);
beforeSend: function () {
$("#prodDeccarea").html("");//this will cl... |
45,447,617 | Tried to send data from one view controller (from an alamofire request) to the next view controller in a navigation controller.
I tried to this with a delegate, but I do not get it working. I allready know this is not the way, but i need to find a solution to get it working.
See below for the code, from view contro... | 2017/08/01 | [
"https://Stackoverflow.com/questions/45447617",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8378150/"
] | To pass data forward, like williej926 said, segues are the way to go. To pass data forward from one viewcontroller to another, you need to create a segue between these two viewcontrollers, and give the segue an identifier if there is more than one segue in your project that you are using to pass data, then this is a mu... | The best way to do this is by using a segue. Connect a segue between the controllers and in the `prepareForSegue` you add a variable that represents the controller you are segueing to like so: `let viewController = segue.destination as! viewController`. Now you can access and change variables inside `viewController` us... |
45,447,617 | Tried to send data from one view controller (from an alamofire request) to the next view controller in a navigation controller.
I tried to this with a delegate, but I do not get it working. I allready know this is not the way, but i need to find a solution to get it working.
See below for the code, from view contro... | 2017/08/01 | [
"https://Stackoverflow.com/questions/45447617",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8378150/"
] | I [wrote an answer](https://stackoverflow.com/a/44935672/7183483) about this not too long ago :
>
> One the simpler way to pass info from one VC to another is either through an initiliazer, or through a variable that you set before presenting the second VC.
>
>
>
The secone method would have you go through a dele... | The best way to do this is by using a segue. Connect a segue between the controllers and in the `prepareForSegue` you add a variable that represents the controller you are segueing to like so: `let viewController = segue.destination as! viewController`. Now you can access and change variables inside `viewController` us... |
28,928,959 | I have a problem. I'd like to share my MP3 File to Whatsapp but it don't work! Here my Share Intent:
```
public void shareAchieve() {
Intent shareAchievement = new Intent();
shareAchievement.setType("audio/*");
shareAchievement.putExtra(Intent.EXTRA_STREAM, Uri.parse("android.resource://de.... | 2015/03/08 | [
"https://Stackoverflow.com/questions/28928959",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4424328/"
] | As @CommonsWare Said ***Very few apps support the `android:resource` scheme***
To make your app compatible with all apps.
You have to copy your raw resource to Internal Storage by this method
```
private String CopyRAWtoSDCard(int raw_id,String sharePath) throws IOException {
InputStream in = getResources().... | You have missed adding /raw/ to the path and change your Intent like
change
```
Intent shareAchievement= new Intent();
shareAchievement.putExtra(Intent.EXTRA_STREAM, Uri.parse("android.resource://de.logtainment.ungesoundboard/" + R.raw.achieve + ".mp3"));
```
to
```
Intent shareAchievement= new Intent(Intent.ACT... |
5,836,843 | I'm trying to implement some automatic logout code for my Application on Android.
I need to detect if all the activities belonging to an Application have entered the background as opposed to working with `onPause()` and `onResume()` for each individual activity. iOS has a helpful `applicationDidEnterBackground:` metho... | 2011/04/29 | [
"https://Stackoverflow.com/questions/5836843",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/116858/"
] | There is no global callback for this, but for each activity it is onStop(). You don't need to mess with an atomic int. Just have a global int with the number of started activities, in every activity increment it in onStart() and decrement it in onStop(). | I think your suggestion is probably the best way to go. Unfortunately I don't think there's an API call to detect if your app is in the background or not. You'll just have to manipulate the onPause() and onResume() methods. Just keep in mind that you'll need need to account for transitions between activities, so once y... |
5,836,843 | I'm trying to implement some automatic logout code for my Application on Android.
I need to detect if all the activities belonging to an Application have entered the background as opposed to working with `onPause()` and `onResume()` for each individual activity. iOS has a helpful `applicationDidEnterBackground:` metho... | 2011/04/29 | [
"https://Stackoverflow.com/questions/5836843",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/116858/"
] | You really don't want to log out the user when the "application" goes in the background, any more than you log out the user of a Web app when the user switches to another tab or minimizes their browser window for a moment. If you were to do either of those things in a Web app, your users would consider your Web app to ... | There is no global callback for this, but for each activity it is onStop(). You don't need to mess with an atomic int. Just have a global int with the number of started activities, in every activity increment it in onStart() and decrement it in onStop(). |
5,836,843 | I'm trying to implement some automatic logout code for my Application on Android.
I need to detect if all the activities belonging to an Application have entered the background as opposed to working with `onPause()` and `onResume()` for each individual activity. iOS has a helpful `applicationDidEnterBackground:` metho... | 2011/04/29 | [
"https://Stackoverflow.com/questions/5836843",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/116858/"
] | There is no global callback for this, but for each activity it is onStop(). You don't need to mess with an atomic int. Just have a global int with the number of started activities, in every activity increment it in onStart() and decrement it in onStop(). | Create an Application class and include in the manifest
```
<application
android:name="com.example.hello.MyApplication"
public class MyApplication extends Application implements
ActivityLifecycleCallbacks, ComponentCallbacks2
```
override the following method
```
@Override
public void onTrimMemor... |
5,836,843 | I'm trying to implement some automatic logout code for my Application on Android.
I need to detect if all the activities belonging to an Application have entered the background as opposed to working with `onPause()` and `onResume()` for each individual activity. iOS has a helpful `applicationDidEnterBackground:` metho... | 2011/04/29 | [
"https://Stackoverflow.com/questions/5836843",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/116858/"
] | You really don't want to log out the user when the "application" goes in the background, any more than you log out the user of a Web app when the user switches to another tab or minimizes their browser window for a moment. If you were to do either of those things in a Web app, your users would consider your Web app to ... | I think your suggestion is probably the best way to go. Unfortunately I don't think there's an API call to detect if your app is in the background or not. You'll just have to manipulate the onPause() and onResume() methods. Just keep in mind that you'll need need to account for transitions between activities, so once y... |
5,836,843 | I'm trying to implement some automatic logout code for my Application on Android.
I need to detect if all the activities belonging to an Application have entered the background as opposed to working with `onPause()` and `onResume()` for each individual activity. iOS has a helpful `applicationDidEnterBackground:` metho... | 2011/04/29 | [
"https://Stackoverflow.com/questions/5836843",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/116858/"
] | I think your suggestion is probably the best way to go. Unfortunately I don't think there's an API call to detect if your app is in the background or not. You'll just have to manipulate the onPause() and onResume() methods. Just keep in mind that you'll need need to account for transitions between activities, so once y... | Create an Application class and include in the manifest
```
<application
android:name="com.example.hello.MyApplication"
public class MyApplication extends Application implements
ActivityLifecycleCallbacks, ComponentCallbacks2
```
override the following method
```
@Override
public void onTrimMemor... |
5,836,843 | I'm trying to implement some automatic logout code for my Application on Android.
I need to detect if all the activities belonging to an Application have entered the background as opposed to working with `onPause()` and `onResume()` for each individual activity. iOS has a helpful `applicationDidEnterBackground:` metho... | 2011/04/29 | [
"https://Stackoverflow.com/questions/5836843",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/116858/"
] | You really don't want to log out the user when the "application" goes in the background, any more than you log out the user of a Web app when the user switches to another tab or minimizes their browser window for a moment. If you were to do either of those things in a Web app, your users would consider your Web app to ... | Create an Application class and include in the manifest
```
<application
android:name="com.example.hello.MyApplication"
public class MyApplication extends Application implements
ActivityLifecycleCallbacks, ComponentCallbacks2
```
override the following method
```
@Override
public void onTrimMemor... |
28,140,306 | I need to save datetime in this columns in this format and then it will be seen in this format if i write select TIME from GAMES. But this is wrong. Can you help me ?
```
create table GAMES (
CIS_HRY INTEGER not null,
NAZEV VARCHAR2(30) not nu... | 2015/01/25 | [
"https://Stackoverflow.com/questions/28140306",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4491965/"
] | Dates do not have a "format" in Oracle - they always contain the fields YEAR, MONTH, DAY, HOUR, MINUTE, and SECOND. You format dates using the `TO_CHAR` function when extracting them for use in a particular situation. I suggest that you re-work your table design as
```
create table GAMES (
CIS_HRY ... | There are a couple of things you might do in this case. If you're using Oracle 11g or 12c, you could use virtual columns to "store" the date as a `VARCHAR2` in `YYYY-MM-DD` format, and time in your specified format; or you might use a trigger on `INSERT` or `UPDATE` to do the same with real columns; or you might (and t... |
21,715,549 | Consider the following demo data:
```
set.seed(1)
n <- 1000000
x1 <- rnorm(n)
x2 <- rnorm(n)
x3 <- rnorm(n)
```
If I build a matrix `mt` with `model.matrix()`, it takes forever:
```
system.time(mt <- model.matrix(~x1+x2+x3))
usuário sistema decorrido
0.916 0.185 1.135
```
But if I do the same with ma... | 2014/02/11 | [
"https://Stackoverflow.com/questions/21715549",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3216713/"
] | Using `debugonce(model.matrix.default)`, and within this using `tracemem(data)`
`model.matrix.default` calls `model.frame` which returns a `data.frame`. Within `model.matrix.default`, this data.frame is copied at least 3 times.
Why does `lm` use `model.matrix` --> `lm` is usually called with a `data.frame` , `list` o... | In general, a call to `Rprof` (in `library(utils)` which should be on the `search()` path by default) will illustrate where the overhead in time is coming from in a function call:
```
Rprof("Rprof.out")
m1 <- model.matrix( ~ x1 + x2 + x3)
Rprof(NULL)
summaryRprof("Rprof.out")
```
giving
```
> summaryRprof("Rprof.ou... |
2,157,636 | Is a program shipped in assembler format portable between Linux distributions (modulo CPU architecture differences)?
Here's the background to my question: I'm working on a new programming language (named Aklo), whose modus operandi will be the classic compiling to .s and feeding the result to the GNU assembler.
Obvio... | 2010/01/28 | [
"https://Stackoverflow.com/questions/2157636",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/45843/"
] | You might want to check out [LLVM](http://llvm.org/) before going down this particular path. It might make your life a lot easier, as it provides a [low level virtual machine](http://en.wikipedia.org/wiki/Low_Level_Virtual_Machine) that makes a lot of hard stuff just work and has been very popular. | It's basically 20 years since I last bootstrapped a C compiler. At the level of compilers, the differences between Linux distributions are minimal.
The much more important reason for going LLVM is cross-platform; if you're not writing some intermediate language, your compiler will be extremely difficult to retarget fo... |
2,157,636 | Is a program shipped in assembler format portable between Linux distributions (modulo CPU architecture differences)?
Here's the background to my question: I'm working on a new programming language (named Aklo), whose modus operandi will be the classic compiling to .s and feeding the result to the GNU assembler.
Obvio... | 2010/01/28 | [
"https://Stackoverflow.com/questions/2157636",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/45843/"
] | At a very high level, the ABI consists of { instruction set, system calls, binary format, libraries }.
Distribution as `.s` may free you from the binary format. This is still rather pointless, because you are fixed to a particular ISA and still need to use libraries and/or make system calls. Libraries vary from distri... | You might want to check out [LLVM](http://llvm.org/) before going down this particular path. It might make your life a lot easier, as it provides a [low level virtual machine](http://en.wikipedia.org/wiki/Low_Level_Virtual_Machine) that makes a lot of hard stuff just work and has been very popular. |
2,157,636 | Is a program shipped in assembler format portable between Linux distributions (modulo CPU architecture differences)?
Here's the background to my question: I'm working on a new programming language (named Aklo), whose modus operandi will be the classic compiling to .s and feeding the result to the GNU assembler.
Obvio... | 2010/01/28 | [
"https://Stackoverflow.com/questions/2157636",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/45843/"
] | At a very high level, the ABI consists of { instruction set, system calls, binary format, libraries }.
Distribution as `.s` may free you from the binary format. This is still rather pointless, because you are fixed to a particular ISA and still need to use libraries and/or make system calls. Libraries vary from distri... | It's basically 20 years since I last bootstrapped a C compiler. At the level of compilers, the differences between Linux distributions are minimal.
The much more important reason for going LLVM is cross-platform; if you're not writing some intermediate language, your compiler will be extremely difficult to retarget fo... |
2,807,910 | I have ClassA and ClassB, with ClassA being the superclass.
ClassA uses NodeA, ClassB uses NodeB.
First problem: method parameters. ClassB needs NodeB types, but I can't cast from the subclass to the superclass. That means I can't set properties which are unique to NodeB's.
Second problem: When I need to add nodes t... | 2010/05/11 | [
"https://Stackoverflow.com/questions/2807910",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/219691/"
] | Use the [add](http://api.jquery.com/add/) method:
```
$elem.add($elem2).show();
``` | Use the jquery data api <http://docs.jquery.com/Data> |
2,807,910 | I have ClassA and ClassB, with ClassA being the superclass.
ClassA uses NodeA, ClassB uses NodeB.
First problem: method parameters. ClassB needs NodeB types, but I can't cast from the subclass to the superclass. That means I can't set properties which are unique to NodeB's.
Second problem: When I need to add nodes t... | 2010/05/11 | [
"https://Stackoverflow.com/questions/2807910",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/219691/"
] | Use the jquery data api <http://docs.jquery.com/Data> | This worked for me:
```
var element1 = $('#element1'),
element2 = $('#element2'),
element3 = $('#element3'),
element4 = $('#element4');
$([element1[0], element2[0], element3[0], element4[0]]).my_function();
```
and had after some performance testing a way better result than this:
```
element1.add(ele... |
2,807,910 | I have ClassA and ClassB, with ClassA being the superclass.
ClassA uses NodeA, ClassB uses NodeB.
First problem: method parameters. ClassB needs NodeB types, but I can't cast from the subclass to the superclass. That means I can't set properties which are unique to NodeB's.
Second problem: When I need to add nodes t... | 2010/05/11 | [
"https://Stackoverflow.com/questions/2807910",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/219691/"
] | Use the [add](http://api.jquery.com/add/) method:
```
$elem.add($elem2).show();
``` | This worked for me:
```
var element1 = $('#element1'),
element2 = $('#element2'),
element3 = $('#element3'),
element4 = $('#element4');
$([element1[0], element2[0], element3[0], element4[0]]).my_function();
```
and had after some performance testing a way better result than this:
```
element1.add(ele... |
34,439,308 | I have a class that is called MyMethodQuery that contains a property of entry of my web method
```
[DataContract()]
public class MyMethodQuery
{
[DataMember(IsRequired = true)]
[StringLength(100, MinimumLength = 10)]
public string Id{ get; set; }
}
```
My Web Method :
```
public string MyMethod(MyMethod... | 2015/12/23 | [
"https://Stackoverflow.com/questions/34439308",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Your request includes non-simple headers `Content-type` and `signature` which must be included in the response's `Access-Control-Allow-Headers` header.
(`Content-type` is sometimes a simple header, but only for particular values. `application/json` is not one of those values, and it causes `Content-type` to become non... | Is your browser making an OPTIONS request before POSTing?
check the NET tab
I've had issues before where an OPTIONS request was being made by the browser or Angular (don't know which) and the server did not have ...
"Access-Control-Allow-Methods": "GET, POST", "PUT", "DELETE", "OPTIONS"; |
34,439,308 | I have a class that is called MyMethodQuery that contains a property of entry of my web method
```
[DataContract()]
public class MyMethodQuery
{
[DataMember(IsRequired = true)]
[StringLength(100, MinimumLength = 10)]
public string Id{ get; set; }
}
```
My Web Method :
```
public string MyMethod(MyMethod... | 2015/12/23 | [
"https://Stackoverflow.com/questions/34439308",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Your request includes non-simple headers `Content-type` and `signature` which must be included in the response's `Access-Control-Allow-Headers` header.
(`Content-type` is sometimes a simple header, but only for particular values. `application/json` is not one of those values, and it causes `Content-type` to become non... | Not sure if you already have the information you need. But in my local web-server - when I make an http request using postman here is what it adds to the header:
headers:
{ host: 'localhost',
connection: 'keep-alive',
pragma: 'no-cache',
'cache-control': 'no-cache',
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; WO... |
34,439,308 | I have a class that is called MyMethodQuery that contains a property of entry of my web method
```
[DataContract()]
public class MyMethodQuery
{
[DataMember(IsRequired = true)]
[StringLength(100, MinimumLength = 10)]
public string Id{ get; set; }
}
```
My Web Method :
```
public string MyMethod(MyMethod... | 2015/12/23 | [
"https://Stackoverflow.com/questions/34439308",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Is your browser making an OPTIONS request before POSTing?
check the NET tab
I've had issues before where an OPTIONS request was being made by the browser or Angular (don't know which) and the server did not have ...
"Access-Control-Allow-Methods": "GET, POST", "PUT", "DELETE", "OPTIONS"; | Not sure if you already have the information you need. But in my local web-server - when I make an http request using postman here is what it adds to the header:
headers:
{ host: 'localhost',
connection: 'keep-alive',
pragma: 'no-cache',
'cache-control': 'no-cache',
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; WO... |
50,649,275 | I am trying to make a bulleted list on a webpage and I need my bullets to function like checkboxes which the user can select. I want to, then, use them to execute some function based on the list elements that the user has selected. Also, each of those `<li>` further contains a `description list`.
`list-style-type` doe... | 2018/06/01 | [
"https://Stackoverflow.com/questions/50649275",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7082018/"
] | Your question is not very clear.
`list-style-type` is used to change the aesthetics of the bullets, but they can't have a specific function. In the example below, I used this property to remove the bullets.
```css
ul {
list-style-type:none;
}
```
```html
<ul>
<li><input type="checkbox"> whatever</li>
... | It looks like you want a list with the `list-style-type` set to `none`
HTML
```
<ul>
<li>
<input type="checkbox"> check 1
</li>
<li>
<input type="checkbox"> check 2
</li>
<li>
<ul>
<li>
<input type="checkbox"> check 3
</li>
... |
50,649,275 | I am trying to make a bulleted list on a webpage and I need my bullets to function like checkboxes which the user can select. I want to, then, use them to execute some function based on the list elements that the user has selected. Also, each of those `<li>` further contains a `description list`.
`list-style-type` doe... | 2018/06/01 | [
"https://Stackoverflow.com/questions/50649275",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7082018/"
] | Your question is not very clear.
`list-style-type` is used to change the aesthetics of the bullets, but they can't have a specific function. In the example below, I used this property to remove the bullets.
```css
ul {
list-style-type:none;
}
```
```html
<ul>
<li><input type="checkbox"> whatever</li>
... | Is it something like this that you're looking for.
```css
ul {
list-style-type: none;
}
```
```html
<ul>
<li>
<dl>
<dt> <label><input type="checkbox">Coffee</label> </dt>
<dd> Black, Strong<dd>
</dl>
</li>
<li>
<dl>
<dt> <label><input type="checkbox">Tea</label> </dt>
... |
50,649,275 | I am trying to make a bulleted list on a webpage and I need my bullets to function like checkboxes which the user can select. I want to, then, use them to execute some function based on the list elements that the user has selected. Also, each of those `<li>` further contains a `description list`.
`list-style-type` doe... | 2018/06/01 | [
"https://Stackoverflow.com/questions/50649275",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7082018/"
] | Is it something like this that you're looking for.
```css
ul {
list-style-type: none;
}
```
```html
<ul>
<li>
<dl>
<dt> <label><input type="checkbox">Coffee</label> </dt>
<dd> Black, Strong<dd>
</dl>
</li>
<li>
<dl>
<dt> <label><input type="checkbox">Tea</label> </dt>
... | It looks like you want a list with the `list-style-type` set to `none`
HTML
```
<ul>
<li>
<input type="checkbox"> check 1
</li>
<li>
<input type="checkbox"> check 2
</li>
<li>
<ul>
<li>
<input type="checkbox"> check 3
</li>
... |
38,455,792 | I have a viewmodel:
```
public class CourseViewModel
{
public int CourseID { get; set; }
public string Title { get; set; }
public string page_title { get; set; }
public string titleabbrev { get; set; }
public string Meta { get; set; }
public string intro_1 { get; set; }
public string intro_... | 2016/07/19 | [
"https://Stackoverflow.com/questions/38455792",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6140842/"
] | Wow.
Please look up the concepts of object oriented programming <https://docs.oracle.com/javase/tutorial/java/concepts/>
You want to define new parameters as type + parametername like Pirate wrote in his answer. Different parameters are separated by commas.
Try
```
package shop;
public class MyShop{
private S... | Try this,
```
class A{
A(String a,String b){
System.out.print(a);
System.out.print(b);
}
public static void main(String arg[]){
A obj=new A("Stack","OverFlow");
}
}
```
Hope it will help. |
39,936,092 | I want to create a list from an existing list after removing all duplicates.
Program works if I use a "for loop" but nothing happens if I use a list comprehension.
```
#use for loop
l=[1,2,2,3,1,1,2]
j=[]
for i in l:
if i not in j:
j.append(i)
print l
print j
#using list
l1=[1,2,2,3,1,1,2]
j1=[]
j1=[i ... | 2016/10/08 | [
"https://Stackoverflow.com/questions/39936092",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6942423/"
] | The expression `[i for i in l1 if i not in j1]` is evaluated and then assigned to *j1*. So during the evaluation *j1* stays empty.
BTW: An easy was of removing duplicates is to pass the list to the [set](https://docs.python.org/3/library/functions.html#func-set) function and then to the [list](https://docs.python.org/... | `j1` is `[]` at the start and isn't updated at intermediate points within the list comprehension. Could do this instead of list comprehension though:
```
l1=[1,2,2,3,1,1,2]
j1=list(set(l1))
print l1
print j1
``` |
5,076,760 | I have just installed MVC3 and VS 2010 express.
Writing my first app in MVC3 but not my first MVC app.
I have written a custom html helper like so
```
namespace MyNamespace.Web.Helpers
{
public static class HtmlExtensions
{
public static string RenderHeaderImages(this HtmlHelper html)
{
... | 2011/02/22 | [
"https://Stackoverflow.com/questions/5076760",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/40568/"
] | I had a similar problem where my custom HTML helper was not being found. I thought it was enough to put the helper's namespace in web.config. But you also need the using statement inside your view (I'm using razor):
```
@using MyProject.HtmlHelpers;
```
Thanks for posting this. | The problem was that I added the wrong `using` for the `HtmlHelper` class
```
using System.Web.WebPages.Html;
```
should have been
```
using System.Web.Mvc
``` |
56,087,274 | While running the .Net Core 2.0 API endpoint getting below error.
A suitable constructor for type 'RestDataService' could not be located. Ensure the type is concrete and services are registered for all parameters of a public constructor.
```
public partial class RestDataService : IRestDataService
{
priva... | 2019/05/11 | [
"https://Stackoverflow.com/questions/56087274",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8133251/"
] | You have to define which concrete class of interface you want to use for IRestDataService. So, define like this.
```
services.AddTransient<IRestDataService, RestDataService>();
```
Remove static keyword before AppConfiguration.
```
private readonly AppConfiguration _configuration;
``` | I had forgotten to add a `RequestDelegate next` parameter to my middleware constructor. Without this, I would get an exception with the message "A suitable constructor for type `[Type]` could not be located. Ensure the type is concrete and services are registered for all parameters of a public constructor" upon calling... |
56,087,274 | While running the .Net Core 2.0 API endpoint getting below error.
A suitable constructor for type 'RestDataService' could not be located. Ensure the type is concrete and services are registered for all parameters of a public constructor.
```
public partial class RestDataService : IRestDataService
{
priva... | 2019/05/11 | [
"https://Stackoverflow.com/questions/56087274",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8133251/"
] | I received the error *"A suitable constructor for type '<type>' could not be located."* after accidentally generating a **protected** constructor instead of **public** constructor. Marking it back to *public* fixed it. | I just ran across this issue because I was accidentally registering `HttpClient` to an `interface`.
```cs
public void ConfigureServices(IServiceCollection services) {
// !! Wrong, this is done automatically by AddHttpClient<IMyService, MyService>()
services.AddTransient<IMyService, MyService>();
// !! There is ... |
56,087,274 | While running the .Net Core 2.0 API endpoint getting below error.
A suitable constructor for type 'RestDataService' could not be located. Ensure the type is concrete and services are registered for all parameters of a public constructor.
```
public partial class RestDataService : IRestDataService
{
priva... | 2019/05/11 | [
"https://Stackoverflow.com/questions/56087274",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8133251/"
] | For `AddHttpClient`, you need to provide `HttpClient` parameter for `RestDataService`. And, you need to register `AppConfiguration`.
1. `RestDataService`
```
public class RestDataService: IRestDataService
{
private static HttpClient _client;
private static AppConfiguration _configuration;
private const ... | I just ran across this issue because I was accidentally registering `HttpClient` to an `interface`.
```cs
public void ConfigureServices(IServiceCollection services) {
// !! Wrong, this is done automatically by AddHttpClient<IMyService, MyService>()
services.AddTransient<IMyService, MyService>();
// !! There is ... |
56,087,274 | While running the .Net Core 2.0 API endpoint getting below error.
A suitable constructor for type 'RestDataService' could not be located. Ensure the type is concrete and services are registered for all parameters of a public constructor.
```
public partial class RestDataService : IRestDataService
{
priva... | 2019/05/11 | [
"https://Stackoverflow.com/questions/56087274",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8133251/"
] | For `AddHttpClient`, you need to provide `HttpClient` parameter for `RestDataService`. And, you need to register `AppConfiguration`.
1. `RestDataService`
```
public class RestDataService: IRestDataService
{
private static HttpClient _client;
private static AppConfiguration _configuration;
private const ... | In my case I got this problem when inattentively duplicating row with DI service registration to register new service but accidentally missed that this is `.AddHttpClient()` method instead of `.AddTransient()` or `.AddScoped()` |
56,087,274 | While running the .Net Core 2.0 API endpoint getting below error.
A suitable constructor for type 'RestDataService' could not be located. Ensure the type is concrete and services are registered for all parameters of a public constructor.
```
public partial class RestDataService : IRestDataService
{
priva... | 2019/05/11 | [
"https://Stackoverflow.com/questions/56087274",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8133251/"
] | You have to define which concrete class of interface you want to use for IRestDataService. So, define like this.
```
services.AddTransient<IRestDataService, RestDataService>();
```
Remove static keyword before AppConfiguration.
```
private readonly AppConfiguration _configuration;
``` | In my case I got this problem when inattentively duplicating row with DI service registration to register new service but accidentally missed that this is `.AddHttpClient()` method instead of `.AddTransient()` or `.AddScoped()` |
56,087,274 | While running the .Net Core 2.0 API endpoint getting below error.
A suitable constructor for type 'RestDataService' could not be located. Ensure the type is concrete and services are registered for all parameters of a public constructor.
```
public partial class RestDataService : IRestDataService
{
priva... | 2019/05/11 | [
"https://Stackoverflow.com/questions/56087274",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8133251/"
] | For `AddHttpClient`, you need to provide `HttpClient` parameter for `RestDataService`. And, you need to register `AppConfiguration`.
1. `RestDataService`
```
public class RestDataService: IRestDataService
{
private static HttpClient _client;
private static AppConfiguration _configuration;
private const ... | You have to define which concrete class of interface you want to use for IRestDataService. So, define like this.
```
services.AddTransient<IRestDataService, RestDataService>();
```
Remove static keyword before AppConfiguration.
```
private readonly AppConfiguration _configuration;
``` |
56,087,274 | While running the .Net Core 2.0 API endpoint getting below error.
A suitable constructor for type 'RestDataService' could not be located. Ensure the type is concrete and services are registered for all parameters of a public constructor.
```
public partial class RestDataService : IRestDataService
{
priva... | 2019/05/11 | [
"https://Stackoverflow.com/questions/56087274",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8133251/"
] | I just ran across this issue because I was accidentally registering `HttpClient` to an `interface`.
```cs
public void ConfigureServices(IServiceCollection services) {
// !! Wrong, this is done automatically by AddHttpClient<IMyService, MyService>()
services.AddTransient<IMyService, MyService>();
// !! There is ... | This doesn't directly answer the question, but is related.
For anyone using `ActivatorUtilities.CreateInstance<T>(IServiceProvider, params object[] parameters)` it's worth mentioning that every parameter must be in the parameters of the class you are creating. I.e.
```cs
public class Example
{
public Example(App... |
56,087,274 | While running the .Net Core 2.0 API endpoint getting below error.
A suitable constructor for type 'RestDataService' could not be located. Ensure the type is concrete and services are registered for all parameters of a public constructor.
```
public partial class RestDataService : IRestDataService
{
priva... | 2019/05/11 | [
"https://Stackoverflow.com/questions/56087274",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8133251/"
] | You have to define which concrete class of interface you want to use for IRestDataService. So, define like this.
```
services.AddTransient<IRestDataService, RestDataService>();
```
Remove static keyword before AppConfiguration.
```
private readonly AppConfiguration _configuration;
``` | This doesn't directly answer the question, but is related.
For anyone using `ActivatorUtilities.CreateInstance<T>(IServiceProvider, params object[] parameters)` it's worth mentioning that every parameter must be in the parameters of the class you are creating. I.e.
```cs
public class Example
{
public Example(App... |
56,087,274 | While running the .Net Core 2.0 API endpoint getting below error.
A suitable constructor for type 'RestDataService' could not be located. Ensure the type is concrete and services are registered for all parameters of a public constructor.
```
public partial class RestDataService : IRestDataService
{
priva... | 2019/05/11 | [
"https://Stackoverflow.com/questions/56087274",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8133251/"
] | I received the error *"A suitable constructor for type '<type>' could not be located."* after accidentally generating a **protected** constructor instead of **public** constructor. Marking it back to *public* fixed it. | You have to define which concrete class of interface you want to use for IRestDataService. So, define like this.
```
services.AddTransient<IRestDataService, RestDataService>();
```
Remove static keyword before AppConfiguration.
```
private readonly AppConfiguration _configuration;
``` |
56,087,274 | While running the .Net Core 2.0 API endpoint getting below error.
A suitable constructor for type 'RestDataService' could not be located. Ensure the type is concrete and services are registered for all parameters of a public constructor.
```
public partial class RestDataService : IRestDataService
{
priva... | 2019/05/11 | [
"https://Stackoverflow.com/questions/56087274",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8133251/"
] | I received the error *"A suitable constructor for type '<type>' could not be located."* after accidentally generating a **protected** constructor instead of **public** constructor. Marking it back to *public* fixed it. | This doesn't directly answer the question, but is related.
For anyone using `ActivatorUtilities.CreateInstance<T>(IServiceProvider, params object[] parameters)` it's worth mentioning that every parameter must be in the parameters of the class you are creating. I.e.
```cs
public class Example
{
public Example(App... |
28,717,373 | Here is the problem,
I just installed PostgreSQL right now and try to build a geoloc database.
For this, i installed the PostGIS extension and PostGIS\_Topology.
In my pgAdmin UI, i can see my model, my schema is "Geo" and I can see below, in the functions list, the postGis functions that are available (about 1000, s... | 2015/02/25 | [
"https://Stackoverflow.com/questions/28717373",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3774191/"
] | Exactly the same way as in Python. C++11 has regular expressions (and for earlier C++, there's Boost regex.) As for the read loop:
```
std::string line;
while ( std::getline( file, line ) ) {
// ...
}
```
is almost exactly the same as:
```
for line in file:
# ...
```
The only differences are:
* The C... | Use flex (it generates C or C++ code, to be used as a part or as the full program)
```
%%
^[^,]+/, {printf("Autor: %s\n",yytext );}
\"[^"]+\" {printf("Title: %s\n",yytext );}
\([^ ]+/[ ]pp\. {printf("Pages: %s\n",yytext+1);}
..................
.|\n {}
%%
```
(untested) |
28,717,373 | Here is the problem,
I just installed PostgreSQL right now and try to build a geoloc database.
For this, i installed the PostGIS extension and PostGIS\_Topology.
In my pgAdmin UI, i can see my model, my schema is "Geo" and I can see below, in the functions list, the postGis functions that are available (about 1000, s... | 2015/02/25 | [
"https://Stackoverflow.com/questions/28717373",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3774191/"
] | Exactly the same way as in Python. C++11 has regular expressions (and for earlier C++, there's Boost regex.) As for the read loop:
```
std::string line;
while ( std::getline( file, line ) ) {
// ...
}
```
is almost exactly the same as:
```
for line in file:
# ...
```
The only differences are:
* The C... | Here's the code:
```
#include <iostream>
#include <cstring>
using namespace std;
string extract (string a)
{
string str = "AUTHOR = "; //the result string
int i = 0;
while (a[i] != ',')
str += a[i++];
while (a[i++] != '\"');
str += "\nTITLE = ";
while (a[i] != '\"')
str += a[... |
28,717,373 | Here is the problem,
I just installed PostgreSQL right now and try to build a geoloc database.
For this, i installed the PostGIS extension and PostGIS\_Topology.
In my pgAdmin UI, i can see my model, my schema is "Geo" and I can see below, in the functions list, the postGis functions that are available (about 1000, s... | 2015/02/25 | [
"https://Stackoverflow.com/questions/28717373",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3774191/"
] | Exactly the same way as in Python. C++11 has regular expressions (and for earlier C++, there's Boost regex.) As for the read loop:
```
std::string line;
while ( std::getline( file, line ) ) {
// ...
}
```
is almost exactly the same as:
```
for line in file:
# ...
```
The only differences are:
* The C... | Your input string is well delimited so I'd recommend using an extraction operator over a `regex`, for speed and for ease of use.
You'd first need to create a `struct` for your books:
```
struct book{
string author;
string title;
int pages;
string code;
string status;
};
```
Then you'd need to wr... |
28,717,373 | Here is the problem,
I just installed PostgreSQL right now and try to build a geoloc database.
For this, i installed the PostGIS extension and PostGIS\_Topology.
In my pgAdmin UI, i can see my model, my schema is "Geo" and I can see below, in the functions list, the postGis functions that are available (about 1000, s... | 2015/02/25 | [
"https://Stackoverflow.com/questions/28717373",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3774191/"
] | Use flex (it generates C or C++ code, to be used as a part or as the full program)
```
%%
^[^,]+/, {printf("Autor: %s\n",yytext );}
\"[^"]+\" {printf("Title: %s\n",yytext );}
\([^ ]+/[ ]pp\. {printf("Pages: %s\n",yytext+1);}
..................
.|\n {}
%%
```
(untested) | Here's the code:
```
#include <iostream>
#include <cstring>
using namespace std;
string extract (string a)
{
string str = "AUTHOR = "; //the result string
int i = 0;
while (a[i] != ',')
str += a[i++];
while (a[i++] != '\"');
str += "\nTITLE = ";
while (a[i] != '\"')
str += a[... |
28,717,373 | Here is the problem,
I just installed PostgreSQL right now and try to build a geoloc database.
For this, i installed the PostGIS extension and PostGIS\_Topology.
In my pgAdmin UI, i can see my model, my schema is "Geo" and I can see below, in the functions list, the postGis functions that are available (about 1000, s... | 2015/02/25 | [
"https://Stackoverflow.com/questions/28717373",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3774191/"
] | Your input string is well delimited so I'd recommend using an extraction operator over a `regex`, for speed and for ease of use.
You'd first need to create a `struct` for your books:
```
struct book{
string author;
string title;
int pages;
string code;
string status;
};
```
Then you'd need to wr... | Here's the code:
```
#include <iostream>
#include <cstring>
using namespace std;
string extract (string a)
{
string str = "AUTHOR = "; //the result string
int i = 0;
while (a[i] != ',')
str += a[i++];
while (a[i++] != '\"');
str += "\nTITLE = ";
while (a[i] != '\"')
str += a[... |
368,049 | The light from the sun will stop traveling after a particular distance due to its intensity becoming 0.
Up to which planet does the light from the sun travel before which it dissipates into nothing?
If light ceases to exist after a particular distance, How are we able to use telescopes to see objects further than th... | 2017/11/10 | [
"https://physics.stackexchange.com/questions/368049",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/118921/"
] | Light never disappears. It consists of photons, which just keep going forever. [The Cosmic Microwave Background](https://en.wikipedia.org/wiki/Cosmic_microwave_background) that we detect in the sky was the light emitted about 13 and a half billion years ago that accordingly has traveled to us over the distance of 13 an... | Light, as photons themselves never stop travelling. The intensity is inversely proportional to the distance from the light source, so the intensity will be ever smaller and closer and closer to zero but never zero. However, information will be lost during the process as the light is more spread out, so it is hard for u... |
368,049 | The light from the sun will stop traveling after a particular distance due to its intensity becoming 0.
Up to which planet does the light from the sun travel before which it dissipates into nothing?
If light ceases to exist after a particular distance, How are we able to use telescopes to see objects further than th... | 2017/11/10 | [
"https://physics.stackexchange.com/questions/368049",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/118921/"
] | Light never disappears. It consists of photons, which just keep going forever. [The Cosmic Microwave Background](https://en.wikipedia.org/wiki/Cosmic_microwave_background) that we detect in the sky was the light emitted about 13 and a half billion years ago that accordingly has traveled to us over the distance of 13 an... | Light can be thought of as particles of photons. They travel forever, and there are no limits, although they do get weaker and lose energy, as safesphere has said. |
368,049 | The light from the sun will stop traveling after a particular distance due to its intensity becoming 0.
Up to which planet does the light from the sun travel before which it dissipates into nothing?
If light ceases to exist after a particular distance, How are we able to use telescopes to see objects further than th... | 2017/11/10 | [
"https://physics.stackexchange.com/questions/368049",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/118921/"
] | Light, as photons themselves never stop travelling. The intensity is inversely proportional to the distance from the light source, so the intensity will be ever smaller and closer and closer to zero but never zero. However, information will be lost during the process as the light is more spread out, so it is hard for u... | Light can be thought of as particles of photons. They travel forever, and there are no limits, although they do get weaker and lose energy, as safesphere has said. |
20,269,888 | Currently I am running tomcat 6.0.37 version (64-bit windows) on remote desktop server(OS-Windows2008/64-bit), please help me to find answers for the following questions.
**QUESTIONS**
**Q1)** How can I run tomcat 6.0.37 version(64-bit windows) as a background process, after closing the tomcat server command prompt w... | 2013/11/28 | [
"https://Stackoverflow.com/questions/20269888",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3046193/"
] | That's because just `usr/include/` isn't a proper compiler flag. You need to use e.g. `-I/usr/include/`.
However, using libraries from userspace in a kernel driver might not work as you expect it to, like not at all. The kernel should have have it's own string library (including the `"string.h"` header file) that you ... | it seems like we can not use standard header files in kernel programming. Thanks for your help |
612,076 | Let $\{x\_n\}\_{n\in \mathbb{N}}\subset \mathbb{R}$ be a bounded sequence. We define $\forall N \in \mathbb{N}$:
$$a\_N := inf\{x\_n \mid n \geq N\}$$
$$b\_N := sup\{x\_n \mid n \geq N\}$$
$$l := \lim\_{N \to \infty} a\_N$$
$$L := \lim\_{N \to \infty} b\_N$$
1. Prove that $\{x\_n\}\_{n\in \mathbb{N}}$ converges $\iff$ ... | 2013/12/18 | [
"https://math.stackexchange.com/questions/612076",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/114655/"
] | If $(x\_n)$ converges, say to $p$, then the idea is clearly that $l = L = p$ in this case.
Suppose $l < L$ instead. Then take $\epsilon < \frac{L - l}{2}$, then all terms of the sequence $x\_n$ where $n >= K$, for some $K$, lie in $(p-\epsilon, p+\epsilon)$. What does this say about $a\_K$ and $b\_K$?
Consider $l-1$ f... | 2) consider the sequence $a\_N+1/N$ resp. $b\_N-1/N$ and their relations to the partial sequence $x\_N,x\_{n+1},...$.
The second part of 1) is actually a consequence of 2), since all subsequences of a convergent sequence have the same limit. |
612,076 | Let $\{x\_n\}\_{n\in \mathbb{N}}\subset \mathbb{R}$ be a bounded sequence. We define $\forall N \in \mathbb{N}$:
$$a\_N := inf\{x\_n \mid n \geq N\}$$
$$b\_N := sup\{x\_n \mid n \geq N\}$$
$$l := \lim\_{N \to \infty} a\_N$$
$$L := \lim\_{N \to \infty} b\_N$$
1. Prove that $\{x\_n\}\_{n\in \mathbb{N}}$ converges $\iff$ ... | 2013/12/18 | [
"https://math.stackexchange.com/questions/612076",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/114655/"
] | 1) $\Longrightarrow$
Let $\left(x\_{n}\right)\_{n}$ converge to
$x$.
For $\varepsilon>0$ some $n\_{\varepsilon}$ exists such that
$n\geq n\_{\varepsilon}\Rightarrow\left|x-x\_{n}\right|<\varepsilon$.
Then $a\_{N}\geq x-\varepsilon$ and $b\_{N}\leq x+\varepsilon$ for
each $N\geq n\_{\varepsilon}$ and consequently $... | 2) consider the sequence $a\_N+1/N$ resp. $b\_N-1/N$ and their relations to the partial sequence $x\_N,x\_{n+1},...$.
The second part of 1) is actually a consequence of 2), since all subsequences of a convergent sequence have the same limit. |
52,934,666 | I need to restart the Elasticsearch node after installing the injest-attachment plugin on Kubernetes Engine on Google Cloud Platform. I have deployed Elasticsearch on a pod. What is the best way to restart the Elasticsearch nodes? | 2018/10/22 | [
"https://Stackoverflow.com/questions/52934666",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10540437/"
] | If Elasticsearch is running directly on the VM:
```
systemctl restart elasticsearch
```
If Elasticsearch is running as a container on docker:
```
docker restart <container-id>
```
If Elasticsearch is running as a Kubernetes pod (deployed through a Kubernetes manifest):
* update the image tag in the manifest if n... | If you have deployed elasticsearch with a replication set, Kubernetes will enforce the number of desired pods automatically so you can simply kill the existing pod and a new one can be created.
```
kubectl delete pods example-pod-1812877987
``` |
52,934,666 | I need to restart the Elasticsearch node after installing the injest-attachment plugin on Kubernetes Engine on Google Cloud Platform. I have deployed Elasticsearch on a pod. What is the best way to restart the Elasticsearch nodes? | 2018/10/22 | [
"https://Stackoverflow.com/questions/52934666",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10540437/"
] | If Elasticsearch is running directly on the VM:
```
systemctl restart elasticsearch
```
If Elasticsearch is running as a container on docker:
```
docker restart <container-id>
```
If Elasticsearch is running as a Kubernetes pod (deployed through a Kubernetes manifest):
* update the image tag in the manifest if n... | I ran into the same problem when installing the ltr plugin on a Minikube deployment of Elasticsearch.
Following the instructions of using initContainer to install the plugin [1] did not work since I could not figure out how to restart Elasticsearch after plugin installation since I was not able to get root access to t... |
18,286,356 | I'm trying to get the two separate pieces of text onto the same line on the grid, I want the words to wrap around inside the constraints of the grid (or a css border). At the moment the output is the text is not wrapping. Whats missing?
```
<h2 class="text" class="grid_6">Best cheese I've ever tasted!</h2>
<h2 class="... | 2013/08/17 | [
"https://Stackoverflow.com/questions/18286356",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2683765/"
] | **Update Q4 2017**. Since my original answer GPU-based encoding has become widely available. If you have a modern [NVIDIA video card and can compile ffmpeg](https://developer.nvidia.com/ffmpeg) then you should be good to go.
Thanks to [Dmytro Dzyubak](https://stackoverflow.com/users/2510628/dmytro-dzyubak) for pointing... | It may be still "under development", but i found several doom9 thread taking about a huge improvement of the x264 encoder(the lib ffmpeg use) when the "LookAhead" function is "on GPU" But it use **OpenCL**.
* <http://forum.doom9.org/showthread.php?t=164960>
* <http://forum.doom9.org/showthread.php?t=165984>
It may he... |
18,286,356 | I'm trying to get the two separate pieces of text onto the same line on the grid, I want the words to wrap around inside the constraints of the grid (or a css border). At the moment the output is the text is not wrapping. Whats missing?
```
<h2 class="text" class="grid_6">Best cheese I've ever tasted!</h2>
<h2 class="... | 2013/08/17 | [
"https://Stackoverflow.com/questions/18286356",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2683765/"
] | **Update Q4 2017**. Since my original answer GPU-based encoding has become widely available. If you have a modern [NVIDIA video card and can compile ffmpeg](https://developer.nvidia.com/ffmpeg) then you should be good to go.
Thanks to [Dmytro Dzyubak](https://stackoverflow.com/users/2510628/dmytro-dzyubak) for pointing... | If you're using an NVidia GPU this might be helpful:
<https://developer.nvidia.com/nvidia-codec-libraries> |
59,711 | Can you please elaborate what's "rounded" teaspoon, what's "heaped" teaspoon and what other "types" of teaspoons exists as a measures of volume?
And is there any difference between, rounded teaspoon and rounded teaspoon\**ful*\*? | 2012/03/01 | [
"https://english.stackexchange.com/questions/59711",
"https://english.stackexchange.com",
"https://english.stackexchange.com/users/6704/"
] | You have a teaspoon, which measures volume - usually in some ovular, concave measuring device. Let's say you're measuring a teaspoon of something granular, like flour, coffee or sugar.
**1 tsp** (or **1 *level* tsp**) means that the top of what you're measuring is flat; no sugar goes above the top of the spoon.
**1 r... | There is also the "scant teaspoon" ([example here](http://recipes.howstuffworks.com/tools-and-techniques/what-does-scant-mean.htm)). It's slightly less than a level teaspoon.
Note that "scant" sometimes means "barely" but in this context it means "not quite." |
21,789,040 | ```
<asp:CheckBoxList ID="ckbLstPartner" runat="server" RepeatDirection="Horizontal" CssClass="cssRdlstMoheSacm">
<asp:ListItem Text="Yes" Value="1"></asp:ListItem>
<asp:ListItem Text="No" Value="0"></asp:ListItem>
</asp:CheckBoxList>
```
In the above CheckBoxList, I'm trying to get the (selected value) by JQuery to ... | 2014/02/14 | [
"https://Stackoverflow.com/questions/21789040",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3311712/"
] | just this
```
$('#<%=ckbLstPartner.ClientID %>').find('option:checked').val();
```
or
```
$('[id$=ckbLstPartner]').find('option:checked').val();
``` | Get checked value
```
$('#<%=ckbLstPartner.ClientID %>').find('option:checked').val();
```
[.val()](http://api.jquery.com/val/)
[.find()](http://api.jquery.com/find/) |
579,380 | In Irving Kaplansky's "Set Theory and Metric Spaces", exercise 17 on page 71 asks for an example of a metric space which is isometric to a proper subset of itself. Any infinite discrete space and any $\ell^p$ space are such spaces, for different reasons. I want some kind of middle ground, that is, some example which is... | 2013/11/24 | [
"https://math.stackexchange.com/questions/579380",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/109951/"
] | Let $\langle Y,d\rangle$ be any metric space, and fix a point $p\in Y$. Let $A$ be any infinite set, let $P=\{p\}\times A$, and let $X\_A=(Y\times A)/P$, the set resulting from $Y\times A$ by identifying $P$ to a point. By abuse of notation call this point $p$. Define a metric $\rho\_A$ on $X\_A$ as follows:
$$\rho\_A... | HINT:
Let $\theta$ any real number such that $\frac{\theta}{\pi}$ is irrational. The metric space $(e^{i n \theta})\_{n\ge 0}$ is isometric to the subset $(e^{i n \theta})\_{n\ge 1}$ by the map $z \mapsto e^{i\theta} \cdot z$ |
5,491,249 | I have a view that has a bunch of programmatically-created UIButton objects (rounded rectangle type), but I need to store a little bit of information in them, identifying each button. I was doing fine with the tag, but the numbers got too large, and I would like to basically have another piece of info associated with e... | 2011/03/30 | [
"https://Stackoverflow.com/questions/5491249",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/684578/"
] | Subclassing uibutton is a real pain. They don't usually work as expected since UIButton is an abstract class. Therefore to make a fully working button you may have to override quite a few methods to get the button to do everything the the Apple subclasses do. Instead if you just need to add storage you can use [associa... | I think adding an `NSString` with some id info shouldn't mess up your `UIButton` subclass too much. At least it's easy to try it out, we are talking 10 lines of code here. I subclassed a UIButton and overrided initWithFrame method once and got it working correctly. But it's true, it is a pain and don't ask me why I did... |
62,740 | Italy certainly started out using the term, which is derived from Senatorial regalia.
Hitler's Germany can also pretty safely be classified as such, that's the regime most people have in mind when referring to Fasciscm.
However, did Franco ever refer to his regime as Fascist, at least during the time when the term ha... | 2021/02/04 | [
"https://history.stackexchange.com/questions/62740",
"https://history.stackexchange.com",
"https://history.stackexchange.com/users/14722/"
] | No. Franco was a [**Falangist**](https://en.wikipedia.org/wiki/Falange_Espa%C3%B1ola), and called himself that. *(In real life more of a military opportunist, who grabbed his chance.)* [Fascists](https://en.wikipedia.org/wiki/Italian_Fascism) were the followers of Mussolini. Hitler was a [National-Socialist](https://en... | The evidence from Franco's own statements strongly suggests that he did not, at least in public. In fact, from 1937, he specifically rejected the term for the Falangists, though he did concede that there were fascists within the movement. He also came close to using the word 'fascist' in a speech in 1938 but deleted it... |
62,740 | Italy certainly started out using the term, which is derived from Senatorial regalia.
Hitler's Germany can also pretty safely be classified as such, that's the regime most people have in mind when referring to Fasciscm.
However, did Franco ever refer to his regime as Fascist, at least during the time when the term ha... | 2021/02/04 | [
"https://history.stackexchange.com/questions/62740",
"https://history.stackexchange.com",
"https://history.stackexchange.com/users/14722/"
] | No. Franco was a [**Falangist**](https://en.wikipedia.org/wiki/Falange_Espa%C3%B1ola), and called himself that. *(In real life more of a military opportunist, who grabbed his chance.)* [Fascists](https://en.wikipedia.org/wiki/Italian_Fascism) were the followers of Mussolini. Hitler was a [National-Socialist](https://en... | Franco was for all intents and purposes a fascist.
As Jos pointed out, the official (English) name of his party was ["Falangist"](https://en.wikipedia.org/wiki/FET_y_de_las_JONS), which refers to a "phalanx" and indirectly, military rule. But the Wikipedia article points out that Franco took the title "National Chief"... |
62,740 | Italy certainly started out using the term, which is derived from Senatorial regalia.
Hitler's Germany can also pretty safely be classified as such, that's the regime most people have in mind when referring to Fasciscm.
However, did Franco ever refer to his regime as Fascist, at least during the time when the term ha... | 2021/02/04 | [
"https://history.stackexchange.com/questions/62740",
"https://history.stackexchange.com",
"https://history.stackexchange.com/users/14722/"
] | The evidence from Franco's own statements strongly suggests that he did not, at least in public. In fact, from 1937, he specifically rejected the term for the Falangists, though he did concede that there were fascists within the movement. He also came close to using the word 'fascist' in a speech in 1938 but deleted it... | Franco was for all intents and purposes a fascist.
As Jos pointed out, the official (English) name of his party was ["Falangist"](https://en.wikipedia.org/wiki/FET_y_de_las_JONS), which refers to a "phalanx" and indirectly, military rule. But the Wikipedia article points out that Franco took the title "National Chief"... |
2,900,084 | I have a list of integers and I need to count how many of them are > 0.
I'm currently doing it with a list comprehension that looks like this:
```
sum([1 for x in frequencies if x > 0])
```
It seems like a decent comprehension but I don't really like the "1"; it seems like a bit of a magic number. Is there a more... | 2010/05/24 | [
"https://Stackoverflow.com/questions/2900084",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/122808/"
] | If you want to reduce the amount of memory, you can avoid generating a temporary list by using a generator:
```
sum(x > 0 for x in frequencies)
```
This works because `bool` is a subclass of `int`:
```
>>> isinstance(True,int)
True
```
and `True`'s value is 1:
```
>>> True==1
True
```
However, as Joe Golton po... | This works, but adding `bool`s as `int`s may be dangerous. Please take this code with a grain of salt (maintainability goes first):
```
sum(k>0 for k in x)
``` |
2,900,084 | I have a list of integers and I need to count how many of them are > 0.
I'm currently doing it with a list comprehension that looks like this:
```
sum([1 for x in frequencies if x > 0])
```
It seems like a decent comprehension but I don't really like the "1"; it seems like a bit of a magic number. Is there a more... | 2010/05/24 | [
"https://Stackoverflow.com/questions/2900084",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/122808/"
] | You could use `len()` on the filtered list:
```
len([x for x in frequencies if x > 0])
``` | I would like to point out that all said applies to lists. If we have a numpy array,
there are solutions that will be at least *fourty* times faster...
Summing up all solutions given and testing for efficiency, plus adding some more (had to modify the reduce code to be able to run it in Python 3), note that the last an... |
2,900,084 | I have a list of integers and I need to count how many of them are > 0.
I'm currently doing it with a list comprehension that looks like this:
```
sum([1 for x in frequencies if x > 0])
```
It seems like a decent comprehension but I don't really like the "1"; it seems like a bit of a magic number. Is there a more... | 2010/05/24 | [
"https://Stackoverflow.com/questions/2900084",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/122808/"
] | If the array only contains elements >= 0 (i.e. all elements are either 0 or a positive integer) then you could just count the zeros and subtract this number form the length of the array:
```
len(arr) - arr.count(0)
``` | I would like to point out that all said applies to lists. If we have a numpy array,
there are solutions that will be at least *fourty* times faster...
Summing up all solutions given and testing for efficiency, plus adding some more (had to modify the reduce code to be able to run it in Python 3), note that the last an... |
2,900,084 | I have a list of integers and I need to count how many of them are > 0.
I'm currently doing it with a list comprehension that looks like this:
```
sum([1 for x in frequencies if x > 0])
```
It seems like a decent comprehension but I don't really like the "1"; it seems like a bit of a magic number. Is there a more... | 2010/05/24 | [
"https://Stackoverflow.com/questions/2900084",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/122808/"
] | If you want to reduce the amount of memory, you can avoid generating a temporary list by using a generator:
```
sum(x > 0 for x in frequencies)
```
This works because `bool` is a subclass of `int`:
```
>>> isinstance(True,int)
True
```
and `True`'s value is 1:
```
>>> True==1
True
```
However, as Joe Golton po... | You could use `len()` on the filtered list:
```
len([x for x in frequencies if x > 0])
``` |
2,900,084 | I have a list of integers and I need to count how many of them are > 0.
I'm currently doing it with a list comprehension that looks like this:
```
sum([1 for x in frequencies if x > 0])
```
It seems like a decent comprehension but I don't really like the "1"; it seems like a bit of a magic number. Is there a more... | 2010/05/24 | [
"https://Stackoverflow.com/questions/2900084",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/122808/"
] | If you want to reduce the amount of memory, you can avoid generating a temporary list by using a generator:
```
sum(x > 0 for x in frequencies)
```
This works because `bool` is a subclass of `int`:
```
>>> isinstance(True,int)
True
```
and `True`'s value is 1:
```
>>> True==1
True
```
However, as Joe Golton po... | A slightly more Pythonic way would be to use a generator instead:
```
sum(1 for x in frequencies if x > 0)
```
This avoids generating the whole list before calling `sum()`. |
2,900,084 | I have a list of integers and I need to count how many of them are > 0.
I'm currently doing it with a list comprehension that looks like this:
```
sum([1 for x in frequencies if x > 0])
```
It seems like a decent comprehension but I don't really like the "1"; it seems like a bit of a magic number. Is there a more... | 2010/05/24 | [
"https://Stackoverflow.com/questions/2900084",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/122808/"
] | If you want to reduce the amount of memory, you can avoid generating a temporary list by using a generator:
```
sum(x > 0 for x in frequencies)
```
This works because `bool` is a subclass of `int`:
```
>>> isinstance(True,int)
True
```
and `True`'s value is 1:
```
>>> True==1
True
```
However, as Joe Golton po... | I would like to point out that all said applies to lists. If we have a numpy array,
there are solutions that will be at least *fourty* times faster...
Summing up all solutions given and testing for efficiency, plus adding some more (had to modify the reduce code to be able to run it in Python 3), note that the last an... |
2,900,084 | I have a list of integers and I need to count how many of them are > 0.
I'm currently doing it with a list comprehension that looks like this:
```
sum([1 for x in frequencies if x > 0])
```
It seems like a decent comprehension but I don't really like the "1"; it seems like a bit of a magic number. Is there a more... | 2010/05/24 | [
"https://Stackoverflow.com/questions/2900084",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/122808/"
] | You could use `len()` on the filtered list:
```
len([x for x in frequencies if x > 0])
``` | If the array only contains elements >= 0 (i.e. all elements are either 0 or a positive integer) then you could just count the zeros and subtract this number form the length of the array:
```
len(arr) - arr.count(0)
``` |
2,900,084 | I have a list of integers and I need to count how many of them are > 0.
I'm currently doing it with a list comprehension that looks like this:
```
sum([1 for x in frequencies if x > 0])
```
It seems like a decent comprehension but I don't really like the "1"; it seems like a bit of a magic number. Is there a more... | 2010/05/24 | [
"https://Stackoverflow.com/questions/2900084",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/122808/"
] | A slightly more Pythonic way would be to use a generator instead:
```
sum(1 for x in frequencies if x > 0)
```
This avoids generating the whole list before calling `sum()`. | How about this?
`reduce(lambda x, y: x+1 if y > 0 else x, frequencies)`
EDIT:
With inspiration from the accepted answer from @~unutbu:
`reduce(lambda x, y: x + (y > 0), frequencies)` |
2,900,084 | I have a list of integers and I need to count how many of them are > 0.
I'm currently doing it with a list comprehension that looks like this:
```
sum([1 for x in frequencies if x > 0])
```
It seems like a decent comprehension but I don't really like the "1"; it seems like a bit of a magic number. Is there a more... | 2010/05/24 | [
"https://Stackoverflow.com/questions/2900084",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/122808/"
] | If you want to reduce the amount of memory, you can avoid generating a temporary list by using a generator:
```
sum(x > 0 for x in frequencies)
```
This works because `bool` is a subclass of `int`:
```
>>> isinstance(True,int)
True
```
and `True`'s value is 1:
```
>>> True==1
True
```
However, as Joe Golton po... | How about this?
`reduce(lambda x, y: x+1 if y > 0 else x, frequencies)`
EDIT:
With inspiration from the accepted answer from @~unutbu:
`reduce(lambda x, y: x + (y > 0), frequencies)` |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.