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 |
|---|---|---|---|---|---|
47,965,797 | I am using a program called [`SlideSort`](https://github.com/iskana/SlideSort), which does not compile anymore on a recent Debian system using GCC 6.3.0. Instead, it throws the following error:
```
mstree.cpp:228:11: error: no match for ‘operator==’ (operand types are ‘std::ofstream {aka std::basic_ofstream<char>}’ an... | 2017/12/25 | [
"https://Stackoverflow.com/questions/47965797",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5309786/"
] | I do not know why this code ever worked. In no version of the C++ standard is a scalar stream object comparable to an integer *or* to `nullptr_t`. That being said, your question is not how to fix the code you've found but how to bypass the error. **I do not recommend doing what I'm about to say here in production code.... | Without knowing the rest of the code, you can just try to rephrase that line such as:
if(!dFile)
See what happens next. |
47,965,797 | I am using a program called [`SlideSort`](https://github.com/iskana/SlideSort), which does not compile anymore on a recent Debian system using GCC 6.3.0. Instead, it throws the following error:
```
mstree.cpp:228:11: error: no match for ‘operator==’ (operand types are ‘std::ofstream {aka std::basic_ofstream<char>}’ an... | 2017/12/25 | [
"https://Stackoverflow.com/questions/47965797",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5309786/"
] | My guess is this (`if(dFile==NULL){`) if condition is trying to check whether a file was open successfully for writing, if so you use function `is_open` which is available in c++. So simply replace the condition by `if (dFile.is_open())`. This should do the trick. | Without knowing the rest of the code, you can just try to rephrase that line such as:
if(!dFile)
See what happens next. |
47,965,797 | I am using a program called [`SlideSort`](https://github.com/iskana/SlideSort), which does not compile anymore on a recent Debian system using GCC 6.3.0. Instead, it throws the following error:
```
mstree.cpp:228:11: error: no match for ‘operator==’ (operand types are ‘std::ofstream {aka std::basic_ofstream<char>}’ an... | 2017/12/25 | [
"https://Stackoverflow.com/questions/47965797",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5309786/"
] | In C++ 98 the streams used to have an `operator void*()` to check the stream state. It returned a null pointer when the stream was in an error state. Turned out that this implicit conversion caused some unexpected results when accidentally invoked in odd places.
So in C++11, which gained explicit operators, it was tur... | Without knowing the rest of the code, you can just try to rephrase that line such as:
if(!dFile)
See what happens next. |
47,965,797 | I am using a program called [`SlideSort`](https://github.com/iskana/SlideSort), which does not compile anymore on a recent Debian system using GCC 6.3.0. Instead, it throws the following error:
```
mstree.cpp:228:11: error: no match for ‘operator==’ (operand types are ‘std::ofstream {aka std::basic_ofstream<char>}’ an... | 2017/12/25 | [
"https://Stackoverflow.com/questions/47965797",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5309786/"
] | In C++ 98 the streams used to have an `operator void*()` to check the stream state. It returned a null pointer when the stream was in an error state. Turned out that this implicit conversion caused some unexpected results when accidentally invoked in odd places.
So in C++11, which gained explicit operators, it was tur... | I do not know why this code ever worked. In no version of the C++ standard is a scalar stream object comparable to an integer *or* to `nullptr_t`. That being said, your question is not how to fix the code you've found but how to bypass the error. **I do not recommend doing what I'm about to say here in production code.... |
47,965,797 | I am using a program called [`SlideSort`](https://github.com/iskana/SlideSort), which does not compile anymore on a recent Debian system using GCC 6.3.0. Instead, it throws the following error:
```
mstree.cpp:228:11: error: no match for ‘operator==’ (operand types are ‘std::ofstream {aka std::basic_ofstream<char>}’ an... | 2017/12/25 | [
"https://Stackoverflow.com/questions/47965797",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5309786/"
] | In C++ 98 the streams used to have an `operator void*()` to check the stream state. It returned a null pointer when the stream was in an error state. Turned out that this implicit conversion caused some unexpected results when accidentally invoked in odd places.
So in C++11, which gained explicit operators, it was tur... | My guess is this (`if(dFile==NULL){`) if condition is trying to check whether a file was open successfully for writing, if so you use function `is_open` which is available in c++. So simply replace the condition by `if (dFile.is_open())`. This should do the trick. |
3,698,733 | >
> **Theorem.** If two figures are similar and have the same orientation then there exists a homothecy that takes one of them into the other.
>
>
>
I see this result is being used pretty often in problems involving homothecy, but I don't know how to prove it. I know the reciprocal is true. If we have two figures ... | 2020/05/30 | [
"https://math.stackexchange.com/questions/3698733",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/463062/"
] | Let's assume that the two figures aren't congruent (the "center" of the homothety will be at infinity).
Let's call the corresponding points on the two figures $A$ and $A'$. Firstly, let's prove the theorem is true for triangles.
>
> **Theorem:** If two triangles $ABC$ and $A'B'C'$ are similar with ratio $r$ with the... | You can just join two pairs of corresponding points. The obtained lines meet at the center of homothety. If they are parallel, your center is located at infinity. |
3,153,400 | if all Styles and Converters are stored in shared resource dictionary file (styles.xaml), and this file is used from various windows.
Is it possible, to pass a parameter to that file, and propagate that parameter to the converters?
I am looking for a way to pass a *"origin"* type parameter, so that the converters c... | 2010/06/30 | [
"https://Stackoverflow.com/questions/3153400",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/349100/"
] | It doesn't make a difference in this case, because + is a special case that can apply to any number of arguments. Reduce is a way to apply a function that expects a fixed number of arguments (2) to an arbitrarily long list of arguments. | A bit late, but...
In this case, there is not a big difference. But in general they are not equivalent. Further more reduce can be more performant. Why?
reduce checks if a collection or type implements [IReduced](https://github.com/clojure/clojure/blob/clojure-1.10.1/src/clj/clojure/core.clj#L6810) interface. That me... |
3,153,400 | if all Styles and Converters are stored in shared resource dictionary file (styles.xaml), and this file is used from various windows.
Is it possible, to pass a parameter to that file, and propagate that parameter to the converters?
I am looking for a way to pass a *"origin"* type parameter, so that the converters c... | 2010/06/30 | [
"https://Stackoverflow.com/questions/3153400",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/349100/"
] | `reduce` and `apply` are of course only equivalent (in terms of the ultimate result returned) for associative functions which need to see all their arguments in the variable-arity case. When they are result-wise equivalent, I'd say that `apply` is always perfectly idiomatic, while `reduce` is equivalent -- and might sh... | For newbies looking at this answer,
be careful, they are not the same:
```
(apply hash-map [:a 5 :b 6])
;= {:a 5, :b 6}
(reduce hash-map [:a 5 :b 6])
;= {{{:a 5} :b} 6}
``` |
3,153,400 | if all Styles and Converters are stored in shared resource dictionary file (styles.xaml), and this file is used from various windows.
Is it possible, to pass a parameter to that file, and propagate that parameter to the converters?
I am looking for a way to pass a *"origin"* type parameter, so that the converters c... | 2010/06/30 | [
"https://Stackoverflow.com/questions/3153400",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/349100/"
] | For newbies looking at this answer,
be careful, they are not the same:
```
(apply hash-map [:a 5 :b 6])
;= {:a 5, :b 6}
(reduce hash-map [:a 5 :b 6])
;= {{{:a 5} :b} 6}
``` | Opinions vary- In the greater Lisp world, `reduce` is definitely considered more idiomatic. First, there is the variadic issues already discussed. Also, some Common Lisp compilers will actually fail when `apply` is applied against very long lists because of how they handle argument lists.
Amongst Clojurists in my circ... |
3,153,400 | if all Styles and Converters are stored in shared resource dictionary file (styles.xaml), and this file is used from various windows.
Is it possible, to pass a parameter to that file, and propagate that parameter to the converters?
I am looking for a way to pass a *"origin"* type parameter, so that the converters c... | 2010/06/30 | [
"https://Stackoverflow.com/questions/3153400",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/349100/"
] | I normally find myself preferring reduce when acting on any kind of collection - it performs well, and is a pretty useful function in general.
The main reason I would use apply is if the parameters mean different things in different positions, or if you have a couple of initial parameters but want to get the rest from... | When using a simple function like +, it really doesn't matter which one you use.
In general, the idea is that `reduce` is an accumulating operation. You present the current accumulation value and one new value to your accumulating function The result of the function is the cumulative value for the next iteration. So, ... |
3,153,400 | if all Styles and Converters are stored in shared resource dictionary file (styles.xaml), and this file is used from various windows.
Is it possible, to pass a parameter to that file, and propagate that parameter to the converters?
I am looking for a way to pass a *"origin"* type parameter, so that the converters c... | 2010/06/30 | [
"https://Stackoverflow.com/questions/3153400",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/349100/"
] | When using a simple function like +, it really doesn't matter which one you use.
In general, the idea is that `reduce` is an accumulating operation. You present the current accumulation value and one new value to your accumulating function The result of the function is the cumulative value for the next iteration. So, ... | The beauty of apply is given function (+ in this case) can be applied to argument list formed by pre-pending intervening arguments with an ending collection. Reduce is an abstraction to process collection items applying the function for each and doesn't work with variable args case.
```
(apply + 1 2 3 [3 4])
=> 13
(re... |
3,153,400 | if all Styles and Converters are stored in shared resource dictionary file (styles.xaml), and this file is used from various windows.
Is it possible, to pass a parameter to that file, and propagate that parameter to the converters?
I am looking for a way to pass a *"origin"* type parameter, so that the converters c... | 2010/06/30 | [
"https://Stackoverflow.com/questions/3153400",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/349100/"
] | Opinions vary- In the greater Lisp world, `reduce` is definitely considered more idiomatic. First, there is the variadic issues already discussed. Also, some Common Lisp compilers will actually fail when `apply` is applied against very long lists because of how they handle argument lists.
Amongst Clojurists in my circ... | A bit late, but...
In this case, there is not a big difference. But in general they are not equivalent. Further more reduce can be more performant. Why?
reduce checks if a collection or type implements [IReduced](https://github.com/clojure/clojure/blob/clojure-1.10.1/src/clj/clojure/core.clj#L6810) interface. That me... |
3,153,400 | if all Styles and Converters are stored in shared resource dictionary file (styles.xaml), and this file is used from various windows.
Is it possible, to pass a parameter to that file, and propagate that parameter to the converters?
I am looking for a way to pass a *"origin"* type parameter, so that the converters c... | 2010/06/30 | [
"https://Stackoverflow.com/questions/3153400",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/349100/"
] | `reduce` and `apply` are of course only equivalent (in terms of the ultimate result returned) for associative functions which need to see all their arguments in the variable-arity case. When they are result-wise equivalent, I'd say that `apply` is always perfectly idiomatic, while `reduce` is equivalent -- and might sh... | I normally find myself preferring reduce when acting on any kind of collection - it performs well, and is a pretty useful function in general.
The main reason I would use apply is if the parameters mean different things in different positions, or if you have a couple of initial parameters but want to get the rest from... |
3,153,400 | if all Styles and Converters are stored in shared resource dictionary file (styles.xaml), and this file is used from various windows.
Is it possible, to pass a parameter to that file, and propagate that parameter to the converters?
I am looking for a way to pass a *"origin"* type parameter, so that the converters c... | 2010/06/30 | [
"https://Stackoverflow.com/questions/3153400",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/349100/"
] | `reduce` and `apply` are of course only equivalent (in terms of the ultimate result returned) for associative functions which need to see all their arguments in the variable-arity case. When they are result-wise equivalent, I'd say that `apply` is always perfectly idiomatic, while `reduce` is equivalent -- and might sh... | The beauty of apply is given function (+ in this case) can be applied to argument list formed by pre-pending intervening arguments with an ending collection. Reduce is an abstraction to process collection items applying the function for each and doesn't work with variable args case.
```
(apply + 1 2 3 [3 4])
=> 13
(re... |
3,153,400 | if all Styles and Converters are stored in shared resource dictionary file (styles.xaml), and this file is used from various windows.
Is it possible, to pass a parameter to that file, and propagate that parameter to the converters?
I am looking for a way to pass a *"origin"* type parameter, so that the converters c... | 2010/06/30 | [
"https://Stackoverflow.com/questions/3153400",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/349100/"
] | For newbies looking at this answer,
be careful, they are not the same:
```
(apply hash-map [:a 5 :b 6])
;= {:a 5, :b 6}
(reduce hash-map [:a 5 :b 6])
;= {{{:a 5} :b} 6}
``` | When using a simple function like +, it really doesn't matter which one you use.
In general, the idea is that `reduce` is an accumulating operation. You present the current accumulation value and one new value to your accumulating function The result of the function is the cumulative value for the next iteration. So, ... |
3,153,400 | if all Styles and Converters are stored in shared resource dictionary file (styles.xaml), and this file is used from various windows.
Is it possible, to pass a parameter to that file, and propagate that parameter to the converters?
I am looking for a way to pass a *"origin"* type parameter, so that the converters c... | 2010/06/30 | [
"https://Stackoverflow.com/questions/3153400",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/349100/"
] | In this specific case I prefer `reduce` because it's more **readable**: when I read
```
(reduce + some-numbers)
```
I know immediately that you're turning a sequence into a value.
With `apply` I have to consider which function is being applied: "ah, it's the `+` function, so I'm getting... a single number". Slightl... | When using a simple function like +, it really doesn't matter which one you use.
In general, the idea is that `reduce` is an accumulating operation. You present the current accumulation value and one new value to your accumulating function The result of the function is the cumulative value for the next iteration. So, ... |
22,932 | I would like to include a file on every block but the last three. How can I accomplish this? | 2017/11/22 | [
"https://craftcms.stackexchange.com/questions/22932",
"https://craftcms.stackexchange.com",
"https://craftcms.stackexchange.com/users/7395/"
] | 95% of the time you see a 400 Bad Request error, it's because it's a CSRF token validation error (or you're just missing the token all-together).
Craft 3 has CSRF validation enabled by default.
Here's how to pass the CSRF token to your JS in Craft 2: <https://craftcms.com/support/csrf-protection#updating-your-javascr... | For Craft3 in JS you can use `var tokenInput = Craft.getCsrfInput();` to get the HTML input or `Craft.csrfTokenName` and `Craft.csrfTokenValue` for the Name and Value.
Then your post url should be
`<form method="post" action="actions/plugin/default/ajax-call" accept-charset="UTF-8">`
And finally in the controller... |
6,742,567 | I have a [jqGrid](http://www.trirand.com/jqgridwiki/doku.php) where I get data at once from server (java) in JSON format. I want the data in the jqGrid to be exported into Excel format.
Till now I saw this [page](http://www.trirand.net/documentation/php/_2v212tis2.htm) which gives me an error in IE `'o.url is null or ... | 2011/07/19 | [
"https://Stackoverflow.com/questions/6742567",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/707414/"
] | You don't have to export a file using the Excel format in order to get the data into Excel. It is generally much easier to export to `CSV`. `CSV` files should be associated with Excel by default, so it should have the Excel icon by it and everything. `XML` would work the same way, I think, but the `CSV` format is much ... | I'm working with MOSS 2007 to export some lists(say 5 lists) to excel.My requirement is i need more than one lists to be exported to excel.I have added a CEWP in my page with a button so that by one click i can export more than one list datas to excel.nw i get a run time error when i use jquery
if( $('#WebPartWPQ3').... |
6,742,567 | I have a [jqGrid](http://www.trirand.com/jqgridwiki/doku.php) where I get data at once from server (java) in JSON format. I want the data in the jqGrid to be exported into Excel format.
Till now I saw this [page](http://www.trirand.net/documentation/php/_2v212tis2.htm) which gives me an error in IE `'o.url is null or ... | 2011/07/19 | [
"https://Stackoverflow.com/questions/6742567",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/707414/"
] | You don't have to export a file using the Excel format in order to get the data into Excel. It is generally much easier to export to `CSV`. `CSV` files should be associated with Excel by default, so it should have the Excel icon by it and everything. `XML` would work the same way, I think, but the `CSV` format is much ... | >
> I have a jqGrid where I get data at once from server (java) in JSON
> format. I want the data in the jqGrid to be exported into Excel
> format.
>
>
>
Here's a nice article, showing you how to export from jqGrid to Excel...
<http://www.codeproject.com/Articles/784342/Export-data-from-jqGrid-into-a-real-Excel... |
6,742,567 | I have a [jqGrid](http://www.trirand.com/jqgridwiki/doku.php) where I get data at once from server (java) in JSON format. I want the data in the jqGrid to be exported into Excel format.
Till now I saw this [page](http://www.trirand.net/documentation/php/_2v212tis2.htm) which gives me an error in IE `'o.url is null or ... | 2011/07/19 | [
"https://Stackoverflow.com/questions/6742567",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/707414/"
] | You don't have to export a file using the Excel format in order to get the data into Excel. It is generally much easier to export to `CSV`. `CSV` files should be associated with Excel by default, so it should have the Excel icon by it and everything. `XML` would work the same way, I think, but the `CSV` format is much ... | I solved this like this:
1. **Read**
<https://w3lessons.info/2015/07/13/export-html-table-to-excel-csv-json-pdf-png-using-jquery/#Installation>
2. Here is **github**
<https://github.com/kayalshri/tableExport.jquery.plugin>
3. Here is a **demo**
<http://demos.w3lessons.info/jquery-table-export#>
It works perfectl... |
6,742,567 | I have a [jqGrid](http://www.trirand.com/jqgridwiki/doku.php) where I get data at once from server (java) in JSON format. I want the data in the jqGrid to be exported into Excel format.
Till now I saw this [page](http://www.trirand.net/documentation/php/_2v212tis2.htm) which gives me an error in IE `'o.url is null or ... | 2011/07/19 | [
"https://Stackoverflow.com/questions/6742567",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/707414/"
] | >
> I have a jqGrid where I get data at once from server (java) in JSON
> format. I want the data in the jqGrid to be exported into Excel
> format.
>
>
>
Here's a nice article, showing you how to export from jqGrid to Excel...
<http://www.codeproject.com/Articles/784342/Export-data-from-jqGrid-into-a-real-Excel... | I'm working with MOSS 2007 to export some lists(say 5 lists) to excel.My requirement is i need more than one lists to be exported to excel.I have added a CEWP in my page with a button so that by one click i can export more than one list datas to excel.nw i get a run time error when i use jquery
if( $('#WebPartWPQ3').... |
6,742,567 | I have a [jqGrid](http://www.trirand.com/jqgridwiki/doku.php) where I get data at once from server (java) in JSON format. I want the data in the jqGrid to be exported into Excel format.
Till now I saw this [page](http://www.trirand.net/documentation/php/_2v212tis2.htm) which gives me an error in IE `'o.url is null or ... | 2011/07/19 | [
"https://Stackoverflow.com/questions/6742567",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/707414/"
] | I solved this like this:
1. **Read**
<https://w3lessons.info/2015/07/13/export-html-table-to-excel-csv-json-pdf-png-using-jquery/#Installation>
2. Here is **github**
<https://github.com/kayalshri/tableExport.jquery.plugin>
3. Here is a **demo**
<http://demos.w3lessons.info/jquery-table-export#>
It works perfectl... | I'm working with MOSS 2007 to export some lists(say 5 lists) to excel.My requirement is i need more than one lists to be exported to excel.I have added a CEWP in my page with a button so that by one click i can export more than one list datas to excel.nw i get a run time error when i use jquery
if( $('#WebPartWPQ3').... |
10,393,457 | I took out my arduino chip from my board and followed the instructions to put it on a breadboard here: <http://itp.nyu.edu/physcomp/uploads/arduinobb_09.jpg>
Everything works fine but when I plug in an XBee, the code doesnt work the way it should.
The code I was using was two simple statements in the `setup()` functio... | 2012/05/01 | [
"https://Stackoverflow.com/questions/10393457",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/986955/"
] | The likely explanation as to why `setup()` is being executed continually is that the chip is being repeatedly reset. This is likely to be related to the low voltage you are seeing. | Yea sorry about this guys. I finally figured out the problem. The batteries I was using were not delivering enough current and power to supply both the arduino and xbee. The thing is, since the batteries were cheap, they ran out really quick of charge and I thought that it was a problem. Better batteries were the solut... |
1,156,915 | I have to find all the unit vectors that are orthogonal to the vectors $\overrightarrow{a}=(2, -4, 3), \overrightarrow{b}=(-4, 8, -6)$ .
I calculated that the cross product $\overrightarrow{a} \times \overrightarrow{b}=0$.
Does this mean that the vector $(0, 0, 0)$ is a unit vector that is perpendicular to $\overri... | 2015/02/20 | [
"https://math.stackexchange.com/questions/1156915",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/80708/"
] | Given two sequences $x\_n$ and $y\_n$, we have the relation
$$
x\_n\leq y\_n\Rightarrow \sum\_n x\_n\leq \sum\_n y\_n.
$$
Therefore, if we set $x\_n=\sum^{\infty}\_{j=1}|I\_{n\_j}|$ and $y\_n=\frac{\epsilon }{2^n}$, applying the above gives
$$
\sum\_n\sum^{\infty}\_{j=1}|I\_{n\_j}|<\sum\_n\frac{\epsilon}{2^n}
$$ | Equalities and inequalities with series of series are preserved under exchanging order of summation indices and also taking inner limits before outer limits, vs. summing all the terms in any order you want, so long as the series are either all positive or all negative terms. Thus you don't have to worry about the doubl... |
1,156,915 | I have to find all the unit vectors that are orthogonal to the vectors $\overrightarrow{a}=(2, -4, 3), \overrightarrow{b}=(-4, 8, -6)$ .
I calculated that the cross product $\overrightarrow{a} \times \overrightarrow{b}=0$.
Does this mean that the vector $(0, 0, 0)$ is a unit vector that is perpendicular to $\overri... | 2015/02/20 | [
"https://math.stackexchange.com/questions/1156915",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/80708/"
] | We're exploiting Zeno's Paradox. Since each set has measure $0$, we can cover it by intervals whose total length is less than any positive real number. Since the union is countable, we can enumerate our sets of measure $0$ as $\{I\_1, I\_2, I\_3, \ldots, \}$. Let $\mu(S) = (b-a)$ for $S=(a,b)$.
Let $\epsilon > 0$. Let... | Equalities and inequalities with series of series are preserved under exchanging order of summation indices and also taking inner limits before outer limits, vs. summing all the terms in any order you want, so long as the series are either all positive or all negative terms. Thus you don't have to worry about the doubl... |
1,156,915 | I have to find all the unit vectors that are orthogonal to the vectors $\overrightarrow{a}=(2, -4, 3), \overrightarrow{b}=(-4, 8, -6)$ .
I calculated that the cross product $\overrightarrow{a} \times \overrightarrow{b}=0$.
Does this mean that the vector $(0, 0, 0)$ is a unit vector that is perpendicular to $\overri... | 2015/02/20 | [
"https://math.stackexchange.com/questions/1156915",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/80708/"
] | That's just how measures work. We start by defining that the measure of an open interval $(a,b)$ is $b-a$. Then we can attempt to define the (outer) measure of an arbitrary set $A$ as the infimum of all $\sum\_{i\in J}\mu(I\_i)$ where the $I\_j$ are open intervals and $A\subseteq \bigcup\_{i\in J}I\_i$.
A few observati... | Equalities and inequalities with series of series are preserved under exchanging order of summation indices and also taking inner limits before outer limits, vs. summing all the terms in any order you want, so long as the series are either all positive or all negative terms. Thus you don't have to worry about the doubl... |
146,274 | So I have a bunch of database users who should be able to execute a procedure with a call to xp\_cmdshell. They are not windows domain accounts, they are just sql-server logins. I want to do it using a proxy `##xp_cmdshell_proxy_account##`. I am aware of security threats that it may bring. I cannot use 'WITH EXECUTE AS... | 2016/08/09 | [
"https://dba.stackexchange.com/questions/146274",
"https://dba.stackexchange.com",
"https://dba.stackexchange.com/users/88793/"
] | It appears you need to grant access to xp\_cmdshell for your sql server login. Once the user has permission to run xp\_cmdshell, it will use your proxy account to run it since it is a non-privileged user.
Another alternative would be to use certificates to sign your stored procedures, allowing you to grant additional... | The question is: what exactly are you using `xp_cmdshell` for? Is it to run a random program, or get a directory listing, or something else? You seem to be avoiding SQLCLR but you don't say why. In many cases, SQLCLR is more secure and more efficient. But it is not possible to be more specific unless additional details... |
146,274 | So I have a bunch of database users who should be able to execute a procedure with a call to xp\_cmdshell. They are not windows domain accounts, they are just sql-server logins. I want to do it using a proxy `##xp_cmdshell_proxy_account##`. I am aware of security threats that it may bring. I cannot use 'WITH EXECUTE AS... | 2016/08/09 | [
"https://dba.stackexchange.com/questions/146274",
"https://dba.stackexchange.com",
"https://dba.stackexchange.com/users/88793/"
] | You can use a SQL Server login.
The following procedure is explained in [MSDN](https://msdn.microsoft.com/en-us/library/ms175046(v=sql.110).aspx):
>
> To allow non-administrators to use xp\_cmdshell, and allow SQL Server
> to create child processes with the security token of a less-privileged
> account, follow the... | The question is: what exactly are you using `xp_cmdshell` for? Is it to run a random program, or get a directory listing, or something else? You seem to be avoiding SQLCLR but you don't say why. In many cases, SQLCLR is more secure and more efficient. But it is not possible to be more specific unless additional details... |
2,581,664 | I have two fields that need to multiply each other and fill a third form's value. Here's the HTML:
```
<input type="text" name="estimate[concrete][price]" value="" onBlur="calc_concreteprice(document.forms.mainform);" />
per SF <strong>times</strong>
<input type="text" name="estimate[concrete][sqft]" value="" on... | 2010/04/05 | [
"https://Stackoverflow.com/questions/2581664",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/60318/"
] | When you write things like `mainform.estimate[concrete][quick_total].value`, it's attempting to access properties called `concrete` and `quick_total`. Try using this format instead to distinguish between a property and a string containing square brackets:
`mainform['estimate[concrete][quick_total]'].value` | I'm pretty sure it's the square brackets. Try changing your names on your input fields. If you want definite separation between the names to show some sort of hierarchy, try using underscores like `<input type="text" name="estimate_concrete_price" />`.
In your javascript change it to `mainform.estimate_concrete_price... |
58,992,027 | I have a table with clients and I need to show the first country of each client like a default country.
```
Table Clients
ID_Client | Name_Client
1 | Mike
2 | Jon
3 | Ben
Table Countries
ID_Country | ID_Client | Name_Country
1 | 1 | France
2 | 1 | USA
3 ... | 2019/11/22 | [
"https://Stackoverflow.com/questions/58992027",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6538386/"
] | You can use Outer APPLY or CROSS APPLY as per Below example,
```
SELECT C.Name_Client + ' - ' + V.Name_Country
FROM Clients C
OUTER APPLY(
SELECT TOP 1 * FROM Countries CO WHERE CO.ID_Client = C.ID_Client
ORDER BY ID_Country
) V
``` | [SQL Fiddle](http://sqlfiddle.com/#!18/2ee07/7)
**MS SQL Server 2017 Schema Setup**:
```
CREATE TABLE CLIENTS (ID_Client int,Name_Client varchar(255))
CREATE TABLE COUNTRIES(ID_Country int,ID_Client int,Name_Country varchar(255))
INSERT INTO CLIENTS(ID_Client,Name_Client)VALUES(1,'Mike'),(2,'Jon'),(3,'Ben')
INSERT I... |
58,992,027 | I have a table with clients and I need to show the first country of each client like a default country.
```
Table Clients
ID_Client | Name_Client
1 | Mike
2 | Jon
3 | Ben
Table Countries
ID_Country | ID_Client | Name_Country
1 | 1 | France
2 | 1 | USA
3 ... | 2019/11/22 | [
"https://Stackoverflow.com/questions/58992027",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6538386/"
] | Your sub-query isn't correlated, try to use `APPLY` :
```
SELECT c.Name_Client, cn.Name_Country
FROM Clients C OUTER APPLY
(SELECT TOP (1) cn.Name_Country
From Countries CN
WHERE cn.ID_Client = c.ID_Client
ORDER BY cn.ID_Country
) cn;
``` | use row\_number()
```
with cte as
( select c.Name_Client, cn.Name_Country,
row_number() over(partition by c.ID_Client order by ID_Country) rn clients c join country cn on c.client_id=cn.client_id
) select * form cte where rn=1
``` |
58,992,027 | I have a table with clients and I need to show the first country of each client like a default country.
```
Table Clients
ID_Client | Name_Client
1 | Mike
2 | Jon
3 | Ben
Table Countries
ID_Country | ID_Client | Name_Country
1 | 1 | France
2 | 1 | USA
3 ... | 2019/11/22 | [
"https://Stackoverflow.com/questions/58992027",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6538386/"
] | You can use Outer APPLY or CROSS APPLY as per Below example,
```
SELECT C.Name_Client + ' - ' + V.Name_Country
FROM Clients C
OUTER APPLY(
SELECT TOP 1 * FROM Countries CO WHERE CO.ID_Client = C.ID_Client
ORDER BY ID_Country
) V
``` | use row\_number()
```
with cte as
( select c.Name_Client, cn.Name_Country,
row_number() over(partition by c.ID_Client order by ID_Country) rn clients c join country cn on c.client_id=cn.client_id
) select * form cte where rn=1
``` |
58,992,027 | I have a table with clients and I need to show the first country of each client like a default country.
```
Table Clients
ID_Client | Name_Client
1 | Mike
2 | Jon
3 | Ben
Table Countries
ID_Country | ID_Client | Name_Country
1 | 1 | France
2 | 1 | USA
3 ... | 2019/11/22 | [
"https://Stackoverflow.com/questions/58992027",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6538386/"
] | Your sub-query isn't correlated, try to use `APPLY` :
```
SELECT c.Name_Client, cn.Name_Country
FROM Clients C OUTER APPLY
(SELECT TOP (1) cn.Name_Country
From Countries CN
WHERE cn.ID_Client = c.ID_Client
ORDER BY cn.ID_Country
) cn;
``` | [SQL Fiddle](http://sqlfiddle.com/#!18/2ee07/7)
**MS SQL Server 2017 Schema Setup**:
```
CREATE TABLE CLIENTS (ID_Client int,Name_Client varchar(255))
CREATE TABLE COUNTRIES(ID_Country int,ID_Client int,Name_Country varchar(255))
INSERT INTO CLIENTS(ID_Client,Name_Client)VALUES(1,'Mike'),(2,'Jon'),(3,'Ben')
INSERT I... |
58,992,027 | I have a table with clients and I need to show the first country of each client like a default country.
```
Table Clients
ID_Client | Name_Client
1 | Mike
2 | Jon
3 | Ben
Table Countries
ID_Country | ID_Client | Name_Country
1 | 1 | France
2 | 1 | USA
3 ... | 2019/11/22 | [
"https://Stackoverflow.com/questions/58992027",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6538386/"
] | [SQL Fiddle](http://sqlfiddle.com/#!18/2ee07/7)
**MS SQL Server 2017 Schema Setup**:
```
CREATE TABLE CLIENTS (ID_Client int,Name_Client varchar(255))
CREATE TABLE COUNTRIES(ID_Country int,ID_Client int,Name_Country varchar(255))
INSERT INTO CLIENTS(ID_Client,Name_Client)VALUES(1,'Mike'),(2,'Jon'),(3,'Ben')
INSERT I... | You can try this
```
SELECT * FROM (
SELECT Name_Client, Name_Country ,
RwNumbr = ROW_NUMBER() OVER(PARTITION by c.ID_Client order by cl.ID_Country)
from CLIENTS c
JOIN COUNTRIES cl
ON cl.ID_Client = c.ID_Client
) as f
WHERE f.RwNumbr = 1
``` |
58,992,027 | I have a table with clients and I need to show the first country of each client like a default country.
```
Table Clients
ID_Client | Name_Client
1 | Mike
2 | Jon
3 | Ben
Table Countries
ID_Country | ID_Client | Name_Country
1 | 1 | France
2 | 1 | USA
3 ... | 2019/11/22 | [
"https://Stackoverflow.com/questions/58992027",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6538386/"
] | You can use Outer APPLY or CROSS APPLY as per Below example,
```
SELECT C.Name_Client + ' - ' + V.Name_Country
FROM Clients C
OUTER APPLY(
SELECT TOP 1 * FROM Countries CO WHERE CO.ID_Client = C.ID_Client
ORDER BY ID_Country
) V
``` | You can use common table expression and filter on the row number partitioned by the id\_client. Like this the row\_number is incremented until a new id\_client is found.
```
WITH cte_countries AS(
SELECT ROW_NUMBER() OVER (PARTITION BY ID_Client ORDER BY ID_Client) AS Row#,
Countries.*
FROM Countries)
SELECT * FROM Cl... |
58,992,027 | I have a table with clients and I need to show the first country of each client like a default country.
```
Table Clients
ID_Client | Name_Client
1 | Mike
2 | Jon
3 | Ben
Table Countries
ID_Country | ID_Client | Name_Country
1 | 1 | France
2 | 1 | USA
3 ... | 2019/11/22 | [
"https://Stackoverflow.com/questions/58992027",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6538386/"
] | You can use Outer APPLY or CROSS APPLY as per Below example,
```
SELECT C.Name_Client + ' - ' + V.Name_Country
FROM Clients C
OUTER APPLY(
SELECT TOP 1 * FROM Countries CO WHERE CO.ID_Client = C.ID_Client
ORDER BY ID_Country
) V
``` | You can try this
```
SELECT * FROM (
SELECT Name_Client, Name_Country ,
RwNumbr = ROW_NUMBER() OVER(PARTITION by c.ID_Client order by cl.ID_Country)
from CLIENTS c
JOIN COUNTRIES cl
ON cl.ID_Client = c.ID_Client
) as f
WHERE f.RwNumbr = 1
``` |
58,992,027 | I have a table with clients and I need to show the first country of each client like a default country.
```
Table Clients
ID_Client | Name_Client
1 | Mike
2 | Jon
3 | Ben
Table Countries
ID_Country | ID_Client | Name_Country
1 | 1 | France
2 | 1 | USA
3 ... | 2019/11/22 | [
"https://Stackoverflow.com/questions/58992027",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6538386/"
] | [SQL Fiddle](http://sqlfiddle.com/#!18/2ee07/7)
**MS SQL Server 2017 Schema Setup**:
```
CREATE TABLE CLIENTS (ID_Client int,Name_Client varchar(255))
CREATE TABLE COUNTRIES(ID_Country int,ID_Client int,Name_Country varchar(255))
INSERT INTO CLIENTS(ID_Client,Name_Client)VALUES(1,'Mike'),(2,'Jon'),(3,'Ben')
INSERT I... | You can use common table expression and filter on the row number partitioned by the id\_client. Like this the row\_number is incremented until a new id\_client is found.
```
WITH cte_countries AS(
SELECT ROW_NUMBER() OVER (PARTITION BY ID_Client ORDER BY ID_Client) AS Row#,
Countries.*
FROM Countries)
SELECT * FROM Cl... |
58,992,027 | I have a table with clients and I need to show the first country of each client like a default country.
```
Table Clients
ID_Client | Name_Client
1 | Mike
2 | Jon
3 | Ben
Table Countries
ID_Country | ID_Client | Name_Country
1 | 1 | France
2 | 1 | USA
3 ... | 2019/11/22 | [
"https://Stackoverflow.com/questions/58992027",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6538386/"
] | Your sub-query isn't correlated, try to use `APPLY` :
```
SELECT c.Name_Client, cn.Name_Country
FROM Clients C OUTER APPLY
(SELECT TOP (1) cn.Name_Country
From Countries CN
WHERE cn.ID_Client = c.ID_Client
ORDER BY cn.ID_Country
) cn;
``` | You can use Outer APPLY or CROSS APPLY as per Below example,
```
SELECT C.Name_Client + ' - ' + V.Name_Country
FROM Clients C
OUTER APPLY(
SELECT TOP 1 * FROM Countries CO WHERE CO.ID_Client = C.ID_Client
ORDER BY ID_Country
) V
``` |
58,992,027 | I have a table with clients and I need to show the first country of each client like a default country.
```
Table Clients
ID_Client | Name_Client
1 | Mike
2 | Jon
3 | Ben
Table Countries
ID_Country | ID_Client | Name_Country
1 | 1 | France
2 | 1 | USA
3 ... | 2019/11/22 | [
"https://Stackoverflow.com/questions/58992027",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6538386/"
] | Your sub-query isn't correlated, try to use `APPLY` :
```
SELECT c.Name_Client, cn.Name_Country
FROM Clients C OUTER APPLY
(SELECT TOP (1) cn.Name_Country
From Countries CN
WHERE cn.ID_Client = c.ID_Client
ORDER BY cn.ID_Country
) cn;
``` | Rather than having a nested query like this try this instead.
```
SELECT clients.Name_Client, countries.Name_Country
FROM Clients clients
LEFT JOIN Countries countries on countries.ID_Client = clients.ID_Client
```
By performing the join you are matching the record and not having a subquery go off and get a bucket... |
2,890,172 | I am planning to build a JS based twitter client. Information about libraries/clients is pretty old on other SO Questions. I was wondering if anyone has come across wrappers other than Spaz and TwitterHelper.
Addition : Please note this will be client app which I also plan to run on mobiles using phonegap.
Thanks :-... | 2010/05/22 | [
"https://Stackoverflow.com/questions/2890172",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/304673/"
] | [SQLyog's](http://www.webyog.com) [HTTP Tunnel](http://gist.github.com/410502) is a very decent one.
 | try use HTTPtunnel GNU. here example [connection to MySQL using HTTPtunnel GNU.](http://mysql-tools.com/en/articles/http-tunnel/73-heidisql-a-http-tunnel.html) |
2,890,172 | I am planning to build a JS based twitter client. Information about libraries/clients is pretty old on other SO Questions. I was wondering if anyone has come across wrappers other than Spaz and TwitterHelper.
Addition : Please note this will be client app which I also plan to run on mobiles using phonegap.
Thanks :-... | 2010/05/22 | [
"https://Stackoverflow.com/questions/2890172",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/304673/"
] | [SQLyog's](http://www.webyog.com) [HTTP Tunnel](http://gist.github.com/410502) is a very decent one.
 | You can use TCP/IP over SSH from within MySQL Workbench and SQLyog without the need for PHP tunnelling script if you have SSH access to you server.
I have had customer sites on shared hosts where this doesn't work due to server configuration which is out of my control. I have overcome this restriction via SSH tunnelli... |
2,890,172 | I am planning to build a JS based twitter client. Information about libraries/clients is pretty old on other SO Questions. I was wondering if anyone has come across wrappers other than Spaz and TwitterHelper.
Addition : Please note this will be client app which I also plan to run on mobiles using phonegap.
Thanks :-... | 2010/05/22 | [
"https://Stackoverflow.com/questions/2890172",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/304673/"
] | [SQLyog's](http://www.webyog.com) [HTTP Tunnel](http://gist.github.com/410502) is a very decent one.
 | I have build a `MySQLTunnel` script in `PHP`, and put it in sourceforge. You can download it and try. It supports:
>
> * HTTP Tunneling to MySQL
> * JSON Resultset
> * On-demand compression to preserve bandwidth
> * On-demand encryption using AES-128 or AES-256 to preserve secure data
> and password
> * Supports bot... |
2,890,172 | I am planning to build a JS based twitter client. Information about libraries/clients is pretty old on other SO Questions. I was wondering if anyone has come across wrappers other than Spaz and TwitterHelper.
Addition : Please note this will be client app which I also plan to run on mobiles using phonegap.
Thanks :-... | 2010/05/22 | [
"https://Stackoverflow.com/questions/2890172",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/304673/"
] | You can use TCP/IP over SSH from within MySQL Workbench and SQLyog without the need for PHP tunnelling script if you have SSH access to you server.
I have had customer sites on shared hosts where this doesn't work due to server configuration which is out of my control. I have overcome this restriction via SSH tunnelli... | try use HTTPtunnel GNU. here example [connection to MySQL using HTTPtunnel GNU.](http://mysql-tools.com/en/articles/http-tunnel/73-heidisql-a-http-tunnel.html) |
2,890,172 | I am planning to build a JS based twitter client. Information about libraries/clients is pretty old on other SO Questions. I was wondering if anyone has come across wrappers other than Spaz and TwitterHelper.
Addition : Please note this will be client app which I also plan to run on mobiles using phonegap.
Thanks :-... | 2010/05/22 | [
"https://Stackoverflow.com/questions/2890172",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/304673/"
] | try use HTTPtunnel GNU. here example [connection to MySQL using HTTPtunnel GNU.](http://mysql-tools.com/en/articles/http-tunnel/73-heidisql-a-http-tunnel.html) | I have build a `MySQLTunnel` script in `PHP`, and put it in sourceforge. You can download it and try. It supports:
>
> * HTTP Tunneling to MySQL
> * JSON Resultset
> * On-demand compression to preserve bandwidth
> * On-demand encryption using AES-128 or AES-256 to preserve secure data
> and password
> * Supports bot... |
2,890,172 | I am planning to build a JS based twitter client. Information about libraries/clients is pretty old on other SO Questions. I was wondering if anyone has come across wrappers other than Spaz and TwitterHelper.
Addition : Please note this will be client app which I also plan to run on mobiles using phonegap.
Thanks :-... | 2010/05/22 | [
"https://Stackoverflow.com/questions/2890172",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/304673/"
] | You can use TCP/IP over SSH from within MySQL Workbench and SQLyog without the need for PHP tunnelling script if you have SSH access to you server.
I have had customer sites on shared hosts where this doesn't work due to server configuration which is out of my control. I have overcome this restriction via SSH tunnelli... | I have build a `MySQLTunnel` script in `PHP`, and put it in sourceforge. You can download it and try. It supports:
>
> * HTTP Tunneling to MySQL
> * JSON Resultset
> * On-demand compression to preserve bandwidth
> * On-demand encryption using AES-128 or AES-256 to preserve secure data
> and password
> * Supports bot... |
68,059,041 | I want make the same text of text1 appear in each line of text2
```
<script type="text/javascript">
$("#btn").click(function(){
var text1 = $('#text1').val();
var text2 = $('#text2').val();
$('#text3').val(text2+text1);
});
</script>
``` | 2021/06/20 | [
"https://Stackoverflow.com/questions/68059041",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16275160/"
] | Since these are the only numbers in the string, you can pull them out with a short regex:
```
import re
s = 'mouse_position = "Point(x=535, y=415)"'
[int(n) for n in re.findall(r'\d+', s)]
# [535, 415]
```
This basically says, find all strings that are made of 1 or more digits. Note, that you will need to determin... | Another approach with `slicing`:
```py
s = 'mouse_position = "Point(x=535, y=415)"'
x_s=s.index('x=')+2
x_e=s.index(',')
x = int(s[x_s:x_e])
y_s=s.index('y=')+2
y_e=s.index(')')
y = int(s[y_s:y_e])
#print(f"{x=}, {y=}")
print(x)#535
print(y)#415
``` |
68,059,041 | I want make the same text of text1 appear in each line of text2
```
<script type="text/javascript">
$("#btn").click(function(){
var text1 = $('#text1').val();
var text2 = $('#text2').val();
$('#text3').val(text2+text1);
});
</script>
``` | 2021/06/20 | [
"https://Stackoverflow.com/questions/68059041",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16275160/"
] | Since these are the only numbers in the string, you can pull them out with a short regex:
```
import re
s = 'mouse_position = "Point(x=535, y=415)"'
[int(n) for n in re.findall(r'\d+', s)]
# [535, 415]
```
This basically says, find all strings that are made of 1 or more digits. Note, that you will need to determin... | This is probably the least python-like code, but it is easy to understand and works really well and extremally fast
```
import pyautogui
import numpy as np
while True:
original_string = str(pyautogui.position()) #getting the position of mouse
characters_to_remove = "Point()xy=,:[]''" #characters you want to r... |
68,059,041 | I want make the same text of text1 appear in each line of text2
```
<script type="text/javascript">
$("#btn").click(function(){
var text1 = $('#text1').val();
var text2 = $('#text2').val();
$('#text3').val(text2+text1);
});
</script>
``` | 2021/06/20 | [
"https://Stackoverflow.com/questions/68059041",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16275160/"
] | You could always pull out the really big gun of text extraction. Regular expressions:
```
import re
mouse_position = "Point(x=535, y=415)"
d = re.match("Point\(x=(?P<x>\d+), y=(?P<y>\d+)\)",mouse_position).groupdict()
```
`d` is now :
```
{'x': '535', 'y': '415'}
``` | Another approach with `slicing`:
```py
s = 'mouse_position = "Point(x=535, y=415)"'
x_s=s.index('x=')+2
x_e=s.index(',')
x = int(s[x_s:x_e])
y_s=s.index('y=')+2
y_e=s.index(')')
y = int(s[y_s:y_e])
#print(f"{x=}, {y=}")
print(x)#535
print(y)#415
``` |
68,059,041 | I want make the same text of text1 appear in each line of text2
```
<script type="text/javascript">
$("#btn").click(function(){
var text1 = $('#text1').val();
var text2 = $('#text2').val();
$('#text3').val(text2+text1);
});
</script>
``` | 2021/06/20 | [
"https://Stackoverflow.com/questions/68059041",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16275160/"
] | You could always pull out the really big gun of text extraction. Regular expressions:
```
import re
mouse_position = "Point(x=535, y=415)"
d = re.match("Point\(x=(?P<x>\d+), y=(?P<y>\d+)\)",mouse_position).groupdict()
```
`d` is now :
```
{'x': '535', 'y': '415'}
``` | This is probably the least python-like code, but it is easy to understand and works really well and extremally fast
```
import pyautogui
import numpy as np
while True:
original_string = str(pyautogui.position()) #getting the position of mouse
characters_to_remove = "Point()xy=,:[]''" #characters you want to r... |
1,772,652 | I like the 'Recent Activity' effect on <http://foursquare.com/>. The top activity pushing all beneath. Is there a JQuery plugin or widget I can readily use which does the same?
(I am a lazy developer so please no 'you can develop this yourself' responses) | 2009/11/20 | [
"https://Stackoverflow.com/questions/1772652",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/129001/"
] | Is there a reason you can't use [simplexml](http://www.php.net/manual/en/book.simplexml.php)?
```
$xml = simplexml_load_file('http://www.supashare.net/test.xml');
$result = $xml->xpath('/XML/RESULTS/LISTING/REDIRECT');
echo $result[0];
``` | ```
$xml = stream_get_contents($fp);
$xml = new SimpleXMLElement($xml);
echo $xml->RESULTS->LISTING->REDIRECT;
``` |
1,772,652 | I like the 'Recent Activity' effect on <http://foursquare.com/>. The top activity pushing all beneath. Is there a JQuery plugin or widget I can readily use which does the same?
(I am a lazy developer so please no 'you can develop this yourself' responses) | 2009/11/20 | [
"https://Stackoverflow.com/questions/1772652",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/129001/"
] | Is there a reason you can't use [simplexml](http://www.php.net/manual/en/book.simplexml.php)?
```
$xml = simplexml_load_file('http://www.supashare.net/test.xml');
$result = $xml->xpath('/XML/RESULTS/LISTING/REDIRECT');
echo $result[0];
``` | ```
$doc = new DomDocument();
$doc->load('http://www.supashare.net/test.xml');
$q = new DomXPath($doc);
echo $q->query('//REDIRECT')->item(0)->nodeValue;
``` |
1,772,652 | I like the 'Recent Activity' effect on <http://foursquare.com/>. The top activity pushing all beneath. Is there a JQuery plugin or widget I can readily use which does the same?
(I am a lazy developer so please no 'you can develop this yourself' responses) | 2009/11/20 | [
"https://Stackoverflow.com/questions/1772652",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/129001/"
] | ```
$xml = stream_get_contents($fp);
$xml = new SimpleXMLElement($xml);
echo $xml->RESULTS->LISTING->REDIRECT;
``` | ```
$doc = new DomDocument();
$doc->load('http://www.supashare.net/test.xml');
$q = new DomXPath($doc);
echo $q->query('//REDIRECT')->item(0)->nodeValue;
``` |
31,552 | I am using a linked datasource in MOSS to create a dynamic table of contents page based on a metadata associated with files in a document library. The library contains multilookup columns for the following: Audience, Category, Subcategory. Users get to the toc page by clicking from another page to pass the Audience in ... | 2012/03/14 | [
"https://sharepoint.stackexchange.com/questions/31552",
"https://sharepoint.stackexchange.com",
"https://sharepoint.stackexchange.com/users/7057/"
] | You are missing the `ElementFile` element. From what you've described, your feature.xml should look something like this:
```
<?xml version="1.0" encoding="utf-8"?>
<Feature
Title="YourFeature"
Description="YourFeature"
Id="GUID"
Scope="Site"
Version="1.0.0.0"
Hidden="FALSE"
DefaultResourceFile="core"
xmlns="htt... | I would check your ddf file. Here is the preview from one of my projects
```
;.OPTION Explicit
.Set CabinetNameTemplate="Test.wsp"
.Set DiskDirectoryTemplate="..\TargetFolderForWsp(bin)"
.Set CompressionType=MSZIP
.Set UniqueFiles=Off
.Set Cabinet=On
;*******************************
manifest.xml
%BuildPath%\Test.dll... |
71,448,383 | I need to dismiss an alert dialogue when a callback is being called. How can i achieve it? | 2022/03/12 | [
"https://Stackoverflow.com/questions/71448383",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18445974/"
] | >
> Some people say that this practice is adopted to avoid repeating declarations.
>
>
>
If some people say that then what they say is misleading. Header guards are used to avoid repeating *definitions* in order to conform to the One Definition Rule. | Repeating **declarations** is okay. Repeating **definitions** is not.
```
int func(); // declaration
int func(); // declaration; repetition is okay
class X; // declaration
class X; // declaration; repetition is okay
class Y {}; // definition
class Y {}; // definition; repetition is not okay
```
If a header consist... |
71,448,383 | I need to dismiss an alert dialogue when a callback is being called. How can i achieve it? | 2022/03/12 | [
"https://Stackoverflow.com/questions/71448383",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18445974/"
] | >
> Some people say that this practice is adopted to avoid repeating declarations.
>
>
>
If some people say that then what they say is misleading. Header guards are used to avoid repeating *definitions* in order to conform to the One Definition Rule. | >
> So is it really necessary to avoid repeating declarations?
>
>
>
You can have multiple **declarations** for a given entity(name). That is you can repeat declarations in a given scope.
>
> is there another reason for using #ifndef?
>
>
>
The main reason for using **header guards** is to **ensure** that th... |
16,569,726 | In this official doc they use 2.2-SNAPSHOT version.
<http://doc.akka.io/docs/akka/snapshot/intro/getting-started.html>
If try to resolve it - it does not work.
If try to add typesafe repo:
```
<repositories>
<repository>
<id>java.net</id>
<url>http://repo.typesafe.com/typesafe/releases/</url>
... | 2013/05/15 | [
"https://Stackoverflow.com/questions/16569726",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/369759/"
] | Can't you use the M3?
```
<dependency>
<groupId>com.typesafe.akka</groupId>
<artifactId>akka-actor_2.10</artifactId>
<version>2.2-M3</version>
</dependency>
```
If so, please use the above. It's available on the standard Maven repo. | Normally people don't publish snapshots to the releases repository (there's almost always a snapshots repository), in Akka's case, it's: **repo.akka.io/snapshots/**
And I definitely recommend to choose one of the timestamped ones and not the snapshot. |
127,260 | I have a small set (currently 3, going to 6, not going to be more than 10) of (virtual, vmware workstation) Windows XP machines. They are similar but not exactly the same.
I'm currently rolling out Windows updates, etc., by hand: start machine 1, update, close, etc; I'd like to review the updates first before the clie... | 2010/03/29 | [
"https://serverfault.com/questions/127260",
"https://serverfault.com",
"https://serverfault.com/users/39096/"
] | [Shavlik Netchk](http://www.shavlik.com/netchk-protect.aspx) can patch Windows and other programs - it is $40 (usd) per patched system. | You could run them on VMWare ESX/ESXi with vCenter and use vCenter Update Manager to get the updates and apply them to all your guest with a few clicks. |
127,260 | I have a small set (currently 3, going to 6, not going to be more than 10) of (virtual, vmware workstation) Windows XP machines. They are similar but not exactly the same.
I'm currently rolling out Windows updates, etc., by hand: start machine 1, update, close, etc; I'd like to review the updates first before the clie... | 2010/03/29 | [
"https://serverfault.com/questions/127260",
"https://serverfault.com",
"https://serverfault.com/users/39096/"
] | It seems from your question that the VMs are not always running (ie you manually start them). Is that so?
If they are always running, then then the functionality you want (auto updates, being able to review updates etc) would mean stepping into the big leagues (WSUS server etc) [note that I don've have any experience... | You could run them on VMWare ESX/ESXi with vCenter and use vCenter Update Manager to get the updates and apply them to all your guest with a few clicks. |
127,260 | I have a small set (currently 3, going to 6, not going to be more than 10) of (virtual, vmware workstation) Windows XP machines. They are similar but not exactly the same.
I'm currently rolling out Windows updates, etc., by hand: start machine 1, update, close, etc; I'd like to review the updates first before the clie... | 2010/03/29 | [
"https://serverfault.com/questions/127260",
"https://serverfault.com",
"https://serverfault.com/users/39096/"
] | Can you tell us what is your host OS?
I think WSUS would be a good solution for you. You can review the updates and approve the ones you need.
Also as the VMs are not always On, You may want to configure a simple startup script to run the WSUS Update command. | You could run them on VMWare ESX/ESXi with vCenter and use vCenter Update Manager to get the updates and apply them to all your guest with a few clicks. |
127,260 | I have a small set (currently 3, going to 6, not going to be more than 10) of (virtual, vmware workstation) Windows XP machines. They are similar but not exactly the same.
I'm currently rolling out Windows updates, etc., by hand: start machine 1, update, close, etc; I'd like to review the updates first before the clie... | 2010/03/29 | [
"https://serverfault.com/questions/127260",
"https://serverfault.com",
"https://serverfault.com/users/39096/"
] | [Shavlik Netchk](http://www.shavlik.com/netchk-protect.aspx) can patch Windows and other programs - it is $40 (usd) per patched system. | It sounds as though you want to be able to make lots of different changes to your virtual guests - whilst Update Manager will handle the patching/hotfix/update side of things, I don't think it will answer your queries around changing other system files/updating Java.
Not forgetting, whilst ESXi may be free, VCenter i... |
127,260 | I have a small set (currently 3, going to 6, not going to be more than 10) of (virtual, vmware workstation) Windows XP machines. They are similar but not exactly the same.
I'm currently rolling out Windows updates, etc., by hand: start machine 1, update, close, etc; I'd like to review the updates first before the clie... | 2010/03/29 | [
"https://serverfault.com/questions/127260",
"https://serverfault.com",
"https://serverfault.com/users/39096/"
] | [Shavlik Netchk](http://www.shavlik.com/netchk-protect.aspx) can patch Windows and other programs - it is $40 (usd) per patched system. | If your host OS is capable of hosting active directory or a Samba domain then you'll get a netlogon directory which you can use to script things to happen on login to your XP machines. You can use batch scripts, powershell or anything else you can make Windows support. It's maybe not the best way of doing things on a l... |
127,260 | I have a small set (currently 3, going to 6, not going to be more than 10) of (virtual, vmware workstation) Windows XP machines. They are similar but not exactly the same.
I'm currently rolling out Windows updates, etc., by hand: start machine 1, update, close, etc; I'd like to review the updates first before the clie... | 2010/03/29 | [
"https://serverfault.com/questions/127260",
"https://serverfault.com",
"https://serverfault.com/users/39096/"
] | It seems from your question that the VMs are not always running (ie you manually start them). Is that so?
If they are always running, then then the functionality you want (auto updates, being able to review updates etc) would mean stepping into the big leagues (WSUS server etc) [note that I don've have any experience... | It sounds as though you want to be able to make lots of different changes to your virtual guests - whilst Update Manager will handle the patching/hotfix/update side of things, I don't think it will answer your queries around changing other system files/updating Java.
Not forgetting, whilst ESXi may be free, VCenter i... |
127,260 | I have a small set (currently 3, going to 6, not going to be more than 10) of (virtual, vmware workstation) Windows XP machines. They are similar but not exactly the same.
I'm currently rolling out Windows updates, etc., by hand: start machine 1, update, close, etc; I'd like to review the updates first before the clie... | 2010/03/29 | [
"https://serverfault.com/questions/127260",
"https://serverfault.com",
"https://serverfault.com/users/39096/"
] | Can you tell us what is your host OS?
I think WSUS would be a good solution for you. You can review the updates and approve the ones you need.
Also as the VMs are not always On, You may want to configure a simple startup script to run the WSUS Update command. | It sounds as though you want to be able to make lots of different changes to your virtual guests - whilst Update Manager will handle the patching/hotfix/update side of things, I don't think it will answer your queries around changing other system files/updating Java.
Not forgetting, whilst ESXi may be free, VCenter i... |
127,260 | I have a small set (currently 3, going to 6, not going to be more than 10) of (virtual, vmware workstation) Windows XP machines. They are similar but not exactly the same.
I'm currently rolling out Windows updates, etc., by hand: start machine 1, update, close, etc; I'd like to review the updates first before the clie... | 2010/03/29 | [
"https://serverfault.com/questions/127260",
"https://serverfault.com",
"https://serverfault.com/users/39096/"
] | It seems from your question that the VMs are not always running (ie you manually start them). Is that so?
If they are always running, then then the functionality you want (auto updates, being able to review updates etc) would mean stepping into the big leagues (WSUS server etc) [note that I don've have any experience... | If your host OS is capable of hosting active directory or a Samba domain then you'll get a netlogon directory which you can use to script things to happen on login to your XP machines. You can use batch scripts, powershell or anything else you can make Windows support. It's maybe not the best way of doing things on a l... |
127,260 | I have a small set (currently 3, going to 6, not going to be more than 10) of (virtual, vmware workstation) Windows XP machines. They are similar but not exactly the same.
I'm currently rolling out Windows updates, etc., by hand: start machine 1, update, close, etc; I'd like to review the updates first before the clie... | 2010/03/29 | [
"https://serverfault.com/questions/127260",
"https://serverfault.com",
"https://serverfault.com/users/39096/"
] | Can you tell us what is your host OS?
I think WSUS would be a good solution for you. You can review the updates and approve the ones you need.
Also as the VMs are not always On, You may want to configure a simple startup script to run the WSUS Update command. | If your host OS is capable of hosting active directory or a Samba domain then you'll get a netlogon directory which you can use to script things to happen on login to your XP machines. You can use batch scripts, powershell or anything else you can make Windows support. It's maybe not the best way of doing things on a l... |
3,940,888 | Suppose $A,B$ are topological spaces, $B $ is a subspace of $A $ and $X\subseteq B $.
If $X $ is compact in $ A$ then is $X $ compact in B?
If an open covering of $X$ in $B$ is in fact an open covering in $A$ then by compactness of $A$ we would have a finite sub covering. | 2020/12/09 | [
"https://math.stackexchange.com/questions/3940888",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/617302/"
] | Yes, and you can prove it directly from the definitions. You are assuming we have a chain of subspaces $X \subseteq B \subseteq A$. If $\{O\_\beta \mid \beta \in I\}$ is an open cover of $X$ in $B$, then $O\_\beta = B \cap U\_\beta$ where $U\_\beta$ is open in $A$. Then $\{U\_\beta \mid \beta \in I\}$ is an open cover ... | Let $\bigcup U\_{i \in I} \supset X$ be a finite covering of $X$ in $A$. Since $B$ is a subspace of $A$ then $\tau\_B = \{B \bigcap U | U \in \tau\}$. This proves that there is a finite covering of $X$ in $B$. |
3,940,888 | Suppose $A,B$ are topological spaces, $B $ is a subspace of $A $ and $X\subseteq B $.
If $X $ is compact in $ A$ then is $X $ compact in B?
If an open covering of $X$ in $B$ is in fact an open covering in $A$ then by compactness of $A$ we would have a finite sub covering. | 2020/12/09 | [
"https://math.stackexchange.com/questions/3940888",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/617302/"
] | Yes, and you can prove it directly from the definitions. You are assuming we have a chain of subspaces $X \subseteq B \subseteq A$. If $\{O\_\beta \mid \beta \in I\}$ is an open cover of $X$ in $B$, then $O\_\beta = B \cap U\_\beta$ where $U\_\beta$ is open in $A$. Then $\{U\_\beta \mid \beta \in I\}$ is an open cover ... | Suppose $X$ is compact relative to $A$ and let $ \{O\}\_i$ be collection of open sets relative to $B$, such that $X\subset \bigcup\_i O\_i$.
By definition of subspace topology,
there exists $N\_i$ open in $A$, such that $O\_i=B\cap N\_i$, for all $i$. Since $X$ is compact in $A$.
Therefore,
$$X\subset N\_{i\_1}\cup\dot... |
21,508,810 | Looking at the code below I know that we have an array `$r`. The for loop evaluates to `true` and it goes to the `rand` function. The `rand` function generates a number between 0 and 100,000.
Then the `if`-statement checks to see if the number generated is less than or equal to 10.
The final part is what is confusing ... | 2014/02/02 | [
"https://Stackoverflow.com/questions/21508810",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1009365/"
] | You could use `paste0`, e.g.:
```
grep(paste0("[Aa]ge: ", age, "$"), agr, value=TRUE))
```
Or `sprintf`, e.g.:
```
grep(sprintf("[Aa]ge: %s$", age), agr, value=TRUE))
```
Another way would be to use regular expressions (see `?regex`):
```
grep("[Aa]ge: [0-9]+$", agr, value=TRUE)
``` | If you goal is to count the matches of the ages specified in `numb` in the strings in `agr`, you can use this approach:
```
# an example vector
agr <- c("Age: 23", "age: 20", "age: 5", "Age: 20", "age: 3")
numb <- c(20, 25, 3, 5)
# create regex pattern
pattern <- paste0("[Aa]ge: (", paste(numb, collapse = "|"), ")$"... |
10,583 | I love using Google map to give me direction. however, I would like it to provide "turn left, turn right" voice while I am driving. I heard Google map navigation able to provide such feature. I search from android market but cannot find one. is it only available to selected country? is there any workaround, or other so... | 2011/06/18 | [
"https://android.stackexchange.com/questions/10583",
"https://android.stackexchange.com",
"https://android.stackexchange.com/users/2999/"
] | It's limited to specific locations, and only available with a data connection. See [this question on the location limitations](https://android.stackexchange.com/questions/1854/does-android-come-with-free-navigation-in-non-us-contries) and [this question on alternatives](https://android.stackexchange.com/questions/227/w... | Google's official list of countries with Google Maps Navigation (Beta) available is here:
<http://www.google.com/support/mobile/bin/answer.py?answer=172221>
Currently 29 countries are listed there.
If your country is not in the list, the simplest workaround I found is [brut.all ownhere modified changepn Google Maps a... |
23,607,059 | I have seen this answer, [How to apply PostgreSQL UNLOGGED feature to an existing table?](https://stackoverflow.com/questions/7938610/how-to-apply-postgresql-9-1-unlogged-feature-to-an-existing-table/7938621#7938621), which basically suggests that the way to convert a table to unlogged is to run:
```
CREATE UNLOGGED T... | 2014/05/12 | [
"https://Stackoverflow.com/questions/23607059",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/457052/"
] | *Update*: In PostgreSQL 9.5+ there is `ALTER TABLE ... SET LOGGED` and `... SET UNLOGGED`
Converting from `UNLOGGED` to `LOGGED` requires that the whole table's data be written to xlogs if `wal_level` is > `minimal` so replicas get a copy. So it's not free, but it can still be worth creating a table unlogged, populati... | Apparently this (alter table ... set logged | unlogged) has been implemented in (the upcoming) postgresql 9.5. |
46,306,596 | My build.gradle:
```
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = '1.1.3-2'
ext.realm_version = '3.7.2'
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3... | 2017/09/19 | [
"https://Stackoverflow.com/questions/46306596",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8542613/"
] | I've just resolve this problem.
I was upgrading the old GCM to FCM, and the Firebase Assistant shows the same error message as yours.
Solved by:
1. Go to Firebase console, in the **Settings** of my project, download `google-servics.json` to `app/` folder. (Replace my old GCM's json file)
2. doing [Add Firebase to you... | You might want to try 'Sync Project with Gradle Files'.
Sometimes I forget to sync the implementations after adding them to the gradle file. |
46,306,596 | My build.gradle:
```
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = '1.1.3-2'
ext.realm_version = '3.7.2'
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3... | 2017/09/19 | [
"https://Stackoverflow.com/questions/46306596",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8542613/"
] | For me, the issue was classpath 'com.google.gms:google-services:4.3.0' was giving error, then I changed to classpath 'com.google.gms:google-services:4.2.0', resync'd Project with Gradle Files', then pressed Connect to firebase, :D | You might want to try 'Sync Project with Gradle Files'.
Sometimes I forget to sync the implementations after adding them to the gradle file. |
5,776,299 | Aloha everyone,
I have another question. I have a SYDI script that retrieves WMI data from Windows computers, then appends a timestamp to the end of the file, and finally saves it to a share on a server. The PHP code I have to read and print out the filenames is shown below:
```
if (is_dir($dir)) {
if ($dh = open... | 2011/04/25 | [
"https://Stackoverflow.com/questions/5776299",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/691694/"
] | try this :
```
for ($i = 0; $i < sizeof($results); $i++) {
$file = 'sydiResults/'.$results[$i];
if (file_exists($file)) {
$xml = simplexml_load_file($file);
print_r($xml);
}
else {
exit('Failed to open '.$file);
}
``` | As I put in the comment above, everything is resolved now! I tested my theory by reading a portion of the data within one of the tags. Here is the code that works:
```
// Open a known directory, and proceed to read its contents
if (is_dir($dir)) {
if ($dh = opendir($dir)) {
while (($file = readdir($dh)) !=... |
9,074,342 | When I try to get a month before last from today, I run “date --date ‘2 months ago’”.
But I run this command on Jan 31st, it return December.
I think it should return November.
Would you know how to get a month before last with date command?
Added at 17:30 (JST):
If this date calculus written in Python, I will use da... | 2012/01/31 | [
"https://Stackoverflow.com/questions/9074342",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/430349/"
] | You are not dreaming :) This is possible.
>
> Go to 'Test' menu >> 'Run' >> 'All Tests in Solution'
>
>
> Keyboard Shortcut : Ctrl + R , A
>
>
>
This will run all the tests in the solution. | Go to the menu and choose:
```
Test -> Windows -> Test View
```
In that view you just mark them all by pressing `Ctrl + A` and then press the `Run` button |
10,794,148 | I am looking to sort an arraylist of arraylist of integers and I require help?
I was informed that I need to implement comparator or comparable and then use the collection.sort to sort the list of list in order...
```
ArrayList<ArrayList<Integer>> g = new ArrayList<ArrayList<Integer>>()
If you look at the list of li... | 2012/05/29 | [
"https://Stackoverflow.com/questions/10794148",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1127574/"
] | No error check for null lists, but here it is.
```
List<List<Integer>> list = Arrays.asList(Arrays.asList(10, 5, 4),
Arrays.asList(3, 2, 1), Arrays.asList(7, 8, 6));
for (List<Integer> l : list) {
Collections.sort(l);
}
Collections.sort(list, new Comparator<List<Integer>>() {
public int compare(List<I... | You could just sort each list individually. The `Collections.sort(collection)` will sort the Integers in ascending order automatically. |
10,794,148 | I am looking to sort an arraylist of arraylist of integers and I require help?
I was informed that I need to implement comparator or comparable and then use the collection.sort to sort the list of list in order...
```
ArrayList<ArrayList<Integer>> g = new ArrayList<ArrayList<Integer>>()
If you look at the list of li... | 2012/05/29 | [
"https://Stackoverflow.com/questions/10794148",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1127574/"
] | No error check for null lists, but here it is.
```
List<List<Integer>> list = Arrays.asList(Arrays.asList(10, 5, 4),
Arrays.asList(3, 2, 1), Arrays.asList(7, 8, 6));
for (List<Integer> l : list) {
Collections.sort(l);
}
Collections.sort(list, new Comparator<List<Integer>>() {
public int compare(List<I... | if sort doesnt have what u need you can try this algorithm:
```
package drawFramePackage;
import java.awt.geom.AffineTransform;
import java.util.ArrayList;
import java.util.ListIterator;
import java.util.Random;
public class QuicksortAlgorithm {
ArrayList<AffineTransform> affs;
ListIterator<AffineTransform> li... |
10,794,148 | I am looking to sort an arraylist of arraylist of integers and I require help?
I was informed that I need to implement comparator or comparable and then use the collection.sort to sort the list of list in order...
```
ArrayList<ArrayList<Integer>> g = new ArrayList<ArrayList<Integer>>()
If you look at the list of li... | 2012/05/29 | [
"https://Stackoverflow.com/questions/10794148",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1127574/"
] | No error check for null lists, but here it is.
```
List<List<Integer>> list = Arrays.asList(Arrays.asList(10, 5, 4),
Arrays.asList(3, 2, 1), Arrays.asList(7, 8, 6));
for (List<Integer> l : list) {
Collections.sort(l);
}
Collections.sort(list, new Comparator<List<Integer>>() {
public int compare(List<I... | This works for me
```
Collections.sort(list, new Comparator<List<Integer>>() {
public int compare(List<Integer> o1, List<Integer> o2) {
int min = Math.min(o1.size(),o2.size());
for(int i=0;i<min;i++)
{
if(o1.get(i)!=o2.get(i))
... |
10,794,148 | I am looking to sort an arraylist of arraylist of integers and I require help?
I was informed that I need to implement comparator or comparable and then use the collection.sort to sort the list of list in order...
```
ArrayList<ArrayList<Integer>> g = new ArrayList<ArrayList<Integer>>()
If you look at the list of li... | 2012/05/29 | [
"https://Stackoverflow.com/questions/10794148",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1127574/"
] | No error check for null lists, but here it is.
```
List<List<Integer>> list = Arrays.asList(Arrays.asList(10, 5, 4),
Arrays.asList(3, 2, 1), Arrays.asList(7, 8, 6));
for (List<Integer> l : list) {
Collections.sort(l);
}
Collections.sort(list, new Comparator<List<Integer>>() {
public int compare(List<I... | It will check up to last element of the list and sort them according to the requirement.
```
Collections.sort(res, new MIN());
```
//method
```
static class MIN implements Comparator<ArrayList<Integer>>
{
public int compare(ArrayList<Integer> a,ArrayList<Integer> b)
{
for(int i=0;i<M... |
10,794,148 | I am looking to sort an arraylist of arraylist of integers and I require help?
I was informed that I need to implement comparator or comparable and then use the collection.sort to sort the list of list in order...
```
ArrayList<ArrayList<Integer>> g = new ArrayList<ArrayList<Integer>>()
If you look at the list of li... | 2012/05/29 | [
"https://Stackoverflow.com/questions/10794148",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1127574/"
] | You could just sort each list individually. The `Collections.sort(collection)` will sort the Integers in ascending order automatically. | if sort doesnt have what u need you can try this algorithm:
```
package drawFramePackage;
import java.awt.geom.AffineTransform;
import java.util.ArrayList;
import java.util.ListIterator;
import java.util.Random;
public class QuicksortAlgorithm {
ArrayList<AffineTransform> affs;
ListIterator<AffineTransform> li... |
10,794,148 | I am looking to sort an arraylist of arraylist of integers and I require help?
I was informed that I need to implement comparator or comparable and then use the collection.sort to sort the list of list in order...
```
ArrayList<ArrayList<Integer>> g = new ArrayList<ArrayList<Integer>>()
If you look at the list of li... | 2012/05/29 | [
"https://Stackoverflow.com/questions/10794148",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1127574/"
] | You could just sort each list individually. The `Collections.sort(collection)` will sort the Integers in ascending order automatically. | This works for me
```
Collections.sort(list, new Comparator<List<Integer>>() {
public int compare(List<Integer> o1, List<Integer> o2) {
int min = Math.min(o1.size(),o2.size());
for(int i=0;i<min;i++)
{
if(o1.get(i)!=o2.get(i))
... |
10,794,148 | I am looking to sort an arraylist of arraylist of integers and I require help?
I was informed that I need to implement comparator or comparable and then use the collection.sort to sort the list of list in order...
```
ArrayList<ArrayList<Integer>> g = new ArrayList<ArrayList<Integer>>()
If you look at the list of li... | 2012/05/29 | [
"https://Stackoverflow.com/questions/10794148",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1127574/"
] | You could just sort each list individually. The `Collections.sort(collection)` will sort the Integers in ascending order automatically. | It will check up to last element of the list and sort them according to the requirement.
```
Collections.sort(res, new MIN());
```
//method
```
static class MIN implements Comparator<ArrayList<Integer>>
{
public int compare(ArrayList<Integer> a,ArrayList<Integer> b)
{
for(int i=0;i<M... |
10,794,148 | I am looking to sort an arraylist of arraylist of integers and I require help?
I was informed that I need to implement comparator or comparable and then use the collection.sort to sort the list of list in order...
```
ArrayList<ArrayList<Integer>> g = new ArrayList<ArrayList<Integer>>()
If you look at the list of li... | 2012/05/29 | [
"https://Stackoverflow.com/questions/10794148",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1127574/"
] | if sort doesnt have what u need you can try this algorithm:
```
package drawFramePackage;
import java.awt.geom.AffineTransform;
import java.util.ArrayList;
import java.util.ListIterator;
import java.util.Random;
public class QuicksortAlgorithm {
ArrayList<AffineTransform> affs;
ListIterator<AffineTransform> li... | This works for me
```
Collections.sort(list, new Comparator<List<Integer>>() {
public int compare(List<Integer> o1, List<Integer> o2) {
int min = Math.min(o1.size(),o2.size());
for(int i=0;i<min;i++)
{
if(o1.get(i)!=o2.get(i))
... |
10,794,148 | I am looking to sort an arraylist of arraylist of integers and I require help?
I was informed that I need to implement comparator or comparable and then use the collection.sort to sort the list of list in order...
```
ArrayList<ArrayList<Integer>> g = new ArrayList<ArrayList<Integer>>()
If you look at the list of li... | 2012/05/29 | [
"https://Stackoverflow.com/questions/10794148",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1127574/"
] | if sort doesnt have what u need you can try this algorithm:
```
package drawFramePackage;
import java.awt.geom.AffineTransform;
import java.util.ArrayList;
import java.util.ListIterator;
import java.util.Random;
public class QuicksortAlgorithm {
ArrayList<AffineTransform> affs;
ListIterator<AffineTransform> li... | It will check up to last element of the list and sort them according to the requirement.
```
Collections.sort(res, new MIN());
```
//method
```
static class MIN implements Comparator<ArrayList<Integer>>
{
public int compare(ArrayList<Integer> a,ArrayList<Integer> b)
{
for(int i=0;i<M... |
28,289,256 | I installed the latest (2015-02-03) MASShortcut as CocoaPod together with a correct bridging header for a very basic OS X Swift Application. I ended up with the following code and I do not know what I am doing wrong?:
```
import Cocoa
@NSApplicationMain
class AppDelegate: NSObject, NSApplicationDelegate {
@IBOut... | 2015/02/03 | [
"https://Stackoverflow.com/questions/28289256",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4522072/"
] | There are a few issues here. Before fixing them you should make sure that you have `MASShortcut` 2.1.2 installed (you can see this in your `Podfile.lock`). If you don't you should run `pod update` to get the newest version.
Another potential issue with you testing this is your shortcut conflicting with OS X default sh... | Wow, that is a great answer. Thank you so much! I realized that I should have studied the basics of Swift a little bit longer. Your solution works perfectly!
However, one little detail is superfluous. You do not have to add the bridging header
```
#import <MASShortcut/MASShortcutMonitor.h>
```
if you create the bri... |
30,506,502 | I want to consume the API messages in c#.net and the response it may come continuously/frequently. Team suggest me to use Web sockets. But I consume the API thru HTTP. Can any one give idea which is better and advantages of Web-socket in continuous receiving the messages as well as in HTTP | 2015/05/28 | [
"https://Stackoverflow.com/questions/30506502",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4516583/"
] | HTTP normally uses a request/response model. It does not allow the server to send data to the client, unless the client first requested it. This can be worked around by letting the client regularly poll the server, or by using the long polling technique where the server delays the response until data is available. In b... | You may try with ASP.NET SignalR which able to send and receive messages via HTTP. You can achieve real-time web functionality to your messaging application. It's able to have server code push content to connected clients instantly, rather than having the server wait for a client to request new data.
Have a look at th... |
61,354,248 | Having trouble trying to change where Django looks for the default image in the ImageField. I am trying to store a default image within a folder in my "media" file.
Code from models.py below:
```
from django.db import models
from django.contrib.auth.models import User
class Profile(models.Model):
user = models.O... | 2020/04/21 | [
"https://Stackoverflow.com/questions/61354248",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12090552/"
] | Map function basically loops and returns result of each loop as an array. So basically all you need is an array of components in the end. There are just different routes to achieve it.
Converting HashMap to an array and running a map on it is slower. Please avoid that. Below code will loop through just once.
```
func... | You can derive an array of keys using the built-in `Map.prototype.forEach` and then use it for `.map` in your render <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/forEach>
```
let myKeys = [];
myHashMap.forEach((value, key) => myKeys.push(key);
return (
{
myKeys.map((ite... |
61,354,248 | Having trouble trying to change where Django looks for the default image in the ImageField. I am trying to store a default image within a folder in my "media" file.
Code from models.py below:
```
from django.db import models
from django.contrib.auth.models import User
class Profile(models.Model):
user = models.O... | 2020/04/21 | [
"https://Stackoverflow.com/questions/61354248",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12090552/"
] | You guys gave great answers, but I found the simplest syntax:
```js
Array.from(myHashMap.entries()).map((entry) => {
const [key, value] = entry;
return (<MyComponent myKey={key} myValue={value} />);
}
``` | You can derive an array of keys using the built-in `Map.prototype.forEach` and then use it for `.map` in your render <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/forEach>
```
let myKeys = [];
myHashMap.forEach((value, key) => myKeys.push(key);
return (
{
myKeys.map((ite... |
65,770,316 | I'm trying to get the second to last non-null column per row, where the null could be in any column. Solutions such as this don't work due to where the null can be anywhere: [Pandas select the second to last column which is also not nan](https://stackoverflow.com/questions/37955900/pandas-select-the-second-to-last-colu... | 2021/01/18 | [
"https://Stackoverflow.com/questions/65770316",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6545542/"
] | You can check for `notna` and do a reverse `cumsum` on `axis=1` , then get the first column that returns 2. and get its value using `df.lookup`:
```
u = df.notna().iloc[:,::-1].cumsum(axis=1)
df['value'] = df.lookup(df.index,u.eq(2).dot(u.columns+',').str.split(',').str[0])
```
---
```
print(df)
a b c d... | You can use [`pandas.DataFrame.apply`](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.apply.html) and [`pandas.Series.shift`](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.Series.shift.html):
```
df.apply(lambda x: x.shift(x.isnull().sum())[-2], axis = 1)
#0 1.0
#1 ... |
65,770,316 | I'm trying to get the second to last non-null column per row, where the null could be in any column. Solutions such as this don't work due to where the null can be anywhere: [Pandas select the second to last column which is also not nan](https://stackoverflow.com/questions/37955900/pandas-select-the-second-to-last-colu... | 2021/01/18 | [
"https://Stackoverflow.com/questions/65770316",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6545542/"
] | You can check for `notna` and do a reverse `cumsum` on `axis=1` , then get the first column that returns 2. and get its value using `df.lookup`:
```
u = df.notna().iloc[:,::-1].cumsum(axis=1)
df['value'] = df.lookup(df.index,u.eq(2).dot(u.columns+',').str.split(',').str[0])
```
---
```
print(df)
a b c d... | You can [`pandas.DataFrame.apply`](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.apply.html), [`pandas.DataFrame.dropna`](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.dropna.html) and access the second last element.
```
>>> df.apply(lambda x:x.dropna().iloc[... |
67,869,203 | I have a json object as below in Azure Dashboard:
{...,'Signal':'0.0',...}
where the Signal can take on the values of 0.0 for No and 1.0 for Yes. I wish to convert these values to "yes" and "no" using Kusto. I tried to do the following but it doesn't work:
| extend signal = tostring(replace(@"0.0",@"No",object['Sign... | 2021/06/07 | [
"https://Stackoverflow.com/questions/67869203",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9205507/"
] | This is done by AJAX, here are the steps
1. create a new view that checks the user status e.g is\_verified\_user and return True/False
2. write a JS function that will call the view and check response, it shall be something like this
```
function check_user_status(){
$.ajax({"url":"{%url 'is_verified_user'%... | Check the api response and use the ternary operator
Example in React JS
const [state, setState] = useState(false)
useEffect( () => {
// call api
let response = axios.get('/')
let result = response.verified ? true : false
setState(result)
},[state])
return (
) |
18,030,990 | I would like to retrieve all schemas in oracle and display in a combobox.
I have been researching and knew that I can retrieve through GetSchema().
```
DataTable table = connection.GetSchema();
```
I don't know how to include the schemas in the list.
```
List<string> list = new List<string>();
return list;
```
... | 2013/08/03 | [
"https://Stackoverflow.com/questions/18030990",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1136827/"
] | This code creates serial queue:
```
dispatch_queue_t imageLoadQueue = dispatch_queue_create("com.GMM.assamkar", NULL);
```
therefore each task IN QUEUE is performed in the same thread successive. Therefore your single work thread is sustained by sleep for each task of loading that slow down all process of loading.
... | Use Lazy Load File for your requirement.
[LazyLoad.h](https://gist.github.com/ipreencekmr/6146285)
[LazyLoad.m](https://gist.github.com/ipreencekmr/6146286)
Use them like this
```
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
UIC... |
18,030,990 | I would like to retrieve all schemas in oracle and display in a combobox.
I have been researching and knew that I can retrieve through GetSchema().
```
DataTable table = connection.GetSchema();
```
I don't know how to include the schemas in the list.
```
List<string> list = new List<string>();
return list;
```
... | 2013/08/03 | [
"https://Stackoverflow.com/questions/18030990",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1136827/"
] | Trying to answer your main question "How can i load images to a `UICollectionview` asynchronously?"
I would suggest solution offered by "*Natasha Murashev*" [here](http://natashatherobot.com/ios-how-to-download-images-asynchronously-make-uitableview-scroll-fast/), which worked nicely for me and it's simple.
If here `... | This code creates serial queue:
```
dispatch_queue_t imageLoadQueue = dispatch_queue_create("com.GMM.assamkar", NULL);
```
therefore each task IN QUEUE is performed in the same thread successive. Therefore your single work thread is sustained by sleep for each task of loading that slow down all process of loading.
... |
18,030,990 | I would like to retrieve all schemas in oracle and display in a combobox.
I have been researching and knew that I can retrieve through GetSchema().
```
DataTable table = connection.GetSchema();
```
I don't know how to include the schemas in the list.
```
List<string> list = new List<string>();
return list;
```
... | 2013/08/03 | [
"https://Stackoverflow.com/questions/18030990",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1136827/"
] | Trying to answer your main question "How can i load images to a `UICollectionview` asynchronously?"
I would suggest solution offered by "*Natasha Murashev*" [here](http://natashatherobot.com/ios-how-to-download-images-asynchronously-make-uitableview-scroll-fast/), which worked nicely for me and it's simple.
If here `... | Use Lazy Load File for your requirement.
[LazyLoad.h](https://gist.github.com/ipreencekmr/6146285)
[LazyLoad.m](https://gist.github.com/ipreencekmr/6146286)
Use them like this
```
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
UIC... |
18,113,429 | >
> Notice: Undefined index: myusername in C:\xampp\htdocs\login\_in2.php on line 14
> Wrong Username or Password
>
>
>
```
<?php
$host="localhost"; // Host name
$username="root"; // Mysql username
$password=""; // Mysql password
$db_name="test"; // Database name
$tbl_name="members"; // Table name
// Conne... | 2013/08/07 | [
"https://Stackoverflow.com/questions/18113429",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2654476/"
] | The data is not being submitted, the error is related to trying to access the variable at `$_POST['']`.
Some simple error checking should fix it:
```
<?php
[..]
if ( isset( $_POST['myusername'] ) && isset( $_POST['mypassword'] ) ) {
// username and password sent from form
$myusername=$_POST['myusername'];
$mypas... | Could it be that you are mixing your quote marks? Instead of
```
$sql="SELECT * FROM $tbl_name WHERE username='$myusername' and password='$mypassword'"
```
You might try
```
$sql="SELECT * FROM $tbl_name WHERE username='".$myusername."' and password='".$mypassword."'";
``` |
18,113,429 | >
> Notice: Undefined index: myusername in C:\xampp\htdocs\login\_in2.php on line 14
> Wrong Username or Password
>
>
>
```
<?php
$host="localhost"; // Host name
$username="root"; // Mysql username
$password=""; // Mysql password
$db_name="test"; // Database name
$tbl_name="members"; // Table name
// Conne... | 2013/08/07 | [
"https://Stackoverflow.com/questions/18113429",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2654476/"
] | The data is not being submitted, the error is related to trying to access the variable at `$_POST['']`.
Some simple error checking should fix it:
```
<?php
[..]
if ( isset( $_POST['myusername'] ) && isset( $_POST['mypassword'] ) ) {
// username and password sent from form
$myusername=$_POST['myusername'];
$mypas... | Probably input form name has a typo.
Replace
```
$myusername=$_POST['myusername']; with $myusername=$_POST['username'];
```
and
```
$mypassword=$_POST['mypassword']; with $mypassword=$_POST['password'];
```
in all instances. |
18,113,429 | >
> Notice: Undefined index: myusername in C:\xampp\htdocs\login\_in2.php on line 14
> Wrong Username or Password
>
>
>
```
<?php
$host="localhost"; // Host name
$username="root"; // Mysql username
$password=""; // Mysql password
$db_name="test"; // Database name
$tbl_name="members"; // Table name
// Conne... | 2013/08/07 | [
"https://Stackoverflow.com/questions/18113429",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2654476/"
] | The data is not being submitted, the error is related to trying to access the variable at `$_POST['']`.
Some simple error checking should fix it:
```
<?php
[..]
if ( isset( $_POST['myusername'] ) && isset( $_POST['mypassword'] ) ) {
// username and password sent from form
$myusername=$_POST['myusername'];
$mypas... | It's the html part you may check. you must name your username input "myusername" since you try to access it by using
```
$myusername=$_POST['myusername'];
```
you must have this on the html code
```
<input type="text" name="myusername" >
``` |
11,680,774 | I tried to find another question with the answer to this but I've had no luck. My question is basically...will this work?
```
$insert_tweets = "INSERT INTO tweets (
'id',
'created_at',
'from_user_id',
'profile_image',
'from_user',
'from_user_name',
'text'
) VALUES (
{$user_data[$i]["id"]},
{$user_... | 2012/07/27 | [
"https://Stackoverflow.com/questions/11680774",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/738201/"
] | ```
for($i=0;$i<count($user_data);$i++){
$insert_tweets = "INSERT INTO tweets ('id','created_at','from_user_id','profile_image','from_user','from_user_name','text') VALUES ({$user_data[$i]["id"]},{$user_data[$i]["created_at"]},{$user_data[$i]["from_user_id"]},{$user_data[$i]["profile_image"]},{$user... | Yes, it will work, but the best way to do this would be to use PDO.
You can create nameless parameters in your prepare statement and then just pass in a array to bind values to those params.
```
$data = array('val1', 'val2');
$query = $db->prepare("INSERT INTO table (col1, col2) VALUES (? , ?)");
$query->execute($dat... |
11,680,774 | I tried to find another question with the answer to this but I've had no luck. My question is basically...will this work?
```
$insert_tweets = "INSERT INTO tweets (
'id',
'created_at',
'from_user_id',
'profile_image',
'from_user',
'from_user_name',
'text'
) VALUES (
{$user_data[$i]["id"]},
{$user_... | 2012/07/27 | [
"https://Stackoverflow.com/questions/11680774",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/738201/"
] | ```
for($i=0;$i<count($user_data);$i++){
$insert_tweets = "INSERT INTO tweets ('id','created_at','from_user_id','profile_image','from_user','from_user_name','text') VALUES ({$user_data[$i]["id"]},{$user_data[$i]["created_at"]},{$user_data[$i]["from_user_id"]},{$user_data[$i]["profile_image"]},{$user... | Here is my suggestion on sanitizing your array:
What i do is create a basic function for sanitizing data:
```
function array_sanitize(&$item){
$item = mysql_real_escape_string($item);
}
```
Then you can use the `array_walk()` to sanitize your array with your new function. ([php manual refrence](http://php.net/m... |
11,680,774 | I tried to find another question with the answer to this but I've had no luck. My question is basically...will this work?
```
$insert_tweets = "INSERT INTO tweets (
'id',
'created_at',
'from_user_id',
'profile_image',
'from_user',
'from_user_name',
'text'
) VALUES (
{$user_data[$i]["id"]},
{$user_... | 2012/07/27 | [
"https://Stackoverflow.com/questions/11680774",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/738201/"
] | Yes, it will work, but the best way to do this would be to use PDO.
You can create nameless parameters in your prepare statement and then just pass in a array to bind values to those params.
```
$data = array('val1', 'val2');
$query = $db->prepare("INSERT INTO table (col1, col2) VALUES (? , ?)");
$query->execute($dat... | Here is my suggestion on sanitizing your array:
What i do is create a basic function for sanitizing data:
```
function array_sanitize(&$item){
$item = mysql_real_escape_string($item);
}
```
Then you can use the `array_walk()` to sanitize your array with your new function. ([php manual refrence](http://php.net/m... |
23,208,700 | I'm doing an app using Laravel, and I'm doing a login system.
In login I don't have any problem, but in logout the browser gets an error
```
Whoops, looks like something went wrong.
```
My login function
```
public function postSignin() {
if (Auth::attempt(array('email'=>Input::get('email'), 'password'=>Input::... | 2014/04/22 | [
"https://Stackoverflow.com/questions/23208700",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3329124/"
] | If you are using Laravel version > 4.1.25 you may be missing the remember\_token field on the users table.
see: <http://laravel.com/docs/upgrade#upgrade-4.1.26>
Laravel requires "nullable remember\_token of VARCHAR(100), TEXT, or equivalent to your users table." | i hope to be helpful giving you this link to a package with build-in authentication signup and admin panel with permission handling.
Fully customizable: <https://github.com/intrip/laravel-authentication-acl> |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.