qid int64 1 74.7M | question stringlengths 0 58.3k | date stringlengths 10 10 | metadata list | response_j stringlengths 2 48.3k | response_k stringlengths 2 40.5k |
|---|---|---|---|---|---|
1,986,872 | I'm porting a Delphi 5 app to D2010, and I've got a bit of a problem. On one form is a TImage component with an OnMouseMove event that's supposed to update a label whenever the mouse is moved over the image. This worked just fine in the original app, but now the OnMouseMove event fires constantly whenever the mouse is ... | 2009/12/31 | [
"https://Stackoverflow.com/questions/1986872",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/32914/"
] | *My psychic debugging sense tells me that you are on Windows, the label is a tooltip window and you are updating on every mousemove.*
In all seriousness, I've seen this exact thing with tooltip window when we switched to Vista. It seems that more recent versions of the Windows tooltip window somehow generate WM\_MOUSE... | Since I couldn't add a comment I'm using the answer section to confirm this behavior change. I have a project that was developed in Delphi 2007 where the `OnMouseMove` event is only called when the mouse position changes. I found that with XE `OnMouseMove` is constantly being called for the same code. I don't know why ... |
1,986,872 | I'm porting a Delphi 5 app to D2010, and I've got a bit of a problem. On one form is a TImage component with an OnMouseMove event that's supposed to update a label whenever the mouse is moved over the image. This worked just fine in the original app, but now the OnMouseMove event fires constantly whenever the mouse is ... | 2009/12/31 | [
"https://Stackoverflow.com/questions/1986872",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/32914/"
] | Since I couldn't add a comment I'm using the answer section to confirm this behavior change. I have a project that was developed in Delphi 2007 where the `OnMouseMove` event is only called when the mouse position changes. I found that with XE `OnMouseMove` is constantly being called for the same code. I don't know why ... | Mason, I can't reproduce this is a new D2010 (Update 4 & 5) VCL Forms application on Windows XP SP2. Here's what I did:
* File|New|VCL Forms Application
* Dropped a TImage and TLabel on the form
* Picked a random image out of the default images folder (GreenBar.bmp) for the TImage.Picture
* Double-clicked the TImage.O... |
32,123,637 | I am using the below code to open a pdf file but its not working-
```
<iframe src="file:///C:\Users\Downloads\0895custbill08132015.pdf" style="height: 638px;" frameborder="0"></iframe>
```
For a google doc the below code is working fine, I am not sure what is required to open a locally saved doc.
```
<iframe src="h... | 2015/08/20 | [
"https://Stackoverflow.com/questions/32123637",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5248452/"
] | Most browsers won't let you open a locally stored file from a website for security reasons. Typically I will host the file on an IIS server and then retrieve it from there (which is what you're doing when you're retrieving it from googledoc). | You are using backslashes in your `src`. Please change them to slashes
```
<iframe src="file:///C:/Users/Downloads/0895custbill08132015.pdf" style="height: 638px;" frameborder="0"></iframe>
``` |
32,123,637 | I am using the below code to open a pdf file but its not working-
```
<iframe src="file:///C:\Users\Downloads\0895custbill08132015.pdf" style="height: 638px;" frameborder="0"></iframe>
```
For a google doc the below code is working fine, I am not sure what is required to open a locally saved doc.
```
<iframe src="h... | 2015/08/20 | [
"https://Stackoverflow.com/questions/32123637",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5248452/"
] | Most browsers won't let you open a locally stored file from a website for security reasons. Typically I will host the file on an IIS server and then retrieve it from there (which is what you're doing when you're retrieving it from googledoc). | You can use
var pdf = $('\<\object type="application/pdf">');
pdf.attr('data', "you pdf scr");
append it in your iframe.. |
390,186 | Is there any admin setting in salesforce where child records are automatically deleted when the parent record is deleted when it is a lookup relationship? | 2022/11/17 | [
"https://salesforce.stackexchange.com/questions/390186",
"https://salesforce.stackexchange.com",
"https://salesforce.stackexchange.com/users/124977/"
] | You can use **Cascade Delete Feature**.
>
> Cascade Delete Feature Provides Lookup Relationships the same cascading delete functionality previously only available to Master Detail Relationships
>
>
>
However, be careful with it:
>
> Cascade delete, while useful for intentional deletions, increases the number of... | By using `cascade-delete` option you can able to delete the child records for lookup relationship and you need to contact salesforce support to enable `cascade-delete` feature.
Delete this record also Available only if a custom object contains the lookup relationship, not if it’s contained by a standard object. Howeve... |
26,675,636 | I have an ES index that contains parameter data from some scientific experiments.
I have the following terms aggregation:
```
{
"aggs": {
"variables": {
"terms": {
"field": "value",
"size": 100
}
}
},
"size": 0
}
```
Which returns a... | 2014/10/31 | [
"https://Stackoverflow.com/questions/26675636",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2321244/"
] | finally my error solveed but that is not exact solution what i wanted. what i did i have created one new project and took min sdk version is 15 bcoz action bar feature is present in 15 and further api .i think that feature introduced in 11 api .so i have taken new project with min sdk version and then no need of appcom... | you have not added the appcompat\_v7 library properly
check whether you have the library in Right click your project->properties->select android->appcompact lib (this library should be refered you are missing this one)
So follow these Steps:-
1)Right-click your project and select Properties.
2)In the category panel... |
26,675,636 | I have an ES index that contains parameter data from some scientific experiments.
I have the following terms aggregation:
```
{
"aggs": {
"variables": {
"terms": {
"field": "value",
"size": 100
}
}
},
"size": 0
}
```
Which returns a... | 2014/10/31 | [
"https://Stackoverflow.com/questions/26675636",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2321244/"
] | you have not added the appcompat\_v7 library properly
check whether you have the library in Right click your project->properties->select android->appcompact lib (this library should be refered you are missing this one)
So follow these Steps:-
1)Right-click your project and select Properties.
2)In the category panel... | Yes this thing was coming to me too since too days.
Go to your Project Properties
and select that android api version that all things is downloaded with you in sdk for example in my case api 17 I choose and in sdk I have everything installed.

