qid int64 1 74.7M | question stringlengths 15 58.3k | date stringlengths 10 10 | metadata list | response_j stringlengths 4 30.2k | response_k stringlengths 11 36.5k |
|---|---|---|---|---|---|
64,464,186 | I have data like this, but sometimes I have wrong mileage. Mileage should increase, but sometimes there is wrong number - too low or too high. Is possible to clean that data in R? Do you have any ideas?
For this mistakes I can use average from below and above record but how to catch the error in than sequence?
```
Car... | 2020/10/21 | [
"https://Stackoverflow.com/questions/64464186",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14492726/"
] | Here's a method showing how to identify outliers and then fill them in using `approx`. I start by looking for decreases in mileage - you can put whatever additional conditions you want to check in the `if_else` to identify outliers:
```
dd %>%
group_by(CarID) %>%
dplyr::mutate(
# replace mistakes with NA
M... | Maybe you can try removing outliers?
```
Q <- quantile(dataframe$Mileage, probs=c(.25, .75), na.rm = FALSE)
eliminated<- subset(dataframe, dataframe$Mileage > (Q[1] - 1.5*iqr) & dataframe$Mileage < (Q[2]+1.5*iqr))
``` |
64,464,186 | I have data like this, but sometimes I have wrong mileage. Mileage should increase, but sometimes there is wrong number - too low or too high. Is possible to clean that data in R? Do you have any ideas?
For this mistakes I can use average from below and above record but how to catch the error in than sequence?
```
Car... | 2020/10/21 | [
"https://Stackoverflow.com/questions/64464186",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14492726/"
] | I just put my comments in an answer just to better show the outputs:
Here is the code:
```
library(dplyr)
library(ggplot2)
df %>% group_by(CarID) %>%
summarise(min = min(Mileage),
max = max(Mileage))
df %>% group_by(CarID) %>% mutate(rate = Mileage/lag(Mileage, n = 1, default = NA)) # if < 1 then the ... | Maybe you can try removing outliers?
```
Q <- quantile(dataframe$Mileage, probs=c(.25, .75), na.rm = FALSE)
eliminated<- subset(dataframe, dataframe$Mileage > (Q[1] - 1.5*iqr) & dataframe$Mileage < (Q[2]+1.5*iqr))
``` |
64,464,186 | I have data like this, but sometimes I have wrong mileage. Mileage should increase, but sometimes there is wrong number - too low or too high. Is possible to clean that data in R? Do you have any ideas?
For this mistakes I can use average from below and above record but how to catch the error in than sequence?
```
Car... | 2020/10/21 | [
"https://Stackoverflow.com/questions/64464186",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14492726/"
] | If you want to identify where the mistakes occur, here might be option using `ave` + `cummax` + `cummin` with base R
```
within(
df,
err <- ave(
Mileage,
CarID,
FUN = function(x) replace(cummax(x) == rev(cummax(rev(x))), length(x), 0) + replace(cummin(x) == rev(cummin(rev(x))), 1, 0)
)
)
```
which ... | I just put my comments in an answer just to better show the outputs:
Here is the code:
```
library(dplyr)
library(ggplot2)
df %>% group_by(CarID) %>%
summarise(min = min(Mileage),
max = max(Mileage))
df %>% group_by(CarID) %>% mutate(rate = Mileage/lag(Mileage, n = 1, default = NA)) # if < 1 then the ... |
64,464,186 | I have data like this, but sometimes I have wrong mileage. Mileage should increase, but sometimes there is wrong number - too low or too high. Is possible to clean that data in R? Do you have any ideas?
For this mistakes I can use average from below and above record but how to catch the error in than sequence?
```
Car... | 2020/10/21 | [
"https://Stackoverflow.com/questions/64464186",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14492726/"
] | Here's a method showing how to identify outliers and then fill them in using `approx`. I start by looking for decreases in mileage - you can put whatever additional conditions you want to check in the `if_else` to identify outliers:
```
dd %>%
group_by(CarID) %>%
dplyr::mutate(
# replace mistakes with NA
M... | I just put my comments in an answer just to better show the outputs:
Here is the code:
```
library(dplyr)
library(ggplot2)
df %>% group_by(CarID) %>%
summarise(min = min(Mileage),
max = max(Mileage))
df %>% group_by(CarID) %>% mutate(rate = Mileage/lag(Mileage, n = 1, default = NA)) # if < 1 then the ... |
24,182,761 | I have a function `fadeOpacity` which basically sets up a `StateModifier` with a start opacity, end opacity, transition and a callback function.
I'm using JSDoc for my own code, and was just wondering what type I should be calling a `transition`
In the source for famo.us's pre-made curves in Easing.js, curves are cre... | 2014/06/12 | [
"https://Stackoverflow.com/questions/24182761",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2463810/"
] | Looking at Lightbox.js, it looks like the type for transitions is just Transition..
eg. line 32 of Lightbox.js
```
* @param {Transition} [options.inTransition=true] The transition in charge of showing a renderable.
```
If you are animating opacity, I am assuming you want the user or OP (or yourself ;)) to interact ... | Yes. The transition is a function that takes in a number t from 0 to 1, and returns a number (often between 0 and 1, with negative values being undershoots, and values greater than 1 being overshoots). Transition can also be a string that is just a key to a registered function. By default, Famo.us comes with a few of t... |
82,646 | I'm writing a software which is divided into two separate stand-alone pieces. One is a service like application that handles all the logics, the other one is a GUI application that just works as a front-end and is aimed to be used by the end user. The service would listen to a port and accept requests from the client (... | 2015/02/27 | [
"https://security.stackexchange.com/questions/82646",
"https://security.stackexchange.com",
"https://security.stackexchange.com/users/69243/"
] | I assume you are the only root/administrator on the machine.
You can use one of those two options:
1. Do not allow other users on that machine at all
2. Let the process run as a special user and use a communication mechanism that is only accessible (read + write) to that user (named pipe, unix domain socket, etc.)
A... | Basically, security is usually bear by the key, not the algorithm. So you're on a fool's errand here. As stated by the Kerckhoff's principle: "A cryptosystem should be secure even if everything about the system, except the key, is public knowledge.", or as Shannon reformulated it : "the enemy knows the system". So you ... |
82,646 | I'm writing a software which is divided into two separate stand-alone pieces. One is a service like application that handles all the logics, the other one is a GUI application that just works as a front-end and is aimed to be used by the end user. The service would listen to a port and accept requests from the client (... | 2015/02/27 | [
"https://security.stackexchange.com/questions/82646",
"https://security.stackexchange.com",
"https://security.stackexchange.com/users/69243/"
] | These are the golden rule of computer security: "It is impossible to hide anything from a competent user with system administrator privilege" and "any competent user with physical access to the device can always elevate himself to system administrator".
You cannot hide any information from someone with physical contro... | Basically, security is usually bear by the key, not the algorithm. So you're on a fool's errand here. As stated by the Kerckhoff's principle: "A cryptosystem should be secure even if everything about the system, except the key, is public knowledge.", or as Shannon reformulated it : "the enemy knows the system". So you ... |
82,646 | I'm writing a software which is divided into two separate stand-alone pieces. One is a service like application that handles all the logics, the other one is a GUI application that just works as a front-end and is aimed to be used by the end user. The service would listen to a port and accept requests from the client (... | 2015/02/27 | [
"https://security.stackexchange.com/questions/82646",
"https://security.stackexchange.com",
"https://security.stackexchange.com/users/69243/"
] | These are the golden rule of computer security: "It is impossible to hide anything from a competent user with system administrator privilege" and "any competent user with physical access to the device can always elevate himself to system administrator".
You cannot hide any information from someone with physical contro... | I assume you are the only root/administrator on the machine.
You can use one of those two options:
1. Do not allow other users on that machine at all
2. Let the process run as a special user and use a communication mechanism that is only accessible (read + write) to that user (named pipe, unix domain socket, etc.)
A... |
134,727 | What are the key differences between [HTML4](http://www.w3.org/TR/REC-html40/) and [HTML5 draft](http://www.w3.org/html/wg/html5/)?
Please keep the answers related to changed syntax and added/removed html elements. | 2008/09/25 | [
"https://Stackoverflow.com/questions/134727",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21473/"
] | HTML5 has several goals which differentiate it from HTML4.
Consistency in Handling Malformed Documents
===========================================
The primary one is *consistent, defined error handling*. As you know, HTML purposely supports 'tag soup', or the ability to write malformed code and have it corrected into... | HTML5 introduces a number of APIs that help in creating Web applications. These can be used together with the new elements introduced for applications:
* An API for playing of video and audio which can be used with the new video and audio elements.
* An API that enables offline Web applications.
* An API that allows a... |
134,727 | What are the key differences between [HTML4](http://www.w3.org/TR/REC-html40/) and [HTML5 draft](http://www.w3.org/html/wg/html5/)?
Please keep the answers related to changed syntax and added/removed html elements. | 2008/09/25 | [
"https://Stackoverflow.com/questions/134727",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21473/"
] | HTML5 introduces a number of APIs that help in creating Web applications. These can be used together with the new elements introduced for applications:
* An API for playing of video and audio which can be used with the new video and audio elements.
* An API that enables offline Web applications.
* An API that allows a... | In short it is much simple compared to html, the long doctype is removed and also center and font tag is removed.
I also answered this difference in my blog :
<http://ravisinghblog.in/key-difference-between-html-and-html-5/> |
134,727 | What are the key differences between [HTML4](http://www.w3.org/TR/REC-html40/) and [HTML5 draft](http://www.w3.org/html/wg/html5/)?
Please keep the answers related to changed syntax and added/removed html elements. | 2008/09/25 | [
"https://Stackoverflow.com/questions/134727",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21473/"
] | From [Wikipedia](http://en.wikipedia.org/wiki/HTML_5#Differences_from_HTML_4):
* New parsing rules oriented towards flexible parsing and compatibility
* New elements – section, video, progress, nav, meter, time, aside, canvas
* New input attributes – dates and times, email, url
* New attributes – ping, charset, async
... | You might be interested in this list of [HTML5 elements and attributes](http://simon.html5.org/html5-elements).
Also, please note that it's "HTML 4", not "HTML4". Indeed, for HTML 5, both variants are used, but there is an important difference in meaning. HTML 5 refers to the name of the W3C specification, whereas "HT... |
134,727 | What are the key differences between [HTML4](http://www.w3.org/TR/REC-html40/) and [HTML5 draft](http://www.w3.org/html/wg/html5/)?
Please keep the answers related to changed syntax and added/removed html elements. | 2008/09/25 | [
"https://Stackoverflow.com/questions/134727",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21473/"
] | You might be interested in this list of [HTML5 elements and attributes](http://simon.html5.org/html5-elements).
Also, please note that it's "HTML 4", not "HTML4". Indeed, for HTML 5, both variants are used, but there is an important difference in meaning. HTML 5 refers to the name of the W3C specification, whereas "HT... | HTML 5 invites you give add a lot of semantic value to your code. What's more, there are natives solution to embed multimedia content.
The rest is important, but it's more technical sugar that will save you from doing the same stuff with a client programming language. |
134,727 | What are the key differences between [HTML4](http://www.w3.org/TR/REC-html40/) and [HTML5 draft](http://www.w3.org/html/wg/html5/)?
Please keep the answers related to changed syntax and added/removed html elements. | 2008/09/25 | [
"https://Stackoverflow.com/questions/134727",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21473/"
] | HTML5 introduces a number of APIs that help in creating Web applications. These can be used together with the new elements introduced for applications:
* An API for playing of video and audio which can be used with the new video and audio elements.
* An API that enables offline Web applications.
* An API that allows a... | HTML 5 invites you give add a lot of semantic value to your code. What's more, there are natives solution to embed multimedia content.
The rest is important, but it's more technical sugar that will save you from doing the same stuff with a client programming language. |
134,727 | What are the key differences between [HTML4](http://www.w3.org/TR/REC-html40/) and [HTML5 draft](http://www.w3.org/html/wg/html5/)?
Please keep the answers related to changed syntax and added/removed html elements. | 2008/09/25 | [
"https://Stackoverflow.com/questions/134727",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21473/"
] | You might be interested in this list of [HTML5 elements and attributes](http://simon.html5.org/html5-elements).
Also, please note that it's "HTML 4", not "HTML4". Indeed, for HTML 5, both variants are used, but there is an important difference in meaning. HTML 5 refers to the name of the W3C specification, whereas "HT... | In short it is much simple compared to html, the long doctype is removed and also center and font tag is removed.
I also answered this difference in my blog :
<http://ravisinghblog.in/key-difference-between-html-and-html-5/> |
134,727 | What are the key differences between [HTML4](http://www.w3.org/TR/REC-html40/) and [HTML5 draft](http://www.w3.org/html/wg/html5/)?
Please keep the answers related to changed syntax and added/removed html elements. | 2008/09/25 | [
"https://Stackoverflow.com/questions/134727",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21473/"
] | HTML5 has several goals which differentiate it from HTML4.
Consistency in Handling Malformed Documents
===========================================
The primary one is *consistent, defined error handling*. As you know, HTML purposely supports 'tag soup', or the ability to write malformed code and have it corrected into... | HTML 5 invites you give add a lot of semantic value to your code. What's more, there are natives solution to embed multimedia content.
The rest is important, but it's more technical sugar that will save you from doing the same stuff with a client programming language. |
134,727 | What are the key differences between [HTML4](http://www.w3.org/TR/REC-html40/) and [HTML5 draft](http://www.w3.org/html/wg/html5/)?
Please keep the answers related to changed syntax and added/removed html elements. | 2008/09/25 | [
"https://Stackoverflow.com/questions/134727",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21473/"
] | You'll want to check [HTML5 Differences from HTML4: W3C Working Group Note 9 December 2014](http://www.w3.org/TR/html5-diff/) for the complete differences. There are many new elements and element attributes. Some elements were removed and others have different semantic value than before.
There are also APIs defined, s... | HTML 5 invites you give add a lot of semantic value to your code. What's more, there are natives solution to embed multimedia content.
The rest is important, but it's more technical sugar that will save you from doing the same stuff with a client programming language. |
134,727 | What are the key differences between [HTML4](http://www.w3.org/TR/REC-html40/) and [HTML5 draft](http://www.w3.org/html/wg/html5/)?
Please keep the answers related to changed syntax and added/removed html elements. | 2008/09/25 | [
"https://Stackoverflow.com/questions/134727",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21473/"
] | You'll want to check [HTML5 Differences from HTML4: W3C Working Group Note 9 December 2014](http://www.w3.org/TR/html5-diff/) for the complete differences. There are many new elements and element attributes. Some elements were removed and others have different semantic value than before.
There are also APIs defined, s... | You might be interested in this list of [HTML5 elements and attributes](http://simon.html5.org/html5-elements).
Also, please note that it's "HTML 4", not "HTML4". Indeed, for HTML 5, both variants are used, but there is an important difference in meaning. HTML 5 refers to the name of the W3C specification, whereas "HT... |
134,727 | What are the key differences between [HTML4](http://www.w3.org/TR/REC-html40/) and [HTML5 draft](http://www.w3.org/html/wg/html5/)?
Please keep the answers related to changed syntax and added/removed html elements. | 2008/09/25 | [
"https://Stackoverflow.com/questions/134727",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21473/"
] | You'll want to check [HTML5 Differences from HTML4: W3C Working Group Note 9 December 2014](http://www.w3.org/TR/html5-diff/) for the complete differences. There are many new elements and element attributes. Some elements were removed and others have different semantic value than before.
There are also APIs defined, s... | Now W3c provides an official difference on their site:
<http://www.w3.org/TR/html5-diff/> |
61,323 | I have a lot of text for the website and all of them are important. I cant cut down the text much.
Then, is there any better way to represents those text?
The contents include some bullet points and two or more independent headings. | 2014/07/16 | [
"https://ux.stackexchange.com/questions/61323",
"https://ux.stackexchange.com",
"https://ux.stackexchange.com/users/50996/"
] | Depends on the purpose of your site. You have some techniques to improve your page with a lot of text. You could use some approaches like @Pierre's and Aleksandr Blekh answer. But if you can't hide your text for any reason, you have other options:
* **Choose a clean and simple font:**
To makes the text more attractiv... | It actually all depends on the *purpose* of your site and of course of its users.
If you take the example of a newspaper website, no one will argue that displaying a lot of text is bad practice. Such sites, however, have taken design steps to continually improve the experience for their users. One interesting idea is ... |
61,323 | I have a lot of text for the website and all of them are important. I cant cut down the text much.
Then, is there any better way to represents those text?
The contents include some bullet points and two or more independent headings. | 2014/07/16 | [
"https://ux.stackexchange.com/questions/61323",
"https://ux.stackexchange.com",
"https://ux.stackexchange.com/users/50996/"
] | There is several tricks.
1. Split information to paragraphs with different level headers.
Like you can see at wikipedia
<http://en.wikipedia.org/wiki/Article_(grammar)>
2. Hide information and show the wide button [show more]. Don't forget about formatting.

[download bm... | It actually all depends on the *purpose* of your site and of course of its users.
If you take the example of a newspaper website, no one will argue that displaying a lot of text is bad practice. Such sites, however, have taken design steps to continually improve the experience for their users. One interesting idea is ... |
61,323 | I have a lot of text for the website and all of them are important. I cant cut down the text much.
Then, is there any better way to represents those text?
The contents include some bullet points and two or more independent headings. | 2014/07/16 | [
"https://ux.stackexchange.com/questions/61323",
"https://ux.stackexchange.com",
"https://ux.stackexchange.com/users/50996/"
] | It actually all depends on the *purpose* of your site and of course of its users.
If you take the example of a newspaper website, no one will argue that displaying a lot of text is bad practice. Such sites, however, have taken design steps to continually improve the experience for their users. One interesting idea is ... | Without meaning to be facetious, printed books have spent centuries refining solutions to this problem, on several different levels. If you want to make it easy for someone to consume a large body of text through a rectangular viewport, look at the page of a comparable printed book and imagine it's a browser window.
W... |
61,323 | I have a lot of text for the website and all of them are important. I cant cut down the text much.
Then, is there any better way to represents those text?
The contents include some bullet points and two or more independent headings. | 2014/07/16 | [
"https://ux.stackexchange.com/questions/61323",
"https://ux.stackexchange.com",
"https://ux.stackexchange.com/users/50996/"
] | Depends on the purpose of your site. You have some techniques to improve your page with a lot of text. You could use some approaches like @Pierre's and Aleksandr Blekh answer. But if you can't hide your text for any reason, you have other options:
* **Choose a clean and simple font:**
To makes the text more attractiv... | Adding to some approaches mentioned in @Pierre's answer. You could use some *visual elements* that **hide** portions of the information (text, in your case) and **display** the hidden portions instantly **on demand** (usually, following user's action, such mouse click). Such visual elements include, but are not limited... |
61,323 | I have a lot of text for the website and all of them are important. I cant cut down the text much.
Then, is there any better way to represents those text?
The contents include some bullet points and two or more independent headings. | 2014/07/16 | [
"https://ux.stackexchange.com/questions/61323",
"https://ux.stackexchange.com",
"https://ux.stackexchange.com/users/50996/"
] | There is several tricks.
1. Split information to paragraphs with different level headers.
Like you can see at wikipedia
<http://en.wikipedia.org/wiki/Article_(grammar)>
2. Hide information and show the wide button [show more]. Don't forget about formatting.

[download bm... | Adding to some approaches mentioned in @Pierre's answer. You could use some *visual elements* that **hide** portions of the information (text, in your case) and **display** the hidden portions instantly **on demand** (usually, following user's action, such mouse click). Such visual elements include, but are not limited... |
61,323 | I have a lot of text for the website and all of them are important. I cant cut down the text much.
Then, is there any better way to represents those text?
The contents include some bullet points and two or more independent headings. | 2014/07/16 | [
"https://ux.stackexchange.com/questions/61323",
"https://ux.stackexchange.com",
"https://ux.stackexchange.com/users/50996/"
] | Adding to some approaches mentioned in @Pierre's answer. You could use some *visual elements* that **hide** portions of the information (text, in your case) and **display** the hidden portions instantly **on demand** (usually, following user's action, such mouse click). Such visual elements include, but are not limited... | Without meaning to be facetious, printed books have spent centuries refining solutions to this problem, on several different levels. If you want to make it easy for someone to consume a large body of text through a rectangular viewport, look at the page of a comparable printed book and imagine it's a browser window.
W... |
61,323 | I have a lot of text for the website and all of them are important. I cant cut down the text much.
Then, is there any better way to represents those text?
The contents include some bullet points and two or more independent headings. | 2014/07/16 | [
"https://ux.stackexchange.com/questions/61323",
"https://ux.stackexchange.com",
"https://ux.stackexchange.com/users/50996/"
] | Depends on the purpose of your site. You have some techniques to improve your page with a lot of text. You could use some approaches like @Pierre's and Aleksandr Blekh answer. But if you can't hide your text for any reason, you have other options:
* **Choose a clean and simple font:**
To makes the text more attractiv... | Without meaning to be facetious, printed books have spent centuries refining solutions to this problem, on several different levels. If you want to make it easy for someone to consume a large body of text through a rectangular viewport, look at the page of a comparable printed book and imagine it's a browser window.
W... |
61,323 | I have a lot of text for the website and all of them are important. I cant cut down the text much.
Then, is there any better way to represents those text?
The contents include some bullet points and two or more independent headings. | 2014/07/16 | [
"https://ux.stackexchange.com/questions/61323",
"https://ux.stackexchange.com",
"https://ux.stackexchange.com/users/50996/"
] | There is several tricks.
1. Split information to paragraphs with different level headers.
Like you can see at wikipedia
<http://en.wikipedia.org/wiki/Article_(grammar)>
2. Hide information and show the wide button [show more]. Don't forget about formatting.

[download bm... | Without meaning to be facetious, printed books have spent centuries refining solutions to this problem, on several different levels. If you want to make it easy for someone to consume a large body of text through a rectangular viewport, look at the page of a comparable printed book and imagine it's a browser window.
W... |
29,858,641 | I'm trying to get the selected text, not value, from my bootstrap drop down, but my .text() statement is returning a string that contains all the values with a '\n' in between.
Here is my rendered html
```
<select class="form-control" id="SpaceAccommodation" name="YogaSpaceAccommodation">
<option selected="select... | 2015/04/24 | [
"https://Stackoverflow.com/questions/29858641",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1186050/"
] | You can get the selected value's text with `$(this).find("option:selected").text()`.
```js
$('#SpaceAccommodation').change(function () {
var selectedText = $(this).find("option:selected").text();
$(".test").text(selectedText);
});
```
```html
<script src="https://code.jquery.com/jquery-1.6.4.min.js"></scr... | [Fiddle for you](http://jsfiddle.net/3UP3a/95/)
```
$(document).ready(function () {
$('.chzn-select').change(function () {
alert( $('.chzn-select option:selected').text());
});
});
<select id="second" class="chzn-select" style="width: 100px">
<option value="1">one</option>
<option value="... |
29,858,641 | I'm trying to get the selected text, not value, from my bootstrap drop down, but my .text() statement is returning a string that contains all the values with a '\n' in between.
Here is my rendered html
```
<select class="form-control" id="SpaceAccommodation" name="YogaSpaceAccommodation">
<option selected="select... | 2015/04/24 | [
"https://Stackoverflow.com/questions/29858641",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1186050/"
] | You can get the selected value's text with `$(this).find("option:selected").text()`.
```js
$('#SpaceAccommodation').change(function () {
var selectedText = $(this).find("option:selected").text();
$(".test").text(selectedText);
});
```
```html
<script src="https://code.jquery.com/jquery-1.6.4.min.js"></scr... | In case anyone cares, I've got another solution. I just looked at the arguments from the docs. You can do something like this (Assuming you've set the value tag of the option element.:
```
$('#type_dropdown')
.on('changed.bs.select',
function(e, clickedIndex, newValue, oldValue) {
... |
29,858,641 | I'm trying to get the selected text, not value, from my bootstrap drop down, but my .text() statement is returning a string that contains all the values with a '\n' in between.
Here is my rendered html
```
<select class="form-control" id="SpaceAccommodation" name="YogaSpaceAccommodation">
<option selected="select... | 2015/04/24 | [
"https://Stackoverflow.com/questions/29858641",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1186050/"
] | [Fiddle for you](http://jsfiddle.net/3UP3a/95/)
```
$(document).ready(function () {
$('.chzn-select').change(function () {
alert( $('.chzn-select option:selected').text());
});
});
<select id="second" class="chzn-select" style="width: 100px">
<option value="1">one</option>
<option value="... | In case anyone cares, I've got another solution. I just looked at the arguments from the docs. You can do something like this (Assuming you've set the value tag of the option element.:
```
$('#type_dropdown')
.on('changed.bs.select',
function(e, clickedIndex, newValue, oldValue) {
... |
68,225,539 | I'm working on a city device (That large interactive display) that is running android 5.1.
The app is working just fine on emulator, however the City Display did not come with google play services, and the google maps is not working on it.
Which google services and which versions of it do I need to install to get the... | 2021/07/02 | [
"https://Stackoverflow.com/questions/68225539",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14912872/"
] | I also got a great answer on [Bicep github discussion](https://github.com/Azure/bicep/discussions/3449)
Basically it boils down to building an array of subnets, use @batchSize(1) to ensure serial creation of subnets (I guess this achieves the same as using `dependsOn` in answer from @Manuel Batsching) and pass the sub... | It seems that ARM gets tangled up when it tries to deploy more than one subnet resource at the same time.
You can use `dependsOn` to make sure the subnets get created one after another:
```
resource existingVNET 'Microsoft.Network/virtualNetworks@2021-02-01' existing = {
name: 'the-existing-vnet'
}
resource subnet... |
27,197,217 | how am i able to join the 2 tables (A & B) below so that i can get the resulting table below
Please note that the query should join values that have the same time,
(i.e. `2014-11-29 9:58:23 6054 1` showing below in the result table)
**Table A**
```
ID time noise
76676 2014-11-29 09:55:24 6636... | 2014/11/28 | [
"https://Stackoverflow.com/questions/27197217",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/612242/"
] | You need to perform a `FULL OUTER JOIN` as already commented by Jynus.
```
select t1.time,t1.noise,t2.movement
from TableA t1 left join TableB t2
on t1.time = t2.time
UNION
select t1.time,t1.noise,t2.movement
from TableA t1 right join TableB t2
on t1.time = t2.time;
```
Per your last comment: that's correct and it... | First you need to union time of both tables and then create the join with both table to get noise and movment
```
SELECT ts.time, ta.noise, tb.movement
FROM (SELECT a.time from tablea a
UNION
SELECT b.time from tableb b) ts
LEFT OUTER JOIN tablea ta ON ts.time = ta.time
LEFT OUTER JOIN tabl... |
27,197,217 | how am i able to join the 2 tables (A & B) below so that i can get the resulting table below
Please note that the query should join values that have the same time,
(i.e. `2014-11-29 9:58:23 6054 1` showing below in the result table)
**Table A**
```
ID time noise
76676 2014-11-29 09:55:24 6636... | 2014/11/28 | [
"https://Stackoverflow.com/questions/27197217",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/612242/"
] | You need to perform a `FULL OUTER JOIN` as already commented by Jynus.
```
select t1.time,t1.noise,t2.movement
from TableA t1 left join TableB t2
on t1.time = t2.time
UNION
select t1.time,t1.noise,t2.movement
from TableA t1 right join TableB t2
on t1.time = t2.time;
```
Per your last comment: that's correct and it... | I like the `union` and aggregate approach to full outer joins:
```
select time, max(noise) as noise, max(movement) as movement
from ((select a.time, a.noise, NULL as movement
from tablea a
) union all
(select b.time, NULL, b.movement
from tableb b
)
) ab
group by time;
``` |
27,197,217 | how am i able to join the 2 tables (A & B) below so that i can get the resulting table below
Please note that the query should join values that have the same time,
(i.e. `2014-11-29 9:58:23 6054 1` showing below in the result table)
**Table A**
```
ID time noise
76676 2014-11-29 09:55:24 6636... | 2014/11/28 | [
"https://Stackoverflow.com/questions/27197217",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/612242/"
] | First you need to union time of both tables and then create the join with both table to get noise and movment
```
SELECT ts.time, ta.noise, tb.movement
FROM (SELECT a.time from tablea a
UNION
SELECT b.time from tableb b) ts
LEFT OUTER JOIN tablea ta ON ts.time = ta.time
LEFT OUTER JOIN tabl... | I like the `union` and aggregate approach to full outer joins:
```
select time, max(noise) as noise, max(movement) as movement
from ((select a.time, a.noise, NULL as movement
from tablea a
) union all
(select b.time, NULL, b.movement
from tableb b
)
) ab
group by time;
``` |
16,996,117 | I have several functions that start with `get_` in my code:
`get_num(...)` , `get_str(...)`
I want to change them to `get_*_struct(...)`.
Can I somehow match the `get_*` regex and then replace according to the pattern so that:
`get_num(...)` becomes `get_num_struct(...)`,
`get_str(...)` becomes `get_str_struct(...)... | 2013/06/08 | [
"https://Stackoverflow.com/questions/16996117",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/948550/"
] | To transform `get_num(...)` to `get_num_struct(...)`, you need to capture the correct text in the input. And, you can't put the parentheses in the regular expression because you may need to match pointers to functions too, as in `&get_distance`, and uses in comments. However, and this depends partially on the fact that... | For an alternate way to do it:
```
%s/get_\(\w*\)(/get_\1_struct(/g
```
What this does:
* `\w` matches to any "word character"; `\w*` matches 0 or more word characters.
* `\(...\)` tells vim to remember whatever matches `...`. So, `\(w*\)` means "match any number of word characters, and remember what you matched. Y... |
39,541,141 | Why do I have to input the number twice when I run the program below?
```
#include "stdafx.h"
#include <iostream>
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
int x;
int number;
cout << "Please enter a integer ." << endl;
cin >> number;
while (!(cin>>x))
{
cout << "I... | 2016/09/16 | [
"https://Stackoverflow.com/questions/39541141",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6841306/"
] | You use
```
cin >> number;
```
And then
```
while (!(cin>>x))
```
Both of which read a number. | you are taking input two times from user.the Ist input is for number variable and the other is for x variable in while loop.The while loop condition means "take input from user and when user enters an integer then stop the loop".so first time loop begins and value is assigned to x condition becomes false and the line a... |
2,480,551 | Let $Q\subset \mathbb{R}^2$ be the square determined by the points $(0,0)$, $(4,0)$, $(4,4)$, $(0,4)$ and let $f:Q\rightarrow Q$ be any continuous function which fixes the four points $(0,0)$, $(4,0)$, $(4,4)$, $(0,4)$.
Denote by $d\subset Q$ the diagonal between $(0,0)$ and $(4,4)$ and by $f(d)$ its image by $f$: it ... | 2017/10/19 | [
"https://math.stackexchange.com/questions/2480551",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/493456/"
] | Note that for $\forall n\in\mathbb{N}$, using $x=t^{n+1}$ gives
$$ \int\_0^1f(\sqrt[n+1]{x})dx=(n+1)\int\_0^1t^nf(t)dt=0 $$
and hence
$$ \int\_0^1t^nf(t)dt=0. $$
Then now you use the result in the link. | Lemma: If $f\in C([0,1]),$ then there exists a sequence of polynomials $p\_n$ such that $p\_n(x^2) \to f(x)$ uniformly as $n\to \infty.$
Proof: The function $f(\sqrt x)\in C([0,1]).$ By Weierstrass, there is a sequence of polynomials $p\_n$ such that $p\_n(x) \to f(\sqrt x)$ uniformly on $[0,1].$. It follows easily th... |
56,692,784 | I have an SVG I'm using as an `<img>` tag. Using Styled Components I am trying to get to a point where I change the stroke color upon hover.
I imported the SVG:
```
import BurgerOpenSvg from '../../images/burger_open.svg';
```
I Created a Styled Components for it:
```
const BurgerImageStyle = styled.img`
&... | 2019/06/20 | [
"https://Stackoverflow.com/questions/56692784",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/282918/"
] | So I looked into this. Turns out you cannot CSS style an SVG image you're loading using the `<img>` tag.
What I've done is this:
I inlined my SVG like this:
```
<BurgerImageStyle x="0px" y="0px" viewBox="0 0 38 28.4">
<line x1="0" y1="1" x2="38" y2="1"/>
<line x1="0" y1="14.2" x2="38" y2="14.2"/>
... | If you want to have some styling shared across multiple SVGs and you don't want to have an extra dependency on `react-inlinesvg` you can use this thing instead:
In `src` prop it accepts SVG React component
```
import styled from 'styled-components';
import React, { FC, memo } from 'react';
type StyledIconProps = {
... |
56,692,784 | I have an SVG I'm using as an `<img>` tag. Using Styled Components I am trying to get to a point where I change the stroke color upon hover.
I imported the SVG:
```
import BurgerOpenSvg from '../../images/burger_open.svg';
```
I Created a Styled Components for it:
```
const BurgerImageStyle = styled.img`
&... | 2019/06/20 | [
"https://Stackoverflow.com/questions/56692784",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/282918/"
] | So I looked into this. Turns out you cannot CSS style an SVG image you're loading using the `<img>` tag.
What I've done is this:
I inlined my SVG like this:
```
<BurgerImageStyle x="0px" y="0px" viewBox="0 0 38 28.4">
<line x1="0" y1="1" x2="38" y2="1"/>
<line x1="0" y1="14.2" x2="38" y2="14.2"/>
... | In addition to what [JasonGenX](https://stackoverflow.com/users/282918/jasongenx) I propose the next case when you're using a SVG component (like one generated using [SVGR](https://react-svgr.com/)). This is even on the [styled-components documentation](https://styled-components.com/docs/advanced#referring-to-other-com... |
56,692,784 | I have an SVG I'm using as an `<img>` tag. Using Styled Components I am trying to get to a point where I change the stroke color upon hover.
I imported the SVG:
```
import BurgerOpenSvg from '../../images/burger_open.svg';
```
I Created a Styled Components for it:
```
const BurgerImageStyle = styled.img`
&... | 2019/06/20 | [
"https://Stackoverflow.com/questions/56692784",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/282918/"
] | If you are looking to avoid writing separate components or copying your raw SVG file, consider `react-inlinesvg`;
<https://github.com/gilbarbara/react-inlinesvg>
```
import React from "react";
import styled from "styled-components";
import SVG from "react-inlinesvg";
import radio from "./radio.svg";
interface SVGPro... | If you want to have some styling shared across multiple SVGs and you don't want to have an extra dependency on `react-inlinesvg` you can use this thing instead:
In `src` prop it accepts SVG React component
```
import styled from 'styled-components';
import React, { FC, memo } from 'react';
type StyledIconProps = {
... |
56,692,784 | I have an SVG I'm using as an `<img>` tag. Using Styled Components I am trying to get to a point where I change the stroke color upon hover.
I imported the SVG:
```
import BurgerOpenSvg from '../../images/burger_open.svg';
```
I Created a Styled Components for it:
```
const BurgerImageStyle = styled.img`
&... | 2019/06/20 | [
"https://Stackoverflow.com/questions/56692784",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/282918/"
] | If you are looking to avoid writing separate components or copying your raw SVG file, consider `react-inlinesvg`;
<https://github.com/gilbarbara/react-inlinesvg>
```
import React from "react";
import styled from "styled-components";
import SVG from "react-inlinesvg";
import radio from "./radio.svg";
interface SVGPro... | In addition to what [JasonGenX](https://stackoverflow.com/users/282918/jasongenx) I propose the next case when you're using a SVG component (like one generated using [SVGR](https://react-svgr.com/)). This is even on the [styled-components documentation](https://styled-components.com/docs/advanced#referring-to-other-com... |
56,692,784 | I have an SVG I'm using as an `<img>` tag. Using Styled Components I am trying to get to a point where I change the stroke color upon hover.
I imported the SVG:
```
import BurgerOpenSvg from '../../images/burger_open.svg';
```
I Created a Styled Components for it:
```
const BurgerImageStyle = styled.img`
&... | 2019/06/20 | [
"https://Stackoverflow.com/questions/56692784",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/282918/"
] | If you want to have some styling shared across multiple SVGs and you don't want to have an extra dependency on `react-inlinesvg` you can use this thing instead:
In `src` prop it accepts SVG React component
```
import styled from 'styled-components';
import React, { FC, memo } from 'react';
type StyledIconProps = {
... | In addition to what [JasonGenX](https://stackoverflow.com/users/282918/jasongenx) I propose the next case when you're using a SVG component (like one generated using [SVGR](https://react-svgr.com/)). This is even on the [styled-components documentation](https://styled-components.com/docs/advanced#referring-to-other-com... |
56,851,696 | I have created the following application template in R shiny :
```
library(shiny)
library(shinyjs)
ui <- fluidPage(
useShinyjs(),
navbarPage("",actionButton("toggleSidebar", "toggle", icon =
icon("database")),
tabPanel("tab",
div( id ="Sidebar",sidebarPanel(
)),mai... | 2019/07/02 | [
"https://Stackoverflow.com/questions/56851696",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11657195/"
] | The part that is not visible that you mention is in fact the empty title parameter that you have "". Leaving this out as below places the toggle button in the title position:
```
library(shiny)
library(shinyjs)
ui <- fluidPage(
useShinyjs(),
navbarPage(actionButton("toggleSidebar", "toggle", icon =
icon("datab... | I made an example with multiple tabPanels.
```
library(shiny)
library(shinyjs)
ui <- fluidPage(
useShinyjs(),
navbarPage(title = tagList("title",actionLink("sidebar_button","",icon = icon("bars"))),
id = "navbarID",
tabPanel("tab1",
div(class="sidebar"
... |
4,472,529 | I was wondering if there is any way to access variables trapped by closure in a function from outside the function; e.g. if I have:
```
A = function(b) {
var c = function() {//some code using b};
foo: function() {
//do things with c;
}
}
```
is there any way to get access to `c` in an instance o... | 2010/12/17 | [
"https://Stackoverflow.com/questions/4472529",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/374449/"
] | If none of the above is possible in your script, a **very hacky** solution is to store it in a hidden html-object:
```
// store inside of closure
html.innerHTML+='<div id="hiddenStore" style="display:none"></div>';
o=document.getElementById("hiddenStore")
o.innerHTML="store this in closure"
```
and outside you can r... | You should be able to use an if statement and do something like:
```js
if(VaraiableBeingPasses === "somethingUniqe") {
return theValueOfC;
}
``` |
4,472,529 | I was wondering if there is any way to access variables trapped by closure in a function from outside the function; e.g. if I have:
```
A = function(b) {
var c = function() {//some code using b};
foo: function() {
//do things with c;
}
}
```
is there any way to get access to `c` in an instance o... | 2010/12/17 | [
"https://Stackoverflow.com/questions/4472529",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/374449/"
] | The whole point to that pattern is to prevent 'c' from being accessed externally. But you can access foo() as a method, so make it that it will see 'c' in its scope:
```
A = function(b) {
var c = function() {//some code using b};
this.foo = function() {
return c();
}
}
``` | If none of the above is possible in your script, a **very hacky** solution is to store it in a hidden html-object:
```
// store inside of closure
html.innerHTML+='<div id="hiddenStore" style="display:none"></div>';
o=document.getElementById("hiddenStore")
o.innerHTML="store this in closure"
```
and outside you can r... |
4,472,529 | I was wondering if there is any way to access variables trapped by closure in a function from outside the function; e.g. if I have:
```
A = function(b) {
var c = function() {//some code using b};
foo: function() {
//do things with c;
}
}
```
is there any way to get access to `c` in an instance o... | 2010/12/17 | [
"https://Stackoverflow.com/questions/4472529",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/374449/"
] | Variables within a closure aren't *directly* accessible from the outside by any means. However, closures within that closure that have the variable in scope can access them, and if you make those closures accessible from the outside, it's almost as good.
Here's an example:
```
var A = function(b) {
var c = b + 10... | If none of the above is possible in your script, a **very hacky** solution is to store it in a hidden html-object:
```
// store inside of closure
html.innerHTML+='<div id="hiddenStore" style="display:none"></div>';
o=document.getElementById("hiddenStore")
o.innerHTML="store this in closure"
```
and outside you can r... |
4,472,529 | I was wondering if there is any way to access variables trapped by closure in a function from outside the function; e.g. if I have:
```
A = function(b) {
var c = function() {//some code using b};
foo: function() {
//do things with c;
}
}
```
is there any way to get access to `c` in an instance o... | 2010/12/17 | [
"https://Stackoverflow.com/questions/4472529",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/374449/"
] | The whole point to that pattern is to prevent 'c' from being accessed externally. But you can access foo() as a method, so make it that it will see 'c' in its scope:
```
A = function(b) {
var c = function() {//some code using b};
this.foo = function() {
return c();
}
}
``` | You should be able to use an if statement and do something like:
```js
if(VaraiableBeingPasses === "somethingUniqe") {
return theValueOfC;
}
``` |
4,472,529 | I was wondering if there is any way to access variables trapped by closure in a function from outside the function; e.g. if I have:
```
A = function(b) {
var c = function() {//some code using b};
foo: function() {
//do things with c;
}
}
```
is there any way to get access to `c` in an instance o... | 2010/12/17 | [
"https://Stackoverflow.com/questions/4472529",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/374449/"
] | Answers above are correct, but they also imply that you'll have to modify the function to see those closed variables.
Redefining the function with the getter methods will do the task.
You can do it dynamically.
See the example below
```
function alertMe() {
var message = "Hello world";
console.log(message);
... | The whole point to that pattern is to prevent 'c' from being accessed externally. But you can access foo() as a method, so make it that it will see 'c' in its scope:
```
A = function(b) {
var c = function() {//some code using b};
this.foo = function() {
return c();
}
}
``` |
4,472,529 | I was wondering if there is any way to access variables trapped by closure in a function from outside the function; e.g. if I have:
```
A = function(b) {
var c = function() {//some code using b};
foo: function() {
//do things with c;
}
}
```
is there any way to get access to `c` in an instance o... | 2010/12/17 | [
"https://Stackoverflow.com/questions/4472529",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/374449/"
] | Answers above are correct, but they also imply that you'll have to modify the function to see those closed variables.
Redefining the function with the getter methods will do the task.
You can do it dynamically.
See the example below
```
function alertMe() {
var message = "Hello world";
console.log(message);
... | If none of the above is possible in your script, a **very hacky** solution is to store it in a hidden html-object:
```
// store inside of closure
html.innerHTML+='<div id="hiddenStore" style="display:none"></div>';
o=document.getElementById("hiddenStore")
o.innerHTML="store this in closure"
```
and outside you can r... |
4,472,529 | I was wondering if there is any way to access variables trapped by closure in a function from outside the function; e.g. if I have:
```
A = function(b) {
var c = function() {//some code using b};
foo: function() {
//do things with c;
}
}
```
is there any way to get access to `c` in an instance o... | 2010/12/17 | [
"https://Stackoverflow.com/questions/4472529",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/374449/"
] | Variables within a closure aren't *directly* accessible from the outside by any means. However, closures within that closure that have the variable in scope can access them, and if you make those closures accessible from the outside, it's almost as good.
Here's an example:
```
var A = function(b) {
var c = b + 10... | Answers above are correct, but they also imply that you'll have to modify the function to see those closed variables.
Redefining the function with the getter methods will do the task.
You can do it dynamically.
See the example below
```
function alertMe() {
var message = "Hello world";
console.log(message);
... |
4,472,529 | I was wondering if there is any way to access variables trapped by closure in a function from outside the function; e.g. if I have:
```
A = function(b) {
var c = function() {//some code using b};
foo: function() {
//do things with c;
}
}
```
is there any way to get access to `c` in an instance o... | 2010/12/17 | [
"https://Stackoverflow.com/questions/4472529",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/374449/"
] | No, not without a getter function on `A` which returns `c` | You should be able to use an if statement and do something like:
```js
if(VaraiableBeingPasses === "somethingUniqe") {
return theValueOfC;
}
``` |
4,472,529 | I was wondering if there is any way to access variables trapped by closure in a function from outside the function; e.g. if I have:
```
A = function(b) {
var c = function() {//some code using b};
foo: function() {
//do things with c;
}
}
```
is there any way to get access to `c` in an instance o... | 2010/12/17 | [
"https://Stackoverflow.com/questions/4472529",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/374449/"
] | The whole point to that pattern is to prevent 'c' from being accessed externally. But you can access foo() as a method, so make it that it will see 'c' in its scope:
```
A = function(b) {
var c = function() {//some code using b};
this.foo = function() {
return c();
}
}
``` | No, not without a getter function on `A` which returns `c` |
4,472,529 | I was wondering if there is any way to access variables trapped by closure in a function from outside the function; e.g. if I have:
```
A = function(b) {
var c = function() {//some code using b};
foo: function() {
//do things with c;
}
}
```
is there any way to get access to `c` in an instance o... | 2010/12/17 | [
"https://Stackoverflow.com/questions/4472529",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/374449/"
] | If you only need access to certain variables and you can change the core code there's one easy answer that won't slowdown your code or reasons you made it a closure in any significant way. You just make a reference in the global scope to it basically.
```
(function($){
let myClosedOffObj = {
"you can't get... | If none of the above is possible in your script, a **very hacky** solution is to store it in a hidden html-object:
```
// store inside of closure
html.innerHTML+='<div id="hiddenStore" style="display:none"></div>';
o=document.getElementById("hiddenStore")
o.innerHTML="store this in closure"
```
and outside you can r... |
39,303,820 | I am trying to print the number of prime factors of a given number. My code works fine for some inputs, but for other inputs it's getting terminated and I can't understand why.
Sample Input:
```
1
561473
```
Output:
```
2
```
Sample Input:
```
1
10093
```
And the program terminates.
At some point, I though... | 2016/09/03 | [
"https://Stackoverflow.com/questions/39303820",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5584455/"
] | Use first row and first column as list of flags for marking corresponding column and row respectively. So in total, there would be `m+n-1` flags available to you for `mxn` matrix, only one ***extra*** flag would be needed to mark `1st` row or `1st` column (its upon programmer to choose, doesn't make difference though).... | A naive approach would be to simply iterate the whole matrix:
```
for i in 1 to number of rows
for j in 1 to number of columns
if n(i,j) == 0:
for all n(i, 1 to number of columns): set to 0
for all n(1 to number of rows, j): set to 0
```
This doesn't require any additional space besides the the two loo... |
39,303,820 | I am trying to print the number of prime factors of a given number. My code works fine for some inputs, but for other inputs it's getting terminated and I can't understand why.
Sample Input:
```
1
561473
```
Output:
```
2
```
Sample Input:
```
1
10093
```
And the program terminates.
At some point, I though... | 2016/09/03 | [
"https://Stackoverflow.com/questions/39303820",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5584455/"
] | Use first row and first column as list of flags for marking corresponding column and row respectively. So in total, there would be `m+n-1` flags available to you for `mxn` matrix, only one ***extra*** flag would be needed to mark `1st` row or `1st` column (its upon programmer to choose, doesn't make difference though).... | * Reduce the space used to O(1) by using boolean variables (and not boolean array)
* check if first row & column are zero. If yes, set the corresponding boolean variables: `rowZero` and `colZero`
* iterate through the remaining rows & columns and mark them as zero wherever applicable
* if the first row/column is not ze... |
61,823,442 | I have been trying to print the points like `The position of the point is (1,2)` from using class, but I can't figure out a way to do it. I simply can't find a way to return two numbers like that, but the problem requires solution that way.
```
#include <iostream>
using namespace std;
class MyPoint{
public:
... | 2020/05/15 | [
"https://Stackoverflow.com/questions/61823442",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12697890/"
] | Your `point_display` could return a string composed of the 2 values:
```
std::string point_display()
{
return std::string{"("} + std::to_string(x)
+ "," + std::to_string(x) + ")";
}
```
Alternatively, as your question asks about returning 2 values, the function could return a pair:
```
std::pair<int,int>... | If all you want to do is *print* the coordinates, you could have the method do it:
```
void point_display()
{
cout << "(" << x << ", " << y << ")";
}
...
cout<<"The position of the point is ";
mypoint.point_display();
cout << endl;
```
If you really want to *return* the coordinates, you could have separate acces... |
61,823,442 | I have been trying to print the points like `The position of the point is (1,2)` from using class, but I can't figure out a way to do it. I simply can't find a way to return two numbers like that, but the problem requires solution that way.
```
#include <iostream>
using namespace std;
class MyPoint{
public:
... | 2020/05/15 | [
"https://Stackoverflow.com/questions/61823442",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12697890/"
] | The usual solution to this is to provide an overload of `operator <<` for class `MyPoint` to print the point.
Something like this:
```
#include <iostream>
using namespace std;
class MyPoint{
public:
int x,y,radius;
MyPoint()
{
x=0;
y=0;
}
MyPoint... | If all you want to do is *print* the coordinates, you could have the method do it:
```
void point_display()
{
cout << "(" << x << ", " << y << ")";
}
...
cout<<"The position of the point is ";
mypoint.point_display();
cout << endl;
```
If you really want to *return* the coordinates, you could have separate acces... |
52,052,220 | Suppose have 3 numbers:
```
val x = 10
val y = 5
val z = 14
```
and we want to do some logic like:
```
if (x + y > z) {
println(x + y)
} else if (x + y < z) {
println(-1)
} else {
println(0)
}
```
If our "z + y" operation is expensive we must calculate it exactly once:
```
val sum = x + y
if (sum > z) {
... | 2018/08/28 | [
"https://Stackoverflow.com/questions/52052220",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1403012/"
] | Calculating the `sum` in a temporary variable is no less functional than your other solutions. And if the calculation is complex then you can use the name of the temporary variable to describe the result and make the code more readable.
If you want to compose it with other code then you can easily wrap it in a functio... | Tim's answer is correct, but I would add that what you really want is a single **expression**. You stated that here, though you used the word "function" instead:
>
> Something that I can compound with another function
>
>
>
However, Scala is already expression-based, so this is actually a single expression:
```
... |
52,052,220 | Suppose have 3 numbers:
```
val x = 10
val y = 5
val z = 14
```
and we want to do some logic like:
```
if (x + y > z) {
println(x + y)
} else if (x + y < z) {
println(-1)
} else {
println(0)
}
```
If our "z + y" operation is expensive we must calculate it exactly once:
```
val sum = x + y
if (sum > z) {
... | 2018/08/28 | [
"https://Stackoverflow.com/questions/52052220",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1403012/"
] | Calculating the `sum` in a temporary variable is no less functional than your other solutions. And if the calculation is complex then you can use the name of the temporary variable to describe the result and make the code more readable.
If you want to compose it with other code then you can easily wrap it in a functio... | Why did you try to compare two int values, if scala has the Ordering implicit type class for Int and you may call compare method instead of code above?
Use compare from java comparator
```
(5 : Int).compare(9: Int) == -1
def compare(that: A): Int
/** Returns true if `this` is less than `that`
*/
object Order... |
52,052,220 | Suppose have 3 numbers:
```
val x = 10
val y = 5
val z = 14
```
and we want to do some logic like:
```
if (x + y > z) {
println(x + y)
} else if (x + y < z) {
println(-1)
} else {
println(0)
}
```
If our "z + y" operation is expensive we must calculate it exactly once:
```
val sum = x + y
if (sum > z) {
... | 2018/08/28 | [
"https://Stackoverflow.com/questions/52052220",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1403012/"
] | Tim's answer is correct, but I would add that what you really want is a single **expression**. You stated that here, though you used the word "function" instead:
>
> Something that I can compound with another function
>
>
>
However, Scala is already expression-based, so this is actually a single expression:
```
... | Why did you try to compare two int values, if scala has the Ordering implicit type class for Int and you may call compare method instead of code above?
Use compare from java comparator
```
(5 : Int).compare(9: Int) == -1
def compare(that: A): Int
/** Returns true if `this` is less than `that`
*/
object Order... |
18,361 | When I'm in the terminal and I press `<C-w>s` the screen is split vertically and the terminal buffer is shown twice. Then I have to do `:terminal` if I want a separate terminal instance.
Typing something in one window is in real time shown in the other. This is a *feature* if I was editing a file but is an *inconvenie... | 2018/12/20 | [
"https://vi.stackexchange.com/questions/18361",
"https://vi.stackexchange.com",
"https://vi.stackexchange.com/users/7129/"
] | This is a documented 'feature' of `:tnoremap` as `tnoremap` effectively only work for insert mode style actions and thus any variant using `tmap` will not work.
Adding the below to `init.vim` will remap the action of Ctrl-w + s in normal mode only for the terminal buffer
`autocmd BufWinEnter,WinEnter term://* nnorema... | Adding this to `~/.config/init.vim` solved it:
```
" Split into a new terminal instance
tnoremap <C-w>s <C-\><C-n><C-w><C-s> :terminal <CR>
tnoremap <C-w>v <C-\><C-n><C-w><C-v> :terminal <CR>
set splitbelow
set splitright
... |
18,361 | When I'm in the terminal and I press `<C-w>s` the screen is split vertically and the terminal buffer is shown twice. Then I have to do `:terminal` if I want a separate terminal instance.
Typing something in one window is in real time shown in the other. This is a *feature* if I was editing a file but is an *inconvenie... | 2018/12/20 | [
"https://vi.stackexchange.com/questions/18361",
"https://vi.stackexchange.com",
"https://vi.stackexchange.com/users/7129/"
] | The following function will `:h :split` the current buffer and create a new terminal buffer if the current buffer is a terminal buffer. Otherwise it will just `:h :split`. Bind this function to both `:h :nnoremap` and `:h :tnoremap` variants of mappings to get the required results.
```
function! TermSplit() abort
... | Adding this to `~/.config/init.vim` solved it:
```
" Split into a new terminal instance
tnoremap <C-w>s <C-\><C-n><C-w><C-s> :terminal <CR>
tnoremap <C-w>v <C-\><C-n><C-w><C-v> :terminal <CR>
set splitbelow
set splitright
... |
112,906 | I am upgrading a bathroom fan from below (no attic access) and replacing the single pole switch with a timer switch. I’ve wired switches and outlets before, but this one is throwing me for a loop. I don’t trust how it was wired before, and I’d like to do this correctly. Romex 1A and 1B were formerly a single 12-2 Romex... | 2017/04/14 | [
"https://diy.stackexchange.com/questions/112906",
"https://diy.stackexchange.com",
"https://diy.stackexchange.com/users/50622/"
] | >
> how would I connect everything up at the light to allow the attic outlets to still have continuous power?
>
>
>
Wire neutrals #1, #2, and #5 together; there will be no neutral connection to Romex #2. Connect "black" #1, #2, & #3 together, to deliver power to the outlet in the attic and to the wall switch; #3 ... | Get a different timer
---------------------
You'll have to take your timer back and get one that doesn't require the neutral to work, unfortunately. You'll also need to make sure your timer is rated for a fan load (many are not).
If you are using a single pole switch instead of the timer -- connect one terminal to th... |
112,906 | I am upgrading a bathroom fan from below (no attic access) and replacing the single pole switch with a timer switch. I’ve wired switches and outlets before, but this one is throwing me for a loop. I don’t trust how it was wired before, and I’d like to do this correctly. Romex 1A and 1B were formerly a single 12-2 Romex... | 2017/04/14 | [
"https://diy.stackexchange.com/questions/112906",
"https://diy.stackexchange.com",
"https://diy.stackexchange.com/users/50622/"
] | >
> how would I connect everything up at the light to allow the attic outlets to still have continuous power?
>
>
>
Wire neutrals #1, #2, and #5 together; there will be no neutral connection to Romex #2. Connect "black" #1, #2, & #3 together, to deliver power to the outlet in the attic and to the wall switch; #3 ... | Why not use the classic spring operated timer switch? It doesn't need neutral to get its own power, it runs on *you* power! Then you can wire it as Jimmy recommends.
I hate those digital timers, the UI is rather confusing. Why seven switches for a simple function?
You may also be able to find smart switches with in... |
83,400 | Here are a few new sentences I have written in my diary:
>
> Our manager was asked to negotiate with the retailing shops' managers and signed the agreements with them. These retailing shops will have to keep our cakes in good condition in their window cabinets. Because the cakes will occupy some of the **places** in ... | 2016/03/04 | [
"https://ell.stackexchange.com/questions/83400",
"https://ell.stackexchange.com",
"https://ell.stackexchange.com/users/13998/"
] | The first word that comes to my mind is "spot". | While afraid I might be a bit out of context, I'm wondering if it ia really the word "place" that is causing the problem. With that in mind, my eyes quickly jumped to "occupy", which does give an air of being a "negative" word, if the idea of "not taking space" is the ultimate goal. Based on these assumptions, a comple... |
83,400 | Here are a few new sentences I have written in my diary:
>
> Our manager was asked to negotiate with the retailing shops' managers and signed the agreements with them. These retailing shops will have to keep our cakes in good condition in their window cabinets. Because the cakes will occupy some of the **places** in ... | 2016/03/04 | [
"https://ell.stackexchange.com/questions/83400",
"https://ell.stackexchange.com",
"https://ell.stackexchange.com/users/13998/"
] | The first word that comes to my mind is "spot". | You can always say
>
> Because the cakes will occupy *a (small) part* of their window cabinets
>
>
>
But *place* has so many different meanings, and the sentence already implies there are multiple places in the window cabinet, that I would not expect those places to be big in size. |
83,400 | Here are a few new sentences I have written in my diary:
>
> Our manager was asked to negotiate with the retailing shops' managers and signed the agreements with them. These retailing shops will have to keep our cakes in good condition in their window cabinets. Because the cakes will occupy some of the **places** in ... | 2016/03/04 | [
"https://ell.stackexchange.com/questions/83400",
"https://ell.stackexchange.com",
"https://ell.stackexchange.com/users/13998/"
] | Retail uses the phrase 'display spaces' for any type of area where a product is being displayed for promotional purposes. | positions, slots, spots, locations...
I think position is used commonly in a retail or advertising context. |
83,400 | Here are a few new sentences I have written in my diary:
>
> Our manager was asked to negotiate with the retailing shops' managers and signed the agreements with them. These retailing shops will have to keep our cakes in good condition in their window cabinets. Because the cakes will occupy some of the **places** in ... | 2016/03/04 | [
"https://ell.stackexchange.com/questions/83400",
"https://ell.stackexchange.com",
"https://ell.stackexchange.com/users/13998/"
] | You can always say
>
> Because the cakes will occupy *a (small) part* of their window cabinets
>
>
>
But *place* has so many different meanings, and the sentence already implies there are multiple places in the window cabinet, that I would not expect those places to be big in size. | positions, slots, spots, locations...
I think position is used commonly in a retail or advertising context. |
83,400 | Here are a few new sentences I have written in my diary:
>
> Our manager was asked to negotiate with the retailing shops' managers and signed the agreements with them. These retailing shops will have to keep our cakes in good condition in their window cabinets. Because the cakes will occupy some of the **places** in ... | 2016/03/04 | [
"https://ell.stackexchange.com/questions/83400",
"https://ell.stackexchange.com",
"https://ell.stackexchange.com/users/13998/"
] | Baked goods are typically arranged inside glass display cases. The space is usually referred to as **shelf space**.
[This article](http://www.foodservicewarehouse.com/blog/how-to-display-your-bakery-items/) might give you some vocabulary.
And [this one](http://bizshifts-trends.com/2014/05/18/war-retail-shelf-space-b... | positions, slots, spots, locations...
I think position is used commonly in a retail or advertising context. |
83,400 | Here are a few new sentences I have written in my diary:
>
> Our manager was asked to negotiate with the retailing shops' managers and signed the agreements with them. These retailing shops will have to keep our cakes in good condition in their window cabinets. Because the cakes will occupy some of the **places** in ... | 2016/03/04 | [
"https://ell.stackexchange.com/questions/83400",
"https://ell.stackexchange.com",
"https://ell.stackexchange.com/users/13998/"
] | Baked goods are typically arranged inside glass display cases. The space is usually referred to as **shelf space**.
[This article](http://www.foodservicewarehouse.com/blog/how-to-display-your-bakery-items/) might give you some vocabulary.
And [this one](http://bizshifts-trends.com/2014/05/18/war-retail-shelf-space-b... | Retail uses the phrase 'display spaces' for any type of area where a product is being displayed for promotional purposes. |
83,400 | Here are a few new sentences I have written in my diary:
>
> Our manager was asked to negotiate with the retailing shops' managers and signed the agreements with them. These retailing shops will have to keep our cakes in good condition in their window cabinets. Because the cakes will occupy some of the **places** in ... | 2016/03/04 | [
"https://ell.stackexchange.com/questions/83400",
"https://ell.stackexchange.com",
"https://ell.stackexchange.com/users/13998/"
] | You can always say
>
> Because the cakes will occupy *a (small) part* of their window cabinets
>
>
>
But *place* has so many different meanings, and the sentence already implies there are multiple places in the window cabinet, that I would not expect those places to be big in size. | While afraid I might be a bit out of context, I'm wondering if it ia really the word "place" that is causing the problem. With that in mind, my eyes quickly jumped to "occupy", which does give an air of being a "negative" word, if the idea of "not taking space" is the ultimate goal. Based on these assumptions, a comple... |
83,400 | Here are a few new sentences I have written in my diary:
>
> Our manager was asked to negotiate with the retailing shops' managers and signed the agreements with them. These retailing shops will have to keep our cakes in good condition in their window cabinets. Because the cakes will occupy some of the **places** in ... | 2016/03/04 | [
"https://ell.stackexchange.com/questions/83400",
"https://ell.stackexchange.com",
"https://ell.stackexchange.com/users/13998/"
] | The first word that comes to my mind is "spot". | positions, slots, spots, locations...
I think position is used commonly in a retail or advertising context. |
83,400 | Here are a few new sentences I have written in my diary:
>
> Our manager was asked to negotiate with the retailing shops' managers and signed the agreements with them. These retailing shops will have to keep our cakes in good condition in their window cabinets. Because the cakes will occupy some of the **places** in ... | 2016/03/04 | [
"https://ell.stackexchange.com/questions/83400",
"https://ell.stackexchange.com",
"https://ell.stackexchange.com/users/13998/"
] | Retail uses the phrase 'display spaces' for any type of area where a product is being displayed for promotional purposes. | While afraid I might be a bit out of context, I'm wondering if it ia really the word "place" that is causing the problem. With that in mind, my eyes quickly jumped to "occupy", which does give an air of being a "negative" word, if the idea of "not taking space" is the ultimate goal. Based on these assumptions, a comple... |
83,400 | Here are a few new sentences I have written in my diary:
>
> Our manager was asked to negotiate with the retailing shops' managers and signed the agreements with them. These retailing shops will have to keep our cakes in good condition in their window cabinets. Because the cakes will occupy some of the **places** in ... | 2016/03/04 | [
"https://ell.stackexchange.com/questions/83400",
"https://ell.stackexchange.com",
"https://ell.stackexchange.com/users/13998/"
] | The first word that comes to my mind is "spot". | Retail uses the phrase 'display spaces' for any type of area where a product is being displayed for promotional purposes. |
44,396,735 | I manage facilities for a large complex and am responsible for issuing and tracking physical keys for our clients here. Keys are printed with specific codes (which match the lock itself), and I have also numbered individual doors on a separate system, to account for the fact that locks often change doors.
In my databa... | 2017/06/06 | [
"https://Stackoverflow.com/questions/44396735",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2755403/"
] | $scope.test\_prop = testFactory.read().prop;
In the above line, the initial value of prop is 0. In javascript, numbers are copied by value, but objects/arrays are by reference. $scope.test\_obj is referencing the service object, while $scope.test\_prop is not. | I would say that `$scope.test_obj` is a reference to the factory's `obj` while `$scope.test_prop` is a copied value of `obj.prop`.
If you add the following to your example :
```
console.log(testFactory.read()); // output : Object {prop: 0}
console.log(testFactory.read().prop); // output 0
```
You'd see that the rea... |
2,613,418 | Question: **An urn contains three balls. The number of red balls in the urn is $0,1,2$ or $3$ equally likely. A ball is drawn from the urn at random. Given that the ball drawn is red, what is the conditional expected number of red balls left in the urn?**
Comment: Poorly worded question, but with it were two equations... | 2018/01/20 | [
"https://math.stackexchange.com/questions/2613418",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/523225/"
] | It seems correct to me
$$x^2+3x(6-x)+2(6-x)=60\iff x^2+18x-3x^2+12-2x-60=0$$
$$\iff-2x^2+16x-48=0\iff x^2-8x+24=0\implies x=4\pm2i\sqrt2$$ | we get
$$x^2+3x(6-x)+2(6-x)=60$$
simplifying we obtain
$$-2x^2+16x-48=0$$
or
$$x^2-8x+24=0$$
can you solve this?
you will get
$$x\_1=4+2\sqrt{2}i$$
or
$$x\_2=4-2\sqrt{2}i$$ and
and
$$y\_1=2-2\sqrt{2}i$$
$$y\_2=2+2\sqrt{2}i$$ so $x+y=6$ |
2,613,418 | Question: **An urn contains three balls. The number of red balls in the urn is $0,1,2$ or $3$ equally likely. A ball is drawn from the urn at random. Given that the ball drawn is red, what is the conditional expected number of red balls left in the urn?**
Comment: Poorly worded question, but with it were two equations... | 2018/01/20 | [
"https://math.stackexchange.com/questions/2613418",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/523225/"
] | Assuming a typo ($y$ instead of $y^2$), we restore
$$\begin{cases}x+y=6,\\x^2+3xy+2y^2=(x+y)(x+2y)=60,\end{cases}$$ then
$$2x+3y=\frac{60}6+6.$$ | we get
$$x^2+3x(6-x)+2(6-x)=60$$
simplifying we obtain
$$-2x^2+16x-48=0$$
or
$$x^2-8x+24=0$$
can you solve this?
you will get
$$x\_1=4+2\sqrt{2}i$$
or
$$x\_2=4-2\sqrt{2}i$$ and
and
$$y\_1=2-2\sqrt{2}i$$
$$y\_2=2+2\sqrt{2}i$$ so $x+y=6$ |
2,613,418 | Question: **An urn contains three balls. The number of red balls in the urn is $0,1,2$ or $3$ equally likely. A ball is drawn from the urn at random. Given that the ball drawn is red, what is the conditional expected number of red balls left in the urn?**
Comment: Poorly worded question, but with it were two equations... | 2018/01/20 | [
"https://math.stackexchange.com/questions/2613418",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/523225/"
] | Assuming a typo ($y$ instead of $y^2$), we restore
$$\begin{cases}x+y=6,\\x^2+3xy+2y^2=(x+y)(x+2y)=60,\end{cases}$$ then
$$2x+3y=\frac{60}6+6.$$ | It seems correct to me
$$x^2+3x(6-x)+2(6-x)=60\iff x^2+18x-3x^2+12-2x-60=0$$
$$\iff-2x^2+16x-48=0\iff x^2-8x+24=0\implies x=4\pm2i\sqrt2$$ |
9,961 | We wanted to setup a server as ContentManagement,Processing and Reporting instance. As we can combine roles, we changed the config accordingly.
```
<add key="role:define" value="ContentManagement,Processing,Reporting" />
```
We immediatly got errors and noticed that we hadn't done the content management setup as de... | 2018/02/08 | [
"https://sitecore.stackexchange.com/questions/9961",
"https://sitecore.stackexchange.com",
"https://sitecore.stackexchange.com/users/237/"
] | We called upon Sitecore Support and they told us this was a "bug". It will be documented but until that is done, you can follow this guide:
1. *App\_Config\Sitecore\Marketing.xDB\Sitecore.Xdb.Remote.Client.config*:
set role:require on sitecore element to "ContentManagement AND !Reporting"
`<sitecore role:require="Con... | It looks like this issue has now been resolved in Sitecore 9 Update 2: <https://dev.sitecore.net/Downloads/Sitecore%20Experience%20Platform/90/Sitecore%20Experience%20Platform%2090%20Update2/Release%20Notes>
"The Experience Analytics and Path Analyzer applications fail to start on a Sitecore instance that is configure... |
46,351,920 | I am coming across this problem, i have a chat server which needs to communicate to the lambda service hosted in aws , but cloud front throws the following error.
```
BODY: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<HTML><HEAD><META HTTP-EQUIV="Content-Type"... | 2017/09/21 | [
"https://Stackoverflow.com/questions/46351920",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1749403/"
] | For me the problem was that, I restarted the EC2 which changed the Instance ID, but my cloudfront origin was still pointing to the previous ID. So, once I changed it, it worked fine. | In my case, I have a client-side load balancer when calling CloudFront. As a result, I am calling CF by IP address instead of hostName.
I checked with Amazon AWS Support team, in this case, CF rejects the request and returns "403 Error, The request could be satisfied". |
46,351,920 | I am coming across this problem, i have a chat server which needs to communicate to the lambda service hosted in aws , but cloud front throws the following error.
```
BODY: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<HTML><HEAD><META HTTP-EQUIV="Content-Type"... | 2017/09/21 | [
"https://Stackoverflow.com/questions/46351920",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1749403/"
] | >
> `require('http');`
>
>
>
That is an HTTP client -- not an HTTPS client.
Specifying port 443 doesn't result in an HTTPS request, even though port 443 is the assigned port for HTTPS. It just makes an ordinary HTTP request against destination port 443.
This isn't a valid thing to do, so CloudFront is returning... | For me the problem was that, I restarted the EC2 which changed the Instance ID, but my cloudfront origin was still pointing to the previous ID. So, once I changed it, it worked fine. |
46,351,920 | I am coming across this problem, i have a chat server which needs to communicate to the lambda service hosted in aws , but cloud front throws the following error.
```
BODY: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<HTML><HEAD><META HTTP-EQUIV="Content-Type"... | 2017/09/21 | [
"https://Stackoverflow.com/questions/46351920",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1749403/"
] | In my case, I had the same problem as @Kireeti K, where I solved this by removing the body from my `postman` request.
it seems that Cloudfront throws an error if you send a `GET` request with a body, if you want to use the body, you will need to change your method to something else than `GET`, for me `POST` worked per... | I encountered the same problem, [this thread](https://aws.amazon.com/premiumsupport/knowledge-center/resolve-cloudfront-bad-request-error/) worked for me.
This error message:
>
> "The request could not be satisfied. Bad Request."
>
>
>
is from the client and the error can occur due to one of the following reaso... |
46,351,920 | I am coming across this problem, i have a chat server which needs to communicate to the lambda service hosted in aws , but cloud front throws the following error.
```
BODY: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<HTML><HEAD><META HTTP-EQUIV="Content-Type"... | 2017/09/21 | [
"https://Stackoverflow.com/questions/46351920",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1749403/"
] | In my case, I had the same problem as @Kireeti K, where I solved this by removing the body from my `postman` request.
it seems that Cloudfront throws an error if you send a `GET` request with a body, if you want to use the body, you will need to change your method to something else than `GET`, for me `POST` worked per... | For me the problem was that, I restarted the EC2 which changed the Instance ID, but my cloudfront origin was still pointing to the previous ID. So, once I changed it, it worked fine. |
46,351,920 | I am coming across this problem, i have a chat server which needs to communicate to the lambda service hosted in aws , but cloud front throws the following error.
```
BODY: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<HTML><HEAD><META HTTP-EQUIV="Content-Type"... | 2017/09/21 | [
"https://Stackoverflow.com/questions/46351920",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1749403/"
] | >
> `require('http');`
>
>
>
That is an HTTP client -- not an HTTPS client.
Specifying port 443 doesn't result in an HTTPS request, even though port 443 is the assigned port for HTTPS. It just makes an ordinary HTTP request against destination port 443.
This isn't a valid thing to do, so CloudFront is returning... | I have seen this problem before. It happens due to the following reasons,
1. Invalid Protocol (using http instead of https)
2. Unknown http verb, make sure the endpoint is having the POST implemented in your case. If you are using API gateway, make sure you have deployed it. |
46,351,920 | I am coming across this problem, i have a chat server which needs to communicate to the lambda service hosted in aws , but cloud front throws the following error.
```
BODY: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<HTML><HEAD><META HTTP-EQUIV="Content-Type"... | 2017/09/21 | [
"https://Stackoverflow.com/questions/46351920",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1749403/"
] | I am facing the same error, I solved this by removing the body from my postman request. | In my case, I had the same problem as @Kireeti K, where I solved this by removing the body from my `postman` request.
it seems that Cloudfront throws an error if you send a `GET` request with a body, if you want to use the body, you will need to change your method to something else than `GET`, for me `POST` worked per... |
46,351,920 | I am coming across this problem, i have a chat server which needs to communicate to the lambda service hosted in aws , but cloud front throws the following error.
```
BODY: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<HTML><HEAD><META HTTP-EQUIV="Content-Type"... | 2017/09/21 | [
"https://Stackoverflow.com/questions/46351920",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1749403/"
] | I am facing the same error, I solved this by removing the body from my postman request. | I encountered the same problem, [this thread](https://aws.amazon.com/premiumsupport/knowledge-center/resolve-cloudfront-bad-request-error/) worked for me.
This error message:
>
> "The request could not be satisfied. Bad Request."
>
>
>
is from the client and the error can occur due to one of the following reaso... |
46,351,920 | I am coming across this problem, i have a chat server which needs to communicate to the lambda service hosted in aws , but cloud front throws the following error.
```
BODY: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<HTML><HEAD><META HTTP-EQUIV="Content-Type"... | 2017/09/21 | [
"https://Stackoverflow.com/questions/46351920",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1749403/"
] | >
> `require('http');`
>
>
>
That is an HTTP client -- not an HTTPS client.
Specifying port 443 doesn't result in an HTTPS request, even though port 443 is the assigned port for HTTPS. It just makes an ordinary HTTP request against destination port 443.
This isn't a valid thing to do, so CloudFront is returning... | I encountered the same problem, [this thread](https://aws.amazon.com/premiumsupport/knowledge-center/resolve-cloudfront-bad-request-error/) worked for me.
This error message:
>
> "The request could not be satisfied. Bad Request."
>
>
>
is from the client and the error can occur due to one of the following reaso... |
46,351,920 | I am coming across this problem, i have a chat server which needs to communicate to the lambda service hosted in aws , but cloud front throws the following error.
```
BODY: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<HTML><HEAD><META HTTP-EQUIV="Content-Type"... | 2017/09/21 | [
"https://Stackoverflow.com/questions/46351920",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1749403/"
] | I am facing the same error, I solved this by removing the body from my postman request. | I have seen this problem before. It happens due to the following reasons,
1. Invalid Protocol (using http instead of https)
2. Unknown http verb, make sure the endpoint is having the POST implemented in your case. If you are using API gateway, make sure you have deployed it. |
46,351,920 | I am coming across this problem, i have a chat server which needs to communicate to the lambda service hosted in aws , but cloud front throws the following error.
```
BODY: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<HTML><HEAD><META HTTP-EQUIV="Content-Type"... | 2017/09/21 | [
"https://Stackoverflow.com/questions/46351920",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1749403/"
] | I have seen this problem before. It happens due to the following reasons,
1. Invalid Protocol (using http instead of https)
2. Unknown http verb, make sure the endpoint is having the POST implemented in your case. If you are using API gateway, make sure you have deployed it. | For me the problem was that, I restarted the EC2 which changed the Instance ID, but my cloudfront origin was still pointing to the previous ID. So, once I changed it, it worked fine. |
3,912,854 | Developing an application using MVC-style extensionless URL's. One of the pages has a url that sometimes contains an email address. On my local machine this works fine. However when I publish to the test server, trying to access this URL yields a 404 error, unless you take the full stop out, in which case it routes as ... | 2010/10/12 | [
"https://Stackoverflow.com/questions/3912854",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/271907/"
] | I've been banging my head against a wall with this today too - I found the answer was to add a trailing slash to the call. | First thanks as your question set me looking at something that it was on my todo list to solve for myself. Second, while I was looking at that, I came across the `requestPathInvalidChars` attribute of the `httpRuntime` config element which looks like it should be what you want here (and what I want elsewhere). |
61,698,666 | I was writing some code and made a mistake that simplifies to:
```
func f() -> Int {
for _ in [1,2,3] {
return 1
}
}
```
And the compiler shows me an error saying that `f` is missing an return, which caused me to realise my mistake. I forgot to put an if statement around the `return`!
But then I rea... | 2020/05/09 | [
"https://Stackoverflow.com/questions/61698666",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5133585/"
] | While for a human it is trivial to see that the loop will always repeat three times, because the list literal is a constant with three elements, this is a non-trivial thing to see for a compiler at the level of semantic analysis.
During semantic analysis, the compiler will evaluate "a generic list literal" (`[1,2,3]`... | `for-in` doesn't know if all it's going to get from an iterator is `nil`. You'll get the same error message, `Missing return in a function expected to return 'Int'`, no matter what the sequence is.
```swift
extension Bool: Sequence, IteratorProtocol {
public func next() -> Void? { () }
}
```
```swift
for _ in true... |
39,867,760 | Example:
Uuid generated from v4 of php :
`8bc278cb-2fb6-413b-add6-8ba39bf830e8`
I want to convert this into two 64 bit integers.
I've tried using `hexdec` of php but it's return value is of numbers. I want datatype integer.
Interestingly :
I have tried using hexdec with the above uuid and used this output to de... | 2016/10/05 | [
"https://Stackoverflow.com/questions/39867760",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3452275/"
] | UUID is a 128bit data type. Excluding the 6 reserved bits, there are 122 data bits in it. Makes it impossible to fully convert any UUID to a 64bit integer. You'll at least need to store it as 2 64bit numbers or 4 32bit numbers.
You can unpack the UUID into binary, then unpack it as 4 32bit unsigned character:
```
fun... | While it's common in other languages ([like Java](http://docs.oracle.com/javase/6/docs/api/java/util/UUID.html)) to get the least significant and most significant bits of a UUID as two unsigned 64-bit integers, PHP has trouble with this because all integers in PHP are signed. Even if using a 64-bit build of PHP, you wi... |
21,344,449 | So I have a mini slide menu in my website there is a menu you can choose what you want to read. There are points to click, when u clicked it the point get a red background.
But there is a problem.
When i click one point and then an other point the first clicked point have to lose his background.
**Here is my HTML:... | 2014/01/24 | [
"https://Stackoverflow.com/questions/21344449",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | You have to select all other points and set their background to none.
Or remeber which point is selected and on select another just remove background on last and remeber current point, then set its background to red.
See fiddle: <http://fiddle.jshell.net/399Dm/5/> | I have fixed the fiddle so that it works hopefully as you plan.
<http://jsfiddle.net/399Dm/8/> There you go!
```
var forEach = function(ctn, callback){
return Array.prototype.forEach.call(ctn, callback);
}
function clear(element, index, array) {
element.getElementsByTagName("dir")[0].style.backgroundColor="";
}... |
21,344,449 | So I have a mini slide menu in my website there is a menu you can choose what you want to read. There are points to click, when u clicked it the point get a red background.
But there is a problem.
When i click one point and then an other point the first clicked point have to lose his background.
**Here is my HTML:... | 2014/01/24 | [
"https://Stackoverflow.com/questions/21344449",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | You have to select all other points and set their background to none.
Or remeber which point is selected and on select another just remove background on last and remeber current point, then set its background to red.
See fiddle: <http://fiddle.jshell.net/399Dm/5/> | If you can look at the following [jsfiddle](http://fiddle.jshell.net/siva_hari/gJLr5/ "JSFiddle"), I used jQuery to get what you want. |
21,344,449 | So I have a mini slide menu in my website there is a menu you can choose what you want to read. There are points to click, when u clicked it the point get a red background.
But there is a problem.
When i click one point and then an other point the first clicked point have to lose his background.
**Here is my HTML:... | 2014/01/24 | [
"https://Stackoverflow.com/questions/21344449",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | First you need to fix your HTML becaue your `id` values aren't unique. In fact, you don't even need `id` values, so you should use "slide\_button" as a class. You can then use it to select all the buttons:
```
<div onClick="clicked(this);" class="slide_button"><dir></dir></div>
<div onClick="clicked(this);" class="sli... | ***[JSFIDDLE DEMO](http://fiddle.jshell.net/399Dm/17/)***
jQuery
```
$('.slide_button').click(function(){
$('.slide_button dir').css("background-color", "inherit");
$(this).find('dir').css("background-color", "red");
});
```
HTML - Your markup is invalid because you have duplicate ids. Make them classes as ... |
21,344,449 | So I have a mini slide menu in my website there is a menu you can choose what you want to read. There are points to click, when u clicked it the point get a red background.
But there is a problem.
When i click one point and then an other point the first clicked point have to lose his background.
**Here is my HTML:... | 2014/01/24 | [
"https://Stackoverflow.com/questions/21344449",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | At first id should be unique per element.
```
<div class="slide_button"><dir class="button"></dir></div>
<div class="slide_button"><dir class="button"></dir></div>
<div class="slide_button"><dir class="button"></dir></div>
<div class="slide_button"><dir class="button"></dir></div>
<div class="slide_button"><dir class=... | I had a slightly different method than @atlavis but a similar result.
<http://fiddle.jshell.net/2AGJQ/> |
21,344,449 | So I have a mini slide menu in my website there is a menu you can choose what you want to read. There are points to click, when u clicked it the point get a red background.
But there is a problem.
When i click one point and then an other point the first clicked point have to lose his background.
**Here is my HTML:... | 2014/01/24 | [
"https://Stackoverflow.com/questions/21344449",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | First you need to fix your HTML becaue your `id` values aren't unique. In fact, you don't even need `id` values, so you should use "slide\_button" as a class. You can then use it to select all the buttons:
```
<div onClick="clicked(this);" class="slide_button"><dir></dir></div>
<div onClick="clicked(this);" class="sli... | You have to select all other points and set their background to none.
Or remeber which point is selected and on select another just remove background on last and remeber current point, then set its background to red.
See fiddle: <http://fiddle.jshell.net/399Dm/5/> |
21,344,449 | So I have a mini slide menu in my website there is a menu you can choose what you want to read. There are points to click, when u clicked it the point get a red background.
But there is a problem.
When i click one point and then an other point the first clicked point have to lose his background.
**Here is my HTML:... | 2014/01/24 | [
"https://Stackoverflow.com/questions/21344449",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | At first id should be unique per element.
```
<div class="slide_button"><dir class="button"></dir></div>
<div class="slide_button"><dir class="button"></dir></div>
<div class="slide_button"><dir class="button"></dir></div>
<div class="slide_button"><dir class="button"></dir></div>
<div class="slide_button"><dir class=... | ***[JSFIDDLE DEMO](http://fiddle.jshell.net/399Dm/17/)***
jQuery
```
$('.slide_button').click(function(){
$('.slide_button dir').css("background-color", "inherit");
$(this).find('dir').css("background-color", "red");
});
```
HTML - Your markup is invalid because you have duplicate ids. Make them classes as ... |
21,344,449 | So I have a mini slide menu in my website there is a menu you can choose what you want to read. There are points to click, when u clicked it the point get a red background.
But there is a problem.
When i click one point and then an other point the first clicked point have to lose his background.
**Here is my HTML:... | 2014/01/24 | [
"https://Stackoverflow.com/questions/21344449",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | First you need to fix your HTML becaue your `id` values aren't unique. In fact, you don't even need `id` values, so you should use "slide\_button" as a class. You can then use it to select all the buttons:
```
<div onClick="clicked(this);" class="slide_button"><dir></dir></div>
<div onClick="clicked(this);" class="sli... | I had a slightly different method than @atlavis but a similar result.
<http://fiddle.jshell.net/2AGJQ/> |
21,344,449 | So I have a mini slide menu in my website there is a menu you can choose what you want to read. There are points to click, when u clicked it the point get a red background.
But there is a problem.
When i click one point and then an other point the first clicked point have to lose his background.
**Here is my HTML:... | 2014/01/24 | [
"https://Stackoverflow.com/questions/21344449",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | At first id should be unique per element.
```
<div class="slide_button"><dir class="button"></dir></div>
<div class="slide_button"><dir class="button"></dir></div>
<div class="slide_button"><dir class="button"></dir></div>
<div class="slide_button"><dir class="button"></dir></div>
<div class="slide_button"><dir class=... | I have fixed the fiddle so that it works hopefully as you plan.
<http://jsfiddle.net/399Dm/8/> There you go!
```
var forEach = function(ctn, callback){
return Array.prototype.forEach.call(ctn, callback);
}
function clear(element, index, array) {
element.getElementsByTagName("dir")[0].style.backgroundColor="";
}... |
21,344,449 | So I have a mini slide menu in my website there is a menu you can choose what you want to read. There are points to click, when u clicked it the point get a red background.
But there is a problem.
When i click one point and then an other point the first clicked point have to lose his background.
**Here is my HTML:... | 2014/01/24 | [
"https://Stackoverflow.com/questions/21344449",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | You have to select all other points and set their background to none.
Or remeber which point is selected and on select another just remove background on last and remeber current point, then set its background to red.
See fiddle: <http://fiddle.jshell.net/399Dm/5/> | I had a slightly different method than @atlavis but a similar result.
<http://fiddle.jshell.net/2AGJQ/> |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.