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 |
|---|---|---|---|---|---|
53,297,450 | VBA implicitly converts values to `Variant` as needed, so what would be a use case of the [`CVar` function](https://learn.microsoft.com/en-us/office/vba/language/concepts/getting-started/type-conversion-functions)? In the [example given in the documentation](https://learn.microsoft.com/en-us/office/vba/language/concept... | 2018/11/14 | [
"https://Stackoverflow.com/questions/53297450",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/87698/"
] | `onresize` is to be used as an attribute in your html. e.g. `<body onresize="resizePage()"></body>`
The correct event is `resize`. Try following
```
if (window.attachEvent) {
window.attachEvent('resize', function() {
if (window.innerWidth < 890) {
console.log('Less than 890px');
} else {
console.l... | Just use:
```
window.onresize = function(event) {
//your code here
};
``` |
53,297,450 | VBA implicitly converts values to `Variant` as needed, so what would be a use case of the [`CVar` function](https://learn.microsoft.com/en-us/office/vba/language/concepts/getting-started/type-conversion-functions)? In the [example given in the documentation](https://learn.microsoft.com/en-us/office/vba/language/concept... | 2018/11/14 | [
"https://Stackoverflow.com/questions/53297450",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/87698/"
] | Just try the following code
```
window.onresize = resize;
function resize()
{
if(document.body.clientWidth < 890)
{
alert("resize event detected!");
}
}
``` | Just use:
```
window.onresize = function(event) {
//your code here
};
``` |
53,297,450 | VBA implicitly converts values to `Variant` as needed, so what would be a use case of the [`CVar` function](https://learn.microsoft.com/en-us/office/vba/language/concepts/getting-started/type-conversion-functions)? In the [example given in the documentation](https://learn.microsoft.com/en-us/office/vba/language/concept... | 2018/11/14 | [
"https://Stackoverflow.com/questions/53297450",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/87698/"
] | ```
const on = (e, i, t = window) => typeof t.addEventListener === 'function'
? t.addEventListener (e, i)
: t.attachEvent ('on' + e, i)
const test = () => console.log (window.innerWidth < 890 ? '< 890' : '>= 890')
on ('resize', test)
``` | Just use:
```
window.onresize = function(event) {
//your code here
};
``` |
53,297,450 | VBA implicitly converts values to `Variant` as needed, so what would be a use case of the [`CVar` function](https://learn.microsoft.com/en-us/office/vba/language/concepts/getting-started/type-conversion-functions)? In the [example given in the documentation](https://learn.microsoft.com/en-us/office/vba/language/concept... | 2018/11/14 | [
"https://Stackoverflow.com/questions/53297450",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/87698/"
] | ```
window.addEventListener('resize', () => {
if (window.innerWidth < 890) {
console.log('Less than 890px');
} else {
console.log('890px or more');
}
});
``` | `onresize` is to be used as an attribute in your html. e.g. `<body onresize="resizePage()"></body>`
The correct event is `resize`. Try following
```
if (window.attachEvent) {
window.attachEvent('resize', function() {
if (window.innerWidth < 890) {
console.log('Less than 890px');
} else {
console.l... |
53,297,450 | VBA implicitly converts values to `Variant` as needed, so what would be a use case of the [`CVar` function](https://learn.microsoft.com/en-us/office/vba/language/concepts/getting-started/type-conversion-functions)? In the [example given in the documentation](https://learn.microsoft.com/en-us/office/vba/language/concept... | 2018/11/14 | [
"https://Stackoverflow.com/questions/53297450",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/87698/"
] | try this
```js
if(window.attachEvent) {
window.attachEvent('onresize', function() {
if (window.innerWidth < 890) {
console.log('Less than 890px');
} else {
console.log('890px or more');
}
});
}
else if(window.addEventListener) {
window.addEventListener('r... | Just try the following code
```
window.onresize = resize;
function resize()
{
if(document.body.clientWidth < 890)
{
alert("resize event detected!");
}
}
``` |
15,360,108 | I've got a contact form on my website, however whenever I click submit I do not receive anything to my e-mail address although it does say it has been submitted.
The HTML is as follows
```
<div id="contactform">
<form name="contact" method="post" action="PHP/send_form_email.php">
<ol>
<li><label>To </... | 2013/03/12 | [
"https://Stackoverflow.com/questions/15360108",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2148708/"
] | It's nice to see the [question](https://stackoverflow.com/q/15376558/2129835) in it's entirety :)
Demo: [JSFiddle](http://jsfiddle.net/G9cSZ/8/)
When you have dynamic content and you don't know how tall your page is going to be, you should not set the `height` property since the height will set it relative to either ... | When you set something to 100%, it's 100% of the parent element. So what is the height of the parent element? If that's not set to some value, then you may not get what you are expecting. If the parent is set to 100%, ask yourself, "100% of what? What is the parent set to?" Percent won't give you a size until you get t... |
15,360,108 | I've got a contact form on my website, however whenever I click submit I do not receive anything to my e-mail address although it does say it has been submitted.
The HTML is as follows
```
<div id="contactform">
<form name="contact" method="post" action="PHP/send_form_email.php">
<ol>
<li><label>To </... | 2013/03/12 | [
"https://Stackoverflow.com/questions/15360108",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2148708/"
] | It's nice to see the [question](https://stackoverflow.com/q/15376558/2129835) in it's entirety :)
Demo: [JSFiddle](http://jsfiddle.net/G9cSZ/8/)
When you have dynamic content and you don't know how tall your page is going to be, you should not set the `height` property since the height will set it relative to either ... | I have solved my problem this way.....
```
#left-nav{position: absolute; width: 329px; height: 100%;}
#someid{height: 70%; bottom: 0;}
```
But still proper solution is recommended. |
15,360,108 | I've got a contact form on my website, however whenever I click submit I do not receive anything to my e-mail address although it does say it has been submitted.
The HTML is as follows
```
<div id="contactform">
<form name="contact" method="post" action="PHP/send_form_email.php">
<ol>
<li><label>To </... | 2013/03/12 | [
"https://Stackoverflow.com/questions/15360108",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2148708/"
] | It's nice to see the [question](https://stackoverflow.com/q/15376558/2129835) in it's entirety :)
Demo: [JSFiddle](http://jsfiddle.net/G9cSZ/8/)
When you have dynamic content and you don't know how tall your page is going to be, you should not set the `height` property since the height will set it relative to either ... | You need to either use equalizeCols (a jQuery plugin) to make both columns the same height
-or-
Simulate the look of the left bar by wrapping 3 and 4 in a container div and giving a background image with a different color/pattern on the left side that can repeat-y for the entire height of the content. Make sense? |
36,374,281 | ```
x = document.getElementById("numb").value;
```
i don't understand what "***.value***" means?
i have already tried to find solution from google and past questions of javascript.
so please tell explanation for better understanding. | 2016/04/02 | [
"https://Stackoverflow.com/questions/36374281",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6120257/"
] | `value` here is a [property](https://en.wikipedia.org/wiki/Property_(programming)) of the [Element Object](http://www.w3schools.com/jsref/dom_obj_all.asp) returned by [getElementById](http://www.w3schools.com/jsref/met_doc_getelementbyid.asp).
As [you can see at this link](http://www.w3schools.com/jsref/prop_text_valu... | `.value` means that you get the value assigned to a HTML element. For example:
```
<html>
<head>
<script>
function getName()
{
var x = document.getElementById("numb").value;
msgbox(x);
}
</script>
</head>
<b... |
48,268,563 | I'm trying to load a model trained with keras by running:
```
model = load_model('model.h5')
```
but I get the following:
```
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.5/dist-packages/keras/models.py", line 258, in load_model
custom_objects=custom_objects)
File "/usr/local/lib/python3.5/dist-... | 2018/01/15 | [
"https://Stackoverflow.com/questions/48268563",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4907108/"
] | AMSgrad has been added on 11.12.2017 to Keras <https://github.com/keras-team/keras/pull/8693> whereas Keras 2.1.2 has been built on 01.12.2017 <https://github.com/keras-team/keras/releases/tag/2.1.2>
So either you need to wait on the next release or install Keras from scratch if the model uses it. | Keras version 2.1.3 is required so you could just go with
```
pip install keras==2.1.3
``` |
31,701,130 | I am a git newbie, I am trying to understand to undo changes in git. Say I have two branches
1: master
2: work
I am working in work branch and I want to pull the latest changes from my teammates in work branch, so I am supposed to give the command
```
git pull origin work
```
But instead, I gave the command
... | 2015/07/29 | [
"https://Stackoverflow.com/questions/31701130",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1529267/"
] | First of all, `git reset` does not take `--head` option, I think you mean `--hard`. Second, no, it's not enough as `git reset --head HEAD~1` will take your repository to the state of the previous commit. If `git pull` resulted in many new commits, it would not be enough. You need to do:
```
$ git reset --hard ORIG_HEA... | I would recommend you to use `git gui` and `gitk` to see the history and do the resets.
But if you want to use the terminal:
To see where the HEAD was before the pull
```
git reflog
```
You should see the SHA1 of the previous position of the HEAD.
Then ( As suggested by Kenney ):
```
git reset --hard <previousSH... |
18,330,796 | i try to capture the the click event occur on save button of CKEditor this way
```
var element = CKEDITOR.document.getById('CKEditor1');
element.on('click', function (ev) {
//ev.removeListener();
alert('hello');
return false;
});
```
but it is not working.when i click on save button of CKEdit... | 2013/08/20 | [
"https://Stackoverflow.com/questions/18330796",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/508127/"
] | Here's a (in my opinion) better/cleaner way to accomplish what you already figured out. This does nothing but replace the javascript that the save button runs, meaning it will not move the save button out of its original toolbar group:
html:
```
<textarea id="CKEditor1"></textarea>
```
javascript:
```
<script>
... | with `preventDefault()` If this method is called, the default action of the event will not be triggered.
Try this code please:
```
$(document).on('click', '#CKEditor1', function(ev){
ev.preventDefault();
alert('hello');
return false;
});
```
[This](http://alfonsoml.blogspot.com.au/2011/03/onchange-event-... |
18,330,796 | i try to capture the the click event occur on save button of CKEditor this way
```
var element = CKEDITOR.document.getById('CKEditor1');
element.on('click', function (ev) {
//ev.removeListener();
alert('hello');
return false;
});
```
but it is not working.when i click on save button of CKEdit... | 2013/08/20 | [
"https://Stackoverflow.com/questions/18330796",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/508127/"
] | Here's a (in my opinion) better/cleaner way to accomplish what you already figured out. This does nothing but replace the javascript that the save button runs, meaning it will not move the save button out of its original toolbar group:
html:
```
<textarea id="CKEditor1"></textarea>
```
javascript:
```
<script>
... | [event.preventDefault()](http://api.jquery.com/event.preventDefault/) documentation
```
Description: If this method is called, the default action of the event will not be triggered.
```
add this ...
```
ev.preventDefault();
```
in you code
```
$('#CKEditor1').on('click', function (ev) {
ev.preventDefa... |
18,330,796 | i try to capture the the click event occur on save button of CKEditor this way
```
var element = CKEDITOR.document.getById('CKEditor1');
element.on('click', function (ev) {
//ev.removeListener();
alert('hello');
return false;
});
```
but it is not working.when i click on save button of CKEdit... | 2013/08/20 | [
"https://Stackoverflow.com/questions/18330796",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/508127/"
] | Here's a (in my opinion) better/cleaner way to accomplish what you already figured out. This does nothing but replace the javascript that the save button runs, meaning it will not move the save button out of its original toolbar group:
html:
```
<textarea id="CKEditor1"></textarea>
```
javascript:
```
<script>
... | Use `mousedown` rather than `click` on submit button, and add `ev.preventDefault` to stop submit.
```
var element = CKEDITOR.document.getById('CKEditor1');
element.on('mousedown', function (ev) {
ev.preventDefault();
alert('hello');
return false;
});
``` |
18,330,796 | i try to capture the the click event occur on save button of CKEditor this way
```
var element = CKEDITOR.document.getById('CKEditor1');
element.on('click', function (ev) {
//ev.removeListener();
alert('hello');
return false;
});
```
but it is not working.when i click on save button of CKEdit... | 2013/08/20 | [
"https://Stackoverflow.com/questions/18330796",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/508127/"
] | Here's a (in my opinion) better/cleaner way to accomplish what you already figured out. This does nothing but replace the javascript that the save button runs, meaning it will not move the save button out of its original toolbar group:
html:
```
<textarea id="CKEditor1"></textarea>
```
javascript:
```
<script>
... | Go to the ckeditorcontrol properties and find the prerender event so you can save your text in database with prerender event.
```
protected void CKEditorControl2_PreRender(object sender, EventArgs e)
{
if (!string.IsNullOrWhiteSpace(CKEditorControl2.Text))
{
// write here what you want to save in your database... |
694,731 | Suppose I have an interface with methods 'storeData(key, data)' and 'getData(key)'. How should I test a concrete implementation? Should I check if the data was correctly set in the storage medium (eg an sql database) or should I just check whether or not it gives the correct data back by using getData?
If I look up th... | 2009/03/29 | [
"https://Stackoverflow.com/questions/694731",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | In cases like this I will usually create SetUp and TearDown methods that fire before/after my unit tests. These methods will set up any test data I need in the db and delete any test data when I'm done. Pseudo code example:
```
Const KEY1 = "somekey"
Const VALUE1= "somevalue"
Const KEY2 = "somekey2"
Const VALUE2= "so... | I think it depends on what happens to the data later - if you're only ever going to access the data using `storeData` and `getData`, why not test the methods in concert? I suppose there's a chance that a bug will arise and it'll be slightly harder to figure out whether it's in `storeData` or `getData`, but I'd consider... |
694,731 | Suppose I have an interface with methods 'storeData(key, data)' and 'getData(key)'. How should I test a concrete implementation? Should I check if the data was correctly set in the storage medium (eg an sql database) or should I just check whether or not it gives the correct data back by using getData?
If I look up th... | 2009/03/29 | [
"https://Stackoverflow.com/questions/694731",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | You seem to be caught up in the hype of unit testing, what you will be doing is actually an integration test. Setting and getting back the same value from the same key is a unit test you'd do with a mock implementation of the storage engine, but actually testing the real storage, say your database, as you should, that ... | I think it depends on what happens to the data later - if you're only ever going to access the data using `storeData` and `getData`, why not test the methods in concert? I suppose there's a chance that a bug will arise and it'll be slightly harder to figure out whether it's in `storeData` or `getData`, but I'd consider... |
694,731 | Suppose I have an interface with methods 'storeData(key, data)' and 'getData(key)'. How should I test a concrete implementation? Should I check if the data was correctly set in the storage medium (eg an sql database) or should I just check whether or not it gives the correct data back by using getData?
If I look up th... | 2009/03/29 | [
"https://Stackoverflow.com/questions/694731",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | What you want to do in a unit test is make sure that the method does the job that it is supposed to do. If the method uses dependencies to accomplish it's work, you would mock those dependencies out and make sure that your method calls the methods on the objects it depends on with the appropriate arguments. This way yo... | I think it depends on what happens to the data later - if you're only ever going to access the data using `storeData` and `getData`, why not test the methods in concert? I suppose there's a chance that a bug will arise and it'll be slightly harder to figure out whether it's in `storeData` or `getData`, but I'd consider... |
694,731 | Suppose I have an interface with methods 'storeData(key, data)' and 'getData(key)'. How should I test a concrete implementation? Should I check if the data was correctly set in the storage medium (eg an sql database) or should I just check whether or not it gives the correct data back by using getData?
If I look up th... | 2009/03/29 | [
"https://Stackoverflow.com/questions/694731",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | You seem to be caught up in the hype of unit testing, what you will be doing is actually an integration test. Setting and getting back the same value from the same key is a unit test you'd do with a mock implementation of the storage engine, but actually testing the real storage, say your database, as you should, that ... | In cases like this I will usually create SetUp and TearDown methods that fire before/after my unit tests. These methods will set up any test data I need in the db and delete any test data when I'm done. Pseudo code example:
```
Const KEY1 = "somekey"
Const VALUE1= "somevalue"
Const KEY2 = "somekey2"
Const VALUE2= "so... |
694,731 | Suppose I have an interface with methods 'storeData(key, data)' and 'getData(key)'. How should I test a concrete implementation? Should I check if the data was correctly set in the storage medium (eg an sql database) or should I just check whether or not it gives the correct data back by using getData?
If I look up th... | 2009/03/29 | [
"https://Stackoverflow.com/questions/694731",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | In cases like this I will usually create SetUp and TearDown methods that fire before/after my unit tests. These methods will set up any test data I need in the db and delete any test data when I'm done. Pseudo code example:
```
Const KEY1 = "somekey"
Const VALUE1= "somevalue"
Const KEY2 = "somekey2"
Const VALUE2= "so... | Testing both in concert is a common technique (at least, in my experience), and I wouldn't shy away from it. I've used this same pattern for serializing/deserializing and parsing and printing.
If you don't want to hit the database, you could use a database mock. Some people have the same feelings as you when using moc... |
694,731 | Suppose I have an interface with methods 'storeData(key, data)' and 'getData(key)'. How should I test a concrete implementation? Should I check if the data was correctly set in the storage medium (eg an sql database) or should I just check whether or not it gives the correct data back by using getData?
If I look up th... | 2009/03/29 | [
"https://Stackoverflow.com/questions/694731",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | What you want to do in a unit test is make sure that the method does the job that it is supposed to do. If the method uses dependencies to accomplish it's work, you would mock those dependencies out and make sure that your method calls the methods on the objects it depends on with the appropriate arguments. This way yo... | In cases like this I will usually create SetUp and TearDown methods that fire before/after my unit tests. These methods will set up any test data I need in the db and delete any test data when I'm done. Pseudo code example:
```
Const KEY1 = "somekey"
Const VALUE1= "somevalue"
Const KEY2 = "somekey2"
Const VALUE2= "so... |
694,731 | Suppose I have an interface with methods 'storeData(key, data)' and 'getData(key)'. How should I test a concrete implementation? Should I check if the data was correctly set in the storage medium (eg an sql database) or should I just check whether or not it gives the correct data back by using getData?
If I look up th... | 2009/03/29 | [
"https://Stackoverflow.com/questions/694731",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | You seem to be caught up in the hype of unit testing, what you will be doing is actually an integration test. Setting and getting back the same value from the same key is a unit test you'd do with a mock implementation of the storage engine, but actually testing the real storage, say your database, as you should, that ... | Testing both in concert is a common technique (at least, in my experience), and I wouldn't shy away from it. I've used this same pattern for serializing/deserializing and parsing and printing.
If you don't want to hit the database, you could use a database mock. Some people have the same feelings as you when using moc... |
694,731 | Suppose I have an interface with methods 'storeData(key, data)' and 'getData(key)'. How should I test a concrete implementation? Should I check if the data was correctly set in the storage medium (eg an sql database) or should I just check whether or not it gives the correct data back by using getData?
If I look up th... | 2009/03/29 | [
"https://Stackoverflow.com/questions/694731",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | What you want to do in a unit test is make sure that the method does the job that it is supposed to do. If the method uses dependencies to accomplish it's work, you would mock those dependencies out and make sure that your method calls the methods on the objects it depends on with the appropriate arguments. This way yo... | Testing both in concert is a common technique (at least, in my experience), and I wouldn't shy away from it. I've used this same pattern for serializing/deserializing and parsing and printing.
If you don't want to hit the database, you could use a database mock. Some people have the same feelings as you when using moc... |
38,387,478 | How to sum condition in array List with class ?
For example :
I have this class :
***productMerchant.cs***
```
using UnityEngine;
using System.Collections;
public class productMerchant {
public int productID;
public string productName;
public int qty;
public int price;
public int have;
pub... | 2016/07/15 | [
"https://Stackoverflow.com/questions/38387478",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6521156/"
] | I think the 'olden' ways to do something like this is to pass the first element instead of the whole array and the size of the array separately:
```
program dyn_array
implicit none
integer :: a(2, 3)
integer :: i
call set1d(a(1,1), size(a))
do i = 1, 3
write(*, '(2I4)') a(:,i)
end do
... | "Can you pass a 2D array into a subroutine that expects a 1D array and get the right size?"
You can use reshape, but if you code is relying on the compiler to help then a 2D into a 1D is dicey. You could use RESHAPE before and after... Or you can have 2 routines, which we can call set1d and set2d.
Then in the module y... |
39,734,344 | I have data in the following form :
```
set.seed(1234)
data <- data.frame(cbind(runif(40,0,10), rep(seq(1,20,1), each = 2)))
data <- data[sample(nrow(data)),]
colnames(data) <- c("obs","subject")
head(data)
obs subject
1.5904600 12
8.1059855 13
5.4497484 6
0.3999592 12
2.5880982 19
... | 2016/09/27 | [
"https://Stackoverflow.com/questions/39734344",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5861691/"
] | Convert to factor with levels then order:
```
data$group <- factor(data$subject, levels = unique(data$subject))
data[ order(data$group), ]
# obs subject group
# 1 1.59046003 12 12
# 4 0.39995918 12 12
# 2 8.10598552 13 13
# 30 2.18799541 13 13
# ...
``` | It is based on zx8754 but it does preserve the data type:
```
library(dplyr) #arrange function
group<-factor(data[,'subject'], levels=unique(data[,'subject']))
data<-cbind(data,group)
data<-arrange(as.data.frame(data),group)
data<-as.matrix(data[,-3])
``` |
39,734,344 | I have data in the following form :
```
set.seed(1234)
data <- data.frame(cbind(runif(40,0,10), rep(seq(1,20,1), each = 2)))
data <- data[sample(nrow(data)),]
colnames(data) <- c("obs","subject")
head(data)
obs subject
1.5904600 12
8.1059855 13
5.4497484 6
0.3999592 12
2.5880982 19
... | 2016/09/27 | [
"https://Stackoverflow.com/questions/39734344",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5861691/"
] | Convert to factor with levels then order:
```
data$group <- factor(data$subject, levels = unique(data$subject))
data[ order(data$group), ]
# obs subject group
# 1 1.59046003 12 12
# 4 0.39995918 12 12
# 2 8.10598552 13 13
# 30 2.18799541 13 13
# ...
``` | `dplyr` is a great package with various useful verbs, one of which is `arrange(variable)`, which does what you want here, and more elegantly (result is generally also a data.frame, so you don't need to `cbind`):
```
require(dplyr)
as.data.frame(data) %>% arrange(subject)
# or, if you want reverse order:
as.data.frame(... |
39,734,344 | I have data in the following form :
```
set.seed(1234)
data <- data.frame(cbind(runif(40,0,10), rep(seq(1,20,1), each = 2)))
data <- data[sample(nrow(data)),]
colnames(data) <- c("obs","subject")
head(data)
obs subject
1.5904600 12
8.1059855 13
5.4497484 6
0.3999592 12
2.5880982 19
... | 2016/09/27 | [
"https://Stackoverflow.com/questions/39734344",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5861691/"
] | Convert to factor with levels then order:
```
data$group <- factor(data$subject, levels = unique(data$subject))
data[ order(data$group), ]
# obs subject group
# 1 1.59046003 12 12
# 4 0.39995918 12 12
# 2 8.10598552 13 13
# 30 2.18799541 13 13
# ...
``` | Nest the data by `obs` and unnest again. The resulting tibble will have retained the original order but `subject` will be grouped.
```
library(tidyr)
data %>% nest(obs) %>% unnest()
# A tibble: 6 × 2
# subject obs
# <int> <dbl>
#1 12 1.5904600
#2 12 0.3999592
#3 13 8.1059855
#4 6 5.... |
39,734,344 | I have data in the following form :
```
set.seed(1234)
data <- data.frame(cbind(runif(40,0,10), rep(seq(1,20,1), each = 2)))
data <- data[sample(nrow(data)),]
colnames(data) <- c("obs","subject")
head(data)
obs subject
1.5904600 12
8.1059855 13
5.4497484 6
0.3999592 12
2.5880982 19
... | 2016/09/27 | [
"https://Stackoverflow.com/questions/39734344",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5861691/"
] | Nest the data by `obs` and unnest again. The resulting tibble will have retained the original order but `subject` will be grouped.
```
library(tidyr)
data %>% nest(obs) %>% unnest()
# A tibble: 6 × 2
# subject obs
# <int> <dbl>
#1 12 1.5904600
#2 12 0.3999592
#3 13 8.1059855
#4 6 5.... | It is based on zx8754 but it does preserve the data type:
```
library(dplyr) #arrange function
group<-factor(data[,'subject'], levels=unique(data[,'subject']))
data<-cbind(data,group)
data<-arrange(as.data.frame(data),group)
data<-as.matrix(data[,-3])
``` |
39,734,344 | I have data in the following form :
```
set.seed(1234)
data <- data.frame(cbind(runif(40,0,10), rep(seq(1,20,1), each = 2)))
data <- data[sample(nrow(data)),]
colnames(data) <- c("obs","subject")
head(data)
obs subject
1.5904600 12
8.1059855 13
5.4497484 6
0.3999592 12
2.5880982 19
... | 2016/09/27 | [
"https://Stackoverflow.com/questions/39734344",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5861691/"
] | Nest the data by `obs` and unnest again. The resulting tibble will have retained the original order but `subject` will be grouped.
```
library(tidyr)
data %>% nest(obs) %>% unnest()
# A tibble: 6 × 2
# subject obs
# <int> <dbl>
#1 12 1.5904600
#2 12 0.3999592
#3 13 8.1059855
#4 6 5.... | `dplyr` is a great package with various useful verbs, one of which is `arrange(variable)`, which does what you want here, and more elegantly (result is generally also a data.frame, so you don't need to `cbind`):
```
require(dplyr)
as.data.frame(data) %>% arrange(subject)
# or, if you want reverse order:
as.data.frame(... |
39,336,407 | I am reading *Mastering Algorithms with C* by Kyle Loudon, and currently I am struggling with Loudon's implementation of Singly-Linked List in Chapter 5.
Here are the links to the source code. I apologize for not posting them here as they are a bit long.
[list.h](https://github.com/kangnahua/matering-algirhtms-with-c... | 2016/09/05 | [
"https://Stackoverflow.com/questions/39336407",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6297414/"
] | It is a function pointer. When you create an instance of this list, you also have to hand the init\_list function a function which it will use to destroy the info.
The purpose of a linked list is to store information, and the linked list structure is there to give some structure to
this data. Hence, each element of th... | A linked list is a data structure made up of nodes, each of which contains or links to one piece of data.
The `destroy` function destroys just one node out of the list.
The `list_destroy` function destroys an entire list.
In the given implementation, the node actually contains a pointer to its `destroy` function, an... |
35,093,756 | 1> for a empty directory, linux command du will show 0 size, that means it does not use disk space. right?
but File.length() in java will not show zero, instead it show the empty directory used some bytes.
If it is true that everything in Unix is a file and should take up disk space, then Java is right here, why du ... | 2016/01/29 | [
"https://Stackoverflow.com/questions/35093756",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/913717/"
] | Because the `du` command has a different purpose, as its *man* page shows. It shows how much disk space is *used* by the file, including partially empty blocks. That's different from the size of of the file, which is how much data it contains. | [Directories are just special cases of files](https://unix.stackexchange.com/questions/18605/how-are-directories-implemented-in-unix-filesystems) and both are specializations of an [`inode`](https://en.wikipedia.org/wiki/Inode), they take up disk space even if they do not contain anything. There has to be something on ... |
35,093,756 | 1> for a empty directory, linux command du will show 0 size, that means it does not use disk space. right?
but File.length() in java will not show zero, instead it show the empty directory used some bytes.
If it is true that everything in Unix is a file and should take up disk space, then Java is right here, why du ... | 2016/01/29 | [
"https://Stackoverflow.com/questions/35093756",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/913717/"
] | Because the `du` command has a different purpose, as its *man* page shows. It shows how much disk space is *used* by the file, including partially empty blocks. That's different from the size of of the file, which is how much data it contains. | Block size is a feature common to both Linux and Windows. It is caused by the way file systems work and is not Java specific. Because of the way space is handled a block can be occupied by no more than one file.
Create a new text document.txt, write a single character in it and check the file size. It will show size ... |
35,093,756 | 1> for a empty directory, linux command du will show 0 size, that means it does not use disk space. right?
but File.length() in java will not show zero, instead it show the empty directory used some bytes.
If it is true that everything in Unix is a file and should take up disk space, then Java is right here, why du ... | 2016/01/29 | [
"https://Stackoverflow.com/questions/35093756",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/913717/"
] | On Linux / Unix systems, there is a concept of a "block size". This block size is the minimum amount of space the OS can hand a file. du reports the block size, rather than the exact file size. This is how much space the file is taking up on the OS, not the size of the file.
>
> The du utility displays the file syste... | [Directories are just special cases of files](https://unix.stackexchange.com/questions/18605/how-are-directories-implemented-in-unix-filesystems) and both are specializations of an [`inode`](https://en.wikipedia.org/wiki/Inode), they take up disk space even if they do not contain anything. There has to be something on ... |
35,093,756 | 1> for a empty directory, linux command du will show 0 size, that means it does not use disk space. right?
but File.length() in java will not show zero, instead it show the empty directory used some bytes.
If it is true that everything in Unix is a file and should take up disk space, then Java is right here, why du ... | 2016/01/29 | [
"https://Stackoverflow.com/questions/35093756",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/913717/"
] | On Linux / Unix systems, there is a concept of a "block size". This block size is the minimum amount of space the OS can hand a file. du reports the block size, rather than the exact file size. This is how much space the file is taking up on the OS, not the size of the file.
>
> The du utility displays the file syste... | Block size is a feature common to both Linux and Windows. It is caused by the way file systems work and is not Java specific. Because of the way space is handled a block can be occupied by no more than one file.
Create a new text document.txt, write a single character in it and check the file size. It will show size ... |
35,093,756 | 1> for a empty directory, linux command du will show 0 size, that means it does not use disk space. right?
but File.length() in java will not show zero, instead it show the empty directory used some bytes.
If it is true that everything in Unix is a file and should take up disk space, then Java is right here, why du ... | 2016/01/29 | [
"https://Stackoverflow.com/questions/35093756",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/913717/"
] | [Directories are just special cases of files](https://unix.stackexchange.com/questions/18605/how-are-directories-implemented-in-unix-filesystems) and both are specializations of an [`inode`](https://en.wikipedia.org/wiki/Inode), they take up disk space even if they do not contain anything. There has to be something on ... | Block size is a feature common to both Linux and Windows. It is caused by the way file systems work and is not Java specific. Because of the way space is handled a block can be occupied by no more than one file.
Create a new text document.txt, write a single character in it and check the file size. It will show size ... |
54,749,956 | I have a similar type of data inside a Google Sheet Column,
**0000 Place Court NE, Atlanta, GA 30000**
The Data in all the cells of this column is in the same format.
The only data I need is "Atlanta, GA"
Is can anyone provide a custom formula to split the value I need from the cells? | 2019/02/18 | [
"https://Stackoverflow.com/questions/54749956",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11079668/"
] | To change the color of an element using Jquery you can use the [css attribute](https://api.jquery.com/css/)
The code will be:
```
$jumbotron.css("color", "color-code");
// Where color-code you can set the color code like: #0fc0fc
``` | You can target the element like so
```
document.getElementById("p2").style.color = "blue";
```
this targets the element by its id. Or
```
document.getElementsByClassName("jumbotron h2").style.color = "blue";
``` |
5,374,432 | i want to place onItemClick listener on my listview...but when i click on listview nothing is happen..
here is my code...can anyone suggest me how can i do this..??
Here is my XML FILE (list.xml)
```
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
andro... | 2011/03/21 | [
"https://Stackoverflow.com/questions/5374432",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/640913/"
] | hi nirav to get a onItem click of list u have to write onclickListener that i not found in your code try with that. | Instead of setting the clikclistener `lv.setOnItemClickListener(new OnItemClickListener()`, can you use the override the method,
`protected void onListItemClick(ListView l, View v, int position, long id)` which is provided by the ListActivity |
5,374,432 | i want to place onItemClick listener on my listview...but when i click on listview nothing is happen..
here is my code...can anyone suggest me how can i do this..??
Here is my XML FILE (list.xml)
```
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
andro... | 2011/03/21 | [
"https://Stackoverflow.com/questions/5374432",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/640913/"
] | Instead of setting the clikclistener `lv.setOnItemClickListener(new OnItemClickListener()`, can you use the override the method,
`protected void onListItemClick(ListView l, View v, int position, long id)` which is provided by the ListActivity | ```java
SimpleAdapter adapter = new SimpleAdapter(this,
groupData,
R.layout.listitem,
new String[] {"name" , "id"},
new int[]{ R.id.txtItemName, R.id.txtid} );
lv.setAdapter(adapter);
lv.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> ar... |
5,374,432 | i want to place onItemClick listener on my listview...but when i click on listview nothing is happen..
here is my code...can anyone suggest me how can i do this..??
Here is my XML FILE (list.xml)
```
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
andro... | 2011/03/21 | [
"https://Stackoverflow.com/questions/5374432",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/640913/"
] | hi nirav to get a onItem click of list u have to write onclickListener that i not found in your code try with that. | try this, its working for me..
`public void onItemClick(AdapterView<?> parent,
View view1, int position, long id) {
// The action to be taken when item is clicked
}` |
5,374,432 | i want to place onItemClick listener on my listview...but when i click on listview nothing is happen..
here is my code...can anyone suggest me how can i do this..??
Here is my XML FILE (list.xml)
```
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
andro... | 2011/03/21 | [
"https://Stackoverflow.com/questions/5374432",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/640913/"
] | hi nirav to get a onItem click of list u have to write onclickListener that i not found in your code try with that. | ```java
SimpleAdapter adapter = new SimpleAdapter(this,
groupData,
R.layout.listitem,
new String[] {"name" , "id"},
new int[]{ R.id.txtItemName, R.id.txtid} );
lv.setAdapter(adapter);
lv.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> ar... |
5,374,432 | i want to place onItemClick listener on my listview...but when i click on listview nothing is happen..
here is my code...can anyone suggest me how can i do this..??
Here is my XML FILE (list.xml)
```
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
andro... | 2011/03/21 | [
"https://Stackoverflow.com/questions/5374432",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/640913/"
] | try this, its working for me..
`public void onItemClick(AdapterView<?> parent,
View view1, int position, long id) {
// The action to be taken when item is clicked
}` | ```java
SimpleAdapter adapter = new SimpleAdapter(this,
groupData,
R.layout.listitem,
new String[] {"name" , "id"},
new int[]{ R.id.txtItemName, R.id.txtid} );
lv.setAdapter(adapter);
lv.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> ar... |
38,071,102 | I'm creating a wallpaper app and I want to apply `getLightMutedColor()`of Palette class to the textbox below each wallpaper. But It's creating problems on restarting the app .
**So this is how it should be**

**On restarting the app the color changes... | 2016/06/28 | [
"https://Stackoverflow.com/questions/38071102",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6519942/"
] | Solution mimics SQL SERVER Row\_Number() function. Google mysql over order by points in the right direction.
```
/*create temporary table t(can_id int, status varchar(20));
insert into t values
(001 , 'section 1 question 1'),
(001 , 'section 1 question 2'),
(001 , 'section 1 question 3'), ... | As per your requirement you want the first 3 questions for every section but you are not considering the section in your query. The following query will do this job.
```
SELECT data_set.*
FROM
(
SELECT temp.can_id
, temp.Section
, temp.Question
, ROW_NUMBER() OVER (PARTITION... |
42,347,515 | I have the following validations...
```
<?php
protected function validator(array $data)
{
return Validator::make($data, [
'refrence_number' => 'integer',
'region' => 'integer',
'tregion' => 'integer',
'tdistrict' => 'integer',
'district' => 'integer',
'zone' => 'int... | 2017/02/20 | [
"https://Stackoverflow.com/questions/42347515",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5928946/"
] | Inheritance is a red herring here. It's not relevant.
`y` and `z` have *automatic storage duration* and are required, in this case, to stay in *scope* until the closing brace of the function.
And `z` will be destructed *before* `y`. (Automatic variables go out of scope in the reverse order in which they were created,... | This is unrelated to inheritance. Variables declared in block scope are destroyed when that block is left, i.e. a `return` statement is taken or the final `}` is reached or an exception is thrown. |
42,347,515 | I have the following validations...
```
<?php
protected function validator(array $data)
{
return Validator::make($data, [
'refrence_number' => 'integer',
'region' => 'integer',
'tregion' => 'integer',
'tdistrict' => 'integer',
'district' => 'integer',
'zone' => 'int... | 2017/02/20 | [
"https://Stackoverflow.com/questions/42347515",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5928946/"
] | This is unrelated to inheritance. Variables declared in block scope are destroyed when that block is left, i.e. a `return` statement is taken or the final `}` is reached or an exception is thrown. | The objects exist at the end of their scope, and the objects get destroyed in reverse order of their construction.
`y` is constructed first, then `z`. So, when their mutual scope's end is reached, `z` gets destroyed first, then `y`.
You were expecting the objects to be destroyed in the same order they were constructe... |
42,347,515 | I have the following validations...
```
<?php
protected function validator(array $data)
{
return Validator::make($data, [
'refrence_number' => 'integer',
'region' => 'integer',
'tregion' => 'integer',
'tdistrict' => 'integer',
'district' => 'integer',
'zone' => 'int... | 2017/02/20 | [
"https://Stackoverflow.com/questions/42347515",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5928946/"
] | Inheritance is a red herring here. It's not relevant.
`y` and `z` have *automatic storage duration* and are required, in this case, to stay in *scope* until the closing brace of the function.
And `z` will be destructed *before* `y`. (Automatic variables go out of scope in the reverse order in which they were created,... | The objects exist at the end of their scope, and the objects get destroyed in reverse order of their construction.
`y` is constructed first, then `z`. So, when their mutual scope's end is reached, `z` gets destroyed first, then `y`.
You were expecting the objects to be destroyed in the same order they were constructe... |
27,601,581 | I've an HTML table and i want to get a selected value in list in a td.
I proceed like this :
```
var table = document.getElementById('ZZ');
for (var r = 0, n = table.rows.length; r < n; r++) {
for (var c = 0, m = table.rows[r].cells.length; c < m; c++) {
var type =table.rows[r].cells[11].inne... | 2014/12/22 | [
"https://Stackoverflow.com/questions/27601581",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3583001/"
] | Since you say you get the result which you get, you could use [`Element.querySelector`](https://developer.mozilla.org/en-US/docs/Web/API/Element.querySelector) which uses css selectors to target the elements.
```
var type = table.rows[r].cells[11].querySelector("[selected]").innerHTML;
```
Note that I'm using innerH... | ```
html:
<SELECT id="orange" onchange=''... >
<OPTION value=1>A</OPTION>
<OPTION selected=2>B</OPTION>
</SELECT>
script:
var allDropdown = document.getElementsByTagName("select");
allDropdown[0].value;
allDropdown[1].value;
```
/\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\... |
27,601,581 | I've an HTML table and i want to get a selected value in list in a td.
I proceed like this :
```
var table = document.getElementById('ZZ');
for (var r = 0, n = table.rows.length; r < n; r++) {
for (var c = 0, m = table.rows[r].cells.length; c < m; c++) {
var type =table.rows[r].cells[11].inne... | 2014/12/22 | [
"https://Stackoverflow.com/questions/27601581",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3583001/"
] | Since you say you get the result which you get, you could use [`Element.querySelector`](https://developer.mozilla.org/en-US/docs/Web/API/Element.querySelector) which uses css selectors to target the elements.
```
var type = table.rows[r].cells[11].querySelector("[selected]").innerHTML;
```
Note that I'm using innerH... | ```js
As in your code you are able to get object of TD then you can use "Find" function to find select and take selected option out from the select.
.find("select") will give you select jquery object and then through sudo code used :selected" you can find selected option from list.It will return you "B".
var table =... |
27,601,581 | I've an HTML table and i want to get a selected value in list in a td.
I proceed like this :
```
var table = document.getElementById('ZZ');
for (var r = 0, n = table.rows.length; r < n; r++) {
for (var c = 0, m = table.rows[r].cells.length; c < m; c++) {
var type =table.rows[r].cells[11].inne... | 2014/12/22 | [
"https://Stackoverflow.com/questions/27601581",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3583001/"
] | Since you say you get the result which you get, you could use [`Element.querySelector`](https://developer.mozilla.org/en-US/docs/Web/API/Element.querySelector) which uses css selectors to target the elements.
```
var type = table.rows[r].cells[11].querySelector("[selected]").innerHTML;
```
Note that I'm using innerH... | \*\*
>
> If your select option exist in the inner child of the td of the table
> and you wanna get the value, this may help you out. It worked for me
>
>
>
\*\*
```
**HTML**
<table class="table table-borderless" id="all_table_hour">
<tbody class="table-hours-record">
<tr data-mytr_id=1 class="table-rowcla... |
27,601,581 | I've an HTML table and i want to get a selected value in list in a td.
I proceed like this :
```
var table = document.getElementById('ZZ');
for (var r = 0, n = table.rows.length; r < n; r++) {
for (var c = 0, m = table.rows[r].cells.length; c < m; c++) {
var type =table.rows[r].cells[11].inne... | 2014/12/22 | [
"https://Stackoverflow.com/questions/27601581",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3583001/"
] | ```
html:
<SELECT id="orange" onchange=''... >
<OPTION value=1>A</OPTION>
<OPTION selected=2>B</OPTION>
</SELECT>
script:
var allDropdown = document.getElementsByTagName("select");
allDropdown[0].value;
allDropdown[1].value;
```
/\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\... | ```js
As in your code you are able to get object of TD then you can use "Find" function to find select and take selected option out from the select.
.find("select") will give you select jquery object and then through sudo code used :selected" you can find selected option from list.It will return you "B".
var table =... |
27,601,581 | I've an HTML table and i want to get a selected value in list in a td.
I proceed like this :
```
var table = document.getElementById('ZZ');
for (var r = 0, n = table.rows.length; r < n; r++) {
for (var c = 0, m = table.rows[r].cells.length; c < m; c++) {
var type =table.rows[r].cells[11].inne... | 2014/12/22 | [
"https://Stackoverflow.com/questions/27601581",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3583001/"
] | \*\*
>
> If your select option exist in the inner child of the td of the table
> and you wanna get the value, this may help you out. It worked for me
>
>
>
\*\*
```
**HTML**
<table class="table table-borderless" id="all_table_hour">
<tbody class="table-hours-record">
<tr data-mytr_id=1 class="table-rowcla... | ```js
As in your code you are able to get object of TD then you can use "Find" function to find select and take selected option out from the select.
.find("select") will give you select jquery object and then through sudo code used :selected" you can find selected option from list.It will return you "B".
var table =... |
23,622 | **Background**
Many models including the famous very first models derived by [Sir Ronald Fisher](http://en.wikipedia.org/wiki/Ronald_Fisher) in his early career, assume infinite population size. In an infinite population, an allele can rise in frequency (if its fitness is greater than the fitness of its counterpart(s)... | 2014/10/31 | [
"https://biology.stackexchange.com/questions/23622",
"https://biology.stackexchange.com",
"https://biology.stackexchange.com/users/4108/"
] | **3.** is right thing to do. You can mention in the introduction that "*Campylobacter fetus*, which was previously known as *Vibrio fetus* [Ref] ........."
You should not use the old name anywhere again (also for the sake of consistency), once you have made it clear that the species was renamed, in the Introduction.
... | There actually is a rule, called the '[Principle of Priority](http://www.biocyclopedia.com/index/icbn.php)', which states that the nomenclature of a taxonomic group is based upon priority of publication hence option 2 in your question is the correct approach. In the principle III (Principle of Priority) section of the ... |
52,842,099 | I have Xdebug enabled and working together with OPcache. OPcache module is loaded first by phpfpm (important). If you try to debug the code below (from the browser) and put a breakpoing in the local variables you will see that they are not displayed. If I deactivate OPCache everything works as expected. I'm using PhpSt... | 2018/10/16 | [
"https://Stackoverflow.com/questions/52842099",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2875887/"
] | I answer myself, in case it serves to someone.
This is a feature of OPCache. It optimizes PHP code by sometimes removing variables if they are not needed.
Solution: disable OPCache when debugging.
```
sudo phpdismod opcache
```
And restart phpfpm or apache according to your environment
```
sudo service php7.2-fpm r... | It's a late answer, but the accepted one is not entirely correct. The problem is not that you cannot use OPCache with xdebug. You can, but you have to load the OPCache extension BEFORE xdebug. To quote the documentation:
>
> If you want to use Xdebug and OPCache together, you must have the
> zend\_extension line for ... |
27,709,238 | I make a shape.xml file under res -> drawable folder.
```
<?xml version="1.0" encoding="utf-8"?>
<selector
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="#ffffff" />
<stroke android:width="1dip" android:color="#ff9900" />
</selector>
... | 2014/12/30 | [
"https://Stackoverflow.com/questions/27709238",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Why using `selector` as the root tag? `selector` is used for applying multiple alternate drawables for different states of the view, so in this case, there is no need for `selector`.
Try the following code.
```
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
... | Use `root tag` as `shape` instead of `selector` in your `shape.xml` file, and it will resolve your problem! |
27,709,238 | I make a shape.xml file under res -> drawable folder.
```
<?xml version="1.0" encoding="utf-8"?>
<selector
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="#ffffff" />
<stroke android:width="1dip" android:color="#ff9900" />
</selector>
... | 2014/12/30 | [
"https://Stackoverflow.com/questions/27709238",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | ```
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
android:shape="rectangle">
<solid android:color="#ffffff" />
<stroke android:width="1dip" android:color="#ff9900" />
</selector>
```
You have to remove `>` this from `selector` root tag, li... | Use `root tag` as `shape` instead of `selector` in your `shape.xml` file, and it will resolve your problem! |
27,709,238 | I make a shape.xml file under res -> drawable folder.
```
<?xml version="1.0" encoding="utf-8"?>
<selector
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="#ffffff" />
<stroke android:width="1dip" android:color="#ff9900" />
</selector>
... | 2014/12/30 | [
"https://Stackoverflow.com/questions/27709238",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Step 1:Create a border.xml in Drawable folder
```
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners
android:radius="2dp"
/>
<solid android:color="#ffffff"
/>
<stroke
android:w... | ```
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
android:shape="rectangle">
<solid android:color="#ffffff" />
<stroke android:width="1dip" android:color="#ff9900" />
</selector>
```
You have to remove `>` this from `selector` root tag, li... |
27,709,238 | I make a shape.xml file under res -> drawable folder.
```
<?xml version="1.0" encoding="utf-8"?>
<selector
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="#ffffff" />
<stroke android:width="1dip" android:color="#ff9900" />
</selector>
... | 2014/12/30 | [
"https://Stackoverflow.com/questions/27709238",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Step 1:Create a border.xml in Drawable folder
```
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners
android:radius="2dp"
/>
<solid android:color="#ffffff"
/>
<stroke
android:w... | Use `root tag` as `shape` instead of `selector` in your `shape.xml` file, and it will resolve your problem! |
27,709,238 | I make a shape.xml file under res -> drawable folder.
```
<?xml version="1.0" encoding="utf-8"?>
<selector
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="#ffffff" />
<stroke android:width="1dip" android:color="#ff9900" />
</selector>
... | 2014/12/30 | [
"https://Stackoverflow.com/questions/27709238",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Why using `selector` as the root tag? `selector` is used for applying multiple alternate drawables for different states of the view, so in this case, there is no need for `selector`.
Try the following code.
```
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
... | i use as following for over come this matter
edittext\_style.xml
```
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:thickness="0dp"
android:shape="rectangle">
<stroke android:width="1dp"
android:color="#c8c8c8"/>
<corners android:radius="0dp" />
```
And applied as bellow
```
<Edi... |
27,709,238 | I make a shape.xml file under res -> drawable folder.
```
<?xml version="1.0" encoding="utf-8"?>
<selector
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="#ffffff" />
<stroke android:width="1dip" android:color="#ff9900" />
</selector>
... | 2014/12/30 | [
"https://Stackoverflow.com/questions/27709238",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Why using `selector` as the root tag? `selector` is used for applying multiple alternate drawables for different states of the view, so in this case, there is no need for `selector`.
Try the following code.
```
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
... | ```
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
android:shape="rectangle">
<solid android:color="#ffffff" />
<stroke android:width="1dip" android:color="#ff9900" />
</selector>
```
You have to remove `>` this from `selector` root tag, li... |
27,709,238 | I make a shape.xml file under res -> drawable folder.
```
<?xml version="1.0" encoding="utf-8"?>
<selector
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="#ffffff" />
<stroke android:width="1dip" android:color="#ff9900" />
</selector>
... | 2014/12/30 | [
"https://Stackoverflow.com/questions/27709238",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | selector is used for applying multiple alternate drawables for different status of the view, so in this case, there is no need for selector
instead use shape
```
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#ffffff" />
<str... | Use `root tag` as `shape` instead of `selector` in your `shape.xml` file, and it will resolve your problem! |
27,709,238 | I make a shape.xml file under res -> drawable folder.
```
<?xml version="1.0" encoding="utf-8"?>
<selector
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="#ffffff" />
<stroke android:width="1dip" android:color="#ff9900" />
</selector>
... | 2014/12/30 | [
"https://Stackoverflow.com/questions/27709238",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Why using `selector` as the root tag? `selector` is used for applying multiple alternate drawables for different states of the view, so in this case, there is no need for `selector`.
Try the following code.
```
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
... | Check below code may will help you,
Using stroke can make border in edit text and change it's color too as shown below...
```
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:padding="10dp"
android:shape="rectangle">
<stroke
android:width="2dp"
android:color="@color/secondary" />
<corn... |
27,709,238 | I make a shape.xml file under res -> drawable folder.
```
<?xml version="1.0" encoding="utf-8"?>
<selector
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="#ffffff" />
<stroke android:width="1dip" android:color="#ff9900" />
</selector>
... | 2014/12/30 | [
"https://Stackoverflow.com/questions/27709238",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Why using `selector` as the root tag? `selector` is used for applying multiple alternate drawables for different states of the view, so in this case, there is no need for `selector`.
Try the following code.
```
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
... | This is work for me:
Drwable->New->Drawable Resource File->create xml file
```
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:col... |
27,709,238 | I make a shape.xml file under res -> drawable folder.
```
<?xml version="1.0" encoding="utf-8"?>
<selector
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="#ffffff" />
<stroke android:width="1dip" android:color="#ff9900" />
</selector>
... | 2014/12/30 | [
"https://Stackoverflow.com/questions/27709238",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Step 1:Create a border.xml in Drawable folder
```
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners
android:radius="2dp"
/>
<solid android:color="#ffffff"
/>
<stroke
android:w... | selector is used for applying multiple alternate drawables for different status of the view, so in this case, there is no need for selector
instead use shape
```
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#ffffff" />
<str... |
61,587,239 | Input:
```
import pandas as pd
data = [['tom', 'Delhi', 'Jaipur'], ['nick', 'Delhi', 'Delhi'], ['juli', '', 'Noida'], ['rob', 'Gurugram', ''], ['dan', '', '']]
df = pd.DataFrame(data, columns = ['Name', 'City1', 'City2'])
Name City1 City2
0 tom Delhi Jaipur
1 nick Delhi Delhi
2 juli ... | 2020/05/04 | [
"https://Stackoverflow.com/questions/61587239",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1634263/"
] | Use if empty values are empty strings use [`numpy.where`](https://docs.scipy.org/doc/numpy/reference/generated/numpy.where.html) with [`DataFrame.pop`](http://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.pop.html) for extract columns:
```
df['City'] = np.where(df['City1'].eq(''), df.pop('City2')... | Try:
```
df['City'] = df['City1'].replace('',df['City2'])
df.drop(['City1', 'City2'], axis=1, inplace=True)
df
Name City
0 tom Delhi
1 nick Delhi
2 juli Noida
3 rob Gurugram
4 dan
``` |
31,142,736 | After googling this issue i managed to do this
```
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
NSString *cellIdentifier = @"InsertMarksCell";
SaveAllExamMarksForAllStudentsTableViewCell *myCell = [tableView dequeueReusableCellWithIdentifier:cellI... | 2015/06/30 | [
"https://Stackoverflow.com/questions/31142736",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4380614/"
] | Why don't you use
```
-(void) textFieldDidEndEditing: (UITextField * ) textField
{
NSString *text = [textField text];
NSLog(@"%@",text);
}
```
?
Your problem is that you are adding textfield into cell, but ask view for this tag.
EDIT:
to get your textfield from tableview
```
-(void) textFieldDidEndEdi... | @Doro thanks for the help.
since the problem is solved, this is the answer that worked well for me
to get the row number and data in the textfield by TAG
```
-(void) textFieldDidEndEditing: (UITextField * ) textField
{
// here get the tag number which is the row number
NSInteger *rowNumberWithout200 = (long... |
4,478 | Who knows one hundred forty-one?
--------------------------------
*Please cite/link your sources, if possible. At some point at least twenty-four hours from now, I will:*
* *Upvote all interesting answers.*
* *Accept the best answer.*
* *Go on to the next number.* | 2010/12/07 | [
"https://judaism.stackexchange.com/questions/4478",
"https://judaism.stackexchange.com",
"https://judaism.stackexchange.com/users/2/"
] | 141 is the [floor](http://en.wikipedia.org/wiki/Floor_and_ceiling_functions) of the greatest distance (141 and a third, in cubits) two cities can be to view them as one (**sort of**: see *mishnayos Eruvin* chapter 5). | 141 years ago (Nov. 9, 1869) the Austro-Hungarian emperor Franz Joseph visited Jerusalem. Among the benefits to the Jewish People from his visit: a donation towards the completion of one of the Old City's famous shuls, Tiferes Yisrael (now, unfortunately, destroyed). |
4,478 | Who knows one hundred forty-one?
--------------------------------
*Please cite/link your sources, if possible. At some point at least twenty-four hours from now, I will:*
* *Upvote all interesting answers.*
* *Accept the best answer.*
* *Go on to the next number.* | 2010/12/07 | [
"https://judaism.stackexchange.com/questions/4478",
"https://judaism.stackexchange.com",
"https://judaism.stackexchange.com/users/2/"
] | 141 years ago (Nov. 9, 1869) the Austro-Hungarian emperor Franz Joseph visited Jerusalem. Among the benefits to the Jewish People from his visit: a donation towards the completion of one of the Old City's famous shuls, Tiferes Yisrael (now, unfortunately, destroyed). | Mitzva = 141 |
4,478 | Who knows one hundred forty-one?
--------------------------------
*Please cite/link your sources, if possible. At some point at least twenty-four hours from now, I will:*
* *Upvote all interesting answers.*
* *Accept the best answer.*
* *Go on to the next number.* | 2010/12/07 | [
"https://judaism.stackexchange.com/questions/4478",
"https://judaism.stackexchange.com",
"https://judaism.stackexchange.com/users/2/"
] | 141 is the [floor](http://en.wikipedia.org/wiki/Floor_and_ceiling_functions) of the greatest distance (141 and a third, in cubits) two cities can be to view them as one (**sort of**: see *mishnayos Eruvin* chapter 5). | 141 is how many judges the great sanhedrin obviously doesn't need. (Source: *Bavli*, *Sanhedrin* 3b.) |
4,478 | Who knows one hundred forty-one?
--------------------------------
*Please cite/link your sources, if possible. At some point at least twenty-four hours from now, I will:*
* *Upvote all interesting answers.*
* *Accept the best answer.*
* *Go on to the next number.* | 2010/12/07 | [
"https://judaism.stackexchange.com/questions/4478",
"https://judaism.stackexchange.com",
"https://judaism.stackexchange.com/users/2/"
] | 141 is how many judges the great sanhedrin obviously doesn't need. (Source: *Bavli*, *Sanhedrin* 3b.) | Mitzva = 141 |
4,478 | Who knows one hundred forty-one?
--------------------------------
*Please cite/link your sources, if possible. At some point at least twenty-four hours from now, I will:*
* *Upvote all interesting answers.*
* *Accept the best answer.*
* *Go on to the next number.* | 2010/12/07 | [
"https://judaism.stackexchange.com/questions/4478",
"https://judaism.stackexchange.com",
"https://judaism.stackexchange.com/users/2/"
] | 141 is the [floor](http://en.wikipedia.org/wiki/Floor_and_ceiling_functions) of the greatest distance (141 and a third, in cubits) two cities can be to view them as one (**sort of**: see *mishnayos Eruvin* chapter 5). | Mitzva = 141 |
43,576,061 | In 2015 Uber was fingerprinting iPhones to reduce fraud in China.
What methods were they using to do this? Was it as simple as recording the serial number in a database? Were they using private methods?
From the [NYT article](https://www.nytimes.com/2017/04/23/technology/travis-kalanick-pushes-uber-and-himself-to-t... | 2017/04/23 | [
"https://Stackoverflow.com/questions/43576061",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1296746/"
] | Found more info and a potential method on [this article](http://daringfireball.net/2017/04/uber_identifying_and_tagging_iphones).
Will Strafach examined a 2014 build of the Uber iOS app and found them using private APIs to use IOKit to pull the device serial number from the device registry.
<https://twitter.com/chr... | Even I was too curious to know. I read a tweet, that basically hints that they exploited IOKits registries to do this.
Seems like they got some identifier from IOKits internals and saved it at their end to identify as device.
<https://twitter.com/chronic/status/856250223777206273> |
9,438 | I'm a public health epidemiologist, and this question has come up in a number of contexts. I've heard tell of people using Google or Yelp for limited uses, but we'd be building state-wide datasets of certain retailers for public health questions.
As a specific example, a tobacco policy nonprofit I work with has been ... | 2016/08/13 | [
"https://opendata.stackexchange.com/questions/9438",
"https://opendata.stackexchange.com",
"https://opendata.stackexchange.com/users/12954/"
] | TMC Location lists are not that open, but [some](http://www.liikennevirasto.fi/web/en/open-data/materials/tmc-location-data) [European countries](http://mhohmann.dev.openstreetmap.org/tmc/TMC.html) offer them up to the public.
OSM them into OSM data, you could use [OSM TMC](http://wiki.openstreetmap.org/wiki/TMC) or... | You need the Location Code List for the area you are interested in. However, there is a catch: there are free and commercial TMC services. The latter either keep their location tables secret or encrypt their data. In order to get the location tables or the decryption key, you would presumably have to sign a license agr... |
3,384,746 | im trying to send a email with action mailer and it gives me a `Timeout::Error (execution expired):` even though in the console it says that the e mail is sent:
it shows
```
Sent mail to aldeirm2@gmail.com
```
then displayes the e mail that was sent then it shows the following error:
```
Timeout::Error (exec... | 2010/08/02 | [
"https://Stackoverflow.com/questions/3384746",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/218183/"
] | I saw a typo there: you wrote
:domian => "gmail.com",
instead of
:domain => "gmail.com", | SMTP requests seem to time out occasionally, probably depending on how long you've set for timeouts. The other problem you'll get is a delay in the web-app while the user waits for your server to communicate with Gmail's SMTP server.
I know gmail is a popular option for new rails apps, but I don't think it's a long-te... |
3,384,746 | im trying to send a email with action mailer and it gives me a `Timeout::Error (execution expired):` even though in the console it says that the e mail is sent:
it shows
```
Sent mail to aldeirm2@gmail.com
```
then displayes the e mail that was sent then it shows the following error:
```
Timeout::Error (exec... | 2010/08/02 | [
"https://Stackoverflow.com/questions/3384746",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/218183/"
] | I saw a typo there: you wrote
:domian => "gmail.com",
instead of
:domain => "gmail.com", | In case anyone else has the same problem:
make sure that your firewall allows outgoing connections to port 587
For **iptables**, you can list all existing rules with:
```
sudo iptables -L
```
have a look [here](https://serverfault.com/questions/350071/iptables-allow-connections-on-a-port-to-only-safe-hosts) for th... |
19,484,337 | I want to add values from table to another , but in first table i have foreign keys
how to insert it's values ?
```
insert into student(first_name)
select * from `TABLE 13`
set school_id = 1
```
school\_id is the forign key how to set it's values to 1 | 2013/10/21 | [
"https://Stackoverflow.com/questions/19484337",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2884425/"
] | Depending on context, use an instance of `javax.swing.Timer` or `java.util.Timer` to pace the animation. You can *repaint* the icon, as shown [here](https://stackoverflow.com/a/3484251/230513), or *replace* the icon, as shown [here](https://stackoverflow.com/a/12228640/230513). | Maybe [Animated Icon](http://tips4java.wordpress.com/2009/06/21/animated-icon/) will give you some ideas. |
65,701,819 | Requirement:
In Android app code, in MainActivity, I want to call a REST POST API through Volley and then pass the JSON response as it is in next Activity. But the response which gets passed is blank. The code is:
Please note that
System.out.println(globalOutput); //THIS DOESN'T PRINT ANYTHING
```
public class MainA... | 2021/01/13 | [
"https://Stackoverflow.com/questions/65701819",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14052447/"
] | makePostCall() method is asynchronous function.
So you need to process in callback function.
```
public void login(View view) throws Exception {
EditText emailEditText = findViewById(R.id.editTextTextEmailAddress2);
EditText phoneEditText = findViewById(R.id.editTextPhone2);
EditText passwordEditText = fin... | Your `System.out.println` is executed before Volley returns the response. Volley's `enqueue` method is asynchronous, i.e. you can't tell exactly when it'll be executed.
Move
```
System.out.println(globalOutput); //THIS DOESN'T PRINT ANYTHING
Intent intent = new Intent(this, LoginNextActivity.class);
intent.putExtra(... |
27,307 | One thing that I really don't like about bounties, is the fact that I have to accept an answer at the end of it. This forces my question effectively 'closed' even though I might not have recieved a satisfactory answer. If I haven't had a satisfactory answer I would much rather leave it open, and just 'lose' the points.... | 2009/10/26 | [
"https://meta.stackexchange.com/questions/27307",
"https://meta.stackexchange.com",
"https://meta.stackexchange.com/users/135353/"
] | Joel has a great point in noting that the bounty should always be awarded, since it is a request for extra work by the contributors. But that could just be left separate from the accepting of an answer. If the person doesn't want to accept an answer, because their problem isn't yet solved, then award the bounty to the ... | I agree with the OP. If there is not a good answer after a time and that prompts a user to add a bounty there is still a high likelihood of no "right" or best answer. I think it is HUGE mistake to award an answer automatically and/or to force a user to pick one.
I've made bounty questions a number of times and in MOS... |
27,307 | One thing that I really don't like about bounties, is the fact that I have to accept an answer at the end of it. This forces my question effectively 'closed' even though I might not have recieved a satisfactory answer. If I haven't had a satisfactory answer I would much rather leave it open, and just 'lose' the points.... | 2009/10/26 | [
"https://meta.stackexchange.com/questions/27307",
"https://meta.stackexchange.com",
"https://meta.stackexchange.com/users/135353/"
] | Joel has a great point in noting that the bounty should always be awarded, since it is a request for extra work by the contributors. But that could just be left separate from the accepting of an answer. If the person doesn't want to accept an answer, because their problem isn't yet solved, then award the bounty to the ... | Probably because the bounty was meant as a "last resort" measure, and it is assumed that you have tweaked and tuned your question beforehand - making it as high quality as it can be *before* you applied the bounty.
Normally/Usually/Generally (hereafter abbreviated NUG) you don't get quality answers to a question becau... |
27,307 | One thing that I really don't like about bounties, is the fact that I have to accept an answer at the end of it. This forces my question effectively 'closed' even though I might not have recieved a satisfactory answer. If I haven't had a satisfactory answer I would much rather leave it open, and just 'lose' the points.... | 2009/10/26 | [
"https://meta.stackexchange.com/questions/27307",
"https://meta.stackexchange.com",
"https://meta.stackexchange.com/users/135353/"
] | Joel has a great point in noting that the bounty should always be awarded, since it is a request for extra work by the contributors. But that could just be left separate from the accepting of an answer. If the person doesn't want to accept an answer, because their problem isn't yet solved, then award the bounty to the ... | What about an option to extend the bounty period, by being able to trade in another amount of points for a new week of bounty period? |
27,307 | One thing that I really don't like about bounties, is the fact that I have to accept an answer at the end of it. This forces my question effectively 'closed' even though I might not have recieved a satisfactory answer. If I haven't had a satisfactory answer I would much rather leave it open, and just 'lose' the points.... | 2009/10/26 | [
"https://meta.stackexchange.com/questions/27307",
"https://meta.stackexchange.com",
"https://meta.stackexchange.com/users/135353/"
] | You can think of a bounty as contract between yourself and other StackOverflow users, with the following basic terms:
>
> You promise to give one lucky user some extra rep in exchange for more attention for your question from the community as a whole.
>
>
>
There are obligations on both sides here:
The communit... | What about an option to extend the bounty period, by being able to trade in another amount of points for a new week of bounty period? |
27,307 | One thing that I really don't like about bounties, is the fact that I have to accept an answer at the end of it. This forces my question effectively 'closed' even though I might not have recieved a satisfactory answer. If I haven't had a satisfactory answer I would much rather leave it open, and just 'lose' the points.... | 2009/10/26 | [
"https://meta.stackexchange.com/questions/27307",
"https://meta.stackexchange.com",
"https://meta.stackexchange.com/users/135353/"
] | Joel has a great point in noting that the bounty should always be awarded, since it is a request for extra work by the contributors. But that could just be left separate from the accepting of an answer. If the person doesn't want to accept an answer, because their problem isn't yet solved, then award the bounty to the ... | <https://blog.stackoverflow.com/2010/06/improvements-to-bounty-system/>
This is effectively completed, because
* bounty system is no longer tied to accepting an answer in any way
* you can issue multiple bounties on your question if necessary |
27,307 | One thing that I really don't like about bounties, is the fact that I have to accept an answer at the end of it. This forces my question effectively 'closed' even though I might not have recieved a satisfactory answer. If I haven't had a satisfactory answer I would much rather leave it open, and just 'lose' the points.... | 2009/10/26 | [
"https://meta.stackexchange.com/questions/27307",
"https://meta.stackexchange.com",
"https://meta.stackexchange.com/users/135353/"
] | I agree with the OP. If there is not a good answer after a time and that prompts a user to add a bounty there is still a high likelihood of no "right" or best answer. I think it is HUGE mistake to award an answer automatically and/or to force a user to pick one.
I've made bounty questions a number of times and in MOS... | Probably because the bounty was meant as a "last resort" measure, and it is assumed that you have tweaked and tuned your question beforehand - making it as high quality as it can be *before* you applied the bounty.
Normally/Usually/Generally (hereafter abbreviated NUG) you don't get quality answers to a question becau... |
27,307 | One thing that I really don't like about bounties, is the fact that I have to accept an answer at the end of it. This forces my question effectively 'closed' even though I might not have recieved a satisfactory answer. If I haven't had a satisfactory answer I would much rather leave it open, and just 'lose' the points.... | 2009/10/26 | [
"https://meta.stackexchange.com/questions/27307",
"https://meta.stackexchange.com",
"https://meta.stackexchange.com/users/135353/"
] | <https://blog.stackoverflow.com/2010/06/improvements-to-bounty-system/>
This is effectively completed, because
* bounty system is no longer tied to accepting an answer in any way
* you can issue multiple bounties on your question if necessary | What about an option to extend the bounty period, by being able to trade in another amount of points for a new week of bounty period? |
27,307 | One thing that I really don't like about bounties, is the fact that I have to accept an answer at the end of it. This forces my question effectively 'closed' even though I might not have recieved a satisfactory answer. If I haven't had a satisfactory answer I would much rather leave it open, and just 'lose' the points.... | 2009/10/26 | [
"https://meta.stackexchange.com/questions/27307",
"https://meta.stackexchange.com",
"https://meta.stackexchange.com/users/135353/"
] | Joel has a great point in noting that the bounty should always be awarded, since it is a request for extra work by the contributors. But that could just be left separate from the accepting of an answer. If the person doesn't want to accept an answer, because their problem isn't yet solved, then award the bounty to the ... | You can think of a bounty as contract between yourself and other StackOverflow users, with the following basic terms:
>
> You promise to give one lucky user some extra rep in exchange for more attention for your question from the community as a whole.
>
>
>
There are obligations on both sides here:
The communit... |
27,307 | One thing that I really don't like about bounties, is the fact that I have to accept an answer at the end of it. This forces my question effectively 'closed' even though I might not have recieved a satisfactory answer. If I haven't had a satisfactory answer I would much rather leave it open, and just 'lose' the points.... | 2009/10/26 | [
"https://meta.stackexchange.com/questions/27307",
"https://meta.stackexchange.com",
"https://meta.stackexchange.com/users/135353/"
] | You can think of a bounty as contract between yourself and other StackOverflow users, with the following basic terms:
>
> You promise to give one lucky user some extra rep in exchange for more attention for your question from the community as a whole.
>
>
>
There are obligations on both sides here:
The communit... | Probably because the bounty was meant as a "last resort" measure, and it is assumed that you have tweaked and tuned your question beforehand - making it as high quality as it can be *before* you applied the bounty.
Normally/Usually/Generally (hereafter abbreviated NUG) you don't get quality answers to a question becau... |
27,307 | One thing that I really don't like about bounties, is the fact that I have to accept an answer at the end of it. This forces my question effectively 'closed' even though I might not have recieved a satisfactory answer. If I haven't had a satisfactory answer I would much rather leave it open, and just 'lose' the points.... | 2009/10/26 | [
"https://meta.stackexchange.com/questions/27307",
"https://meta.stackexchange.com",
"https://meta.stackexchange.com/users/135353/"
] | <https://blog.stackoverflow.com/2010/06/improvements-to-bounty-system/>
This is effectively completed, because
* bounty system is no longer tied to accepting an answer in any way
* you can issue multiple bounties on your question if necessary | Probably because the bounty was meant as a "last resort" measure, and it is assumed that you have tweaked and tuned your question beforehand - making it as high quality as it can be *before* you applied the bounty.
Normally/Usually/Generally (hereafter abbreviated NUG) you don't get quality answers to a question becau... |
62,498,598 | I'm trying to add the user's text into an existing array. Currently, as you type each character they get added as a separate value in the array.
My question is how can you group these multiple values to form a single value. e.g. I type 'Hello World' into the input and the array should look like:
```
['red', 'green', ... | 2020/06/21 | [
"https://Stackoverflow.com/questions/62498598",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1321811/"
] | Mypy shouldn't flag anything if your logic contains:
```
if arg is None:
return None
```
If that is not possible you can also put an assertion before the warning:
```
assert x is not None
``` | There is no null-safety in python.
The best you can do is:
```
if arg is not None:
do_something(arg)
```
Or if you want to raise an exception:
```
if arg is None:
raise Exception("arg == none")
do_something(arg) # arg will not be None
```
Also, type hints mean nothing in normal python because this is on... |
62,498,598 | I'm trying to add the user's text into an existing array. Currently, as you type each character they get added as a separate value in the array.
My question is how can you group these multiple values to form a single value. e.g. I type 'Hello World' into the input and the array should look like:
```
['red', 'green', ... | 2020/06/21 | [
"https://Stackoverflow.com/questions/62498598",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1321811/"
] | There are a couple of fundamental differences between TypeScript and Python with mypy. It is closer to how ECMAScript with [Google Closure Compiler](https://developers.google.com/closure/compiler/) works than how TypeScript works. Or, how modern IDEs use type hints in documentation comments.
First off, TypeScript has ... | There is no null-safety in python.
The best you can do is:
```
if arg is not None:
do_something(arg)
```
Or if you want to raise an exception:
```
if arg is None:
raise Exception("arg == none")
do_something(arg) # arg will not be None
```
Also, type hints mean nothing in normal python because this is on... |
62,498,598 | I'm trying to add the user's text into an existing array. Currently, as you type each character they get added as a separate value in the array.
My question is how can you group these multiple values to form a single value. e.g. I type 'Hello World' into the input and the array should look like:
```
['red', 'green', ... | 2020/06/21 | [
"https://Stackoverflow.com/questions/62498598",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1321811/"
] | Mypy shouldn't flag anything if your logic contains:
```
if arg is None:
return None
```
If that is not possible you can also put an assertion before the warning:
```
assert x is not None
``` | There are a couple of fundamental differences between TypeScript and Python with mypy. It is closer to how ECMAScript with [Google Closure Compiler](https://developers.google.com/closure/compiler/) works than how TypeScript works. Or, how modern IDEs use type hints in documentation comments.
First off, TypeScript has ... |
9,660,254 | I'm trying to send a message through ICMP packets but I don't know how to do it.
This is the code I currently have, but obviously doesn't work:
```
s = socket(AF_INET, SOCK_RAW, IPPROTO_ICMP)
s.setsockopt(IPPROTO_IP, IP_HDRINCL, 1)
s.settimeout(3.0)
s.sendto("Hello!" + "\r\n", (server, 7))
msg = s.recvfrom(buff_size)... | 2012/03/12 | [
"https://Stackoverflow.com/questions/9660254",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/368299/"
] | In order to construct an ICMP packet, you have to create the whole packet yourself using a raw socket. The [`struct` module](http://docs.python.org/library/struct.html) is useful for this.
Secondly, in order to even use raw sockets in the first place, you need to have permission to do so—you should be running as root ... | I don't think that `SOCK_RAW` is going an ICMP datagram for you just because you set the protocol field to `IPPROTO_ICMP`! You have to construct the packet yourself.
Take a look at the source of ping.
There are (at least) two popular packages that provide `ping` in GNU/Linux operating systems. One is `netkit` and the... |
29,918,836 | What is the problem with my code?
```
protected void Button1_Click(object sender, EventArgs e)
{
string stream = FileUpload1.FileName;
string sub = stream.Substring(stream.LastIndexOf(".")+1);
if(FileUpload1.HasFile)
{
if (sub == "jpg" || sub == "jpeg" || sub == "png")
{
str... | 2015/04/28 | [
"https://Stackoverflow.com/questions/29918836",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4551839/"
] | Are you using `$scope.lblMsg={value:result['message']}` inside a callback fro ma 3rd party api, like salesforce instead of a normal $http call? If 'yes', then you should consider wrapping that in an $apply block or an $applyAsync one, otherwise Angular won't know about that update. | I think your label looks like
```
<label id="lblMsg"><label>
```
that's why you can get the label element using 'id' attribute like
```
document.getElementById('lblMsg');
```
If you want to achieve this result in angular style, your html code should be
```
<label>{{lblMsg}}<label>
```
and your controller ... |
63,256,961 | I have dataset which has forecast data which is updated ambiguously over a 42 hour period. Here is a sample:
```
df_old = pd.DataFrame({'IssueDatetime': ['2010-01-01 09:00:00', '2010-01-01 09:00:00', '2010-01-01 09:00:00','2010-01-01 09:00:00','2010-01-01 09:00:00'],
'endtime':['2010-01-03 03:00:00'... | 2020/08/05 | [
"https://Stackoverflow.com/questions/63256961",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13544678/"
] | IIUC, first you need to convert the `'forecastTime'` column to datetime, then you set `'forecastTime'` column as index to do the resample, after that group by `'Regions'`, do the `resample` by hours, and fill the NaN values with `ffill`:
```
df_old['forecastTime'] = pd.to_datetime(df_old['forecastTime'])
df_new = df_o... | I've partially answered my own question... I was still getting a multi-index error so I added a millisecond to each forecastTime per row to make them unique:
```
df_old['forecastTime'] = df_old['forecastTime'] + pd.to_timedelta(df_old.groupby('forecastTime').cumcount(), unit='ms')
df_old['forecastTime'] = pd.to_datet... |
9,866,923 | I'm trying to solve this newbie puzzle:
I've created this function:
```
def bucket_loop(htable, key):
bucket = hashtable_get_bucket(htable, key)
for entry in bucket:
if entry[0] == key:
return entry[1]
return None
```
And I have to call it in two ot... | 2012/03/26 | [
"https://Stackoverflow.com/questions/9866923",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/955883/"
] | In general, there are three things you can do:
1. Write “setter” functions (ex, `bucket_set`)
2. Return mutable values (ex, `bucket_get(table, key).append(42)` if the value is a `list`)
3. Use a class which overrides `__getitem__` and `__setitem__`
For example, you could have a class like like:
```
class Bucket(obje... | One option that would require few changes would be adding a third argument to `bucket_loop`, optional, to use for assignment:
```
empty = object() # An object that's guaranteed not to be in your htable
def bucket_loop(htable, key, value=empty):
bucket = hashtable_get_bucket(htable, key)
for entry in bucket:
... |
9,866,923 | I'm trying to solve this newbie puzzle:
I've created this function:
```
def bucket_loop(htable, key):
bucket = hashtable_get_bucket(htable, key)
for entry in bucket:
if entry[0] == key:
return entry[1]
return None
```
And I have to call it in two ot... | 2012/03/26 | [
"https://Stackoverflow.com/questions/9866923",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/955883/"
] | In general, there are three things you can do:
1. Write “setter” functions (ex, `bucket_set`)
2. Return mutable values (ex, `bucket_get(table, key).append(42)` if the value is a `list`)
3. Use a class which overrides `__getitem__` and `__setitem__`
For example, you could have a class like like:
```
class Bucket(obje... | So you're basically cheating at udacity, which is an online cs class / university? Funny part is you couldn't even declare the question properly. Next time cheat thoroughly and paste the two functions you're supposed to simplify and request someone simplify them by creating a third function with the overlapping code wi... |
9,866,923 | I'm trying to solve this newbie puzzle:
I've created this function:
```
def bucket_loop(htable, key):
bucket = hashtable_get_bucket(htable, key)
for entry in bucket:
if entry[0] == key:
return entry[1]
return None
```
And I have to call it in two ot... | 2012/03/26 | [
"https://Stackoverflow.com/questions/9866923",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/955883/"
] | One option that would require few changes would be adding a third argument to `bucket_loop`, optional, to use for assignment:
```
empty = object() # An object that's guaranteed not to be in your htable
def bucket_loop(htable, key, value=empty):
bucket = hashtable_get_bucket(htable, key)
for entry in bucket:
... | So you're basically cheating at udacity, which is an online cs class / university? Funny part is you couldn't even declare the question properly. Next time cheat thoroughly and paste the two functions you're supposed to simplify and request someone simplify them by creating a third function with the overlapping code wi... |
14,467,958 | Is it possible to write a function within mySQL that checks the value of a SELECT query, and if it != 0, continue running the function and add to the result array?
I have a few entries marked as `related_id` = `0` The rest have actual positive numbers attached.
I am trying to create a single query that will continual... | 2013/01/22 | [
"https://Stackoverflow.com/questions/14467958",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1238470/"
] | ```
$ git log -p <filename>
```
will show you the log message plus a diff for each commit that touched the named file.
To show only differences to the previous version, ask for just one step in log history:
```
$ git log -1 -p <filename>
``` | `git blame` should get you to your destination pretty fast. |
14,467,958 | Is it possible to write a function within mySQL that checks the value of a SELECT query, and if it != 0, continue running the function and add to the result array?
I have a few entries marked as `related_id` = `0` The rest have actual positive numbers attached.
I am trying to create a single query that will continual... | 2013/01/22 | [
"https://Stackoverflow.com/questions/14467958",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1238470/"
] | ```
$ git log -p <filename>
```
will show you the log message plus a diff for each commit that touched the named file.
To show only differences to the previous version, ask for just one step in log history:
```
$ git log -1 -p <filename>
``` | You can make use of `git log` formatting to get the hashes of previous commits to a file. For example,
```
git log --pretty=format:'%h' -1 --skip=1 <filename>
```
will get you the 2nd to last commit to touch a specific file. In fact, if you don't specify a filename, this will get you the 2nd to last commit on the en... |
14,467,958 | Is it possible to write a function within mySQL that checks the value of a SELECT query, and if it != 0, continue running the function and add to the result array?
I have a few entries marked as `related_id` = `0` The rest have actual positive numbers attached.
I am trying to create a single query that will continual... | 2013/01/22 | [
"https://Stackoverflow.com/questions/14467958",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1238470/"
] | You can make use of `git log` formatting to get the hashes of previous commits to a file. For example,
```
git log --pretty=format:'%h' -1 --skip=1 <filename>
```
will get you the 2nd to last commit to touch a specific file. In fact, if you don't specify a filename, this will get you the 2nd to last commit on the en... | `git blame` should get you to your destination pretty fast. |
23,542,041 | **HTML:**
```
<header>
Header text.
</header>
<main>
Your content here.
</main>
```
**CSS:**
```
header {
position: relative;
background: #5fa3c6;
padding: 8px 10px;
color: #ffffff;
font-size: 20px;
}
header:before {
z-index: -1;
position: absolute;
width: 14px;
height... | 2014/05/08 | [
"https://Stackoverflow.com/questions/23542041",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/548591/"
] | You'll need to create a new build system for Prolog. First, I assume that you already have `swipl` installed and it is on your `$PATH`. Open Terminal and run the command
```
which swipl
```
to find you where it is located, then copy the full path. For example, it may return `/usr/local/bin/swipl`. Then, in Sublime, ... | Installing prolog from brew will help
```
brew install swi-prolog
```
After installing, restart sublime text, and it should build. |
30,315 | Según una definición, en español "la onomatopeya es una imitación lingüística de una palabra que se asemeja con el sonido que representa", por eso el encomillado en el título.
Pero, hay otra definición que dice:
>
> Onomatopeya es una palabra que proviene del latín tardío onomatopoeia, aunque su origen se remonta a... | 2019/05/01 | [
"https://spanish.stackexchange.com/questions/30315",
"https://spanish.stackexchange.com",
"https://spanish.stackexchange.com/users/13101/"
] | La onomatopeya japonesa シーン ("shiin") se usa mucho en el ámbito del cómic para expresar el silencio absoluto, y suele ir acompañada de algún dibujo descriptivo de la escena a representar. Tener una onomatopeya para el silencio no deja de ser contradictorio, pero si lo pensamos la onomatopeya del silencio no es más que ... | Pensaba que no, pero al buscar, resulta que existen onomatopeyas de "acciones", que en sí no implicarían sonido:
Aggggggh (expresión de terror)
Bah (expresión de desprecio)
Brrrr (sensación de frío)
Buuu (expresión de abucheos)
Hum… (expresión de duda)
jajaja (expresión de risa fuerte)
jejeje (expresión de risa ... |
30,315 | Según una definición, en español "la onomatopeya es una imitación lingüística de una palabra que se asemeja con el sonido que representa", por eso el encomillado en el título.
Pero, hay otra definición que dice:
>
> Onomatopeya es una palabra que proviene del latín tardío onomatopoeia, aunque su origen se remonta a... | 2019/05/01 | [
"https://spanish.stackexchange.com/questions/30315",
"https://spanish.stackexchange.com",
"https://spanish.stackexchange.com/users/13101/"
] | Pensaba que no, pero al buscar, resulta que existen onomatopeyas de "acciones", que en sí no implicarían sonido:
Aggggggh (expresión de terror)
Bah (expresión de desprecio)
Brrrr (sensación de frío)
Buuu (expresión de abucheos)
Hum… (expresión de duda)
jajaja (expresión de risa fuerte)
jejeje (expresión de risa ... | Se ocurren éstas
Titilar - Definitivamente no implica sonido porque se refiere a un cuerpo luminoso.
Tiritar - Se puede hacer sonido al tiritar pero no es indispensable.
Bamboleo - Indica movimiento.
Tris - Como se explica en [esta respuesta](https://spanish.stackexchange.com/a/30641/12572), aunque se basa en un so... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.