I also did o... |
26,675,636 | I have an ES index that contains parameter data from some scientific experiments.
I have the following terms aggregation:
```
{
"aggs": {
"variables": {
"terms": {
"field": "value",
"size": 100
}
}
},
"size": 0
}
```
Which returns a... | 2014/10/31 | [
"https://Stackoverflow.com/questions/26675636",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2321244/"
] | you have not added the appcompat\_v7 library properly
check whether you have the library in Right click your project->properties->select android->appcompact lib (this library should be refered you are missing this one)
So follow these Steps:-
1)Right-click your project and select Properties.
2)In the category panel... | appcompat\_v7 -> project.properties ,I have changed the target =19 to target=21 . Then refreshed the project ,that fixed my issue.
Reference:
[Got an error while building a project in new workspace](https://stackoverflow.com/questions/26623083/got-an-error-while-building-a-project-in-new-workspace) |
26,675,636 | I have an ES index that contains parameter data from some scientific experiments.
I have the following terms aggregation:
```
{
"aggs": {
"variables": {
"terms": {
"field": "value",
"size": 100
}
}
},
"size": 0
}
```
Which returns a... | 2014/10/31 | [
"https://Stackoverflow.com/questions/26675636",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2321244/"
] | finally my error solveed but that is not exact solution what i wanted. what i did i have created one new project and took min sdk version is 15 bcoz action bar feature is present in 15 and further api .i think that feature introduced in 11 api .so i have taken new project with min sdk version and then no need of appcom... | Yes this thing was coming to me too since too days.
Go to your Project Properties
and select that android api version that all things is downloaded with you in sdk for example in my case api 17 I choose and in sdk I have everything installed.

I also did o... |
26,675,636 | I have an ES index that contains parameter data from some scientific experiments.
I have the following terms aggregation:
```
{
"aggs": {
"variables": {
"terms": {
"field": "value",
"size": 100
}
}
},
"size": 0
}
```
Which returns a... | 2014/10/31 | [
"https://Stackoverflow.com/questions/26675636",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2321244/"
] | finally my error solveed but that is not exact solution what i wanted. what i did i have created one new project and took min sdk version is 15 bcoz action bar feature is present in 15 and further api .i think that feature introduced in 11 api .so i have taken new project with min sdk version and then no need of appcom... | appcompat\_v7 -> project.properties ,I have changed the target =19 to target=21 . Then refreshed the project ,that fixed my issue.
Reference:
[Got an error while building a project in new workspace](https://stackoverflow.com/questions/26623083/got-an-error-while-building-a-project-in-new-workspace) |
45,044,526 | I'm trying to fix a CSV file that has a trailing `,\r\n` in it. No matter what I do, it simply doesn't do anything. I tried putting the expression in `[]` which makes it replace every single comma. That implies that the issue is that it can't match the newline character.
I have saved the file with Windows line endings... | 2017/07/11 | [
"https://Stackoverflow.com/questions/45044526",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1142368/"
] | PowerShell turns out to be quite... *special*.
`Get-Content` by default returns an array of strings. It finds all new line characters and uses them to split the input into said array. Meaning there are no new lines present for the regexp to match.
A slight variation of this command using the `-Raw` parameter fixed m... | Indeed, **[`Get-Content`](https://learn.microsoft.com/powershell/module/microsoft.powershell.management/get-content) by defaults reads and emits the input file's content *line by line*, with newlines of any flavor - CRLF, LF, CR - *stripped***.
While the behavior may be *unfamiliar*, is *generally helpful* for process... |
55,876,067 | For my program i am asking the user for a zip code. I am trying to make the program ask the user for their zip code again if the one they typed in isn't only numbers and is exactly 5 characters. It does ask for the zip code again if it isn't 5 characters, but it doesn't ask again if the user typed in something that isn... | 2019/04/26 | [
"https://Stackoverflow.com/questions/55876067",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11418059/"
] | isnumeric checks the entire string, so it's just:
```
while not zipcode.isnumeric() or not len(zipcode) == 5:
...
``` | You need to call the `all()` function to return the result of testing all the characters in `zipcode`. Your list comprehension produces a generator, which will always be truthy.
And the correct function is `isdigit`, not `isnumber`.
```
while ziplen != 5 or not all(map(str.isdigit, zipcode)):
``` |
10,277,638 | Is it possible to host a .NET 4 application under a .NET 2 site?
For several reasons we have to run the main site on .NET 3.5, but there is an application written in entity framework 4, which hosted under the same domain/port.
When I try to add an application under the site (using a different .net 4.0 application po... | 2012/04/23 | [
"https://Stackoverflow.com/questions/10277638",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/622661/"
] | No, that's not possible. An assembly compiled against .NET 4.0 must be run inside CLR 4.0. It is possible the other way around: run an assembly compiled against .NET 2.0 inside CLR 4.0. | No, the nested application will not be able to set a seperate framework version. I would suggest changing the version on the main site to v4. I don't think you should experience problems running a 3.5 app on version 4. What are your reasons for running it in 3.5? |
10,277,638 | Is it possible to host a .NET 4 application under a .NET 2 site?
For several reasons we have to run the main site on .NET 3.5, but there is an application written in entity framework 4, which hosted under the same domain/port.
When I try to add an application under the site (using a different .net 4.0 application po... | 2012/04/23 | [
"https://Stackoverflow.com/questions/10277638",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/622661/"
] | It is possible to fix, if you carefully read Microsoft's document,
<http://msdn.microsoft.com/en-us/library/a99txfy5.aspx>
and
<http://www.asp.net/whitepapers/aspnet4/breaking-changes#0.1__Toc256770150> | No, the nested application will not be able to set a seperate framework version. I would suggest changing the version on the main site to v4. I don't think you should experience problems running a 3.5 app on version 4. What are your reasons for running it in 3.5? |
10,277,638 | Is it possible to host a .NET 4 application under a .NET 2 site?
For several reasons we have to run the main site on .NET 3.5, but there is an application written in entity framework 4, which hosted under the same domain/port.
When I try to add an application under the site (using a different .net 4.0 application po... | 2012/04/23 | [
"https://Stackoverflow.com/questions/10277638",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/622661/"
] | It is possible to fix, if you carefully read Microsoft's document,
<http://msdn.microsoft.com/en-us/library/a99txfy5.aspx>
and
<http://www.asp.net/whitepapers/aspnet4/breaking-changes#0.1__Toc256770150> | No, that's not possible. An assembly compiled against .NET 4.0 must be run inside CLR 4.0. It is possible the other way around: run an assembly compiled against .NET 2.0 inside CLR 4.0. |
4,248,521 | Let $A$ be a C$^\*$-algebra, $f$ a representation of $A$, $F$ the universal representation of $A$, and $g=f\circ F^{-1}$. For an ultraweakly continuous linear functional $w$ on $f(A)$, $w\circ g$ is bounded and hence according to a well-known theorem, is ultraweakly continuous linear functional on $F(A)$.
My question: ... | 2021/09/12 | [
"https://math.stackexchange.com/questions/4248521",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/854737/"
] | Suppose $\{ w\_1, w\_2, \dots, w\_r \}$ is a basis of $W$. You can complete it to get a basis $\{ w\_1, \dots, w\_r, v\_{r+1}, \dots, v\_n \}$ of the whole space. The clases $\{ v\_{r+1} + W, \dots, v\_n + W \}$ are a basis of the quotient space (Why?) A proof of the dimension now follows easily.
Since you ask for ano... | Let $\{w\_i\}$ be a basis for $W$ and extend by $\{v\_j\}$ to get a basis for $V$. Then you can show $\{v\_j + W\}$ is a basis for the quotient. |
4,248,521 | Let $A$ be a C$^\*$-algebra, $f$ a representation of $A$, $F$ the universal representation of $A$, and $g=f\circ F^{-1}$. For an ultraweakly continuous linear functional $w$ on $f(A)$, $w\circ g$ is bounded and hence according to a well-known theorem, is ultraweakly continuous linear functional on $F(A)$.
My question: ... | 2021/09/12 | [
"https://math.stackexchange.com/questions/4248521",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/854737/"
] | Another proof that may be circular depending on how you proved the Rank-Nullity theorem is as follows:
Let $\pi:V\to V/W$ be the canonical projection. Notice that it is linear and surjective and the kernel by definition is $W$ hence:
$$\dim(V)=\dim(V/W)+\dim(W)$$
And your equality follows. | Let $\{w\_i\}$ be a basis for $W$ and extend by $\{v\_j\}$ to get a basis for $V$. Then you can show $\{v\_j + W\}$ is a basis for the quotient. |
17,595,349 | I have the following sql comparison using `IIF` keyword
```
DECLARE @a int, @b int
SET @a = 10
SET @b = 20
BEGIN
SELECT IIF( @a < @b, 'True', 'False') As Result
END
```
However, on execution it gives an error
```
Incorrect syntax near '<'
```
What is causing this? | 2013/07/11 | [
"https://Stackoverflow.com/questions/17595349",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/544079/"
] | As mentioned in comments, `IIF` is a new function in SQL Server 2012+, so you'll have to use a `CASE` statement instead:
```
DECLARE @a int, @b int
SET @a = 10
SET @b = 20
BEGIN
SELECT CASE WHEN @a < @b THEN 'True' ELSE 'False' END As Result
END
``` | IIF was used in VBA, but not available in SQL Server until the 2012 release. use the SELECT CASE statement instead.
```
DECLARE @a int, @b int
SET @a = 10
SET @b = 20
BEGIN
SELECT CASE WHEN @a < @b THEN 'True' ELSE 'False' END As Result
END
``` |
30,031,241 | I have been looking around for a method to plot points outside a polygon's area(hexagon in my case). Here's the scenario that I want to achieve, I have a small hexagon located inside a big hexagon. The picture is as follows:

In the picture, I cr... | 2015/05/04 | [
"https://Stackoverflow.com/questions/30031241",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4643715/"
] | **UPDATE**
Thank to `Hoki`'s suggestion, I finally able to work it out.
**Note that I change this part inside the code:**
>
> `validpoint = inpolygon(point_x,point_y,bhex_x,bhex_y) & ~inpolygon(point_x,point_y,shex_vertices_x2,shex_vertices_y2);`
>
>
>
Hopefully, this clear the confusions and would help other ... | If your inner hexagon is defined by the vertices then you could use `inpolygon` ([link](http://uk.mathworks.com/help/matlab/ref/inpolygon.html)) to test whether a given point is inside it or not. |
30,031,241 | I have been looking around for a method to plot points outside a polygon's area(hexagon in my case). Here's the scenario that I want to achieve, I have a small hexagon located inside a big hexagon. The picture is as follows:

In the picture, I cr... | 2015/05/04 | [
"https://Stackoverflow.com/questions/30031241",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4643715/"
] | **UPDATE**
Thank to `Hoki`'s suggestion, I finally able to work it out.
**Note that I change this part inside the code:**
>
> `validpoint = inpolygon(point_x,point_y,bhex_x,bhex_y) & ~inpolygon(point_x,point_y,shex_vertices_x2,shex_vertices_y2);`
>
>
>
Hopefully, this clear the confusions and would help other ... | Pls check by adding following two lines after `inside2 = inpolygon(point_x,point_y,bhex_x,bhex_y);`
```
in1 = inpolygon(point_x,point_y,shex_vertices_x2,shex_vertices_y2);
inside2= logical(inside2-in1);
``` |
51,565,544 | I am unable to unit test one of my functions that contains `HttpContext.Current.Request.LogonUserIdentity.Name`
The error that I get is because `LogonUserIdentity` is null.
I added this in my unit test in order to set a value for `HttpContext.Current` because that was also null:
```
HttpContext.Current = new HttpCo... | 2018/07/27 | [
"https://Stackoverflow.com/questions/51565544",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7113839/"
] | This is a sign of much bigger problem to come.
>
> The LogonUserIdentity property exposes the properties and methods of the WindowsIdentity object **for the currently connected user to Microsoft Internet Information Services (IIS)**. The instance of the WindowsIdentity class that is exposed by LogonUserIdentity track... | You can mock the context as shown here
```
var requestMock = new Mock<HttpRequestBase>();
var contextMock = new Mock<HttpContextBase>();
var mockIIdentity = new Mock<IIdentity>();
mockIIdentity.SetupGet(x => x.Name).Returns("MyName");
WindowsIdentity windowsIdentity = mockIIdentity.Object as Window... |
51,565,544 | I am unable to unit test one of my functions that contains `HttpContext.Current.Request.LogonUserIdentity.Name`
The error that I get is because `LogonUserIdentity` is null.
I added this in my unit test in order to set a value for `HttpContext.Current` because that was also null:
```
HttpContext.Current = new HttpCo... | 2018/07/27 | [
"https://Stackoverflow.com/questions/51565544",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7113839/"
] | This is a sign of much bigger problem to come.
>
> The LogonUserIdentity property exposes the properties and methods of the WindowsIdentity object **for the currently connected user to Microsoft Internet Information Services (IIS)**. The instance of the WindowsIdentity class that is exposed by LogonUserIdentity track... | You can mock it using (System.Web.Fakes) like this:
ShimHttpRequest.AllInstances.LogonUserIdentityGet = (a) => { return WindowsIdentity.GetCurrent(); }; |
51,565,544 | I am unable to unit test one of my functions that contains `HttpContext.Current.Request.LogonUserIdentity.Name`
The error that I get is because `LogonUserIdentity` is null.
I added this in my unit test in order to set a value for `HttpContext.Current` because that was also null:
```
HttpContext.Current = new HttpCo... | 2018/07/27 | [
"https://Stackoverflow.com/questions/51565544",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7113839/"
] | This is a sign of much bigger problem to come.
>
> The LogonUserIdentity property exposes the properties and methods of the WindowsIdentity object **for the currently connected user to Microsoft Internet Information Services (IIS)**. The instance of the WindowsIdentity class that is exposed by LogonUserIdentity track... | Not really the best mock, but sometimes you're trapped.
In this solution you must handle locally logged user (johndoe) on controller and/or
in your db.
But works.
```
var mockRequest = new HttpRequest("", "http://tempuri.org", "");
HttpContext.Current = new HttpContext(
mockR... |
51,565,544 | I am unable to unit test one of my functions that contains `HttpContext.Current.Request.LogonUserIdentity.Name`
The error that I get is because `LogonUserIdentity` is null.
I added this in my unit test in order to set a value for `HttpContext.Current` because that was also null:
```
HttpContext.Current = new HttpCo... | 2018/07/27 | [
"https://Stackoverflow.com/questions/51565544",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7113839/"
] | I spent a lot of time trying to mock HttpContext or HttpContextBase, then trying to shim with fakes WindowsIdentity class or HttpRequest.LogonUserIdentity property.
Nothing works - you don't need completely mocked HttpContext because you want see real responses, not your mock set ups returned.
Shims are just not gener... | You can mock the context as shown here
```
var requestMock = new Mock<HttpRequestBase>();
var contextMock = new Mock<HttpContextBase>();
var mockIIdentity = new Mock<IIdentity>();
mockIIdentity.SetupGet(x => x.Name).Returns("MyName");
WindowsIdentity windowsIdentity = mockIIdentity.Object as Window... |
51,565,544 | I am unable to unit test one of my functions that contains `HttpContext.Current.Request.LogonUserIdentity.Name`
The error that I get is because `LogonUserIdentity` is null.
I added this in my unit test in order to set a value for `HttpContext.Current` because that was also null:
```
HttpContext.Current = new HttpCo... | 2018/07/27 | [
"https://Stackoverflow.com/questions/51565544",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7113839/"
] | Not really the best mock, but sometimes you're trapped.
In this solution you must handle locally logged user (johndoe) on controller and/or
in your db.
But works.
```
var mockRequest = new HttpRequest("", "http://tempuri.org", "");
HttpContext.Current = new HttpContext(
mockR... | You can mock the context as shown here
```
var requestMock = new Mock<HttpRequestBase>();
var contextMock = new Mock<HttpContextBase>();
var mockIIdentity = new Mock<IIdentity>();
mockIIdentity.SetupGet(x => x.Name).Returns("MyName");
WindowsIdentity windowsIdentity = mockIIdentity.Object as Window... |
51,565,544 | I am unable to unit test one of my functions that contains `HttpContext.Current.Request.LogonUserIdentity.Name`
The error that I get is because `LogonUserIdentity` is null.
I added this in my unit test in order to set a value for `HttpContext.Current` because that was also null:
```
HttpContext.Current = new HttpCo... | 2018/07/27 | [
"https://Stackoverflow.com/questions/51565544",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7113839/"
] | I spent a lot of time trying to mock HttpContext or HttpContextBase, then trying to shim with fakes WindowsIdentity class or HttpRequest.LogonUserIdentity property.
Nothing works - you don't need completely mocked HttpContext because you want see real responses, not your mock set ups returned.
Shims are just not gener... | You can mock it using (System.Web.Fakes) like this:
ShimHttpRequest.AllInstances.LogonUserIdentityGet = (a) => { return WindowsIdentity.GetCurrent(); }; |
51,565,544 | I am unable to unit test one of my functions that contains `HttpContext.Current.Request.LogonUserIdentity.Name`
The error that I get is because `LogonUserIdentity` is null.
I added this in my unit test in order to set a value for `HttpContext.Current` because that was also null:
```
HttpContext.Current = new HttpCo... | 2018/07/27 | [
"https://Stackoverflow.com/questions/51565544",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7113839/"
] | Not really the best mock, but sometimes you're trapped.
In this solution you must handle locally logged user (johndoe) on controller and/or
in your db.
But works.
```
var mockRequest = new HttpRequest("", "http://tempuri.org", "");
HttpContext.Current = new HttpContext(
mockR... | You can mock it using (System.Web.Fakes) like this:
ShimHttpRequest.AllInstances.LogonUserIdentityGet = (a) => { return WindowsIdentity.GetCurrent(); }; |
51,565,544 | I am unable to unit test one of my functions that contains `HttpContext.Current.Request.LogonUserIdentity.Name`
The error that I get is because `LogonUserIdentity` is null.
I added this in my unit test in order to set a value for `HttpContext.Current` because that was also null:
```
HttpContext.Current = new HttpCo... | 2018/07/27 | [
"https://Stackoverflow.com/questions/51565544",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7113839/"
] | I spent a lot of time trying to mock HttpContext or HttpContextBase, then trying to shim with fakes WindowsIdentity class or HttpRequest.LogonUserIdentity property.
Nothing works - you don't need completely mocked HttpContext because you want see real responses, not your mock set ups returned.
Shims are just not gener... | Not really the best mock, but sometimes you're trapped.
In this solution you must handle locally logged user (johndoe) on controller and/or
in your db.
But works.
```
var mockRequest = new HttpRequest("", "http://tempuri.org", "");
HttpContext.Current = new HttpContext(
mockR... |
4,800,781 | I know running `javac file1.java` produces `file1.class` if `file1.java` is the only source file, then I can just say `java file1` to run it.
However, if I have 2 source files, `file1.java` and `file2.java`, then how do I build the program? | 2011/01/26 | [
"https://Stackoverflow.com/questions/4800781",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/590015/"
] | Try the following:
```
javac file1.java file2.java
``` | Here is another example, for compiling a java file in a nested directory.
I was trying to build this from the command line. This is an example from 'gradle', which has dependency 'commons-collection.jar'. For more info, please see '[gradle: java quickstart](https://docs.gradle.org/1.11/userguide/tutorial_java_projects... |
4,800,781 | I know running `javac file1.java` produces `file1.class` if `file1.java` is the only source file, then I can just say `java file1` to run it.
However, if I have 2 source files, `file1.java` and `file2.java`, then how do I build the program? | 2011/01/26 | [
"https://Stackoverflow.com/questions/4800781",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/590015/"
] | Try the following:
```
javac file1.java file2.java
``` | OR you could just use `javac file1.java` and then also use `javac file2.java` afterwards. |
4,800,781 | I know running `javac file1.java` produces `file1.class` if `file1.java` is the only source file, then I can just say `java file1` to run it.
However, if I have 2 source files, `file1.java` and `file2.java`, then how do I build the program? | 2011/01/26 | [
"https://Stackoverflow.com/questions/4800781",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/590015/"
] | Try the following:
```
javac file1.java file2.java
``` | 1.[use wildcard](https://i.stack.imgur.com/lln2q.png)
2.[use options](https://i.stack.imgur.com/57O6G.png)
3.<https://docs.oracle.com/javase/8/docs/technotes/tools/windows/javac.html> |
4,800,781 | I know running `javac file1.java` produces `file1.class` if `file1.java` is the only source file, then I can just say `java file1` to run it.
However, if I have 2 source files, `file1.java` and `file2.java`, then how do I build the program? | 2011/01/26 | [
"https://Stackoverflow.com/questions/4800781",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/590015/"
] | or you can use the following to compile the all java source files in current directory..
```
javac *.java
``` | Here is another example, for compiling a java file in a nested directory.
I was trying to build this from the command line. This is an example from 'gradle', which has dependency 'commons-collection.jar'. For more info, please see '[gradle: java quickstart](https://docs.gradle.org/1.11/userguide/tutorial_java_projects... |
4,800,781 | I know running `javac file1.java` produces `file1.class` if `file1.java` is the only source file, then I can just say `java file1` to run it.
However, if I have 2 source files, `file1.java` and `file2.java`, then how do I build the program? | 2011/01/26 | [
"https://Stackoverflow.com/questions/4800781",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/590015/"
] | or you can use the following to compile the all java source files in current directory..
```
javac *.java
``` | OR you could just use `javac file1.java` and then also use `javac file2.java` afterwards. |
4,800,781 | I know running `javac file1.java` produces `file1.class` if `file1.java` is the only source file, then I can just say `java file1` to run it.
However, if I have 2 source files, `file1.java` and `file2.java`, then how do I build the program? | 2011/01/26 | [
"https://Stackoverflow.com/questions/4800781",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/590015/"
] | or you can use the following to compile the all java source files in current directory..
```
javac *.java
``` | 1.[use wildcard](https://i.stack.imgur.com/lln2q.png)
2.[use options](https://i.stack.imgur.com/57O6G.png)
3.<https://docs.oracle.com/javase/8/docs/technotes/tools/windows/javac.html> |
4,800,781 | I know running `javac file1.java` produces `file1.class` if `file1.java` is the only source file, then I can just say `java file1` to run it.
However, if I have 2 source files, `file1.java` and `file2.java`, then how do I build the program? | 2011/01/26 | [
"https://Stackoverflow.com/questions/4800781",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/590015/"
] | Here is another example, for compiling a java file in a nested directory.
I was trying to build this from the command line. This is an example from 'gradle', which has dependency 'commons-collection.jar'. For more info, please see '[gradle: java quickstart](https://docs.gradle.org/1.11/userguide/tutorial_java_projects... | OR you could just use `javac file1.java` and then also use `javac file2.java` afterwards. |
4,800,781 | I know running `javac file1.java` produces `file1.class` if `file1.java` is the only source file, then I can just say `java file1` to run it.
However, if I have 2 source files, `file1.java` and `file2.java`, then how do I build the program? | 2011/01/26 | [
"https://Stackoverflow.com/questions/4800781",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/590015/"
] | Here is another example, for compiling a java file in a nested directory.
I was trying to build this from the command line. This is an example from 'gradle', which has dependency 'commons-collection.jar'. For more info, please see '[gradle: java quickstart](https://docs.gradle.org/1.11/userguide/tutorial_java_projects... | 1.[use wildcard](https://i.stack.imgur.com/lln2q.png)
2.[use options](https://i.stack.imgur.com/57O6G.png)
3.<https://docs.oracle.com/javase/8/docs/technotes/tools/windows/javac.html> |
4,800,781 | I know running `javac file1.java` produces `file1.class` if `file1.java` is the only source file, then I can just say `java file1` to run it.
However, if I have 2 source files, `file1.java` and `file2.java`, then how do I build the program? | 2011/01/26 | [
"https://Stackoverflow.com/questions/4800781",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/590015/"
] | 1.[use wildcard](https://i.stack.imgur.com/lln2q.png)
2.[use options](https://i.stack.imgur.com/57O6G.png)
3.<https://docs.oracle.com/javase/8/docs/technotes/tools/windows/javac.html> | OR you could just use `javac file1.java` and then also use `javac file2.java` afterwards. |
1,018,338 | Hopefully this example will illustrate my point better than simply trying to explain it:
I'm using one of the many jQuery watermark plugins. To attach a watermark to a textbox, the syntax is:
```
$(document).ready(function(){
$("#item_description").watermark("Description");
});
```
This works wonderfully if I hav... | 2009/06/19 | [
"https://Stackoverflow.com/questions/1018338",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1108/"
] | Why must it be in `$(document).ready`? You already have javascript loading the ajax, so you can activate `$("#item_description").watermark("Description");` on the callback. | From the ajax, just make the call directly without wrapping it inside `$(document).ready()`
```
$("#item_description").watermark("Description");
``` |
63,223,502 | I am actually doing the `Daily Coding Problem #2`
I believe I have the result and I used it with recursion but I am wondering if it's good that I passed the `arr` in each recursion? Will passing it cause more memory or time?
The coding problem question is
>
> Given an array of integers, return a new array such that... | 2020/08/03 | [
"https://Stackoverflow.com/questions/63223502",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1850712/"
] | Are you probably using Composer v2? When I use the given JSON in my local environment using Composer v1, it tells me:
>
> Deprecation warning: Your package name vendor\_name/PhpProjec is invalid, it should not contain uppercase characters. We suggest using vendor\_name/php-projec instead. Make sure you fix this as Co... | composer is case sensitive from v1.9 onwards...
so change "PhpProject" to "phpproject"
```
{
"name": "vendor_name/phpproject",
"description": "description",
"minimum-stability": "stable",
"license": "proprietary",
"authors": [
{
"name": "***",
"email": "email@example.com"
}
],
"req... |
63,223,502 | I am actually doing the `Daily Coding Problem #2`
I believe I have the result and I used it with recursion but I am wondering if it's good that I passed the `arr` in each recursion? Will passing it cause more memory or time?
The coding problem question is
>
> Given an array of integers, return a new array such that... | 2020/08/03 | [
"https://Stackoverflow.com/questions/63223502",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1850712/"
] | Are you probably using Composer v2? When I use the given JSON in my local environment using Composer v1, it tells me:
>
> Deprecation warning: Your package name vendor\_name/PhpProjec is invalid, it should not contain uppercase characters. We suggest using vendor\_name/php-projec instead. Make sure you fix this as Co... | Easy fix go to `composer.json` file find where is capitalizised e.g Izupay/PayMent to izupay/payment this will fix the error.
```json
{
"name": "IzuPay/PayMent",
"description": "description",
"minimum-stability": "stable",
"license": "proprietary",
"authors": [
{
"name": "***",
"email": "emai... |
63,223,502 | I am actually doing the `Daily Coding Problem #2`
I believe I have the result and I used it with recursion but I am wondering if it's good that I passed the `arr` in each recursion? Will passing it cause more memory or time?
The coding problem question is
>
> Given an array of integers, return a new array such that... | 2020/08/03 | [
"https://Stackoverflow.com/questions/63223502",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1850712/"
] | Are you probably using Composer v2? When I use the given JSON in my local environment using Composer v1, it tells me:
>
> Deprecation warning: Your package name vendor\_name/PhpProjec is invalid, it should not contain uppercase characters. We suggest using vendor\_name/php-projec instead. Make sure you fix this as Co... | This most likely has to do with the version of Composer you're using.
Before Composer version 2.0, a name could contain *any character*, including white spaces.
However, from version 2.0 upwards:
* the name can consists of words separated by -, . or \_.
* the complete name should match ^a-z0-9*/a-z0-9*$.
* the name ... |
63,223,502 | I am actually doing the `Daily Coding Problem #2`
I believe I have the result and I used it with recursion but I am wondering if it's good that I passed the `arr` in each recursion? Will passing it cause more memory or time?
The coding problem question is
>
> Given an array of integers, return a new array such that... | 2020/08/03 | [
"https://Stackoverflow.com/questions/63223502",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1850712/"
] | The problem is in the **"name"** property
```
- name : Does not match the regex pattern ^[a-z0-9]([_.-]?[a-z0-9]+)*/[a-z0-9](([_.]?|-{0,2})[a-z0-9]+)*$
```
Change the "name" property accordingly **"vendor-name/project-name"**
eg: `"name": "nismi/my-php-project"` | composer is case sensitive from v1.9 onwards...
so change "PhpProject" to "phpproject"
```
{
"name": "vendor_name/phpproject",
"description": "description",
"minimum-stability": "stable",
"license": "proprietary",
"authors": [
{
"name": "***",
"email": "email@example.com"
}
],
"req... |
63,223,502 | I am actually doing the `Daily Coding Problem #2`
I believe I have the result and I used it with recursion but I am wondering if it's good that I passed the `arr` in each recursion? Will passing it cause more memory or time?
The coding problem question is
>
> Given an array of integers, return a new array such that... | 2020/08/03 | [
"https://Stackoverflow.com/questions/63223502",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1850712/"
] | composer is case sensitive from v1.9 onwards...
so change "PhpProject" to "phpproject"
```
{
"name": "vendor_name/phpproject",
"description": "description",
"minimum-stability": "stable",
"license": "proprietary",
"authors": [
{
"name": "***",
"email": "email@example.com"
}
],
"req... | Easy fix go to `composer.json` file find where is capitalizised e.g Izupay/PayMent to izupay/payment this will fix the error.
```json
{
"name": "IzuPay/PayMent",
"description": "description",
"minimum-stability": "stable",
"license": "proprietary",
"authors": [
{
"name": "***",
"email": "emai... |
63,223,502 | I am actually doing the `Daily Coding Problem #2`
I believe I have the result and I used it with recursion but I am wondering if it's good that I passed the `arr` in each recursion? Will passing it cause more memory or time?
The coding problem question is
>
> Given an array of integers, return a new array such that... | 2020/08/03 | [
"https://Stackoverflow.com/questions/63223502",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1850712/"
] | composer is case sensitive from v1.9 onwards...
so change "PhpProject" to "phpproject"
```
{
"name": "vendor_name/phpproject",
"description": "description",
"minimum-stability": "stable",
"license": "proprietary",
"authors": [
{
"name": "***",
"email": "email@example.com"
}
],
"req... | This most likely has to do with the version of Composer you're using.
Before Composer version 2.0, a name could contain *any character*, including white spaces.
However, from version 2.0 upwards:
* the name can consists of words separated by -, . or \_.
* the complete name should match ^a-z0-9*/a-z0-9*$.
* the name ... |
63,223,502 | I am actually doing the `Daily Coding Problem #2`
I believe I have the result and I used it with recursion but I am wondering if it's good that I passed the `arr` in each recursion? Will passing it cause more memory or time?
The coding problem question is
>
> Given an array of integers, return a new array such that... | 2020/08/03 | [
"https://Stackoverflow.com/questions/63223502",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1850712/"
] | The problem is in the **"name"** property
```
- name : Does not match the regex pattern ^[a-z0-9]([_.-]?[a-z0-9]+)*/[a-z0-9](([_.]?|-{0,2})[a-z0-9]+)*$
```
Change the "name" property accordingly **"vendor-name/project-name"**
eg: `"name": "nismi/my-php-project"` | Easy fix go to `composer.json` file find where is capitalizised e.g Izupay/PayMent to izupay/payment this will fix the error.
```json
{
"name": "IzuPay/PayMent",
"description": "description",
"minimum-stability": "stable",
"license": "proprietary",
"authors": [
{
"name": "***",
"email": "emai... |
63,223,502 | I am actually doing the `Daily Coding Problem #2`
I believe I have the result and I used it with recursion but I am wondering if it's good that I passed the `arr` in each recursion? Will passing it cause more memory or time?
The coding problem question is
>
> Given an array of integers, return a new array such that... | 2020/08/03 | [
"https://Stackoverflow.com/questions/63223502",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1850712/"
] | The problem is in the **"name"** property
```
- name : Does not match the regex pattern ^[a-z0-9]([_.-]?[a-z0-9]+)*/[a-z0-9](([_.]?|-{0,2})[a-z0-9]+)*$
```
Change the "name" property accordingly **"vendor-name/project-name"**
eg: `"name": "nismi/my-php-project"` | This most likely has to do with the version of Composer you're using.
Before Composer version 2.0, a name could contain *any character*, including white spaces.
However, from version 2.0 upwards:
* the name can consists of words separated by -, . or \_.
* the complete name should match ^a-z0-9*/a-z0-9*$.
* the name ... |
31,750,293 | Why can't we declare an array of 10000000 integers (or say, large enough) inside the main function or inside any function locally while it is possible globally? | 2015/07/31 | [
"https://Stackoverflow.com/questions/31750293",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4695532/"
] | **tl;dr:** space for local variables is limited. That's how CPU's and Operating Systems work.
---
This is an implementation detail that is shared by many languages and implementations, e.g. C, C++ on typical desktop OS.
Most platforms where the code runs on set aside some memory called the *Stack* to be used for re... | (edit: global variables don't typically go in the heap)
It's likely due to the difference between available **stack** memory and total memory. Local variables get placed on the stack, whereas global variables get placed in a statically allocated section of memory. The following is a more general question that has a go... |
231,772 | Remodeling a kitchen. I'll be adding two new circuits dedicated to the microwave and fridge. I'll also be reconfiguring the countertops which will result in having to add another outlet to meet code for power distribution.
Haven't done any major wiring changes for a while and I'm now seeing that AFCI is required basic... | 2021/08/11 | [
"https://diy.stackexchange.com/questions/231772",
"https://diy.stackexchange.com",
"https://diy.stackexchange.com/users/140252/"
] | If you are following 2014 NEC or newer, the answer would be yes, 210.12 specifies AFCI protection where branch circuit wiring is "modified, replaced, or extended". So "adding an outlet down the line" would be an extension of the branch circuit wiring.
The current NEC reference is 210.12(D)(1). I believe it was 210.12(... | This is really a local jurisdiction issue.
In my city, the rule would be adding an outlet requires a permit which triggers crazy local rules. For AFCI retrofit, my building department would require all circuits servicing the room/area be retrofitted.
In my house, since the lighting circuit for kitchen also feeds fami... |
42,456 | Given a Turing machine, how can I identify the language it accepts and write a set notation for L(M)? | 2015/05/12 | [
"https://cs.stackexchange.com/questions/42456",
"https://cs.stackexchange.com",
"https://cs.stackexchange.com/users/33571/"
] | A Turing machine implements an algorithm.
The algorithm can be implicit by an explicit definition of the language such as:
$M$ is a TM such that $L(M)=\left \{ x\in \Sigma^\* \ | \ |x|\in \mathbb{N}\_{even}\right \}$. Which is usually the case.
In other cases, you might have to understand a turing machine based o... | The problem of identifying the language that is accepted by a Turing machine (using or not some form of set construction notation) does not have a general solution. This means that - with the exception of a minority of trivial cases - you will have to take them one at a time, as separate problems, *by logical necessity... |
49,911,879 | I'm currently following a tutorial and the tutorial is making use of `EventEmitter`. The code goes like this
```
@Output() ratingClicked: EventEmitter<string> =
new EventEmitter<string>();
```
But it visual studio code gives me these errors:
1. Type 'EventEmitter' is not generic.
2. Expected 0 type argument... | 2018/04/19 | [
"https://Stackoverflow.com/questions/49911879",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7660753/"
] | You are probably using the `node` native EventEmitter from `node/index.d.ts` i.e.
```
import { EventEmitter } from 'events';
```
Fix
===
Change the import to the one from angular:
```
import { EventEmitter } from '@angular/core';
``` | In visual studio code when your try to listen to user click event from your html file of the component
`@Output() event: EventEmitter<string> = new EventEmitter<string>();`
it automatically import this to the component `import { EventEmitter } from '@angular/event'` instead of `import { EventEmitter } from '@angular... |
49,911,879 | I'm currently following a tutorial and the tutorial is making use of `EventEmitter`. The code goes like this
```
@Output() ratingClicked: EventEmitter<string> =
new EventEmitter<string>();
```
But it visual studio code gives me these errors:
1. Type 'EventEmitter' is not generic.
2. Expected 0 type argument... | 2018/04/19 | [
"https://Stackoverflow.com/questions/49911879",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7660753/"
] | You are probably using the `node` native EventEmitter from `node/index.d.ts` i.e.
```
import { EventEmitter } from 'events';
```
Fix
===
Change the import to the one from angular:
```
import { EventEmitter } from '@angular/core';
``` | I was doing the same tutorial and faced the same issue.
It is a problem with an import. `EventEmitter` must be imported from `@angular/core`
Use:
```
import { EventEmitter } from '@angular/core';
```
This will fix it. |
49,911,879 | I'm currently following a tutorial and the tutorial is making use of `EventEmitter`. The code goes like this
```
@Output() ratingClicked: EventEmitter<string> =
new EventEmitter<string>();
```
But it visual studio code gives me these errors:
1. Type 'EventEmitter' is not generic.
2. Expected 0 type argument... | 2018/04/19 | [
"https://Stackoverflow.com/questions/49911879",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7660753/"
] | You are probably using the `node` native EventEmitter from `node/index.d.ts` i.e.
```
import { EventEmitter } from 'events';
```
Fix
===
Change the import to the one from angular:
```
import { EventEmitter } from '@angular/core';
``` | For me, VS code IDE V1.60.0 has added automatically this code:
```
import { EventEmitter } from 'stream';
```
However, it is wrong and you should replace it with this
```
import { EventEmitter } from '@angular/core';
``` |
49,911,879 | I'm currently following a tutorial and the tutorial is making use of `EventEmitter`. The code goes like this
```
@Output() ratingClicked: EventEmitter<string> =
new EventEmitter<string>();
```
But it visual studio code gives me these errors:
1. Type 'EventEmitter' is not generic.
2. Expected 0 type argument... | 2018/04/19 | [
"https://Stackoverflow.com/questions/49911879",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7660753/"
] | You are probably using the `node` native EventEmitter from `node/index.d.ts` i.e.
```
import { EventEmitter } from 'events';
```
Fix
===
Change the import to the one from angular:
```
import { EventEmitter } from '@angular/core';
``` | **This is the latest update for Angular 13**
This is happening because the `EventEmitter` might be imported from the `events` module.
```
import * as EventEmitter from 'events';
```
Or
```
import { EventEmitter } from 'events';
```
**To fix this**, import `EventEmitter` from `@angular/core`
```
import { EventEm... |
49,911,879 | I'm currently following a tutorial and the tutorial is making use of `EventEmitter`. The code goes like this
```
@Output() ratingClicked: EventEmitter<string> =
new EventEmitter<string>();
```
But it visual studio code gives me these errors:
1. Type 'EventEmitter' is not generic.
2. Expected 0 type argument... | 2018/04/19 | [
"https://Stackoverflow.com/questions/49911879",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7660753/"
] | I was doing the same tutorial and faced the same issue.
It is a problem with an import. `EventEmitter` must be imported from `@angular/core`
Use:
```
import { EventEmitter } from '@angular/core';
```
This will fix it. | In visual studio code when your try to listen to user click event from your html file of the component
`@Output() event: EventEmitter<string> = new EventEmitter<string>();`
it automatically import this to the component `import { EventEmitter } from '@angular/event'` instead of `import { EventEmitter } from '@angular... |
49,911,879 | I'm currently following a tutorial and the tutorial is making use of `EventEmitter`. The code goes like this
```
@Output() ratingClicked: EventEmitter<string> =
new EventEmitter<string>();
```
But it visual studio code gives me these errors:
1. Type 'EventEmitter' is not generic.
2. Expected 0 type argument... | 2018/04/19 | [
"https://Stackoverflow.com/questions/49911879",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7660753/"
] | For me, VS code IDE V1.60.0 has added automatically this code:
```
import { EventEmitter } from 'stream';
```
However, it is wrong and you should replace it with this
```
import { EventEmitter } from '@angular/core';
``` | In visual studio code when your try to listen to user click event from your html file of the component
`@Output() event: EventEmitter<string> = new EventEmitter<string>();`
it automatically import this to the component `import { EventEmitter } from '@angular/event'` instead of `import { EventEmitter } from '@angular... |
49,911,879 | I'm currently following a tutorial and the tutorial is making use of `EventEmitter`. The code goes like this
```
@Output() ratingClicked: EventEmitter<string> =
new EventEmitter<string>();
```
But it visual studio code gives me these errors:
1. Type 'EventEmitter' is not generic.
2. Expected 0 type argument... | 2018/04/19 | [
"https://Stackoverflow.com/questions/49911879",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7660753/"
] | **This is the latest update for Angular 13**
This is happening because the `EventEmitter` might be imported from the `events` module.
```
import * as EventEmitter from 'events';
```
Or
```
import { EventEmitter } from 'events';
```
**To fix this**, import `EventEmitter` from `@angular/core`
```
import { EventEm... | In visual studio code when your try to listen to user click event from your html file of the component
`@Output() event: EventEmitter<string> = new EventEmitter<string>();`
it automatically import this to the component `import { EventEmitter } from '@angular/event'` instead of `import { EventEmitter } from '@angular... |
49,911,879 | I'm currently following a tutorial and the tutorial is making use of `EventEmitter`. The code goes like this
```
@Output() ratingClicked: EventEmitter<string> =
new EventEmitter<string>();
```
But it visual studio code gives me these errors:
1. Type 'EventEmitter' is not generic.
2. Expected 0 type argument... | 2018/04/19 | [
"https://Stackoverflow.com/questions/49911879",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7660753/"
] | For me, VS code IDE V1.60.0 has added automatically this code:
```
import { EventEmitter } from 'stream';
```
However, it is wrong and you should replace it with this
```
import { EventEmitter } from '@angular/core';
``` | I was doing the same tutorial and faced the same issue.
It is a problem with an import. `EventEmitter` must be imported from `@angular/core`
Use:
```
import { EventEmitter } from '@angular/core';
```
This will fix it. |
49,911,879 | I'm currently following a tutorial and the tutorial is making use of `EventEmitter`. The code goes like this
```
@Output() ratingClicked: EventEmitter<string> =
new EventEmitter<string>();
```
But it visual studio code gives me these errors:
1. Type 'EventEmitter' is not generic.
2. Expected 0 type argument... | 2018/04/19 | [
"https://Stackoverflow.com/questions/49911879",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7660753/"
] | For me, VS code IDE V1.60.0 has added automatically this code:
```
import { EventEmitter } from 'stream';
```
However, it is wrong and you should replace it with this
```
import { EventEmitter } from '@angular/core';
``` | **This is the latest update for Angular 13**
This is happening because the `EventEmitter` might be imported from the `events` module.
```
import * as EventEmitter from 'events';
```
Or
```
import { EventEmitter } from 'events';
```
**To fix this**, import `EventEmitter` from `@angular/core`
```
import { EventEm... |
3,254,671 | Ok, I think I overcomplicated things and now I'm lost. Basically, I need to translate this, from Perl to Lua:
```
my $mem;
my $memfree;
open(FILE, 'proc/meminfo');
while (<FILE>)
{
if (m/MemTotal/)
{
$mem = $_;
$mem =~ s/.*:(.*)/$1/;
}
}
close(FILE);
```
So far I've written this:
```
fo... | 2010/07/15 | [
"https://Stackoverflow.com/questions/3254671",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/385364/"
] | Lua doesn't use regular expressions. See Programming in Lua, sections [20.1](http://www.lua.org/pil/20.1.html) and following to understand how pattern matching and replacement works in Lua and where it differs from regular expressions.
In your case you're replacing the complete string (`.*`) by the literal string `.*`... | The code below parses the contents of that file and puts it in a table:
```
meminfo={}
for Line in io.lines("/proc/meminfo") do
local k,v=Line:match("(.-): *(%d+)")
if k~=nil and v~=nil then meminfo[k]=tonumber(v) end
end
```
You can then just do
```
print(meminfo.MemTotal)
``` |
18,869,163 | I make a menu to load (without refreshing the page) a page in a div (id="main-content"), and everything is working except the slider, there is the JS code :
```
jQuery(document).ready(function(){
// load index page when the page loads
jQuery("#main-content").load("/tpl/index.tpl.php");
jQuery("#index").cli... | 2013/09/18 | [
"https://Stackoverflow.com/questions/18869163",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2782444/"
] | You have 3 records.
If you write `assert_difference 'Review.count', 1`... it expects 4 at the end.
But if you write `assert_difference 'Review.count', -1`... it expects 2, thus 1 less. | This line tells that you are expecting the difference of Plus one(1 or +1).
```
assert_difference 'Review.count', 1 , "a review should be deleted"
```
But actually you want the difference in Negative one(-1), so you should write
```
assert_difference 'Review.count', -1 , "a review should be deleted"
```
For more ... |
11,394,706 | What is the inverse of the function
```
math.atan2
```
I use this in Lua where I can get the inverse of `math.atan` by `math.tan`.
But I am lost here.
**EDIT**
OK, let me give you more details.
I needed to calculate angle between 2 points (x1,y1) and (x2,y2) and I did,
```
local dy = y1-y2
local dx = x1-x2
... | 2012/07/09 | [
"https://Stackoverflow.com/questions/11394706",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1137788/"
] | Apparently, something like this will help:
```
x = cos(theta)
y = sin(theta)
```
Simple Google search threw this up, and the guy who asked the question said it solved it. | According [this reference](http://pgl.yoyo.org/luai/i/math.atan2):
>
> Returns the arc tangent of y/x (in radians), but uses the signs of
> both parameters to find the quadrant of the result. (It also handles
> correctly the case of x being zero.)
>
>
>
So I guess you can use `math.tan` to invert it also. |
11,394,706 | What is the inverse of the function
```
math.atan2
```
I use this in Lua where I can get the inverse of `math.atan` by `math.tan`.
But I am lost here.
**EDIT**
OK, let me give you more details.
I needed to calculate angle between 2 points (x1,y1) and (x2,y2) and I did,
```
local dy = y1-y2
local dx = x1-x2
... | 2012/07/09 | [
"https://Stackoverflow.com/questions/11394706",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1137788/"
] | Given only the angle you can only derive a unit vector pointing to `(dx, dy)`. To get the original `(dx, dy)` you also need to know the length of the vector `(dx, dy)`, which I'll call `len`. You also have to convert the angle you derived from degrees back to radians and then use the trig equations mentioned elsewhere ... | Apparently, something like this will help:
```
x = cos(theta)
y = sin(theta)
```
Simple Google search threw this up, and the guy who asked the question said it solved it. |
11,394,706 | What is the inverse of the function
```
math.atan2
```
I use this in Lua where I can get the inverse of `math.atan` by `math.tan`.
But I am lost here.
**EDIT**
OK, let me give you more details.
I needed to calculate angle between 2 points (x1,y1) and (x2,y2) and I did,
```
local dy = y1-y2
local dx = x1-x2
... | 2012/07/09 | [
"https://Stackoverflow.com/questions/11394706",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1137788/"
] | Apparently, something like this will help:
```
x = cos(theta)
y = sin(theta)
```
Simple Google search threw this up, and the guy who asked the question said it solved it. | You'll probably get the wrong numbers if you use:
```
local dy = y1-y2
local dx = x1-x2
local angle = atan2(dy,dx) * 180 / pi
```
If you are using the coordinate system where y gets bigger going down the screen and x gets bigger going to the right then you should use:
```
local dy = y1 - y2
local dx = x2 - x1
loca... |
11,394,706 | What is the inverse of the function
```
math.atan2
```
I use this in Lua where I can get the inverse of `math.atan` by `math.tan`.
But I am lost here.
**EDIT**
OK, let me give you more details.
I needed to calculate angle between 2 points (x1,y1) and (x2,y2) and I did,
```
local dy = y1-y2
local dx = x1-x2
... | 2012/07/09 | [
"https://Stackoverflow.com/questions/11394706",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1137788/"
] | Apparently, something like this will help:
```
x = cos(theta)
y = sin(theta)
```
Simple Google search threw this up, and the guy who asked the question said it solved it. | As atan2 works as tan-1, so the inverse could be tan, taking into consideration conversion between radian and degree |
11,394,706 | What is the inverse of the function
```
math.atan2
```
I use this in Lua where I can get the inverse of `math.atan` by `math.tan`.
But I am lost here.
**EDIT**
OK, let me give you more details.
I needed to calculate angle between 2 points (x1,y1) and (x2,y2) and I did,
```
local dy = y1-y2
local dx = x1-x2
... | 2012/07/09 | [
"https://Stackoverflow.com/questions/11394706",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1137788/"
] | Given only the angle you can only derive a unit vector pointing to `(dx, dy)`. To get the original `(dx, dy)` you also need to know the length of the vector `(dx, dy)`, which I'll call `len`. You also have to convert the angle you derived from degrees back to radians and then use the trig equations mentioned elsewhere ... | According [this reference](http://pgl.yoyo.org/luai/i/math.atan2):
>
> Returns the arc tangent of y/x (in radians), but uses the signs of
> both parameters to find the quadrant of the result. (It also handles
> correctly the case of x being zero.)
>
>
>
So I guess you can use `math.tan` to invert it also. |
11,394,706 | What is the inverse of the function
```
math.atan2
```
I use this in Lua where I can get the inverse of `math.atan` by `math.tan`.
But I am lost here.
**EDIT**
OK, let me give you more details.
I needed to calculate angle between 2 points (x1,y1) and (x2,y2) and I did,
```
local dy = y1-y2
local dx = x1-x2
... | 2012/07/09 | [
"https://Stackoverflow.com/questions/11394706",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1137788/"
] | You'll probably get the wrong numbers if you use:
```
local dy = y1-y2
local dx = x1-x2
local angle = atan2(dy,dx) * 180 / pi
```
If you are using the coordinate system where y gets bigger going down the screen and x gets bigger going to the right then you should use:
```
local dy = y1 - y2
local dx = x2 - x1
loca... | According [this reference](http://pgl.yoyo.org/luai/i/math.atan2):
>
> Returns the arc tangent of y/x (in radians), but uses the signs of
> both parameters to find the quadrant of the result. (It also handles
> correctly the case of x being zero.)
>
>
>
So I guess you can use `math.tan` to invert it also. |
11,394,706 | What is the inverse of the function
```
math.atan2
```
I use this in Lua where I can get the inverse of `math.atan` by `math.tan`.
But I am lost here.
**EDIT**
OK, let me give you more details.
I needed to calculate angle between 2 points (x1,y1) and (x2,y2) and I did,
```
local dy = y1-y2
local dx = x1-x2
... | 2012/07/09 | [
"https://Stackoverflow.com/questions/11394706",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1137788/"
] | Given only the angle you can only derive a unit vector pointing to `(dx, dy)`. To get the original `(dx, dy)` you also need to know the length of the vector `(dx, dy)`, which I'll call `len`. You also have to convert the angle you derived from degrees back to radians and then use the trig equations mentioned elsewhere ... | You'll probably get the wrong numbers if you use:
```
local dy = y1-y2
local dx = x1-x2
local angle = atan2(dy,dx) * 180 / pi
```
If you are using the coordinate system where y gets bigger going down the screen and x gets bigger going to the right then you should use:
```
local dy = y1 - y2
local dx = x2 - x1
loca... |
11,394,706 | What is the inverse of the function
```
math.atan2
```
I use this in Lua where I can get the inverse of `math.atan` by `math.tan`.
But I am lost here.
**EDIT**
OK, let me give you more details.
I needed to calculate angle between 2 points (x1,y1) and (x2,y2) and I did,
```
local dy = y1-y2
local dx = x1-x2
... | 2012/07/09 | [
"https://Stackoverflow.com/questions/11394706",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1137788/"
] | Given only the angle you can only derive a unit vector pointing to `(dx, dy)`. To get the original `(dx, dy)` you also need to know the length of the vector `(dx, dy)`, which I'll call `len`. You also have to convert the angle you derived from degrees back to radians and then use the trig equations mentioned elsewhere ... | As atan2 works as tan-1, so the inverse could be tan, taking into consideration conversion between radian and degree |
11,394,706 | What is the inverse of the function
```
math.atan2
```
I use this in Lua where I can get the inverse of `math.atan` by `math.tan`.
But I am lost here.
**EDIT**
OK, let me give you more details.
I needed to calculate angle between 2 points (x1,y1) and (x2,y2) and I did,
```
local dy = y1-y2
local dx = x1-x2
... | 2012/07/09 | [
"https://Stackoverflow.com/questions/11394706",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1137788/"
] | You'll probably get the wrong numbers if you use:
```
local dy = y1-y2
local dx = x1-x2
local angle = atan2(dy,dx) * 180 / pi
```
If you are using the coordinate system where y gets bigger going down the screen and x gets bigger going to the right then you should use:
```
local dy = y1 - y2
local dx = x2 - x1
loca... | As atan2 works as tan-1, so the inverse could be tan, taking into consideration conversion between radian and degree |
5,158,014 | I'm writing some C++ codes for fun and practice, to learn more about language features. I want to know more about static variables and their behaviour in recursive functions. Trying this code in g++ compiler, I'm given expected result:
```
#include <iostream>
using namespace std;
int f(const int& value)
{
static ... | 2011/03/01 | [
"https://Stackoverflow.com/questions/5158014",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/275221/"
] | The order of evaluation of the following three subexpressions is unspecified:
```
f(10)
f(f(10))
f(f(f(10)))
```
The compiler may evaluate those subexpressions in any order. You should not rely on a particular order of evaluation in your program, especially if you intend to compile using multiple compilers.
This is... | Just because the output appears left-to-right on the screen does not mean the *order of evaluation* follows the same direction. In C++, the order of evaluation of function arguments is *unspecified*. Plus, printing data via the `<<` operator is just fancy syntax for calling functions.
In short, if you say `operator<<(... |
5,158,014 | I'm writing some C++ codes for fun and practice, to learn more about language features. I want to know more about static variables and their behaviour in recursive functions. Trying this code in g++ compiler, I'm given expected result:
```
#include <iostream>
using namespace std;
int f(const int& value)
{
static ... | 2011/03/01 | [
"https://Stackoverflow.com/questions/5158014",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/275221/"
] | The order of evaluation of the following three subexpressions is unspecified:
```
f(10)
f(f(10))
f(f(f(10)))
```
The compiler may evaluate those subexpressions in any order. You should not rely on a particular order of evaluation in your program, especially if you intend to compile using multiple compilers.
This is... | An easy way to see exactly what it is doing:
```
int f(const int& value, int fID)
{
static int result = 0;
static int fCounter = 0;
fCounter++;
cout << fCounter << ". ID:" << fID << endl;
return result += value;
}
int main()
{
cout << f(10, 6) << ", " << f(f(10, 4), 5) << ", " << f(f(f(10, 1),2... |
5,158,014 | I'm writing some C++ codes for fun and practice, to learn more about language features. I want to know more about static variables and their behaviour in recursive functions. Trying this code in g++ compiler, I'm given expected result:
```
#include <iostream>
using namespace std;
int f(const int& value)
{
static ... | 2011/03/01 | [
"https://Stackoverflow.com/questions/5158014",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/275221/"
] | The order of evaluation of the following three subexpressions is unspecified:
```
f(10)
f(f(10))
f(f(f(10)))
```
The compiler may evaluate those subexpressions in any order. You should not rely on a particular order of evaluation in your program, especially if you intend to compile using multiple compilers.
This is... | The prefix operator syntax is translated into the following prefix notation:
```
<<( <<( <<( cout, f(10) ), f(f(10)) ), f(f(f(10))) )
A B C
```
Now there are three different function calls, identified as A, B and C above. with the arguments of each call being:
```
arg1 arg2
A: result of B, f(10)
B:... |
58,726,779 | This is something I just noticed but can't find any information, not in PEPs, APIs, or examples. We all know `print` changed to `print()` in Python 3, but I've always seen `return` written as a statement, not a function. However it has exactly the same behaviour as a function. I can see the similarity between this and ... | 2019/11/06 | [
"https://Stackoverflow.com/questions/58726779",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6260169/"
] | It's not a function. It's a statement with unnecessary parentheses. `(val)` means `val`, so `return (val)` is the same as `return val`.
Writing `return(val)`, making it look like a function, is just bad style. | It process it as:
```
return (val)
```
As a number with a paired parenthesis, not a function, but
```
>>> val = 10
>>> (val)
10
>>>
```
`(val)` is not changing anything, only thing it does is to keep it as a number, so it ends with:
```
return val
```
Which is the same as the other one |
8,146,045 | I'm trying to create a simple doc on google docs, I have a sheet called "Income"
With A Being name, B being a date, and C being the amount
What I need to do is get the amount for this month, date format is dd/mm/yyyy
Any help would be appreciated! | 2011/11/16 | [
"https://Stackoverflow.com/questions/8146045",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/810304/"
] | Change
```
dif = (end - start) * 1000;
```
to
```
dif = (end.tv_sec - start.tv_sec) * 1000
+ (end.tv_usec - start.tv_usec) / 1000;
```
In pseudocode:
```
Get the seconds part of the time delta
Multiply by 1000 to get milliseconds
Get the microseconds part of the time delta
Divide that part by 1000
Add that part... | For quick benchmark, I'd use `clock()` and `CLOCKS_PER_SEC`.
Here's some macro code I use:
```
#define CLOCK_TICK(acc, ctr) ctr = std::clock()
#define CLOCK_TOCK(acc, ctr) acc += (std::clock() - ctr)
#define CLOCK_RESET(acc) acc = 0
#define CLOCK_REPORT(acc) (1000. * double(acc) / double(CLOCKS_PER_SEC))
static cl... |
8,146,045 | I'm trying to create a simple doc on google docs, I have a sheet called "Income"
With A Being name, B being a date, and C being the amount
What I need to do is get the amount for this month, date format is dd/mm/yyyy
Any help would be appreciated! | 2011/11/16 | [
"https://Stackoverflow.com/questions/8146045",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/810304/"
] | Change
```
dif = (end - start) * 1000;
```
to
```
dif = (end.tv_sec - start.tv_sec) * 1000
+ (end.tv_usec - start.tv_usec) / 1000;
```
In pseudocode:
```
Get the seconds part of the time delta
Multiply by 1000 to get milliseconds
Get the microseconds part of the time delta
Divide that part by 1000
Add that part... | 1. Make sure you're including the correct header ("#include ")
2. Use "timersub()" to get the difference, instead of subtracting end-start:
<http://linux.die.net/man/3/timeradd>
'Hope that helps .. PSM |
8,146,045 | I'm trying to create a simple doc on google docs, I have a sheet called "Income"
With A Being name, B being a date, and C being the amount
What I need to do is get the amount for this month, date format is dd/mm/yyyy
Any help would be appreciated! | 2011/11/16 | [
"https://Stackoverflow.com/questions/8146045",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/810304/"
] | Change
```
dif = (end - start) * 1000;
```
to
```
dif = (end.tv_sec - start.tv_sec) * 1000
+ (end.tv_usec - start.tv_usec) / 1000;
```
In pseudocode:
```
Get the seconds part of the time delta
Multiply by 1000 to get milliseconds
Get the microseconds part of the time delta
Divide that part by 1000
Add that part... | You want:
```
dif = (end.tv_sec - start.tv_sec) + (end.tv_usec - start.tv_usec) / 1000.0;
```
Note 1: You need the tv\_sec to handle even a short duration crossing a second ticking over.
Note 2: Second term divides by a 1000.0 so as to use floating point rather than integer division. |
8,146,045 | I'm trying to create a simple doc on google docs, I have a sheet called "Income"
With A Being name, B being a date, and C being the amount
What I need to do is get the amount for this month, date format is dd/mm/yyyy
Any help would be appreciated! | 2011/11/16 | [
"https://Stackoverflow.com/questions/8146045",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/810304/"
] | Change
```
dif = (end - start) * 1000;
```
to
```
dif = (end.tv_sec - start.tv_sec) * 1000
+ (end.tv_usec - start.tv_usec) / 1000;
```
In pseudocode:
```
Get the seconds part of the time delta
Multiply by 1000 to get milliseconds
Get the microseconds part of the time delta
Divide that part by 1000
Add that part... | On Linux the best way to achieve this is to use the times(2) interface rather than gettimeofday(2) have a read of the man page.
>
> man 2 times.
>
>
>
It has exquisite fidelity. |
8,146,045 | I'm trying to create a simple doc on google docs, I have a sheet called "Income"
With A Being name, B being a date, and C being the amount
What I need to do is get the amount for this month, date format is dd/mm/yyyy
Any help would be appreciated! | 2011/11/16 | [
"https://Stackoverflow.com/questions/8146045",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/810304/"
] | You want:
```
dif = (end.tv_sec - start.tv_sec) + (end.tv_usec - start.tv_usec) / 1000.0;
```
Note 1: You need the tv\_sec to handle even a short duration crossing a second ticking over.
Note 2: Second term divides by a 1000.0 so as to use floating point rather than integer division. | For quick benchmark, I'd use `clock()` and `CLOCKS_PER_SEC`.
Here's some macro code I use:
```
#define CLOCK_TICK(acc, ctr) ctr = std::clock()
#define CLOCK_TOCK(acc, ctr) acc += (std::clock() - ctr)
#define CLOCK_RESET(acc) acc = 0
#define CLOCK_REPORT(acc) (1000. * double(acc) / double(CLOCKS_PER_SEC))
static cl... |
8,146,045 | I'm trying to create a simple doc on google docs, I have a sheet called "Income"
With A Being name, B being a date, and C being the amount
What I need to do is get the amount for this month, date format is dd/mm/yyyy
Any help would be appreciated! | 2011/11/16 | [
"https://Stackoverflow.com/questions/8146045",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/810304/"
] | You want:
```
dif = (end.tv_sec - start.tv_sec) + (end.tv_usec - start.tv_usec) / 1000.0;
```
Note 1: You need the tv\_sec to handle even a short duration crossing a second ticking over.
Note 2: Second term divides by a 1000.0 so as to use floating point rather than integer division. | 1. Make sure you're including the correct header ("#include ")
2. Use "timersub()" to get the difference, instead of subtracting end-start:
<http://linux.die.net/man/3/timeradd>
'Hope that helps .. PSM |
8,146,045 | I'm trying to create a simple doc on google docs, I have a sheet called "Income"
With A Being name, B being a date, and C being the amount
What I need to do is get the amount for this month, date format is dd/mm/yyyy
Any help would be appreciated! | 2011/11/16 | [
"https://Stackoverflow.com/questions/8146045",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/810304/"
] | You want:
```
dif = (end.tv_sec - start.tv_sec) + (end.tv_usec - start.tv_usec) / 1000.0;
```
Note 1: You need the tv\_sec to handle even a short duration crossing a second ticking over.
Note 2: Second term divides by a 1000.0 so as to use floating point rather than integer division. | On Linux the best way to achieve this is to use the times(2) interface rather than gettimeofday(2) have a read of the man page.
>
> man 2 times.
>
>
>
It has exquisite fidelity. |
10,505,561 | I have a listbox with items bound to an ObservableCollection.
Now, from within the viewModel, I need to cause an update to the UI.
I dont have a refernce to the listbox from my view model.
If I remove or add an item from my ObservableCollection, the ui gets updated.
Based on some other logic I need to update the UI.... | 2012/05/08 | [
"https://Stackoverflow.com/questions/10505561",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1202434/"
] | If you need to change your UI because you've edited the items *in* your collection, then you should arrange for those items to implement the `INotifyPropertyChanged` interface. If the objects within your collection have a `PropertyChanged` event, the UI will be listening for that event from individual items. (If possib... | I've had a similar issue where I wanted to change the background on an item, but obviously neither the item nor the collection changed.
It was achieved by calling:
```
CollectionViewSource.GetDefaultView(your_collection_name).Refresh();
```
This refreshed the view from the view model without altering the collecti... |
10,505,561 | I have a listbox with items bound to an ObservableCollection.
Now, from within the viewModel, I need to cause an update to the UI.
I dont have a refernce to the listbox from my view model.
If I remove or add an item from my ObservableCollection, the ui gets updated.
Based on some other logic I need to update the UI.... | 2012/05/08 | [
"https://Stackoverflow.com/questions/10505561",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1202434/"
] | If you need to change your UI because you've edited the items *in* your collection, then you should arrange for those items to implement the `INotifyPropertyChanged` interface. If the objects within your collection have a `PropertyChanged` event, the UI will be listening for that event from individual items. (If possib... | This is a good case for an extension method. It hides away the implementation in case it changes in future versions, can be modified in one place, and the calling code looks simpler and less confusing.
```
public static void Refresh<T>(this ObservableCollection<T> value)
{
CollectionViewSource.GetDefaultView(value... |
10,505,561 | I have a listbox with items bound to an ObservableCollection.
Now, from within the viewModel, I need to cause an update to the UI.
I dont have a refernce to the listbox from my view model.
If I remove or add an item from my ObservableCollection, the ui gets updated.
Based on some other logic I need to update the UI.... | 2012/05/08 | [
"https://Stackoverflow.com/questions/10505561",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1202434/"
] | I've had a similar issue where I wanted to change the background on an item, but obviously neither the item nor the collection changed.
It was achieved by calling:
```
CollectionViewSource.GetDefaultView(your_collection_name).Refresh();
```
This refreshed the view from the view model without altering the collecti... | This is a good case for an extension method. It hides away the implementation in case it changes in future versions, can be modified in one place, and the calling code looks simpler and less confusing.
```
public static void Refresh<T>(this ObservableCollection<T> value)
{
CollectionViewSource.GetDefaultView(value... |
52,592 | I want to use the following code
```
the_time('d. F Y', '<p class="article-date">', '</p>');
```
to show the date of an article (post) wrapped within `<p></p>`. I also tried
```
echo '<p class="article-date">' . the_time('d. F Y') . '</p>';
```
but again the date isn't placed in those tags. What I'm doing wrong... | 2012/05/18 | [
"https://wordpress.stackexchange.com/questions/52592",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/13921/"
] | ```
<p>
<?php the_time() ?>
</p>
```
It helps with separation of concerns and increases readability of code as well as being consistent with WordPress coding standards and the default coding style.
The first method you attempted is completely invalid, `the_time()` only accepts 1 parameter, the date format. The s... | about your first line of code:
[`the_time()`](http://codex.wordpress.org/Function_Reference/the_time) only uses one parameter.
about your second line of code:
if you want to use 'the\_time' in a string concatenation, use [`get_the_time()`](http://codex.wordpress.org/Function_Reference/get_the_time) :
example:
```... |
11,226 | Many individuals believe they can make significant quantities of money by stock trading. Much of the financial services industry wants the public to believe that it can take our savings and, by the application of investing skill, make better returns than the market average. Much of the advertising for mutual fund inves... | 2012/10/11 | [
"https://skeptics.stackexchange.com/questions/11226",
"https://skeptics.stackexchange.com",
"https://skeptics.stackexchange.com/users/3943/"
] | >
> is there evidence that experts can consistently beat the market?
>
>
>
Yes, there is. It's quoted in [the Forbes article](http://www.forbes.com/sites/rickferri/2012/03/12/why-smart-people-fail-to-beat-the-market/) you provide as a source.
>
> To answer this question, Fama and French compared the distribution... | There is a problem with Mutual Funds. When the market declines, some people unload the funds and the manager has to liquidate to give them their money, i.e. sell into a declining market. Conversely when markets are climbing, the managers have to invest the incoming cash into the climbing stock prices.
This is a struct... |
59,481,865 | Could you please take a look at my code and give me some advice how I might improve my code so it takes less time to process? Main purpose is to look at each row (ID) at test table and find same ID at list table, if it's match then look at time difference between the two identical ID and label them as if it takes less ... | 2019/12/25 | [
"https://Stackoverflow.com/questions/59481865",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11986289/"
] | You can easily generate the indexing array with `r_`.
```
In [165]: np.r_[0,3:15]
Out[165]: array([ 0, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14])
```
under the covers it's just doing
```
In [166]: np.concatenate([[0],np.arange(3,15)]) ... | You can use [**`np.delete`** [numpy-doc]](https://docs.scipy.org/doc/numpy/reference/generated/numpy.delete.html) for that, and use a `slice` object as parameter to remove:
```
>>> np.delete(data, slice(1, 3), 1)
array([[61. , 15.04, 14.96, 13.17, 9.29, 13.96, 9.87, 13.67, 10.25,
10.83, 12.58, 18.5 , 15.04]... |
59,481,865 | Could you please take a look at my code and give me some advice how I might improve my code so it takes less time to process? Main purpose is to look at each row (ID) at test table and find same ID at list table, if it's match then look at time difference between the two identical ID and label them as if it takes less ... | 2019/12/25 | [
"https://Stackoverflow.com/questions/59481865",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11986289/"
] | You can use [**`np.delete`** [numpy-doc]](https://docs.scipy.org/doc/numpy/reference/generated/numpy.delete.html) for that, and use a `slice` object as parameter to remove:
```
>>> np.delete(data, slice(1, 3), 1)
array([[61. , 15.04, 14.96, 13.17, 9.29, 13.96, 9.87, 13.67, 10.25,
10.83, 12.58, 18.5 , 15.04]... | If `a` is your `numpy` array and you want to drop the columns: `1,2`, you could do that using the following in a single line.
```py
import numpy as np
delete_cols = [1,2] # list of column numbers to delete
a[:,list(set(np.arange(a.shape[-1])) - set(delete_cols))]
```
### Some Explanation
What you need here is pro... |
59,481,865 | Could you please take a look at my code and give me some advice how I might improve my code so it takes less time to process? Main purpose is to look at each row (ID) at test table and find same ID at list table, if it's match then look at time difference between the two identical ID and label them as if it takes less ... | 2019/12/25 | [
"https://Stackoverflow.com/questions/59481865",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11986289/"
] | You can easily generate the indexing array with `r_`.
```
In [165]: np.r_[0,3:15]
Out[165]: array([ 0, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14])
```
under the covers it's just doing
```
In [166]: np.concatenate([[0],np.arange(3,15)]) ... | If `a` is your `numpy` array and you want to drop the columns: `1,2`, you could do that using the following in a single line.
```py
import numpy as np
delete_cols = [1,2] # list of column numbers to delete
a[:,list(set(np.arange(a.shape[-1])) - set(delete_cols))]
```
### Some Explanation
What you need here is pro... |
59,481,865 | Could you please take a look at my code and give me some advice how I might improve my code so it takes less time to process? Main purpose is to look at each row (ID) at test table and find same ID at list table, if it's match then look at time difference between the two identical ID and label them as if it takes less ... | 2019/12/25 | [
"https://Stackoverflow.com/questions/59481865",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11986289/"
] | You can easily generate the indexing array with `r_`.
```
In [165]: np.r_[0,3:15]
Out[165]: array([ 0, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14])
```
under the covers it's just doing
```
In [166]: np.concatenate([[0],np.arange(3,15)]) ... | This should work:
```
import numpy as np
data = np.loadtxt('wind.data')
data_nomonth_noday = np.zeros((data.shape[0],data.shape[1]-2))
data_nomonth_noday[:,0] = data[:,0]
data_nomonth_noday[:,1:] = data[:,3:]
```
In my opinion this is more readable,flexible and intuitive than some of the other possible ways of doin... |
59,481,865 | Could you please take a look at my code and give me some advice how I might improve my code so it takes less time to process? Main purpose is to look at each row (ID) at test table and find same ID at list table, if it's match then look at time difference between the two identical ID and label them as if it takes less ... | 2019/12/25 | [
"https://Stackoverflow.com/questions/59481865",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11986289/"
] | This should work:
```
import numpy as np
data = np.loadtxt('wind.data')
data_nomonth_noday = np.zeros((data.shape[0],data.shape[1]-2))
data_nomonth_noday[:,0] = data[:,0]
data_nomonth_noday[:,1:] = data[:,3:]
```
In my opinion this is more readable,flexible and intuitive than some of the other possible ways of doin... | If `a` is your `numpy` array and you want to drop the columns: `1,2`, you could do that using the following in a single line.
```py
import numpy as np
delete_cols = [1,2] # list of column numbers to delete
a[:,list(set(np.arange(a.shape[-1])) - set(delete_cols))]
```
### Some Explanation
What you need here is pro... |
18,046,942 | I've got some client code, in this example `MyModule`, that defines some custom Exceptions in a sub module called `Exception`. In `MyModule` there is a `rescue` block that references `Exception`. The problem is, ruby is resolving the name `Exception` to be `MyModule::Exception` (a module) when it needs to be the base E... | 2013/08/04 | [
"https://Stackoverflow.com/questions/18046942",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1483247/"
] | When in doubt, you need to specify fully qualified name (FQN) for a class. Your exception has this FQN:
```
MyModule::Exception
```
but Exception from core is on top level (not nested in anything), so its FQN is just
```
::Exception
```
And yes, you probably **don't want** to rescue core `Exception`. It's bad pr... | Figured it out. On a lark, I tried `::Exception`, which makes a weird sort of sense. |
66,950 | I'm currently working on a short story in which the main character has received a device from an anonymous individual. This device *appears* to function like a regular phone. Until he realizes that he can send text messages up to 1 hour back into the past.
My question being... How would such a device (theoretically) ... | 2017/01/05 | [
"https://worldbuilding.stackexchange.com/questions/66950",
"https://worldbuilding.stackexchange.com",
"https://worldbuilding.stackexchange.com/users/31755/"
] | Such a device is called a tachyonic antitelephone.
<https://en.wikipedia.org/wiki/Tachyonic_antitelephone>
It relies on the existence of tachyons - particles that always go faster than light.
This Worldbuilding idea has a fine answer walking through why FTL implies time travel.
[Are there any ways to allow some form ... | It's not possible
=================
Imagine this:
A phone (let's call it phone A) gets destroyed. 30 minutes later, the *device* sends a message to phone A 1 hour in the past. There is *no* way that phone A could receive that message since it already got destroyed. It can no longer receive any message ever since it g... |
66,950 | I'm currently working on a short story in which the main character has received a device from an anonymous individual. This device *appears* to function like a regular phone. Until he realizes that he can send text messages up to 1 hour back into the past.
My question being... How would such a device (theoretically) ... | 2017/01/05 | [
"https://worldbuilding.stackexchange.com/questions/66950",
"https://worldbuilding.stackexchange.com",
"https://worldbuilding.stackexchange.com/users/31755/"
] | Wormholes.
----------
Wormholes are hypothetical "connected black holes". In essence you have two points in spacetime which are always connected to each other, and matter and information could *potentially* pass from one to the other very quickly (apparently faster than lightspeed) without violating relativity.
In re... | It's not possible
=================
Imagine this:
A phone (let's call it phone A) gets destroyed. 30 minutes later, the *device* sends a message to phone A 1 hour in the past. There is *no* way that phone A could receive that message since it already got destroyed. It can no longer receive any message ever since it g... |
66,950 | I'm currently working on a short story in which the main character has received a device from an anonymous individual. This device *appears* to function like a regular phone. Until he realizes that he can send text messages up to 1 hour back into the past.
My question being... How would such a device (theoretically) ... | 2017/01/05 | [
"https://worldbuilding.stackexchange.com/questions/66950",
"https://worldbuilding.stackexchange.com",
"https://worldbuilding.stackexchange.com/users/31755/"
] | Such a device is called a tachyonic antitelephone.
<https://en.wikipedia.org/wiki/Tachyonic_antitelephone>
It relies on the existence of tachyons - particles that always go faster than light.
This Worldbuilding idea has a fine answer walking through why FTL implies time travel.
[Are there any ways to allow some form ... | Wormholes.
----------
Wormholes are hypothetical "connected black holes". In essence you have two points in spacetime which are always connected to each other, and matter and information could *potentially* pass from one to the other very quickly (apparently faster than lightspeed) without violating relativity.
In re... |
3,220,176 | I set a Date with 'DateFromComponents" and when I read it out... its wrong.
I have to set the DAY to the 2nd or anything later so I get the right Year?!?
I set year 2011 and when I read it out i get Year 2010 !!
---
```
day = 1;
month = 1;
year = 2011;
NSCalendar *gregorian = [[NSCalendar alloc] initWithCalendarI... | 2010/07/10 | [
"https://Stackoverflow.com/questions/3220176",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/355372/"
] | I ran this code:
```
NSInteger day = 1;
NSInteger month = 1;
NSInteger year =0;
NSCalendar *gregorian;
NSDateComponents *components;
NSDate *theDate;
NSDateFormatter *dateFormatter;
for (int i=2005; i<2015; i++) {
year= i;
gregorian = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar];
co... | As stated in <http://unicode.org/reports/tr35/tr35-6.html#Date_Format_Patterns>, YYYY can differ from the calendar year.
January 1st can belong to the last week of the year before. YYYY will display the year used when mentioning weeks of year (ie week 52 of 2009). If January 1st 2010 belong to the week 52 of 2009, the... |
15,882 | Let's take some old popular at a time but abandoned game: WorldRacing/HiOctane/Constructor/any other. Say I with a team want to revitalize said game and bring it to year 2011 without major changes and then work on improving it (e.g. add multiplayer). Also it is important to keep the game's spirit, assets, story, music,... | 2011/08/12 | [
"https://gamedev.stackexchange.com/questions/15882",
"https://gamedev.stackexchange.com",
"https://gamedev.stackexchange.com/users/3644/"
] | [Byte published a high-level summary of the "abandonware" situation in 2001, which answers many of these questions.](http://www.savetz.com/articles/byte-abandonware.php) However, it's dealing with the case where you simply want the company to re-release the software or release it into the public domain. If you intend t... | You've asked a lot of questions here - let me cherry pick one of them.
>
> How to deal with localizations in other languages, are they to obtain
> from other companies or do they belong to master publisher?
>
>
>
Localization is also one of those areas where it could be managed on a case-by-case basis.
Most co... |
45,348 | I have a [LoRa Click](https://learn.mikroe.com/lora-rf-click-solution-for-iot-developers/) Module and [Adafruit Ultimate GPS](https://www.adafruit.com/product/746) which both use Serial Communication.
I wish to just check the initial tests with all the components in on the Serial Console. Hence I have declared :
* `S... | 2017/10/06 | [
"https://arduino.stackexchange.com/questions/45348",
"https://arduino.stackexchange.com",
"https://arduino.stackexchange.com/users/37223/"
] | You cannot use two SoftwareSerial instances at the same time - or not for receiving anyway.
SoftwareSerial is a "last resort" system - only to be used if there is absolutely no other option. And then you need to be aware of certain information and rules:
* Only one device can *listen* at any time, switchable using th... | Sometimes, with some devices, SoftwareSerial can struggle at higher baud rates, there are quite a few posts on here about it. Would it be possible to set the LoRaSerial to 9600 too?
Can you try just the LoRaSerial on its own?
Do you have a second device, could you wire the SoftwareSerials on you Nano to two Software ... |
1,851,292 | I've gone through [this SO question](https://stackoverflow.com/questions/246058/system-invalidoperationexception-the-object-is-currently-in-use-elsewhere-ho) but it didn't help.
The case here is different. I'm using Backgroundworkers. 1st backgroundworker starts operating on the image input of user and inside firstbac... | 2009/12/05 | [
"https://Stackoverflow.com/questions/1851292",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/193653/"
] | So it looks like your BackgroundWorkers are trying to access the same Windows Forms components at the same time. This would explain why the failure is random.
You'll need to make sure this doesn't happen by using a `lock`, perhaps like so:
```
private object lockObject = new object();
algo1backgroundworker_DoWork()
... | In windows forms not only should you only access the controls from a single thread but that thread should be the main application thread, the thread that created the control.
This means that in DoWork you should not access any controls (without using Control.Invoke). So here you would call RunWorkerAsync passing in yo... |
1,851,292 | I've gone through [this SO question](https://stackoverflow.com/questions/246058/system-invalidoperationexception-the-object-is-currently-in-use-elsewhere-ho) but it didn't help.
The case here is different. I'm using Backgroundworkers. 1st backgroundworker starts operating on the image input of user and inside firstbac... | 2009/12/05 | [
"https://Stackoverflow.com/questions/1851292",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/193653/"
] | There's a lock inside GDI+ that prevents two threads from accessing a bitmap at the same time. This is not a blocking kind of lock, it is a "programmer did something wrong, I'll throw an exception" kind of lock. Your threads are bombing because you are cloning the image (== accessing a bitmap) in all threads. Your UI t... | So it looks like your BackgroundWorkers are trying to access the same Windows Forms components at the same time. This would explain why the failure is random.
You'll need to make sure this doesn't happen by using a `lock`, perhaps like so:
```
private object lockObject = new object();
algo1backgroundworker_DoWork()
... |
1,851,292 | I've gone through [this SO question](https://stackoverflow.com/questions/246058/system-invalidoperationexception-the-object-is-currently-in-use-elsewhere-ho) but it didn't help.
The case here is different. I'm using Backgroundworkers. 1st backgroundworker starts operating on the image input of user and inside firstbac... | 2009/12/05 | [
"https://Stackoverflow.com/questions/1851292",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/193653/"
] | There's a lock inside GDI+ that prevents two threads from accessing a bitmap at the same time. This is not a blocking kind of lock, it is a "programmer did something wrong, I'll throw an exception" kind of lock. Your threads are bombing because you are cloning the image (== accessing a bitmap) in all threads. Your UI t... | In windows forms not only should you only access the controls from a single thread but that thread should be the main application thread, the thread that created the control.
This means that in DoWork you should not access any controls (without using Control.Invoke). So here you would call RunWorkerAsync passing in yo... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.