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 |
|---|---|---|---|---|---|
8,828,687 | Mostly out of curiosity, I would like to know if there are any edge cases that can arise from cases like:
```
<span class="class1 class2 class3 class2 class4">...</span>
```
(`class2` is listed twice)
or
```
<span class="class1 class2 class3 class2 class2 class2 class3 class4 class4 class3">...</span>
```
(a mo... | 2012/01/12 | [
"https://Stackoverflow.com/questions/8828687",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/224354/"
] | **No, none whatsoever**, unless you have the habit of using the `class` attribute:
```
[class="class1 class2"] {
/* ... */
}
```
instead of:
```
.class1.class2 {
/* ... */
}
```
which is terrible practice, of course.
---
Also, although your question isn't tagged [javascript](/questions/tagged/javascript... | FYI
browsers such as firefox/chrome/ie9,
**computing the style contexts using the rule tree**,
**if two rules have the same weight, origin and specificity, the one written lower down in the style sheet wins**. so ...
styles :
```
.c1 {background:red;}.c1.c3 {background:blue;}.c2 {background:orange;}
```
case1 :... |
8,828,687 | Mostly out of curiosity, I would like to know if there are any edge cases that can arise from cases like:
```
<span class="class1 class2 class3 class2 class4">...</span>
```
(`class2` is listed twice)
or
```
<span class="class1 class2 class3 class2 class2 class2 class3 class4 class4 class3">...</span>
```
(a mo... | 2012/01/12 | [
"https://Stackoverflow.com/questions/8828687",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/224354/"
] | FYI
browsers such as firefox/chrome/ie9,
**computing the style contexts using the rule tree**,
**if two rules have the same weight, origin and specificity, the one written lower down in the style sheet wins**. so ...
styles :
```
.c1 {background:red;}.c1.c3 {background:blue;}.c2 {background:orange;}
```
case1 :... | No, there is nothing *wrong* with it other than it looks weird. Any re-occurences of a class name won't affect anything, ever. It doesn't "reapply" those styles after applying styles from the class defined before it or anything. Remember that CSS will always select the style defined *last* for that level of specificity... |
43,838,466 | I've found this code on another thread (shown at the very bottom) for Swift 3 and can't seem to get it to work in my IOS project.
I know it's a Singleton, but I'll have to admit, I'm not sure how to USE it in my IOS project so that the timer will work across all ViewControllers.
Can I do the following? And if not, h... | 2017/05/08 | [
"https://Stackoverflow.com/questions/43838466",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7978073/"
] | `#rainbow` refers to the unordered list, not the list items themselves. You need to change your selector to include the list elements:
```
let listItems = document.querySelectorAll('#rainbow li');
```
### Explanation
The selector passed to the `querySelectorAll` method matches the way you would write a CSS selector... | The array of colors could have more elements than the listItems array. So, when i variable is greater than the size of the listItems array - 1, you receive a TypeError. And of course, you have to select the items inside the ul and not the ul itself. |
7,796 | I'm trying to solve a system of equations:
```
Solve[ A1 D1 + E1 H1 == 0 && A2 D1 + A1 D2 + E2 H1 + E1 H2 == 0 &&
C1 F1 - E1 G1 == 0 && C2 F2 - E2 G2 == 0 && A1 - B1 + C1 == 0 &&
A2 - B2 + C2 == 0 && A3 - B3 + C3 == 0,
{A1,A2,A3,B1,B2,B3,C1,C2,C3,D1,D2,E1,E2,F1,F2,G1,G2,H1,H2}]
```
Sin... | 2012/07/02 | [
"https://mathematica.stackexchange.com/questions/7796",
"https://mathematica.stackexchange.com",
"https://mathematica.stackexchange.com/users/1481/"
] | The Wolfram Demonstration in its original version was wrong. The demo **has since been corrected (updated March 2013)**. The *first* five functions called $H$ there (**which were originally the only functions listed**) do *not* form a group. You need a **sixth** element to make the set closed under multiplication!
Thi... | Not a general solution, but works for the case you cited;
```
(*Definitions*)
an=6;
bn=4;
h[0,x_]:=x; h[1,x_]:=1/x;
h[2,x_]:=1-x; h[3,x_]:=1/(1-x); h[4,x_]:=(x-1)/x;
f[x_] := Sum[a@i x^i,{i,an}] / Sum[b@i x^i,{i,bn}]; (*Proposed form / Rational*)
(*Now find the coefficients a[i] and b[i]*)
ss=Solve[And @@ T... |
55,634,148 | I am training Logistic Regression in R. I use train set and test set. I have some data and binary output.
In a data file the output is the integers 1 or 0 without missing values. I have more 1 than 0 (the proportion is 70/30).
The result of LR is very different depending on if I factories the output or not, namely i... | 2019/04/11 | [
"https://Stackoverflow.com/questions/55634148",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11346454/"
] | You could turn off/on the click handler conditionally by using
```
end.tap { |item| item.on(:click) { select_envelope } unless conflicts }
```
to replace
```
end.on(:click) { select_envelope }
``` | I'm not sure that checking the element for a click event would be reliable due to event bubbling.
I would write the test to click the element, and then expect whatever logic is in the click event to not happen.
```
conflicts = true
element.click() # trigger select_envelope
expect(selected_envelope).to be_nil # no ... |
55,634,148 | I am training Logistic Regression in R. I use train set and test set. I have some data and binary output.
In a data file the output is the integers 1 or 0 without missing values. I have more 1 than 0 (the proportion is 70/30).
The result of LR is very different depending on if I factories the output or not, namely i... | 2019/04/11 | [
"https://Stackoverflow.com/questions/55634148",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11346454/"
] | You could turn off/on the click handler conditionally by using
```
end.tap { |item| item.on(:click) { select_envelope } unless conflicts }
```
to replace
```
end.on(:click) { select_envelope }
``` | A nice way to keep the code clean is just return inside the method called in the event:
```rb
def select_envelope
return if conflicts
...
end
# this keeps the event handler the same
end.on(:click) { select_envelope }
```
There will be a negligible performance hit from having to always trigger the event, but th... |
55,634,148 | I am training Logistic Regression in R. I use train set and test set. I have some data and binary output.
In a data file the output is the integers 1 or 0 without missing values. I have more 1 than 0 (the proportion is 70/30).
The result of LR is very different depending on if I factories the output or not, namely i... | 2019/04/11 | [
"https://Stackoverflow.com/questions/55634148",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11346454/"
] | ```
end.on(:click) { select_envelope }
```
You could replace `(:click)`
with:
```
(!conflicts && :click)
```
This works because if conflicts is not nil, this would result in a nil click handler that doesn't do anything. | I'm not sure that checking the element for a click event would be reliable due to event bubbling.
I would write the test to click the element, and then expect whatever logic is in the click event to not happen.
```
conflicts = true
element.click() # trigger select_envelope
expect(selected_envelope).to be_nil # no ... |
55,634,148 | I am training Logistic Regression in R. I use train set and test set. I have some data and binary output.
In a data file the output is the integers 1 or 0 without missing values. I have more 1 than 0 (the proportion is 70/30).
The result of LR is very different depending on if I factories the output or not, namely i... | 2019/04/11 | [
"https://Stackoverflow.com/questions/55634148",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11346454/"
] | ```
end.on(:click) { select_envelope }
```
You could replace `(:click)`
with:
```
(!conflicts && :click)
```
This works because if conflicts is not nil, this would result in a nil click handler that doesn't do anything. | A nice way to keep the code clean is just return inside the method called in the event:
```rb
def select_envelope
return if conflicts
...
end
# this keeps the event handler the same
end.on(:click) { select_envelope }
```
There will be a negligible performance hit from having to always trigger the event, but th... |
58,617,144 | I am trying to filter a list of POJOs with two different predicates using a stream.
```
public class Toy {
public boolean isRed();
public boolean isBlue();
public boolean isGreen();
}
public class RedBlueExtravaganza {
public RedBlueExtravaganza(RedToy rt, BlueToy bt) {
//construct
}
}
// Wrappers aro... | 2019/10/30 | [
"https://Stackoverflow.com/questions/58617144",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10205830/"
] | Here's a solution which traverses your list only once, giving you the first red and blue toys at the end. We can filter out all the other irrelevent colors and then create a map whose key is whether the toy is red and the value is the first toy matching the given criteria. Here's how it looks.
```
Map<Boolean, Toy> fi... | One way which first comes into my mind is to use 2 streams for finding first red and blue toy object, respectively. Then merge them into one stream by using `Stream.concat()` so that you can add more oprations for this.
**Code snippet**
```
RedBlueExtravaganza firstRedBlueList = Stream
.concat(
toyLis... |
58,617,144 | I am trying to filter a list of POJOs with two different predicates using a stream.
```
public class Toy {
public boolean isRed();
public boolean isBlue();
public boolean isGreen();
}
public class RedBlueExtravaganza {
public RedBlueExtravaganza(RedToy rt, BlueToy bt) {
//construct
}
}
// Wrappers aro... | 2019/10/30 | [
"https://Stackoverflow.com/questions/58617144",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10205830/"
] | I like [this answers](https://stackoverflow.com/a/58618100/11733759), similar solution can be with reduce and List as "Tuple (or something)"
```java
List<Toy> reduceToList = toyList.stream()
.filter(t -> t.isBlue() || t.isRed())
.map(t -> Arrays.asList(t, t))
.reduce(Arrays.asList(null, null), (a, c)... | One way which first comes into my mind is to use 2 streams for finding first red and blue toy object, respectively. Then merge them into one stream by using `Stream.concat()` so that you can add more oprations for this.
**Code snippet**
```
RedBlueExtravaganza firstRedBlueList = Stream
.concat(
toyLis... |
58,617,144 | I am trying to filter a list of POJOs with two different predicates using a stream.
```
public class Toy {
public boolean isRed();
public boolean isBlue();
public boolean isGreen();
}
public class RedBlueExtravaganza {
public RedBlueExtravaganza(RedToy rt, BlueToy bt) {
//construct
}
}
// Wrappers aro... | 2019/10/30 | [
"https://Stackoverflow.com/questions/58617144",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10205830/"
] | Here's a solution which traverses your list only once, giving you the first red and blue toys at the end. We can filter out all the other irrelevent colors and then create a map whose key is whether the toy is red and the value is the first toy matching the given criteria. Here's how it looks.
```
Map<Boolean, Toy> fi... | I like [this answers](https://stackoverflow.com/a/58618100/11733759), similar solution can be with reduce and List as "Tuple (or something)"
```java
List<Toy> reduceToList = toyList.stream()
.filter(t -> t.isBlue() || t.isRed())
.map(t -> Arrays.asList(t, t))
.reduce(Arrays.asList(null, null), (a, c)... |
66,539,704 | I have been trying to solve this problem since yesterday. The program should accept N numbers from the user and will place them in an array. I have done this. However, I don't seem to know how to "warn" the user that the input is a duplicate and lets the user enter again.
Here is my code:
```
# include <iostream>
usin... | 2021/03/09 | [
"https://Stackoverflow.com/questions/66539704",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13634556/"
] | You need to force b2 to where master is. If you are on master at the moment:
```
git branch -f b2
```
That will do. | Just try:
```
git checkout b2
git reset --hard master
``` |
67,834,792 | I have a model structured like so:
```
public int JobID { get; set; }
public int SiteID { get; set; }
public List<AModel> ListAModel { get; set; }
```
In my main view, I am iterating through the List using a for loop with i as an index. I want to call a partial view from within this main page to avoid repeat code ac... | 2021/06/04 | [
"https://Stackoverflow.com/questions/67834792",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7728486/"
] | As @SOS touches on in their comment (not sure why they did not make it an "answer"?), the issue is not the conversion. The issue is that ColdFusion is displaying `69.35 * 100` as equalling `6935`, which it isn't. And even ColdFusion doesn't really think it is.
As far as most computing languages are concerned, `69.35 *... | I know I'm kind of late to the game with this answer, but here's what I've used in the past when encountering precision issues in ColdFusion when dealing with mathematical calculations using currency. In order to avoid precision errors, I've always wrapped my mathematical calculations with the `precisionEvaluate()` fun... |
19,052,347 | I run a script with the param `-A AA/BB` . To get an array with AA and BB, i can do this.
```
INPUT_PARAM=(${AIRLINE_OPTION//-A / }) #get rid of the '-A ' in the begining
LIST=(${AIRLINES_PARAM//\// }) # split by '/'
```
Can we achieve this in a single line?
Thanks in advance. | 2013/09/27 | [
"https://Stackoverflow.com/questions/19052347",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/494659/"
] | One way
```
IFS=/ read -r -a LIST <<< "${AIRLINE_OPTION//-A /}"
```
This places the output from the parameter substitution `${AIRLINE_OPTION//-A /}` into a "here-string" and uses the bash `read` built-in to parse this into an array. Splitting by `/` is achieved by setting the value of `IFS` to `/` for the `read` com... | With `awk`, for example, you can create an array and store it in `LIST` variable:
```
$ LIST=($(awk -F"[\/ ]" '{print $2,$3}' <<< "-A AA/BB"))
```
Result:
```
$ echo ${LIST[0]}
AA
$ echo ${LIST[1]}
BB
```
### Explanation
* `-F"[\/ ]"` defines two possible field separators: a space or a slash `/`.
* `'{print $2$3... |
19,052,347 | I run a script with the param `-A AA/BB` . To get an array with AA and BB, i can do this.
```
INPUT_PARAM=(${AIRLINE_OPTION//-A / }) #get rid of the '-A ' in the begining
LIST=(${AIRLINES_PARAM//\// }) # split by '/'
```
Can we achieve this in a single line?
Thanks in advance. | 2013/09/27 | [
"https://Stackoverflow.com/questions/19052347",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/494659/"
] | One way
```
IFS=/ read -r -a LIST <<< "${AIRLINE_OPTION//-A /}"
```
This places the output from the parameter substitution `${AIRLINE_OPTION//-A /}` into a "here-string" and uses the bash `read` built-in to parse this into an array. Splitting by `/` is achieved by setting the value of `IFS` to `/` for the `read` com... | ```
LIST=( $(IFS=/; for x in ${AIRLINE_OPTION#-A }; do printf "$x "; done) )
```
This is a portable solution, but if your `read` supports `-a` and you don't mind portability then you should go for @1\_CR's solution. |
45,142,355 | I have this html file:
```
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width = device-width">
<meta name="description" content="Some training on web design">
<meta name="keywords" content="web, design">
<meta name="author" content="Houssem badri">
<meta charset="utf-8">
<link... | 2017/07/17 | [
"https://Stackoverflow.com/questions/45142355",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1807373/"
] | Add `clear: both` to the footer's CSS (you need that because of the floating elements above it)
And erase `overflow: hidden` from the `body` tag.
```css
body{
background: #E1F9A8;
font-family: "Arial";
font-size: 16px;
width: 80%;
margin: auto;
padding-bottom:60px;
}
ul{
margin:0;... | i have tried your code, everything is correct what you done, but you need to add a small code in footer css part
check the below css footer code
```
<!-- css -->
<style>
footer
{
border: 1px solid;
border-radius: 10px;
background-color: #D0D8BE;
padding: 20px;
margin: 15px 0 0 0px;
... |
45,142,355 | I have this html file:
```
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width = device-width">
<meta name="description" content="Some training on web design">
<meta name="keywords" content="web, design">
<meta name="author" content="Houssem badri">
<meta charset="utf-8">
<link... | 2017/07/17 | [
"https://Stackoverflow.com/questions/45142355",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1807373/"
] | Define a class called `clearfix` with css as provided in snippet which will clear the ends. Where ever you have floating child divs, give this to the parent div
```css
body{
background: #E1F9A8;
font-family: "Arial";
font-size: 16px;
width: 80%;
margin: auto;
overflow: hidden;
paddin... | i have tried your code, everything is correct what you done, but you need to add a small code in footer css part
check the below css footer code
```
<!-- css -->
<style>
footer
{
border: 1px solid;
border-radius: 10px;
background-color: #D0D8BE;
padding: 20px;
margin: 15px 0 0 0px;
... |
7,363,077 | I am trying to get no. of recent unread mails from a gmail account.For this I have installed IMAP in my Ubuntu system and tried some PHP iMAP functions.
Here are what i have tried till now.
```
/* connect to gmail */
$hostname = '{imap.gmail.com:993/imap/ssl}INBOX';
$username = 'user@gmail.com';
$password = 'user_pass... | 2011/09/09 | [
"https://Stackoverflow.com/questions/7363077",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/936786/"
] | This function seems to work:
```
function CountUnreadMail($host, $login, $passwd) {
$mbox = imap_open($host, $login, $passwd);
$count = 0;
if (!$mbox) {
echo "Error";
} else {
$headers = imap_headers($mbox);
foreach ($headers as $mail) {
$flags = substr($mail, 0, 4);... | I have solved it using database,This is how I have done it.
1.I made a column in users table, for ex- 'email\_max\_uid' INT(11) NOT NULL default 0
2.When a user loads this page first, using my sql query I retrieved the value of 'email\_max\_uid' of that particular users
3.connect to his gmail account automatically a... |
446,341 | I have this zpool:
```
bash-3.2# zpool status dpool
pool: dpool
state: ONLINE
scan: none requested
config:
NAME STATE READ WRITE CKSUM
dpool ONLINE 0 0 0
c3t600601604F021A009E1F867A3E24E211d0 ON... | 2012/11/07 | [
"https://serverfault.com/questions/446341",
"https://serverfault.com",
"https://serverfault.com/users/5756/"
] | No, I don't think this is possible in the manner you're describing.
You *can*, however, create a new pool with the single disk and copy your ZFS filesystems to the new pool using a simple [zfs send/receive](http://docs.oracle.com/cd/E19963-01/html/821-1448/gbchx.html) process. | You should be able to `zpool attach` the new and larger drive, wait for the mirroring to be completed, and then `zpool detach` the old drives.
*Edit*: I had misread your question, and I was quite sure that you were running them as a mirror.
I agree that the best course of action is to create a new pool and recursivel... |
32,351,138 | The following code replaces an anchor element with an inputbox and assigns an ID to it. I'd also like to assign an onblur event to it, but can't get it working. `newElement.onblur = texOnBlur(this));`
All help is welcome.
```
function replaceElement(e) {
selectedElement = e.id
var newElement = document.createE... | 2015/09/02 | [
"https://Stackoverflow.com/questions/32351138",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5018622/"
] | As you can see <http://www.w3schools.com/jsref/event_onblur.asp>
```
object.onblur=function(){myScript};
```
you should assign a function to `.onblur` event, you assigned function result. | try this one
```
newElement.addEventListener("blur", function(){
// do stuff
texOnBlur(this);
alert("Done");
});
``` |
32,351,138 | The following code replaces an anchor element with an inputbox and assigns an ID to it. I'd also like to assign an onblur event to it, but can't get it working. `newElement.onblur = texOnBlur(this));`
All help is welcome.
```
function replaceElement(e) {
selectedElement = e.id
var newElement = document.createE... | 2015/09/02 | [
"https://Stackoverflow.com/questions/32351138",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5018622/"
] | As you can see <http://www.w3schools.com/jsref/event_onblur.asp>
```
object.onblur=function(){myScript};
```
you should assign a function to `.onblur` event, you assigned function result. | You are currently referencing the result of the `textOnBlur` function instead of the function itself.
You should write :
```
newElement.onblur = textOnBlur;
```
`this` should refer to the input element inside the `textOnBlur` function automatically. |
33,603,250 | `Add-AzureRmAccount` or the alias `Login-AzureRmAccount` doesn't seem to persist between sessions the way that `Add-AzureAccount` does.
Is there a way to get it to persist? | 2015/11/09 | [
"https://Stackoverflow.com/questions/33603250",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/82993/"
] | After adding the account to your session (either `Add-AzureRmAccount` or `Login-AzureRmAccount`,) use
```
Save-AzureRmProfile -Path <path-to-file>
```
to save the current credentials and
```
Select-AzureRmProfile -Path <path-to-file>
```
to load them.
[Thanks to Mark Cowlishaw](https://github.com/Azure/azure-pow... | Not yet, not in the way you're used to... It's a known issue, but I couldn't find it in the list. Feel free to add it to:
<https://github.com/Azure/azure-powershell/issues> |
187,172 | I got this quote from a customer service email explaining why my order is being delayed:
...."Hence we request your patience in this regards."...
This reads weird to me, is this a common phrase? Shouldn't the customer service be hoping/asking for my patience instead of "requesting" my patience, since they are causing ... | 2018/11/30 | [
"https://ell.stackexchange.com/questions/187172",
"https://ell.stackexchange.com",
"https://ell.stackexchange.com/users/-1/"
] | >
> Hence we request your patience in this regard
>
>
>
(it should normally be "regard" singular) means "We ask that you be patient about this issue". The tone here is both formal and old-fashioned, particularly "hence" which means "therefore". Really this phrase means "we are sorry that you must wait". | *Asking* for would be more polite but the difference is minor in my opinion.
There are many such phrases in business letters to explain their lateness or offer to excuse your lateness with a bill, say. The language can slowly become more urgent and less patient with each notice.
If English is their first language it ... |
65,379,652 | I'm trying to develop a GUI in python for analyze tRNA-Seq data which could be run in Linux and Windows. For this it is needed run some programs like: bowtie2, samtools or bedtools, which can be downloaded by anaconda easily on Linux but is a headache on Windows. This programs can't be downloaded on Windows so I had to... | 2020/12/20 | [
"https://Stackoverflow.com/questions/65379652",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14802400/"
] | In order to really be `O(logN)`, the updates to the bounding indeces `minInd,maxInd` should only ever be
```
maxInd = midInd [- 1]
minInd = midInd [+ 1]
```
to half the search space. Since there are paths through your loop body that only do
```
minInd += 1
maxInd -= 1
```
respectively, I am not sure that you can'... | Yes, there is a better approach.
As the list is sorted, you can use binary search with slight custom modifications as follows:
```
list = [1, 1, 1, 2, 2]
uniqueElementSet = set([])
def binary_search(minIndex, maxIndex, n):
if(len(uniqueElementSet)>=3):
return
#Checking the bounds for index:
if... |
65,379,652 | I'm trying to develop a GUI in python for analyze tRNA-Seq data which could be run in Linux and Windows. For this it is needed run some programs like: bowtie2, samtools or bedtools, which can be downloaded by anaconda easily on Linux but is a headache on Windows. This programs can't be downloaded on Windows so I had to... | 2020/12/20 | [
"https://Stackoverflow.com/questions/65379652",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14802400/"
] | ```
from bisect import bisect
def hasThreeDistinctElements(A):
return A[:1] < A[-1:] > [A[bisect(A, A[0])]]
```
The first comparison safely(\*) checks whether there are two different values at all. If so, we check whether the first value larger than `A[0]` is also smaller than `A[-1]`.
(\*): Doesn't crash if `A... | Yes, there is a better approach.
As the list is sorted, you can use binary search with slight custom modifications as follows:
```
list = [1, 1, 1, 2, 2]
uniqueElementSet = set([])
def binary_search(minIndex, maxIndex, n):
if(len(uniqueElementSet)>=3):
return
#Checking the bounds for index:
if... |
65,379,652 | I'm trying to develop a GUI in python for analyze tRNA-Seq data which could be run in Linux and Windows. For this it is needed run some programs like: bowtie2, samtools or bedtools, which can be downloaded by anaconda easily on Linux but is a headache on Windows. This programs can't be downloaded on Windows so I had to... | 2020/12/20 | [
"https://Stackoverflow.com/questions/65379652",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14802400/"
] | ```
from bisect import bisect
def hasThreeDistinctElements(A):
return A[:1] < A[-1:] > [A[bisect(A, A[0])]]
```
The first comparison safely(\*) checks whether there are two different values at all. If so, we check whether the first value larger than `A[0]` is also smaller than `A[-1]`.
(\*): Doesn't crash if `A... | In order to really be `O(logN)`, the updates to the bounding indeces `minInd,maxInd` should only ever be
```
maxInd = midInd [- 1]
minInd = midInd [+ 1]
```
to half the search space. Since there are paths through your loop body that only do
```
minInd += 1
maxInd -= 1
```
respectively, I am not sure that you can'... |
14,925,707 | I'd like to right align several text when drawing using Core Graphics. Below is the code I'm using to draw text now. How can I draw several texts that are right aligned?
```
CGContextSelectFont(context, "Helvetica-Light", 10.0f,kCGEncodingMacRoman);
CGContextSetTextDrawingMode(context, kCGTextFill);
CGContextSetFillCo... | 2013/02/17 | [
"https://Stackoverflow.com/questions/14925707",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1473780/"
] | perhaps you're looking for something like this...
```
[@"Any text what you like to show" drawInRect:CGRectMake(0.f, 0.f, 320.f, 80.f) withFont:[UIFont fontWithName:@"Helvetica-Light" size:10.f] lineBreakMode:NSLineBreakByWordWrapping alignment:NSTextAlignmentRight];
```
update
======
that way is unfortunately depre... | ```
[@"your Text" drawInRect:CGRectMake(0.f, 0.f, 320.f, 80.f) withAttributes:"dictionary with text attributes"];
```
here the attributes refers to text font,text size,alignment etc.
Where the alignment can be set using the NSMutableParagraphStyle object with the text i.e.lineBreakMode etc |
45,563,414 | I am trying to build a chaincode using `go build`.
Environment:
* installed go 1.8.3 windows/amd
* Windows 10
When I run `go build` I get the following error:
```
# github.com/hyperledger/fabric/vendor/github.com/miekg/pkcs11
..\..\github.com\hyperledger\fabric\vendor\github.com\miekg\pkcs11\pkcs11.go:29:18: fatal ... | 2017/08/08 | [
"https://Stackoverflow.com/questions/45563414",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1315125/"
] | On windows you can build without `PKCS`
`go build --tags nopkcs11` | Try running the following command
```
sudo apt install libtool libltdl-dev
```
Make sure `go get -u github.com/hyperledger/fabric/core/chaincode/shim` throws no error then `go build` it. |
38,420,057 | I have a simple code to make Java code compiler
```
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import javax.tools.*;
import java.io.*;
import java.util.*;
public class Compiler extends JFrame
{
String loc="D:\\java";
File file=null,
dir=null;
boolean success;
public Com... | 2016/07/17 | [
"https://Stackoverflow.com/questions/38420057",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4539582/"
] | In addition to setting `javax.tools.StandardLocation.CLASS_OUTPUT`, you need to set `javax.tools.StandardLocation.CLASS_PATH` to include the same location where you put the previous output:
```
fileManager.setLocation(javax.tools.StandardLocation.CLASS_OUTPUT, Arrays.asList(dir));
// Set dirClassPath to include dir, a... | Create jar File of external classes and attach with compiler.
```
List<String> optionList = new ArrayList<String>();
// set compiler's classpath to be same as the runtime's
optionList.addAll(Arrays.asList("-classpath", System.getProperty("java.class.path")
+ getValueFromPropertieFile("jarfile1;... |
38,420,057 | I have a simple code to make Java code compiler
```
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import javax.tools.*;
import java.io.*;
import java.util.*;
public class Compiler extends JFrame
{
String loc="D:\\java";
File file=null,
dir=null;
boolean success;
public Com... | 2016/07/17 | [
"https://Stackoverflow.com/questions/38420057",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4539582/"
] | You need to specify the sourcepath directory,
your code
`String[] option=new String[]{"-g","-parameters"};`,
try this
`String[] option=new String[]{"-g","-sourcepath", loc};`
where `loc` is the root directory for the `B` class. With `A` properly stored inside its own package.
I've tried your code, with my modif... | Create jar File of external classes and attach with compiler.
```
List<String> optionList = new ArrayList<String>();
// set compiler's classpath to be same as the runtime's
optionList.addAll(Arrays.asList("-classpath", System.getProperty("java.class.path")
+ getValueFromPropertieFile("jarfile1;... |
64,552,799 | First file:-
```
<!doctype html>
<html>
<head>
<link rel="stylesheet" href="mexp_css.css">
<title>php_main3_feed</title>
</head>
<body>
<?php
if(isset($_POST['submit']))
{
$a=$_POST['fname'];
$b=$_POST['email'];
$c=$_POST['cnum'];
setcookie("c1",$a,time()+3600);
... | 2020/10/27 | [
"https://Stackoverflow.com/questions/64552799",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12903710/"
] | The main idea of unit testing is to test units separately. Otherwise, it would be an integration test.
In this case, you need to write a separate test suite for `Dependency`, and mock the call to it in `ClassUnderTest`. | If you're writing your unit test suite you probably want to mock it, even more if your dependency is pure logic. Consider the following scenario
```
public class ClassUnderTest {
@Autowired
private Dependency dependency;
public int doSomething(int a, int b) {
return dependency.add(a, b) * 2;
}
}
public c... |
64,552,799 | First file:-
```
<!doctype html>
<html>
<head>
<link rel="stylesheet" href="mexp_css.css">
<title>php_main3_feed</title>
</head>
<body>
<?php
if(isset($_POST['submit']))
{
$a=$_POST['fname'];
$b=$_POST['email'];
$c=$_POST['cnum'];
setcookie("c1",$a,time()+3600);
... | 2020/10/27 | [
"https://Stackoverflow.com/questions/64552799",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12903710/"
] | The main idea of unit testing is to test units separately. Otherwise, it would be an integration test.
In this case, you need to write a separate test suite for `Dependency`, and mock the call to it in `ClassUnderTest`. | You have two separate question.
The point of mocking is to not have dependencies in your unit tests creating implicit behavior. You want unit tests to be explicit about the code unit you test to be able to identify regression and also declare your expectation how `ClassUnderTest` behaves in different conditions.
Whet... |
64,552,799 | First file:-
```
<!doctype html>
<html>
<head>
<link rel="stylesheet" href="mexp_css.css">
<title>php_main3_feed</title>
</head>
<body>
<?php
if(isset($_POST['submit']))
{
$a=$_POST['fname'];
$b=$_POST['email'];
$c=$_POST['cnum'];
setcookie("c1",$a,time()+3600);
... | 2020/10/27 | [
"https://Stackoverflow.com/questions/64552799",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12903710/"
] | You have two separate question.
The point of mocking is to not have dependencies in your unit tests creating implicit behavior. You want unit tests to be explicit about the code unit you test to be able to identify regression and also declare your expectation how `ClassUnderTest` behaves in different conditions.
Whet... | If you're writing your unit test suite you probably want to mock it, even more if your dependency is pure logic. Consider the following scenario
```
public class ClassUnderTest {
@Autowired
private Dependency dependency;
public int doSomething(int a, int b) {
return dependency.add(a, b) * 2;
}
}
public c... |
6,523,301 | So I want to put a list of newsitems in \_Layout.cshtml
I have a News model and a Show Action in its controller, and I want to put it in there with a RenderAction.
```
@Html.RenderAction("Show","News");
```
Does not seem to work.
But <http://localhost:49295/News/Show/> does work
I should be using renderaction rig... | 2011/06/29 | [
"https://Stackoverflow.com/questions/6523301",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/295688/"
] | Set the layout to null in the View
```
@{ Layout = null; }
``` | In your View try:
```
@{Html.RenderAction("Show","News");}
``` |
373,608 | I'm new to this vmware stuff. I was wondering if anyone knows how to modify virtual images offline or know of any tools. I used VM Converter to convert my current desktop to an image. This is for a school project to be able to make changes to the image offline such as changing the os, install/remove software etc... | 2012/03/26 | [
"https://serverfault.com/questions/373608",
"https://serverfault.com",
"https://serverfault.com/users/115424/"
] | You can use [UFS Explorer](http://www.ufsexplorer.com/) to modify a cold VMDK image. It's a good data recovery tool as well. | maybe you want to take a look at this <http://www.vmware.com/support/developer/vddk/> |
62,840,198 | So I'm trying to parse quotes from a website, but within the Result class there are multiple paragraphs.
Is there a way to ignore the date and author and only select the material in quotes? So I would only be left with a list of quotes? Using BeautifulSoup btw. Thanks.
```
<div class="result">
<p><strong>Date:</stro... | 2020/07/10 | [
"https://Stackoverflow.com/questions/62840198",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13907664/"
] | you can use xpath for your query, for example:
```
import requests
from lxml import html
page = requests.get('enter_your_url')
tree = html.fromstring(page.content)
data = tree.xpath('//div[@class="result"]//p[2]/text()')
print(data)
``` | If I understand your question properly, you're looking to print just the quotes, which appear in every 3rd paragraph element, starting with the 2nd one.
```py
quotes = soup.find_all('p')
for i in range(1, len(quotes), 3):
print(quotes[i].text)
```
There may be a cleaner way of doing this, but that should work. |
41,576,119 | I'm currently working on an Angular 2 project and even though everything concernig routes seems to be working relatively fine, I'm not entirely happy with how I've accomplished this.
Here's a diagram closely matching the structure I'm using for our app:

So, this app has two... | 2017/01/10 | [
"https://Stackoverflow.com/questions/41576119",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3219404/"
] | Any time you need to have a delay in iterations, it makes sense to use a self-calling function instead of a loop.
```
function doStuff(data, i){
//do things here
console.log(i)
if(--i) setTimeout(function(){doStuff(data, i)}, 1000)
else nextStep(data)
}
function nextStep(data){
//after the loop ends, mo... | Have you tried the equivalent of thread sleep?
```
var millisecondsToWait = 500;
setTimeout(function() {
// Whatever you want to do after the wait
}, millisecondsToWait);
``` |
41,576,119 | I'm currently working on an Angular 2 project and even though everything concernig routes seems to be working relatively fine, I'm not entirely happy with how I've accomplished this.
Here's a diagram closely matching the structure I'm using for our app:

So, this app has two... | 2017/01/10 | [
"https://Stackoverflow.com/questions/41576119",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3219404/"
] | I'm not really sure of what you're after, but if you want to wait for each counter (in each input) to finish and then start the next counter, a linked list comes to mind.
Jquery provides the method [next](https://api.jquery.com/next/) that gets you the next sibling. That could help you to build the linked list. The it... | Have you tried the equivalent of thread sleep?
```
var millisecondsToWait = 500;
setTimeout(function() {
// Whatever you want to do after the wait
}, millisecondsToWait);
``` |
41,576,119 | I'm currently working on an Angular 2 project and even though everything concernig routes seems to be working relatively fine, I'm not entirely happy with how I've accomplished this.
Here's a diagram closely matching the structure I'm using for our app:

So, this app has two... | 2017/01/10 | [
"https://Stackoverflow.com/questions/41576119",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3219404/"
] | I'm not really sure of what you're after, but if you want to wait for each counter (in each input) to finish and then start the next counter, a linked list comes to mind.
Jquery provides the method [next](https://api.jquery.com/next/) that gets you the next sibling. That could help you to build the linked list. The it... | Any time you need to have a delay in iterations, it makes sense to use a self-calling function instead of a loop.
```
function doStuff(data, i){
//do things here
console.log(i)
if(--i) setTimeout(function(){doStuff(data, i)}, 1000)
else nextStep(data)
}
function nextStep(data){
//after the loop ends, mo... |
28,263,366 | I have below code, but I don't understand how the output is working.
```
String s1 = "hello";
String s2 = "hello";
String s3 = new String("hello");
String s4 = new String("hello");
System.out.println(s1==s2);
System.out.println(s3==s4);
```
The output is **true** then **false**. But the hashcode value for all s1,s... | 2015/02/01 | [
"https://Stackoverflow.com/questions/28263366",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/757481/"
] | Use `s1.equals(s2)` for comparison between `String`, as `equals()` checks value equality while `==` checks reference equality, and `==` would never invoke `hashCode()`.
Your first case is true because literals are interned by the compiler and thus refer to the same object
```
String s1 = "hello";
String s2 = "hello"... | Paul Lo is right. '==' checks if those objects are stored at the same place in the memory. The equals methode is suppost to return true if the hash is the same, not '=='. |
28,263,366 | I have below code, but I don't understand how the output is working.
```
String s1 = "hello";
String s2 = "hello";
String s3 = new String("hello");
String s4 = new String("hello");
System.out.println(s1==s2);
System.out.println(s3==s4);
```
The output is **true** then **false**. But the hashcode value for all s1,s... | 2015/02/01 | [
"https://Stackoverflow.com/questions/28263366",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/757481/"
] | ```
== tests for reference equality.
.equals() tests for value equality.
```
and **==** has nothing to do with hashCode(); | Paul Lo is right. '==' checks if those objects are stored at the same place in the memory. The equals methode is suppost to return true if the hash is the same, not '=='. |
28,263,366 | I have below code, but I don't understand how the output is working.
```
String s1 = "hello";
String s2 = "hello";
String s3 = new String("hello");
String s4 = new String("hello");
System.out.println(s1==s2);
System.out.println(s3==s4);
```
The output is **true** then **false**. But the hashcode value for all s1,s... | 2015/02/01 | [
"https://Stackoverflow.com/questions/28263366",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/757481/"
] | s1 and s2, created using string literal, are always of the same object, being retrieved from the String constant pool.
On the other hand, two new String objects are being created for s3 and S4 using new constructor. | Paul Lo is right. '==' checks if those objects are stored at the same place in the memory. The equals methode is suppost to return true if the hash is the same, not '=='. |
14,835,436 | I have a config.ini file with some values. One of them is the path to the root of my script. So in my js file i get the content from the config.ini file, but i have one big mistake. To load the data from the config file i already need one value from the config file, namely the path to the config file.
Any idea how to ... | 2013/02/12 | [
"https://Stackoverflow.com/questions/14835436",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1515190/"
] | Yes. Store the path to your config file in code. The rest can be loaded from the config file.
You can't possibly have everything in a config file. I once worked with someone who tried to store database configuration in the database. And then realized their mistake when they tried to make the application, you know, wor... | What I've always done is to statically define the name of the config file in my code, so in your JS:
```
config_file = '/path/to/myconfig.ini'
``` |
14,835,436 | I have a config.ini file with some values. One of them is the path to the root of my script. So in my js file i get the content from the config.ini file, but i have one big mistake. To load the data from the config file i already need one value from the config file, namely the path to the config file.
Any idea how to ... | 2013/02/12 | [
"https://Stackoverflow.com/questions/14835436",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1515190/"
] | Yes. Store the path to your config file in code. The rest can be loaded from the config file.
You can't possibly have everything in a config file. I once worked with someone who tried to store database configuration in the database. And then realized their mistake when they tried to make the application, you know, wor... | This is a chicken and egg problem. The config file cannot contain the path to the config file, its path needs to be known to all parts of the program that need to know the settings. Perhaps have the path as a global variable in your program somewhere? |
31,866,796 | I am writing an application in Flask, which works really well except that `WSGI` is synchronous and blocking. I have one task in particular which calls out to a third party API and that task can take several minutes to complete. I would like to make that call (it's actually a series of calls) and let it run. while cont... | 2015/08/06 | [
"https://Stackoverflow.com/questions/31866796",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/791335/"
] | I would use [Celery](https://docs.celeryproject.org/en/stable/index.html) to handle the asynchronous task for you. You'll need to install a broker to serve as your task queue (RabbitMQ and Redis are recommended).
`app.py`:
```
from flask import Flask
from celery import Celery
broker_url = 'amqp://guest@localhost' ... | Threading is another possible solution. Although the Celery based solution is better for applications at scale, if you are not expecting too much traffic on the endpoint in question, threading is a viable alternative.
This solution is based on [Miguel Grinberg's PyCon 2016 Flask at Scale presentation](https://youtu.be... |
31,866,796 | I am writing an application in Flask, which works really well except that `WSGI` is synchronous and blocking. I have one task in particular which calls out to a third party API and that task can take several minutes to complete. I would like to make that call (it's actually a series of calls) and let it run. while cont... | 2015/08/06 | [
"https://Stackoverflow.com/questions/31866796",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/791335/"
] | I would use [Celery](https://docs.celeryproject.org/en/stable/index.html) to handle the asynchronous task for you. You'll need to install a broker to serve as your task queue (RabbitMQ and Redis are recommended).
`app.py`:
```
from flask import Flask
from celery import Celery
broker_url = 'amqp://guest@localhost' ... | You can also try using [`multiprocessing.Process`](https://docs.python.org/3/library/multiprocessing.html#multiprocessing.Process) with `daemon=True`; the `process.start()` method does not block and you can return a response/status immediately to the caller while your expensive function executes in the background.
I e... |
31,866,796 | I am writing an application in Flask, which works really well except that `WSGI` is synchronous and blocking. I have one task in particular which calls out to a third party API and that task can take several minutes to complete. I would like to make that call (it's actually a series of calls) and let it run. while cont... | 2015/08/06 | [
"https://Stackoverflow.com/questions/31866796",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/791335/"
] | I would use [Celery](https://docs.celeryproject.org/en/stable/index.html) to handle the asynchronous task for you. You'll need to install a broker to serve as your task queue (RabbitMQ and Redis are recommended).
`app.py`:
```
from flask import Flask
from celery import Celery
broker_url = 'amqp://guest@localhost' ... | Flask 2.0
=========
Flask 2.0 supports async routes now. You can use the httpx library and use the asyncio coroutines for that. You can change your code a bit like below
```
@app.route('/render/<id>', methods=['POST'])
async def render_script(id=None):
...
data = json.loads(request.data)
text_list = data.... |
31,866,796 | I am writing an application in Flask, which works really well except that `WSGI` is synchronous and blocking. I have one task in particular which calls out to a third party API and that task can take several minutes to complete. I would like to make that call (it's actually a series of calls) and let it run. while cont... | 2015/08/06 | [
"https://Stackoverflow.com/questions/31866796",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/791335/"
] | I would use [Celery](https://docs.celeryproject.org/en/stable/index.html) to handle the asynchronous task for you. You'll need to install a broker to serve as your task queue (RabbitMQ and Redis are recommended).
`app.py`:
```
from flask import Flask
from celery import Celery
broker_url = 'amqp://guest@localhost' ... | If you are using `redis`, you can use `Pubsub` event to handle background tasks.
See more: <https://redis.com/ebook/part-2-core-concepts/chapter-3-commands-in-redis/3-6-publishsubscribe/> |
31,866,796 | I am writing an application in Flask, which works really well except that `WSGI` is synchronous and blocking. I have one task in particular which calls out to a third party API and that task can take several minutes to complete. I would like to make that call (it's actually a series of calls) and let it run. while cont... | 2015/08/06 | [
"https://Stackoverflow.com/questions/31866796",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/791335/"
] | Threading is another possible solution. Although the Celery based solution is better for applications at scale, if you are not expecting too much traffic on the endpoint in question, threading is a viable alternative.
This solution is based on [Miguel Grinberg's PyCon 2016 Flask at Scale presentation](https://youtu.be... | You can also try using [`multiprocessing.Process`](https://docs.python.org/3/library/multiprocessing.html#multiprocessing.Process) with `daemon=True`; the `process.start()` method does not block and you can return a response/status immediately to the caller while your expensive function executes in the background.
I e... |
31,866,796 | I am writing an application in Flask, which works really well except that `WSGI` is synchronous and blocking. I have one task in particular which calls out to a third party API and that task can take several minutes to complete. I would like to make that call (it's actually a series of calls) and let it run. while cont... | 2015/08/06 | [
"https://Stackoverflow.com/questions/31866796",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/791335/"
] | Threading is another possible solution. Although the Celery based solution is better for applications at scale, if you are not expecting too much traffic on the endpoint in question, threading is a viable alternative.
This solution is based on [Miguel Grinberg's PyCon 2016 Flask at Scale presentation](https://youtu.be... | Flask 2.0
=========
Flask 2.0 supports async routes now. You can use the httpx library and use the asyncio coroutines for that. You can change your code a bit like below
```
@app.route('/render/<id>', methods=['POST'])
async def render_script(id=None):
...
data = json.loads(request.data)
text_list = data.... |
31,866,796 | I am writing an application in Flask, which works really well except that `WSGI` is synchronous and blocking. I have one task in particular which calls out to a third party API and that task can take several minutes to complete. I would like to make that call (it's actually a series of calls) and let it run. while cont... | 2015/08/06 | [
"https://Stackoverflow.com/questions/31866796",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/791335/"
] | Threading is another possible solution. Although the Celery based solution is better for applications at scale, if you are not expecting too much traffic on the endpoint in question, threading is a viable alternative.
This solution is based on [Miguel Grinberg's PyCon 2016 Flask at Scale presentation](https://youtu.be... | If you are using `redis`, you can use `Pubsub` event to handle background tasks.
See more: <https://redis.com/ebook/part-2-core-concepts/chapter-3-commands-in-redis/3-6-publishsubscribe/> |
31,866,796 | I am writing an application in Flask, which works really well except that `WSGI` is synchronous and blocking. I have one task in particular which calls out to a third party API and that task can take several minutes to complete. I would like to make that call (it's actually a series of calls) and let it run. while cont... | 2015/08/06 | [
"https://Stackoverflow.com/questions/31866796",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/791335/"
] | You can also try using [`multiprocessing.Process`](https://docs.python.org/3/library/multiprocessing.html#multiprocessing.Process) with `daemon=True`; the `process.start()` method does not block and you can return a response/status immediately to the caller while your expensive function executes in the background.
I e... | If you are using `redis`, you can use `Pubsub` event to handle background tasks.
See more: <https://redis.com/ebook/part-2-core-concepts/chapter-3-commands-in-redis/3-6-publishsubscribe/> |
31,866,796 | I am writing an application in Flask, which works really well except that `WSGI` is synchronous and blocking. I have one task in particular which calls out to a third party API and that task can take several minutes to complete. I would like to make that call (it's actually a series of calls) and let it run. while cont... | 2015/08/06 | [
"https://Stackoverflow.com/questions/31866796",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/791335/"
] | Flask 2.0
=========
Flask 2.0 supports async routes now. You can use the httpx library and use the asyncio coroutines for that. You can change your code a bit like below
```
@app.route('/render/<id>', methods=['POST'])
async def render_script(id=None):
...
data = json.loads(request.data)
text_list = data.... | If you are using `redis`, you can use `Pubsub` event to handle background tasks.
See more: <https://redis.com/ebook/part-2-core-concepts/chapter-3-commands-in-redis/3-6-publishsubscribe/> |
26,828,549 | How to move my actionbar item to the left side of the ACTIONBAR, before the title? I have two items, edit and settings, I need my items placed both on the right and left side, but it places by default on the right, how can i change it? | 2014/11/09 | [
"https://Stackoverflow.com/questions/26828549",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4166426/"
] | in the Activity
ActionBar actionBar = getActionBar();
```
actionBar.setDisplayShowHomeEnabled(false);
View mActionBarView = getLayoutInflater().inflate(R.layout.my_action_bar, null);
actionBar.setCustomView(mActionBarView);
actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM);
```
my\_action\_bar.xml:
```
<R... | What I would do is hide the actionbar title by following way:
```
getActionBar().setDisplayShowTitleEnabled(false);
```
Then place them in item menu as you wish in your order. |
44,119,792 | >
> We're sorry if it sounds too noob. But this is our life's first encounter with Python.
>
>
>
We have [got a python function](https://tio.run/nexus/python2#LY7BCsIwEER/ZY@7ZgOm0AhK/BHx0MYUQs0qsUL79bFtvMzwGGaY8ggDJBQe2bsjnWdenFxymL5ZwEMcQJwbITw/AU4H9FdLrwwpCibEWXW8qJ62sjI0rEnHPUS5oeGGeFW9ma6k/9iw2VVvpivpHe9U3jnK... | 2017/05/22 | [
"https://Stackoverflow.com/questions/44119792",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6664238/"
] | When you define a function, either the function definition must be all on the same line (as in your original example), or the header `def m(n,k,c=0):` must be on the line of its own, and the remaining statements must be on the next line(s). You cannot mix-and-match.
```
def m(n, k, c=0):
x, y = n
return c if n==k ... | The part that goes `return c if n==k else ...` is a ternary conditional operator in Python (similar to the `? :` operator in JS). See [Does Python have a ternary conditional operator?](https://stackoverflow.com/questions/394809/does-python-have-a-ternary-conditional-operator) for instance. You can't put a line break th... |
240,231 | I have created an SVN server long time back.
I have been storing some binary files (doc files) along with codes.
After every edit size increases because SVN saves a new copy of binary file.
Now the svn is occupying a lot of space.
Q1. I want to delete all previous revision of the binary files, keeping previous revisi... | 2011/02/25 | [
"https://serverfault.com/questions/240231",
"https://serverfault.com",
"https://serverfault.com/users/72184/"
] | The only way to destroy data in subversion is to dump the repository to a file; run it through `svndumpfilter` and load it back again. svndumpfilter only works on paths, not revisions, however, so for your purpose, I'd recommend `svn export`ing your binaries folder, before doing the following:
```
svnadmin dump <repo ... | i'm affraid you cant do it 'out of the box', what goes in is meant to stay.
you can remove files by dumping the repository, filtering files and importing it again - but it's a pain.
check this discussions: [1](https://stackoverflow.com/questions/2426056/why-isnt-obliterate-an-essential-feature-of-subversion), [2](http... |
65,202,015 | I recently started using enums for commonly used names in my application. The issue is that enums cannot be inherited. This is the intent:
```
public enum foreignCars
{
Mazda = 0,
Nissan = 1,
Peugot = 2
}
public enum allCars : foreignCars
{
BMW = 3,
VW = 4,
Audi = 5
}
```
O... | 2020/12/08 | [
"https://Stackoverflow.com/questions/65202015",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10243896/"
] | ```
using System;
namespace Csharp_learning
{
class MainDemo
{
public static int ReadNumber(string prompt, int min, int max)
{
int result = 0;
do
{
Console.Write(prompt);
string numberString = Console.ReadLine();
result = int.Parse(numberString);
if (result ... | Your code runs fine for me. It works as expected. The error suggest there is a typo in the project file. Open your CSharp Learning.csproj project file and look for parenthesis that are mismatched or out of place. Another solution would be to create a new project. Then copy your code the the new project. |
9,790,243 | **UPDATE:**
Seems to me like it is pretty much an Apple bug. I tried the following:
1. create a new single-window project
2. create a single UIPickerView like the one shown below, only that the
picker just allows for turning the dials. That is, neither variables
nor any state is manipulated when interacting the picke... | 2012/03/20 | [
"https://Stackoverflow.com/questions/9790243",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/949772/"
] | Firstly, I'm impressed that you managed to create an InnoDB table that has FK references to two MyISAM tables!
Try creating all three table with InnoDB engine and trying again.... | Both the parent and the child tables need to use the InnoDB storage engine, but you're using MyISAM for the parent tables.
My guess is that there is already a table named department\_roles\_map, so when you run`CREATE TABLE IF NOT EXISTS` it's failing because the table already exists, and ignoring the error. Then when... |
262,796 | I built a custom post type where we can find a standard textarea/tinymce generated by `wp_editor()` and I'm facing an issue for the saving part.
If I save the content with the following code :
```
update_post_meta( $post_id, $prefix.'content', $_POST['content'] );
```
Everything is working fine but there is no sec... | 2017/04/07 | [
"https://wordpress.stackexchange.com/questions/262796",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/117153/"
] | In short: it is in dependence of your context, the data inside your editor.
`wp_kses()` is really helpful, and you can define your custom allowed HTML tags.
Alternative, you can use the default functions, like [`wp_kses_post`](https://codex.wordpress.org/Function_Reference/wp_kses_post) or [`wp_kses_data`](https://cod... | Try
```
//save this in the database
$content=sanitize_text_field( htmlentities($_POST['content']) );
//to display, use
html_entity_decode($content);
```
1. `htmlentities()` will convert all characters which have HTML character entity equivalents to their equivalents.
2. `sanitize_text_field()` will then check for ... |
262,796 | I built a custom post type where we can find a standard textarea/tinymce generated by `wp_editor()` and I'm facing an issue for the saving part.
If I save the content with the following code :
```
update_post_meta( $post_id, $prefix.'content', $_POST['content'] );
```
Everything is working fine but there is no sec... | 2017/04/07 | [
"https://wordpress.stackexchange.com/questions/262796",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/117153/"
] | Try
```
//save this in the database
$content=sanitize_text_field( htmlentities($_POST['content']) );
//to display, use
html_entity_decode($content);
```
1. `htmlentities()` will convert all characters which have HTML character entity equivalents to their equivalents.
2. `sanitize_text_field()` will then check for ... | [wp\_slash](https://codex.wordpress.org/Function_Reference/wp_slash) More information.
```
update_post_meta( $post_id, $prefix.'content',wp_slash($_POST['content']) );
``` |
262,796 | I built a custom post type where we can find a standard textarea/tinymce generated by `wp_editor()` and I'm facing an issue for the saving part.
If I save the content with the following code :
```
update_post_meta( $post_id, $prefix.'content', $_POST['content'] );
```
Everything is working fine but there is no sec... | 2017/04/07 | [
"https://wordpress.stackexchange.com/questions/262796",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/117153/"
] | Try
```
//save this in the database
$content=sanitize_text_field( htmlentities($_POST['content']) );
//to display, use
html_entity_decode($content);
```
1. `htmlentities()` will convert all characters which have HTML character entity equivalents to their equivalents.
2. `sanitize_text_field()` will then check for ... | You could do someting like this:
```
/**
* Most of the 'post' HTML are excepted accept <textarea> itself.
* @link https://codex.wordpress.org/Function_Reference/wp_kses_allowed_html
*/
$allowed_html = wp_kses_allowed_html( 'post' );
// Remove '<textarea>' tag
unset ( $allowed_html['textarea'] );
/**
* wp_kses_al... |
262,796 | I built a custom post type where we can find a standard textarea/tinymce generated by `wp_editor()` and I'm facing an issue for the saving part.
If I save the content with the following code :
```
update_post_meta( $post_id, $prefix.'content', $_POST['content'] );
```
Everything is working fine but there is no sec... | 2017/04/07 | [
"https://wordpress.stackexchange.com/questions/262796",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/117153/"
] | In short: it is in dependence of your context, the data inside your editor.
`wp_kses()` is really helpful, and you can define your custom allowed HTML tags.
Alternative, you can use the default functions, like [`wp_kses_post`](https://codex.wordpress.org/Function_Reference/wp_kses_post) or [`wp_kses_data`](https://cod... | [wp\_slash](https://codex.wordpress.org/Function_Reference/wp_slash) More information.
```
update_post_meta( $post_id, $prefix.'content',wp_slash($_POST['content']) );
``` |
262,796 | I built a custom post type where we can find a standard textarea/tinymce generated by `wp_editor()` and I'm facing an issue for the saving part.
If I save the content with the following code :
```
update_post_meta( $post_id, $prefix.'content', $_POST['content'] );
```
Everything is working fine but there is no sec... | 2017/04/07 | [
"https://wordpress.stackexchange.com/questions/262796",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/117153/"
] | In short: it is in dependence of your context, the data inside your editor.
`wp_kses()` is really helpful, and you can define your custom allowed HTML tags.
Alternative, you can use the default functions, like [`wp_kses_post`](https://codex.wordpress.org/Function_Reference/wp_kses_post) or [`wp_kses_data`](https://cod... | You could do someting like this:
```
/**
* Most of the 'post' HTML are excepted accept <textarea> itself.
* @link https://codex.wordpress.org/Function_Reference/wp_kses_allowed_html
*/
$allowed_html = wp_kses_allowed_html( 'post' );
// Remove '<textarea>' tag
unset ( $allowed_html['textarea'] );
/**
* wp_kses_al... |
262,796 | I built a custom post type where we can find a standard textarea/tinymce generated by `wp_editor()` and I'm facing an issue for the saving part.
If I save the content with the following code :
```
update_post_meta( $post_id, $prefix.'content', $_POST['content'] );
```
Everything is working fine but there is no sec... | 2017/04/07 | [
"https://wordpress.stackexchange.com/questions/262796",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/117153/"
] | You could do someting like this:
```
/**
* Most of the 'post' HTML are excepted accept <textarea> itself.
* @link https://codex.wordpress.org/Function_Reference/wp_kses_allowed_html
*/
$allowed_html = wp_kses_allowed_html( 'post' );
// Remove '<textarea>' tag
unset ( $allowed_html['textarea'] );
/**
* wp_kses_al... | [wp\_slash](https://codex.wordpress.org/Function_Reference/wp_slash) More information.
```
update_post_meta( $post_id, $prefix.'content',wp_slash($_POST['content']) );
``` |
25,161,692 | After installing opensips(It will be better if i won't have to use opensips control panel) how can add users and can make test call.
Note:
I am a newbie, and following this guide for installation.
<http://www.opensips.org/Documentation/Install-CompileAndInstall-1-11> | 2014/08/06 | [
"https://Stackoverflow.com/questions/25161692",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/937256/"
] | Instead of using the *Control Panel*, you can use *opensipsctl* in order to add new subscribers. All you need to do is:
```
opensipsctl add liviu@opensips.org mypassword
```
For more help on the *opensipsctl*, simply type:
```
opensipsctl
``` | For any user that's trying to install the package under Ubuntu by instructions from official manual, please make sure that you also read setup manual from github page, section [C] and [D]
>
> <https://github.com/OpenSIPS/opensips/blob/master/INSTALL>
>
>
>
I've tried to do a fresh setup of opensips on a virtual m... |
19,533,246 | I want to know
How to find out difference between normal mkdir directory and svn checkout directory? | 2013/10/23 | [
"https://Stackoverflow.com/questions/19533246",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2866881/"
] | After reading your question and comment, I would suggest you to use one2many relation between two objects and keep one2many list view inside partner, from where one can create the record , does not need to select the partner and record is created only for that partner.
Cheers,
Parthiv | Google OpenERP \_defaults (a dictionary) and default\_get (a method). |
1,255,721 | I have installed R in my Ubuntu (18.04) system and when I try to install a package I receive the following message (for example when trying to install `dplyr` package):
```
> install.packages('dplyr')
Installing package into ‘/home/giwrikas/R/x86_64-pc-linux-gnu-library/4.0’
(as ‘lib’ is unspecified)
Warning: unable t... | 2020/07/02 | [
"https://askubuntu.com/questions/1255721",
"https://askubuntu.com",
"https://askubuntu.com/users/1058780/"
] | Try to switch to other mirror using the following procedure:
1. Open terminal and launch `R` shell
2. In `R` shell switch the mirror by `chooseCRANmirror()` - in opened window choose nearest mirror
3. In `R` shell retry package installation with `install.packages('dplyr')` | The newest version of R that you seem to want can be installed without adding software sources to the default repositories starting in Ubuntu 20.10 which won't be released until November. An earlier version of r-cran-dplyr can be installed right now from the default repositories in 18.04, but it drags in r-base-core 3.... |
1,255,721 | I have installed R in my Ubuntu (18.04) system and when I try to install a package I receive the following message (for example when trying to install `dplyr` package):
```
> install.packages('dplyr')
Installing package into ‘/home/giwrikas/R/x86_64-pc-linux-gnu-library/4.0’
(as ‘lib’ is unspecified)
Warning: unable t... | 2020/07/02 | [
"https://askubuntu.com/questions/1255721",
"https://askubuntu.com",
"https://askubuntu.com/users/1058780/"
] | Are you behind a firewall ? I had to add the proxy to my Renviron.site before proceeding on various servers:
`sudo nano /usr/lib/R/etc/Renviron.site`
```
#add following, edit to your proxy
http_proxy=http://myproxy.com:8080
https_proxy=http://myproxy.com:8080
ftp_proxy=http://myproxy.com:8080
``` | Try to switch to other mirror using the following procedure:
1. Open terminal and launch `R` shell
2. In `R` shell switch the mirror by `chooseCRANmirror()` - in opened window choose nearest mirror
3. In `R` shell retry package installation with `install.packages('dplyr')` |
1,255,721 | I have installed R in my Ubuntu (18.04) system and when I try to install a package I receive the following message (for example when trying to install `dplyr` package):
```
> install.packages('dplyr')
Installing package into ‘/home/giwrikas/R/x86_64-pc-linux-gnu-library/4.0’
(as ‘lib’ is unspecified)
Warning: unable t... | 2020/07/02 | [
"https://askubuntu.com/questions/1255721",
"https://askubuntu.com",
"https://askubuntu.com/users/1058780/"
] | Are you behind a firewall ? I had to add the proxy to my Renviron.site before proceeding on various servers:
`sudo nano /usr/lib/R/etc/Renviron.site`
```
#add following, edit to your proxy
http_proxy=http://myproxy.com:8080
https_proxy=http://myproxy.com:8080
ftp_proxy=http://myproxy.com:8080
``` | The newest version of R that you seem to want can be installed without adding software sources to the default repositories starting in Ubuntu 20.10 which won't be released until November. An earlier version of r-cran-dplyr can be installed right now from the default repositories in 18.04, but it drags in r-base-core 3.... |
3,115,334 | Four dice are thrown, what's the probability that:
a) None of them fall higher than three?
b) None of them fall higher than four?
c) That four is the highest number thrown?
So for a, I wanna think about the denominator first. There are 6 possible outcomes for each dice, and we have four dice. So we're technically p... | 2019/02/16 | [
"https://math.stackexchange.com/questions/3115334",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/416804/"
] | a) The probability that a die does not fall higher than $3$ is given by
$$P(X\le3)=\frac{3}{6}=\frac{1}{2}$$
So as each event is independent we can find the probability that no die falls higher than three by raising this result to the power of $4$
$$(P(X\le3))^4=\frac{1}{2^4}=\frac{1}{16}$$
b) Similarly the probabilit... | Let $D\_i$ be the outcome of the $i$-th die. Denote $D = (D\_1,\dots,D\_4)$.
>
> So the denominator/sample space should be 6464 right?
>
>
>
* Sample space $\Omega = \{1,\dots,6\}^4$
* We use the *cardinality* of $\Omega$ as the denominator, and that of the desired event $E$ as the numerator for (a) and (b).
* (a... |
3,115,334 | Four dice are thrown, what's the probability that:
a) None of them fall higher than three?
b) None of them fall higher than four?
c) That four is the highest number thrown?
So for a, I wanna think about the denominator first. There are 6 possible outcomes for each dice, and we have four dice. So we're technically p... | 2019/02/16 | [
"https://math.stackexchange.com/questions/3115334",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/416804/"
] | a) The probability that a die does not fall higher than $3$ is given by
$$P(X\le3)=\frac{3}{6}=\frac{1}{2}$$
So as each event is independent we can find the probability that no die falls higher than three by raising this result to the power of $4$
$$(P(X\le3))^4=\frac{1}{2^4}=\frac{1}{16}$$
b) Similarly the probabilit... | $a)$
The probability that one dice rolls a number equal to $3$ or lower is $\frac{3}{6}=\frac{1}{2}$.
Hence, the probability that all of them roll $3$ or lower is $(\frac{1}{2})^4=\frac{1}{16}$.
Can you do the same for $b)$?
$c)$
Firstly, There is a probability of $(\frac{4}{6})^4=(\frac{256}{1296})$ that all numbers... |
3,115,334 | Four dice are thrown, what's the probability that:
a) None of them fall higher than three?
b) None of them fall higher than four?
c) That four is the highest number thrown?
So for a, I wanna think about the denominator first. There are 6 possible outcomes for each dice, and we have four dice. So we're technically p... | 2019/02/16 | [
"https://math.stackexchange.com/questions/3115334",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/416804/"
] | a) The probability that a die does not fall higher than $3$ is given by
$$P(X\le3)=\frac{3}{6}=\frac{1}{2}$$
So as each event is independent we can find the probability that no die falls higher than three by raising this result to the power of $4$
$$(P(X\le3))^4=\frac{1}{2^4}=\frac{1}{16}$$
b) Similarly the probabilit... | I'm trying to address your metholodigal doubts, GNUSupporter 8964民主女神 地下教會 already gave a (very brief) answer to your mathematical questions.
Probably it's an urban legend, but there was a dispute between two statisticians: If you throw 2 "normal", 6-sided fair dice and add the values, will you get (in the long run) t... |
3,115,334 | Four dice are thrown, what's the probability that:
a) None of them fall higher than three?
b) None of them fall higher than four?
c) That four is the highest number thrown?
So for a, I wanna think about the denominator first. There are 6 possible outcomes for each dice, and we have four dice. So we're technically p... | 2019/02/16 | [
"https://math.stackexchange.com/questions/3115334",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/416804/"
] | Let $D\_i$ be the outcome of the $i$-th die. Denote $D = (D\_1,\dots,D\_4)$.
>
> So the denominator/sample space should be 6464 right?
>
>
>
* Sample space $\Omega = \{1,\dots,6\}^4$
* We use the *cardinality* of $\Omega$ as the denominator, and that of the desired event $E$ as the numerator for (a) and (b).
* (a... | $a)$
The probability that one dice rolls a number equal to $3$ or lower is $\frac{3}{6}=\frac{1}{2}$.
Hence, the probability that all of them roll $3$ or lower is $(\frac{1}{2})^4=\frac{1}{16}$.
Can you do the same for $b)$?
$c)$
Firstly, There is a probability of $(\frac{4}{6})^4=(\frac{256}{1296})$ that all numbers... |
3,115,334 | Four dice are thrown, what's the probability that:
a) None of them fall higher than three?
b) None of them fall higher than four?
c) That four is the highest number thrown?
So for a, I wanna think about the denominator first. There are 6 possible outcomes for each dice, and we have four dice. So we're technically p... | 2019/02/16 | [
"https://math.stackexchange.com/questions/3115334",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/416804/"
] | Let $D\_i$ be the outcome of the $i$-th die. Denote $D = (D\_1,\dots,D\_4)$.
>
> So the denominator/sample space should be 6464 right?
>
>
>
* Sample space $\Omega = \{1,\dots,6\}^4$
* We use the *cardinality* of $\Omega$ as the denominator, and that of the desired event $E$ as the numerator for (a) and (b).
* (a... | I'm trying to address your metholodigal doubts, GNUSupporter 8964民主女神 地下教會 already gave a (very brief) answer to your mathematical questions.
Probably it's an urban legend, but there was a dispute between two statisticians: If you throw 2 "normal", 6-sided fair dice and add the values, will you get (in the long run) t... |
3,115,334 | Four dice are thrown, what's the probability that:
a) None of them fall higher than three?
b) None of them fall higher than four?
c) That four is the highest number thrown?
So for a, I wanna think about the denominator first. There are 6 possible outcomes for each dice, and we have four dice. So we're technically p... | 2019/02/16 | [
"https://math.stackexchange.com/questions/3115334",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/416804/"
] | I'm trying to address your metholodigal doubts, GNUSupporter 8964民主女神 地下教會 already gave a (very brief) answer to your mathematical questions.
Probably it's an urban legend, but there was a dispute between two statisticians: If you throw 2 "normal", 6-sided fair dice and add the values, will you get (in the long run) t... | $a)$
The probability that one dice rolls a number equal to $3$ or lower is $\frac{3}{6}=\frac{1}{2}$.
Hence, the probability that all of them roll $3$ or lower is $(\frac{1}{2})^4=\frac{1}{16}$.
Can you do the same for $b)$?
$c)$
Firstly, There is a probability of $(\frac{4}{6})^4=(\frac{256}{1296})$ that all numbers... |
584 | I feel like there might be a fundamental issue with the format of this website.
Overview
--------
The StackExchange model works well for subjects where the question is posed for the purpose of helping the asker, and answers can be deemed "correct" based on how well they help the asker.
On a site like StackOverflow,... | 2011/04/22 | [
"https://skeptics.meta.stackexchange.com/questions/584",
"https://skeptics.meta.stackexchange.com",
"https://skeptics.meta.stackexchange.com/users/1840/"
] | Accepted answers aren't always right even on Stack Overflow. I've downvoted some that were just plain wrong, leaving comments as to how they were wrong. Presumably they were accepted because their advice happened to work in the original poster's exact situation.
The accepted answer gets 15 rep and sits at the top of t... | I don't see a problem. OPs simply should accept the best answer.
See also: [The best posts of Skeptics!](https://skeptics.meta.stackexchange.com/questions/442/the-best-posts-of-skeptics) |
584 | I feel like there might be a fundamental issue with the format of this website.
Overview
--------
The StackExchange model works well for subjects where the question is posed for the purpose of helping the asker, and answers can be deemed "correct" based on how well they help the asker.
On a site like StackOverflow,... | 2011/04/22 | [
"https://skeptics.meta.stackexchange.com/questions/584",
"https://skeptics.meta.stackexchange.com",
"https://skeptics.meta.stackexchange.com/users/1840/"
] | I think this is rather like going on Wikipedia and telling them that an encyclopedia anyone can edit is a bad idea. That may be so, but that's the entire point of the endeavor.
The [Area 51](http://area51.stackexchange.com/) process exists to apply a model that has created [one of the best programming Q&A sites in the... | I don't see a problem. OPs simply should accept the best answer.
See also: [The best posts of Skeptics!](https://skeptics.meta.stackexchange.com/questions/442/the-best-posts-of-skeptics) |
584 | I feel like there might be a fundamental issue with the format of this website.
Overview
--------
The StackExchange model works well for subjects where the question is posed for the purpose of helping the asker, and answers can be deemed "correct" based on how well they help the asker.
On a site like StackOverflow,... | 2011/04/22 | [
"https://skeptics.meta.stackexchange.com/questions/584",
"https://skeptics.meta.stackexchange.com",
"https://skeptics.meta.stackexchange.com/users/1840/"
] | There is, I think, a real problem applying the stack exchange model here and I think the issues is highlighted in the question's summary of how the whole SE process works:
>
> The basics of the Stack Exchange Model are very simple.
>
>
> * Answer-Acceptance shows that a the Asker of a question **likes an answer** b... | I don't see a problem. OPs simply should accept the best answer.
See also: [The best posts of Skeptics!](https://skeptics.meta.stackexchange.com/questions/442/the-best-posts-of-skeptics) |
584 | I feel like there might be a fundamental issue with the format of this website.
Overview
--------
The StackExchange model works well for subjects where the question is posed for the purpose of helping the asker, and answers can be deemed "correct" based on how well they help the asker.
On a site like StackOverflow,... | 2011/04/22 | [
"https://skeptics.meta.stackexchange.com/questions/584",
"https://skeptics.meta.stackexchange.com",
"https://skeptics.meta.stackexchange.com/users/1840/"
] | From my point of view, the "Accepted Answer" for questions on this site is a bit of an issue, largely because science does allow for things to change and what may be a perfectly valid accepted answer could be completely negated several months later by new data. However, there is also an answer for this built into scien... | I don't see a problem. OPs simply should accept the best answer.
See also: [The best posts of Skeptics!](https://skeptics.meta.stackexchange.com/questions/442/the-best-posts-of-skeptics) |
584 | I feel like there might be a fundamental issue with the format of this website.
Overview
--------
The StackExchange model works well for subjects where the question is posed for the purpose of helping the asker, and answers can be deemed "correct" based on how well they help the asker.
On a site like StackOverflow,... | 2011/04/22 | [
"https://skeptics.meta.stackexchange.com/questions/584",
"https://skeptics.meta.stackexchange.com",
"https://skeptics.meta.stackexchange.com/users/1840/"
] | Accepted answers aren't always right even on Stack Overflow. I've downvoted some that were just plain wrong, leaving comments as to how they were wrong. Presumably they were accepted because their advice happened to work in the original poster's exact situation.
The accepted answer gets 15 rep and sits at the top of t... | I think this is rather like going on Wikipedia and telling them that an encyclopedia anyone can edit is a bad idea. That may be so, but that's the entire point of the endeavor.
The [Area 51](http://area51.stackexchange.com/) process exists to apply a model that has created [one of the best programming Q&A sites in the... |
584 | I feel like there might be a fundamental issue with the format of this website.
Overview
--------
The StackExchange model works well for subjects where the question is posed for the purpose of helping the asker, and answers can be deemed "correct" based on how well they help the asker.
On a site like StackOverflow,... | 2011/04/22 | [
"https://skeptics.meta.stackexchange.com/questions/584",
"https://skeptics.meta.stackexchange.com",
"https://skeptics.meta.stackexchange.com/users/1840/"
] | Accepted answers aren't always right even on Stack Overflow. I've downvoted some that were just plain wrong, leaving comments as to how they were wrong. Presumably they were accepted because their advice happened to work in the original poster's exact situation.
The accepted answer gets 15 rep and sits at the top of t... | There is, I think, a real problem applying the stack exchange model here and I think the issues is highlighted in the question's summary of how the whole SE process works:
>
> The basics of the Stack Exchange Model are very simple.
>
>
> * Answer-Acceptance shows that a the Asker of a question **likes an answer** b... |
584 | I feel like there might be a fundamental issue with the format of this website.
Overview
--------
The StackExchange model works well for subjects where the question is posed for the purpose of helping the asker, and answers can be deemed "correct" based on how well they help the asker.
On a site like StackOverflow,... | 2011/04/22 | [
"https://skeptics.meta.stackexchange.com/questions/584",
"https://skeptics.meta.stackexchange.com",
"https://skeptics.meta.stackexchange.com/users/1840/"
] | Accepted answers aren't always right even on Stack Overflow. I've downvoted some that were just plain wrong, leaving comments as to how they were wrong. Presumably they were accepted because their advice happened to work in the original poster's exact situation.
The accepted answer gets 15 rep and sits at the top of t... | From my point of view, the "Accepted Answer" for questions on this site is a bit of an issue, largely because science does allow for things to change and what may be a perfectly valid accepted answer could be completely negated several months later by new data. However, there is also an answer for this built into scien... |
584 | I feel like there might be a fundamental issue with the format of this website.
Overview
--------
The StackExchange model works well for subjects where the question is posed for the purpose of helping the asker, and answers can be deemed "correct" based on how well they help the asker.
On a site like StackOverflow,... | 2011/04/22 | [
"https://skeptics.meta.stackexchange.com/questions/584",
"https://skeptics.meta.stackexchange.com",
"https://skeptics.meta.stackexchange.com/users/1840/"
] | I think this is rather like going on Wikipedia and telling them that an encyclopedia anyone can edit is a bad idea. That may be so, but that's the entire point of the endeavor.
The [Area 51](http://area51.stackexchange.com/) process exists to apply a model that has created [one of the best programming Q&A sites in the... | From my point of view, the "Accepted Answer" for questions on this site is a bit of an issue, largely because science does allow for things to change and what may be a perfectly valid accepted answer could be completely negated several months later by new data. However, there is also an answer for this built into scien... |
584 | I feel like there might be a fundamental issue with the format of this website.
Overview
--------
The StackExchange model works well for subjects where the question is posed for the purpose of helping the asker, and answers can be deemed "correct" based on how well they help the asker.
On a site like StackOverflow,... | 2011/04/22 | [
"https://skeptics.meta.stackexchange.com/questions/584",
"https://skeptics.meta.stackexchange.com",
"https://skeptics.meta.stackexchange.com/users/1840/"
] | There is, I think, a real problem applying the stack exchange model here and I think the issues is highlighted in the question's summary of how the whole SE process works:
>
> The basics of the Stack Exchange Model are very simple.
>
>
> * Answer-Acceptance shows that a the Asker of a question **likes an answer** b... | From my point of view, the "Accepted Answer" for questions on this site is a bit of an issue, largely because science does allow for things to change and what may be a perfectly valid accepted answer could be completely negated several months later by new data. However, there is also an answer for this built into scien... |
2,876,672 | I have 2 different controller actions. As seen below, one calls the same view as the other one. The fitness version has a bunch of jquery ui tabs.
```
public ActionResult FitnessByTab(string tab, DateTime entryDate)
{
return View("Fitness", GetFitnessVM(DateTime.Today.Date));
}
public ActionRe... | 2010/05/20 | [
"https://Stackoverflow.com/questions/2876672",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4653/"
] | This is just a function that uses the `XMLHttpRequest` object to perform asynchronous requests for HTML in order to update the existing document.
Its not a pattern per se, its just one of many ways to dynamically update the document.
Its not 'server-side Ajax' (whats that?), its just plain simple ajax used to update ... | What's the problem? It seems to me it is just someone's home rolled ajax update helper function. Many of us have written lots of those through the times. |
2,876,672 | I have 2 different controller actions. As seen below, one calls the same view as the other one. The fitness version has a bunch of jquery ui tabs.
```
public ActionResult FitnessByTab(string tab, DateTime entryDate)
{
return View("Fitness", GetFitnessVM(DateTime.Today.Date));
}
public ActionRe... | 2010/05/20 | [
"https://Stackoverflow.com/questions/2876672",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4653/"
] | Not sure what you're exactly asking here, but the function given is actually fairly simple. Decoding the variables / parameters:
* e = AJAX request object
* c = Page to send AJAX request to
* f = Loading text to be displayed in specified element b
* b = id of element to display result in
* a = Function to call if ajax... | This is just a function that uses the `XMLHttpRequest` object to perform asynchronous requests for HTML in order to update the existing document.
Its not a pattern per se, its just one of many ways to dynamically update the document.
Its not 'server-side Ajax' (whats that?), its just plain simple ajax used to update ... |
2,876,672 | I have 2 different controller actions. As seen below, one calls the same view as the other one. The fitness version has a bunch of jquery ui tabs.
```
public ActionResult FitnessByTab(string tab, DateTime entryDate)
{
return View("Fitness", GetFitnessVM(DateTime.Today.Date));
}
public ActionRe... | 2010/05/20 | [
"https://Stackoverflow.com/questions/2876672",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4653/"
] | Not sure what you're exactly asking here, but the function given is actually fairly simple. Decoding the variables / parameters:
* e = AJAX request object
* c = Page to send AJAX request to
* f = Loading text to be displayed in specified element b
* b = id of element to display result in
* a = Function to call if ajax... | What's the problem? It seems to me it is just someone's home rolled ajax update helper function. Many of us have written lots of those through the times. |
2,876,672 | I have 2 different controller actions. As seen below, one calls the same view as the other one. The fitness version has a bunch of jquery ui tabs.
```
public ActionResult FitnessByTab(string tab, DateTime entryDate)
{
return View("Fitness", GetFitnessVM(DateTime.Today.Date));
}
public ActionRe... | 2010/05/20 | [
"https://Stackoverflow.com/questions/2876672",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4653/"
] | [AJAX](http://en.wikipedia.org/wiki/Ajax_(programming)) is just a buzz word for using [`XMLHttpRequest`](http://en.wikipedia.org/wiki/XMLHttpRequest) to load web content asynchronously from the server into your web document.
That function call is a plain `XMLHttpRequest` call that requests data from `page.php` (async... | What's the problem? It seems to me it is just someone's home rolled ajax update helper function. Many of us have written lots of those through the times. |
2,876,672 | I have 2 different controller actions. As seen below, one calls the same view as the other one. The fitness version has a bunch of jquery ui tabs.
```
public ActionResult FitnessByTab(string tab, DateTime entryDate)
{
return View("Fitness", GetFitnessVM(DateTime.Today.Date));
}
public ActionRe... | 2010/05/20 | [
"https://Stackoverflow.com/questions/2876672",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4653/"
] | Not sure what you're exactly asking here, but the function given is actually fairly simple. Decoding the variables / parameters:
* e = AJAX request object
* c = Page to send AJAX request to
* f = Loading text to be displayed in specified element b
* b = id of element to display result in
* a = Function to call if ajax... | [AJAX](http://en.wikipedia.org/wiki/Ajax_(programming)) is just a buzz word for using [`XMLHttpRequest`](http://en.wikipedia.org/wiki/XMLHttpRequest) to load web content asynchronously from the server into your web document.
That function call is a plain `XMLHttpRequest` call that requests data from `page.php` (async... |
461,872 | After wake up the login screen appears, but I cannot type the password to log in. Furthermore, the buttons on the system panel (e. g. to shut down) are disabled, so clicking does not take effect. I'm using Samsung RV509, 64 bit. | 2014/05/06 | [
"https://askubuntu.com/questions/461872",
"https://askubuntu.com",
"https://askubuntu.com/users/278680/"
] | The OP provided the solution in a comment:
>
> I've found the solution. I shouldn't have used the open source Xorg
> driver instead of the proprietary Nvidia driver that seems to work
> correctly.
>
>
>
– [user278680](https://askubuntu.com/users/278680/user278680) [May 11 at 16:42](https://askubuntu.com/questio... | I had the same problem.
I've installed the latest nvidia drivers from [here](http://www.binarytides.com/install-nvidia-drivers-ubuntu-14-04/),
and now everything works fine. |
461,872 | After wake up the login screen appears, but I cannot type the password to log in. Furthermore, the buttons on the system panel (e. g. to shut down) are disabled, so clicking does not take effect. I'm using Samsung RV509, 64 bit. | 2014/05/06 | [
"https://askubuntu.com/questions/461872",
"https://askubuntu.com",
"https://askubuntu.com/users/278680/"
] | The OP provided the solution in a comment:
>
> I've found the solution. I shouldn't have used the open source Xorg
> driver instead of the proprietary Nvidia driver that seems to work
> correctly.
>
>
>
– [user278680](https://askubuntu.com/users/278680/user278680) [May 11 at 16:42](https://askubuntu.com/questio... | I had a similar problem on Ubuntu Gnome 15.10. This is what worked for me:
```
sudo gedit /etc/default/grub
```
Edit the line: GRUB\_CMDLINE\_LINUX\_DEFAULT="quiet splash'"
Replace it with: GRUB\_CMDLINE\_LINUX\_DEFAULT="quiet splash acpi\_backlight=vendor acpi\_osi='!Windows 2013' acpi\_osi='!Windows 2012'"
```
s... |
461,872 | After wake up the login screen appears, but I cannot type the password to log in. Furthermore, the buttons on the system panel (e. g. to shut down) are disabled, so clicking does not take effect. I'm using Samsung RV509, 64 bit. | 2014/05/06 | [
"https://askubuntu.com/questions/461872",
"https://askubuntu.com",
"https://askubuntu.com/users/278680/"
] | I also had the same problem. Using HUD-->additional drivers, I was able to switch from the Xorg driver to the NVIDIA driver. (The number was different for mine than the 331.38 but this makes sense, I guess). Solved my problem of the login screen being frozen after waking from suspend. | Has anyone thought the problem might be suspending with unmounted drives (partitions or USB drives) showing. I had this problem recently, and no other changes than having unmounted drives @ suspend caused the problem. When any detected drives/partitions were mounted, the suspend feature worked flawlessly. This is proba... |
461,872 | After wake up the login screen appears, but I cannot type the password to log in. Furthermore, the buttons on the system panel (e. g. to shut down) are disabled, so clicking does not take effect. I'm using Samsung RV509, 64 bit. | 2014/05/06 | [
"https://askubuntu.com/questions/461872",
"https://askubuntu.com",
"https://askubuntu.com/users/278680/"
] | I'm running Ubuntu 14.10 on GA-H81M-D3H motherboard without any separate GPU, and it's frozen after suspending randomly. All that remains is the log-in screen that you can neither move your mouse nor enter the tty mode. I figured out that the problem happened every time I triggered the audio on the system. ~~Then I wen... | Has anyone thought the problem might be suspending with unmounted drives (partitions or USB drives) showing. I had this problem recently, and no other changes than having unmounted drives @ suspend caused the problem. When any detected drives/partitions were mounted, the suspend feature worked flawlessly. This is proba... |
461,872 | After wake up the login screen appears, but I cannot type the password to log in. Furthermore, the buttons on the system panel (e. g. to shut down) are disabled, so clicking does not take effect. I'm using Samsung RV509, 64 bit. | 2014/05/06 | [
"https://askubuntu.com/questions/461872",
"https://askubuntu.com",
"https://askubuntu.com/users/278680/"
] | I'm running Ubuntu 14.10 on GA-H81M-D3H motherboard without any separate GPU, and it's frozen after suspending randomly. All that remains is the log-in screen that you can neither move your mouse nor enter the tty mode. I figured out that the problem happened every time I triggered the audio on the system. ~~Then I wen... | I've had a similar problem, after wake up sometime i could move the mouse but the GUI was freezed and only when i pressed CTRL+ALT+F1 i could use the terminal. Other times instead it freezed totally.
After long research ( changing bios settings, grub settings, graphic drivers , DMs etc) i tried both lxde and gnome wit... |
461,872 | After wake up the login screen appears, but I cannot type the password to log in. Furthermore, the buttons on the system panel (e. g. to shut down) are disabled, so clicking does not take effect. I'm using Samsung RV509, 64 bit. | 2014/05/06 | [
"https://askubuntu.com/questions/461872",
"https://askubuntu.com",
"https://askubuntu.com/users/278680/"
] | The OP provided the solution in a comment:
>
> I've found the solution. I shouldn't have used the open source Xorg
> driver instead of the proprietary Nvidia driver that seems to work
> correctly.
>
>
>
– [user278680](https://askubuntu.com/users/278680/user278680) [May 11 at 16:42](https://askubuntu.com/questio... | I'm running Ubuntu 14.10 on GA-H81M-D3H motherboard without any separate GPU, and it's frozen after suspending randomly. All that remains is the log-in screen that you can neither move your mouse nor enter the tty mode. I figured out that the problem happened every time I triggered the audio on the system. ~~Then I wen... |
461,872 | After wake up the login screen appears, but I cannot type the password to log in. Furthermore, the buttons on the system panel (e. g. to shut down) are disabled, so clicking does not take effect. I'm using Samsung RV509, 64 bit. | 2014/05/06 | [
"https://askubuntu.com/questions/461872",
"https://askubuntu.com",
"https://askubuntu.com/users/278680/"
] | The OP provided the solution in a comment:
>
> I've found the solution. I shouldn't have used the open source Xorg
> driver instead of the proprietary Nvidia driver that seems to work
> correctly.
>
>
>
– [user278680](https://askubuntu.com/users/278680/user278680) [May 11 at 16:42](https://askubuntu.com/questio... | I've had a similar problem, after wake up sometime i could move the mouse but the GUI was freezed and only when i pressed CTRL+ALT+F1 i could use the terminal. Other times instead it freezed totally.
After long research ( changing bios settings, grub settings, graphic drivers , DMs etc) i tried both lxde and gnome wit... |
461,872 | After wake up the login screen appears, but I cannot type the password to log in. Furthermore, the buttons on the system panel (e. g. to shut down) are disabled, so clicking does not take effect. I'm using Samsung RV509, 64 bit. | 2014/05/06 | [
"https://askubuntu.com/questions/461872",
"https://askubuntu.com",
"https://askubuntu.com/users/278680/"
] | I'm running Ubuntu 14.10 on GA-H81M-D3H motherboard without any separate GPU, and it's frozen after suspending randomly. All that remains is the log-in screen that you can neither move your mouse nor enter the tty mode. I figured out that the problem happened every time I triggered the audio on the system. ~~Then I wen... | found another thread where a workaround is "sudo pm-suspend". Seems to work well for me. I'm using Intel Ivy Bridge graphics. |
461,872 | After wake up the login screen appears, but I cannot type the password to log in. Furthermore, the buttons on the system panel (e. g. to shut down) are disabled, so clicking does not take effect. I'm using Samsung RV509, 64 bit. | 2014/05/06 | [
"https://askubuntu.com/questions/461872",
"https://askubuntu.com",
"https://askubuntu.com/users/278680/"
] | I also had the same problem. Using HUD-->additional drivers, I was able to switch from the Xorg driver to the NVIDIA driver. (The number was different for mine than the 331.38 but this makes sense, I guess). Solved my problem of the login screen being frozen after waking from suspend. | I had a similar problem on Ubuntu Gnome 15.10. This is what worked for me:
```
sudo gedit /etc/default/grub
```
Edit the line: GRUB\_CMDLINE\_LINUX\_DEFAULT="quiet splash'"
Replace it with: GRUB\_CMDLINE\_LINUX\_DEFAULT="quiet splash acpi\_backlight=vendor acpi\_osi='!Windows 2013' acpi\_osi='!Windows 2012'"
```
s... |
461,872 | After wake up the login screen appears, but I cannot type the password to log in. Furthermore, the buttons on the system panel (e. g. to shut down) are disabled, so clicking does not take effect. I'm using Samsung RV509, 64 bit. | 2014/05/06 | [
"https://askubuntu.com/questions/461872",
"https://askubuntu.com",
"https://askubuntu.com/users/278680/"
] | I'm running Ubuntu 14.10 on GA-H81M-D3H motherboard without any separate GPU, and it's frozen after suspending randomly. All that remains is the log-in screen that you can neither move your mouse nor enter the tty mode. I figured out that the problem happened every time I triggered the audio on the system. ~~Then I wen... | I had a similar problem on Ubuntu Gnome 15.10. This is what worked for me:
```
sudo gedit /etc/default/grub
```
Edit the line: GRUB\_CMDLINE\_LINUX\_DEFAULT="quiet splash'"
Replace it with: GRUB\_CMDLINE\_LINUX\_DEFAULT="quiet splash acpi\_backlight=vendor acpi\_osi='!Windows 2013' acpi\_osi='!Windows 2012'"
```
s... |
104,074 | I need lightest simplest windows tool like combination of notepad and calender in a fashion of sticky notes , and want to keep always open but should have minimize button. | 2010/02/03 | [
"https://superuser.com/questions/104074",
"https://superuser.com",
"https://superuser.com/users/15114/"
] | Figuring out which packages to install to satisfy dependencies is not an exact science. But there are some tips that might help you:
* When you're working with satisfying dependencies to compile something, you nearly always want the package that ends in `-dev`. This is short for development. For example, the `openssl`... | Nobody mentioned
```
aptitude build-dep
```
The man-page entry is pretty comprehensive. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.