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 |
|---|---|---|---|---|---|
9,182,137 | How would ya'll recommend that I convert a FlowDocument to PDF to be attached to an EMail?
The FlowDocument is dynamic, not static.
I would prefer to be able to store the PDF in memory as a byte[], rather than on disk, but that is negotiable.
Thanks for your help! | 2012/02/07 | [
"https://Stackoverflow.com/questions/9182137",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/205241/"
] | Disclaimer: I am writer of XamlToPDF Library, however it is free for any type of use.
<http://xamltopdf.codeplex.com/>
Its very easy to create PDF, it supports Tables and images as well. | Another option to look at is [FlowDocumentConverter](https://github.com/marcpiechura/FlowDocumentConverter). This is available in a [NuGet package](https://www.nuget.org/packages/FlowDocumentConverter/), but per [documentation](https://github.com/marcpiechura/FlowDocumentConverter) does have a 10 page limitation. |
9,182,137 | How would ya'll recommend that I convert a FlowDocument to PDF to be attached to an EMail?
The FlowDocument is dynamic, not static.
I would prefer to be able to store the PDF in memory as a byte[], rather than on disk, but that is negotiable.
Thanks for your help! | 2012/02/07 | [
"https://Stackoverflow.com/questions/9182137",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/205241/"
] | I managed to get this working with the PDFCreator printer driver. You need to install the driver for this to work, so it may not be an ideal solution for some people. There is a COM interface available. The code more or less looks something like this:
```
PDFCreator.clsPDFCreator _PDFCreator;
PDFCreato... | Another option to look at is [FlowDocumentConverter](https://github.com/marcpiechura/FlowDocumentConverter). This is available in a [NuGet package](https://www.nuget.org/packages/FlowDocumentConverter/), but per [documentation](https://github.com/marcpiechura/FlowDocumentConverter) does have a 10 page limitation. |
9,182,137 | How would ya'll recommend that I convert a FlowDocument to PDF to be attached to an EMail?
The FlowDocument is dynamic, not static.
I would prefer to be able to store the PDF in memory as a byte[], rather than on disk, but that is negotiable.
Thanks for your help! | 2012/02/07 | [
"https://Stackoverflow.com/questions/9182137",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/205241/"
] | I am assuming you want this to occur programmatically rather than as a manual process.
**Method 1:** Install a PDF driver such as [Amyuni](http://www.amyuni.com/en/enduser/pdfconverterend) or [PrimoPDF](http://www.primopdf.com/). Print your FlowDocument with the desired PrintTicket / page size, to the print driver. Th... | Another option to look at is [FlowDocumentConverter](https://github.com/marcpiechura/FlowDocumentConverter). This is available in a [NuGet package](https://www.nuget.org/packages/FlowDocumentConverter/), but per [documentation](https://github.com/marcpiechura/FlowDocumentConverter) does have a 10 page limitation. |
9,182,137 | How would ya'll recommend that I convert a FlowDocument to PDF to be attached to an EMail?
The FlowDocument is dynamic, not static.
I would prefer to be able to store the PDF in memory as a byte[], rather than on disk, but that is negotiable.
Thanks for your help! | 2012/02/07 | [
"https://Stackoverflow.com/questions/9182137",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/205241/"
] | You have two options that I know of.
The first is to use a proprietary library called [NiPDF](http://nixps.com/nipdf/index.html), alternatively you can use Word Interop.
1. Save the FlowDocument to a DOCX file using [Open XML SDK](http://msdn.microsoft.com/en-us/library/bb448854.aspx)
2. Use Word Interop to load the ... | You might want to consider the product called "Report Writer for .NET" by Seberix (http://www.siberix.com/). Its API is similar to the code behind in FlowDocument which I think is you want want when you said "dynamic, not static". (But I'm sure there are differences as well. Devils are in the details).
Once a Siberix.... |
9,182,137 | How would ya'll recommend that I convert a FlowDocument to PDF to be attached to an EMail?
The FlowDocument is dynamic, not static.
I would prefer to be able to store the PDF in memory as a byte[], rather than on disk, but that is negotiable.
Thanks for your help! | 2012/02/07 | [
"https://Stackoverflow.com/questions/9182137",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/205241/"
] | You have two options that I know of.
The first is to use a proprietary library called [NiPDF](http://nixps.com/nipdf/index.html), alternatively you can use Word Interop.
1. Save the FlowDocument to a DOCX file using [Open XML SDK](http://msdn.microsoft.com/en-us/library/bb448854.aspx)
2. Use Word Interop to load the ... | When I needed to do this I saved the FlowDocument as an XPS file and finally converted to PDF with PDFSharp and deleted the XPS file
```
var test = (IDocumentPaginatorSource)flowDoc;
XpsDocument xpsDocument = new XpsDocument(xpsFileLocation, FileAccess.ReadWrite);
XpsDocumentWriter writer = XpsDocument.CreateXpsDocume... |
9,182,137 | How would ya'll recommend that I convert a FlowDocument to PDF to be attached to an EMail?
The FlowDocument is dynamic, not static.
I would prefer to be able to store the PDF in memory as a byte[], rather than on disk, but that is negotiable.
Thanks for your help! | 2012/02/07 | [
"https://Stackoverflow.com/questions/9182137",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/205241/"
] | You have two options that I know of.
The first is to use a proprietary library called [NiPDF](http://nixps.com/nipdf/index.html), alternatively you can use Word Interop.
1. Save the FlowDocument to a DOCX file using [Open XML SDK](http://msdn.microsoft.com/en-us/library/bb448854.aspx)
2. Use Word Interop to load the ... | I managed to get this working with the PDFCreator printer driver. You need to install the driver for this to work, so it may not be an ideal solution for some people. There is a COM interface available. The code more or less looks something like this:
```
PDFCreator.clsPDFCreator _PDFCreator;
PDFCreato... |
34,186,890 | I'm trying to figure out how to make a python program that highlights the position/positions of a certain inputed word in a sentence and lists what place that word is. For example if the sentence was: "The fat cat sat on the mat"
then the position for the word fat would be Number 2.
Heres what Ive got so far:
```
var... | 2015/12/09 | [
"https://Stackoverflow.com/questions/34186890",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5660756/"
] | The reason is that the iterator block is always lazy. Unless you call `GetEnumerator()` and then `MoveNext()`, the code in the method won't get executed.
In other words, consider this call to your "equivalent" method:
```
var ignored = OtherEnumerable.Where<string>(null, null);
```
No exception is thrown, because y... | It may depend of the scenario and your coding style. Jon Skeet is absolutely right about why they should be separated when you're using `yield` to create iterators.
BTW, I thought it could be interesting adding my two cents here: same code using *Code Contracts* (i.e. *design by contract*) behaves in a different way.
... |
34,186,890 | I'm trying to figure out how to make a python program that highlights the position/positions of a certain inputed word in a sentence and lists what place that word is. For example if the sentence was: "The fat cat sat on the mat"
then the position for the word fat would be Number 2.
Heres what Ive got so far:
```
var... | 2015/12/09 | [
"https://Stackoverflow.com/questions/34186890",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5660756/"
] | The reason is that the iterator block is always lazy. Unless you call `GetEnumerator()` and then `MoveNext()`, the code in the method won't get executed.
In other words, consider this call to your "equivalent" method:
```
var ignored = OtherEnumerable.Where<string>(null, null);
```
No exception is thrown, because y... | A method using `yield return` looks very nice and simple, but if you examine the compiled code you will notice it gets quite complicated.
The compiler generates a new class for you with state machine logic to support the enumeration. For the 2nd `Where` method, it's around 160 lines of code after decompilation. The ac... |
34,186,890 | I'm trying to figure out how to make a python program that highlights the position/positions of a certain inputed word in a sentence and lists what place that word is. For example if the sentence was: "The fat cat sat on the mat"
then the position for the word fat would be Number 2.
Heres what Ive got so far:
```
var... | 2015/12/09 | [
"https://Stackoverflow.com/questions/34186890",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5660756/"
] | It may depend of the scenario and your coding style. Jon Skeet is absolutely right about why they should be separated when you're using `yield` to create iterators.
BTW, I thought it could be interesting adding my two cents here: same code using *Code Contracts* (i.e. *design by contract*) behaves in a different way.
... | A method using `yield return` looks very nice and simple, but if you examine the compiled code you will notice it gets quite complicated.
The compiler generates a new class for you with state machine logic to support the enumeration. For the 2nd `Where` method, it's around 160 lines of code after decompilation. The ac... |
41,305,836 | I have a column of numbers and want to go through each cell to check if the number is positive, or negative. After determining if a number is positive, or negative I want to copy and paste that number into a new table on a new sheet separating the positive and negative values.
I used a nested if statement to do this o... | 2016/12/23 | [
"https://Stackoverflow.com/questions/41305836",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7335589/"
] | My solution to this kind of problem is not to use a tag in this way at all. It's a complete misuse of tags (in my opinion), and is likely to cause trouble down the road (as you've discovered), because cells are reused.
Typically, the problem being solved is this: A piece of interface in a cell is interacted with by th... | You are running into the issue of cell-reuse.
When you create a button for the view you set a tag to it, but then you override this tag to set the row number to it.
When the cell get's reused, because the row number is longer ROW\_BUTTON\_ACTION, you don't reset the tag to the correct row number and things go wrong.
... |
41,305,836 | I have a column of numbers and want to go through each cell to check if the number is positive, or negative. After determining if a number is positive, or negative I want to copy and paste that number into a new table on a new sheet separating the positive and negative values.
I used a nested if statement to do this o... | 2016/12/23 | [
"https://Stackoverflow.com/questions/41305836",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7335589/"
] | My solution to this kind of problem is not to use a tag in this way at all. It's a complete misuse of tags (in my opinion), and is likely to cause trouble down the road (as you've discovered), because cells are reused.
Typically, the problem being solved is this: A piece of interface in a cell is interacted with by th... | I agree with @matt that this is not a good use of tags, but disagree with him slightly about the solution. Instead of walking up the button's superviews until you find a cell, I prefer to get the button's origin, convert it to table view coordinates, and then ask the table view for the indexPath of the cell that contai... |
557,177 | I stumbled on a retro Dutch [video](https://youtu.be/J-gCBh6rk3M?t=11) from 1983 where a large four color mechanical display is shown.
Each pixel consists of a cube which can be turned in order to change the pixel color between 4 colors (white, green, red and blue), a carriage moves behind the screen and slowly updates... | 2021/03/29 | [
"https://electronics.stackexchange.com/questions/557177",
"https://electronics.stackexchange.com",
"https://electronics.stackexchange.com/users/206791/"
] | Your board outputs logic levels like +5V or 0V to control the LEDs, these are voltage, and voltage is relative, it is the difference in electric potential between two points. You can't have a voltage if you have only one wire, you need two. One of them is often called "ground" or "0V" and it is used as a voltage refere... | Connecting the grounds between two systems that are in physical close proximity to each other is normal and done frequently.
If however your systems are far apart (on the order of 20+ ft.) , then you'll want to use some sort of isolation system to allow them to communicate while maintaining separate grounds. |
55,940,664 | I have a problem. I created a dictionary like this:
```
var TriangleRegistry = new Dictionary<string, TriangleRegistryObject>();
```
With a class like this:
```
class TriangleRegistryObject
{
public double x1 { get; set; }
public double y1 { get; set; }
public double x2 { get; set; }
public double y... | 2019/05/01 | [
"https://Stackoverflow.com/questions/55940664",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | If you want to store and retrieve something from a dictionary and the key is made up of all three coordinates of the triangle - six values - then the combined coordinates of the triangle *are* the key to the dictionary.
That's what you're describing here:
>
> I know x1, y1, x2, y2, x3, y3 and I want get the value of... | You can use LINQ to query your dictionary and find a match:
```
using System.Linq;
...
var matches = TriangleRegistry.Where(t => t.Value.X1 == ... && t.Value.Y1 == ...); // fill in the blanks here with whatever you're looking for
foreach (var match in matches)
{
Console.WriteLine("Here's a match: {0}", match.Sele... |
55,940,664 | I have a problem. I created a dictionary like this:
```
var TriangleRegistry = new Dictionary<string, TriangleRegistryObject>();
```
With a class like this:
```
class TriangleRegistryObject
{
public double x1 { get; set; }
public double y1 { get; set; }
public double x2 { get; set; }
public double y... | 2019/05/01 | [
"https://Stackoverflow.com/questions/55940664",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | You can do that by using LINQ (as posted above/below) or for each loop and check wash variable. In most cases LINQ is slower alot so if your application requires a better performance - consider using for each / etc. | You can use LINQ to query your dictionary and find a match:
```
using System.Linq;
...
var matches = TriangleRegistry.Where(t => t.Value.X1 == ... && t.Value.Y1 == ...); // fill in the blanks here with whatever you're looking for
foreach (var match in matches)
{
Console.WriteLine("Here's a match: {0}", match.Sele... |
55,940,664 | I have a problem. I created a dictionary like this:
```
var TriangleRegistry = new Dictionary<string, TriangleRegistryObject>();
```
With a class like this:
```
class TriangleRegistryObject
{
public double x1 { get; set; }
public double y1 { get; set; }
public double x2 { get; set; }
public double y... | 2019/05/01 | [
"https://Stackoverflow.com/questions/55940664",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | If you want to store and retrieve something from a dictionary and the key is made up of all three coordinates of the triangle - six values - then the combined coordinates of the triangle *are* the key to the dictionary.
That's what you're describing here:
>
> I know x1, y1, x2, y2, x3, y3 and I want get the value of... | You can do that by using LINQ (as posted above/below) or for each loop and check wash variable. In most cases LINQ is slower alot so if your application requires a better performance - consider using for each / etc. |
2,375,790 | Can you help me with this problem?
>
> Evaluate
> $${\int \int \int\_{\Omega } xy^{2}z^{2}dxdydz}$$
> where $\Omega = \left \{ z=xy,x=1, z=0 \right \}$
>
>
>
**Edit:**
where $\Omega$ is bounded by the surfaces $z=xy$, $y= x$ , $x=1$, $z=0$.
Sorry !!! | 2017/07/29 | [
"https://math.stackexchange.com/questions/2375790",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/463791/"
] | Hint. Note that
$$\iiint\_{\Omega } xy^{2}z^{2}dxdydz=\int\_{x=0}^1\left(\int\_{y=0}^x\left(\int\_{z=0}^{xy} xy^{2}z^{2}dz\right)dy\right)dx$$
Can you take it from here? | Robert Z is correct, the setup is
$$
\iiint\_\Omega xy^2z^2\;dV=\int\_0^1 \int\_0^x \int\_0^{xy} xy^2z^2 \;dz\;dy\;dx
$$
which can be easily computed from there to obtain $\dfrac{1}{198}$, you can even [confirm at this link](http://www.wolframalpha.com/input/?i=Integrate%5Bxy%5E2z%5E2,%7Bx,0,1%7D,%7By,0,x%7D,%7Bz,0,xy... |
4,144,578 | >
> Find the number of quadratic equations of the form $x^2 + ax + b = 0,$ such that whenever $c$ is a root of the equation, $c^2 - 2$ is also a root of the equation.
>
>
>
Hello, today I came across this problem on a worksheet, and I wasn't able to solve with the tools that I have learned so far on the subject.
... | 2021/05/19 | [
"https://math.stackexchange.com/questions/4144578",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/911556/"
] | Suppose $c$ is a root. Then $c^2 - 2$ is a root. But then $(c^2 - 2)^2 - 2 = c^4 - 4c^2 + 2$ is a root as well (because $c^2 - 2$ is a root).
But there are only two roots! So either $c = c^2 - 2$ or $c = c^4 - 4c^2 + 2$ or $c^2 - 2 = c^4 - 4c^2 + 2$. If you solve all of these equations, you find that either $c = \pm 1... | If $p, q$ are roots, then we must have $p^2-2\in \{p, q\}$:
Now $p^2-2=p \implies (p-2)(p+1)=0 \implies p \in \{2, -1\}$. This raises three distinct possibilities:
Case 1:
$p^2-2=p, q^2-2=q \implies p, q \in \{2, -1\} \implies (x-2)^2, (x-2)(x+1), (x+1)^2$ are the three possible quadratics in this case.
Case 2: $... |
70,305,442 | ```
sweets = {'cadbury': [180,90], 'candy': [190],
'milk chocolate': [150, 160], 'dark chocolate': [100],
'white chocolate': [180], 'ice cream': [122]}
```
The dict sweets has different keys and list values pairs. I would like to get your help on finding the average of the numbers in the value lis... | 2021/12/10 | [
"https://Stackoverflow.com/questions/70305442",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13780668/"
] | You can use `statistics.mean` to compute the mean, and `max` with a custom key to get the key with a max mean:
```py
sweets = {'cadbury': [180,90], 'candy': [190], 'milk chocolate': [150, 160], 'dark chocolate': [100], 'white chocolate': [180],
'ice cream': [122]}
from statistics import mean
max(sweets, key=lambda x... | Using numpy you could try:
```
d = {x:np.mean(sweets[x]) for x in sweets}
```
Returning:
```
{'cadbury': 135.0,
'candy': 190.0,
'dark chocolate': 100.0,
'ice cream': 122.0,
'milk chocolate': 155.0,
'white chocolate': 180.0}
```
And to get the key:
```
max(d, key=d.get)
```
Returning:
```
'candy'
``` |
70,305,442 | ```
sweets = {'cadbury': [180,90], 'candy': [190],
'milk chocolate': [150, 160], 'dark chocolate': [100],
'white chocolate': [180], 'ice cream': [122]}
```
The dict sweets has different keys and list values pairs. I would like to get your help on finding the average of the numbers in the value lis... | 2021/12/10 | [
"https://Stackoverflow.com/questions/70305442",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13780668/"
] | Using numpy you could try:
```
d = {x:np.mean(sweets[x]) for x in sweets}
```
Returning:
```
{'cadbury': 135.0,
'candy': 190.0,
'dark chocolate': 100.0,
'ice cream': 122.0,
'milk chocolate': 155.0,
'white chocolate': 180.0}
```
And to get the key:
```
max(d, key=d.get)
```
Returning:
```
'candy'
``` | Write a for loop for iterarting every key values in dict. Then write inner loop for calculating average for each key. First have to set maximum average to minimum float value then if value is more than min value set it as maximum average, until loop ends. |
70,305,442 | ```
sweets = {'cadbury': [180,90], 'candy': [190],
'milk chocolate': [150, 160], 'dark chocolate': [100],
'white chocolate': [180], 'ice cream': [122]}
```
The dict sweets has different keys and list values pairs. I would like to get your help on finding the average of the numbers in the value lis... | 2021/12/10 | [
"https://Stackoverflow.com/questions/70305442",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13780668/"
] | You can use `statistics.mean` to compute the mean, and `max` with a custom key to get the key with a max mean:
```py
sweets = {'cadbury': [180,90], 'candy': [190], 'milk chocolate': [150, 160], 'dark chocolate': [100], 'white chocolate': [180],
'ice cream': [122]}
from statistics import mean
max(sweets, key=lambda x... | Write a for loop for iterarting every key values in dict. Then write inner loop for calculating average for each key. First have to set maximum average to minimum float value then if value is more than min value set it as maximum average, until loop ends. |
6,008,895 | How would I draw something on a Canvas in C# for Windows Phone?
Okay, let me be a little more clear.
Say the user taps his finger down at 386,43 on the canvas. (the canvas is 768 by 480)
I would like my application to be able to respond by placing a red dot at 386,43 on the canvas.
I have **no** prior experience with C... | 2011/05/15 | [
"https://Stackoverflow.com/questions/6008895",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/631193/"
] | There are various ways of doing this. Depending on the nature of the red dot, you could make it a UserControl. For a basic circle, you can simply handle your canvas' `ManipulationStarted` event.
```
private void myCanvas_ManipulationStarted(object sender, ManipulationStartedEventArgs e)
{
Ellipse el = new... | I think you need to approach the problem differently. (I'm not including code on purpose, because of that).
Forms and controls in an Windows applications (including Phone) can be refreshed for several reasons, at any time. If you draw on a canvas in response to a touch action, you have an updated canvas until the next... |
7,619,671 | I have a class which is implementing an interface, and one of the methods is called onClick. Is there a way to implement the onClick that the interface wants but name it something else? Something like (and I'm making this up):
```
public void AnyMethodNameIWant() implements Interface1.onClick
```
Three reasons I'm a... | 2011/10/01 | [
"https://Stackoverflow.com/questions/7619671",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/974369/"
] | No, you can't. Interfaces *have* to be implemented by a method of the same name in Java.
You can use the `@Override` annotation with interface implementations (as of Java 6) though, which helps to clarify that this is a method which can't just be renamed arbitrarily.
One option for your second issue might be to creat... | Nope.
The only thing you could do is add a shadow method that implements the interface and calls your method.
```
public class MyClass implements Interface1 {
public void AnyMethodNameIWant() { ...; }
public void onClick() { AnyMethodNameIWant(); }
}
``` |
7,619,671 | I have a class which is implementing an interface, and one of the methods is called onClick. Is there a way to implement the onClick that the interface wants but name it something else? Something like (and I'm making this up):
```
public void AnyMethodNameIWant() implements Interface1.onClick
```
Three reasons I'm a... | 2011/10/01 | [
"https://Stackoverflow.com/questions/7619671",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/974369/"
] | No, you can't. Interfaces *have* to be implemented by a method of the same name in Java.
You can use the `@Override` annotation with interface implementations (as of Java 6) though, which helps to clarify that this is a method which can't just be renamed arbitrarily.
One option for your second issue might be to creat... | You can't rename the method, but you could define both methods (`onClick` and `anyMethodNameIWant`) and have `onClick` just simply call your other method.
```
@Override
public void onClick() {
anyOtherMethodNameIWant();
}
``` |
7,619,671 | I have a class which is implementing an interface, and one of the methods is called onClick. Is there a way to implement the onClick that the interface wants but name it something else? Something like (and I'm making this up):
```
public void AnyMethodNameIWant() implements Interface1.onClick
```
Three reasons I'm a... | 2011/10/01 | [
"https://Stackoverflow.com/questions/7619671",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/974369/"
] | No, you can't. Interfaces *have* to be implemented by a method of the same name in Java.
You can use the `@Override` annotation with interface implementations (as of Java 6) though, which helps to clarify that this is a method which can't just be renamed arbitrarily.
One option for your second issue might be to creat... | You of course can have additional methods with different names that point to the same implementation to get the naming you desire.
```
public void interfaceMethodA(){
// some implementation here
}
public void AnyMethodNameIWant(){
interfaceMethodA();
}
``` |
7,619,671 | I have a class which is implementing an interface, and one of the methods is called onClick. Is there a way to implement the onClick that the interface wants but name it something else? Something like (and I'm making this up):
```
public void AnyMethodNameIWant() implements Interface1.onClick
```
Three reasons I'm a... | 2011/10/01 | [
"https://Stackoverflow.com/questions/7619671",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/974369/"
] | No, you can't. Interfaces *have* to be implemented by a method of the same name in Java.
You can use the `@Override` annotation with interface implementations (as of Java 6) though, which helps to clarify that this is a method which can't just be renamed arbitrarily.
One option for your second issue might be to creat... | Those two points
>
> * To avoid 'generic' names like onClick that an interface may require me to have
> * To distinguish between the same method names in many interfaces
>
>
>
are usually solved by using the *[Adapter Pattern](http://en.wikipedia.org/wiki/Adapter_pattern)*.
```
interface IFoo {
void onClick... |
7,619,671 | I have a class which is implementing an interface, and one of the methods is called onClick. Is there a way to implement the onClick that the interface wants but name it something else? Something like (and I'm making this up):
```
public void AnyMethodNameIWant() implements Interface1.onClick
```
Three reasons I'm a... | 2011/10/01 | [
"https://Stackoverflow.com/questions/7619671",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/974369/"
] | Nope.
The only thing you could do is add a shadow method that implements the interface and calls your method.
```
public class MyClass implements Interface1 {
public void AnyMethodNameIWant() { ...; }
public void onClick() { AnyMethodNameIWant(); }
}
``` | You can't rename the method, but you could define both methods (`onClick` and `anyMethodNameIWant`) and have `onClick` just simply call your other method.
```
@Override
public void onClick() {
anyOtherMethodNameIWant();
}
``` |
7,619,671 | I have a class which is implementing an interface, and one of the methods is called onClick. Is there a way to implement the onClick that the interface wants but name it something else? Something like (and I'm making this up):
```
public void AnyMethodNameIWant() implements Interface1.onClick
```
Three reasons I'm a... | 2011/10/01 | [
"https://Stackoverflow.com/questions/7619671",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/974369/"
] | Nope.
The only thing you could do is add a shadow method that implements the interface and calls your method.
```
public class MyClass implements Interface1 {
public void AnyMethodNameIWant() { ...; }
public void onClick() { AnyMethodNameIWant(); }
}
``` | You of course can have additional methods with different names that point to the same implementation to get the naming you desire.
```
public void interfaceMethodA(){
// some implementation here
}
public void AnyMethodNameIWant(){
interfaceMethodA();
}
``` |
7,619,671 | I have a class which is implementing an interface, and one of the methods is called onClick. Is there a way to implement the onClick that the interface wants but name it something else? Something like (and I'm making this up):
```
public void AnyMethodNameIWant() implements Interface1.onClick
```
Three reasons I'm a... | 2011/10/01 | [
"https://Stackoverflow.com/questions/7619671",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/974369/"
] | Those two points
>
> * To avoid 'generic' names like onClick that an interface may require me to have
> * To distinguish between the same method names in many interfaces
>
>
>
are usually solved by using the *[Adapter Pattern](http://en.wikipedia.org/wiki/Adapter_pattern)*.
```
interface IFoo {
void onClick... | You can't rename the method, but you could define both methods (`onClick` and `anyMethodNameIWant`) and have `onClick` just simply call your other method.
```
@Override
public void onClick() {
anyOtherMethodNameIWant();
}
``` |
7,619,671 | I have a class which is implementing an interface, and one of the methods is called onClick. Is there a way to implement the onClick that the interface wants but name it something else? Something like (and I'm making this up):
```
public void AnyMethodNameIWant() implements Interface1.onClick
```
Three reasons I'm a... | 2011/10/01 | [
"https://Stackoverflow.com/questions/7619671",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/974369/"
] | Those two points
>
> * To avoid 'generic' names like onClick that an interface may require me to have
> * To distinguish between the same method names in many interfaces
>
>
>
are usually solved by using the *[Adapter Pattern](http://en.wikipedia.org/wiki/Adapter_pattern)*.
```
interface IFoo {
void onClick... | You of course can have additional methods with different names that point to the same implementation to get the naming you desire.
```
public void interfaceMethodA(){
// some implementation here
}
public void AnyMethodNameIWant(){
interfaceMethodA();
}
``` |
4,007,087 | I cannot figure out how to solve this integral with the commonly known methods of integration. The different online integral calculators that I have tried fail to solve it.
$ \int \sin(a x) ((b-x)^2-c^2)^{-3/2} dx $
where *a, b* and *c* are constants.
Is there a solution? Thanks. | 2021/01/31 | [
"https://math.stackexchange.com/questions/4007087",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/881399/"
] | Unlike derivatives, not every elementary function has an elementary antiderivative. Elementary meaning polynomials, trigonometric functions, logarithmic functions, exponential functions and their inverse functions.
One example is $$\int e^{-x^2} dx$$
which cannot be represented by any elementary function. I am pretty... | The problems with your integral are the unknown parameters $a, b, c$.
Assuming they are all real, it's basically impossible to solve the general integral due to their unknown nature indeed.
Even the very trivial case in which $a = b = c = 1$ brings lots of problems.
There are special cases, for example:
**Special cas... |
63,837,096 | Today, the behavior of Typeorm (Postgres) for
* `getManager().query(...)` and
* `getRepositoty().createQueryBuilder(...).getMany()`
is to wait for a response indefinitely.
Is there a way to introduce a request timeout that I might've missed?
If this is not possible, does Typeorm expose the connection from its pool ... | 2020/09/10 | [
"https://Stackoverflow.com/questions/63837096",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1248779/"
] | To work with a specific connection from the pool use `createQueryRunner` there is no info about it in the docs but it is documented in the [api](https://typeorm.delightful.studio/classes/_connection_connection_.connection.html).
>
> Creates a query runner used for perform queries on a single database connection.
> Us... | [from the documentation](https://typeorm.io/#/connection-options/common-connection-options) you can use `maxQueryExecutionTime` ConnectionOption.
`maxQueryExecutionTime` - If query execution time exceed this given max execution time (in milliseconds) then logger will log this query.
ConnectionOptions is a connection ... |
63,837,096 | Today, the behavior of Typeorm (Postgres) for
* `getManager().query(...)` and
* `getRepositoty().createQueryBuilder(...).getMany()`
is to wait for a response indefinitely.
Is there a way to introduce a request timeout that I might've missed?
If this is not possible, does Typeorm expose the connection from its pool ... | 2020/09/10 | [
"https://Stackoverflow.com/questions/63837096",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1248779/"
] | You can change the default behaviour on a per connection basis either by using `statement_timeout` or `query_timeout`. You can read more about all possible configurations in the official node pg driver [doc](https://node-postgres.com/api/client). Difference between a `statement` and `query`?
>
> A statement is any SQ... | [from the documentation](https://typeorm.io/#/connection-options/common-connection-options) you can use `maxQueryExecutionTime` ConnectionOption.
`maxQueryExecutionTime` - If query execution time exceed this given max execution time (in milliseconds) then logger will log this query.
ConnectionOptions is a connection ... |
63,837,096 | Today, the behavior of Typeorm (Postgres) for
* `getManager().query(...)` and
* `getRepositoty().createQueryBuilder(...).getMany()`
is to wait for a response indefinitely.
Is there a way to introduce a request timeout that I might've missed?
If this is not possible, does Typeorm expose the connection from its pool ... | 2020/09/10 | [
"https://Stackoverflow.com/questions/63837096",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1248779/"
] | To work with a specific connection from the pool use `createQueryRunner` there is no info about it in the docs but it is documented in the [api](https://typeorm.delightful.studio/classes/_connection_connection_.connection.html).
>
> Creates a query runner used for perform queries on a single database connection.
> Us... | You can change the default behaviour on a per connection basis either by using `statement_timeout` or `query_timeout`. You can read more about all possible configurations in the official node pg driver [doc](https://node-postgres.com/api/client). Difference between a `statement` and `query`?
>
> A statement is any SQ... |
36,570,106 | I'm trying to port the following to a UWP app:
`var localAppData = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
string spotlightPath = System.IO.Path.Combine(localAppData, "Packages\\Microsoft.Windows.ContentDeliveryManager_cw5n1h2txyewy\\LocalState\\Assets");`
It look like ApplicationDa... | 2016/04/12 | [
"https://Stackoverflow.com/questions/36570106",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/584423/"
] | Try replacing
```
x.readonly = "readonly";
```
with
```
x.readOnly = true;
```
Notice that `O` of `readOnly` is caps now, and value is a boolean.
`getElementsByTagName` returns a NodeList rather than a Node. You need to iterate them
```
function hide ()
{
var x = document.getElementsByTagName("input");
... | Instead of read only try for disable.
```
document.getElementById("InputBoxID").disabled = true;
``` |
36,570,106 | I'm trying to port the following to a UWP app:
`var localAppData = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
string spotlightPath = System.IO.Path.Combine(localAppData, "Packages\\Microsoft.Windows.ContentDeliveryManager_cw5n1h2txyewy\\LocalState\\Assets");`
It look like ApplicationDa... | 2016/04/12 | [
"https://Stackoverflow.com/questions/36570106",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/584423/"
] | Try replacing
```
x.readonly = "readonly";
```
with
```
x.readOnly = true;
```
Notice that `O` of `readOnly` is caps now, and value is a boolean.
`getElementsByTagName` returns a NodeList rather than a Node. You need to iterate them
```
function hide ()
{
var x = document.getElementsByTagName("input");
... | Get all input tags and set attribute..working...
```
function hide () {
var x = document.getElementsByTagName("input");
for ( var counter = 0; counter < x.length; counter++)
{
x[counter].setAttribute("readonly","true");
}
}
``` |
36,570,106 | I'm trying to port the following to a UWP app:
`var localAppData = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
string spotlightPath = System.IO.Path.Combine(localAppData, "Packages\\Microsoft.Windows.ContentDeliveryManager_cw5n1h2txyewy\\LocalState\\Assets");`
It look like ApplicationDa... | 2016/04/12 | [
"https://Stackoverflow.com/questions/36570106",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/584423/"
] | Get all input tags and set attribute..working...
```
function hide () {
var x = document.getElementsByTagName("input");
for ( var counter = 0; counter < x.length; counter++)
{
x[counter].setAttribute("readonly","true");
}
}
``` | Instead of read only try for disable.
```
document.getElementById("InputBoxID").disabled = true;
``` |
24,863,011 | I want those images to be visible when i hover them over the text. But according to this it works but it selects the first one only as there is same id for every images. Please any one know to fix this problem. This is my first post. Pls excuse if i had done anything wrong in posting. Thanks in advance.
```
<!doctype ... | 2014/07/21 | [
"https://Stackoverflow.com/questions/24863011",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3860258/"
] | `D` doesn't have a constructor taking an `int`. If you want it to inherit `B`'s constructor, say so, like this:
```
struct D : B {
using B::B;
int d;
};
```
You probably want to do more than that though, given that `D` has another `int` member.
A more complete `D` which initialises both `B::b` (by calling `B::... | In what you've written `D` has only a default constructor and does not know how to invoke `B::B(int i)`. All you have to do is to provide a corresponding constructor in `D` like:
```
struct D : B {
D(int i) : B(i) {}//;
int d;
};
``` |
10,706,522 | <http://jqueryfordesigners.com/demo/scroll-link-nav.html>
The link above is more or less what im looking for in terms of the active state responding to the scroll position.
But if one tries this on an ipad the active state sticks in certain places and trying to navigate purely by tapping the buttons, it stops scrolli... | 2012/05/22 | [
"https://Stackoverflow.com/questions/10706522",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1341935/"
] | I have one solution which does the scrolling on all browsers
<http://jsfiddle.net/t9mna/1/> all browsers
-------------------------------------------
```
$("nav ul li a").click(function(){
$(".selected").removeClass("selected");
$(this).addClass("selected");
var $scrollTo = $($(this).attr("href"));
$('... | ```
$("nav ul li a").click(function(){
$(".selected").removeClass("selected");
$(this).addClass("selected");
var $scrollTo = $($(this).attr("href"));
$(function() {
if ($(isiPad).length != 1) {
$('html, body').animate({
scrollTop: $.scrollTo.offset().top //point
... |
49,525 | How do you typically handle data ownership in these systems?
Right now I just have a map that maps type(std::string or hashed int)->void\* where outside sources can add attributes via a simple AddAttribute method.
Right now I'm having the problem of where and how to delete some of that data, since some of it is add... | 2013/02/17 | [
"https://gamedev.stackexchange.com/questions/49525",
"https://gamedev.stackexchange.com",
"https://gamedev.stackexchange.com/users/7946/"
] | To make it more general than in the comments. There is nothing special in an ECS regarding memory management and object ownership. The same rules apply as to any other application.
Personally I'm an advocate of the most restricted version, clear object ownership and an explicit lifetime management for objects and memo... | As Maik's answer says, the difference between reference data and value data (and how to manage the lifetime of references) presents the same challenges to any system that offers both types, and the use of components here doesn't really change anything. The main problem you have is that you're trying not to hard-code an... |
57,132,505 | I have 100 dataframes like this:
```
Date ID Value weight
1 2018-07-16 123450 617 0.1
2 2018-07-23 123450 476 0.3
3 2018-07-30 123450 445 0.4
4 2018-08-06 123450 248 0.1
5 2018-08-13 123450 177 0.1
```
Each data set only has the same "ID" and sum(weight) = 1
I would like ... | 2019/07/21 | [
"https://Stackoverflow.com/questions/57132505",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11792552/"
] | Assuming your entire data inside a single dataframe named `mydata`
```
id_list <- unique(mydata$ID)
for(i in 1:length(id_list)) {
selected <- mydata[mydata$ID == id_list[i],]
wm <- weighted.mean(selected$Value, selected$weight)
wsd <- sum(selected$Value * (selected$Value - wm)^2)
pre_result <- data.frame(ID=id_li... | We can write a function which calculates required values from each dataframe
```
get_return_values <- function(df) {
wm <- with(df, weighted.mean(Value, weight))
wsd <- with(df, sum(weight * (Value - wm)^2))
data.frame(ID = df$ID[1], wm = wm, wsd = wsd)
}
```
Then the main task is to get all the dataframes in ... |
4,076,727 | I am getting this error in my C# application. I am using log4net as a logging tool.
Here is my app.config file:
```xml
<configuration>
<configSections>
<section name="log4net" type ="log4net.Config.Log4NetConfigurationSectionHandler,log4net"/>
</configSections>
<log4net>
<root>
<level value="ALL... | 2010/11/02 | [
"https://Stackoverflow.com/questions/4076727",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/194476/"
] | Use this:
```
<lockingModel type="log4net.Appender.FileAppender+MinimalLock" />
```
Note: `type` instead of `value`. | This error can also happen when there is an XML element in the appender configuration but not a matching property in the appender. For example the `BufferingAppenderSkeleton` does not have a property for "LockingModel", so if it's included in the configxml as it is in the above examples, the `XmlConfigurator` will repo... |
36,012,532 | I am trying to use Number Formatter and while formatting the negetive value , it appends () around it.
here is the code
```
double amount =-200.0;
Locale locale = new Locale("en", "US");
NumberFormat currencyFormatter = NumberFormat.getCurrencyInstance(locale);
System.out.println(currencyFormatter.... | 2016/03/15 | [
"https://Stackoverflow.com/questions/36012532",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1863039/"
] | add this two line with your curreny formatter
```
currencyFormatter.setNegativePrefix("-")
currencyFormatter.setNegativeSuffix("")
``` | Maybe it is better to avoid currency formatter in this case? You can try universal decimal formatter instead:
```
double amount = -200.0;
DecimalFormat formatter = new DecimalFormat("$#,##0.00;$-#,##0.00");
String result = formatter.format(amount);
System.out.println(result);
```
Pattern which is passed into the con... |
30,779,827 | This question has been asked many a times and i have found many results but none of them really helped me.
Using the below code to Switch ON GPS
```
String provider = Settings.Secure.getString(getContentResolver(), Settings.Secure.LOCATION_PROVIDERS_ALLOWED);
Log.i("GPS IS ON", "GPS IS ON"+provider.contains("gps"));... | 2015/06/11 | [
"https://Stackoverflow.com/questions/30779827",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2056563/"
] | I think one cannot change the user's personal phone settings(Like GPS turn on-off, sound on-off,display etc.) from any application. It would be security voilation.
In my opinion here only option is to check if GPS is on or off and Redirect User to Settings screen.
```
LocationManager manager = (LocationManager) getS... | Note: If you are using both NETWORK\_PROVIDER and GPS\_PROVIDER, then you need to request only the ACCESS\_FINE\_LOCATION permission, because it includes permission for both providers. (Permission for ACCESS\_COARSE\_LOCATION includes permission only for NETWORK\_PROVIDER.) |
26,479,319 | I can't select look up field in my SharePoint 2013 List.
also I can't filter base on a Look up field.
for example I have List with Name Test and this list has fields: Title, Company, Province
the Company and Province is look up fields I want to filter based on Province which is a look up field
using REST query it give... | 2014/10/21 | [
"https://Stackoverflow.com/questions/26479319",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1542982/"
] | How to filter by lookup field value using SharePoint REST
---------------------------------------------------------
Assume a `Contacts` list that contains a lookup field named `Province`
**Option 1**
When a lookup column is being added into list, its `ID` become accessible automatically via REST. For example, when t... | Use $expand like blow code:
```
/_api/web/lists/GetByTitle('Test')/items?$select=Province/Title&$expand=Province&$filter=Province/Title eq 'XYZ'
``` |
26,479,319 | I can't select look up field in my SharePoint 2013 List.
also I can't filter base on a Look up field.
for example I have List with Name Test and this list has fields: Title, Company, Province
the Company and Province is look up fields I want to filter based on Province which is a look up field
using REST query it give... | 2014/10/21 | [
"https://Stackoverflow.com/questions/26479319",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1542982/"
] | Use $expand like blow code:
```
/_api/web/lists/GetByTitle('Test')/items?$select=Province/Title&$expand=Province&$filter=Province/Title eq 'XYZ'
``` | Mehdi jalal, I found why it was throwing that error. You need to close your ProvinceTitle with Single Quotes and there you have it. like this
Query Syntax:
`/_api/web/lists/GetByTitle('Contacts')/items?$select=Province/Title,Province/ID&$expand=Province&$filter=Province/Title eq '<ProvinceTitle>'`
Now this is Example... |
26,479,319 | I can't select look up field in my SharePoint 2013 List.
also I can't filter base on a Look up field.
for example I have List with Name Test and this list has fields: Title, Company, Province
the Company and Province is look up fields I want to filter based on Province which is a look up field
using REST query it give... | 2014/10/21 | [
"https://Stackoverflow.com/questions/26479319",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1542982/"
] | How to filter by lookup field value using SharePoint REST
---------------------------------------------------------
Assume a `Contacts` list that contains a lookup field named `Province`
**Option 1**
When a lookup column is being added into list, its `ID` become accessible automatically via REST. For example, when t... | Mehdi jalal, I found why it was throwing that error. You need to close your ProvinceTitle with Single Quotes and there you have it. like this
Query Syntax:
`/_api/web/lists/GetByTitle('Contacts')/items?$select=Province/Title,Province/ID&$expand=Province&$filter=Province/Title eq '<ProvinceTitle>'`
Now this is Example... |
2,895,780 | I am trying to write a short paper with LaTeX and need to add a table with 3 columns.
```
+-------------+-----------------+--------------------------------------+
| AAAAAAAAAA | BBBBBBBBBBBBBBB | Betty Botter Bought a Bit of Butter |
| | | but the Butter's Bitter |
+---------... | 2010/05/24 | [
"https://Stackoverflow.com/questions/2895780",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/31472/"
] | Use the `p` column descriptor:
Change
```
\begin{tabular}{lll}
```
to
```
\begin{tabular}{llp{5cm}}
```
To explicitly insert line-breaks:
```
CCCCCCCC & DDDD & \parbox{5cm}{Betty Botter Thought: \\ If I Put This Bitter Butter in My Batter it Will Make My Batter Bitter}
``` | This is the answer I found so far for my needs: [Link here](https://tex.stackexchange.com/questions/2441/how-to-add-a-forced-line-break-inside-a-table-cell/19678#19678).
It creates a new command that will make a table inside a table in a more proper way:
```
\newcommand{\specialcell}[2][c]{%
\begin{tabular}[#1]{@{}c@... |
2,895,780 | I am trying to write a short paper with LaTeX and need to add a table with 3 columns.
```
+-------------+-----------------+--------------------------------------+
| AAAAAAAAAA | BBBBBBBBBBBBBBB | Betty Botter Bought a Bit of Butter |
| | | but the Butter's Bitter |
+---------... | 2010/05/24 | [
"https://Stackoverflow.com/questions/2895780",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/31472/"
] | Use the `p` column descriptor:
Change
```
\begin{tabular}{lll}
```
to
```
\begin{tabular}{llp{5cm}}
```
To explicitly insert line-breaks:
```
CCCCCCCC & DDDD & \parbox{5cm}{Betty Botter Thought: \\ If I Put This Bitter Butter in My Batter it Will Make My Batter Bitter}
``` | Here is an answer with no fancy coding. Write your rows in separate lines. Omit the \hline for all but the last row(line) Its quick and dirty but, hey, it works and gives me exactly what I want, for simple tables anyway. I was making advertising to go on automobile windscreens. I have 3 centered rows in each cell
```
... |
2,895,780 | I am trying to write a short paper with LaTeX and need to add a table with 3 columns.
```
+-------------+-----------------+--------------------------------------+
| AAAAAAAAAA | BBBBBBBBBBBBBBB | Betty Botter Bought a Bit of Butter |
| | | but the Butter's Bitter |
+---------... | 2010/05/24 | [
"https://Stackoverflow.com/questions/2895780",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/31472/"
] | Use the `p` column descriptor:
Change
```
\begin{tabular}{lll}
```
to
```
\begin{tabular}{llp{5cm}}
```
To explicitly insert line-breaks:
```
CCCCCCCC & DDDD & \parbox{5cm}{Betty Botter Thought: \\ If I Put This Bitter Butter in My Batter it Will Make My Batter Bitter}
``` | As @aioobe wrote in his answer, in this case one can switch from the left alignment
```latex
\begin{tabular}{lll}
```
to the *paragraph* alignment, at least in the third column where the custom linebreak must be inserted manually:
```latex
\begin{tabular}{llp{.5\textwidth}}
```
After this edit, one can use the co... |
2,895,780 | I am trying to write a short paper with LaTeX and need to add a table with 3 columns.
```
+-------------+-----------------+--------------------------------------+
| AAAAAAAAAA | BBBBBBBBBBBBBBB | Betty Botter Bought a Bit of Butter |
| | | but the Butter's Bitter |
+---------... | 2010/05/24 | [
"https://Stackoverflow.com/questions/2895780",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/31472/"
] | This is the answer I found so far for my needs: [Link here](https://tex.stackexchange.com/questions/2441/how-to-add-a-forced-line-break-inside-a-table-cell/19678#19678).
It creates a new command that will make a table inside a table in a more proper way:
```
\newcommand{\specialcell}[2][c]{%
\begin{tabular}[#1]{@{}c@... | Here is an answer with no fancy coding. Write your rows in separate lines. Omit the \hline for all but the last row(line) Its quick and dirty but, hey, it works and gives me exactly what I want, for simple tables anyway. I was making advertising to go on automobile windscreens. I have 3 centered rows in each cell
```
... |
2,895,780 | I am trying to write a short paper with LaTeX and need to add a table with 3 columns.
```
+-------------+-----------------+--------------------------------------+
| AAAAAAAAAA | BBBBBBBBBBBBBBB | Betty Botter Bought a Bit of Butter |
| | | but the Butter's Bitter |
+---------... | 2010/05/24 | [
"https://Stackoverflow.com/questions/2895780",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/31472/"
] | This is the answer I found so far for my needs: [Link here](https://tex.stackexchange.com/questions/2441/how-to-add-a-forced-line-break-inside-a-table-cell/19678#19678).
It creates a new command that will make a table inside a table in a more proper way:
```
\newcommand{\specialcell}[2][c]{%
\begin{tabular}[#1]{@{}c@... | As @aioobe wrote in his answer, in this case one can switch from the left alignment
```latex
\begin{tabular}{lll}
```
to the *paragraph* alignment, at least in the third column where the custom linebreak must be inserted manually:
```latex
\begin{tabular}{llp{.5\textwidth}}
```
After this edit, one can use the co... |
2,895,780 | I am trying to write a short paper with LaTeX and need to add a table with 3 columns.
```
+-------------+-----------------+--------------------------------------+
| AAAAAAAAAA | BBBBBBBBBBBBBBB | Betty Botter Bought a Bit of Butter |
| | | but the Butter's Bitter |
+---------... | 2010/05/24 | [
"https://Stackoverflow.com/questions/2895780",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/31472/"
] | As @aioobe wrote in his answer, in this case one can switch from the left alignment
```latex
\begin{tabular}{lll}
```
to the *paragraph* alignment, at least in the third column where the custom linebreak must be inserted manually:
```latex
\begin{tabular}{llp{.5\textwidth}}
```
After this edit, one can use the co... | Here is an answer with no fancy coding. Write your rows in separate lines. Omit the \hline for all but the last row(line) Its quick and dirty but, hey, it works and gives me exactly what I want, for simple tables anyway. I was making advertising to go on automobile windscreens. I have 3 centered rows in each cell
```
... |
402,425 | I want to know if the Swap is used at all. `free` shows the usage of the memory:
```
# free
total used free shared buff/cache available
Mem: 1362084 169864 38288 724 1153932 1163816
Swap: 1048572 0 1048572
```
My understanding is t... | 2017/11/03 | [
"https://unix.stackexchange.com/questions/402425",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/128826/"
] | From within a Screen window, run
```
screen -X hardcopy -h s
vim s
rm s
```
`hardcopy -h` dumps the scrollback into a temporary file which you can then open in Vim if you like. If you script this you should use a proper temporary file name:
```
#!/bin/sh
scrollback_file=$(mktemp)
screen -X hardcopy -h "$scrollback_... | If you don't mind running the command again, you can always do
```bsh
<command> | vim -
```
If you also care about `stderr`:
```bsh
<command> 2>&1 | vim -
```
Specially useful if you want to search for a pattern and open vim in that location:
```bsh
grep -iIrHn <pattern> | vim -
```
then place the cursor at th... |
91,861 | How can I delete multiple transactions in a batch in GnuCash?
My specific use-case is that I am treating each year as a standalone gnucash file. I start with a copy of the previous year and import the current year transactions into it in order to benefit from trained Bayesian automatic transaction mapping during impor... | 2018/03/12 | [
"https://money.stackexchange.com/questions/91861",
"https://money.stackexchange.com",
"https://money.stackexchange.com/users/4508/"
] | As a workaround I made a shortcut key for deleting transactions. With GnuCash closed, I modified the accelerator-map file.
In GnuCash 2.6 and older:
`C:\Users\username\.gnu-cash\accelerator-map`
In GnuCash 3.0 and newer:
`C:\Users\username\AppData\Roaming\GnuCash\accelerator-map`
Ubuntu (as mentioned in comments):
`... | As a follow-up to this very useful info, on a Windows PC, the file is located in:
```
C:\Users\UserName\AppData\Roaming\GnuCash\accelerator-map
```
The way the edited line is displayed in the above answer is correct but it may not be immediately obvious to everyone that like some other languages, the semicolon needs... |
14,496 | I want to be able to display my company on Google Maps. I have a places page set up. If you search for it Google will show my business with a red marker which links to my places page.
I want it to display on the map all the time. Like the TM Lewin Shop in the example below.
. I'm not sure how they handle three businesses. I would guess that they choose the one most relevant to a search query. |
60,262,841 | I have the next regular expression: `/i18n(-?).*="(.*)"/g` for javascript.
I use <https://www.regextester.com> to check.
```
<button i18n="@@user.button" data-test="download-confirmation_ok">
<a i18n-href="@@link.url" href="https://www.aaaa.es" target="_blank">
<div i18n="@@link.text">www.aaaa.es</div>
```
I don't ... | 2020/02/17 | [
"https://Stackoverflow.com/questions/60262841",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5023329/"
] | You might be looking for `defaultdict` from collections in the standard library. Creating a `defaultdict` with `dict` as default factory will enable you to write to `frequencyLomb[J][K]` without first creating dict at `frequencyLomb[J]`.
```
from collections import defaultdict
frequencyLomb = defaultdict(dict)
for J... | Try something like this:
```
if j not in frequencyLomb: #Then try frequencyLomb[J] = {} and then frequncyLomb[J][K] = Your Value
else: #Then directly add your value to the inner dictionary.
``` |
51,183,866 | I need to declare a function that returns a string from an array of pointers .. I am programming a PIC and I am using as an interface an LCD ..
With this code I have what I want:
```
// CONFIGURATION BITS
#pragma config FOSC = HS // Oscillator Selection bits (XT oscillator)
#pragma config WDTE = OFF // Watchdog Tim... | 2018/07/05 | [
"https://Stackoverflow.com/questions/51183866",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4286383/"
] | Your function returns `char` but you return a `char *`.
Change the return type to `char *`
And up your compiler warning to catch those things. | Just try this,
```
char kbd_getc(){
int key = 2;
char *key2[] = {"3", "4", "5"};
char a = key2[key];
return a ;
}
```
I think That u r returning array.
You need to return a char.
Thank you |
51,183,866 | I need to declare a function that returns a string from an array of pointers .. I am programming a PIC and I am using as an interface an LCD ..
With this code I have what I want:
```
// CONFIGURATION BITS
#pragma config FOSC = HS // Oscillator Selection bits (XT oscillator)
#pragma config WDTE = OFF // Watchdog Tim... | 2018/07/05 | [
"https://Stackoverflow.com/questions/51183866",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4286383/"
] | ```
char *key2[] = {"3", "4", "5"};
return key2[key];
```
Here, `key2` is an array of `char` pointers and `key2[key]` is pointer at index `key` of array `key2` which is pointing to first character of a string.
Now, look at the return type of function `kbd_getc()`:
```
char kbd_getc(){
^^^^
```
Its a `c... | Just try this,
```
char kbd_getc(){
int key = 2;
char *key2[] = {"3", "4", "5"};
char a = key2[key];
return a ;
}
```
I think That u r returning array.
You need to return a char.
Thank you |
1,678,519 | I came across a question today:
>
> $$\int \frac{\ln x \, dx}{(1+\ln x)^2}$$
>
>
>
How to do it? I tried to substitute $1+\ln x$ and also tried taking $\ln x$ outside the brackets but they doesn't work... I even tried to use that multiplication rule.That didn't work either. I can't see anything to pass through it... | 2016/03/01 | [
"https://math.stackexchange.com/questions/1678519",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/287678/"
] | Let $u=\ln x$ and $du=\frac{1}{x}dx$.
Thus, the integral transforms to $\displaystyle\int \dfrac{\ln x dx}{(1+\ln x)^2}=\displaystyle \int \frac{e^u u du}{(1+u)^2}.$
Now, integrate by parts with $f=e^u u$ and $dg=\frac{1}{(1+u)^2}du.$ | **Hint:**
Wolfram Alpha solves this (in an admittingly cumbersome way) by first letting $v=\log x$ and then integrating by parts with $u = ve^v$ and $dg = \frac{dv}{(v+1)^2}$. Then just back substitute and you'll get your answer. |
1,678,519 | I came across a question today:
>
> $$\int \frac{\ln x \, dx}{(1+\ln x)^2}$$
>
>
>
How to do it? I tried to substitute $1+\ln x$ and also tried taking $\ln x$ outside the brackets but they doesn't work... I even tried to use that multiplication rule.That didn't work either. I can't see anything to pass through it... | 2016/03/01 | [
"https://math.stackexchange.com/questions/1678519",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/287678/"
] | Let $u=\ln x$ and $du=\frac{1}{x}dx$.
Thus, the integral transforms to $\displaystyle\int \dfrac{\ln x dx}{(1+\ln x)^2}=\displaystyle \int \frac{e^u u du}{(1+u)^2}.$
Now, integrate by parts with $f=e^u u$ and $dg=\frac{1}{(1+u)^2}du.$ | Set $t=\ln x$ and $dt=\frac{dx}{x}$
$$=\int\frac{e^tt}{(t+1)^2}dt$$
By parts $f=e^tt$ and $dg=\frac{dt}{(1+t)^2}$
$$=-\frac{e^tt}{t+1}+\int e^t dt=\color{red}{\frac{x}{\ln x+1}+\mathcal C}$$ |
1,678,519 | I came across a question today:
>
> $$\int \frac{\ln x \, dx}{(1+\ln x)^2}$$
>
>
>
How to do it? I tried to substitute $1+\ln x$ and also tried taking $\ln x$ outside the brackets but they doesn't work... I even tried to use that multiplication rule.That didn't work either. I can't see anything to pass through it... | 2016/03/01 | [
"https://math.stackexchange.com/questions/1678519",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/287678/"
] | Let $u=\ln x$ and $du=\frac{1}{x}dx$.
Thus, the integral transforms to $\displaystyle\int \dfrac{\ln x dx}{(1+\ln x)^2}=\displaystyle \int \frac{e^u u du}{(1+u)^2}.$
Now, integrate by parts with $f=e^u u$ and $dg=\frac{1}{(1+u)^2}du.$ | $1+\ln x=u\iff x=e^{u-1},dx=e^{u-1}du$
$$I=\int\dfrac{\ln x}{(1+\ln x)^2}dx=\int\dfrac{u-1}{u^2}e^{u-1}du=\int e^{u-1}\left(\dfrac1u+\dfrac{d(1/u)}{du}\right)du =\dfrac{e^{u-1}}u+K$$
as $\dfrac{e^xf(x)}{dx}=e^x[f(x)+f'(x)]\implies\int e^x[f(x)+f'(x)]dx=e^x f(x)$
$$\implies I=\dfrac x{1+\ln x}+K$$
Alternatively,
$... |
1,678,519 | I came across a question today:
>
> $$\int \frac{\ln x \, dx}{(1+\ln x)^2}$$
>
>
>
How to do it? I tried to substitute $1+\ln x$ and also tried taking $\ln x$ outside the brackets but they doesn't work... I even tried to use that multiplication rule.That didn't work either. I can't see anything to pass through it... | 2016/03/01 | [
"https://math.stackexchange.com/questions/1678519",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/287678/"
] | **Hint:**
Wolfram Alpha solves this (in an admittingly cumbersome way) by first letting $v=\log x$ and then integrating by parts with $u = ve^v$ and $dg = \frac{dv}{(v+1)^2}$. Then just back substitute and you'll get your answer. | $1+\ln x=u\iff x=e^{u-1},dx=e^{u-1}du$
$$I=\int\dfrac{\ln x}{(1+\ln x)^2}dx=\int\dfrac{u-1}{u^2}e^{u-1}du=\int e^{u-1}\left(\dfrac1u+\dfrac{d(1/u)}{du}\right)du =\dfrac{e^{u-1}}u+K$$
as $\dfrac{e^xf(x)}{dx}=e^x[f(x)+f'(x)]\implies\int e^x[f(x)+f'(x)]dx=e^x f(x)$
$$\implies I=\dfrac x{1+\ln x}+K$$
Alternatively,
$... |
1,678,519 | I came across a question today:
>
> $$\int \frac{\ln x \, dx}{(1+\ln x)^2}$$
>
>
>
How to do it? I tried to substitute $1+\ln x$ and also tried taking $\ln x$ outside the brackets but they doesn't work... I even tried to use that multiplication rule.That didn't work either. I can't see anything to pass through it... | 2016/03/01 | [
"https://math.stackexchange.com/questions/1678519",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/287678/"
] | Set $t=\ln x$ and $dt=\frac{dx}{x}$
$$=\int\frac{e^tt}{(t+1)^2}dt$$
By parts $f=e^tt$ and $dg=\frac{dt}{(1+t)^2}$
$$=-\frac{e^tt}{t+1}+\int e^t dt=\color{red}{\frac{x}{\ln x+1}+\mathcal C}$$ | $1+\ln x=u\iff x=e^{u-1},dx=e^{u-1}du$
$$I=\int\dfrac{\ln x}{(1+\ln x)^2}dx=\int\dfrac{u-1}{u^2}e^{u-1}du=\int e^{u-1}\left(\dfrac1u+\dfrac{d(1/u)}{du}\right)du =\dfrac{e^{u-1}}u+K$$
as $\dfrac{e^xf(x)}{dx}=e^x[f(x)+f'(x)]\implies\int e^x[f(x)+f'(x)]dx=e^x f(x)$
$$\implies I=\dfrac x{1+\ln x}+K$$
Alternatively,
$... |
10,435,883 | Why doesn't this work?
Route:
```
routes.MapRoute(
"Summary",
"{controller}/{id}",
new { controller = "Summary", action = "Default" }
);
```
Controller:
```
public class SummaryController : Controller
{
public ActionResult Default(int id)
... | 2012/05/03 | [
"https://Stackoverflow.com/questions/10435883",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/220899/"
] | How do routes work (by default)?
--------------------------------
Let's get back to the default route, which is somewhat like this one:
```
routes.MapRoute(
// Route name
"Default",
// URL with parameters
"{controller}/{action}/{id}",
// Parameter defaults
new { controller = "Home", actio... | Try replacing :
```
new { controller = "Summary", action = "Default" }
```
with :
```
new { controller = "Summary", action = "Default", id = UrlParameter.Optional }
```
**Edit:** tried your code, worked for me. Do you have any other routes defined in your global.asax? |
16,420,647 | I have already integration of Handsontable with KnockoutJS here [http://jsfiddle.net/NHpEH](http://jsfiddle.net/NHpEH/).
```
ko.bindingHandlers.handsontable = {
init: function (element, valueAccessor, allBindingsAccessor) {
var value = valueAccessor(); // TODO: what happens if value is null? ... | 2013/05/07 | [
"https://Stackoverflow.com/questions/16420647",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/330320/"
] | OK, This is my solution. The code snippet is not optimized and is just a simple idea.
In this way, you can specify a computed observable for each specific cell. The third column is sum of the first three columns and the fourth column is multiply of them. [jsfiddle](http://jsfiddle.net/mortezasoft/Yr6KE/4/)
```
funct... | Here is how you can add observables and a computed to your array:
```
var 2008Kia = ko.observable(10);
var 2008Nissan = ko.observable(11);
var 2008Toyota = ko.observable(12);
var 2008Honda = ko.observable(13);
var 2008Total = ko.computed(function() {
return 2008Kia() + 2008Nissan() + 2008Toyota() + 2008Honda();
});
... |
120 | We've discussed this in comments in a number of different topics, and it's come up time and again, so we should explicitly cover this:
Are questions about stage combat (or re-enacting [Ren Fair, SCA, Civil War?], etc.), even if the intent is to adapt a martial art to stage combat, on topic? | 2012/02/23 | [
"https://martialarts.meta.stackexchange.com/questions/120",
"https://martialarts.meta.stackexchange.com",
"https://martialarts.meta.stackexchange.com/users/25/"
] | It seems to me that there are other Stack Exchange sites and proposals which would be a better fit for this topic, such as [Theatre](http://area51.stackexchange.com/proposals/23762/theatre).
Martial Arts, [as so far defined](https://martialarts.meta.stackexchange.com/questions/97/what-is-the-definition-of-martial-art)... | I believe talking about stage combat would give better answers on this Q&A site. When you want to emulate a certain fighting technique, there are visual differences on how you stand, throw a punch, and kick.
The advice that could come out of this site would give someone more detail in how a move is done, or what happe... |
120 | We've discussed this in comments in a number of different topics, and it's come up time and again, so we should explicitly cover this:
Are questions about stage combat (or re-enacting [Ren Fair, SCA, Civil War?], etc.), even if the intent is to adapt a martial art to stage combat, on topic? | 2012/02/23 | [
"https://martialarts.meta.stackexchange.com/questions/120",
"https://martialarts.meta.stackexchange.com",
"https://martialarts.meta.stackexchange.com/users/25/"
] | Like what we discussed with Lion Dancing: how does staging fake fights help with one's growth in martial arts?
Some possible examples: Classical Chinese opera. Korean masked dances might hide something interesting. Capoeira. I think some variants of Silat have ritual dances in between rounds within ritual duels. Some ... | I believe talking about stage combat would give better answers on this Q&A site. When you want to emulate a certain fighting technique, there are visual differences on how you stand, throw a punch, and kick.
The advice that could come out of this site would give someone more detail in how a move is done, or what happe... |
120 | We've discussed this in comments in a number of different topics, and it's come up time and again, so we should explicitly cover this:
Are questions about stage combat (or re-enacting [Ren Fair, SCA, Civil War?], etc.), even if the intent is to adapt a martial art to stage combat, on topic? | 2012/02/23 | [
"https://martialarts.meta.stackexchange.com/questions/120",
"https://martialarts.meta.stackexchange.com",
"https://martialarts.meta.stackexchange.com/users/25/"
] | I largely agree with Ho-Sheng Hsiao. I think that the original question, as asked, is relatively problematic, and while I recognize the need to not let us branch too broadly, I am uncomfortable with the idea that the *purpose* of the practice matters relative to what the practice is. So if you are practicing taekwondo ... | I believe talking about stage combat would give better answers on this Q&A site. When you want to emulate a certain fighting technique, there are visual differences on how you stand, throw a punch, and kick.
The advice that could come out of this site would give someone more detail in how a move is done, or what happe... |
70,855 | How can I sample from a mixture distribution, and in particular a mixture of Normal distributions in `R`? For example, if I wanted to sample from:
$$
0.3\!\times\mathcal{N}(0,1)\; + \;0.5\!\times\mathcal{N}(10,1)\; + \;0.2\!\times\mathcal{N}(3,.1)
$$
how could I do that? | 2013/09/24 | [
"https://stats.stackexchange.com/questions/70855",
"https://stats.stackexchange.com",
"https://stats.stackexchange.com/users/-1/"
] | In general, one of the easiest ways to sample from a mixture distribution is the following:
**Algorithm Steps**
1) Generate a random variable $U\sim\text{Uniform}(0,1)$
2) If $U\in\left[\sum\_{i=1}^kp\_{k},\sum\_{i=1}^{k+1}p\_{k+1}\right)$ interval, where $p\_{k}$ correspond to the the probability of the $k^{th}$ co... | Conceptually, you are just picking one distribution (from $k$ possibilities) with some probability, and then generating pseudo-random variates from that distribution. In `R`, this would be (e.g.):
```
set.seed(8) # this makes the example reproducible
N = 1000 # this is how many data you... |
70,855 | How can I sample from a mixture distribution, and in particular a mixture of Normal distributions in `R`? For example, if I wanted to sample from:
$$
0.3\!\times\mathcal{N}(0,1)\; + \;0.5\!\times\mathcal{N}(10,1)\; + \;0.2\!\times\mathcal{N}(3,.1)
$$
how could I do that? | 2013/09/24 | [
"https://stats.stackexchange.com/questions/70855",
"https://stats.stackexchange.com",
"https://stats.stackexchange.com/users/-1/"
] | It's good practice to avoid `for` loops in `R` for performance reasons. An alternative solution which exploits the fact `rnorm` is vectorized:
```
N <- 100000
components <- sample(1:3,prob=c(0.3,0.5,0.2),size=N,replace=TRUE)
mus <- c(0,10,3)
sds <- sqrt(c(1,1,0.1))
samples <- rnorm(n=N,mean=mus[components],sd=sds[co... | Conceptually, you are just picking one distribution (from $k$ possibilities) with some probability, and then generating pseudo-random variates from that distribution. In `R`, this would be (e.g.):
```
set.seed(8) # this makes the example reproducible
N = 1000 # this is how many data you... |
70,855 | How can I sample from a mixture distribution, and in particular a mixture of Normal distributions in `R`? For example, if I wanted to sample from:
$$
0.3\!\times\mathcal{N}(0,1)\; + \;0.5\!\times\mathcal{N}(10,1)\; + \;0.2\!\times\mathcal{N}(3,.1)
$$
how could I do that? | 2013/09/24 | [
"https://stats.stackexchange.com/questions/70855",
"https://stats.stackexchange.com",
"https://stats.stackexchange.com/users/-1/"
] | In general, one of the easiest ways to sample from a mixture distribution is the following:
**Algorithm Steps**
1) Generate a random variable $U\sim\text{Uniform}(0,1)$
2) If $U\in\left[\sum\_{i=1}^kp\_{k},\sum\_{i=1}^{k+1}p\_{k+1}\right)$ interval, where $p\_{k}$ correspond to the the probability of the $k^{th}$ co... | Already given perfect answers, so for those who want to achieve this in Python, here is my solution:
```
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
mu = [0, 10, 3]
sigma = [1, 1, 1]
p_i = [0.3, 0.5, 0.2]
n = 10000
x = []
for i in range(n):
z_i = np.argmax(np.random.multinomial(1, p_i))... |
70,855 | How can I sample from a mixture distribution, and in particular a mixture of Normal distributions in `R`? For example, if I wanted to sample from:
$$
0.3\!\times\mathcal{N}(0,1)\; + \;0.5\!\times\mathcal{N}(10,1)\; + \;0.2\!\times\mathcal{N}(3,.1)
$$
how could I do that? | 2013/09/24 | [
"https://stats.stackexchange.com/questions/70855",
"https://stats.stackexchange.com",
"https://stats.stackexchange.com/users/-1/"
] | It's good practice to avoid `for` loops in `R` for performance reasons. An alternative solution which exploits the fact `rnorm` is vectorized:
```
N <- 100000
components <- sample(1:3,prob=c(0.3,0.5,0.2),size=N,replace=TRUE)
mus <- c(0,10,3)
sds <- sqrt(c(1,1,0.1))
samples <- rnorm(n=N,mean=mus[components],sd=sds[co... | Already given perfect answers, so for those who want to achieve this in Python, here is my solution:
```
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
mu = [0, 10, 3]
sigma = [1, 1, 1]
p_i = [0.3, 0.5, 0.2]
n = 10000
x = []
for i in range(n):
z_i = np.argmax(np.random.multinomial(1, p_i))... |
4,800,924 | i am making a taskmanager like app. for windows,i can get all the system processes,now i want to get process's username.I got the code from net.
```
void enableDebugPrivileges()
{
HANDLE hcurrent=GetCurrentProcess();
HANDLE hToken;
BOOL bret=OpenProcessToken(hcurrent,40,&hToken);
LUID luid;
bret=Lo... | 2011/01/26 | [
"https://Stackoverflow.com/questions/4800924",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/438983/"
] | IIRC there's a separate pseudo account called LocalService, but its not in the normal security system (hence you get a null string). There's also a NetworkService account. | I also used the code I got from the Net and used your GetUserName() part(Thanks for sharing) and it works perfectly. I used VS2019. I am printing Process, PID and User Name all in one line.
```
#include <windows.h>
#include <stdio.h>
#include <tchar.h>
#include <psapi.h>
void enableDebugPrivileges()
{
HANDLE hcu... |
22,102,312 | Is it okay in C++ with STL to change a hashmap while iterating over it?
obviously, you can change the iterator variable itself (iter->first and iter->second), but can you:
1. change the value of an existing key which is not necessarily pointed to by the iterator?
2. add new keys? | 2014/02/28 | [
"https://Stackoverflow.com/questions/22102312",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/991703/"
] | Quote from [cppreference's docs on `std::unordered_map::operator[]`](http://en.cppreference.com/w/cpp/container/unordered_map/operator_at):
>
> If an insertion occurs and results in a rehashing of the container, all iterators are invalidated. Otherwise iterators are not affected. References are not invalidated.
>
> ... | From [this `insert` reference`](http://en.cppreference.com/w/cpp/container/unordered_map/insert)
>
> If rehashing occurs due to the insertion, all iterators are invalidated. Otherwise iterators are not affected.
>
>
>
Also:
>
> Rehashing occurs only if the new number of elements is equal to or greater than max\... |
2,412,027 | I am working on an ASP.NET WebForm application using MVP pattern. For every Web Form, there is a Presenter class associated to handle UI and Business logic. However, I had problem when writing unit tests for Presenters, since session values are used in presenters. And there is no HTTP context exists during execution of... | 2010/03/09 | [
"https://Stackoverflow.com/questions/2412027",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/192727/"
] | I belive that you did not undestand that this think you ask, if you going to build it its takes months of design and developing.
if you search for "web chat webcam" you maybe see why I say that.
For example this <http://www.ivideochat.com/> site have developed a program for that reason. See how complicate it is, how... | Architecturally, you need a server to relay the video/audio to both parties, since they cannot connect directly.
You need a Silverlight or Flash 'movie' running in the browser, which you have written, and you need a server to do the relaying.
Its relatively straightforward using **Haxe**.
[Haxe](http://haxe.org) is ... |
2,412,027 | I am working on an ASP.NET WebForm application using MVP pattern. For every Web Form, there is a Presenter class associated to handle UI and Business logic. However, I had problem when writing unit tests for Presenters, since session values are used in presenters. And there is no HTTP context exists during execution of... | 2010/03/09 | [
"https://Stackoverflow.com/questions/2412027",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/192727/"
] | Action Script 3 + Flash Media Server or opensource Red5 server
<http://osflash.org/red5> | I belive that you did not undestand that this think you ask, if you going to build it its takes months of design and developing.
if you search for "web chat webcam" you maybe see why I say that.
For example this <http://www.ivideochat.com/> site have developed a program for that reason. See how complicate it is, how... |
2,412,027 | I am working on an ASP.NET WebForm application using MVP pattern. For every Web Form, there is a Presenter class associated to handle UI and Business logic. However, I had problem when writing unit tests for Presenters, since session values are used in presenters. And there is no HTTP context exists during execution of... | 2010/03/09 | [
"https://Stackoverflow.com/questions/2412027",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/192727/"
] | Action Script 3 + Flash Media Server or opensource Red5 server
<http://osflash.org/red5> | My suggestion is to hire a developer or two who know how to build web-applications involving real-time audio & video capabilities in Flex/Silverlight. |
2,412,027 | I am working on an ASP.NET WebForm application using MVP pattern. For every Web Form, there is a Presenter class associated to handle UI and Business logic. However, I had problem when writing unit tests for Presenters, since session values are used in presenters. And there is no HTTP context exists during execution of... | 2010/03/09 | [
"https://Stackoverflow.com/questions/2412027",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/192727/"
] | Would like to try something hot ?
[Silverlight 4](http://silverlight.net/getstarted/silverlight-4-beta/) (now in Beta) seems to have support for microphone&webcam. You will need to create server side for it as well. Probably some kind of user management and contact list. There will be significant bandwidth if you get ... | Architecturally, you need a server to relay the video/audio to both parties, since they cannot connect directly.
You need a Silverlight or Flash 'movie' running in the browser, which you have written, and you need a server to do the relaying.
Its relatively straightforward using **Haxe**.
[Haxe](http://haxe.org) is ... |
2,412,027 | I am working on an ASP.NET WebForm application using MVP pattern. For every Web Form, there is a Presenter class associated to handle UI and Business logic. However, I had problem when writing unit tests for Presenters, since session values are used in presenters. And there is no HTTP context exists during execution of... | 2010/03/09 | [
"https://Stackoverflow.com/questions/2412027",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/192727/"
] | I belive that you did not undestand that this think you ask, if you going to build it its takes months of design and developing.
if you search for "web chat webcam" you maybe see why I say that.
For example this <http://www.ivideochat.com/> site have developed a program for that reason. See how complicate it is, how... | My suggestion is to hire a developer or two who know how to build web-applications involving real-time audio & video capabilities in Flex/Silverlight. |
2,412,027 | I am working on an ASP.NET WebForm application using MVP pattern. For every Web Form, there is a Presenter class associated to handle UI and Business logic. However, I had problem when writing unit tests for Presenters, since session values are used in presenters. And there is no HTTP context exists during execution of... | 2010/03/09 | [
"https://Stackoverflow.com/questions/2412027",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/192727/"
] | Action Script 3 + Flash Media Server or opensource Red5 server
<http://osflash.org/red5> | Would like to try something hot ?
[Silverlight 4](http://silverlight.net/getstarted/silverlight-4-beta/) (now in Beta) seems to have support for microphone&webcam. You will need to create server side for it as well. Probably some kind of user management and contact list. There will be significant bandwidth if you get ... |
2,412,027 | I am working on an ASP.NET WebForm application using MVP pattern. For every Web Form, there is a Presenter class associated to handle UI and Business logic. However, I had problem when writing unit tests for Presenters, since session values are used in presenters. And there is no HTTP context exists during execution of... | 2010/03/09 | [
"https://Stackoverflow.com/questions/2412027",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/192727/"
] | >
> An adsl connection 12$,
> a computer
> 320$,
> as3 documentacion about [camera
> class](http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/media/Camera.html) priceless
>
>
> | My suggestion is to hire a developer or two who know how to build web-applications involving real-time audio & video capabilities in Flex/Silverlight. |
2,412,027 | I am working on an ASP.NET WebForm application using MVP pattern. For every Web Form, there is a Presenter class associated to handle UI and Business logic. However, I had problem when writing unit tests for Presenters, since session values are used in presenters. And there is no HTTP context exists during execution of... | 2010/03/09 | [
"https://Stackoverflow.com/questions/2412027",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/192727/"
] | >
> An adsl connection 12$,
> a computer
> 320$,
> as3 documentacion about [camera
> class](http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/media/Camera.html) priceless
>
>
> | Architecturally, you need a server to relay the video/audio to both parties, since they cannot connect directly.
You need a Silverlight or Flash 'movie' running in the browser, which you have written, and you need a server to do the relaying.
Its relatively straightforward using **Haxe**.
[Haxe](http://haxe.org) is ... |
2,412,027 | I am working on an ASP.NET WebForm application using MVP pattern. For every Web Form, there is a Presenter class associated to handle UI and Business logic. However, I had problem when writing unit tests for Presenters, since session values are used in presenters. And there is no HTTP context exists during execution of... | 2010/03/09 | [
"https://Stackoverflow.com/questions/2412027",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/192727/"
] | Action Script 3 + Flash Media Server or opensource Red5 server
<http://osflash.org/red5> | >
> An adsl connection 12$,
> a computer
> 320$,
> as3 documentacion about [camera
> class](http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/media/Camera.html) priceless
>
>
> |
2,412,027 | I am working on an ASP.NET WebForm application using MVP pattern. For every Web Form, there is a Presenter class associated to handle UI and Business logic. However, I had problem when writing unit tests for Presenters, since session values are used in presenters. And there is no HTTP context exists during execution of... | 2010/03/09 | [
"https://Stackoverflow.com/questions/2412027",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/192727/"
] | Action Script 3 + Flash Media Server or opensource Red5 server
<http://osflash.org/red5> | Architecturally, you need a server to relay the video/audio to both parties, since they cannot connect directly.
You need a Silverlight or Flash 'movie' running in the browser, which you have written, and you need a server to do the relaying.
Its relatively straightforward using **Haxe**.
[Haxe](http://haxe.org) is ... |
51,330,850 | This about running Spark/Scala from a Zeppelin notebook.
In order to better modularize and reorganize code, I need to import existing Scala classes, packages or functions into the notebook, preferably skipping creating a jar file (much the same as in PySpark).
Something like:
```
import myclass
```
where 'myclass... | 2018/07/13 | [
"https://Stackoverflow.com/questions/51330850",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1592712/"
] | Committer here. It's actually a fair bit of work to support Java 9+: [SPARK-24417](https://issues.apache.org/jira/browse/SPARK-24417)
It's also almost done and should be ready for Spark 3.0, which should run on Java 8 through 11 and beyond.
The goal (well, mine) is to make it work without opening up module access. T... | Primary technical reason is that Spark depends heavily on direct access to native memory with `sun.misc.Unsafe`, which has been made private in Java 9.
* <https://issues.apache.org/jira/browse/SPARK-24421>
* <http://apache-spark-developers-list.1001551.n3.nabble.com/Java-9-td20875.html> |
51,330,850 | This about running Spark/Scala from a Zeppelin notebook.
In order to better modularize and reorganize code, I need to import existing Scala classes, packages or functions into the notebook, preferably skipping creating a jar file (much the same as in PySpark).
Something like:
```
import myclass
```
where 'myclass... | 2018/07/13 | [
"https://Stackoverflow.com/questions/51330850",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1592712/"
] | Primary technical reason is that Spark depends heavily on direct access to native memory with `sun.misc.Unsafe`, which has been made private in Java 9.
* <https://issues.apache.org/jira/browse/SPARK-24421>
* <http://apache-spark-developers-list.1001551.n3.nabble.com/Java-9-td20875.html> | Spark depends on the memory API's which has been changed in JDK 9 so it is not available starting JDK 9.
And that is the reason for this.
Please check the issue:
<https://issues.apache.org/jira/browse/SPARK-24421> |
51,330,850 | This about running Spark/Scala from a Zeppelin notebook.
In order to better modularize and reorganize code, I need to import existing Scala classes, packages or functions into the notebook, preferably skipping creating a jar file (much the same as in PySpark).
Something like:
```
import myclass
```
where 'myclass... | 2018/07/13 | [
"https://Stackoverflow.com/questions/51330850",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1592712/"
] | Committer here. It's actually a fair bit of work to support Java 9+: [SPARK-24417](https://issues.apache.org/jira/browse/SPARK-24417)
It's also almost done and should be ready for Spark 3.0, which should run on Java 8 through 11 and beyond.
The goal (well, mine) is to make it work without opening up module access. T... | Spark depends on the memory API's which has been changed in JDK 9 so it is not available starting JDK 9.
And that is the reason for this.
Please check the issue:
<https://issues.apache.org/jira/browse/SPARK-24421> |
67,774,782 | I am having a challenge folding a list of integer elements to sum them up.
```
List<int> ints = [1,2,3,4,5];
var result = ints.fold(0, (pV,element)=>pV + element);
print(result);
```
Somehow I can't get this simple code to compile. I keep getting the error:
```
Error compiling to JavaScript:
Warning: Interpretin... | 2021/05/31 | [
"https://Stackoverflow.com/questions/67774782",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5662792/"
] | I don't know why, but if you are explicit with the types, it works:
```
var result = ints.fold(0, (int pV, element) => pV + element);
``` | As **pV** is of type object and **element** is of type int, you cannot add them.
You can do something like this if you required:
```
List<int> ints = [1,2,3,4,5];
var result = ints.fold(0, (pV,element)=>int.parse(pV.toString()) + element);
print(result);
``` |
26,974,250 | I try to upload files with dropzone.js.
My problem is that I have four dropzone upload containers on one page for different images.
How can I post the selected div to the post event?
```html
<div class='product_thumbs'>
<form name="product_image_1" action="ajax/upload.php" class="dropzone">
<div class="product_... | 2014/11/17 | [
"https://Stackoverflow.com/questions/26974250",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2791514/"
] | You want to spy on the `$upload.http` method and return a mocked object that lets you register progress, success and error callbacks.
```
spyOn($upload, 'http').andReturn({
progress: function (progressCallback) {
this.progressCallback = progressCallback;
},
success: function (errorCallback) {
this.errorC... | We are speaking about unit-tests?
Why do you need to test 3rd-party at all?
Just **mock this all part**.
Probably I did not get the idea of the question, so need more code that should be covered by tests. |
328,793 | The `curses.ascii` module has some nice functions defined, that allow for example to recognize which characters are printable (`curses.ascii.isprint(ch)`).
But, diffrent character codes can be printable depending on which locale setting is being used. For example, there are certain polish characters:
```
>>> ord('a')... | 2008/11/30 | [
"https://Stackoverflow.com/questions/328793",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4172/"
] | If you convert the character to a unicode then you can use unicodedata:
```
>>> unicodedata.category(u'ą')[0] in 'LNPS'
True
``` | Well, it is called curses.ascii, so using ASCII rules for what's printable should not be a surprise. If you are using an ISO 8-bit code, or you are operating from a known code page, you will need rules that correspond to what the actual codes and their displays are.
I think using unicode characters and standard Unicod... |
281,781 | I have difficulties understanding the different types of prediction after running `survival::clogit` in R. I do not think this is due to author's fault, but mainly due to my limited understanding of statistics.
So, I wish someone can enlighten me how the predictions were calculated.
Noted: The data (modified) and my... | 2017/05/26 | [
"https://stats.stackexchange.com/questions/281781",
"https://stats.stackexchange.com",
"https://stats.stackexchange.com/users/155741/"
] | The conditional logistic regression model conditions out an intercept for each stratum, so the linear predictor is only determined up to a stratum-specific offset. Stata uses zero for this offset; R uses the stratum mean of the covariate (for numerical stability)
So
```
> m<-with(sim_data, ave(Open, Strata))
> head(p... | I am not familiar with the predict() function, so I won't be able to tell you what this function is doing. However, it is not too difficult to predict probabilities in a clogit-type of model. Once you've estimated your model, you can now use the estimates to compute the proba of each event to occur. For each observatio... |
40,712,319 | I have an object array as follows:
```
products = [
{
id: 1,
title: "Product 1",
specifications: {
price: 1.55,
discount: 15,
attributes: [
{
l1: 100,
l2: 80
height:200,
weight: 15,
parameters: [
{
id: 1... | 2016/11/21 | [
"https://Stackoverflow.com/questions/40712319",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/952740/"
] | ```
_.forEach(products, function(product) {
_.forEach(_.get(product, 'specifications.attributes', []), function(attribute) {
_.set(_.find(attribute.parameters, {id: 199199}), 'size', 189);
});
});
``` | I believe what you want is underscore's `findIndex()` - <http://underscorejs.org/#findIndex>. Once you find which element in the array you want to apply the changes to (comparing the nested id to what you are looking for) you can then make the change to that particular element. |
40,712,319 | I have an object array as follows:
```
products = [
{
id: 1,
title: "Product 1",
specifications: {
price: 1.55,
discount: 15,
attributes: [
{
l1: 100,
l2: 80
height:200,
weight: 15,
parameters: [
{
id: 1... | 2016/11/21 | [
"https://Stackoverflow.com/questions/40712319",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/952740/"
] | This looks ugly, but it is effective:
To make it more dynamic, let's use variables: `identifier` will be your '199199' value and `new_size` for the '189' value.
```
methods: {
updateRecord: function(identifier, new_size) {
this.products.map(function(product) {
product.specifications.attrib... | I believe what you want is underscore's `findIndex()` - <http://underscorejs.org/#findIndex>. Once you find which element in the array you want to apply the changes to (comparing the nested id to what you are looking for) you can then make the change to that particular element. |
40,712,319 | I have an object array as follows:
```
products = [
{
id: 1,
title: "Product 1",
specifications: {
price: 1.55,
discount: 15,
attributes: [
{
l1: 100,
l2: 80
height:200,
weight: 15,
parameters: [
{
id: 1... | 2016/11/21 | [
"https://Stackoverflow.com/questions/40712319",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/952740/"
] | This looks ugly, but it is effective:
To make it more dynamic, let's use variables: `identifier` will be your '199199' value and `new_size` for the '189' value.
```
methods: {
updateRecord: function(identifier, new_size) {
this.products.map(function(product) {
product.specifications.attrib... | ```
_.forEach(products, function(product) {
_.forEach(_.get(product, 'specifications.attributes', []), function(attribute) {
_.set(_.find(attribute.parameters, {id: 199199}), 'size', 189);
});
});
``` |
248,292 | Is there any difference in meaning between *come*, *come over* and *come along* in the sense of arriving at a place? For example:
>
> I didn't expect you to show up at my party. Thanks for **coming**.
>
>
> I didn't expect you to show up at my party. Thanks for **coming over**.
>
>
> I didn't expect you to show u... | 2020/05/23 | [
"https://ell.stackexchange.com/questions/248292",
"https://ell.stackexchange.com",
"https://ell.stackexchange.com/users/60696/"
] | "Thanks for coming" means, "thank you for attending [this event]".
"Thanks for coming over" means, "thank you for making the effort to travel [here]".
"Thanks for coming along" means, "thank you for accompanying me [to wherever *or* on this journey *or* as i do this thing]". | "Thanks for coming" - you're thanking the person for turning up to your party.
"Thanks for comming over." - you're thanking the person for making the effort to get to your party.
"Thanks for comming along." - This one's more vague. It could mean either of the first two meanings, or, more figuratively, you could be t... |
9,233,076 | I am experiencing inconsistent behavior across machines with conversion to Well-Known Text (WKT) of spatial types in SQL server 2008. It looks as if the data is being stored identically, but the conversion back to WKT acts differently depending on the machine!
Here's something I put together to pinpoint the issue:
``... | 2012/02/10 | [
"https://Stackoverflow.com/questions/9233076",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/791838/"
] | You would need to construct a new instance of your class, not just assign the variable:
```
duplicateItemVO = new ItemVO
{
ItemId = originalItemVO.ItemId,
ItemCategory = originalItemVO.ItemCategory
};
```
When you're dealing with reference types (any class), just assigning a variable is c... | I suggest using as is in the link below.
For me it worked very well.
<https://msdn.microsoft.com/en-us/library/system.object.memberwiseclone(v=vs.110).aspx>
```
public Person ShallowCopy ()
{
return (Person) this.MemberwiseClone ();
}
``` |
9,233,076 | I am experiencing inconsistent behavior across machines with conversion to Well-Known Text (WKT) of spatial types in SQL server 2008. It looks as if the data is being stored identically, but the conversion back to WKT acts differently depending on the machine!
Here's something I put together to pinpoint the issue:
``... | 2012/02/10 | [
"https://Stackoverflow.com/questions/9233076",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/791838/"
] | In order to change one instance without changing the other you need to clone the actual values of this instance and not the reference.
The pattern used in .Net is to implement ICloneable.
So your code would look like this:
```
public class ItemVO: ICloneable
{
public ItemVO()
{
ItemId = "";
... | By Default objects are reference type.
Assign the one object to another object its means that you just refer the address of the object.Any changes in any object it will reflect in both.
To solve this problem you should have initialize the object using "new" keyword, then add this object value in the first object. |
9,233,076 | I am experiencing inconsistent behavior across machines with conversion to Well-Known Text (WKT) of spatial types in SQL server 2008. It looks as if the data is being stored identically, but the conversion back to WKT acts differently depending on the machine!
Here's something I put together to pinpoint the issue:
``... | 2012/02/10 | [
"https://Stackoverflow.com/questions/9233076",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/791838/"
] | You would need to construct a new instance of your class, not just assign the variable:
```
duplicateItemVO = new ItemVO
{
ItemId = originalItemVO.ItemId,
ItemCategory = originalItemVO.ItemCategory
};
```
When you're dealing with reference types (any class), just assigning a variable is c... | class are [reference type](http://msdn.microsoft.com/en-us/library/490f96s2.aspx) and when you change one instance it will change the ariginal refference. so use [value type](http://msdn.microsoft.com/en-us/library/s1ax56ch.aspx) object for overcome your task(ex: use [struct](http://msdn.microsoft.com/en-us/library/ah1... |
9,233,076 | I am experiencing inconsistent behavior across machines with conversion to Well-Known Text (WKT) of spatial types in SQL server 2008. It looks as if the data is being stored identically, but the conversion back to WKT acts differently depending on the machine!
Here's something I put together to pinpoint the issue:
``... | 2012/02/10 | [
"https://Stackoverflow.com/questions/9233076",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/791838/"
] | You cannot practically copy an object since they would more likely be of reference types.
The ideal method is to serialize or stream the object into a new one - Provided your class is serializable (by providing the [Serializable] attribute in class declaration).
```
private static T Clone<T>(T source)
{
if... | By Default objects are reference type.
Assign the one object to another object its means that you just refer the address of the object.Any changes in any object it will reflect in both.
To solve this problem you should have initialize the object using "new" keyword, then add this object value in the first object. |
9,233,076 | I am experiencing inconsistent behavior across machines with conversion to Well-Known Text (WKT) of spatial types in SQL server 2008. It looks as if the data is being stored identically, but the conversion back to WKT acts differently depending on the machine!
Here's something I put together to pinpoint the issue:
``... | 2012/02/10 | [
"https://Stackoverflow.com/questions/9233076",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/791838/"
] | You would need to construct a new instance of your class, not just assign the variable:
```
duplicateItemVO = new ItemVO
{
ItemId = originalItemVO.ItemId,
ItemCategory = originalItemVO.ItemCategory
};
```
When you're dealing with reference types (any class), just assigning a variable is c... | You cannot practically copy an object since they would more likely be of reference types.
The ideal method is to serialize or stream the object into a new one - Provided your class is serializable (by providing the [Serializable] attribute in class declaration).
```
private static T Clone<T>(T source)
{
if... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.