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 |
|---|---|---|---|---|---|
68,746,525 | I am having a hard time understanding why `pthread_join`'s `retval` argument is a `void**`. I have read the manpage and tried to wrap my head around it but I still cannot fully understand it. I couldn't convince myself that `retval` cannot be a `void*`. Could someone please enlighten me?
Thank you very much in advance... | 2021/08/11 | [
"https://Stackoverflow.com/questions/68746525",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12379242/"
] | It's because you are supposed to supply the address of a `void*` to `pthread_join`.
`pthread_join` will then write the address supplied by `pthread_exit(void*)` into the variable (who's address you supplied).
Example scenario:
```
typedef struct {
// members
} input_data;
typedef struct {
// members
} output... | Simple enough. The return value of thread func supplied to `pthread_create` is `void*`; `pthread_join` is supposed to return this value to caller.
It can not return this as a function return type (because it is already returning `int` to indicate the overall status of the call). The only other way as through out param... |
68,746,525 | I am having a hard time understanding why `pthread_join`'s `retval` argument is a `void**`. I have read the manpage and tried to wrap my head around it but I still cannot fully understand it. I couldn't convince myself that `retval` cannot be a `void*`. Could someone please enlighten me?
Thank you very much in advance... | 2021/08/11 | [
"https://Stackoverflow.com/questions/68746525",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12379242/"
] | It's because you are supposed to supply the address of a `void*` to `pthread_join`.
`pthread_join` will then write the address supplied by `pthread_exit(void*)` into the variable (who's address you supplied).
Example scenario:
```
typedef struct {
// members
} input_data;
typedef struct {
// members
} output... | The exiting thread is going to provide a pointer to some data. The pthread routines do not know what type that data has, so they receive the pointer as a `void *`.
The caller of `pthread_join` is going to receive that `void *`. Since the function return value is used for something else, the `void *` has to be received... |
68,746,525 | I am having a hard time understanding why `pthread_join`'s `retval` argument is a `void**`. I have read the manpage and tried to wrap my head around it but I still cannot fully understand it. I couldn't convince myself that `retval` cannot be a `void*`. Could someone please enlighten me?
Thank you very much in advance... | 2021/08/11 | [
"https://Stackoverflow.com/questions/68746525",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12379242/"
] | It's because you are supposed to supply the address of a `void*` to `pthread_join`.
`pthread_join` will then write the address supplied by `pthread_exit(void*)` into the variable (who's address you supplied).
Example scenario:
```
typedef struct {
// members
} input_data;
typedef struct {
// members
} output... | From the manpage:
>
> If retval is not NULL, then pthread\_join() copies the exit status of the target thread (i.e., the value that the target thread supplied to pthread\_exit(3)) into the location pointed to by retval.
>
>
>
Let's look at the signature of `pthread_exit`.
`noreturn void pthread_exit(void *retval... |
33,533,804 | I would like to transform a ggplot graph such that 0.9, 0.99, 0.999, 0.9999, etc. are at equal distances from each other on the x axis.
In the following example, these breaks are bunched up on the right side. I would like the higher values to be stretched on the x axis. This would be the opposite of a log scale which ... | 2015/11/04 | [
"https://Stackoverflow.com/questions/33533804",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9435/"
] | Been thinking about it. Think this is what you want:
This code:
```
#Generate our Data
p <- seq(0.001, 1-0.001, 0.001)
sin_p <- sin(p*pi)
xin <- c( 0.5,0.9,0.99,0.999 )
lxin <- as.character(xin)
pctdf <- data.frame(p,sinp)
# Plot it in raw form
g1 <- ggplot(pctdf, aes(p, sin_p)) +
geom_point() +
geom_vline(xint... | Remove `scale_x_continuous` and use
```
g1 + scale_x_log10(breaks=c(0,0.9,.9,.99,.999,.9999))
```
But you're going to have problems with the `breaks == 0` since `log10(0) = -Inf`
For example:
```
p <- seq(0.001, 1, 0.001)
d <- seq(1, 1000)
percentile <- data.frame(p, d)
g1 <- ggplot(percentile, aes(p, d))
g1 <- g1... |
33,533,804 | I would like to transform a ggplot graph such that 0.9, 0.99, 0.999, 0.9999, etc. are at equal distances from each other on the x axis.
In the following example, these breaks are bunched up on the right side. I would like the higher values to be stretched on the x axis. This would be the opposite of a log scale which ... | 2015/11/04 | [
"https://Stackoverflow.com/questions/33533804",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9435/"
] | Using Mike Wise's answer below as a template, I was able to get this working. Here is the code I came up with:
```
transform <- function(x){
log(1/(1-x))
}
p <- transform(seq(0.001, 1, 0.001))
d <- seq(1, 1000)
xin <- transform(c(0.5,0.9,0.99,0.999))
lxin <- as.character(c(0.5,0.9,0.99,0.999))
percentile <- data.fra... | Remove `scale_x_continuous` and use
```
g1 + scale_x_log10(breaks=c(0,0.9,.9,.99,.999,.9999))
```
But you're going to have problems with the `breaks == 0` since `log10(0) = -Inf`
For example:
```
p <- seq(0.001, 1, 0.001)
d <- seq(1, 1000)
percentile <- data.frame(p, d)
g1 <- ggplot(percentile, aes(p, d))
g1 <- g1... |
33,533,804 | I would like to transform a ggplot graph such that 0.9, 0.99, 0.999, 0.9999, etc. are at equal distances from each other on the x axis.
In the following example, these breaks are bunched up on the right side. I would like the higher values to be stretched on the x axis. This would be the opposite of a log scale which ... | 2015/11/04 | [
"https://Stackoverflow.com/questions/33533804",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9435/"
] | Using Mike Wise's answer below as a template, I was able to get this working. Here is the code I came up with:
```
transform <- function(x){
log(1/(1-x))
}
p <- transform(seq(0.001, 1, 0.001))
d <- seq(1, 1000)
xin <- transform(c(0.5,0.9,0.99,0.999))
lxin <- as.character(c(0.5,0.9,0.99,0.999))
percentile <- data.fra... | Been thinking about it. Think this is what you want:
This code:
```
#Generate our Data
p <- seq(0.001, 1-0.001, 0.001)
sin_p <- sin(p*pi)
xin <- c( 0.5,0.9,0.99,0.999 )
lxin <- as.character(xin)
pctdf <- data.frame(p,sinp)
# Plot it in raw form
g1 <- ggplot(pctdf, aes(p, sin_p)) +
geom_point() +
geom_vline(xint... |
7,947,327 | I'm making a class and I want to be able to automatically assign variables being posted from an ajax request.
```
function assign_vars() {
foreach($_POST as $index => $value) {
if($index == 'car_year') {
$this->car_year = $value;
}
}
}
```
This function would be very handy is the... | 2011/10/30 | [
"https://Stackoverflow.com/questions/7947327",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1004383/"
] | Consider the following setup:
```
class ClassName
{
/* Init with default values. */
protected $_vars = array(
'car_year' => null
, ...
);
public function assign_vars( $array )
{
$this->_vars =
array_merge($this->_vars, array_intersect_key($array, $this->_vars));
}
}
$obj = new ClassNa... | Try with:
```
function assign_vars() {
foreach($_POST as $index => $value) {
$this->$index = $value;
}
}
```
However the way you go is looking like not thought out solution. |
36,823,453 | Below is the HTML and CSS I'm using. Unfortunately the questions already asked do not give the answer required. Basically it decreases the width of all siblings and increases the one that is hovered over. I'm using `ease-in-out` but the OUT part of the transition just instantaneously jumps back to its original state.
... | 2016/04/24 | [
"https://Stackoverflow.com/questions/36823453",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4820242/"
] | just simple add this one and works like a charm!! `
```
materialDesignSpinner.setAdapter(arrayAdapter);
materialDesignSpinner.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
... | The setOnItemSelectedListener does not work, because the Material/BetterSpinner is a EditText with auto-complete. Not a really Spinner.
you can see the answer here:
<https://github.com/Lesilva/BetterSpinner/issues/42> |
36,823,453 | Below is the HTML and CSS I'm using. Unfortunately the questions already asked do not give the answer required. Basically it decreases the width of all siblings and increases the one that is hovered over. I'm using `ease-in-out` but the OUT part of the transition just instantaneously jumps back to its original state.
... | 2016/04/24 | [
"https://Stackoverflow.com/questions/36823453",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4820242/"
] | just simple add this one and works like a charm!! `
```
materialDesignSpinner.setAdapter(arrayAdapter);
materialDesignSpinner.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
... | You can use this code.
```
MaterialBetterSpinner MBS = (MaterialBetterSpinner) findViewById(R.id.Spinner);
MBS.addTextChangedListener(new myTextWatcher() {
@Override
public void afterTextChanged(Editable s) {
Log.e("Text",MBS.getText().toString());
}
});
```
Create a myTextWatcher class then copy paste the code b... |
36,823,453 | Below is the HTML and CSS I'm using. Unfortunately the questions already asked do not give the answer required. Basically it decreases the width of all siblings and increases the one that is hovered over. I'm using `ease-in-out` but the OUT part of the transition just instantaneously jumps back to its original state.
... | 2016/04/24 | [
"https://Stackoverflow.com/questions/36823453",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4820242/"
] | just simple add this one and works like a charm!! `
```
materialDesignSpinner.setAdapter(arrayAdapter);
materialDesignSpinner.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
... | Use this
```
public class DropDownList extends MaterialBetterSpinner {
private AdapterView.OnItemSelectedListener listener;
public DropDownList(Context context) {
super(context);
}
public DropDownList(Context arg0, AttributeSet arg1) {
super(arg0, arg1);
}
public DropDownLis... |
356,708 | Why Built-in Potential of White,Red,Green and Blue LEDs are in the order:
$$V\_W > V\_B > V\_G > V\_R$$
where $$V\_W \implies Built-in \quad Potential \quad of \quad White \quad LED $$
My Approach:
We know: $$\lambda\_R>\lambda\_G>\lambda\_B$$
$$\therefore E\_{gR}< E\_{gG} < E\_{gB} $$ as Band gap Energy... | 2018/02/17 | [
"https://electronics.stackexchange.com/questions/356708",
"https://electronics.stackexchange.com",
"https://electronics.stackexchange.com/users/175381/"
] | The dies used in "White" LEDs are actually blue, with rare earth phosphor or phosphors to deliver longer wavelength yellow and red light (depending on the desired color temperature).
Electrically, they behave as blue LEDs. | Vf= Vt+If\*Rs
I usually call Rs=ESR and I know all diode ESR = k/Pd for k= ~0.5 to 1 and depends on thermal design for Pd= Vmax\*Imax rated @ 85'C
Ideal equation only covers Vt and not Pd or ESR.
\$Vf=Vt+If\*k/Pd\$
use this with k= 1 for epoxy types and k=0.5 for ceramic SMD approximately |
356,708 | Why Built-in Potential of White,Red,Green and Blue LEDs are in the order:
$$V\_W > V\_B > V\_G > V\_R$$
where $$V\_W \implies Built-in \quad Potential \quad of \quad White \quad LED $$
My Approach:
We know: $$\lambda\_R>\lambda\_G>\lambda\_B$$
$$\therefore E\_{gR}< E\_{gG} < E\_{gB} $$ as Band gap Energy... | 2018/02/17 | [
"https://electronics.stackexchange.com/questions/356708",
"https://electronics.stackexchange.com",
"https://electronics.stackexchange.com/users/175381/"
] | The forward voltage drop of a LED is a function of the wavelength of light it produces. The more energetic shorter wavelengths require a higher voltage from the LED that produces them.
There are several different technologies for making a "white" LED. Some use a blue LED, with phosphors to convert some of the blue lig... | Vf= Vt+If\*Rs
I usually call Rs=ESR and I know all diode ESR = k/Pd for k= ~0.5 to 1 and depends on thermal design for Pd= Vmax\*Imax rated @ 85'C
Ideal equation only covers Vt and not Pd or ESR.
\$Vf=Vt+If\*k/Pd\$
use this with k= 1 for epoxy types and k=0.5 for ceramic SMD approximately |
9,786,121 | I am trying to understand the difference of using the keyword "this" or rather what it represents in jQuery Vs an MVC framework like Backbone.
Below are 2 code samples of each;
So in jQuery, we have
```
$("#result").click(function(){
$(this).html(someval);
})
```
In Backbone, we have code as;
```
var HandlebarsVi... | 2012/03/20 | [
"https://Stackoverflow.com/questions/9786121",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/485743/"
] | `this` is the context in which a function executes.
The trick to understanding `this` is understanding that it's the way you execute a function that determines it.
When you pass a function to a method like jQuery, you are using that function as a callback method. jQuery explicitly sets the context of the callback whe... | In Backbone 'this' inside the view refers to the current view object. In models 'this' refers to the current model object. And similarly for collections 'this' refers to the current collection object.
But for views 'this' is transient between selected dom element by jQuery and view object, that is why we use \_.bindAl... |
4,457,760 | I am creatind 20 dynamic div , on page load attaching onclick event to each div to alert its id but problem is on clicking any div only last div id is alerted plz help.
For example on clicking on fist div is alerting last div id.
Required result is onclick on a div should alert its own id.
Full code is given bellow... | 2010/12/16 | [
"https://Stackoverflow.com/questions/4457760",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/472193/"
] | this a variable closure issue use this instead:
```
div.onclick = function (num)
{
return function(){
alert(num+"test");
};
}(i);
``` | I came across this problem once. Just remember: the value of `i` is now 20 across the entire scope of the `test()` function. But, the `innerHTML` value of each div is now set as you'd expect. So use that `innerHTML` value reference instead. |
10,646,389 | I am running python (2.7) from a command prompt in Cygwin. I normally pass a filename to my python code and retrieve the filename with: sys.argv[1]. I get python to check for the existance of the file (using os.path.exists) prior to opening.
This has worked even if I specified a file as "../dir1/dir2/file\_name". As ... | 2012/05/18 | [
"https://Stackoverflow.com/questions/10646389",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1402377/"
] | **Edit**: As `@Jake King` noted, in my previous answer I was not paying attention to the details (that your `mydegree` member is a `String` instance.
This way the only reason for you to get a `NPE` is that your `tv TextView` is null.
Please check your layout xml file you use for the activity / renderer / view, and ... | Simple.. use this
```
tv.setText(degrees+""); //Degrees is the float value
``` |
10,646,389 | I am running python (2.7) from a command prompt in Cygwin. I normally pass a filename to my python code and retrieve the filename with: sys.argv[1]. I get python to check for the existance of the file (using os.path.exists) prior to opening.
This has worked even if I specified a file as "../dir1/dir2/file\_name". As ... | 2012/05/18 | [
"https://Stackoverflow.com/questions/10646389",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1402377/"
] | As tigrang points out, your problem is not converting a float to a String. What you have should work fine. Your problem is that `findViewById()` is returning a `null` value for some reason or another, presumably because no views have the ID you provided. Make sure the ID is correct and that you are getting a valid `Tex... | Simple.. use this
```
tv.setText(degrees+""); //Degrees is the float value
``` |
10,646,389 | I am running python (2.7) from a command prompt in Cygwin. I normally pass a filename to my python code and retrieve the filename with: sys.argv[1]. I get python to check for the existance of the file (using os.path.exists) prior to opening.
This has worked even if I specified a file as "../dir1/dir2/file\_name". As ... | 2012/05/18 | [
"https://Stackoverflow.com/questions/10646389",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1402377/"
] | ```
String degreesStr = Float.parseFloat(degrees);
```
try this which converts a float value to string. | Simple.. use this
```
tv.setText(degrees+""); //Degrees is the float value
``` |
10,646,389 | I am running python (2.7) from a command prompt in Cygwin. I normally pass a filename to my python code and retrieve the filename with: sys.argv[1]. I get python to check for the existance of the file (using os.path.exists) prior to opening.
This has worked even if I specified a file as "../dir1/dir2/file\_name". As ... | 2012/05/18 | [
"https://Stackoverflow.com/questions/10646389",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1402377/"
] | **Edit**: As `@Jake King` noted, in my previous answer I was not paying attention to the details (that your `mydegree` member is a `String` instance.
This way the only reason for you to get a `NPE` is that your `tv TextView` is null.
Please check your layout xml file you use for the activity / renderer / view, and ... | ```
String degreesStr = Float.parseFloat(degrees);
```
try this which converts a float value to string. |
10,646,389 | I am running python (2.7) from a command prompt in Cygwin. I normally pass a filename to my python code and retrieve the filename with: sys.argv[1]. I get python to check for the existance of the file (using os.path.exists) prior to opening.
This has worked even if I specified a file as "../dir1/dir2/file\_name". As ... | 2012/05/18 | [
"https://Stackoverflow.com/questions/10646389",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1402377/"
] | As tigrang points out, your problem is not converting a float to a String. What you have should work fine. Your problem is that `findViewById()` is returning a `null` value for some reason or another, presumably because no views have the ID you provided. Make sure the ID is correct and that you are getting a valid `Tex... | ```
String degreesStr = Float.parseFloat(degrees);
```
try this which converts a float value to string. |
27,256,125 | As refactoring my code, I realize some of code is repeated except the exception handling of them. I am wondering whether these codes are considered to be repeated to refactor, if so, how?
Specific sample:
E.g I have two methods.
```
void fun1() {
try {
foo();
} catch (Exception ex) {
handle1(... | 2014/12/02 | [
"https://Stackoverflow.com/questions/27256125",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3393757/"
] | I believe the reason is described [here](https://github.com/rspec/rspec-core/issues/828 "here"). Since your file names are ended with "\_spec.rb", they get autoloaded as examples by RSpec. What I did and what helped, is renaming the files, containing shared examples, removing the "\_spec" portion. | There's a closed [issue](https://github.com/rspec/rspec-rails/issues/623) on rspec-rails for this. Basically, RSpec uses a pattern matcher (`spec/**/*_spec.rb`) to find spec files and auto-loads them. But your spec helper auto-loads all files in the `spec/support/` subdirectory. So your `spec/support/shared/authenticat... |
3,476,096 | Look at this example code, from a Telerik MVC grid:
```
<% Html.Telerik().Grid(Model.InstallerList)
.Name("InstallerGrid")
.DataKeys(key => key.Add(c => c.InstallerID))
.Columns(column =>
{
column.Template(action =>
{%>
<%= Html.ActionLink("Edit", "Edit", new{ id = a... | 2010/08/13 | [
"https://Stackoverflow.com/questions/3476096",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8741/"
] | There's no *real* difference, *in this case*, they just let you chain by returning the reference. The advantage? It's more terse and you don't have to maintain a reference yourself, other than that it's more about style than anything else.
When the Telerik guys converted to jQuery (which also chains) for their client-... | These are called ["Fluent Interfaces"](http://en.wikipedia.org/wiki/Fluent_interface).
The supposed benefits are in readablity and discoverablity or code, though with good intellisense these may not give the most benefit.
Code becomes a lot more tight and the style of programming becomes more declarative - you say wh... |
3,476,096 | Look at this example code, from a Telerik MVC grid:
```
<% Html.Telerik().Grid(Model.InstallerList)
.Name("InstallerGrid")
.DataKeys(key => key.Add(c => c.InstallerID))
.Columns(column =>
{
column.Template(action =>
{%>
<%= Html.ActionLink("Edit", "Edit", new{ id = a... | 2010/08/13 | [
"https://Stackoverflow.com/questions/3476096",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8741/"
] | Ditto " People refer to these as "Fluent Interfaces". "
A great benefit is to avoid unnecessary parameters in methods, especially constructors. For example a cake can have icing, and icing can have words written on it.
Do you go for
```
Cake cake = new Cake( Icing.None, "" ); // no icing, no words
Cake birthday... | These are called ["Fluent Interfaces"](http://en.wikipedia.org/wiki/Fluent_interface).
The supposed benefits are in readablity and discoverablity or code, though with good intellisense these may not give the most benefit.
Code becomes a lot more tight and the style of programming becomes more declarative - you say wh... |
3,476,096 | Look at this example code, from a Telerik MVC grid:
```
<% Html.Telerik().Grid(Model.InstallerList)
.Name("InstallerGrid")
.DataKeys(key => key.Add(c => c.InstallerID))
.Columns(column =>
{
column.Template(action =>
{%>
<%= Html.ActionLink("Edit", "Edit", new{ id = a... | 2010/08/13 | [
"https://Stackoverflow.com/questions/3476096",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8741/"
] | Fluent interfaces are meant to be a type of internal domain specific language. When implemented well they can read like a natural language sentence.
There's a really good write-up on Martin Fowler's [bliki](http://martinfowler.com/dslwip/InternalOverview.html) that covers the pros and cons in detail.
Note that Fowler... | These are called ["Fluent Interfaces"](http://en.wikipedia.org/wiki/Fluent_interface).
The supposed benefits are in readablity and discoverablity or code, though with good intellisense these may not give the most benefit.
Code becomes a lot more tight and the style of programming becomes more declarative - you say wh... |
3,476,096 | Look at this example code, from a Telerik MVC grid:
```
<% Html.Telerik().Grid(Model.InstallerList)
.Name("InstallerGrid")
.DataKeys(key => key.Add(c => c.InstallerID))
.Columns(column =>
{
column.Template(action =>
{%>
<%= Html.ActionLink("Edit", "Edit", new{ id = a... | 2010/08/13 | [
"https://Stackoverflow.com/questions/3476096",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8741/"
] | Fluent interfaces are meant to be a type of internal domain specific language. When implemented well they can read like a natural language sentence.
There's a really good write-up on Martin Fowler's [bliki](http://martinfowler.com/dslwip/InternalOverview.html) that covers the pros and cons in detail.
Note that Fowler... | There's no *real* difference, *in this case*, they just let you chain by returning the reference. The advantage? It's more terse and you don't have to maintain a reference yourself, other than that it's more about style than anything else.
When the Telerik guys converted to jQuery (which also chains) for their client-... |
3,476,096 | Look at this example code, from a Telerik MVC grid:
```
<% Html.Telerik().Grid(Model.InstallerList)
.Name("InstallerGrid")
.DataKeys(key => key.Add(c => c.InstallerID))
.Columns(column =>
{
column.Template(action =>
{%>
<%= Html.ActionLink("Edit", "Edit", new{ id = a... | 2010/08/13 | [
"https://Stackoverflow.com/questions/3476096",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8741/"
] | There's no *real* difference, *in this case*, they just let you chain by returning the reference. The advantage? It's more terse and you don't have to maintain a reference yourself, other than that it's more about style than anything else.
When the Telerik guys converted to jQuery (which also chains) for their client-... | The return type that those methods chain may not necessarily be the original grid. In addition, not all of them may be easily expressible or useful after you're finished with them. Using a method chain keeps things tight and easy to change in the future. |
3,476,096 | Look at this example code, from a Telerik MVC grid:
```
<% Html.Telerik().Grid(Model.InstallerList)
.Name("InstallerGrid")
.DataKeys(key => key.Add(c => c.InstallerID))
.Columns(column =>
{
column.Template(action =>
{%>
<%= Html.ActionLink("Edit", "Edit", new{ id = a... | 2010/08/13 | [
"https://Stackoverflow.com/questions/3476096",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8741/"
] | Fluent interfaces are meant to be a type of internal domain specific language. When implemented well they can read like a natural language sentence.
There's a really good write-up on Martin Fowler's [bliki](http://martinfowler.com/dslwip/InternalOverview.html) that covers the pros and cons in detail.
Note that Fowler... | Ditto " People refer to these as "Fluent Interfaces". "
A great benefit is to avoid unnecessary parameters in methods, especially constructors. For example a cake can have icing, and icing can have words written on it.
Do you go for
```
Cake cake = new Cake( Icing.None, "" ); // no icing, no words
Cake birthday... |
3,476,096 | Look at this example code, from a Telerik MVC grid:
```
<% Html.Telerik().Grid(Model.InstallerList)
.Name("InstallerGrid")
.DataKeys(key => key.Add(c => c.InstallerID))
.Columns(column =>
{
column.Template(action =>
{%>
<%= Html.ActionLink("Edit", "Edit", new{ id = a... | 2010/08/13 | [
"https://Stackoverflow.com/questions/3476096",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8741/"
] | Ditto " People refer to these as "Fluent Interfaces". "
A great benefit is to avoid unnecessary parameters in methods, especially constructors. For example a cake can have icing, and icing can have words written on it.
Do you go for
```
Cake cake = new Cake( Icing.None, "" ); // no icing, no words
Cake birthday... | The return type that those methods chain may not necessarily be the original grid. In addition, not all of them may be easily expressible or useful after you're finished with them. Using a method chain keeps things tight and easy to change in the future. |
3,476,096 | Look at this example code, from a Telerik MVC grid:
```
<% Html.Telerik().Grid(Model.InstallerList)
.Name("InstallerGrid")
.DataKeys(key => key.Add(c => c.InstallerID))
.Columns(column =>
{
column.Template(action =>
{%>
<%= Html.ActionLink("Edit", "Edit", new{ id = a... | 2010/08/13 | [
"https://Stackoverflow.com/questions/3476096",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8741/"
] | Fluent interfaces are meant to be a type of internal domain specific language. When implemented well they can read like a natural language sentence.
There's a really good write-up on Martin Fowler's [bliki](http://martinfowler.com/dslwip/InternalOverview.html) that covers the pros and cons in detail.
Note that Fowler... | The return type that those methods chain may not necessarily be the original grid. In addition, not all of them may be easily expressible or useful after you're finished with them. Using a method chain keeps things tight and easy to change in the future. |
19,122,296 | I'm trying to pass information from js to codebehind. When setting a breakpoint at the end of the js - The (Firefox) **debugger** (-js) shows me that an `input`'s value *has* been set, while the (Firefox) **Inspector** (-html) shows it *hasn't*. When reaching the **codebehind** - it *hasn't* been set. Why?
**js** to s... | 2013/10/01 | [
"https://Stackoverflow.com/questions/19122296",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/939213/"
] | You need to set `value` property of input instead of `innerHTML`
*Change*
```
i.innerHTML = s;
```
*To*
```
i.value = s;
``` | You want to use `value` to set the value of an input:
```
function doit(s, input, button) {
document.getElementById(input).value = s;
var b = document.getElementById(button);
b.click();
}
``` |
203,525 | I'm having trouble finding how many ways there is to arrange 5 black, 7 red, 9 blue, and 6 white marbles to find the probability that every white marble is adjacent to at least one other white marble.
If you could help me out that would be great! | 2012/09/27 | [
"https://math.stackexchange.com/questions/203525",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/42075/"
] | There are, in general, $n!$ ways to arrange $n$ objects. So you'd have $(5+7+9+6)!$ but then as all the black marbles are identical, their permutations shouldn't be counted. For every 'good' permutation, you also have another $5!7!9!6!$ that only differ from it by permutations of same colored marbles. Thus the result i... | We describe one way to count the number of ways to arrange the balls.
Let the number of ways to place the white marbles be $W$. Each of these ways leaves $21$ empty slots. Let $N$ be the number of ways to fill these slots. Then our answer is $WN$.
Finding $N$ is probably a standard problem for you.
Finding $W$ is ... |
203,525 | I'm having trouble finding how many ways there is to arrange 5 black, 7 red, 9 blue, and 6 white marbles to find the probability that every white marble is adjacent to at least one other white marble.
If you could help me out that would be great! | 2012/09/27 | [
"https://math.stackexchange.com/questions/203525",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/42075/"
] | There are, in general, $n!$ ways to arrange $n$ objects. So you'd have $(5+7+9+6)!$ but then as all the black marbles are identical, their permutations shouldn't be counted. For every 'good' permutation, you also have another $5!7!9!6!$ that only differ from it by permutations of same colored marbles. Thus the result i... | First find the total probability space of the marbles. I assume the marbles of each color are otherwise indistinguishable and so order doesn't matter.
$N\_{all} = \frac{(5+7+9+6)!}{5!\cdot7!\cdot9!\cdot6!}$
Second, create an expression for the number of combinations of the black, red, and blue marbles, this will be t... |
203,525 | I'm having trouble finding how many ways there is to arrange 5 black, 7 red, 9 blue, and 6 white marbles to find the probability that every white marble is adjacent to at least one other white marble.
If you could help me out that would be great! | 2012/09/27 | [
"https://math.stackexchange.com/questions/203525",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/42075/"
] | There are, in general, $n!$ ways to arrange $n$ objects. So you'd have $(5+7+9+6)!$ but then as all the black marbles are identical, their permutations shouldn't be counted. For every 'good' permutation, you also have another $5!7!9!6!$ that only differ from it by permutations of same colored marbles. Thus the result i... | A simple way is to compute the complement.
The 21 "non-white" marbles have 22 "interstices" (including ends), so the white marbles can be placed in C(22,6) "non-adjacent" ways and the others permuted in 21!/(5!7!9!) ways in their positions
Pr = 1 - [C(22,6)\*21!/(5!7!9!)]/[27!/(5!7!9!6!)]
= 1 - C(22,6)\*6!21!/27! |
203,525 | I'm having trouble finding how many ways there is to arrange 5 black, 7 red, 9 blue, and 6 white marbles to find the probability that every white marble is adjacent to at least one other white marble.
If you could help me out that would be great! | 2012/09/27 | [
"https://math.stackexchange.com/questions/203525",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/42075/"
] | First find the total probability space of the marbles. I assume the marbles of each color are otherwise indistinguishable and so order doesn't matter.
$N\_{all} = \frac{(5+7+9+6)!}{5!\cdot7!\cdot9!\cdot6!}$
Second, create an expression for the number of combinations of the black, red, and blue marbles, this will be t... | We describe one way to count the number of ways to arrange the balls.
Let the number of ways to place the white marbles be $W$. Each of these ways leaves $21$ empty slots. Let $N$ be the number of ways to fill these slots. Then our answer is $WN$.
Finding $N$ is probably a standard problem for you.
Finding $W$ is ... |
203,525 | I'm having trouble finding how many ways there is to arrange 5 black, 7 red, 9 blue, and 6 white marbles to find the probability that every white marble is adjacent to at least one other white marble.
If you could help me out that would be great! | 2012/09/27 | [
"https://math.stackexchange.com/questions/203525",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/42075/"
] | We describe one way to count the number of ways to arrange the balls.
Let the number of ways to place the white marbles be $W$. Each of these ways leaves $21$ empty slots. Let $N$ be the number of ways to fill these slots. Then our answer is $WN$.
Finding $N$ is probably a standard problem for you.
Finding $W$ is ... | A simple way is to compute the complement.
The 21 "non-white" marbles have 22 "interstices" (including ends), so the white marbles can be placed in C(22,6) "non-adjacent" ways and the others permuted in 21!/(5!7!9!) ways in their positions
Pr = 1 - [C(22,6)\*21!/(5!7!9!)]/[27!/(5!7!9!6!)]
= 1 - C(22,6)\*6!21!/27! |
203,525 | I'm having trouble finding how many ways there is to arrange 5 black, 7 red, 9 blue, and 6 white marbles to find the probability that every white marble is adjacent to at least one other white marble.
If you could help me out that would be great! | 2012/09/27 | [
"https://math.stackexchange.com/questions/203525",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/42075/"
] | First find the total probability space of the marbles. I assume the marbles of each color are otherwise indistinguishable and so order doesn't matter.
$N\_{all} = \frac{(5+7+9+6)!}{5!\cdot7!\cdot9!\cdot6!}$
Second, create an expression for the number of combinations of the black, red, and blue marbles, this will be t... | A simple way is to compute the complement.
The 21 "non-white" marbles have 22 "interstices" (including ends), so the white marbles can be placed in C(22,6) "non-adjacent" ways and the others permuted in 21!/(5!7!9!) ways in their positions
Pr = 1 - [C(22,6)\*21!/(5!7!9!)]/[27!/(5!7!9!6!)]
= 1 - C(22,6)\*6!21!/27! |
25,747,900 | How would you exclude a transitive dependency globally? My project depends on a lot of the Twitter libraries or on libraries that depend on the Twitter libraries. I don't want `slf4j-jdk14` in my classpath, no matter what (I use logback as slf4j binding).
Currently I do this:
```
"com.twitter" %% "finagle-thriftmux" ... | 2014/09/09 | [
"https://Stackoverflow.com/questions/25747900",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1671319/"
] | **Since sbt 0.13.8**
In sbt 0.13.8 there is [possibility](http://www.scala-sbt.org/1.x/docs/sbt-0.13-Tech-Previews.html#Project-level+dependency+exclusions) to exclude dependencies globally. Here is a compact example:
```
excludeDependencies += "org.slf4j" % "slf4j-jdk14"
```
However, at the moment of writing this ... | ```
libraryDependencies := libraryDependencies.value.map(_.exclude("groupid", "artifactname"))
``` |
25,747,900 | How would you exclude a transitive dependency globally? My project depends on a lot of the Twitter libraries or on libraries that depend on the Twitter libraries. I don't want `slf4j-jdk14` in my classpath, no matter what (I use logback as slf4j binding).
Currently I do this:
```
"com.twitter" %% "finagle-thriftmux" ... | 2014/09/09 | [
"https://Stackoverflow.com/questions/25747900",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1671319/"
] | **Since sbt 0.13.8**
In sbt 0.13.8 there is [possibility](http://www.scala-sbt.org/1.x/docs/sbt-0.13-Tech-Previews.html#Project-level+dependency+exclusions) to exclude dependencies globally. Here is a compact example:
```
excludeDependencies += "org.slf4j" % "slf4j-jdk14"
```
However, at the moment of writing this ... | `excludeDependencies += "org.slf4j" % "slf4j-jdk14"` |
25,747,900 | How would you exclude a transitive dependency globally? My project depends on a lot of the Twitter libraries or on libraries that depend on the Twitter libraries. I don't want `slf4j-jdk14` in my classpath, no matter what (I use logback as slf4j binding).
Currently I do this:
```
"com.twitter" %% "finagle-thriftmux" ... | 2014/09/09 | [
"https://Stackoverflow.com/questions/25747900",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1671319/"
] | `excludeDependencies += "org.slf4j" % "slf4j-jdk14"` | ```
libraryDependencies := libraryDependencies.value.map(_.exclude("groupid", "artifactname"))
``` |
415,538 | YAGNI might tell us, that in the below implementation the generic version is not needed, as long as the function is only used once.
But to me personally, it seems, the generic version is more readable because I'm not distracted by all the possibilities the special class has, but are not used. The generic version is ex... | 2020/09/03 | [
"https://softwareengineering.stackexchange.com/questions/415538",
"https://softwareengineering.stackexchange.com",
"https://softwareengineering.stackexchange.com/users/104636/"
] | There are definitely cases where solving a more general problem than required makes code easier to read, to reason about and to maintain. The most simple example I can think of is when code deals with input data consisting of four or five similar attributes, and the processing code gets duplicated up to 5 times because... | In the meantime, I've learned more about the underlying principle, this decision can be based on, and also found a better minimal example. It can be found in this article ("Why a generic implementation can be the easier-to-understand solution"):
* original URL: <https://github.com/Dobiasd/articles/blob/master/why_a_ge... |
415,538 | YAGNI might tell us, that in the below implementation the generic version is not needed, as long as the function is only used once.
But to me personally, it seems, the generic version is more readable because I'm not distracted by all the possibilities the special class has, but are not used. The generic version is ex... | 2020/09/03 | [
"https://softwareengineering.stackexchange.com/questions/415538",
"https://softwareengineering.stackexchange.com",
"https://softwareengineering.stackexchange.com/users/104636/"
] | I do think it depends. If you are the only developer who will touch the code, I would write a generic only if you can actually foresee to, say, greater than 50% probability, usage for multiple types. Otherwise, should that usage become necessary unexpectedly, you know how to rewrite your function as a generic and your ... | In the meantime, I've learned more about the underlying principle, this decision can be based on, and also found a better minimal example. It can be found in this article ("Why a generic implementation can be the easier-to-understand solution"):
* original URL: <https://github.com/Dobiasd/articles/blob/master/why_a_ge... |
415,538 | YAGNI might tell us, that in the below implementation the generic version is not needed, as long as the function is only used once.
But to me personally, it seems, the generic version is more readable because I'm not distracted by all the possibilities the special class has, but are not used. The generic version is ex... | 2020/09/03 | [
"https://softwareengineering.stackexchange.com/questions/415538",
"https://softwareengineering.stackexchange.com",
"https://softwareengineering.stackexchange.com/users/104636/"
] | There are definitely cases where solving a more general problem than required makes code easier to read, to reason about and to maintain. The most simple example I can think of is when code deals with input data consisting of four or five similar attributes, and the processing code gets duplicated up to 5 times because... | >
> What it actually does is not that important for this example
>
>
>
* Where you define it is. Sweeping generic utility functions often have no benefit of being part of the class which often implements it. Try this exercise please... **If you move the utility functions to a separate class and the question is act... |
415,538 | YAGNI might tell us, that in the below implementation the generic version is not needed, as long as the function is only used once.
But to me personally, it seems, the generic version is more readable because I'm not distracted by all the possibilities the special class has, but are not used. The generic version is ex... | 2020/09/03 | [
"https://softwareengineering.stackexchange.com/questions/415538",
"https://softwareengineering.stackexchange.com",
"https://softwareengineering.stackexchange.com/users/104636/"
] | There's has been some back and forth in the comments, and my feedback generally boils down to the same argument every time:
Your problem, as you describe it, always starts from the really unusual assumption that you don't know what it is you should be doing and would just interact with random available things *just be... | Do you know what exactly your function is going to be working with, or does it even matter?
In the cases of looking at various collections, like a list for example, knowing what the items are within the list may be completely irrelevant (as far as the list itself is concerned). For example, if you want to be able to s... |
415,538 | YAGNI might tell us, that in the below implementation the generic version is not needed, as long as the function is only used once.
But to me personally, it seems, the generic version is more readable because I'm not distracted by all the possibilities the special class has, but are not used. The generic version is ex... | 2020/09/03 | [
"https://softwareengineering.stackexchange.com/questions/415538",
"https://softwareengineering.stackexchange.com",
"https://softwareengineering.stackexchange.com/users/104636/"
] | There are definitely cases where solving a more general problem than required makes code easier to read, to reason about and to maintain. The most simple example I can think of is when code deals with input data consisting of four or five similar attributes, and the processing code gets duplicated up to 5 times because... | Do you know what exactly your function is going to be working with, or does it even matter?
In the cases of looking at various collections, like a list for example, knowing what the items are within the list may be completely irrelevant (as far as the list itself is concerned). For example, if you want to be able to s... |
415,538 | YAGNI might tell us, that in the below implementation the generic version is not needed, as long as the function is only used once.
But to me personally, it seems, the generic version is more readable because I'm not distracted by all the possibilities the special class has, but are not used. The generic version is ex... | 2020/09/03 | [
"https://softwareengineering.stackexchange.com/questions/415538",
"https://softwareengineering.stackexchange.com",
"https://softwareengineering.stackexchange.com/users/104636/"
] | >
> What it actually does is not that important for this example
>
>
>
* Where you define it is. Sweeping generic utility functions often have no benefit of being part of the class which often implements it. Try this exercise please... **If you move the utility functions to a separate class and the question is act... | In general generics should be considered when you are dealing with a relatively large number of implementations/sub-types of certain family(class/interface), while you introduce a processing/organization layer that deals with the family as whole.
It is a good thing to go for if you are designing a framework and you ha... |
415,538 | YAGNI might tell us, that in the below implementation the generic version is not needed, as long as the function is only used once.
But to me personally, it seems, the generic version is more readable because I'm not distracted by all the possibilities the special class has, but are not used. The generic version is ex... | 2020/09/03 | [
"https://softwareengineering.stackexchange.com/questions/415538",
"https://softwareengineering.stackexchange.com",
"https://softwareengineering.stackexchange.com/users/104636/"
] | In the meantime, I've learned more about the underlying principle, this decision can be based on, and also found a better minimal example. It can be found in this article ("Why a generic implementation can be the easier-to-understand solution"):
* original URL: <https://github.com/Dobiasd/articles/blob/master/why_a_ge... | In general generics should be considered when you are dealing with a relatively large number of implementations/sub-types of certain family(class/interface), while you introduce a processing/organization layer that deals with the family as whole.
It is a good thing to go for if you are designing a framework and you ha... |
415,538 | YAGNI might tell us, that in the below implementation the generic version is not needed, as long as the function is only used once.
But to me personally, it seems, the generic version is more readable because I'm not distracted by all the possibilities the special class has, but are not used. The generic version is ex... | 2020/09/03 | [
"https://softwareengineering.stackexchange.com/questions/415538",
"https://softwareengineering.stackexchange.com",
"https://softwareengineering.stackexchange.com/users/104636/"
] | There are definitely cases where solving a more general problem than required makes code easier to read, to reason about and to maintain. The most simple example I can think of is when code deals with input data consisting of four or five similar attributes, and the processing code gets duplicated up to 5 times because... | In general generics should be considered when you are dealing with a relatively large number of implementations/sub-types of certain family(class/interface), while you introduce a processing/organization layer that deals with the family as whole.
It is a good thing to go for if you are designing a framework and you ha... |
415,538 | YAGNI might tell us, that in the below implementation the generic version is not needed, as long as the function is only used once.
But to me personally, it seems, the generic version is more readable because I'm not distracted by all the possibilities the special class has, but are not used. The generic version is ex... | 2020/09/03 | [
"https://softwareengineering.stackexchange.com/questions/415538",
"https://softwareengineering.stackexchange.com",
"https://softwareengineering.stackexchange.com/users/104636/"
] | There's has been some back and forth in the comments, and my feedback generally boils down to the same argument every time:
Your problem, as you describe it, always starts from the really unusual assumption that you don't know what it is you should be doing and would just interact with random available things *just be... | I do think it depends. If you are the only developer who will touch the code, I would write a generic only if you can actually foresee to, say, greater than 50% probability, usage for multiple types. Otherwise, should that usage become necessary unexpectedly, you know how to rewrite your function as a generic and your ... |
415,538 | YAGNI might tell us, that in the below implementation the generic version is not needed, as long as the function is only used once.
But to me personally, it seems, the generic version is more readable because I'm not distracted by all the possibilities the special class has, but are not used. The generic version is ex... | 2020/09/03 | [
"https://softwareengineering.stackexchange.com/questions/415538",
"https://softwareengineering.stackexchange.com",
"https://softwareengineering.stackexchange.com/users/104636/"
] | I do think it depends. If you are the only developer who will touch the code, I would write a generic only if you can actually foresee to, say, greater than 50% probability, usage for multiple types. Otherwise, should that usage become necessary unexpectedly, you know how to rewrite your function as a generic and your ... | Do you know what exactly your function is going to be working with, or does it even matter?
In the cases of looking at various collections, like a list for example, knowing what the items are within the list may be completely irrelevant (as far as the list itself is concerned). For example, if you want to be able to s... |
57,231,518 | If is working only if the statement is false. when it's right it doesnt do anything.
I first tried with if - else , but my code was never entering the else statement. Then , as you can see i tried with a flag but the same thing is happening.
```php
if (isset($_POST['upload'])){
$filename = $_FILES['file']['na... | 2019/07/27 | [
"https://Stackoverflow.com/questions/57231518",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11845073/"
] | The signature of [`std::max`](https://en.cppreference.com/w/cpp/algorithm/max) is:
```cpp
template< class T >
constexpr const T& max( const T& a, const T& b );
```
So `max` expects both arguments to be of the same type, if they are not fo the same type then you explicitly need set the template argument:
```
std::m... | std::max() accepts parameters that are of the same type.
If you want to compare two variables that are not of the same you will have to cast one into another.
In this case i suggest casting int into long long int so you don't lose anything. |
57,231,518 | If is working only if the statement is false. when it's right it doesnt do anything.
I first tried with if - else , but my code was never entering the else statement. Then , as you can see i tried with a flag but the same thing is happening.
```php
if (isset($_POST['upload'])){
$filename = $_FILES['file']['na... | 2019/07/27 | [
"https://Stackoverflow.com/questions/57231518",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11845073/"
] | Because `std::max` is a function template whose signature is, for example,
```
template< class T >
const T& max( const T& a, const T& b );
```
complete list at: <https://en.cppreference.com/w/cpp/algorithm/max>
Now, when instantiating the template you give two different types but the templates only wants one. You... | std::max() accepts parameters that are of the same type.
If you want to compare two variables that are not of the same you will have to cast one into another.
In this case i suggest casting int into long long int so you don't lose anything. |
2,164,159 | Is there a way in C# to mark a method as being part of a class to satisfy an interface that the class implements? I find myself wondering sometimes when digging in a class's code why some methods are there but then, when I try to remove one since it isn't in use, I see it's necessary in order for the class to implement... | 2010/01/29 | [
"https://Stackoverflow.com/questions/2164159",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/38743/"
] | Maybe you have deeper design issues if your class is implementing methods that you feel should be deleted.
Anyways, Resharper can help you out here.
<http://www.jetbrains.com/resharper/documentation/presentation/overview/code_generation/Generate_demo.htm>
Drag the slider to 10/69 to see the special "Implements inter... | Can you make use of an addin for Visual Studio? This will save you from marking up your code in a way that cannot be validated, but does have the downside that you will not be able to get the information when viewing the code outside of Visual Studio.
[ReSharper](http://www.jetbrains.com/resharper/) adds an icon in th... |
2,164,159 | Is there a way in C# to mark a method as being part of a class to satisfy an interface that the class implements? I find myself wondering sometimes when digging in a class's code why some methods are there but then, when I try to remove one since it isn't in use, I see it's necessary in order for the class to implement... | 2010/01/29 | [
"https://Stackoverflow.com/questions/2164159",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/38743/"
] | Surround them with `#region MyInterface Members` as Visual Studio does for you.
It reduces readability if you use `#region` only for interface members. If on the other hand you use it for private variables, properties, methods, events and different interface members the code will become much more readable. You can als... | Can you make use of an addin for Visual Studio? This will save you from marking up your code in a way that cannot be validated, but does have the downside that you will not be able to get the information when viewing the code outside of Visual Studio.
[ReSharper](http://www.jetbrains.com/resharper/) adds an icon in th... |
2,164,159 | Is there a way in C# to mark a method as being part of a class to satisfy an interface that the class implements? I find myself wondering sometimes when digging in a class's code why some methods are there but then, when I try to remove one since it isn't in use, I see it's necessary in order for the class to implement... | 2010/01/29 | [
"https://Stackoverflow.com/questions/2164159",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/38743/"
] | Surround them with `#region MyInterface Members` as Visual Studio does for you.
It reduces readability if you use `#region` only for interface members. If on the other hand you use it for private variables, properties, methods, events and different interface members the code will become much more readable. You can als... | ```
#region ISomeInterface implementation
public void Foo(){}
public void Bar(){}
#endregion
``` |
2,164,159 | Is there a way in C# to mark a method as being part of a class to satisfy an interface that the class implements? I find myself wondering sometimes when digging in a class's code why some methods are there but then, when I try to remove one since it isn't in use, I see it's necessary in order for the class to implement... | 2010/01/29 | [
"https://Stackoverflow.com/questions/2164159",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/38743/"
] | You have three options:
**Explicitly implement the interface:**
You can [explicitly implement the interface](http://msdn.microsoft.com/en-us/library/aa288461(VS.71).aspx) using the syntax `IInterface.MethodName`, for example:
```
bool IInterface.MethodName(string other)
{
// code
}
```
**Wrap interface member... | Maybe you have deeper design issues if your class is implementing methods that you feel should be deleted.
Anyways, Resharper can help you out here.
<http://www.jetbrains.com/resharper/documentation/presentation/overview/code_generation/Generate_demo.htm>
Drag the slider to 10/69 to see the special "Implements inter... |
2,164,159 | Is there a way in C# to mark a method as being part of a class to satisfy an interface that the class implements? I find myself wondering sometimes when digging in a class's code why some methods are there but then, when I try to remove one since it isn't in use, I see it's necessary in order for the class to implement... | 2010/01/29 | [
"https://Stackoverflow.com/questions/2164159",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/38743/"
] | Surround them with `#region MyInterface Members` as Visual Studio does for you.
It reduces readability if you use `#region` only for interface members. If on the other hand you use it for private variables, properties, methods, events and different interface members the code will become much more readable. You can als... | You can explicitly implement the interface, but then the method won't be available on an instance of the class unless you first cast the class to that interface.
```
public Foo : IDisposable
{
void IDisposable.Dispose()
{
}
}
``` |
2,164,159 | Is there a way in C# to mark a method as being part of a class to satisfy an interface that the class implements? I find myself wondering sometimes when digging in a class's code why some methods are there but then, when I try to remove one since it isn't in use, I see it's necessary in order for the class to implement... | 2010/01/29 | [
"https://Stackoverflow.com/questions/2164159",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/38743/"
] | Surround them with `#region MyInterface Members` as Visual Studio does for you.
It reduces readability if you use `#region` only for interface members. If on the other hand you use it for private variables, properties, methods, events and different interface members the code will become much more readable. You can als... | Another way if your anti region would be to use the documentation comments like so:
```
///<summary>
/// Used for implementation of InterfaceX
///</summary>
public void Foo() {}
``` |
2,164,159 | Is there a way in C# to mark a method as being part of a class to satisfy an interface that the class implements? I find myself wondering sometimes when digging in a class's code why some methods are there but then, when I try to remove one since it isn't in use, I see it's necessary in order for the class to implement... | 2010/01/29 | [
"https://Stackoverflow.com/questions/2164159",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/38743/"
] | Can you make use of an addin for Visual Studio? This will save you from marking up your code in a way that cannot be validated, but does have the downside that you will not be able to get the information when viewing the code outside of Visual Studio.
[ReSharper](http://www.jetbrains.com/resharper/) adds an icon in th... | ```
#region ISomeInterface implementation
public void Foo(){}
public void Bar(){}
#endregion
``` |
2,164,159 | Is there a way in C# to mark a method as being part of a class to satisfy an interface that the class implements? I find myself wondering sometimes when digging in a class's code why some methods are there but then, when I try to remove one since it isn't in use, I see it's necessary in order for the class to implement... | 2010/01/29 | [
"https://Stackoverflow.com/questions/2164159",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/38743/"
] | Surround them with `#region MyInterface Members` as Visual Studio does for you.
It reduces readability if you use `#region` only for interface members. If on the other hand you use it for private variables, properties, methods, events and different interface members the code will become much more readable. You can als... | Maybe you have deeper design issues if your class is implementing methods that you feel should be deleted.
Anyways, Resharper can help you out here.
<http://www.jetbrains.com/resharper/documentation/presentation/overview/code_generation/Generate_demo.htm>
Drag the slider to 10/69 to see the special "Implements inter... |
2,164,159 | Is there a way in C# to mark a method as being part of a class to satisfy an interface that the class implements? I find myself wondering sometimes when digging in a class's code why some methods are there but then, when I try to remove one since it isn't in use, I see it's necessary in order for the class to implement... | 2010/01/29 | [
"https://Stackoverflow.com/questions/2164159",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/38743/"
] | Can you make use of an addin for Visual Studio? This will save you from marking up your code in a way that cannot be validated, but does have the downside that you will not be able to get the information when viewing the code outside of Visual Studio.
[ReSharper](http://www.jetbrains.com/resharper/) adds an icon in th... | You can explicitly implement the interface, but then the method won't be available on an instance of the class unless you first cast the class to that interface.
```
public Foo : IDisposable
{
void IDisposable.Dispose()
{
}
}
``` |
2,164,159 | Is there a way in C# to mark a method as being part of a class to satisfy an interface that the class implements? I find myself wondering sometimes when digging in a class's code why some methods are there but then, when I try to remove one since it isn't in use, I see it's necessary in order for the class to implement... | 2010/01/29 | [
"https://Stackoverflow.com/questions/2164159",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/38743/"
] | Maybe you have deeper design issues if your class is implementing methods that you feel should be deleted.
Anyways, Resharper can help you out here.
<http://www.jetbrains.com/resharper/documentation/presentation/overview/code_generation/Generate_demo.htm>
Drag the slider to 10/69 to see the special "Implements inter... | ```
#region ISomeInterface implementation
public void Foo(){}
public void Bar(){}
#endregion
``` |
27,554,412 | I have a top down 2d game where you walk around shooting bad guys. I want to be able to shoot towards the mouse, no mater what direction it is but I have absolutely no idea how to do this.
Here is my `bullet` class:
```
public class bullet {
public double x, y,dy,dx,mx,my;
public int dir;
public Rectangle r = new R... | 2014/12/18 | [
"https://Stackoverflow.com/questions/27554412",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2279603/"
] | Basicially, you need calculate the angel between the start point and end point, something like...
```
angle = -Math.toDegrees(Math.atan2(startX - endX, startY - endY)) + 180;
```
As an example:
* [Rotating a triangle around a point java](https://stackoverflow.com/questions/27260445/rotating-a-triangle-around-a-poin... | Try using MouseInfo.getPointerInfo().getPosition() ( <http://download.oracle.com/javase/1.5.0/docs/api/java/awt/PointerInfo.html#getLocation%28%29>) It will return a point object.
Use a timer and on every timer event you'll move your bullet a specific length (which you would want it to move) towards the mouse position... |
99,954 | Considering a balanced training set, I noticed that the results of a classification primarily depend on the class imbalance of the test set.
As shown in [this article](https://sinyi-chou.github.io/classification-pr-curve/), unless the classes are perfectly separable, the performance (precision & recall) of a model for... | 2021/08/11 | [
"https://datascience.stackexchange.com/questions/99954",
"https://datascience.stackexchange.com",
"https://datascience.stackexchange.com/users/122876/"
] | Most classification algorithms define a decision boundary between classes. Class imbalances will cause cause the learned decision boundary to have a preference for the majority class. This is preference exists because most loss functions try to minimize average error (this is best done by maximizing performance on the ... | There is a confusion between the "true" performance of the classifier, which is indeed fixed once the classifier is trained, and the observed performance on a particular test set.
The "true" performance can only be estimated, and it should be estimated using a random sample which follows the "true" distribution of the... |
64,446,985 | I am new to Unix and I want to make a copy program that uses CL for compiling it. I get: "file format not recognized; treating as linker script".
This is my code for copying from source file to destination
```
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(int argc, char* argv[]) {
FILE *fsou... | 2020/10/20 | [
"https://Stackoverflow.com/questions/64446985",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12609452/"
] | You are trying to compile the program (that means, making an executable application out of the code) and run it at the same time. You need to compile your application first using:
`gcc 2.c -o programname`
and then execute it via
`./programname source.txt destination.txt` | You supplied the command line arguments which are intended for your program to the gcc compiler, instead. This is wrong. First compile your program using e.g. `gcc 2.c -o mycopy` and then invoke your program by `./mycopy source.txt destination.txt`.
```
$gcc 2.c -o mycopy
$echo "test1234" > source.txt
$cat source.tx... |
5,806,807 | As a Matlab user transitioning to R, I have ran across the problem of applying trigonometric functions to degrees. In Matlab there are trig functions for both radians and degrees (e.g. cos and cosd, respectively). R seems to only include functions for radians, thus requiring me to create my own (see below)
```
cosd<-f... | 2011/04/27 | [
"https://Stackoverflow.com/questions/5806807",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/652069/"
] | Looks like it's working fine to me. The value for pi probably isn't precise enough, so you are getting a very close estimate. If you think about it, 6.123234e-17 and -1.836970e-16 are very very close to 0, which is what the answer should be.
Your problem lies in the fact that while 90\*pi/180 = pi/2 on paper, in compu... | This is a floating point representation error. See Chapter 1 of <http://lib.stat.cmu.edu/s/Spoetry/Tutor/R_inferno.pdf> |
5,806,807 | As a Matlab user transitioning to R, I have ran across the problem of applying trigonometric functions to degrees. In Matlab there are trig functions for both radians and degrees (e.g. cos and cosd, respectively). R seems to only include functions for radians, thus requiring me to create my own (see below)
```
cosd<-f... | 2011/04/27 | [
"https://Stackoverflow.com/questions/5806807",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/652069/"
] | This is floating point arithmetic:
```
> all.equal(cosd(90), 0)
[1] TRUE
> all.equal(cosd(270), 0)
[1] TRUE
```
If that is what you meant by "does not work properly"?
This is also a FAQ: <http://cran.r-project.org/doc/FAQ/R-FAQ.html#Why-doesn_0027t-R-think-these-numbers-are-equal_003f> | This is a floating point representation error. See Chapter 1 of <http://lib.stat.cmu.edu/s/Spoetry/Tutor/R_inferno.pdf> |
5,806,807 | As a Matlab user transitioning to R, I have ran across the problem of applying trigonometric functions to degrees. In Matlab there are trig functions for both radians and degrees (e.g. cos and cosd, respectively). R seems to only include functions for radians, thus requiring me to create my own (see below)
```
cosd<-f... | 2011/04/27 | [
"https://Stackoverflow.com/questions/5806807",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/652069/"
] | Looks like it's working fine to me. The value for pi probably isn't precise enough, so you are getting a very close estimate. If you think about it, 6.123234e-17 and -1.836970e-16 are very very close to 0, which is what the answer should be.
Your problem lies in the fact that while 90\*pi/180 = pi/2 on paper, in compu... | The same reason that
```
1-(1/3)-(1/3)-(1/3)
```
doesn't equal 0. It has something to do with floating point numbers. I'm sure there will be more elaboration. |
5,806,807 | As a Matlab user transitioning to R, I have ran across the problem of applying trigonometric functions to degrees. In Matlab there are trig functions for both radians and degrees (e.g. cos and cosd, respectively). R seems to only include functions for radians, thus requiring me to create my own (see below)
```
cosd<-f... | 2011/04/27 | [
"https://Stackoverflow.com/questions/5806807",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/652069/"
] | This is floating point arithmetic:
```
> all.equal(cosd(90), 0)
[1] TRUE
> all.equal(cosd(270), 0)
[1] TRUE
```
If that is what you meant by "does not work properly"?
This is also a FAQ: <http://cran.r-project.org/doc/FAQ/R-FAQ.html#Why-doesn_0027t-R-think-these-numbers-are-equal_003f> | The same reason that
```
1-(1/3)-(1/3)-(1/3)
```
doesn't equal 0. It has something to do with floating point numbers. I'm sure there will be more elaboration. |
5,806,807 | As a Matlab user transitioning to R, I have ran across the problem of applying trigonometric functions to degrees. In Matlab there are trig functions for both radians and degrees (e.g. cos and cosd, respectively). R seems to only include functions for radians, thus requiring me to create my own (see below)
```
cosd<-f... | 2011/04/27 | [
"https://Stackoverflow.com/questions/5806807",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/652069/"
] | This is floating point arithmetic:
```
> all.equal(cosd(90), 0)
[1] TRUE
> all.equal(cosd(270), 0)
[1] TRUE
```
If that is what you meant by "does not work properly"?
This is also a FAQ: <http://cran.r-project.org/doc/FAQ/R-FAQ.html#Why-doesn_0027t-R-think-these-numbers-are-equal_003f> | Looks like it's working fine to me. The value for pi probably isn't precise enough, so you are getting a very close estimate. If you think about it, 6.123234e-17 and -1.836970e-16 are very very close to 0, which is what the answer should be.
Your problem lies in the fact that while 90\*pi/180 = pi/2 on paper, in compu... |
5,806,807 | As a Matlab user transitioning to R, I have ran across the problem of applying trigonometric functions to degrees. In Matlab there are trig functions for both radians and degrees (e.g. cos and cosd, respectively). R seems to only include functions for radians, thus requiring me to create my own (see below)
```
cosd<-f... | 2011/04/27 | [
"https://Stackoverflow.com/questions/5806807",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/652069/"
] | Looks like it's working fine to me. The value for pi probably isn't precise enough, so you are getting a very close estimate. If you think about it, 6.123234e-17 and -1.836970e-16 are very very close to 0, which is what the answer should be.
Your problem lies in the fact that while 90\*pi/180 = pi/2 on paper, in compu... | You may also be interested in the zapsmall function for another way of showing numbers that are close to 0 as 0. |
5,806,807 | As a Matlab user transitioning to R, I have ran across the problem of applying trigonometric functions to degrees. In Matlab there are trig functions for both radians and degrees (e.g. cos and cosd, respectively). R seems to only include functions for radians, thus requiring me to create my own (see below)
```
cosd<-f... | 2011/04/27 | [
"https://Stackoverflow.com/questions/5806807",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/652069/"
] | This is floating point arithmetic:
```
> all.equal(cosd(90), 0)
[1] TRUE
> all.equal(cosd(270), 0)
[1] TRUE
```
If that is what you meant by "does not work properly"?
This is also a FAQ: <http://cran.r-project.org/doc/FAQ/R-FAQ.html#Why-doesn_0027t-R-think-these-numbers-are-equal_003f> | You may also be interested in the zapsmall function for another way of showing numbers that are close to 0 as 0. |
2,551,218 | Suppose an object is moving in some direction on a 2D plane. Its direction is given as a heading, where 0 degrees is north and 180 degrees is south.
Suppose that I know the object's coordinates are 0,0 (x,y) and that its heading is 90 degrees. To maintain the current heading I know that for each whole unit I move the ... | 2017/12/04 | [
"https://math.stackexchange.com/questions/2551218",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/510148/"
] | The function $f$ you describe is
$f(x,y,a)=(x,y)+\begin{cases}
(1,\cot (a)) & 45\leq a\leq 135 \\
(-\tan (a),-1) & 135\leq a\leq 225 \\
(-1,-\cot (a)) & 225\leq a\leq 315 \\
(\tan (a),1) & \text{else}
\end{cases}$
which is well-defined despite the overlapping conditions. | The function can be written as
$$f(x,y,d)=(x,y)+\begin{cases}
(0,1)\quad &\quad d=0^\circ\\\\
(0,-1)\quad &\quad d=180^\circ\\\\
\left((-1)^{\left\lfloor\frac{d}{180}\right\rfloor},(-1)^{\left\lfloor\frac{d}{180}\right\rfloor}\cot\left(\dfrac{d\pi}{180}\right)\right)\quad &\quad\text{else}\end{cases}$$
where $\lfloor... |
2,551,218 | Suppose an object is moving in some direction on a 2D plane. Its direction is given as a heading, where 0 degrees is north and 180 degrees is south.
Suppose that I know the object's coordinates are 0,0 (x,y) and that its heading is 90 degrees. To maintain the current heading I know that for each whole unit I move the ... | 2017/12/04 | [
"https://math.stackexchange.com/questions/2551218",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/510148/"
] | The function $f$ you describe is
$f(x,y,a)=(x,y)+\begin{cases}
(1,\cot (a)) & 45\leq a\leq 135 \\
(-\tan (a),-1) & 135\leq a\leq 225 \\
(-1,-\cot (a)) & 225\leq a\leq 315 \\
(\tan (a),1) & \text{else}
\end{cases}$
which is well-defined despite the overlapping conditions. | Just to give a little integration to the correct answer by mathlove, since the OP does not specify criteria to decide, for angles that are not multiples of $\pi/4$, whether the integer unit step must be taken in the $x$- or $y$-axis direction. To follow the notation of the OP, I will express angles in degrees. Let us a... |
68,206,264 | How to write JPQL with JOIN FETCH to grab all the **Post** collection and associated tags & items & subitems in one call without N+1 query from database.
Entities
```
@Entity
public class Post {
@Id
private String postId;
private String postName;
@OneToMany(mappedBy = "Post", cascade = CascadeType.ALL)
priv... | 2021/07/01 | [
"https://Stackoverflow.com/questions/68206264",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5144738/"
] | You can use aspectRatio modifier in jetpack compose.
```
modifier = Modifier.aspectRatio(0.75f)
```
It takes two parameters first one is a single float value that represents that aspect ratio. Like If you want to use 3:4 you have to input 3/4f or 3/4 = .75f.
2nd one is optional by default it's false. If you send tr... | You can use the [**`aspectRatio`**](https://developer.android.com/reference/kotlin/androidx/compose/foundation/layout/package-summary#(androidx.compose.ui.Modifier).aspectRatio(kotlin.Float,kotlin.Boolean)) modifier:
```
Image(
painter = painterResource(id = R.drawable.xxx),
"some ignored propertie... |
68,206,264 | How to write JPQL with JOIN FETCH to grab all the **Post** collection and associated tags & items & subitems in one call without N+1 query from database.
Entities
```
@Entity
public class Post {
@Id
private String postId;
private String postName;
@OneToMany(mappedBy = "Post", cascade = CascadeType.ALL)
priv... | 2021/07/01 | [
"https://Stackoverflow.com/questions/68206264",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5144738/"
] | The problem with using `Modifier.aspectRatio` is that it doesn't seem to be taken into account when using other constraints. Aspect ratios are actually supported by ConstraintLayout itself
Take this layout for example, we constrain one dimension as a ratio of 16:9
```
ConstraintLayout(modifier = Modifier.fillMaxSize(... | You can use the [**`aspectRatio`**](https://developer.android.com/reference/kotlin/androidx/compose/foundation/layout/package-summary#(androidx.compose.ui.Modifier).aspectRatio(kotlin.Float,kotlin.Boolean)) modifier:
```
Image(
painter = painterResource(id = R.drawable.xxx),
"some ignored propertie... |
28,734 | I read an essay by John Mason about the principles of the harmony of prose numbers (or feet). I am wondering whether it is of any use, considering other books I have read say that treating prose rhythm in terms of metrical feet has been a failure.
If one wants to write in a certain voice, requiring them to select and ... | 2017/06/15 | [
"https://writers.stackexchange.com/questions/28734",
"https://writers.stackexchange.com",
"https://writers.stackexchange.com/users/25421/"
] | Prose cadence has mostly to do with making the emphasis in a sentence fall on the most important words:
>
> But, in a larger sense, we can not dedicate—we can not consecrate—we can not hallow—this ground. The brave men, living and dead, who struggled here, have consecrated it, far above our poor power to add or detra... | Perhaps the most famous use of cadence is Shakespeare with iambic pentameter. However, he strayed from it often. Was it based simply on ear? I don't think so. It was the mood he was trying to convey.
Poetry is an entity onto itself. Take E.E. Cummins. Marshy-mushy.
In fictional prose, **if you're not setting a mood o... |
28,734 | I read an essay by John Mason about the principles of the harmony of prose numbers (or feet). I am wondering whether it is of any use, considering other books I have read say that treating prose rhythm in terms of metrical feet has been a failure.
If one wants to write in a certain voice, requiring them to select and ... | 2017/06/15 | [
"https://writers.stackexchange.com/questions/28734",
"https://writers.stackexchange.com",
"https://writers.stackexchange.com/users/25421/"
] | Prose cadence has mostly to do with making the emphasis in a sentence fall on the most important words:
>
> But, in a larger sense, we can not dedicate—we can not consecrate—we can not hallow—this ground. The brave men, living and dead, who struggled here, have consecrated it, far above our poor power to add or detra... | Yes, I'd pretty much go with your ear. I could explain the technicalities of cadence and pacing but it's pretty much like dancing - if you think about too much while your doing do it . . . it's rarely pretty.
Experience in poetry helps. It helps with balance and rhythm. |
19,681,290 | I've developed an application for sending SMS messages, using BroadcastReceivers for sent and (not) delivered messages successfully.
In my delivery receiver, I would like to get time, when the message was delivered to target recipient. As both sending and receiving device can be turned off occasionally, I assume, that... | 2013/10/30 | [
"https://Stackoverflow.com/questions/19681290",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1041723/"
] | Here is a working solution.
By studying the source code of [com.android.internal.telephony.gsm.SmsMessage](http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android/5.1.0_r1/com/android/internal/telephony/gsm/SmsMessage.java) class (which is Android's internal class that deals with parsing S... | Have not tried but you can see if that information is in the extra "pdus" of intent passed to BroadcastReceiver
```
@Override
public void onReceive(Context context, Intent intent) {
Bundle bundle=intent.getExtras();
Object[] messages=(Object[])bundle.get("pdus");
SmsMessage[] sms=new SmsMessage[messages... |
295,470 | For Sharepoint modern Team site, is there a way to auto update on change of the group member?
let's say, a permission group generated based on department, hence, any new member on board or staff offboard for that particular department, change will be reflected automatically in the permission group. | 2021/07/22 | [
"https://sharepoint.stackexchange.com/questions/295470",
"https://sharepoint.stackexchange.com",
"https://sharepoint.stackexchange.com/users/97542/"
] | According to <https://docs.microsoft.com/openspecs/sharepoint_protocols/ms-listsws/65c0df83-47b8-4b0e-a195-2a6c22a4cfe8> , owshiddenversion is used for conflict detection, and according to <https://learn.microsoft.com/da-dk/openspecs/sharepoint_protocols/ms-wssfo/20d052c8-4aa6-452d-bef4-2713578a74f2> , \_UIVersion is t... | You can find the official documentation at:
[2.2.7.3 AllUserData Table](https://docs.microsoft.com/openspecs/sharepoint_protocols/ms-wssfo/20d052c8-4aa6-452d-bef4-2713578a74f2)
[3.1.4.31.2.1 UpdateListItems](https://docs.microsoft.com/openspecs/sharepoint_protocols/ms-listsws/65c0df83-47b8-4b0e-a195-2a6c22a4cfe8) |
311,661 | For a complex number $\displaystyle z$, How to evaluate
$$\int\_0^\infty\frac{\text{d}x}{x^2+(1-z^2x^2)^2}$$ | 2013/02/23 | [
"https://math.stackexchange.com/questions/311661",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/58196/"
] | A [related problem](https://math.stackexchange.com/questions/262321/fourier-transform-of-fx-frac1x26x13/262670#262670). Here is the idea, since the integrand is an even function, then we can write the integral as
$$ \int\_0^\infty\frac{\text{d}x}{x^2+(1-z^2x^2)^2}=\frac{1}{2}\int\_{-\infty}^{\infty}\frac{\text{d}x}{x^... | By the quadratic formula, the denominator of the integrand has roots
$$\begin{align}
r\_1,r\_2,r\_3,r\_4 &= \pm\sqrt{\frac{2z^2-1\pm\sqrt{1-4z^2}}{2z^4}}\\
&=\frac{\pm1}{2z^2}\left(i\pm\sqrt{4z^2-1}\right)
\end{align}$$
and since the integrand is an even function,
$$\begin{align}
\int\_0^\infty \frac{dx}{x^2+(1-z^2x^... |
67,290,525 | I need create new variable based od existing variable in pandas dataframe. This run ok:
```
xxx = pd.DataFrame({'indsplit': [' km', 11, 12], 'week': [1, 1, 1]})
xxx = xxx.assign(
week2 = lambda dataframe: xxx['indsplit'].map(lambda indsplit: 10 if indsplit == ' km'
... | 2021/04/27 | [
"https://Stackoverflow.com/questions/67290525",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7676365/"
] | If you need to, just define a real function using `def` and pass that instead of using an inline lambda.
```
def mycriteria(indsplit):
if indssplit == ' km':
return 10
if indspllit == 11:
return 15
return 20
...
xxx = xxx.assign( week2 = lambd dataframe: xxx['indsplit'].map(mycriteria) )
`... | There is no direct `if-elif-else` statement in Python lambda function. You can use nested `if-else` instead.
```py
xxx = xxx.assign(week2 = lambda dataframe: xxx['indsplit'].map(lambda indsplit:
10 if indsplit == ' km'
... |
97,967 | I don't know if i choose the correct title.
Here's my probleme, I've created a module in wich I can put my js/css (<http://img4.hostingpics.net/pics/586674moduleJs.png>) and I would like to get the id of my html elements. Sharepoint is adding some kind of matrix characters to my elements ID's and each of them look sim... | 2014/05/05 | [
"https://sharepoint.stackexchange.com/questions/97967",
"https://sharepoint.stackexchange.com",
"https://sharepoint.stackexchange.com/users/25007/"
] | If you are using SharePoint 2007/2010, you can inherit from OOB field types and create a new field type. Following articles can help you get started:
[http://msdn.microsoft.com/en-us/library/office/bb861799(v=office.14).aspx](http://msdn.microsoft.com/en-us/library/office/bb861799%28v=office.14%29.aspx)
<http://weblog... | It depends, deploying custom field types is not supported for SharePoint Online.
According to [MSDN](http://msdn.microsoft.com/en-us/library/gg615464.aspx):
>
> Only fields that use a built-in SharePoint Foundation field type, or a
> custom field type that is previously installed in a farm solution, are
> possib... |
11,137,214 | System Spec:
VPS running Windows Server 2008 R2 SP1
64-bit dual core 2.39GHz VCPU
2GB RAM
Parallels Plesk for Windows 10.4.4
IIS 7.5
PHP 5.2.17
MySQL 5.1.56
I have a PHP script to loop through a static file and import each line as a row in MySQL. This works fine if the file is split into several thousand lines at a ti... | 2012/06/21 | [
"https://Stackoverflow.com/questions/11137214",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1469709/"
] | Remove the Content-Length and also have Flush() and then End() in your code, do not use Close() at the end of your code, you can use that before you declare everything. Octet-stream is generally used when you do not know what the file type will be, so stay away from that if you know what the file type will be. Use appl... | have you tried `Application/octet-stream` as the MIME-type?
or
```
private void WriteStreamToResponse(MemoryStream ms)
{
if (ms.Length > 0)
{
byte[] byteArray = ms.ToArray();
ms.Flush();
ms.Close();
string filename = DateTime.Now.ToFileTime().ToString() + ".zip";
Respo... |
52,131,241 | Thanks in advance for reading this. I can't wrap my head around it and it's getting quite frustrating by now.
We have the following registration form:
```
class RegistrationForm(forms.ModelForm):
class Meta:
model = Register
fields = ('name', 'company_name')
def clean(self):
if is not... | 2018/09/01 | [
"https://Stackoverflow.com/questions/52131241",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4003617/"
] | >
> why reference to pointer pf? In my understanding necesseary for allocation
>
>
>
That is an incorrect understanding. `pf` is a pointer to a function. Its return type is `std::ostream&` and the only argument is also a `std::ostream&`.
>
> why the second (ostream&)?
>
>
>
The function gets called using an ... | `pf` is a function pointer (whose single argument and return value are each a reference to `ostream`), not a reference to anything.
This is used to implement *manipulators* like `endl`. |
1,327,097 | Is there a reliable way to remove/disable/terminate the built-in "feature", CapsLock delay?
* Setting the CapsLock key to 'None' in Keyboard Modifier keys... settings, saving, then setting CapsLock to CapsLock again - didn't work.
* Enabling Slow keys and setting key repeat to 0 is not a viable solution as it makes th... | 2018/05/30 | [
"https://superuser.com/questions/1327097",
"https://superuser.com",
"https://superuser.com/users/766360/"
] | I've found a solution.
Karabiner Elements, ver. 11.6.0 works great (do not use any >11.6.0 ver. for this) as it has, in 'Virtual keyboard' section, Capslock delay field where the default value is set to 0.
Karabiner be blessed.
KE download: <https://pqrs.org/osx/karabiner/> | If you don't like to use Karabiner for that, I've written a very small, open source tool just for that:
<https://github.com/gkpln3/CapsLockNoDelay> |
30,091 | Intuitively, there is a clear difference between knowing something and understanding something. We speak of someone 'getting' or 'internalizing' a concept, of developing a 'gut feeling' for something, etc...
Some examples:
* When I was an undergrad, for a time I knew the exact definition of a [Fourier transform](htt... | 2015/11/30 | [
"https://philosophy.stackexchange.com/questions/30091",
"https://philosophy.stackexchange.com",
"https://philosophy.stackexchange.com/users/13808/"
] | Greek Distinction
=================
I think there have been *several* perhaps innumerable attempts to look at different modes of "knowing" in philosophy (here reading know as a larger category word for know, understand, comprehend, fathom). Obviously, the oldest one we have a substantial amount of writing from is Plat... | 1. To 'understand' something is an extension of 'knowing' something. The distinction between 'knowing' and 'understanding' lies in the ability to deduce further from the initial concept. One for example could know the geometric definition of a square i.e. four sides of which all equal in length. However this does not m... |
30,091 | Intuitively, there is a clear difference between knowing something and understanding something. We speak of someone 'getting' or 'internalizing' a concept, of developing a 'gut feeling' for something, etc...
Some examples:
* When I was an undergrad, for a time I knew the exact definition of a [Fourier transform](htt... | 2015/11/30 | [
"https://philosophy.stackexchange.com/questions/30091",
"https://philosophy.stackexchange.com",
"https://philosophy.stackexchange.com/users/13808/"
] | Greek Distinction
=================
I think there have been *several* perhaps innumerable attempts to look at different modes of "knowing" in philosophy (here reading know as a larger category word for know, understand, comprehend, fathom). Obviously, the oldest one we have a substantial amount of writing from is Plat... | Wittgenstein investigates these words throughout his Philosophical Investigations and I highly recommend reading it.
A method that he advocates repeatedly is to investigate and **look** how words are used in the language:
>
> For a large class of cases of the employment of the word “meaning” — though not for all — t... |
30,091 | Intuitively, there is a clear difference between knowing something and understanding something. We speak of someone 'getting' or 'internalizing' a concept, of developing a 'gut feeling' for something, etc...
Some examples:
* When I was an undergrad, for a time I knew the exact definition of a [Fourier transform](htt... | 2015/11/30 | [
"https://philosophy.stackexchange.com/questions/30091",
"https://philosophy.stackexchange.com",
"https://philosophy.stackexchange.com/users/13808/"
] | The words "knowledge" and "understanding" are very difficult in the English language. I've even found contrasting documents: one that uses them one way, and one that uses them in almost the exact same way but swapping their meanings! Accordingly, I recommend questioning the author's intent of the words when you see the... | Wittgenstein investigates these words throughout his Philosophical Investigations and I highly recommend reading it.
A method that he advocates repeatedly is to investigate and **look** how words are used in the language:
>
> For a large class of cases of the employment of the word “meaning” — though not for all — t... |
30,091 | Intuitively, there is a clear difference between knowing something and understanding something. We speak of someone 'getting' or 'internalizing' a concept, of developing a 'gut feeling' for something, etc...
Some examples:
* When I was an undergrad, for a time I knew the exact definition of a [Fourier transform](htt... | 2015/11/30 | [
"https://philosophy.stackexchange.com/questions/30091",
"https://philosophy.stackexchange.com",
"https://philosophy.stackexchange.com/users/13808/"
] | Knowing a definition, is only a knowing a definition...
To know how to use it, is a *techne*; but it isn't one until a certain level of fluency is reached - and there are degrees of such. This is *know-how*.
To understand why this definition, as opposed to something similar; for example in your Fourier example - why ... | 1. To 'understand' something is an extension of 'knowing' something. The distinction between 'knowing' and 'understanding' lies in the ability to deduce further from the initial concept. One for example could know the geometric definition of a square i.e. four sides of which all equal in length. However this does not m... |
30,091 | Intuitively, there is a clear difference between knowing something and understanding something. We speak of someone 'getting' or 'internalizing' a concept, of developing a 'gut feeling' for something, etc...
Some examples:
* When I was an undergrad, for a time I knew the exact definition of a [Fourier transform](htt... | 2015/11/30 | [
"https://philosophy.stackexchange.com/questions/30091",
"https://philosophy.stackexchange.com",
"https://philosophy.stackexchange.com/users/13808/"
] | Greek Distinction
=================
I think there have been *several* perhaps innumerable attempts to look at different modes of "knowing" in philosophy (here reading know as a larger category word for know, understand, comprehend, fathom). Obviously, the oldest one we have a substantial amount of writing from is Plat... | I will build by answer more on a analytic tradition as it is described in EPM by Wilfried Sellars. [This SEP article](http://plato.stanford.edu/entries/knowledge-acquaindescrip/) can be seen as strongly related, but I will more go the line of logic rather than justifiability.
First, knowledge, in this tradition, is kn... |
30,091 | Intuitively, there is a clear difference between knowing something and understanding something. We speak of someone 'getting' or 'internalizing' a concept, of developing a 'gut feeling' for something, etc...
Some examples:
* When I was an undergrad, for a time I knew the exact definition of a [Fourier transform](htt... | 2015/11/30 | [
"https://philosophy.stackexchange.com/questions/30091",
"https://philosophy.stackexchange.com",
"https://philosophy.stackexchange.com/users/13808/"
] | Greek Distinction
=================
I think there have been *several* perhaps innumerable attempts to look at different modes of "knowing" in philosophy (here reading know as a larger category word for know, understand, comprehend, fathom). Obviously, the oldest one we have a substantial amount of writing from is Plat... | Knowing a definition, is only a knowing a definition...
To know how to use it, is a *techne*; but it isn't one until a certain level of fluency is reached - and there are degrees of such. This is *know-how*.
To understand why this definition, as opposed to something similar; for example in your Fourier example - why ... |
30,091 | Intuitively, there is a clear difference between knowing something and understanding something. We speak of someone 'getting' or 'internalizing' a concept, of developing a 'gut feeling' for something, etc...
Some examples:
* When I was an undergrad, for a time I knew the exact definition of a [Fourier transform](htt... | 2015/11/30 | [
"https://philosophy.stackexchange.com/questions/30091",
"https://philosophy.stackexchange.com",
"https://philosophy.stackexchange.com/users/13808/"
] | Knowing a definition, is only a knowing a definition...
To know how to use it, is a *techne*; but it isn't one until a certain level of fluency is reached - and there are degrees of such. This is *know-how*.
To understand why this definition, as opposed to something similar; for example in your Fourier example - why ... | I will build by answer more on a analytic tradition as it is described in EPM by Wilfried Sellars. [This SEP article](http://plato.stanford.edu/entries/knowledge-acquaindescrip/) can be seen as strongly related, but I will more go the line of logic rather than justifiability.
First, knowledge, in this tradition, is kn... |
30,091 | Intuitively, there is a clear difference between knowing something and understanding something. We speak of someone 'getting' or 'internalizing' a concept, of developing a 'gut feeling' for something, etc...
Some examples:
* When I was an undergrad, for a time I knew the exact definition of a [Fourier transform](htt... | 2015/11/30 | [
"https://philosophy.stackexchange.com/questions/30091",
"https://philosophy.stackexchange.com",
"https://philosophy.stackexchange.com/users/13808/"
] | Wittgenstein investigates these words throughout his Philosophical Investigations and I highly recommend reading it.
A method that he advocates repeatedly is to investigate and **look** how words are used in the language:
>
> For a large class of cases of the employment of the word “meaning” — though not for all — t... | I will build by answer more on a analytic tradition as it is described in EPM by Wilfried Sellars. [This SEP article](http://plato.stanford.edu/entries/knowledge-acquaindescrip/) can be seen as strongly related, but I will more go the line of logic rather than justifiability.
First, knowledge, in this tradition, is kn... |
30,091 | Intuitively, there is a clear difference between knowing something and understanding something. We speak of someone 'getting' or 'internalizing' a concept, of developing a 'gut feeling' for something, etc...
Some examples:
* When I was an undergrad, for a time I knew the exact definition of a [Fourier transform](htt... | 2015/11/30 | [
"https://philosophy.stackexchange.com/questions/30091",
"https://philosophy.stackexchange.com",
"https://philosophy.stackexchange.com/users/13808/"
] | The words "knowledge" and "understanding" are very difficult in the English language. I've even found contrasting documents: one that uses them one way, and one that uses them in almost the exact same way but swapping their meanings! Accordingly, I recommend questioning the author's intent of the words when you see the... | Knowing a definition, is only a knowing a definition...
To know how to use it, is a *techne*; but it isn't one until a certain level of fluency is reached - and there are degrees of such. This is *know-how*.
To understand why this definition, as opposed to something similar; for example in your Fourier example - why ... |
30,091 | Intuitively, there is a clear difference between knowing something and understanding something. We speak of someone 'getting' or 'internalizing' a concept, of developing a 'gut feeling' for something, etc...
Some examples:
* When I was an undergrad, for a time I knew the exact definition of a [Fourier transform](htt... | 2015/11/30 | [
"https://philosophy.stackexchange.com/questions/30091",
"https://philosophy.stackexchange.com",
"https://philosophy.stackexchange.com/users/13808/"
] | The words "knowledge" and "understanding" are very difficult in the English language. I've even found contrasting documents: one that uses them one way, and one that uses them in almost the exact same way but swapping their meanings! Accordingly, I recommend questioning the author's intent of the words when you see the... | I will build by answer more on a analytic tradition as it is described in EPM by Wilfried Sellars. [This SEP article](http://plato.stanford.edu/entries/knowledge-acquaindescrip/) can be seen as strongly related, but I will more go the line of logic rather than justifiability.
First, knowledge, in this tradition, is kn... |
66,183,706 | I am attempting to create a function that takes an object and returns an array with the highest and lowest keys. My problem is the array does not have the highest value but instead the second highest value? My code is below and even when I add a second while value (another loop for max) it still comes up with the secon... | 2021/02/13 | [
"https://Stackoverflow.com/questions/66183706",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15202626/"
] | As others have stated, object properties that represent integer index numbers are actually strings, and so comparing them will give the result of a *string* comparison.
If your object has only such index properties -- i.e. non-negative integers up to 232−1 in standard decimal representation -- then they will be iterat... | Try using `Object.keys` and `Math.[min/max]` to determine the minimum and maximum value. Or sort the keys and return the first and last value of the result (`minMax` in the snippet).
The keys of an object are always `String`, so they must be converted to `Number` before you can use them as such. [From MDN](https://dev... |
66,183,706 | I am attempting to create a function that takes an object and returns an array with the highest and lowest keys. My problem is the array does not have the highest value but instead the second highest value? My code is below and even when I add a second while value (another loop for max) it still comes up with the secon... | 2021/02/13 | [
"https://Stackoverflow.com/questions/66183706",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15202626/"
] | As others have stated, object properties that represent integer index numbers are actually strings, and so comparing them will give the result of a *string* comparison.
If your object has only such index properties -- i.e. non-negative integers up to 232−1 in standard decimal representation -- then they will be iterat... | Objects store their keys as strings or [Symbols](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol). As a result, when you iterate the keys of your object, your `i` will be a string and not a number. As you're comparing the string versions of your numbers, your comparison will give... |
38,584,759 | Hello i'm beginner in SQL and i do not understand how to:
```
select product from category where id='1'.
```
I have 3 tables:
```
product: id | name
category: id | name
category_product: product_id | category_id
``` | 2016/07/26 | [
"https://Stackoverflow.com/questions/38584759",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6584869/"
] | Then you can use
delete $cookies['userName '];
Hope this answers your question it depends upon different versions. | >
> At your login function(as soon as u click on login) place `$rootScope.login= 1;` and on your login screen controller after you set new cookie place-
>
>
>
```
if ($rootScope.loin=== 1){
window.location.reload();
}
```
>
> After above code set ur scope from cookie.
>
>
> |
12,091,534 | Currently I'm checking the app version code on launch and match it with latest version code on my server and based on this matching I send user to get latest update from Android market.
It's working well but my problem is that I have to manually change the latest version code on my server and I don't know exactly when... | 2012/08/23 | [
"https://Stackoverflow.com/questions/12091534",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1206201/"
] | Google Play does not provide any official APIs for retrieving metadata. You could however, check the unofficial API at <http://code.google.com/p/android-market-api/>.
Specifically, take a look at the Wiki page [HowToSearchApps](http://code.google.com/p/android-market-api/wiki/HowToSearchApps). The response to the que... | We can do pattern matching for getting the app version from playStore.
To match the latest pattern from google playstore ie
`<div class="BgcNfc">Current Version</div><span class="htlgb"><div><span class="htlgb">X.X.X</span></div>`
we first have to match the above node sequence and then from above sequence get the v... |
32,987,621 | Visual Studio Code is highly customizable in its key bindings, especially when it comes to contextual bindings (using `"when"` to bind the same shortcut to different commands in different contexts).
I'm looking for a **list of variables that can be used in those `"when"` conditions**. (There is a great [list of comman... | 2015/10/07 | [
"https://Stackoverflow.com/questions/32987621",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1168892/"
] | These are hopefully all variables that can be used in `when` conditions:
```
editorFocus
editorHasMultipleSelections
editorHasSelection
editorLangId == 'name' // for example: editorLangId == 'typescript'
editorTabMovesFocus
editorTextFocus
findWidgetVisible
globalMessageVisible
hasWordHighlights
inChangeAllMode
inDeb... | Updated. April 2019 (version 1.34)
==================================
List of all variables that can be used in [when](https://code.visualstudio.com/docs/getstarted/keybindings#_when-clause-contexts) conditions in **version 1.34**:
```
acceptSuggestionOnEnter
accessibilityHelpWidgetVisible
activeEditor
activeEditorGr... |
32,987,621 | Visual Studio Code is highly customizable in its key bindings, especially when it comes to contextual bindings (using `"when"` to bind the same shortcut to different commands in different contexts).
I'm looking for a **list of variables that can be used in those `"when"` conditions**. (There is a great [list of comman... | 2015/10/07 | [
"https://Stackoverflow.com/questions/32987621",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1168892/"
] | These are hopefully all variables that can be used in `when` conditions:
```
editorFocus
editorHasMultipleSelections
editorHasSelection
editorLangId == 'name' // for example: editorLangId == 'typescript'
editorTabMovesFocus
editorTextFocus
findWidgetVisible
globalMessageVisible
hasWordHighlights
inChangeAllMode
inDeb... | The `when clause` documentation has been moved to [when clause contexts](https://code.visualstudio.com/api/references/when-clause-contexts).
But it is essentially the same info as was available before and does not provide much of a list of available contexts unfortunately.
Your best bet is to use the `Developer: Insp... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.