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 |
|---|---|---|---|---|---|
43,144,164 | I need to output lots of different datasets to different text files. The datasets share some common variables that need to be output but also have quite a lot of different ones. I have loaded these different ones into a macro variable separated by blanks so that I can macroize this.
So I created a macro which loops ov... | 2017/03/31 | [
"https://Stackoverflow.com/questions/43144164",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4235461/"
] | Do not include quotes around the list of variable names.
```
put a b c d &vars ;
```
There should not be any limit to the number of variables you can output, but if the length of the output line gets too long SAS will wrap to a new line. The default line length is currently 32,767 (but older versions of SAS use 256... | I would tackle this but having 1 put statement per variable. Use the `@` modifier so that you don't get a new line.
For example:
```
data test;
a=1;
b=2;
c=3;
output;
output;
run;
data _null_;
set test;
put a @;
put b @;
put c @;
put;
run;
```
Outputs this to the log:
>
>
> ```
> 800 data _null_;
> 801 set te... |
43,144,164 | I need to output lots of different datasets to different text files. The datasets share some common variables that need to be output but also have quite a lot of different ones. I have loaded these different ones into a macro variable separated by blanks so that I can macroize this.
So I created a macro which loops ov... | 2017/03/31 | [
"https://Stackoverflow.com/questions/43144164",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4235461/"
] | Do not include quotes around the list of variable names.
```
put a b c d &vars ;
```
There should not be any limit to the number of variables you can output, but if the length of the output line gets too long SAS will wrap to a new line. The default line length is currently 32,767 (but older versions of SAS use 256... | Not sure why you're talking about quoted strings: you would not quote the &vars argument.
```
put a b c d &vars;
```
not
```
put a b c d "&vars";
```
There's a limit there, but it's much higher (64k).
That said, I would do this in a data driven fashion with `CALL EXECUTE`. This is pretty simple and does it all... |
622 | While at lunch with my lab group we got into discussion of the different types of scattering phenomenon that we encounter in everyday life and physical experiments. We ended up listing about a dozen or so types of scattering that we see constantly, but I left unfulfilled.
I want to compile a list of scattering phenome... | 2010/11/12 | [
"https://physics.stackexchange.com/questions/622",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/95/"
] | The obvious answer is their mass, accelerating a subatomic particle to relativistic velocity takes many orders of magnitude less energy than accelerating a macroscopic particle.
More subtly, we can only accelerate subatomic particles that we can manipulate with electromagnetic fields, nobody has a proposed viable expe... | How about Newton's law $F=ma$? The force needed to accelerate 1 kg is 27 orders of magnitude ($10^{27}$) bigger then to accelerate a proton. |
622 | While at lunch with my lab group we got into discussion of the different types of scattering phenomenon that we encounter in everyday life and physical experiments. We ended up listing about a dozen or so types of scattering that we see constantly, but I left unfulfilled.
I want to compile a list of scattering phenome... | 2010/11/12 | [
"https://physics.stackexchange.com/questions/622",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/95/"
] | How about Newton's law $F=ma$? The force needed to accelerate 1 kg is 27 orders of magnitude ($10^{27}$) bigger then to accelerate a proton. | It's not particularly hard to accelerate anything, it just requires an energy source and time.
The problems are merely practical:
* To go really fast you require a large vacuum. So in the case of particles we have a 27km underground tunnel (LHC) and in the case of space probes we have space itself.
* In the case of p... |
622 | While at lunch with my lab group we got into discussion of the different types of scattering phenomenon that we encounter in everyday life and physical experiments. We ended up listing about a dozen or so types of scattering that we see constantly, but I left unfulfilled.
I want to compile a list of scattering phenome... | 2010/11/12 | [
"https://physics.stackexchange.com/questions/622",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/95/"
] | How about Newton's law $F=ma$? The force needed to accelerate 1 kg is 27 orders of magnitude ($10^{27}$) bigger then to accelerate a proton. | The following formula is very self-explained:
$m=\frac{m\_{0}}{\sqrt{1-v^{2}/c^{2}}}$
So, as an object go faster, its mass increases, and it is more difficult to accelerate it. Mass tends to infinity when you approach to the speed of light. Thus, only massless particles can go so fast! |
622 | While at lunch with my lab group we got into discussion of the different types of scattering phenomenon that we encounter in everyday life and physical experiments. We ended up listing about a dozen or so types of scattering that we see constantly, but I left unfulfilled.
I want to compile a list of scattering phenome... | 2010/11/12 | [
"https://physics.stackexchange.com/questions/622",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/95/"
] | The obvious answer is their mass, accelerating a subatomic particle to relativistic velocity takes many orders of magnitude less energy than accelerating a macroscopic particle.
More subtly, we can only accelerate subatomic particles that we can manipulate with electromagnetic fields, nobody has a proposed viable expe... | It's not particularly hard to accelerate anything, it just requires an energy source and time.
The problems are merely practical:
* To go really fast you require a large vacuum. So in the case of particles we have a 27km underground tunnel (LHC) and in the case of space probes we have space itself.
* In the case of p... |
622 | While at lunch with my lab group we got into discussion of the different types of scattering phenomenon that we encounter in everyday life and physical experiments. We ended up listing about a dozen or so types of scattering that we see constantly, but I left unfulfilled.
I want to compile a list of scattering phenome... | 2010/11/12 | [
"https://physics.stackexchange.com/questions/622",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/95/"
] | The obvious answer is their mass, accelerating a subatomic particle to relativistic velocity takes many orders of magnitude less energy than accelerating a macroscopic particle.
More subtly, we can only accelerate subatomic particles that we can manipulate with electromagnetic fields, nobody has a proposed viable expe... | The following formula is very self-explained:
$m=\frac{m\_{0}}{\sqrt{1-v^{2}/c^{2}}}$
So, as an object go faster, its mass increases, and it is more difficult to accelerate it. Mass tends to infinity when you approach to the speed of light. Thus, only massless particles can go so fast! |
622 | While at lunch with my lab group we got into discussion of the different types of scattering phenomenon that we encounter in everyday life and physical experiments. We ended up listing about a dozen or so types of scattering that we see constantly, but I left unfulfilled.
I want to compile a list of scattering phenome... | 2010/11/12 | [
"https://physics.stackexchange.com/questions/622",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/95/"
] | It's not particularly hard to accelerate anything, it just requires an energy source and time.
The problems are merely practical:
* To go really fast you require a large vacuum. So in the case of particles we have a 27km underground tunnel (LHC) and in the case of space probes we have space itself.
* In the case of p... | The following formula is very self-explained:
$m=\frac{m\_{0}}{\sqrt{1-v^{2}/c^{2}}}$
So, as an object go faster, its mass increases, and it is more difficult to accelerate it. Mass tends to infinity when you approach to the speed of light. Thus, only massless particles can go so fast! |
48,084,981 | My react router works fine.. but I would like get the date from the `Path` as the `title` which expects a string.
```
<Route exact path="/meeting/:date"
breadcrumb="Meetings"
title={DATE}
component={(props) => (
<FooComponent
date={props.ma... | 2018/01/03 | [
"https://Stackoverflow.com/questions/48084981",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8686341/"
] | In your initial component, set the path that loads your route. By adding /:date to the end of your route, that string can be accessed by calling props.match.params.date inside that routes component.
`<Route exact path="/meeting/:date" component={DateComponent} />`
In the component that the route renders, use `props.m... | I use [Helmet](https://github.com/nfl/react-helmet) for that, it allows you to update the title, meta, scripts and basically anything related to the header.
Once you install it, just add the following code to `FooComponent` or to a common parent component.
```
<Helmet>
<title>{props.match.params.date}</title>
</Hel... |
48,084,981 | My react router works fine.. but I would like get the date from the `Path` as the `title` which expects a string.
```
<Route exact path="/meeting/:date"
breadcrumb="Meetings"
title={DATE}
component={(props) => (
<FooComponent
date={props.ma... | 2018/01/03 | [
"https://Stackoverflow.com/questions/48084981",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8686341/"
] | There is a new api in `react-router-dom 5.1`
<https://github.com/ReactTraining/react-router/releases/tag/v5.1.0>
```
import {useParams} from "react-router-dom";
function MyComponent(){
const {date} = useParams()
}
``` | I use [Helmet](https://github.com/nfl/react-helmet) for that, it allows you to update the title, meta, scripts and basically anything related to the header.
Once you install it, just add the following code to `FooComponent` or to a common parent component.
```
<Helmet>
<title>{props.match.params.date}</title>
</Hel... |
3,391,576 | How can I implement [prepend](http://api.jquery.com/prepend/) and [append](http://api.jquery.com/append/) with regular JavaScript without using jQuery? | 2010/08/02 | [
"https://Stackoverflow.com/questions/3391576",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/342984/"
] | Here's a snippet to get you going:
```
theParent = document.getElementById("theParent");
theKid = document.createElement("div");
theKid.innerHTML = 'Are we there yet?';
// append theKid to the end of theParent
theParent.appendChild(theKid);
// prepend theKid to the beginning of theParent
theParent.insertBefore(theKi... | If you want to insert a raw HTML string no matter how complex, you can use:
[`insertAdjacentHTML`](https://developer.mozilla.org/en-US/docs/Web/API/Element.insertAdjacentHTML), with appropriate first argument:
>
> **'beforebegin'**
> Before the element itself.
> **'afterbegin'**
> Just inside the element, before ... |
3,391,576 | How can I implement [prepend](http://api.jquery.com/prepend/) and [append](http://api.jquery.com/append/) with regular JavaScript without using jQuery? | 2010/08/02 | [
"https://Stackoverflow.com/questions/3391576",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/342984/"
] | Here's a snippet to get you going:
```
theParent = document.getElementById("theParent");
theKid = document.createElement("div");
theKid.innerHTML = 'Are we there yet?';
// append theKid to the end of theParent
theParent.appendChild(theKid);
// prepend theKid to the beginning of theParent
theParent.insertBefore(theKi... | In order to simplify your life you can extend the `HTMLElement` object. It might not work for older browsers, but definitely makes your life easier:
```
HTMLElement = typeof(HTMLElement) != 'undefined' ? HTMLElement : Element;
HTMLElement.prototype.prepend = function(element) {
if (this.firstChild) {
retu... |
3,391,576 | How can I implement [prepend](http://api.jquery.com/prepend/) and [append](http://api.jquery.com/append/) with regular JavaScript without using jQuery? | 2010/08/02 | [
"https://Stackoverflow.com/questions/3391576",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/342984/"
] | If you want to insert a raw HTML string no matter how complex, you can use:
[`insertAdjacentHTML`](https://developer.mozilla.org/en-US/docs/Web/API/Element.insertAdjacentHTML), with appropriate first argument:
>
> **'beforebegin'**
> Before the element itself.
> **'afterbegin'**
> Just inside the element, before ... | This is not best way to do it but if anyone wants to insert an element before everything, here is a way.
```
var newElement = document.createElement("div");
var element = document.getElementById("targetelement");
element.innerHTML = '<div style="display:none !important;"></div>' + element.innerHTML;
var referanceEleme... |
3,391,576 | How can I implement [prepend](http://api.jquery.com/prepend/) and [append](http://api.jquery.com/append/) with regular JavaScript without using jQuery? | 2010/08/02 | [
"https://Stackoverflow.com/questions/3391576",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/342984/"
] | Perhaps you're asking about the [DOM methods](http://www.w3.org/TR/DOM-Level-3-Core/core.html#ID-184E7107) `appendChild` and `insertBefore`.
```
parentNode.insertBefore(newChild, refChild)
```
>
> Inserts the node `newChild` as a child of `parentNode` before the
> existing child node `refChild`. (Returns `newChild... | I added this on my project and it seems to work:
```
HTMLElement.prototype.prependHtml = function (element) {
const div = document.createElement('div');
div.innerHTML = element;
this.insertBefore(div, this.firstChild);
};
HTMLElement.prototype.appendHtml = function (element) {
const div = document.cre... |
3,391,576 | How can I implement [prepend](http://api.jquery.com/prepend/) and [append](http://api.jquery.com/append/) with regular JavaScript without using jQuery? | 2010/08/02 | [
"https://Stackoverflow.com/questions/3391576",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/342984/"
] | I added this on my project and it seems to work:
```
HTMLElement.prototype.prependHtml = function (element) {
const div = document.createElement('div');
div.innerHTML = element;
this.insertBefore(div, this.firstChild);
};
HTMLElement.prototype.appendHtml = function (element) {
const div = document.cre... | ```
var insertedElement = parentElement.insertBefore(newElement, referenceElement);
```
If referenceElement is null, or undefined, newElement is inserted at the end of the list of child nodes.
```
insertedElement The node being inserted, that is newElement
parentElement The parent of the newly inserted node.
newElem... |
3,391,576 | How can I implement [prepend](http://api.jquery.com/prepend/) and [append](http://api.jquery.com/append/) with regular JavaScript without using jQuery? | 2010/08/02 | [
"https://Stackoverflow.com/questions/3391576",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/342984/"
] | If you want to insert a raw HTML string no matter how complex, you can use:
[`insertAdjacentHTML`](https://developer.mozilla.org/en-US/docs/Web/API/Element.insertAdjacentHTML), with appropriate first argument:
>
> **'beforebegin'**
> Before the element itself.
> **'afterbegin'**
> Just inside the element, before ... | I added this on my project and it seems to work:
```
HTMLElement.prototype.prependHtml = function (element) {
const div = document.createElement('div');
div.innerHTML = element;
this.insertBefore(div, this.firstChild);
};
HTMLElement.prototype.appendHtml = function (element) {
const div = document.cre... |
3,391,576 | How can I implement [prepend](http://api.jquery.com/prepend/) and [append](http://api.jquery.com/append/) with regular JavaScript without using jQuery? | 2010/08/02 | [
"https://Stackoverflow.com/questions/3391576",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/342984/"
] | You didn't give us much to go on here, but I think you're just asking how to add content to the beginning or end of an element?
If so here's how you can do it pretty easily:
```
//get the target div you want to append/prepend to
var someDiv = document.getElementById("targetDiv");
//append text
someDiv.innerHTML += "A... | ```
var insertedElement = parentElement.insertBefore(newElement, referenceElement);
```
If referenceElement is null, or undefined, newElement is inserted at the end of the list of child nodes.
```
insertedElement The node being inserted, that is newElement
parentElement The parent of the newly inserted node.
newElem... |
3,391,576 | How can I implement [prepend](http://api.jquery.com/prepend/) and [append](http://api.jquery.com/append/) with regular JavaScript without using jQuery? | 2010/08/02 | [
"https://Stackoverflow.com/questions/3391576",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/342984/"
] | If you want to insert a raw HTML string no matter how complex, you can use:
[`insertAdjacentHTML`](https://developer.mozilla.org/en-US/docs/Web/API/Element.insertAdjacentHTML), with appropriate first argument:
>
> **'beforebegin'**
> Before the element itself.
> **'afterbegin'**
> Just inside the element, before ... | **In 2017** I know for Edge 15 and IE 12, the prepend method isn't included as a property for Div elements, but if anyone needs a quick reference to polyfill a function I made this:
```
HTMLDivElement.prototype.prepend = (node, ele)=>{
try { node.insertBefore(ele ,node.children[0]);}
... |
3,391,576 | How can I implement [prepend](http://api.jquery.com/prepend/) and [append](http://api.jquery.com/append/) with regular JavaScript without using jQuery? | 2010/08/02 | [
"https://Stackoverflow.com/questions/3391576",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/342984/"
] | You didn't give us much to go on here, but I think you're just asking how to add content to the beginning or end of an element?
If so here's how you can do it pretty easily:
```
//get the target div you want to append/prepend to
var someDiv = document.getElementById("targetDiv");
//append text
someDiv.innerHTML += "A... | In order to simplify your life you can extend the `HTMLElement` object. It might not work for older browsers, but definitely makes your life easier:
```
HTMLElement = typeof(HTMLElement) != 'undefined' ? HTMLElement : Element;
HTMLElement.prototype.prepend = function(element) {
if (this.firstChild) {
retu... |
3,391,576 | How can I implement [prepend](http://api.jquery.com/prepend/) and [append](http://api.jquery.com/append/) with regular JavaScript without using jQuery? | 2010/08/02 | [
"https://Stackoverflow.com/questions/3391576",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/342984/"
] | In order to simplify your life you can extend the `HTMLElement` object. It might not work for older browsers, but definitely makes your life easier:
```
HTMLElement = typeof(HTMLElement) != 'undefined' ? HTMLElement : Element;
HTMLElement.prototype.prepend = function(element) {
if (this.firstChild) {
retu... | This is not best way to do it but if anyone wants to insert an element before everything, here is a way.
```
var newElement = document.createElement("div");
var element = document.getElementById("targetelement");
element.innerHTML = '<div style="display:none !important;"></div>' + element.innerHTML;
var referanceEleme... |
17,934,074 | Is there a way to use "rsvg-convert" to convert either a multi page SVG or multi SVG files to a single multi page PDF?
I am using the command:
```
/usr/bin/rsvg-convert -f pdf -o out.pdf in.svg
``` | 2013/07/29 | [
"https://Stackoverflow.com/questions/17934074",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1171852/"
] | you can provide a list of .svg files when converting to pdf.
```
rsvg-convert -f pdf -o out.pdf file1.svg file2.svg file3.svg
```
alternatively you can convert all .svg files in a folder to 1 pdf like this:
```
rsvg-convert -f pdf -o out.pdf *.svg
``` | `rsvg-convert` accomplishes a multi-SVG to single-PDF task [see @holger-will's answer](https://stackoverflow.com/a/32633311/). However, it resizes **all** of the PDF pages to the same size as the first SVG file (regardless if the second, third, etc. are larger). This is not suitable for combining an assortment of varie... |
61,866 | They are very small and look like the earliest stages of thrip larva, but I have never seen an adult thrip, even though I see these guys often, so I don't think that's what they are. They walk on legs and have antennas. I find them in the bottom of tropical plant pots inside, and also in the bottom of veggie pots on th... | 2022/02/20 | [
"https://gardening.stackexchange.com/questions/61866",
"https://gardening.stackexchange.com",
"https://gardening.stackexchange.com/users/29668/"
] | After the top part of the central leader of a Leyland spruce is broken, the tree will grow multiple leaders. These leaders compete for dominance, but often the result is several leaders growing alongside. This leads to the loss of the slender shape of the tree, and result in a V-shaped or further irregular shaped tree,... | It will develop another leader, maybe a few, and continue grow. |
29,133,088 | Vehicle
```
+--------+--------+-----------+
| regNo | make | model |
+------- +--------+-----------+
| SM56ED | BMW | 3 Series |
+--------+--------+-----------+
| GH45EM | Audi | A3 |
+--------+--------+-----------+
| LM33ZG | Toyota | Yaris |
+-----... | 2015/03/18 | [
"https://Stackoverflow.com/questions/29133088",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3782813/"
] | Those are some very good questions. Let's tackle each point one by one:
>
> My question is what actually are these keypoints?
>
>
>
Keypoints are the same thing as interest points. They are spatial locations, or points in the image that define what is **interesting** or what **stand out** in the image. Interest p... | I'm not as familiar with SURF, but I can tell you about SIFT, which SURF is based on. I provided a few notes about SURF at the end, but I don't know all the details.
---
[SIFT](http://en.wikipedia.org/wiki/Scale-invariant_feature_transform) aims to find highly-distinctive locations (or *keypoints*) in an image. The l... |
50,120,713 | So I have the following code
```
var processed;
fs.readFile(path, 'utf-8', function(err, data) {
processed = false;
//checking if text is in file and setting flag
processed = true;
});
if (processed == true) {
try {
var fname = path.substring(path.lastIndexOf("\\") + 1);
fs.moveSync(pa... | 2018/05/01 | [
"https://Stackoverflow.com/questions/50120713",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4453962/"
] | ```
int rec(int n)
{
int sum = 0;
if(n<=0)
return 0;
else if ((n%10)%2==0)
sum = rec(n/10)+1;
else
sum = rec(n/10);
return sum;
}
```
Maybe something like this :) | seems like you're trying to count the even digits in a number
```
int countEven(int n){
if(n == 0)
return 0; //base case
if (n<10)
return !(n%2);
return !(n%2)+countEven(n/10);
}
``` |
50,120,713 | So I have the following code
```
var processed;
fs.readFile(path, 'utf-8', function(err, data) {
processed = false;
//checking if text is in file and setting flag
processed = true;
});
if (processed == true) {
try {
var fname = path.substring(path.lastIndexOf("\\") + 1);
fs.moveSync(pa... | 2018/05/01 | [
"https://Stackoverflow.com/questions/50120713",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4453962/"
] | ```
int rec(int n)
{
int sum = 0;
if(n<=0)
return 0;
else if ((n%10)%2==0)
sum = rec(n/10)+1;
else
sum = rec(n/10);
return sum;
}
```
Maybe something like this :) | looks like a similar question i received from QC.
to make it recursive, you must have the function calling onto itself. Ask how you can make the the input simpler and have some sort of base so that the function doesn't break.
```
int countEven(int number) {
if (x <= 0) return 0;
if (x % 2 == 0) {
retur... |
50,120,713 | So I have the following code
```
var processed;
fs.readFile(path, 'utf-8', function(err, data) {
processed = false;
//checking if text is in file and setting flag
processed = true;
});
if (processed == true) {
try {
var fname = path.substring(path.lastIndexOf("\\") + 1);
fs.moveSync(pa... | 2018/05/01 | [
"https://Stackoverflow.com/questions/50120713",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4453962/"
] | For counting the **even digits** of an integer **base 10** you can simplify the function to the following
```
int countEven(int n)
{
if (n != 0) return !(n % 2) + countEven(n/10);
else return 0;
}
```
This expands as follows. Assume `n = 258`:
```
countEven(258) =
1 + countEven(2... | seems like you're trying to count the even digits in a number
```
int countEven(int n){
if(n == 0)
return 0; //base case
if (n<10)
return !(n%2);
return !(n%2)+countEven(n/10);
}
``` |
50,120,713 | So I have the following code
```
var processed;
fs.readFile(path, 'utf-8', function(err, data) {
processed = false;
//checking if text is in file and setting flag
processed = true;
});
if (processed == true) {
try {
var fname = path.substring(path.lastIndexOf("\\") + 1);
fs.moveSync(pa... | 2018/05/01 | [
"https://Stackoverflow.com/questions/50120713",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4453962/"
] | For counting the **even digits** of an integer **base 10** you can simplify the function to the following
```
int countEven(int n)
{
if (n != 0) return !(n % 2) + countEven(n/10);
else return 0;
}
```
This expands as follows. Assume `n = 258`:
```
countEven(258) =
1 + countEven(2... | looks like a similar question i received from QC.
to make it recursive, you must have the function calling onto itself. Ask how you can make the the input simpler and have some sort of base so that the function doesn't break.
```
int countEven(int number) {
if (x <= 0) return 0;
if (x % 2 == 0) {
retur... |
50,120,713 | So I have the following code
```
var processed;
fs.readFile(path, 'utf-8', function(err, data) {
processed = false;
//checking if text is in file and setting flag
processed = true;
});
if (processed == true) {
try {
var fname = path.substring(path.lastIndexOf("\\") + 1);
fs.moveSync(pa... | 2018/05/01 | [
"https://Stackoverflow.com/questions/50120713",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4453962/"
] | seems like you're trying to count the even digits in a number
```
int countEven(int n){
if(n == 0)
return 0; //base case
if (n<10)
return !(n%2);
return !(n%2)+countEven(n/10);
}
``` | looks like a similar question i received from QC.
to make it recursive, you must have the function calling onto itself. Ask how you can make the the input simpler and have some sort of base so that the function doesn't break.
```
int countEven(int number) {
if (x <= 0) return 0;
if (x % 2 == 0) {
retur... |
21,472,341 | I have no idea what's going on. I usually have simple sign in pages like this done very quickly but this one isn't working and I cannot spot the error.
```
<?php
$con=mysql_connect("db_server","db_user","db_pass","db");
if (!$con)
{
echo "Failed to connect to MySQL: " . mysql_error();
}
$username = $_GET['username'... | 2014/01/31 | [
"https://Stackoverflow.com/questions/21472341",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1159861/"
] | You have a major error in your logic, for one. If there is an error connecting to MySQL, you print the error, but yet proceed to query the broken connection - you are also not selecting a database.
Also, this approach is for PHP4. Unless you are stuck in PHP4 on this project, moving into the PHP5 world would be a good... | Try this one.
```
<?php
$con=mysql_connect("db_server","db_user","db_pass");
mysql_select_db("db");
if (!$con)
{
echo "Failed to connect to MySQL: " . mysql_error();
}
$username = $_GET['username'];
$password = $_GET['password'];
$query=mysql_query("SELECT username FROM users");
if($query){
$row = mysql_fetch... |
18,725 | How far should lay followers go, to help others?
There is no denying that we all have innate desire to ease suffering of others, but when it’s done without right understanding it may lead to a higher suffering to the assisted person. On the other had if it’s done with right understanding and with the aim to assist the... | 2017/01/01 | [
"https://buddhism.stackexchange.com/questions/18725",
"https://buddhism.stackexchange.com",
"https://buddhism.stackexchange.com/users/-1/"
] | The most important things is to get [Panna](https://en.wikipedia.org/wiki/Praj%C3%B1%C4%81_(Buddhism)) yourself as much as you can. You can achieve it by either reading Tripitaka or consulting monks about wholesome and unwholesome acts or both.
Passionate or compassionate about others is generally speaking wholesome a... | >
> *...by preventing it we could be hindering the person from realizing the first noble truth.*
>
>
>
It is very difficult to actually prevent another person from suffering. Generally, people are destined to suffering because of their strong wrong views & opinions. Otherwise, they have a positive intuition or wis... |
45,407,684 | Im trying to develop an angular 2 app that routes to a different component once a specific condition is met, for this i used the this.router.navigate method but it doesnt seem to execute as it keeps showing the "Cannot read property 'navigate' of undefined" error. will appreciate any help on this :)
The specific compo... | 2017/07/31 | [
"https://Stackoverflow.com/questions/45407684",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7257759/"
] | It's because `this` in the `frame` is no longer points to the component. Use the following:
```
var id = setInterval(()=>{ frame() }, 20);
```
Read [this](https://stackoverflow.com/a/44739585/2545680) and [this](https://stackoverflow.com/questions/20279484/how-to-access-the-correct-this-inside-a-callback/20279485#2... | You can store `this` into a variable:
`var that = this`;
inside the function you can use as
`that.router.navigate(['/details']);`
Hope this helps :) |
144,242 | I am trying to install some packes on my machine running CentOS 5.5 but when i run ./config or ./Configure, I am returned:
>
> -bash: ./config: /bin/sh: bad interpreter: Permission denied
>
>
> -bash: ./Configure: Permission denied
>
>
>
What do I need to change to correct the issue? I am connected as the root ... | 2010/05/21 | [
"https://serverfault.com/questions/144242",
"https://serverfault.com",
"https://serverfault.com/users/43197/"
] | It looks like you got it right the first time with `./config`
The problem seems to lie in `/bin/sh`; you may try using `bash ./config` instead, or otherwise fix `/bin/sh`'s permissions or ownership.
Out of curiosity, can you do: `ls -l /bin/sh`\* for us?
Is the partition or drive where you are trying to build this m... | If you haven't gotten it resolved already... Are you trying to install as root? You should be. Otherwise, you might 'sudo'.
Others have suggested that the permissions problem is on the /bin/sh executable, but if that isn't it, make sure you can execute config / Configure (as appropriate). To do this, look at the file... |
144,242 | I am trying to install some packes on my machine running CentOS 5.5 but when i run ./config or ./Configure, I am returned:
>
> -bash: ./config: /bin/sh: bad interpreter: Permission denied
>
>
> -bash: ./Configure: Permission denied
>
>
>
What do I need to change to correct the issue? I am connected as the root ... | 2010/05/21 | [
"https://serverfault.com/questions/144242",
"https://serverfault.com",
"https://serverfault.com/users/43197/"
] | How about just `ls -l` inside the openssl directory, **not** `ls -l /bin/ls` like *jrod* wrongly suggested.
Either set the executable permission on the file your are trying to run with `chmod` like so:
```
chmod +x config
```
the run it:
```
./config
```
or just run it directly with the shell like so:
```
sh .... | If you haven't gotten it resolved already... Are you trying to install as root? You should be. Otherwise, you might 'sudo'.
Others have suggested that the permissions problem is on the /bin/sh executable, but if that isn't it, make sure you can execute config / Configure (as appropriate). To do this, look at the file... |
28,375,699 | How can I do pattern matching to match all elements up to the last element?
For example, suppose I have this unapplySeq:
```
object MyObject {
def unapplySeq(money: String): Option[List[Char]] = {
val amount = money.trim.toList
if (amount.isEmpty) None
else
Some(amount)
}
}
```
And I try the f... | 2015/02/06 | [
"https://Stackoverflow.com/questions/28375699",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/141516/"
] | This would be pretty straightforward with Regex
```
def currency(s: String) {
val dollar = """\$(.+)""".r
val euro = """(.+)€""".r
s match {
case dollar(amt) => println(amt + " dollars")
case euro(amt) => println(amt + " euros")
case _ => println("unknown currency")
}
}
scala> currency("$1346.00... | Possibly, regexes are overkill to express "startsWith" and "endsWith".
A simple extractor does the job, but listifying Strings to do it is a notch below stringifying Lists.
```
scala> object Currency { def unapply(s: String): Option[(Char, String)] =
| if (s.head == '$') Some('$',s.tail)
| else if (s.last =... |
50,252,048 | create table pairs( number a,number b)
where the data is
```
1,1
1,2
1,3
2,1
2,2
2,3
3,1
3,2
3,3
```
etc.
what query gives me the unique pairs?
With this i mean:
```
1,2 or 2,1
1,3 3,1
2,3 3,2
``` | 2018/05/09 | [
"https://Stackoverflow.com/questions/50252048",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9745695/"
] | You may use a least/greatest trick here:
```
SELECT
LEAST(a, b), GREATEST(a, b)
FROM yourTable
WHERE a <> b
GROUP BY
LEAST(a, b), GREATEST(a, b);
```
To see why this works, consider the two pairs `(1, 2)` and `(2, 1)`. In both cases, the least resolves to `1` and the greatest to `2`, so both pairs would be r... | ```
SELECT sub.output FROM
(
SELECT CONCAT(a,b, ' or ',
b,a ) output,
ASCII(a)+ASCII(b) asci
FROM tbl_t1 WHERE a!=b
) sub GROUP BY sub.asci;
``` |
50,252,048 | create table pairs( number a,number b)
where the data is
```
1,1
1,2
1,3
2,1
2,2
2,3
3,1
3,2
3,3
```
etc.
what query gives me the unique pairs?
With this i mean:
```
1,2 or 2,1
1,3 3,1
2,3 3,2
``` | 2018/05/09 | [
"https://Stackoverflow.com/questions/50252048",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9745695/"
] | I think this is the simplest solution. If it can be guaranteed that there are no duplicated pairs then the `GROUP BY` isn't needed.
```
SELECT a, b
FROM pairs
WHERE a < b
GROUP BY a, b
```
Output:
```
a b
1 2
1 3
2 3
```
You can always change the `<` to `>` if you want the alternate output:
```
a b... | ```
SELECT sub.output FROM
(
SELECT CONCAT(a,b, ' or ',
b,a ) output,
ASCII(a)+ASCII(b) asci
FROM tbl_t1 WHERE a!=b
) sub GROUP BY sub.asci;
``` |
7,201,221 | I'm trying to re-create a few elements I've seen online and I've been using Element Inspector but can't seem to figure out why this a href element is loading outside of my modalHeader class.
Here's some HTML:
```
<div id="modalContainer">
<div class="fakeModal">
<div class="modalHeader">
<h2>Fake Modal... | 2011/08/26 | [
"https://Stackoverflow.com/questions/7201221",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/602210/"
] | You've set the link to be position absolute, not relative to it's parent container. Remove the position, and change the top and right to margins. | An absolute position always refers to the element above which is positioned relative or absolute. If there isn't one, it refers to the body. Try to change `position: absolute;` to `position: relative;` or define the modalHeader as `position: relative;`. |
7,201,221 | I'm trying to re-create a few elements I've seen online and I've been using Element Inspector but can't seem to figure out why this a href element is loading outside of my modalHeader class.
Here's some HTML:
```
<div id="modalContainer">
<div class="fakeModal">
<div class="modalHeader">
<h2>Fake Modal... | 2011/08/26 | [
"https://Stackoverflow.com/questions/7201221",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/602210/"
] | @zack; you give `position: absolute;` to your `a` tag so, give `position: relative;` to your parent div `modalHeader` that's work for you .
CSS:
```
.modalHeader {position: relative;}
```
for more read this article <http://css-tricks.com/791-absolute-positioning-inside-relative-positioning/> | You've set the link to be position absolute, not relative to it's parent container. Remove the position, and change the top and right to margins. |
7,201,221 | I'm trying to re-create a few elements I've seen online and I've been using Element Inspector but can't seem to figure out why this a href element is loading outside of my modalHeader class.
Here's some HTML:
```
<div id="modalContainer">
<div class="fakeModal">
<div class="modalHeader">
<h2>Fake Modal... | 2011/08/26 | [
"https://Stackoverflow.com/questions/7201221",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/602210/"
] | @zack; you give `position: absolute;` to your `a` tag so, give `position: relative;` to your parent div `modalHeader` that's work for you .
CSS:
```
.modalHeader {position: relative;}
```
for more read this article <http://css-tricks.com/791-absolute-positioning-inside-relative-positioning/> | An absolute position always refers to the element above which is positioned relative or absolute. If there isn't one, it refers to the body. Try to change `position: absolute;` to `position: relative;` or define the modalHeader as `position: relative;`. |
7,080,781 | I want to run maven-replacer-plugin just before packaging war. I have find "prepare-package" phase but it triggered before war assembled and all resources copied, but I need to make changes when all resources copied and just before archive create. Is this possible in maven?
BTW, I use maven-2.2.1.
Thanks. | 2011/08/16 | [
"https://Stackoverflow.com/questions/7080781",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I have found answer in [maven replacer plugin WIKI](http://code.google.com/p/maven-replacer-plugin/wiki/UsageWithOtherPlugins). The trick is to make all things after war:exploded but then use `<useCache>true</useCache>` property in war plugin configuration. And war:war will use existing files and don't rewrite them. | If you mean you need to do something after webapp resources are copied, then no. The war plugin does that in the process of building the war, so you'd need to execute something inside the war plugin, which isn't going to happen without modifying the war plugin itself. |
26,780,453 | I am using JavaScript to resize and reposition page elements to fit the browser window. My code works perfectly in Chrome, Safari, and [Internet Explorer 9](https://en.wikipedia.org/wiki/Internet_Explorer_9), but breaks in Firefox. The console gives me two errors: *"TypeError: sidebar.style is undefined"* and *"TypeErr... | 2014/11/06 | [
"https://Stackoverflow.com/questions/26780453",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3988270/"
] | You don't show your code, but given the wording of your question and the title with "(div Id).style in console" I suspect you are trying to simply reference the elements directly in your JavaScript by using the ids as if they were variables. Some browsers do allow this, though it can cause problems if you also have var... | I ultimately resolved the issue by simply changing the ID of the div. Evidently Firefox disliked 'sidebar' as an ID for some reason. No other changes to the code were necessary. |
17,689,423 | I'm trying to set up a new WordPress site and can't get it to connect to the database.
To to try isolate the problem, I created a php file in the same directory as the WordPress app with the following code:
```
<?php
$mysqli = new mysqli('localhost:3306', 'root', 'somepassword', 'gazos');
if ($mysqli->connect_error)... | 2013/07/17 | [
"https://Stackoverflow.com/questions/17689423",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/433895/"
] | Replace localhost:3306 with 127.0.0.1.
When I asked this question on a wordpress forum, I was told my MySQL configuration was bad. When I asked about that problem on this forum, it was suggested that I try 127.0.0.1 in place of localhost:3306. That fixed the problem. I still don't know if my configuration is bad. | leave the port out on DB\_HOST.
`define('DB_HOST', 'localhost');`
Edit:
Try changing your mysql password and updating your wp-config.php.
Saw that [here](http://wordpress.org/support/topic/just-upgraded-to-php-54-and-site-doesnt-work). |
30,966,867 | I have a `Board` (a.k.a. `&mut Vec<Vec<Cell>>`) which I would like to update while iterating over it. The new value I want to update with is derived from a function which requires a `&Vec<Vec<Cell>>` to the collection I'm updating.
I have tried several things:
1. Use `board.iter_mut().enumerate()` and `row.iter_mut()... | 2015/06/21 | [
"https://Stackoverflow.com/questions/30966867",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1763669/"
] | >
> Is there a way that I could make this code update the board "in place"?
>
>
>
There exists a type specially made for situations such as these. It's coincidentally called [`std::cell::Cell`](https://doc.rust-lang.org/std/cell/struct.Cell.html). You're allowed to mutate the contents of a `Cell` even when it has ... | It entirely depends on your `next_gen` function. Assuming we know nothing about the function except its signature, the easiest way is to use indices:
```
fn step(board: &mut Board) {
for row_index in 0..board.len() {
for column_index in 0..board[row_index].len() {
let cell_next = next_gen((row_... |
56,101,929 | I'm creating a simple story game, where you have Description of the situation and also 2 actions. Next situation is depending on what is your choice.
Data storing class
'''
class StoryData {
```
var storyText: String
var answerA: String
var answerB: String
var nextStoryA: StoryData?
var nextStoryB: StoryData?
init(t... | 2019/05/12 | [
"https://Stackoverflow.com/questions/56101929",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6396849/"
] | Lambda functions that capture outside variables cannot be used as Win32 callbacks. They are not convertible to raw function pointers.
The solution in your case is to pass a pointer to something as the LPARAM parameter of EnumWindows(), which is passed to the callback.
```
class A {...};
A a;
EnumWindows([](HWND hwn... | >
> Any better solution i'm missing?
>
>
>
Well, yes, that NULL in the second parameter is passed back to the callback so you can easily use it to propagate local state.
```
HWND get_wallpaper_window()
{
HWND progman = FindWindow(L"ProgMan", NULL);
SendMessageTimeout(progman, 0x052C, 0, 0, SMTO_NORMAL... |
30,358,692 | I am trying to transfer a Google Doc that currently belongs to me and move it to the root of another user's Google Drive. Both account are in the same domain and I'm using a Service Account to access all users.
At first I tried doing this by modifying the permissions. This would give the second user access to the file... | 2015/05/20 | [
"https://Stackoverflow.com/questions/30358692",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2744119/"
] | OK, I figured it out. It looks like I was just using the wrong API. You have to first insert the new permission then you have to delete the old permission. This will send the file to the root of the new user's Drive.
```
# Insert new permission first
new_permission = {
'value': 'email_of_new_owner@mydomain.c... | Does it return any kind of error?
I don't think you can "move" the file like that. Try [file.insert](https://developers.google.com/drive/v2/reference/files/insert) to his drive then [delete](https://developers.google.com/drive/v2/reference/files/delete) from your own.
I have never heard of anyone trying to patch the... |
41,784 | I download lots of lectures from iTunes U. The problem is, they usually come with video and there is no audio-only version for many.
How can I, using any software available for Snow Leopard, free or paid, extract the audio from a series of video files and end up with a series of audio files?
Any ideas? | 2012/02/26 | [
"https://apple.stackexchange.com/questions/41784",
"https://apple.stackexchange.com",
"https://apple.stackexchange.com/users/1377/"
] | I suggest using [Max](http://sbooth.org/Max/) or [ffmpegx](http://www.ffmpegx.com/), which is a GUI for ffmpeg.
You can also use ffmpeg from the shell:
```
for f in *.mp4; do ffmpeg -i "$f" -vn -c copy "${f%mp4}m4a"; done
```
`-vn` (video none) removes video streams and `-c copy` disables re-encoding the audio. You... | Please try it with [VLC](http://www.videolan.org/), see [Extract Audio](http://wiki.videolan.org/Extract_audio) in the Videolan wiki. |
41,784 | I download lots of lectures from iTunes U. The problem is, they usually come with video and there is no audio-only version for many.
How can I, using any software available for Snow Leopard, free or paid, extract the audio from a series of video files and end up with a series of audio files?
Any ideas? | 2012/02/26 | [
"https://apple.stackexchange.com/questions/41784",
"https://apple.stackexchange.com",
"https://apple.stackexchange.com/users/1377/"
] | Please try it with [VLC](http://www.videolan.org/), see [Extract Audio](http://wiki.videolan.org/Extract_audio) in the Videolan wiki. | I use AudioHijack Pro it costs money though. I can rip audio from DVDs and Internet streams. |
41,784 | I download lots of lectures from iTunes U. The problem is, they usually come with video and there is no audio-only version for many.
How can I, using any software available for Snow Leopard, free or paid, extract the audio from a series of video files and end up with a series of audio files?
Any ideas? | 2012/02/26 | [
"https://apple.stackexchange.com/questions/41784",
"https://apple.stackexchange.com",
"https://apple.stackexchange.com/users/1377/"
] | I suggest using [Max](http://sbooth.org/Max/) or [ffmpegx](http://www.ffmpegx.com/), which is a GUI for ffmpeg.
You can also use ffmpeg from the shell:
```
for f in *.mp4; do ffmpeg -i "$f" -vn -c copy "${f%mp4}m4a"; done
```
`-vn` (video none) removes video streams and `-c copy` disables re-encoding the audio. You... | You can import the clip into iMovie, then export it as an AIF audio file using the iMovie Share menu's Quicktime export feature. Then you can import the AIF file into iTunes. Once it's in iTunes, you can create a much more compact MP3 version. All rather cumbersome. Too bad iTunes U doesn't just upload audio versions o... |
41,784 | I download lots of lectures from iTunes U. The problem is, they usually come with video and there is no audio-only version for many.
How can I, using any software available for Snow Leopard, free or paid, extract the audio from a series of video files and end up with a series of audio files?
Any ideas? | 2012/02/26 | [
"https://apple.stackexchange.com/questions/41784",
"https://apple.stackexchange.com",
"https://apple.stackexchange.com/users/1377/"
] | I suggest using [Max](http://sbooth.org/Max/) or [ffmpegx](http://www.ffmpegx.com/), which is a GUI for ffmpeg.
You can also use ffmpeg from the shell:
```
for f in *.mp4; do ffmpeg -i "$f" -vn -c copy "${f%mp4}m4a"; done
```
`-vn` (video none) removes video streams and `-c copy` disables re-encoding the audio. You... | Old question, but one you can do that nobody mentioned is, download a bunch of Video Lectures using Itunes U.
Add the selections to a Playlist in iTunes.
Right click the Playlist and select Burn Playlist to Disc:
There will be Disc Formats : Audio CD. and MP3 Cd.
selecting either of those options will strip just th... |
41,784 | I download lots of lectures from iTunes U. The problem is, they usually come with video and there is no audio-only version for many.
How can I, using any software available for Snow Leopard, free or paid, extract the audio from a series of video files and end up with a series of audio files?
Any ideas? | 2012/02/26 | [
"https://apple.stackexchange.com/questions/41784",
"https://apple.stackexchange.com",
"https://apple.stackexchange.com/users/1377/"
] | I suggest using [Max](http://sbooth.org/Max/) or [ffmpegx](http://www.ffmpegx.com/), which is a GUI for ffmpeg.
You can also use ffmpeg from the shell:
```
for f in *.mp4; do ffmpeg -i "$f" -vn -c copy "${f%mp4}m4a"; done
```
`-vn` (video none) removes video streams and `-c copy` disables re-encoding the audio. You... | I use AudioHijack Pro it costs money though. I can rip audio from DVDs and Internet streams. |
41,784 | I download lots of lectures from iTunes U. The problem is, they usually come with video and there is no audio-only version for many.
How can I, using any software available for Snow Leopard, free or paid, extract the audio from a series of video files and end up with a series of audio files?
Any ideas? | 2012/02/26 | [
"https://apple.stackexchange.com/questions/41784",
"https://apple.stackexchange.com",
"https://apple.stackexchange.com/users/1377/"
] | You can import the clip into iMovie, then export it as an AIF audio file using the iMovie Share menu's Quicktime export feature. Then you can import the AIF file into iTunes. Once it's in iTunes, you can create a much more compact MP3 version. All rather cumbersome. Too bad iTunes U doesn't just upload audio versions o... | I use AudioHijack Pro it costs money though. I can rip audio from DVDs and Internet streams. |
41,784 | I download lots of lectures from iTunes U. The problem is, they usually come with video and there is no audio-only version for many.
How can I, using any software available for Snow Leopard, free or paid, extract the audio from a series of video files and end up with a series of audio files?
Any ideas? | 2012/02/26 | [
"https://apple.stackexchange.com/questions/41784",
"https://apple.stackexchange.com",
"https://apple.stackexchange.com/users/1377/"
] | Old question, but one you can do that nobody mentioned is, download a bunch of Video Lectures using Itunes U.
Add the selections to a Playlist in iTunes.
Right click the Playlist and select Burn Playlist to Disc:
There will be Disc Formats : Audio CD. and MP3 Cd.
selecting either of those options will strip just th... | I use AudioHijack Pro it costs money though. I can rip audio from DVDs and Internet streams. |
21,210,190 | I've got the following code:
```
<div contenteditable="true" id="editor">
<p>This is example text with <span class="spoiler">spoiler<strong>s</strong></span></p>
<p>The <span class="spoiler">spoiler</span> exists in multiple paragraphs</p>
</div>
<button onclick="removeSpoiler();">remove spoiler</button>
```
T... | 2014/01/18 | [
"https://Stackoverflow.com/questions/21210190",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1168835/"
] | The fastest and easiest way to do this is to use [rangy](https://code.google.com/p/rangy/) framework and its [CSSClassApplier](https://code.google.com/p/rangy/wiki/CSSClassApplierModule) module.
It's easy and your code could look like this:
```
rangy.init();
var cssClassApplierModule = rangy.modules.CssClassApplier;... | Not sure what you are after here, but:
```
function removeSpoiler()
{
var e=document.getElementsByClassName("spoiler");
for(var n=0;n<e.length;n++)
e[n].style.display="none";
}
```
will hide the spoiler spans when the button is clicked. |
42,067,443 | I am selecting an image through i am getting name of a image. now i want to save that image in specific folder.
here is my html code for photo\_upload.php below:-
```html
<html>
<body>
<form enctype="multipart/form-data">
<label>enter name :</label>
<input type="text" name="txt" /><br><br>
<l... | 2017/02/06 | [
"https://Stackoverflow.com/questions/42067443",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7523063/"
] | Remove the onclick attribute on your button:
Try this: gotten from [Here](http://www.w3schools.com/php/php_file_upload.asp).
```
<?php
$target_dir = "uploads/";
$target_file = $target_dir . basename($_FILES["fileToUpload"]["name"]);
$uploadOk = 1;
$imageFileType = pathinfo($target_file,PATHINFO_EXTENSION);
// Check i... | ```
$tmp_path = $_FILES['txtImage']['tmp_name'];
$dest_path = path_where_in_your_server_you_want_this_image_to_be_moved.$_FILES['textImage']['name']; (eg: 'images/'.$_FILES['name'])
if(move_uploaded_file($tmp_path,$dest_path)){ //this will move the file from tmp location in server to the destination you provide in ... |
99,021 | Do you know any PDF reader which remembers the last page for each document?
The usage scenario should be something like this:
* A new PDF file is loaded into the reader
* The PDF file is opened on page 0
* Reading, reading, reading ... Reading finished at page 37.
* Reader closed
...
* The same PDF file is loaded in... | 2010/01/22 | [
"https://superuser.com/questions/99021",
"https://superuser.com",
"https://superuser.com/users/11659/"
] | [Evince](http://projects.gnome.org/evince/) does that...it's for Linux, but hey you never said anything about the OS: ;) | Since no OS is mentioned: Preview on Mac OS X does it by default. |
99,021 | Do you know any PDF reader which remembers the last page for each document?
The usage scenario should be something like this:
* A new PDF file is loaded into the reader
* The PDF file is opened on page 0
* Reading, reading, reading ... Reading finished at page 37.
* Reader closed
...
* The same PDF file is loaded in... | 2010/01/22 | [
"https://superuser.com/questions/99021",
"https://superuser.com",
"https://superuser.com/users/11659/"
] | Acrobat Reader
 | **[PDF-Xchange Viewer](http://www.docu-track.com/home/prod_user/PDF-XChange_Tools/pdfx_viewer/)** does just that (and not only for the last opened document, but all documents). In addition you can create your own bookmarks.

PDF-Xchange Viewer is freeware and a portable... |
99,021 | Do you know any PDF reader which remembers the last page for each document?
The usage scenario should be something like this:
* A new PDF file is loaded into the reader
* The PDF file is opened on page 0
* Reading, reading, reading ... Reading finished at page 37.
* Reader closed
...
* The same PDF file is loaded in... | 2010/01/22 | [
"https://superuser.com/questions/99021",
"https://superuser.com",
"https://superuser.com/users/11659/"
] | [Evince](http://projects.gnome.org/evince/) does that...it's for Linux, but hey you never said anything about the OS: ;) | **[PDF-Xchange Viewer](http://www.docu-track.com/home/prod_user/PDF-XChange_Tools/pdfx_viewer/)** does just that (and not only for the last opened document, but all documents). In addition you can create your own bookmarks.

PDF-Xchange Viewer is freeware and a portable... |
99,021 | Do you know any PDF reader which remembers the last page for each document?
The usage scenario should be something like this:
* A new PDF file is loaded into the reader
* The PDF file is opened on page 0
* Reading, reading, reading ... Reading finished at page 37.
* Reader closed
...
* The same PDF file is loaded in... | 2010/01/22 | [
"https://superuser.com/questions/99021",
"https://superuser.com",
"https://superuser.com/users/11659/"
] | [**Foxit Reader**](http://www.foxitsoftware.com/pdf/reader/reader3.php) does that and it's free!
 | **[PDF-Xchange Viewer](http://www.docu-track.com/home/prod_user/PDF-XChange_Tools/pdfx_viewer/)** does just that (and not only for the last opened document, but all documents). In addition you can create your own bookmarks.

PDF-Xchange Viewer is freeware and a portable... |
99,021 | Do you know any PDF reader which remembers the last page for each document?
The usage scenario should be something like this:
* A new PDF file is loaded into the reader
* The PDF file is opened on page 0
* Reading, reading, reading ... Reading finished at page 37.
* Reader closed
...
* The same PDF file is loaded in... | 2010/01/22 | [
"https://superuser.com/questions/99021",
"https://superuser.com",
"https://superuser.com/users/11659/"
] | [Evince](http://projects.gnome.org/evince/) does that...it's for Linux, but hey you never said anything about the OS: ;) | [Okular](http://okular.kde.org/) |
99,021 | Do you know any PDF reader which remembers the last page for each document?
The usage scenario should be something like this:
* A new PDF file is loaded into the reader
* The PDF file is opened on page 0
* Reading, reading, reading ... Reading finished at page 37.
* Reader closed
...
* The same PDF file is loaded in... | 2010/01/22 | [
"https://superuser.com/questions/99021",
"https://superuser.com",
"https://superuser.com/users/11659/"
] | [**Foxit Reader**](http://www.foxitsoftware.com/pdf/reader/reader3.php) does that and it's free!
 | Since no OS is mentioned: Preview on Mac OS X does it by default. |
99,021 | Do you know any PDF reader which remembers the last page for each document?
The usage scenario should be something like this:
* A new PDF file is loaded into the reader
* The PDF file is opened on page 0
* Reading, reading, reading ... Reading finished at page 37.
* Reader closed
...
* The same PDF file is loaded in... | 2010/01/22 | [
"https://superuser.com/questions/99021",
"https://superuser.com",
"https://superuser.com/users/11659/"
] | Acrobat Reader
 | Since no OS is mentioned: Preview on Mac OS X does it by default. |
99,021 | Do you know any PDF reader which remembers the last page for each document?
The usage scenario should be something like this:
* A new PDF file is loaded into the reader
* The PDF file is opened on page 0
* Reading, reading, reading ... Reading finished at page 37.
* Reader closed
...
* The same PDF file is loaded in... | 2010/01/22 | [
"https://superuser.com/questions/99021",
"https://superuser.com",
"https://superuser.com/users/11659/"
] | Acrobat Reader
 | [**Foxit Reader**](http://www.foxitsoftware.com/pdf/reader/reader3.php) does that and it's free!
 |
99,021 | Do you know any PDF reader which remembers the last page for each document?
The usage scenario should be something like this:
* A new PDF file is loaded into the reader
* The PDF file is opened on page 0
* Reading, reading, reading ... Reading finished at page 37.
* Reader closed
...
* The same PDF file is loaded in... | 2010/01/22 | [
"https://superuser.com/questions/99021",
"https://superuser.com",
"https://superuser.com/users/11659/"
] | [Evince](http://projects.gnome.org/evince/) does that...it's for Linux, but hey you never said anything about the OS: ;) | [Sumatra](http://blog.kowalczyk.info/software/sumatrapdf/free-pdf-reader.html) does that to all PDF files by default.
>
> Sumatra PDF is a free PDF, XPS, DjVu, CHM, Comic Book (CBZ and CBR)
> reader for Windows.
>
>
> |
99,021 | Do you know any PDF reader which remembers the last page for each document?
The usage scenario should be something like this:
* A new PDF file is loaded into the reader
* The PDF file is opened on page 0
* Reading, reading, reading ... Reading finished at page 37.
* Reader closed
...
* The same PDF file is loaded in... | 2010/01/22 | [
"https://superuser.com/questions/99021",
"https://superuser.com",
"https://superuser.com/users/11659/"
] | Acrobat Reader
 | [Evince](http://projects.gnome.org/evince/) does that...it's for Linux, but hey you never said anything about the OS: ;) |
72,438,409 | I have version 11.0.1 of firebase installed on my Windows 11 machine. When I run the firebase emulators, it crashes with this message:
>
> `$ firebase emulators:start`
>
>
>
> !! emulators: firebase-tools no longer supports Java version before 11. Please upgrade to Java version 11 or above to continue using th... | 2022/05/30 | [
"https://Stackoverflow.com/questions/72438409",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1404347/"
] | *For future visitors*
If you're using older version of the `firebase-tools`(<11.), you will get some logs/warning like the following when you run the Firebase local emulator:
```
emulators: Support for Java version <= 10 will be dropped soon in firebase-tools@11.
Please upgrade to Java version 11 or above to continu... | The best way to tell what version you have is to open a terminal shell and type:
```
java -version
```
I think you have JDK 8. That is long past the end of its support life.
You want either JDK 11 or, better yet, 17. Those are the two LTS versions to choose from.
You can download JDK 11 or 17 from [OpenJDK](https:... |
72,438,409 | I have version 11.0.1 of firebase installed on my Windows 11 machine. When I run the firebase emulators, it crashes with this message:
>
> `$ firebase emulators:start`
>
>
>
> !! emulators: firebase-tools no longer supports Java version before 11. Please upgrade to Java version 11 or above to continue using th... | 2022/05/30 | [
"https://Stackoverflow.com/questions/72438409",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1404347/"
] | The best way to tell what version you have is to open a terminal shell and type:
```
java -version
```
I think you have JDK 8. That is long past the end of its support life.
You want either JDK 11 or, better yet, 17. Those are the two LTS versions to choose from.
You can download JDK 11 or 17 from [OpenJDK](https:... | On macOS you can download the latest version of the JDK by downloading the [OpenJDK installer on AdoptOpenJDK](https://adoptopenjdk.net/archive.html?variant=openjdk11&jvmVariant=hotspot). |
72,438,409 | I have version 11.0.1 of firebase installed on my Windows 11 machine. When I run the firebase emulators, it crashes with this message:
>
> `$ firebase emulators:start`
>
>
>
> !! emulators: firebase-tools no longer supports Java version before 11. Please upgrade to Java version 11 or above to continue using th... | 2022/05/30 | [
"https://Stackoverflow.com/questions/72438409",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1404347/"
] | I just had the same error and just went through the all version 8 vs. version 11, etc. but now I get it.
firebase-tools is referring to the version of the JDK installed, not the version of Java runtime installed.
The latest JDK from Oracle can be downloaded from <https://www.oracle.com/java/technologies/downloads/#jd... | The best way to tell what version you have is to open a terminal shell and type:
```
java -version
```
I think you have JDK 8. That is long past the end of its support life.
You want either JDK 11 or, better yet, 17. Those are the two LTS versions to choose from.
You can download JDK 11 or 17 from [OpenJDK](https:... |
72,438,409 | I have version 11.0.1 of firebase installed on my Windows 11 machine. When I run the firebase emulators, it crashes with this message:
>
> `$ firebase emulators:start`
>
>
>
> !! emulators: firebase-tools no longer supports Java version before 11. Please upgrade to Java version 11 or above to continue using th... | 2022/05/30 | [
"https://Stackoverflow.com/questions/72438409",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1404347/"
] | The best way to tell what version you have is to open a terminal shell and type:
```
java -version
```
I think you have JDK 8. That is long past the end of its support life.
You want either JDK 11 or, better yet, 17. Those are the two LTS versions to choose from.
You can download JDK 11 or 17 from [OpenJDK](https:... | The command to deterine installed JDK is:
javac -version
(while java -version if for Java Runtime version)
I had the same issue on Windows and upgrading Java through Java updater or dowloading JDK from Oracle didn't help (propably it could).
On the other hand Firebase installation doc refers to Open JDK:
<https://fi... |
72,438,409 | I have version 11.0.1 of firebase installed on my Windows 11 machine. When I run the firebase emulators, it crashes with this message:
>
> `$ firebase emulators:start`
>
>
>
> !! emulators: firebase-tools no longer supports Java version before 11. Please upgrade to Java version 11 or above to continue using th... | 2022/05/30 | [
"https://Stackoverflow.com/questions/72438409",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1404347/"
] | *For future visitors*
If you're using older version of the `firebase-tools`(<11.), you will get some logs/warning like the following when you run the Firebase local emulator:
```
emulators: Support for Java version <= 10 will be dropped soon in firebase-tools@11.
Please upgrade to Java version 11 or above to continu... | On macOS you can download the latest version of the JDK by downloading the [OpenJDK installer on AdoptOpenJDK](https://adoptopenjdk.net/archive.html?variant=openjdk11&jvmVariant=hotspot). |
72,438,409 | I have version 11.0.1 of firebase installed on my Windows 11 machine. When I run the firebase emulators, it crashes with this message:
>
> `$ firebase emulators:start`
>
>
>
> !! emulators: firebase-tools no longer supports Java version before 11. Please upgrade to Java version 11 or above to continue using th... | 2022/05/30 | [
"https://Stackoverflow.com/questions/72438409",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1404347/"
] | I just had the same error and just went through the all version 8 vs. version 11, etc. but now I get it.
firebase-tools is referring to the version of the JDK installed, not the version of Java runtime installed.
The latest JDK from Oracle can be downloaded from <https://www.oracle.com/java/technologies/downloads/#jd... | *For future visitors*
If you're using older version of the `firebase-tools`(<11.), you will get some logs/warning like the following when you run the Firebase local emulator:
```
emulators: Support for Java version <= 10 will be dropped soon in firebase-tools@11.
Please upgrade to Java version 11 or above to continu... |
72,438,409 | I have version 11.0.1 of firebase installed on my Windows 11 machine. When I run the firebase emulators, it crashes with this message:
>
> `$ firebase emulators:start`
>
>
>
> !! emulators: firebase-tools no longer supports Java version before 11. Please upgrade to Java version 11 or above to continue using th... | 2022/05/30 | [
"https://Stackoverflow.com/questions/72438409",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1404347/"
] | *For future visitors*
If you're using older version of the `firebase-tools`(<11.), you will get some logs/warning like the following when you run the Firebase local emulator:
```
emulators: Support for Java version <= 10 will be dropped soon in firebase-tools@11.
Please upgrade to Java version 11 or above to continu... | The command to deterine installed JDK is:
javac -version
(while java -version if for Java Runtime version)
I had the same issue on Windows and upgrading Java through Java updater or dowloading JDK from Oracle didn't help (propably it could).
On the other hand Firebase installation doc refers to Open JDK:
<https://fi... |
72,438,409 | I have version 11.0.1 of firebase installed on my Windows 11 machine. When I run the firebase emulators, it crashes with this message:
>
> `$ firebase emulators:start`
>
>
>
> !! emulators: firebase-tools no longer supports Java version before 11. Please upgrade to Java version 11 or above to continue using th... | 2022/05/30 | [
"https://Stackoverflow.com/questions/72438409",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1404347/"
] | I just had the same error and just went through the all version 8 vs. version 11, etc. but now I get it.
firebase-tools is referring to the version of the JDK installed, not the version of Java runtime installed.
The latest JDK from Oracle can be downloaded from <https://www.oracle.com/java/technologies/downloads/#jd... | On macOS you can download the latest version of the JDK by downloading the [OpenJDK installer on AdoptOpenJDK](https://adoptopenjdk.net/archive.html?variant=openjdk11&jvmVariant=hotspot). |
72,438,409 | I have version 11.0.1 of firebase installed on my Windows 11 machine. When I run the firebase emulators, it crashes with this message:
>
> `$ firebase emulators:start`
>
>
>
> !! emulators: firebase-tools no longer supports Java version before 11. Please upgrade to Java version 11 or above to continue using th... | 2022/05/30 | [
"https://Stackoverflow.com/questions/72438409",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1404347/"
] | I just had the same error and just went through the all version 8 vs. version 11, etc. but now I get it.
firebase-tools is referring to the version of the JDK installed, not the version of Java runtime installed.
The latest JDK from Oracle can be downloaded from <https://www.oracle.com/java/technologies/downloads/#jd... | The command to deterine installed JDK is:
javac -version
(while java -version if for Java Runtime version)
I had the same issue on Windows and upgrading Java through Java updater or dowloading JDK from Oracle didn't help (propably it could).
On the other hand Firebase installation doc refers to Open JDK:
<https://fi... |
27,720,898 | So could you? As an example, you can print a line out onto the screen using `std::cout << "Message";` but if you add `using namespace std;` to the top of your code you can then use it without the `std::` and just use it as `cout << "Message";`
Can you do that with your own code?
Edit: Let me explain better.
Let's sa... | 2014/12/31 | [
"https://Stackoverflow.com/questions/27720898",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4370958/"
] | Non-static member functions of a class can only be called on an object of that class. That's what they are for. You don't have to have a named object but you still have to have an object:
```
A().testFunction();
```
If you make the function `static` then you can call it like this:
```
A::testFunction();
```
It do... | here is an example from [tutorialspoint](http://www.tutorialspoint.com/cplusplus/cpp_namespaces.htm):
```
#include <iostream>
using namespace std;
// first name space
namespace first_space{
void func(){
cout << "Inside first_space" << endl;
}
}
// second name space
namespace second_space{
void func(){
... |
27,720,898 | So could you? As an example, you can print a line out onto the screen using `std::cout << "Message";` but if you add `using namespace std;` to the top of your code you can then use it without the `std::` and just use it as `cout << "Message";`
Can you do that with your own code?
Edit: Let me explain better.
Let's sa... | 2014/12/31 | [
"https://Stackoverflow.com/questions/27720898",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4370958/"
] | Non-static member functions of a class can only be called on an object of that class. That's what they are for. You don't have to have a named object but you still have to have an object:
```
A().testFunction();
```
If you make the function `static` then you can call it like this:
```
A::testFunction();
```
It do... | If u want to call a method(say in class A) only by its name then it will create ambiguities when there is a method with same name,parameters,return type in another class(say class B) that is also included in the header. |
20,309,534 | i want get number between tags that not hex or unicode in a html content
like this with regular expression
```
<a href="/sam2/example-3.php">go to page 13</a> 0x91 0x26 exchange hello98.25 …
```
return
13 and 98.25 | 2013/12/01 | [
"https://Stackoverflow.com/questions/20309534",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1019920/"
] | GHC may evaluate it far fewer than 9 times. In fact it does so, and we can prove that using `Debug.Trace.trace`
```
module Main (main) where
import Debug.Trace
x = let strings = ["foo", "bar", "baz"]
in [filter (== char) (trace "\nconcat strings\n" (concat strings)) | char <- "oaxyz"]
main = do
print x
``... | It will be evaluated twice. GHC doesn't [memoize](https://stackoverflow.com/questions/3951012/when-is-memoization-automatic-in-ghc-haskell). list comprehensions desugar like this
```
[term | x <- xs, y <- ys ...] -- I ignore guards
do
x <- xs
y <- ys
...
return term
```
Which is the same as
```
flip con... |
20,309,534 | i want get number between tags that not hex or unicode in a html content
like this with regular expression
```
<a href="/sam2/example-3.php">go to page 13</a> 0x91 0x26 exchange hello98.25 …
```
return
13 and 98.25 | 2013/12/01 | [
"https://Stackoverflow.com/questions/20309534",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1019920/"
] | What Chris says in his reply is all true. While you cannot completely rely on the expression to be shared, it's a valid optimization for GHC to share it, and it will usually do so when optimizations are enabled. Nevertheless, you might not want to rely on this functionality, and if you can make the intended sharing exp... | It will be evaluated twice. GHC doesn't [memoize](https://stackoverflow.com/questions/3951012/when-is-memoization-automatic-in-ghc-haskell). list comprehensions desugar like this
```
[term | x <- xs, y <- ys ...] -- I ignore guards
do
x <- xs
y <- ys
...
return term
```
Which is the same as
```
flip con... |
20,309,534 | i want get number between tags that not hex or unicode in a html content
like this with regular expression
```
<a href="/sam2/example-3.php">go to page 13</a> 0x91 0x26 exchange hello98.25 …
```
return
13 and 98.25 | 2013/12/01 | [
"https://Stackoverflow.com/questions/20309534",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1019920/"
] | What Chris says in his reply is all true. While you cannot completely rely on the expression to be shared, it's a valid optimization for GHC to share it, and it will usually do so when optimizations are enabled. Nevertheless, you might not want to rely on this functionality, and if you can make the intended sharing exp... | GHC may evaluate it far fewer than 9 times. In fact it does so, and we can prove that using `Debug.Trace.trace`
```
module Main (main) where
import Debug.Trace
x = let strings = ["foo", "bar", "baz"]
in [filter (== char) (trace "\nconcat strings\n" (concat strings)) | char <- "oaxyz"]
main = do
print x
``... |
25,058,314 | This is a short excerpt of the offending code. The summary is that 3 ccsprite are put into a lua table and then I attempt to add those nodes to the cclayer in the same fashion as the example I'm working from. The error I get is:
```
addChild has wrong number of arguments: 0, was expecting 3
```
So perhaps I could b... | 2014/07/31 | [
"https://Stackoverflow.com/questions/25058314",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3740655/"
] | I Solved that issue at my Side by Using Just This Code
>
>
> ```
> mediaPos = mplayer.getCurrentPosition(); mediaMax = mplayer.getDuration();
>
> ```
>
> seekbar.setMax(mediaMax); // Set the Maximum range of the
>
> seekbar.setProgress(mediaPos);// set current progress to song's
>
>
> handler.removeCallb... | I used `seekbar.OnSeekBarChangeListener` to listen for any changes in seekbar. It worked well for my audio file. I am not sure for video files. But anyhow try this. My code is:
```
private SeekBar.OnSeekBarChangeListener seekBarChanged = new
SeekBar.OnSeekBarChangeListener() {
@Override
public void onStopTrack... |
48,386 | I'm moving to Canada from New York and I'm just checking in baggage along with plastic storage boxes. I'm trying to figure out the safest and most secure way to close the boxes. Any suggestions? Is this even possible? I'm flying Air Canada. I'd really appreciate feedback, packing is stressful enough. | 2015/05/28 | [
"https://travel.stackexchange.com/questions/48386",
"https://travel.stackexchange.com",
"https://travel.stackexchange.com/users/30087/"
] | You are flying FROM New York, hence you are at the mercy of TSA. And if the scanners show anything suspicious looking in your boxes, they will open them to inspect, in which case your duct tape, plastic wrap, etc will be cut open and useless.
What I usually do with boxes and cases like that is to get some compression ... | Be aware that baggage handling systems are known not to be too gentle. It could pretty happily put your box upside down in a cart on a steep incline while heading to another part of the building at 30 km/h. When it gets there, it is usually tipped off the cart at speed and down a steep chute to the waiting luggage hand... |
48,386 | I'm moving to Canada from New York and I'm just checking in baggage along with plastic storage boxes. I'm trying to figure out the safest and most secure way to close the boxes. Any suggestions? Is this even possible? I'm flying Air Canada. I'd really appreciate feedback, packing is stressful enough. | 2015/05/28 | [
"https://travel.stackexchange.com/questions/48386",
"https://travel.stackexchange.com",
"https://travel.stackexchange.com/users/30087/"
] | You are flying FROM New York, hence you are at the mercy of TSA. And if the scanners show anything suspicious looking in your boxes, they will open them to inspect, in which case your duct tape, plastic wrap, etc will be cut open and useless.
What I usually do with boxes and cases like that is to get some compression ... | I can't possibly comment on what you're likely to experience with the TSA, however I can recommend good storage bin for air travel.
Before moving to the UK from Canada in 2010, I bought two [24 gallon Rubbermaid ActionPackers](http://rads.stackoverflow.com/amzn/click/B00002N6SQ "amazon.com") and a 4 pack of padlocks (... |
43,158,491 | what's the difference between the two ways to unzip two zipped lists?
```
assert isinstance(X, list)
assert isinstance(X[0], tuple)
assert isinstance(X[0][0], list)
assert isinstance(X[0][0][0], dict)
X_model = []
X_synth = []
for row in X:
X_model.append(row[0])
X_synth.append(row[1])
```
X\_model is now a... | 2017/04/01 | [
"https://Stackoverflow.com/questions/43158491",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1691477/"
] | Let's use an example. For simplicity sake, instead of using a list of dicts let's use numbers. Notice the first element of every tuple is odd and the second element of every tuple is even.
```
>>> X = [(1, 2), (3, 4), (5, 6), (7, 8), (9, 10)]
>>> X_model = []
>>> X_synth = []
>>> for row in X:
... X_model.append(r... | The equivalent to `zip()` would be:
```
X_model = tuple(x for x, _ in X)
X_synth = tuple(x for _, x in X)
```
But this isn't very efficient as it cycles `X` twice.
Note: `tuple`s are immutable, so you can't efficiently do it in a loop as you would be creating a new tuple each time. |
11,366,635 | Prior to rails 3.2, this was prevented by default. With rails 3.2, there doesn't seem to be a clear-cut solution. In comments in the commit introducing the change, Aaron suggested tagging the log lines with process pid and/or request uuid, which doesn't satisfy our Operations folks. I've seen some random solutions hith... | 2012/07/06 | [
"https://Stackoverflow.com/questions/11366635",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/508458/"
] | We ended up writing a mildly horrible patch to revert to the old behavior:
```
config.after_initialize do
# Reverse the deprecation of flush in BufferedLogger
module ActiveSupport
class BufferedLogger
def flush
@log_dest.flush
end
def respond_to?(method, include_private = false)
... | More info here: <https://github.com/rails/rails/issues/5388>
The answer above didn't flush the log lines after each request (Rails 3.2.18). So I used a initializer [based on this post](http://developer.zendesk.com/blog/2013/09/23/buffer-rails3-logs-for-uninterleaved-requests/):
```
class NonInterleavedLoggingMiddlewa... |
54,791,729 | A colleague of mine is using Eclipse Photon on Windows 10. When they specify the ChromeDriver location to run a Selenium test, they get an error like:
>
> java.lang.IllegalStateException: The driver executable does not exist:
> C:\eclipse-project-folder\?C:\some-path\chromedriver.exe
>
>
>
...where we specified ... | 2019/02/20 | [
"https://Stackoverflow.com/questions/54791729",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1678392/"
] | I was able to reproduce the issue by placing `?` before the driver path. But I am sure you might have checked this. Just try to copy paste the path to the notepad and then take it from there when you are working with the paths, by this way you don't end-up appending some invisible chars that might cause this kinds of i... | Try forward slashes. It works for me.
```
-Dwebdriver.chrome.driver=C:/some-path/chromedriver.exe
``` |
73,329,649 | I want to get input from the user in python, but the input that is pasted in from the user has multiple new lines in it, so if I enter it as input, the new lines stop the input and I don't get the full input. For example if my input is `hello\nworld` (not with a literal `\n` but there is a new line in between the words... | 2022/08/12 | [
"https://Stackoverflow.com/questions/73329649",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19748220/"
] | As mentioned in comment, you didn't use braces `{}` properly. I also made it a bit better, so you can use this :
```
internal class Program
{
private static void Main(string[] args)
{
bool end = false;
Random rnd = new Random();
int rps;
string input;
while (end != true... | You did it wrong. You didn't use brackets.
```
if (condition)
{
// more than one line
}
if (condition)
//single line
```
Please try it like this;
```
if (input == "Rock" && rps == 1)
{
Console.WriteLine("You Win");
end = true;
}
if (input == "Rock" && rps == 2)
{
Console.WriteLine("You Lose");... |
73,329,649 | I want to get input from the user in python, but the input that is pasted in from the user has multiple new lines in it, so if I enter it as input, the new lines stop the input and I don't get the full input. For example if my input is `hello\nworld` (not with a literal `\n` but there is a new line in between the words... | 2022/08/12 | [
"https://Stackoverflow.com/questions/73329649",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19748220/"
] | As mentioned in comment, you didn't use braces `{}` properly. I also made it a bit better, so you can use this :
```
internal class Program
{
private static void Main(string[] args)
{
bool end = false;
Random rnd = new Random();
int rps;
string input;
while (end != true... | You need to wrap the if statement in a block
```
if (input == "Rock" && rps == 1)
Console.WriteLine("You Win");
end = true; // this line is always executed
```
Is not the same as
```
if (input == "Rock" && rps == 1)
{
Console.WriteLine("You Win");
end = true;
}
``` |
73,329,649 | I want to get input from the user in python, but the input that is pasted in from the user has multiple new lines in it, so if I enter it as input, the new lines stop the input and I don't get the full input. For example if my input is `hello\nworld` (not with a literal `\n` but there is a new line in between the words... | 2022/08/12 | [
"https://Stackoverflow.com/questions/73329649",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19748220/"
] | You did it wrong. You didn't use brackets.
```
if (condition)
{
// more than one line
}
if (condition)
//single line
```
Please try it like this;
```
if (input == "Rock" && rps == 1)
{
Console.WriteLine("You Win");
end = true;
}
if (input == "Rock" && rps == 2)
{
Console.WriteLine("You Lose");... | You need to wrap the if statement in a block
```
if (input == "Rock" && rps == 1)
Console.WriteLine("You Win");
end = true; // this line is always executed
```
Is not the same as
```
if (input == "Rock" && rps == 1)
{
Console.WriteLine("You Win");
end = true;
}
``` |
4,372,397 | I need to get a phone's user agent string, but I haven't found anything in the API that allows this. I've come across the following two blog posts describing the format of the user agent string:
<http://blogs.msdn.com/b/iemobile/archive/2010/03/25/ladies-and-gentlemen-please-welcome-the-ie-mobile-user-agent-string.asp... | 2010/12/07 | [
"https://Stackoverflow.com/questions/4372397",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/209981/"
] | Go to [http://whatsmyuseragent.com](http://whatsmyuseragent.com/) using the phone in question.
From my Samsung Focus: `Mozilla/4.0 (compatible: MSIE 7.0; Windows Phone OS 7.0; Trident/3.1; IEMobile/7.0; SAMSUNG; SGH-i917)` | I made this helper that will create a temporary WebBrowser, load a script and return an awaitable userAgent:
```
internal static class UserAgentHelper
{
private const string Html = @"<!DOCTYPE html><html><body onload=""window.external.notify(navigator.userAgent);""></body></html>";
public static Task<string> G... |
6,195,857 | I'm just trying to create another dropdown menu effect within a dropdown menu.
Observe:
```
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="javascript/class-lib.js"></script>
<script type="text/javascript" src="javascript/script.js"></script>
<link rel="stylesheet" type="text/css" href="css/style.c... | 2011/06/01 | [
"https://Stackoverflow.com/questions/6195857",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/763053/"
] | Instead of doing:
```
#nav li ul li a:hover{
#nav li ul li ul li a{
visibility:visible;
}
}
```
It should be:
```
#nav li ul li:hover ul li a
{
visibility:visible;
}
``` | Other people have shown you how to fix the problem, but you shouldn't really be doing it that way anyways; although it is a nice and clean way to create menus, it crosses the boundaries in the content-presentation-behaviour rule. Although it may not matter much, the code that drops down menus belongs in JavaScript. |
6,195,857 | I'm just trying to create another dropdown menu effect within a dropdown menu.
Observe:
```
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="javascript/class-lib.js"></script>
<script type="text/javascript" src="javascript/script.js"></script>
<link rel="stylesheet" type="text/css" href="css/style.c... | 2011/06/01 | [
"https://Stackoverflow.com/questions/6195857",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/763053/"
] | You can't nest statements. It's just not the right use for CSS.
From [Wikipedia](http://en.wikipedia.org/wiki/Cascading_Style_Sheets):
>
> Cascading Style Sheets (CSS) is a
> **style sheet language used to describe
> the presentation semantics (the look
> and formatting) of a document** written
> in a markup lan... | Other people have shown you how to fix the problem, but you shouldn't really be doing it that way anyways; although it is a nice and clean way to create menus, it crosses the boundaries in the content-presentation-behaviour rule. Although it may not matter much, the code that drops down menus belongs in JavaScript. |
4,643,798 | i am working on an win mobile application . I am running application in background using
```
e.Cancle = true;
```
Now i need to relaunch same instance of that application so that i can off that application .
can any one tell me ... how to do this? | 2011/01/10 | [
"https://Stackoverflow.com/questions/4643798",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/504104/"
] | If the application needs to restart itself this may help you :
<http://msdn.microsoft.com/en-us/library/system.windows.forms.application.restart.aspx>
You don't actually need to be running a winforms application for this to work - you just need to make sure the System.Windows.Forms DLL is present.
PS. i couldn't get... | You need to:
1) Stop application(Kill process) <http://msdn.microsoft.com/en-us/library/system.diagnostics.process.kill.aspx> or Exit application <http://msdn.microsoft.com/en-us/library/system.windows.forms.application.exit(v=vs.71).aspx>
2) Run application again(Start process) <http://msdn.microsoft.com/en-us/libra... |
4,643,798 | i am working on an win mobile application . I am running application in background using
```
e.Cancle = true;
```
Now i need to relaunch same instance of that application so that i can off that application .
can any one tell me ... how to do this? | 2011/01/10 | [
"https://Stackoverflow.com/questions/4643798",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/504104/"
] | You need to:
1) Stop application(Kill process) <http://msdn.microsoft.com/en-us/library/system.diagnostics.process.kill.aspx> or Exit application <http://msdn.microsoft.com/en-us/library/system.windows.forms.application.exit(v=vs.71).aspx>
2) Run application again(Start process) <http://msdn.microsoft.com/en-us/libra... | This might do it.
```
System.Diagnostics.Process.Start(Application.ExecutablePath);
Close();
``` |
4,643,798 | i am working on an win mobile application . I am running application in background using
```
e.Cancle = true;
```
Now i need to relaunch same instance of that application so that i can off that application .
can any one tell me ... how to do this? | 2011/01/10 | [
"https://Stackoverflow.com/questions/4643798",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/504104/"
] | If the application needs to restart itself this may help you :
<http://msdn.microsoft.com/en-us/library/system.windows.forms.application.restart.aspx>
You don't actually need to be running a winforms application for this to work - you just need to make sure the System.Windows.Forms DLL is present.
PS. i couldn't get... | This might do it.
```
System.Diagnostics.Process.Start(Application.ExecutablePath);
Close();
``` |
26,145,871 | How can I redirect to the login page if someone tries to hit any other route when they are not authenticated? Is there a "best" way to do this in AngularJS?
Seems like a common problem but I can't seem to find a way to do this. Thank you in advance for your help. | 2014/10/01 | [
"https://Stackoverflow.com/questions/26145871",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1236296/"
] | The best way to do this is to set up a '$routeChangeStart' listener which checks an 'authProvider' service function to verify that there is a user logged in. In our 'app.js' or in a separate file:
```
angular.module('myApp')
.run(['$rootScope', '$location', 'authProvider', function ($rootScope, $location, au... | I am doing this a different way now, with Node.js & Express & the `passport` module, but before that, when I was using PHP, I did it with several Angular modules. I had an outside module on my `<html>` tag with `ng-app`, then `ng-controller`s at certain tags, like `<body>` & certain `<div>`s. In one of these `ng-contro... |
138,867 | As of [a previous question](https://sharepoint.stackexchange.com/questions/138802/setting-custom-field-default-value-within-itemadded-event?noredirect=1), whenever an item is added in a list, I create a document library based on a template, and set defaultvalues for some of its fields.
In Sharepoint Manager I see defau... | 2015/04/20 | [
"https://sharepoint.stackexchange.com/questions/138867",
"https://sharepoint.stackexchange.com",
"https://sharepoint.stackexchange.com/users/40327/"
] | There was not an issue with the code nor the Sharepoint edition.
The issue was a somewhat scrambled list template, with multiple duplicate content types.
I recreated it and everything is OK. | This should work for you.
You have to call the .Update() on the field not on the list.
```
public override void ItemAdded(SPItemEventProperties properties)
{
SPWeb myWeb = properties.Web;
string projectName = properties.ListItem["Project Name"].ToString();
var customTemplate = myWeb.ListTemplates["Proje... |
5,862,616 | I am creating a small framework for a board game platform and I have created the following interfaces in order to be as generic as possible for the games that I will be putting within this framework.
I wanted to use Java Generics, so that each implementation would then not only
implement the respective interfaces in... | 2011/05/02 | [
"https://Stackoverflow.com/questions/5862616",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/340088/"
] | Do you really need this dependency GameTable <-> Game? Is not enough for GameTable to retrieve the game instance from gameFactory.getGameInstance() by using an enum indicating a type of table? Basically I will try to reduce the dependencies between interfaces/interfaces and classes/interfaces. | The problem is, your GameFactory returns "G extends Game", and you are trying to assign that to another "G extends Game" which is potentially not the same class (even though it actually is in your implementation).
One way to resolve that would be for GameFactory to return a "Game", rather than "something that extends... |
5,862,616 | I am creating a small framework for a board game platform and I have created the following interfaces in order to be as generic as possible for the games that I will be putting within this framework.
I wanted to use Java Generics, so that each implementation would then not only
implement the respective interfaces in... | 2011/05/02 | [
"https://Stackoverflow.com/questions/5862616",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/340088/"
] | You have mixed generics with non-generics and this tends to lead to confusion. In Game you have given it two generics parameter types, but in GameFactory it is treated as a non-generic. Try to make all your types consistently either generic or non-generic and it should work.
e.g.
```
public interface GameFactory<T ex... | The problem is, your GameFactory returns "G extends Game", and you are trying to assign that to another "G extends Game" which is potentially not the same class (even though it actually is in your implementation).
One way to resolve that would be for GameFactory to return a "Game", rather than "something that extends... |
5,862,616 | I am creating a small framework for a board game platform and I have created the following interfaces in order to be as generic as possible for the games that I will be putting within this framework.
I wanted to use Java Generics, so that each implementation would then not only
implement the respective interfaces in... | 2011/05/02 | [
"https://Stackoverflow.com/questions/5862616",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/340088/"
] | You have mixed generics with non-generics and this tends to lead to confusion. In Game you have given it two generics parameter types, but in GameFactory it is treated as a non-generic. Try to make all your types consistently either generic or non-generic and it should work.
e.g.
```
public interface GameFactory<T ex... | Do you really need this dependency GameTable <-> Game? Is not enough for GameTable to retrieve the game instance from gameFactory.getGameInstance() by using an enum indicating a type of table? Basically I will try to reduce the dependencies between interfaces/interfaces and classes/interfaces. |
4,454,939 | I am trying to set Google Web Toolkit up on my system in order to tinker with creating web applications. I have been following the guide at <http://code.google.com/webtoolkit/doc/latest/tutorial/create.html> to get some experience with the system. I have had some problems though. When I run the program in development m... | 2010/12/15 | [
"https://Stackoverflow.com/questions/4454939",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/543789/"
] | Try to use another browser, I think you are using Chrome 10.0.612.1 dev.
IMHO it could be caused by the WebKit update.
I have the same problem too, I just filled a bug: <http://code.google.com/p/google-web-toolkit/issues/detail?id=5778> | I'm just guessing.. Have you checked the version compliance between GWT SDK installed onto Eclipse, and the libraries you are using in your GWT project classpath? |
24,400,106 | I need JS code that does the following
1.) Get's the current url of the page.
2.) If url = a certain url
Then = #header is set to display:none;
3.) If else = no change
Came up with a few ideas with no avail, struggling with this; appreciative of any and all help. | 2014/06/25 | [
"https://Stackoverflow.com/questions/24400106",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3216108/"
] | In a hexagon as follows, you need to know about the triangles that make up the edges:
```
B B
*--* *
/| \ /|
/ | \ / |
A*--*C * ==> c / | a
\ / / |
\ / / |
*--* A*-----*C
... | You can solve this with simple calculations, if you know (you should) the size of the hex cells.
```
| small |
| width |
_______ ______
/ \ h
/ \ e
/ \ i
\ / g
\ / h
| \_______/ _|____t
| |
|--- width ---|
```
```
use... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.