qid int64 1 74.7M | question stringlengths 15 58.3k | date stringlengths 10 10 | metadata list | response_j stringlengths 4 30.2k | response_k stringlengths 11 36.5k |
|---|---|---|---|---|---|
14,625,833 | I am trying to implement SWT [GC](http://help.eclipse.org/indigo/index.jsp?topic=%2Forg.eclipse.platform.doc.isv%2Freference%2Fapi%2Forg%2Feclipse%2Fswt%2Fgraphics%2FGC.html)-like xor-mode drawing for an AWT [Graphics2D](http://docs.oracle.com/javase/6/docs/api/java/awt/Graphics2D.html). Using the built-in [XORComposit... | 2013/01/31 | [
"https://Stackoverflow.com/questions/14625833",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1437501/"
] | Caveat: It's been a while since I've touched Rasters.
It looks like you are probably accessing pixels outside the raster.
Rasters have a `minX`, `minY`, so your loops need to be something like this:
```
int srcMinX = src.getMinX();
int srcMinY = src.getMinY();
int dstInMinX = dstIn.getMinX();
int dstInMinY = dstIn.g... | The g2d clip region has more than one box, and will throw a RasterFormatException because its full-size raster reference gets replaced with the antialiased box's raster. |
189,134 | I am an international student studying in North america. I am applying for a master's program. I reached out to many professors for a letter of recommendation, but none replied. So, I told one professor that I would give him a small coffee gift card just for replying, regardless of whether he said yes or no. **I now re... | 2022/09/27 | [
"https://academia.stackexchange.com/questions/189134",
"https://academia.stackexchange.com",
"https://academia.stackexchange.com/users/163105/"
] | Avoid using that reference unless it means you can't put in the application. It comes across as odd, and a reader will discount the letter.
If you have trouble getting professors to write you references, you could try making an appointment with the chair of your department (or a similar position) and ask them to help.... | This is a really awkward position, for the both of you. If he considers this as a bribe, he is obligated to report it to the university and not mention in a recommendation letter... I think that he is trying to teach you something about the ethical value of that as an action. Also, I don't know how things work over the... |
189,134 | I am an international student studying in North america. I am applying for a master's program. I reached out to many professors for a letter of recommendation, but none replied. So, I told one professor that I would give him a small coffee gift card just for replying, regardless of whether he said yes or no. **I now re... | 2022/09/27 | [
"https://academia.stackexchange.com/questions/189134",
"https://academia.stackexchange.com",
"https://academia.stackexchange.com/users/163105/"
] | **Your professor's actions seem very strange.**
* If he believes that you were trying to bribe him, then he should have refused to write the letter.
* If he believes that this was a simple misunderstanding, then putting this in your letter seems like an inappropriate response. At most, the professor should disclose th... | This incident sounds to me like a simple misjudgment in relation to an intention to give a small gift as a thank-you. The inference to this being a bribe to influence a decision-maker is weak, since you offered it as a gift irrespective of the outcome of the decision of the professor, and the value was extremely small ... |
189,134 | I am an international student studying in North america. I am applying for a master's program. I reached out to many professors for a letter of recommendation, but none replied. So, I told one professor that I would give him a small coffee gift card just for replying, regardless of whether he said yes or no. **I now re... | 2022/09/27 | [
"https://academia.stackexchange.com/questions/189134",
"https://academia.stackexchange.com",
"https://academia.stackexchange.com/users/163105/"
] | **Do not use this reference letter.**
Depending on the exact information included and the phrasing used, there are two potential interpretations the reader could be left with.
Scenario A is that the reader gets the impression that you genuinely and purposefully tried to bribe the letter writer. This would such a dras... | Avoid using that reference unless it means you can't put in the application. It comes across as odd, and a reader will discount the letter.
If you have trouble getting professors to write you references, you could try making an appointment with the chair of your department (or a similar position) and ask them to help.... |
189,134 | I am an international student studying in North america. I am applying for a master's program. I reached out to many professors for a letter of recommendation, but none replied. So, I told one professor that I would give him a small coffee gift card just for replying, regardless of whether he said yes or no. **I now re... | 2022/09/27 | [
"https://academia.stackexchange.com/questions/189134",
"https://academia.stackexchange.com",
"https://academia.stackexchange.com/users/163105/"
] | This incident sounds to me like a simple misjudgment in relation to an intention to give a small gift as a thank-you. The inference to this being a bribe to influence a decision-maker is weak, since you offered it as a gift irrespective of the outcome of the decision of the professor, and the value was extremely small ... | **My first thought would have been "do not use his letter", but I also feel like you don't have a lot of options. It's not easy.**
1. I have a lot of experience with recommendation letters (requesting, writing, and reading). I have never, ever, seen (or made) any mention of attempted gifts in one of them. This would s... |
189,134 | I am an international student studying in North america. I am applying for a master's program. I reached out to many professors for a letter of recommendation, but none replied. So, I told one professor that I would give him a small coffee gift card just for replying, regardless of whether he said yes or no. **I now re... | 2022/09/27 | [
"https://academia.stackexchange.com/questions/189134",
"https://academia.stackexchange.com",
"https://academia.stackexchange.com/users/163105/"
] | **Your professor's actions seem very strange.**
* If he believes that you were trying to bribe him, then he should have refused to write the letter.
* If he believes that this was a simple misunderstanding, then putting this in your letter seems like an inappropriate response. At most, the professor should disclose th... | Perhaps this is just a cultural misunderstanding. You don't write like a native Canadian, so I'll assume you are from another culture for this advice.
Different cultures have different practices and expectations around gifts. In Canada and the US, what you did seems like a bribe of some sort and your comments suggest ... |
189,134 | I am an international student studying in North america. I am applying for a master's program. I reached out to many professors for a letter of recommendation, but none replied. So, I told one professor that I would give him a small coffee gift card just for replying, regardless of whether he said yes or no. **I now re... | 2022/09/27 | [
"https://academia.stackexchange.com/questions/189134",
"https://academia.stackexchange.com",
"https://academia.stackexchange.com/users/163105/"
] | This incident sounds to me like a simple misjudgment in relation to an intention to give a small gift as a thank-you. The inference to this being a bribe to influence a decision-maker is weak, since you offered it as a gift irrespective of the outcome of the decision of the professor, and the value was extremely small ... | This is a really awkward position, for the both of you. If he considers this as a bribe, he is obligated to report it to the university and not mention in a recommendation letter... I think that he is trying to teach you something about the ethical value of that as an action. Also, I don't know how things work over the... |
189,134 | I am an international student studying in North america. I am applying for a master's program. I reached out to many professors for a letter of recommendation, but none replied. So, I told one professor that I would give him a small coffee gift card just for replying, regardless of whether he said yes or no. **I now re... | 2022/09/27 | [
"https://academia.stackexchange.com/questions/189134",
"https://academia.stackexchange.com",
"https://academia.stackexchange.com/users/163105/"
] | Avoid using that reference unless it means you can't put in the application. It comes across as odd, and a reader will discount the letter.
If you have trouble getting professors to write you references, you could try making an appointment with the chair of your department (or a similar position) and ask them to help.... | This incident sounds to me like a simple misjudgment in relation to an intention to give a small gift as a thank-you. The inference to this being a bribe to influence a decision-maker is weak, since you offered it as a gift irrespective of the outcome of the decision of the professor, and the value was extremely small ... |
189,134 | I am an international student studying in North america. I am applying for a master's program. I reached out to many professors for a letter of recommendation, but none replied. So, I told one professor that I would give him a small coffee gift card just for replying, regardless of whether he said yes or no. **I now re... | 2022/09/27 | [
"https://academia.stackexchange.com/questions/189134",
"https://academia.stackexchange.com",
"https://academia.stackexchange.com/users/163105/"
] | Perhaps this is just a cultural misunderstanding. You don't write like a native Canadian, so I'll assume you are from another culture for this advice.
Different cultures have different practices and expectations around gifts. In Canada and the US, what you did seems like a bribe of some sort and your comments suggest ... | This incident sounds to me like a simple misjudgment in relation to an intention to give a small gift as a thank-you. The inference to this being a bribe to influence a decision-maker is weak, since you offered it as a gift irrespective of the outcome of the decision of the professor, and the value was extremely small ... |
189,134 | I am an international student studying in North america. I am applying for a master's program. I reached out to many professors for a letter of recommendation, but none replied. So, I told one professor that I would give him a small coffee gift card just for replying, regardless of whether he said yes or no. **I now re... | 2022/09/27 | [
"https://academia.stackexchange.com/questions/189134",
"https://academia.stackexchange.com",
"https://academia.stackexchange.com/users/163105/"
] | **Your professor's actions seem very strange.**
* If he believes that you were trying to bribe him, then he should have refused to write the letter.
* If he believes that this was a simple misunderstanding, then putting this in your letter seems like an inappropriate response. At most, the professor should disclose th... | **My first thought would have been "do not use his letter", but I also feel like you don't have a lot of options. It's not easy.**
1. I have a lot of experience with recommendation letters (requesting, writing, and reading). I have never, ever, seen (or made) any mention of attempted gifts in one of them. This would s... |
189,134 | I am an international student studying in North america. I am applying for a master's program. I reached out to many professors for a letter of recommendation, but none replied. So, I told one professor that I would give him a small coffee gift card just for replying, regardless of whether he said yes or no. **I now re... | 2022/09/27 | [
"https://academia.stackexchange.com/questions/189134",
"https://academia.stackexchange.com",
"https://academia.stackexchange.com/users/163105/"
] | Perhaps this is just a cultural misunderstanding. You don't write like a native Canadian, so I'll assume you are from another culture for this advice.
Different cultures have different practices and expectations around gifts. In Canada and the US, what you did seems like a bribe of some sort and your comments suggest ... | This is a really awkward position, for the both of you. If he considers this as a bribe, he is obligated to report it to the university and not mention in a recommendation letter... I think that he is trying to teach you something about the ethical value of that as an action. Also, I don't know how things work over the... |
567,805 | I have a UIPickerView that gets faded out to 20% alpha when not in use. I want the user to be able to touch the picker and have it fade back in.
I can get it to work if I put a touchesBegan method on the main View, but this only works when the user touches the View. I tried sub-classing UIPickerView and having a touch... | 2009/02/20 | [
"https://Stackoverflow.com/questions/567805",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1075/"
] | I've been searching for a solution to this problem for over a week. I'm answering you even if you're question is over a year old hoping this helps others.
Sorry if my language is not very technical, but I'm pretty new to Objective-C and iPhone development.
Subclassing UIpickerView is the right way to do it. But you'v... | Here is some code that does what you want:
```
@interface TouchDetectionView : UIPickerView {
}
- (UIView *)getNextResponderView:(NSSet *)touches withEvent:(UIEvent *)event;
@end
@implementation TouchDetectionView
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
UIView * hitTestView = [self get... |
567,805 | I have a UIPickerView that gets faded out to 20% alpha when not in use. I want the user to be able to touch the picker and have it fade back in.
I can get it to work if I put a touchesBegan method on the main View, but this only works when the user touches the View. I tried sub-classing UIPickerView and having a touch... | 2009/02/20 | [
"https://Stackoverflow.com/questions/567805",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1075/"
] | I've been searching for a solution to this problem for over a week. I'm answering you even if you're question is over a year old hoping this helps others.
Sorry if my language is not very technical, but I'm pretty new to Objective-C and iPhone development.
Subclassing UIpickerView is the right way to do it. But you'v... | Both of the above answers were very helpful, but I have a UIPickerView nested within a UIScrollView. I'm also doing continual rendering elsewhere on-screen while the GUI is present. The problem is that the UIPickerView doesn't update fully when: a non-selected row is tapped, the picker is moved so that two rows straddl... |
567,805 | I have a UIPickerView that gets faded out to 20% alpha when not in use. I want the user to be able to touch the picker and have it fade back in.
I can get it to work if I put a touchesBegan method on the main View, but this only works when the user touches the View. I tried sub-classing UIPickerView and having a touch... | 2009/02/20 | [
"https://Stackoverflow.com/questions/567805",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1075/"
] | I've been searching for a solution to this problem for over a week. I'm answering you even if you're question is over a year old hoping this helps others.
Sorry if my language is not very technical, but I'm pretty new to Objective-C and iPhone development.
Subclassing UIpickerView is the right way to do it. But you'v... | Set canCancelContentTouches and delaysContentTouches of parent view to NO, that worked for me |
567,805 | I have a UIPickerView that gets faded out to 20% alpha when not in use. I want the user to be able to touch the picker and have it fade back in.
I can get it to work if I put a touchesBegan method on the main View, but this only works when the user touches the View. I tried sub-classing UIPickerView and having a touch... | 2009/02/20 | [
"https://Stackoverflow.com/questions/567805",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1075/"
] | I've been searching for a solution to this problem for over a week. I'm answering you even if you're question is over a year old hoping this helps others.
Sorry if my language is not very technical, but I'm pretty new to Objective-C and iPhone development.
Subclassing UIpickerView is the right way to do it. But you'v... | Couldn't find a recent, easier solution to this so I rigged something to solve my problem. Created an invisible button that stretches over the picker view. Connected that button with a "Touch Down" recognizer to my parent UIView. Now any functionality can be added, I happened to need a random selection timer to be inva... |
567,805 | I have a UIPickerView that gets faded out to 20% alpha when not in use. I want the user to be able to touch the picker and have it fade back in.
I can get it to work if I put a touchesBegan method on the main View, but this only works when the user touches the View. I tried sub-classing UIPickerView and having a touch... | 2009/02/20 | [
"https://Stackoverflow.com/questions/567805",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1075/"
] | Here is some code that does what you want:
```
@interface TouchDetectionView : UIPickerView {
}
- (UIView *)getNextResponderView:(NSSet *)touches withEvent:(UIEvent *)event;
@end
@implementation TouchDetectionView
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
UIView * hitTestView = [self get... | Both of the above answers were very helpful, but I have a UIPickerView nested within a UIScrollView. I'm also doing continual rendering elsewhere on-screen while the GUI is present. The problem is that the UIPickerView doesn't update fully when: a non-selected row is tapped, the picker is moved so that two rows straddl... |
567,805 | I have a UIPickerView that gets faded out to 20% alpha when not in use. I want the user to be able to touch the picker and have it fade back in.
I can get it to work if I put a touchesBegan method on the main View, but this only works when the user touches the View. I tried sub-classing UIPickerView and having a touch... | 2009/02/20 | [
"https://Stackoverflow.com/questions/567805",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1075/"
] | Here is some code that does what you want:
```
@interface TouchDetectionView : UIPickerView {
}
- (UIView *)getNextResponderView:(NSSet *)touches withEvent:(UIEvent *)event;
@end
@implementation TouchDetectionView
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
UIView * hitTestView = [self get... | Set canCancelContentTouches and delaysContentTouches of parent view to NO, that worked for me |
567,805 | I have a UIPickerView that gets faded out to 20% alpha when not in use. I want the user to be able to touch the picker and have it fade back in.
I can get it to work if I put a touchesBegan method on the main View, but this only works when the user touches the View. I tried sub-classing UIPickerView and having a touch... | 2009/02/20 | [
"https://Stackoverflow.com/questions/567805",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1075/"
] | Here is some code that does what you want:
```
@interface TouchDetectionView : UIPickerView {
}
- (UIView *)getNextResponderView:(NSSet *)touches withEvent:(UIEvent *)event;
@end
@implementation TouchDetectionView
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
UIView * hitTestView = [self get... | Couldn't find a recent, easier solution to this so I rigged something to solve my problem. Created an invisible button that stretches over the picker view. Connected that button with a "Touch Down" recognizer to my parent UIView. Now any functionality can be added, I happened to need a random selection timer to be inva... |
11,669,419 | Please help in this, i want to run a shell script where it should take jave heap dump every 30 seconds using kill -3 command. Thanks in advance. | 2012/07/26 | [
"https://Stackoverflow.com/questions/11669419",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1553784/"
] | Have you tried such a simple shell script?
```
while true
do
jmap -dump:file=/tmp/java-`date +%s`.hprof PID_OF_JVM
sleep 30
done
```
This will create one file pear each snapshot. For thread dump you can use similar script:
```
while true
do
jstack PID_OF_JVM > stack-`date +%s`.txt
sleep 30
done
```
~~I gu... | I have not used `kill -3` command but i have used `jmap` command provided by `sun sdk`
You can write a script and then in script run below command.
```
${JAVA_HOME}/bin/jmap -dump:file=/home/MyDump.hprof PID
``` |
11,669,419 | Please help in this, i want to run a shell script where it should take jave heap dump every 30 seconds using kill -3 command. Thanks in advance. | 2012/07/26 | [
"https://Stackoverflow.com/questions/11669419",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1553784/"
] | Have you tried such a simple shell script?
```
while true
do
jmap -dump:file=/tmp/java-`date +%s`.hprof PID_OF_JVM
sleep 30
done
```
This will create one file pear each snapshot. For thread dump you can use similar script:
```
while true
do
jstack PID_OF_JVM > stack-`date +%s`.txt
sleep 30
done
```
~~I gu... | 3 will give only the thread dump but not the heap dump.Thread dump means you can only check the stack traces for each thread in the JVM.But you are lookin g for the heap dump on linux then need to use the below commands.
jmap -dump:file=myheap.bin {pid of which you are looking to take heap dump}. The output "myheap.bin... |
11,669,419 | Please help in this, i want to run a shell script where it should take jave heap dump every 30 seconds using kill -3 command. Thanks in advance. | 2012/07/26 | [
"https://Stackoverflow.com/questions/11669419",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1553784/"
] | you can do thread dumping from java application using code like this
```
public static String getDumpFor(Thread thread) {
StringBuilder sb = new StringBuilder();
if (thread.isAlive()) {
StackTraceElement[] stackTrace = thread.getStackTrace();
sb.append(thread.toString()).append("\n")
... | I have not used `kill -3` command but i have used `jmap` command provided by `sun sdk`
You can write a script and then in script run below command.
```
${JAVA_HOME}/bin/jmap -dump:file=/home/MyDump.hprof PID
``` |
11,669,419 | Please help in this, i want to run a shell script where it should take jave heap dump every 30 seconds using kill -3 command. Thanks in advance. | 2012/07/26 | [
"https://Stackoverflow.com/questions/11669419",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1553784/"
] | you can do thread dumping from java application using code like this
```
public static String getDumpFor(Thread thread) {
StringBuilder sb = new StringBuilder();
if (thread.isAlive()) {
StackTraceElement[] stackTrace = thread.getStackTrace();
sb.append(thread.toString()).append("\n")
... | 3 will give only the thread dump but not the heap dump.Thread dump means you can only check the stack traces for each thread in the JVM.But you are lookin g for the heap dump on linux then need to use the below commands.
jmap -dump:file=myheap.bin {pid of which you are looking to take heap dump}. The output "myheap.bin... |
11,669,419 | Please help in this, i want to run a shell script where it should take jave heap dump every 30 seconds using kill -3 command. Thanks in advance. | 2012/07/26 | [
"https://Stackoverflow.com/questions/11669419",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1553784/"
] | I have not used `kill -3` command but i have used `jmap` command provided by `sun sdk`
You can write a script and then in script run below command.
```
${JAVA_HOME}/bin/jmap -dump:file=/home/MyDump.hprof PID
``` | 3 will give only the thread dump but not the heap dump.Thread dump means you can only check the stack traces for each thread in the JVM.But you are lookin g for the heap dump on linux then need to use the below commands.
jmap -dump:file=myheap.bin {pid of which you are looking to take heap dump}. The output "myheap.bin... |
8,096,852 | I managed to find out how to make a WPF animation - transition between two colors.
It's called ColorAnimation and works well.
```
ColorAnimation animation = new ColorAnimation
{
From = Colors.DarkGreen,
To = Colors.Transparent,
Duration = new Duration(TimeSpan.FromSeconds(1.5)),
AutoReverse = false
};... | 2011/11/11 | [
"https://Stackoverflow.com/questions/8096852",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | You just need to use the color animation on the gradient stops of the gradient brush. Here is an example that animates a rectangle gradient using a storyboard.
```
<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="G... | You can animate the color of the brush if you have a template style in which you give the fill brush a name, like so:
```
<Rectangle Width="100" Height="100">
<Rectangle.Fill>
<SolidColorBrush x:Name="MyAnimatedBrush" Color="Orange" />
</Rectangle.Fill>
<Rectangle.Triggers>
<!-- Animates the brush's col... |
8,096,852 | I managed to find out how to make a WPF animation - transition between two colors.
It's called ColorAnimation and works well.
```
ColorAnimation animation = new ColorAnimation
{
From = Colors.DarkGreen,
To = Colors.Transparent,
Duration = new Duration(TimeSpan.FromSeconds(1.5)),
AutoReverse = false
};... | 2011/11/11 | [
"https://Stackoverflow.com/questions/8096852",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Another possible way is, to create a custom animtion class that animate brushes.
I found a simple way to do that by creating a class, derivated from [`AnimationTimeline`](https://msdn.microsoft.com/en-us/library/system.windows.media.animation.animationtimeline.aspx). We can override some members in the custom class, am... | You just need to use the color animation on the gradient stops of the gradient brush. Here is an example that animates a rectangle gradient using a storyboard.
```
<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="G... |
8,096,852 | I managed to find out how to make a WPF animation - transition between two colors.
It's called ColorAnimation and works well.
```
ColorAnimation animation = new ColorAnimation
{
From = Colors.DarkGreen,
To = Colors.Transparent,
Duration = new Duration(TimeSpan.FromSeconds(1.5)),
AutoReverse = false
};... | 2011/11/11 | [
"https://Stackoverflow.com/questions/8096852",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Another possible way is, to create a custom animtion class that animate brushes.
I found a simple way to do that by creating a class, derivated from [`AnimationTimeline`](https://msdn.microsoft.com/en-us/library/system.windows.media.animation.animationtimeline.aspx). We can override some members in the custom class, am... | You can animate the color of the brush if you have a template style in which you give the fill brush a name, like so:
```
<Rectangle Width="100" Height="100">
<Rectangle.Fill>
<SolidColorBrush x:Name="MyAnimatedBrush" Color="Orange" />
</Rectangle.Fill>
<Rectangle.Triggers>
<!-- Animates the brush's col... |
2,375,178 | I have a class, that subscribes to an event via PRISMs event aggregator.
As it is somewhat hard to mock the event aggregator as noted [here](https://stackoverflow.com/questions/1187269/why-does-my-moq-ieventaggregator-verification-fail), I just instantiate a real one and pass it to the system under test.
In my test I... | 2010/03/03 | [
"https://Stackoverflow.com/questions/2375178",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/97443/"
] | If you mock both the event and the Event Aggregator, and use moq's Callback, you can do it.
Here's an example:
```
Mock<IEventAggregator> mockEventAggregator;
Mock<MyEvent> mockEvent;
mockEventAggregator.Setup(e => e.GetEvent<MyEvent>()).Returns(mockEvent.Object);
// Get a copy of the callback so we can "Publish" ... | I really think you should use mocks for everything and not the EventAggregator. It's not hard to mock at all... I don't think the linked answer proves much of anything about the testability of the EventAggregator.
Here's your test. I don't use MSpec, but here's the test in Moq. You didn't provide any code, so I'm basi... |
2,375,178 | I have a class, that subscribes to an event via PRISMs event aggregator.
As it is somewhat hard to mock the event aggregator as noted [here](https://stackoverflow.com/questions/1187269/why-does-my-moq-ieventaggregator-verification-fail), I just instantiate a real one and pass it to the system under test.
In my test I... | 2010/03/03 | [
"https://Stackoverflow.com/questions/2375178",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/97443/"
] | I really think you should use mocks for everything and not the EventAggregator. It's not hard to mock at all... I don't think the linked answer proves much of anything about the testability of the EventAggregator.
Here's your test. I don't use MSpec, but here's the test in Moq. You didn't provide any code, so I'm basi... | You may not like this as it may involve what you feel is an "ugly hack", but my preference IS to use a real EventAggregator rather than mocking everything. While ostensibly an external resource, the EventAggregator runs in memory and so does not require much set-up, clear down, and is not a bottle neck like other exter... |
2,375,178 | I have a class, that subscribes to an event via PRISMs event aggregator.
As it is somewhat hard to mock the event aggregator as noted [here](https://stackoverflow.com/questions/1187269/why-does-my-moq-ieventaggregator-verification-fail), I just instantiate a real one and pass it to the system under test.
In my test I... | 2010/03/03 | [
"https://Stackoverflow.com/questions/2375178",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/97443/"
] | If you mock both the event and the Event Aggregator, and use moq's Callback, you can do it.
Here's an example:
```
Mock<IEventAggregator> mockEventAggregator;
Mock<MyEvent> mockEvent;
mockEventAggregator.Setup(e => e.GetEvent<MyEvent>()).Returns(mockEvent.Object);
// Get a copy of the callback so we can "Publish" ... | You may not like this as it may involve what you feel is an "ugly hack", but my preference IS to use a real EventAggregator rather than mocking everything. While ostensibly an external resource, the EventAggregator runs in memory and so does not require much set-up, clear down, and is not a bottle neck like other exter... |
49,671,897 | I wrote a PowerShell script to download files using FTPto my local machine.
After the file is downloaded, I want to delete it from the FTP server. I wrote this code too. But unfortunately it's not working.
Can anyone help me to point out what is wrong with my code? Any clues will be helpful ...
**Here is my code**... | 2018/04/05 | [
"https://Stackoverflow.com/questions/49671897",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | You cannot use `Test-Path` with an FTP URL. So your code for deleting the file will never execute.
Just remove the `Test-Path` condition and try to delete the file unconditionally. Then check for error and treat *"file not exist"* error as you like.
```
$ftprequest = [System.Net.FtpWebRequest]::create($Source)
$ftpre... | I ran your script locally to try it out and found a few issues. I refactored also a few things just to make it a bit more readable (at least in my opinion :) ).
### Issues
* Line 13. `$Source` parameter there is a `ftp://...` path. `Test-Path` will always return `$false` here and the delete request will never be exec... |
24,344,022 | I recently came across this awesome `MutationObserver` feature which sort of keep tracks of the changes on any dom element. I used the code that was shown on the mozilla developer network, but can't seem to make it run. This is the code I used ([link](http://jsfiddle.net/6Jajs/)):
```
// create an observer instance... | 2014/06/21 | [
"https://Stackoverflow.com/questions/24344022",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1523154/"
] | You need `subtree: true`
<http://jsfiddle.net/6Jajs/1/>
The inner text would normally be a child text() element in the DOM. Without the subtree it will only watch the element itself.
There is possible confusion surrounding "characterData" (<https://developer.mozilla.org/en-US/docs/Web/API/CharacterData>), but it see... | Simple Example:
```
<div contentEditable id="myID">MUST EDIT NOW</div>
<script>
let x = new MutationObserver( function(){ alert('DETECTED'); } );
x.observe( myID , {subtree:true,characterData:true} );
</script>
```
See Example Live: <https://jsfiddle.net/mbo9eLt5/> |
24,344,022 | I recently came across this awesome `MutationObserver` feature which sort of keep tracks of the changes on any dom element. I used the code that was shown on the mozilla developer network, but can't seem to make it run. This is the code I used ([link](http://jsfiddle.net/6Jajs/)):
```
// create an observer instance... | 2014/06/21 | [
"https://Stackoverflow.com/questions/24344022",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1523154/"
] | You need `subtree: true`
<http://jsfiddle.net/6Jajs/1/>
The inner text would normally be a child text() element in the DOM. Without the subtree it will only watch the element itself.
There is possible confusion surrounding "characterData" (<https://developer.mozilla.org/en-US/docs/Web/API/CharacterData>), but it see... | To Watch Text or Input changes
use
```
characterData: true
```
Example:
```js
var target = document.querySelector('#text');
var observer = new MutationObserver(function(mutations) {
mutations.forEach(function(mutation) {
console.log(mutation.type);
});
});
var config = {
characterData: true,
... |
66,022,544 | Can some help me with this issue. On press not working in Flatlist render function. here my code. i checked other screens touch case working fine but when i try it in Flatlist it's not working
```
render(){
return (
<View style={styles.container} >
<FlatList
... | 2021/02/03 | [
"https://Stackoverflow.com/questions/66022544",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6744327/"
] | You need to wrap your row element (inside your renderItem method) inside tag. TouchableWithoutFeedback takes onPress as it's prop where you can provide onPress event.
For TouchableWithoutFeedback refer
<https://facebook.github.io/react-native/docs/touchablewithoutfeedback.html> | if onPress is not workingin the flatlist's render method try using onTouchStart method of the components if they have in the flatList's render method. |
51,084,217 | To start off with, I realize that I *can* write an if statement with this operator that compiles and runs. I'm wondering if there's a way it can be used to make an `if`/`elsif`/`else` block a little more elegant.
I currently have a block of code that looks like this
```
if( $bill == $ted) {
# Do some stuff
}... | 2018/06/28 | [
"https://Stackoverflow.com/questions/51084217",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9886657/"
] | This uses the result of `<=>` as an array index like ***choroba's*** answer, but there is no need to store and call anonymous subroutines
I still wouldn't use it in live code
```
use strict;
use warnings;
use feature 'say';
for my $x ( 1 .. 3 ) {
say ['equal', 'greater than', 'less than']->[$x <=> 2];
}
```
##... | Well, the operator returns 1, 0 or -1 depending on the test outcome, which is what `sort` uses.
So it's quite viable to do that. But I'm not sure if it's a particularly clear approach, compared to;
```
if ( $first < $second ) { do X ; next}
if ( $first > $second ) { do Y ; next}
do Z. #$first == $second
```
I'd st... |
51,084,217 | To start off with, I realize that I *can* write an if statement with this operator that compiles and runs. I'm wondering if there's a way it can be used to make an `if`/`elsif`/`else` block a little more elegant.
I currently have a block of code that looks like this
```
if( $bill == $ted) {
# Do some stuff
}... | 2018/06/28 | [
"https://Stackoverflow.com/questions/51084217",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9886657/"
] | Well, the operator returns 1, 0 or -1 depending on the test outcome, which is what `sort` uses.
So it's quite viable to do that. But I'm not sure if it's a particularly clear approach, compared to;
```
if ( $first < $second ) { do X ; next}
if ( $first > $second ) { do Y ; next}
do Z. #$first == $second
```
I'd st... | Taking a cue from draxil w/o the experimental features:
```
use strict;
use warnings;
my $x = 1;
for ( $x <=> 2 ){
if ($_ == -1){
say "stuff"
}
if ($_ == 0){
say "diff stuff"
}
if ($_ == 1){
say "other stuff"
}
}
``` |
51,084,217 | To start off with, I realize that I *can* write an if statement with this operator that compiles and runs. I'm wondering if there's a way it can be used to make an `if`/`elsif`/`else` block a little more elegant.
I currently have a block of code that looks like this
```
if( $bill == $ted) {
# Do some stuff
}... | 2018/06/28 | [
"https://Stackoverflow.com/questions/51084217",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9886657/"
] | It's kind of obscure, but you can use the `<=>` operator to get an element of a dispatch table:
```
( sub { say 'they are the same' },
sub { say 'x is greater' },
sub { say 'x is lesser' }
)[$x <=> $y]->();
```
It's based on the fact that the index -1 returns the last element of a list.
Using a hash might... | I wouldn't call it elegant, but you could use a given/when to catch all the outcomes:
```
use strict;
use 5.10.0;
use feature "switch";
use experimental "smartmatch";
my $x = 1;
given( $x <=> 2 ){
when(-1){
say "stuff"
}
when(0){
say "diff stuff"... |
51,084,217 | To start off with, I realize that I *can* write an if statement with this operator that compiles and runs. I'm wondering if there's a way it can be used to make an `if`/`elsif`/`else` block a little more elegant.
I currently have a block of code that looks like this
```
if( $bill == $ted) {
# Do some stuff
}... | 2018/06/28 | [
"https://Stackoverflow.com/questions/51084217",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9886657/"
] | It's kind of obscure, but you can use the `<=>` operator to get an element of a dispatch table:
```
( sub { say 'they are the same' },
sub { say 'x is greater' },
sub { say 'x is lesser' }
)[$x <=> $y]->();
```
It's based on the fact that the index -1 returns the last element of a list.
Using a hash might... | ```perl
{
goto (qw( EQ GT LS ))[$x <=> $y];
LS:
say('less');
last;
EQ:
say('equal');
last;
GT:
say('greater');
}
```
[But](http://perldoc.perl.org/functions/goto.html):
>
> This isn't necessarily recommended if you're optimizing for maintainability.
>
>
> |
51,084,217 | To start off with, I realize that I *can* write an if statement with this operator that compiles and runs. I'm wondering if there's a way it can be used to make an `if`/`elsif`/`else` block a little more elegant.
I currently have a block of code that looks like this
```
if( $bill == $ted) {
# Do some stuff
}... | 2018/06/28 | [
"https://Stackoverflow.com/questions/51084217",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9886657/"
] | Well, the operator returns 1, 0 or -1 depending on the test outcome, which is what `sort` uses.
So it's quite viable to do that. But I'm not sure if it's a particularly clear approach, compared to;
```
if ( $first < $second ) { do X ; next}
if ( $first > $second ) { do Y ; next}
do Z. #$first == $second
```
I'd st... | ```perl
{
goto (qw( EQ GT LS ))[$x <=> $y];
LS:
say('less');
last;
EQ:
say('equal');
last;
GT:
say('greater');
}
```
[But](http://perldoc.perl.org/functions/goto.html):
>
> This isn't necessarily recommended if you're optimizing for maintainability.
>
>
> |
51,084,217 | To start off with, I realize that I *can* write an if statement with this operator that compiles and runs. I'm wondering if there's a way it can be used to make an `if`/`elsif`/`else` block a little more elegant.
I currently have a block of code that looks like this
```
if( $bill == $ted) {
# Do some stuff
}... | 2018/06/28 | [
"https://Stackoverflow.com/questions/51084217",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9886657/"
] | It's kind of obscure, but you can use the `<=>` operator to get an element of a dispatch table:
```
( sub { say 'they are the same' },
sub { say 'x is greater' },
sub { say 'x is lesser' }
)[$x <=> $y]->();
```
It's based on the fact that the index -1 returns the last element of a list.
Using a hash might... | Taking a cue from draxil w/o the experimental features:
```
use strict;
use warnings;
my $x = 1;
for ( $x <=> 2 ){
if ($_ == -1){
say "stuff"
}
if ($_ == 0){
say "diff stuff"
}
if ($_ == 1){
say "other stuff"
}
}
``` |
51,084,217 | To start off with, I realize that I *can* write an if statement with this operator that compiles and runs. I'm wondering if there's a way it can be used to make an `if`/`elsif`/`else` block a little more elegant.
I currently have a block of code that looks like this
```
if( $bill == $ted) {
# Do some stuff
}... | 2018/06/28 | [
"https://Stackoverflow.com/questions/51084217",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9886657/"
] | It's kind of obscure, but you can use the `<=>` operator to get an element of a dispatch table:
```
( sub { say 'they are the same' },
sub { say 'x is greater' },
sub { say 'x is lesser' }
)[$x <=> $y]->();
```
It's based on the fact that the index -1 returns the last element of a list.
Using a hash might... | This uses the result of `<=>` as an array index like ***choroba's*** answer, but there is no need to store and call anonymous subroutines
I still wouldn't use it in live code
```
use strict;
use warnings;
use feature 'say';
for my $x ( 1 .. 3 ) {
say ['equal', 'greater than', 'less than']->[$x <=> 2];
}
```
##... |
51,084,217 | To start off with, I realize that I *can* write an if statement with this operator that compiles and runs. I'm wondering if there's a way it can be used to make an `if`/`elsif`/`else` block a little more elegant.
I currently have a block of code that looks like this
```
if( $bill == $ted) {
# Do some stuff
}... | 2018/06/28 | [
"https://Stackoverflow.com/questions/51084217",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9886657/"
] | This uses the result of `<=>` as an array index like ***choroba's*** answer, but there is no need to store and call anonymous subroutines
I still wouldn't use it in live code
```
use strict;
use warnings;
use feature 'say';
for my $x ( 1 .. 3 ) {
say ['equal', 'greater than', 'less than']->[$x <=> 2];
}
```
##... | ```perl
{
goto (qw( EQ GT LS ))[$x <=> $y];
LS:
say('less');
last;
EQ:
say('equal');
last;
GT:
say('greater');
}
```
[But](http://perldoc.perl.org/functions/goto.html):
>
> This isn't necessarily recommended if you're optimizing for maintainability.
>
>
> |
51,084,217 | To start off with, I realize that I *can* write an if statement with this operator that compiles and runs. I'm wondering if there's a way it can be used to make an `if`/`elsif`/`else` block a little more elegant.
I currently have a block of code that looks like this
```
if( $bill == $ted) {
# Do some stuff
}... | 2018/06/28 | [
"https://Stackoverflow.com/questions/51084217",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9886657/"
] | It's kind of obscure, but you can use the `<=>` operator to get an element of a dispatch table:
```
( sub { say 'they are the same' },
sub { say 'x is greater' },
sub { say 'x is lesser' }
)[$x <=> $y]->();
```
It's based on the fact that the index -1 returns the last element of a list.
Using a hash might... | Well, the operator returns 1, 0 or -1 depending on the test outcome, which is what `sort` uses.
So it's quite viable to do that. But I'm not sure if it's a particularly clear approach, compared to;
```
if ( $first < $second ) { do X ; next}
if ( $first > $second ) { do Y ; next}
do Z. #$first == $second
```
I'd st... |
51,084,217 | To start off with, I realize that I *can* write an if statement with this operator that compiles and runs. I'm wondering if there's a way it can be used to make an `if`/`elsif`/`else` block a little more elegant.
I currently have a block of code that looks like this
```
if( $bill == $ted) {
# Do some stuff
}... | 2018/06/28 | [
"https://Stackoverflow.com/questions/51084217",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9886657/"
] | This uses the result of `<=>` as an array index like ***choroba's*** answer, but there is no need to store and call anonymous subroutines
I still wouldn't use it in live code
```
use strict;
use warnings;
use feature 'say';
for my $x ( 1 .. 3 ) {
say ['equal', 'greater than', 'less than']->[$x <=> 2];
}
```
##... | Taking a cue from draxil w/o the experimental features:
```
use strict;
use warnings;
my $x = 1;
for ( $x <=> 2 ){
if ($_ == -1){
say "stuff"
}
if ($_ == 0){
say "diff stuff"
}
if ($_ == 1){
say "other stuff"
}
}
``` |
21,578,837 | I preg\_replace anything like **.php.jpg**, **.php.png**,
**.js.jpg**, **.js.png**, in the name of the uploaded file (images) for security purposes and would like to know if there are any extensions that I should also consider replacing before moving the file to the corresponding folder after the upload is complete? | 2014/02/05 | [
"https://Stackoverflow.com/questions/21578837",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1190478/"
] | Looking at the filename alone is really not a safe way to prevent rogue code/executables being uploaded.
Depending on the type of files you are accepting for upload there are better ways to play it safe.
As a general rule never upload any files to anywhere publicly accessible from the web until you know 100% they're... | Depending on what you need to do with the file it would be possible to crypt or just run a gzip on the files. There you save space on the server and if someone uploads scriptfiles they can't be run via a http request. The thing i would to is to check if there is any public access from the filed and/or set up an htacces... |
21,578,837 | I preg\_replace anything like **.php.jpg**, **.php.png**,
**.js.jpg**, **.js.png**, in the name of the uploaded file (images) for security purposes and would like to know if there are any extensions that I should also consider replacing before moving the file to the corresponding folder after the upload is complete? | 2014/02/05 | [
"https://Stackoverflow.com/questions/21578837",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1190478/"
] | Looking at the filename alone is really not a safe way to prevent rogue code/executables being uploaded.
Depending on the type of files you are accepting for upload there are better ways to play it safe.
As a general rule never upload any files to anywhere publicly accessible from the web until you know 100% they're... | Short answer, yes there are many other executable extensions that you should also consider blocking if you are going to use a black list approach, like 'phtml', 'java', 'perl', 'py', 'asp', 'go' and you should consider exe and bat and others that could deliver malware.
But, I would only use a blacklist if you are goi... |
60,265,318 | I want a list with rows, with each row having 2 Textfields inside of it. Those rows should be saved in an array, so that I can use the data in an other view for further functions. If the text in the Textfield is changed, the text should be saved inside the right entry in the array.
You also can add new rows to the list... | 2020/02/17 | [
"https://Stackoverflow.com/questions/60265318",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10749730/"
] | I am not sure what the best practice is keep a view up to date with state in an array like this, but here is one approach to make it work.
For the models, I added a list class that conforms to Observable object, and each KeyValue item alerts it on changes:
```
class KeyValueList: ObservableObject {
@Published va... | No need to mess up with classes, `Observable`, `Identifiable`. You can do it all with structs.
Note, that version below will do fine for insertions, but fail if you try to delete array elements:
```
import SwiftUI
// the single item
struct KeyValue {
var key: String
var value: String
}
struct ContentView: V... |
60,265,318 | I want a list with rows, with each row having 2 Textfields inside of it. Those rows should be saved in an array, so that I can use the data in an other view for further functions. If the text in the Textfield is changed, the text should be saved inside the right entry in the array.
You also can add new rows to the list... | 2020/02/17 | [
"https://Stackoverflow.com/questions/60265318",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10749730/"
] | I am not sure what the best practice is keep a view up to date with state in an array like this, but here is one approach to make it work.
For the models, I added a list class that conforms to Observable object, and each KeyValue item alerts it on changes:
```
class KeyValueList: ObservableObject {
@Published va... | Swift 5.5
=========
This version of swift enables one line code for this by passing the bindable item directly from the array.
```
struct DirectionsList: View {
@Binding var directions: [Direction]
var body: some View {
List($directions) { $direction in
Label {
TextField("... |
60,265,318 | I want a list with rows, with each row having 2 Textfields inside of it. Those rows should be saved in an array, so that I can use the data in an other view for further functions. If the text in the Textfield is changed, the text should be saved inside the right entry in the array.
You also can add new rows to the list... | 2020/02/17 | [
"https://Stackoverflow.com/questions/60265318",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10749730/"
] | I am not sure what the best practice is keep a view up to date with state in an array like this, but here is one approach to make it work.
For the models, I added a list class that conforms to Observable object, and each KeyValue item alerts it on changes:
```
class KeyValueList: ObservableObject {
@Published va... | Working code example for iOS 15
===============================
In SwiftUI, Apple recommends passing the binding directly into the List constructor and using a `@Binding` in the `ViewBuilder` block to iterate through with each element.
Apple recommends this approach over using the `Indices` to iterate over the collec... |
60,265,318 | I want a list with rows, with each row having 2 Textfields inside of it. Those rows should be saved in an array, so that I can use the data in an other view for further functions. If the text in the Textfield is changed, the text should be saved inside the right entry in the array.
You also can add new rows to the list... | 2020/02/17 | [
"https://Stackoverflow.com/questions/60265318",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10749730/"
] | No need to mess up with classes, `Observable`, `Identifiable`. You can do it all with structs.
Note, that version below will do fine for insertions, but fail if you try to delete array elements:
```
import SwiftUI
// the single item
struct KeyValue {
var key: String
var value: String
}
struct ContentView: V... | Swift 5.5
=========
This version of swift enables one line code for this by passing the bindable item directly from the array.
```
struct DirectionsList: View {
@Binding var directions: [Direction]
var body: some View {
List($directions) { $direction in
Label {
TextField("... |
60,265,318 | I want a list with rows, with each row having 2 Textfields inside of it. Those rows should be saved in an array, so that I can use the data in an other view for further functions. If the text in the Textfield is changed, the text should be saved inside the right entry in the array.
You also can add new rows to the list... | 2020/02/17 | [
"https://Stackoverflow.com/questions/60265318",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10749730/"
] | Working code example for iOS 15
===============================
In SwiftUI, Apple recommends passing the binding directly into the List constructor and using a `@Binding` in the `ViewBuilder` block to iterate through with each element.
Apple recommends this approach over using the `Indices` to iterate over the collec... | Swift 5.5
=========
This version of swift enables one line code for this by passing the bindable item directly from the array.
```
struct DirectionsList: View {
@Binding var directions: [Direction]
var body: some View {
List($directions) { $direction in
Label {
TextField("... |
9,777,070 | I am trying to make sure that the format people input is exactly this :
```
.match(/\d{1,2}:\d\d\s((AM)|(PM))/)
```
Meaning that a user could write :
```
12:30 AM
2:30 PM
```
But not :
```
1:2 A
1:30
PM
```
It needs to be first two digits, followed by a colon, than two more digits, a space, and either AM or PM... | 2012/03/19 | [
"https://Stackoverflow.com/questions/9777070",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/93311/"
] | What exactly seems to be the problem?
```
> "1:2 A".match(/\d{1,2}:\d\d\s((AM)|(PM))/);
null
>"12:30 AM".match(/\d{1,2}:\d\d\s((AM)|(PM))/);
["12:30 AM", "AM", "AM", undefined]
```
However:
1. You need to ground your expression to the start (`^`) and end (`$`) of the string otherwise;
```
> "foo 12:30 AM foo".mat... | If your problem is new line character.
You can try:
```
'12:30
AM'.replace(/\n/, '').match(/\d{1,2}:\d\d\s((AM)|(PM))/)
``` |
9,777,070 | I am trying to make sure that the format people input is exactly this :
```
.match(/\d{1,2}:\d\d\s((AM)|(PM))/)
```
Meaning that a user could write :
```
12:30 AM
2:30 PM
```
But not :
```
1:2 A
1:30
PM
```
It needs to be first two digits, followed by a colon, than two more digits, a space, and either AM or PM... | 2012/03/19 | [
"https://Stackoverflow.com/questions/9777070",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/93311/"
] | What exactly seems to be the problem?
```
> "1:2 A".match(/\d{1,2}:\d\d\s((AM)|(PM))/);
null
>"12:30 AM".match(/\d{1,2}:\d\d\s((AM)|(PM))/);
["12:30 AM", "AM", "AM", undefined]
```
However:
1. You need to ground your expression to the start (`^`) and end (`$`) of the string otherwise;
```
> "foo 12:30 AM foo".mat... | Your regex seems to be right. Incorporating some ideas above, you could test your string like this with Regex:
```
^(1[0-2]|\d):[0-5]\d [aApP][mM]$
```
And the testing code in Javascript:
```
var regex = /^(1[0-2]|\d):[0-5]\d [aApP][mM]$/g;
var input = "2:30 PM";
if(regex.test(input)) {
var matches... |
9,777,070 | I am trying to make sure that the format people input is exactly this :
```
.match(/\d{1,2}:\d\d\s((AM)|(PM))/)
```
Meaning that a user could write :
```
12:30 AM
2:30 PM
```
But not :
```
1:2 A
1:30
PM
```
It needs to be first two digits, followed by a colon, than two more digits, a space, and either AM or PM... | 2012/03/19 | [
"https://Stackoverflow.com/questions/9777070",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/93311/"
] | Assuming that you are checking it on single line input field (and not searching it inside a text area), you should do:
```
/^\d{1,2}:\d\d\s[AP]M$/
``` | I've tried your code in <http://www.regular-expressions.info/javascriptexample.html> and it worked.
By the way, you also need to test if the time is valid. Your code now can accept things like this 99:12 AM as if they were correct. I suggest you to use something like this.
```
\b(1[0-2]|\d):[0-5][0-9]\s([aApP][mM])\... |
9,777,070 | I am trying to make sure that the format people input is exactly this :
```
.match(/\d{1,2}:\d\d\s((AM)|(PM))/)
```
Meaning that a user could write :
```
12:30 AM
2:30 PM
```
But not :
```
1:2 A
1:30
PM
```
It needs to be first two digits, followed by a colon, than two more digits, a space, and either AM or PM... | 2012/03/19 | [
"https://Stackoverflow.com/questions/9777070",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/93311/"
] | What exactly seems to be the problem?
```
> "1:2 A".match(/\d{1,2}:\d\d\s((AM)|(PM))/);
null
>"12:30 AM".match(/\d{1,2}:\d\d\s((AM)|(PM))/);
["12:30 AM", "AM", "AM", undefined]
```
However:
1. You need to ground your expression to the start (`^`) and end (`$`) of the string otherwise;
```
> "foo 12:30 AM foo".mat... | Combining the ideas of Matt, c0deNinja and my own you should end up with:
```
/^(0?[1-9]|1[0-2]):[0-5][0-9]\s?[AP]M$/.test(input);
``` |
9,777,070 | I am trying to make sure that the format people input is exactly this :
```
.match(/\d{1,2}:\d\d\s((AM)|(PM))/)
```
Meaning that a user could write :
```
12:30 AM
2:30 PM
```
But not :
```
1:2 A
1:30
PM
```
It needs to be first two digits, followed by a colon, than two more digits, a space, and either AM or PM... | 2012/03/19 | [
"https://Stackoverflow.com/questions/9777070",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/93311/"
] | How about something like this:
```
.match(/([0]?[1-9]|1[0-2])(:)[0-5][0-9]?( )?(AM|PM)/)
``` | Your regex seems to be right. Incorporating some ideas above, you could test your string like this with Regex:
```
^(1[0-2]|\d):[0-5]\d [aApP][mM]$
```
And the testing code in Javascript:
```
var regex = /^(1[0-2]|\d):[0-5]\d [aApP][mM]$/g;
var input = "2:30 PM";
if(regex.test(input)) {
var matches... |
9,777,070 | I am trying to make sure that the format people input is exactly this :
```
.match(/\d{1,2}:\d\d\s((AM)|(PM))/)
```
Meaning that a user could write :
```
12:30 AM
2:30 PM
```
But not :
```
1:2 A
1:30
PM
```
It needs to be first two digits, followed by a colon, than two more digits, a space, and either AM or PM... | 2012/03/19 | [
"https://Stackoverflow.com/questions/9777070",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/93311/"
] | What exactly seems to be the problem?
```
> "1:2 A".match(/\d{1,2}:\d\d\s((AM)|(PM))/);
null
>"12:30 AM".match(/\d{1,2}:\d\d\s((AM)|(PM))/);
["12:30 AM", "AM", "AM", undefined]
```
However:
1. You need to ground your expression to the start (`^`) and end (`$`) of the string otherwise;
```
> "foo 12:30 AM foo".mat... | Assuming that you are checking it on single line input field (and not searching it inside a text area), you should do:
```
/^\d{1,2}:\d\d\s[AP]M$/
``` |
9,777,070 | I am trying to make sure that the format people input is exactly this :
```
.match(/\d{1,2}:\d\d\s((AM)|(PM))/)
```
Meaning that a user could write :
```
12:30 AM
2:30 PM
```
But not :
```
1:2 A
1:30
PM
```
It needs to be first two digits, followed by a colon, than two more digits, a space, and either AM or PM... | 2012/03/19 | [
"https://Stackoverflow.com/questions/9777070",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/93311/"
] | How about something like this:
```
.match(/([0]?[1-9]|1[0-2])(:)[0-5][0-9]?( )?(AM|PM)/)
``` | If your problem is new line character.
You can try:
```
'12:30
AM'.replace(/\n/, '').match(/\d{1,2}:\d\d\s((AM)|(PM))/)
``` |
9,777,070 | I am trying to make sure that the format people input is exactly this :
```
.match(/\d{1,2}:\d\d\s((AM)|(PM))/)
```
Meaning that a user could write :
```
12:30 AM
2:30 PM
```
But not :
```
1:2 A
1:30
PM
```
It needs to be first two digits, followed by a colon, than two more digits, a space, and either AM or PM... | 2012/03/19 | [
"https://Stackoverflow.com/questions/9777070",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/93311/"
] | How about something like this:
```
.match(/([0]?[1-9]|1[0-2])(:)[0-5][0-9]?( )?(AM|PM)/)
``` | Combining the ideas of Matt, c0deNinja and my own you should end up with:
```
/^(0?[1-9]|1[0-2]):[0-5][0-9]\s?[AP]M$/.test(input);
``` |
9,777,070 | I am trying to make sure that the format people input is exactly this :
```
.match(/\d{1,2}:\d\d\s((AM)|(PM))/)
```
Meaning that a user could write :
```
12:30 AM
2:30 PM
```
But not :
```
1:2 A
1:30
PM
```
It needs to be first two digits, followed by a colon, than two more digits, a space, and either AM or PM... | 2012/03/19 | [
"https://Stackoverflow.com/questions/9777070",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/93311/"
] | Assuming that you are checking it on single line input field (and not searching it inside a text area), you should do:
```
/^\d{1,2}:\d\d\s[AP]M$/
``` | Your regex seems to be right. Incorporating some ideas above, you could test your string like this with Regex:
```
^(1[0-2]|\d):[0-5]\d [aApP][mM]$
```
And the testing code in Javascript:
```
var regex = /^(1[0-2]|\d):[0-5]\d [aApP][mM]$/g;
var input = "2:30 PM";
if(regex.test(input)) {
var matches... |
9,777,070 | I am trying to make sure that the format people input is exactly this :
```
.match(/\d{1,2}:\d\d\s((AM)|(PM))/)
```
Meaning that a user could write :
```
12:30 AM
2:30 PM
```
But not :
```
1:2 A
1:30
PM
```
It needs to be first two digits, followed by a colon, than two more digits, a space, and either AM or PM... | 2012/03/19 | [
"https://Stackoverflow.com/questions/9777070",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/93311/"
] | Assuming that you are checking it on single line input field (and not searching it inside a text area), you should do:
```
/^\d{1,2}:\d\d\s[AP]M$/
``` | Combining the ideas of Matt, c0deNinja and my own you should end up with:
```
/^(0?[1-9]|1[0-2]):[0-5][0-9]\s?[AP]M$/.test(input);
``` |
9,962 | Is there a way to get filetype for given extension or filename
For example:
```
let my_f='text.rb'
let my_ft=GetFileType(my_f)
echo my_ft
" should output ruby
``` | 2016/10/19 | [
"https://vi.stackexchange.com/questions/9962",
"https://vi.stackexchange.com",
"https://vi.stackexchange.com/users/7820/"
] | As Christian said, parsing the expression won't be the easier way. I'd even say that's insufficient. Some filetypes share the same file extension. In that case, vim parses a few lines from the files to deduce exactly their filetype.
Otherwise, you could indeed parse `filetype.vim`, but instead, I'd parse the result of... | If you need to set `filetype` for cases like "myfile.ext.template" you could use this
```
autocmd BufRead,BufNewFile *.template execute "doautocmd filetypedetect BufRead " . fnameescape(expand("<afile>:r"))
``` |
60,126,316 | Hi the link the the question is here: <https://www.hackerrank.com/challenges/harry-potter-and-wands/problem>
My solution is very simple as below. Logic is that **"group by power and age"** should give me minimum coins for every power-age combination.
Please tell me what am I missing.
```
select m.id, m.age, min(m.c... | 2020/02/08 | [
"https://Stackoverflow.com/questions/60126316",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9989987/"
] | I've been recently working through these problems to brush up on my MySQL. This was the solution I came up with, which follows similar logic to the prior posts in this thread. Basically, all I'm trying to do here is find the minimally-priced non-evil wands per code and power (and redundantly, age).
Then, I apply an in... | If you're using MySQL
1. Find the minimum coins required where the code(age) and the power remain the same.
2. Select the previously created selection and join the wands table using both minimum coin required and code.
3. Join the wands\_property table using code.
4. modify the select statement with the relevant colum... |
60,126,316 | Hi the link the the question is here: <https://www.hackerrank.com/challenges/harry-potter-and-wands/problem>
My solution is very simple as below. Logic is that **"group by power and age"** should give me minimum coins for every power-age combination.
Please tell me what am I missing.
```
select m.id, m.age, min(m.c... | 2020/02/08 | [
"https://Stackoverflow.com/questions/60126316",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9989987/"
] | I've been recently working through these problems to brush up on my MySQL. This was the solution I came up with, which follows similar logic to the prior posts in this thread. Basically, all I'm trying to do here is find the minimally-priced non-evil wands per code and power (and redundantly, age).
Then, I apply an in... | Solution(accepted)(MS SQL Server) for this one is using ROW\_NUMBER() function which will give you a rank for every unique combination of highest power with age and with coins needed in the increasing rank.
```
SELECT t1.id, t1.age, t1.coins_needed, t1.power
FROM(
SELECT Wands.id, Wands_Property.age, Wands.coins_need... |
60,126,316 | Hi the link the the question is here: <https://www.hackerrank.com/challenges/harry-potter-and-wands/problem>
My solution is very simple as below. Logic is that **"group by power and age"** should give me minimum coins for every power-age combination.
Please tell me what am I missing.
```
select m.id, m.age, min(m.c... | 2020/02/08 | [
"https://Stackoverflow.com/questions/60126316",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9989987/"
] | I've been recently working through these problems to brush up on my MySQL. This was the solution I came up with, which follows similar logic to the prior posts in this thread. Basically, all I'm trying to do here is find the minimally-priced non-evil wands per code and power (and redundantly, age).
Then, I apply an in... | I just wanna add another coding way to solve the challenge.
My code logic is simple:
1. Create a virtual table contains wands which is not evil and has the min price (because some wands has the same code, age and power, but got a different price and id)
```
SELECT
w.code,
wp.age,
MIN(w.coins_needed) as minco... |
60,126,316 | Hi the link the the question is here: <https://www.hackerrank.com/challenges/harry-potter-and-wands/problem>
My solution is very simple as below. Logic is that **"group by power and age"** should give me minimum coins for every power-age combination.
Please tell me what am I missing.
```
select m.id, m.age, min(m.c... | 2020/02/08 | [
"https://Stackoverflow.com/questions/60126316",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9989987/"
] | This was my previously submitted (accepted) solution in MS SQL Server, but this much should be the same for MySQL.
```sql
SELECT
W.id,
WP.age,
W.coins_needed,
W.power
FROM Wands W
INNER JOIN Wands_Property WP ON W.code = WP.code
WHERE WP.is_evil != 1
AND W.coins_needed = (
SELECT
MIN(W2.coi... | Solution(accepted)(MS SQL Server) for this one is using ROW\_NUMBER() function which will give you a rank for every unique combination of highest power with age and with coins needed in the increasing rank.
```
SELECT t1.id, t1.age, t1.coins_needed, t1.power
FROM(
SELECT Wands.id, Wands_Property.age, Wands.coins_need... |
60,126,316 | Hi the link the the question is here: <https://www.hackerrank.com/challenges/harry-potter-and-wands/problem>
My solution is very simple as below. Logic is that **"group by power and age"** should give me minimum coins for every power-age combination.
Please tell me what am I missing.
```
select m.id, m.age, min(m.c... | 2020/02/08 | [
"https://Stackoverflow.com/questions/60126316",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9989987/"
] | I just wanna add another coding way to solve the challenge.
My code logic is simple:
1. Create a virtual table contains wands which is not evil and has the min price (because some wands has the same code, age and power, but got a different price and id)
```
SELECT
w.code,
wp.age,
MIN(w.coins_needed) as minco... | ```
select id,age,coins_needed, power from(
select id,age,coins_needed, power, rank() over(partition by age,power order by
coins_needed) rr
from wands w
left join wands_property wp
on w.code=wp.code
where is_evil=0)a
where rr=1
order by power desc,age desc
``` |
60,126,316 | Hi the link the the question is here: <https://www.hackerrank.com/challenges/harry-potter-and-wands/problem>
My solution is very simple as below. Logic is that **"group by power and age"** should give me minimum coins for every power-age combination.
Please tell me what am I missing.
```
select m.id, m.age, min(m.c... | 2020/02/08 | [
"https://Stackoverflow.com/questions/60126316",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9989987/"
] | This was my previously submitted (accepted) solution in MS SQL Server, but this much should be the same for MySQL.
```sql
SELECT
W.id,
WP.age,
W.coins_needed,
W.power
FROM Wands W
INNER JOIN Wands_Property WP ON W.code = WP.code
WHERE WP.is_evil != 1
AND W.coins_needed = (
SELECT
MIN(W2.coi... | I've been recently working through these problems to brush up on my MySQL. This was the solution I came up with, which follows similar logic to the prior posts in this thread. Basically, all I'm trying to do here is find the minimally-priced non-evil wands per code and power (and redundantly, age).
Then, I apply an in... |
60,126,316 | Hi the link the the question is here: <https://www.hackerrank.com/challenges/harry-potter-and-wands/problem>
My solution is very simple as below. Logic is that **"group by power and age"** should give me minimum coins for every power-age combination.
Please tell me what am I missing.
```
select m.id, m.age, min(m.c... | 2020/02/08 | [
"https://Stackoverflow.com/questions/60126316",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9989987/"
] | This was my previously submitted (accepted) solution in MS SQL Server, but this much should be the same for MySQL.
```sql
SELECT
W.id,
WP.age,
W.coins_needed,
W.power
FROM Wands W
INNER JOIN Wands_Property WP ON W.code = WP.code
WHERE WP.is_evil != 1
AND W.coins_needed = (
SELECT
MIN(W2.coi... | I just wanna add another coding way to solve the challenge.
My code logic is simple:
1. Create a virtual table contains wands which is not evil and has the min price (because some wands has the same code, age and power, but got a different price and id)
```
SELECT
w.code,
wp.age,
MIN(w.coins_needed) as minco... |
60,126,316 | Hi the link the the question is here: <https://www.hackerrank.com/challenges/harry-potter-and-wands/problem>
My solution is very simple as below. Logic is that **"group by power and age"** should give me minimum coins for every power-age combination.
Please tell me what am I missing.
```
select m.id, m.age, min(m.c... | 2020/02/08 | [
"https://Stackoverflow.com/questions/60126316",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9989987/"
] | This was my previously submitted (accepted) solution in MS SQL Server, but this much should be the same for MySQL.
```sql
SELECT
W.id,
WP.age,
W.coins_needed,
W.power
FROM Wands W
INNER JOIN Wands_Property WP ON W.code = WP.code
WHERE WP.is_evil != 1
AND W.coins_needed = (
SELECT
MIN(W2.coi... | If you're using MySQL
1. Find the minimum coins required where the code(age) and the power remain the same.
2. Select the previously created selection and join the wands table using both minimum coin required and code.
3. Join the wands\_property table using code.
4. modify the select statement with the relevant colum... |
60,126,316 | Hi the link the the question is here: <https://www.hackerrank.com/challenges/harry-potter-and-wands/problem>
My solution is very simple as below. Logic is that **"group by power and age"** should give me minimum coins for every power-age combination.
Please tell me what am I missing.
```
select m.id, m.age, min(m.c... | 2020/02/08 | [
"https://Stackoverflow.com/questions/60126316",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9989987/"
] | If you're using MySQL
1. Find the minimum coins required where the code(age) and the power remain the same.
2. Select the previously created selection and join the wands table using both minimum coin required and code.
3. Join the wands\_property table using code.
4. modify the select statement with the relevant colum... | ```
select id,age,coins_needed, power from(
select id,age,coins_needed, power, rank() over(partition by age,power order by
coins_needed) rr
from wands w
left join wands_property wp
on w.code=wp.code
where is_evil=0)a
where rr=1
order by power desc,age desc
``` |
60,126,316 | Hi the link the the question is here: <https://www.hackerrank.com/challenges/harry-potter-and-wands/problem>
My solution is very simple as below. Logic is that **"group by power and age"** should give me minimum coins for every power-age combination.
Please tell me what am I missing.
```
select m.id, m.age, min(m.c... | 2020/02/08 | [
"https://Stackoverflow.com/questions/60126316",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9989987/"
] | This was my previously submitted (accepted) solution in MS SQL Server, but this much should be the same for MySQL.
```sql
SELECT
W.id,
WP.age,
W.coins_needed,
W.power
FROM Wands W
INNER JOIN Wands_Property WP ON W.code = WP.code
WHERE WP.is_evil != 1
AND W.coins_needed = (
SELECT
MIN(W2.coi... | ```
select id,age,coins_needed, power from(
select id,age,coins_needed, power, rank() over(partition by age,power order by
coins_needed) rr
from wands w
left join wands_property wp
on w.code=wp.code
where is_evil=0)a
where rr=1
order by power desc,age desc
``` |
33,766,639 | Newbie here with a simple (and no doubt dumb) question.
I’m trying to center a headline. I tried using the text-align property in CSS but to no avail:
```
h1 {
text-align: center;
}
```
The headline is still flush left.
After doing a bit of digging, I tried this:
```
h1 {
margin: 0 auto;
}
```
Still ... | 2015/11/17 | [
"https://Stackoverflow.com/questions/33766639",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5573779/"
] | Just make the width `100%` instead of a fixed pixel width. This is the default value (for a block element such as `<h1>`, but you must have changed something.) This will make it dynamic.
See [this example](http://jsfiddle.net/jlam55555/jcdstceg/) on JSFiddle.net. | The first CSS you posted works fine, if it doesn't you must have some other CSS that's overriding it.
```css
h1 {
text-align: center;
}
```
```html
<h1>Centered Headline</h1>
``` |
33,766,639 | Newbie here with a simple (and no doubt dumb) question.
I’m trying to center a headline. I tried using the text-align property in CSS but to no avail:
```
h1 {
text-align: center;
}
```
The headline is still flush left.
After doing a bit of digging, I tried this:
```
h1 {
margin: 0 auto;
}
```
Still ... | 2015/11/17 | [
"https://Stackoverflow.com/questions/33766639",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5573779/"
] | Just make the width `100%` instead of a fixed pixel width. This is the default value (for a block element such as `<h1>`, but you must have changed something.) This will make it dynamic.
See [this example](http://jsfiddle.net/jlam55555/jcdstceg/) on JSFiddle.net. | By default, this will be centered:
```css
h1 {
text-align: center;
}
```
```html
<h1>Test</h1>
```
While there are a variety of ways it could be acting up, the most likely candidate is that you have set `h1 { display: inline }` (or something other than `block`) elsewhere in your code. Try giving the `h1` a ba... |
2,474,101 | I am trying to understand DbConnection and DbCommand, and the proper way to dispose those objects after use.
Following is the code snippet I have.
By using "using statement" on DbConnection and DbCommand, would it be sufficient? I am trying to prevent possible memory leak.
2nd question,
Do I have to Dispose DbComma... | 2010/03/18 | [
"https://Stackoverflow.com/questions/2474101",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/83181/"
] | using `using` is the same as a `try/finally` block with `dispose()` called in `finally`.
`DbCommand` should be wrapped in a `using` statement as it implements `IDisposable`.
Note that `DbCommand` is actually an abstract class so you will need to either
* derive from it
* code to an interface (`IDbCommand`)
* use on... | Yes I would call Dispose on the DbCommand object. In general, the rule should be that if it implements IDisposable, you should call its Dispose method when appropriate. Your code looks well formed to me. I think you are on the right track.
**EDIT** Actually, you might want to also wrap your DbDataAdapter in a using st... |
2,474,101 | I am trying to understand DbConnection and DbCommand, and the proper way to dispose those objects after use.
Following is the code snippet I have.
By using "using statement" on DbConnection and DbCommand, would it be sufficient? I am trying to prevent possible memory leak.
2nd question,
Do I have to Dispose DbComma... | 2010/03/18 | [
"https://Stackoverflow.com/questions/2474101",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/83181/"
] | using `using` is the same as a `try/finally` block with `dispose()` called in `finally`.
`DbCommand` should be wrapped in a `using` statement as it implements `IDisposable`.
Note that `DbCommand` is actually an abstract class so you will need to either
* derive from it
* code to an interface (`IDbCommand`)
* use on... | Wrapping the objects in `using` blocks as you do should be sufficient; this will make the code call `Dispose` even if there is an exception thrown.
And yes, you should do that for the `DbCommand` object, as well as the `DbDataAdapter` and the `DataTable`. They all (directly or indirectly) implement `IDisposable`. |
996,030 | Workstation: Windows 10 and Windows 7sp1
Server: 2008r2sp1 Standard Domain Controller.
I've created a GPO GPP to delete some files on the users desktop. The GPO is linked to the OU which contains all my users. Security Filtering is set to a group named "MasterCAM Users". The "MasterCAM Users" group contains my test u... | 2015/11/04 | [
"https://superuser.com/questions/996030",
"https://superuser.com",
"https://superuser.com/users/42556/"
] | The old method of using a hyperlink to a shortcut to the template does not work
anymore, so there is no other option than to use VBA.
I will try to walk you through the procedure.
The difference will be that to use the macro, one will need to double-click the
trigger-text, rather that using `Ctrl`+Click.
1. In the Vie... | If simply saving as a PDF is an option, this resolves the issue. The link is then opened as a new document based on the template. |
996,030 | Workstation: Windows 10 and Windows 7sp1
Server: 2008r2sp1 Standard Domain Controller.
I've created a GPO GPP to delete some files on the users desktop. The GPO is linked to the OU which contains all my users. Security Filtering is set to a group named "MasterCAM Users". The "MasterCAM Users" group contains my test u... | 2015/11/04 | [
"https://superuser.com/questions/996030",
"https://superuser.com",
"https://superuser.com/users/42556/"
] | The old method of using a hyperlink to a shortcut to the template does not work
anymore, so there is no other option than to use VBA.
I will try to walk you through the procedure.
The difference will be that to use the macro, one will need to double-click the
trigger-text, rather that using `Ctrl`+Click.
1. In the Vie... | Another simple solution is, to change your properties of of your template to a *read-only*, this way it the template itself will never be changed and once it is *saved as* it will be a whole new different document. |
996,030 | Workstation: Windows 10 and Windows 7sp1
Server: 2008r2sp1 Standard Domain Controller.
I've created a GPO GPP to delete some files on the users desktop. The GPO is linked to the OU which contains all my users. Security Filtering is set to a group named "MasterCAM Users". The "MasterCAM Users" group contains my test u... | 2015/11/04 | [
"https://superuser.com/questions/996030",
"https://superuser.com",
"https://superuser.com/users/42556/"
] | The old method of using a hyperlink to a shortcut to the template does not work
anymore, so there is no other option than to use VBA.
I will try to walk you through the procedure.
The difference will be that to use the macro, one will need to double-click the
trigger-text, rather that using `Ctrl`+Click.
1. In the Vie... | Another work-around is to create a hyperlink to a folder that contains the template rather than the template itself.
Click n the hyperlink to open the folder, which shows the user the only template stored in that folder.
An extra click, but seems to work fine. |
996,030 | Workstation: Windows 10 and Windows 7sp1
Server: 2008r2sp1 Standard Domain Controller.
I've created a GPO GPP to delete some files on the users desktop. The GPO is linked to the OU which contains all my users. Security Filtering is set to a group named "MasterCAM Users". The "MasterCAM Users" group contains my test u... | 2015/11/04 | [
"https://superuser.com/questions/996030",
"https://superuser.com",
"https://superuser.com/users/42556/"
] | If simply saving as a PDF is an option, this resolves the issue. The link is then opened as a new document based on the template. | Another simple solution is, to change your properties of of your template to a *read-only*, this way it the template itself will never be changed and once it is *saved as* it will be a whole new different document. |
996,030 | Workstation: Windows 10 and Windows 7sp1
Server: 2008r2sp1 Standard Domain Controller.
I've created a GPO GPP to delete some files on the users desktop. The GPO is linked to the OU which contains all my users. Security Filtering is set to a group named "MasterCAM Users". The "MasterCAM Users" group contains my test u... | 2015/11/04 | [
"https://superuser.com/questions/996030",
"https://superuser.com",
"https://superuser.com/users/42556/"
] | If simply saving as a PDF is an option, this resolves the issue. The link is then opened as a new document based on the template. | Another work-around is to create a hyperlink to a folder that contains the template rather than the template itself.
Click n the hyperlink to open the folder, which shows the user the only template stored in that folder.
An extra click, but seems to work fine. |
5,104,094 | In JSF MVC framework who is Model, View, and Controller? | 2011/02/24 | [
"https://Stackoverflow.com/questions/5104094",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/187141/"
] | This depends on the point of view (pun intented).
In the big architectural picture, your own JSF code is the **V**:
**M** - Business domain/Service layer (e.g. EJB/JPA/DAO)
**V** - Your JSF code
**C** - FacesServlet
In the developer picture, the architectural **V** is in turn dividable as below:
**M** - Entit... | **M** odel would be your `ManagedBean`
**V** iew would be `jsp`,`XHTML` (well you can accommodate various views here )
**C** ontroller will be `FacesServlet`
Update, hope this picture helps more
 |
5,104,094 | In JSF MVC framework who is Model, View, and Controller? | 2011/02/24 | [
"https://Stackoverflow.com/questions/5104094",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/187141/"
] | **M** odel would be your `ManagedBean`
**V** iew would be `jsp`,`XHTML` (well you can accommodate various views here )
**C** ontroller will be `FacesServlet`
Update, hope this picture helps more
 | The faces servlet manages the faces lifecycle so in that sense it is the controller combined with your own code that may get called during each lifecycle phase
<http://www.java-samples.com/images/jsf-lifecycle.gif> |
5,104,094 | In JSF MVC framework who is Model, View, and Controller? | 2011/02/24 | [
"https://Stackoverflow.com/questions/5104094",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/187141/"
] | **M** odel would be your `ManagedBean`
**V** iew would be `jsp`,`XHTML` (well you can accommodate various views here )
**C** ontroller will be `FacesServlet`
Update, hope this picture helps more
 | Java Server Faces is an MVC web framework where the MVC components are as follows,
1. **Model** - It is the managed bean class annotated with @ManagedBean, which has properties to hold the data and respective getters and setters. The managed bean class can also contain the business logic.These are also known as backin... |
5,104,094 | In JSF MVC framework who is Model, View, and Controller? | 2011/02/24 | [
"https://Stackoverflow.com/questions/5104094",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/187141/"
] | This depends on the point of view (pun intented).
In the big architectural picture, your own JSF code is the **V**:
**M** - Business domain/Service layer (e.g. EJB/JPA/DAO)
**V** - Your JSF code
**C** - FacesServlet
In the developer picture, the architectural **V** is in turn dividable as below:
**M** - Entit... | The faces servlet manages the faces lifecycle so in that sense it is the controller combined with your own code that may get called during each lifecycle phase
<http://www.java-samples.com/images/jsf-lifecycle.gif> |
5,104,094 | In JSF MVC framework who is Model, View, and Controller? | 2011/02/24 | [
"https://Stackoverflow.com/questions/5104094",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/187141/"
] | This depends on the point of view (pun intented).
In the big architectural picture, your own JSF code is the **V**:
**M** - Business domain/Service layer (e.g. EJB/JPA/DAO)
**V** - Your JSF code
**C** - FacesServlet
In the developer picture, the architectural **V** is in turn dividable as below:
**M** - Entit... | Java Server Faces is an MVC web framework where the MVC components are as follows,
1. **Model** - It is the managed bean class annotated with @ManagedBean, which has properties to hold the data and respective getters and setters. The managed bean class can also contain the business logic.These are also known as backin... |
5,104,094 | In JSF MVC framework who is Model, View, and Controller? | 2011/02/24 | [
"https://Stackoverflow.com/questions/5104094",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/187141/"
] | The faces servlet manages the faces lifecycle so in that sense it is the controller combined with your own code that may get called during each lifecycle phase
<http://www.java-samples.com/images/jsf-lifecycle.gif> | Java Server Faces is an MVC web framework where the MVC components are as follows,
1. **Model** - It is the managed bean class annotated with @ManagedBean, which has properties to hold the data and respective getters and setters. The managed bean class can also contain the business logic.These are also known as backin... |
603 | Recently, I got several friend requests on Facebook from people I sort of knew in middle school. We went to different high schools, and so I haven't talked to them in five years, as I've just finished my first year in college.
I prefer to keep my Facebook friends to people I would really characterize as my friends. Ma... | 2017/07/13 | [
"https://interpersonal.stackexchange.com/questions/603",
"https://interpersonal.stackexchange.com",
"https://interpersonal.stackexchange.com/users/102/"
] | First you are over thinking this. They know you are not really friends, you are not in contact with them, and probably just sent you the friend request in case you wanted to reconnect. Chances are they will never even notice you didn't accept their request. If they do it will be months from now and they will question i... | Being a Facebook "friend" is a privilege, not a right. But some people send out solicitations for friends to people they don't know all that well.
I would just ignore the first solicitation. Because of the above, there is a good chance that you will be lost in the shuffle.
If someone you don't know well persists, I w... |
603 | Recently, I got several friend requests on Facebook from people I sort of knew in middle school. We went to different high schools, and so I haven't talked to them in five years, as I've just finished my first year in college.
I prefer to keep my Facebook friends to people I would really characterize as my friends. Ma... | 2017/07/13 | [
"https://interpersonal.stackexchange.com/questions/603",
"https://interpersonal.stackexchange.com",
"https://interpersonal.stackexchange.com/users/102/"
] | First you are over thinking this. They know you are not really friends, you are not in contact with them, and probably just sent you the friend request in case you wanted to reconnect. Chances are they will never even notice you didn't accept their request. If they do it will be months from now and they will question i... | >
> As has been pointed out, folks don't get notified if their request is
> declined, and so I could simply leave things in limbo by not acting on
> the request. I'm not too enthusiastic about that suggestion; it feels
> like lying if I try to make them believe that I simply haven't seen
> the requests. I'm not ve... |
603 | Recently, I got several friend requests on Facebook from people I sort of knew in middle school. We went to different high schools, and so I haven't talked to them in five years, as I've just finished my first year in college.
I prefer to keep my Facebook friends to people I would really characterize as my friends. Ma... | 2017/07/13 | [
"https://interpersonal.stackexchange.com/questions/603",
"https://interpersonal.stackexchange.com",
"https://interpersonal.stackexchange.com/users/102/"
] | First you are over thinking this. They know you are not really friends, you are not in contact with them, and probably just sent you the friend request in case you wanted to reconnect. Chances are they will never even notice you didn't accept their request. If they do it will be months from now and they will question i... | I too am a person that never *wants* anyone to feel slighted if I can help it. So Facebook is one that took me a long time to *feel* at ease about.
So how I handle things now when I get a request is to simply accept, reject it or leave it alone if I want to think about it. I have been friend requested by literally hu... |
603 | Recently, I got several friend requests on Facebook from people I sort of knew in middle school. We went to different high schools, and so I haven't talked to them in five years, as I've just finished my first year in college.
I prefer to keep my Facebook friends to people I would really characterize as my friends. Ma... | 2017/07/13 | [
"https://interpersonal.stackexchange.com/questions/603",
"https://interpersonal.stackexchange.com",
"https://interpersonal.stackexchange.com/users/102/"
] | First you are over thinking this. They know you are not really friends, you are not in contact with them, and probably just sent you the friend request in case you wanted to reconnect. Chances are they will never even notice you didn't accept their request. If they do it will be months from now and they will question i... | Maybe it's just me but I get "itchy" seeing notifications pile up. It's like a growing "to do" list and I want to cross things off. I have added a pretty wide array of people on facebook and I honestly feel like it's an email account that's been overrun with spam and can no longer really be used in the way originally i... |
603 | Recently, I got several friend requests on Facebook from people I sort of knew in middle school. We went to different high schools, and so I haven't talked to them in five years, as I've just finished my first year in college.
I prefer to keep my Facebook friends to people I would really characterize as my friends. Ma... | 2017/07/13 | [
"https://interpersonal.stackexchange.com/questions/603",
"https://interpersonal.stackexchange.com",
"https://interpersonal.stackexchange.com/users/102/"
] | Being a Facebook "friend" is a privilege, not a right. But some people send out solicitations for friends to people they don't know all that well.
I would just ignore the first solicitation. Because of the above, there is a good chance that you will be lost in the shuffle.
If someone you don't know well persists, I w... | I too am a person that never *wants* anyone to feel slighted if I can help it. So Facebook is one that took me a long time to *feel* at ease about.
So how I handle things now when I get a request is to simply accept, reject it or leave it alone if I want to think about it. I have been friend requested by literally hu... |
603 | Recently, I got several friend requests on Facebook from people I sort of knew in middle school. We went to different high schools, and so I haven't talked to them in five years, as I've just finished my first year in college.
I prefer to keep my Facebook friends to people I would really characterize as my friends. Ma... | 2017/07/13 | [
"https://interpersonal.stackexchange.com/questions/603",
"https://interpersonal.stackexchange.com",
"https://interpersonal.stackexchange.com/users/102/"
] | Being a Facebook "friend" is a privilege, not a right. But some people send out solicitations for friends to people they don't know all that well.
I would just ignore the first solicitation. Because of the above, there is a good chance that you will be lost in the shuffle.
If someone you don't know well persists, I w... | Maybe it's just me but I get "itchy" seeing notifications pile up. It's like a growing "to do" list and I want to cross things off. I have added a pretty wide array of people on facebook and I honestly feel like it's an email account that's been overrun with spam and can no longer really be used in the way originally i... |
603 | Recently, I got several friend requests on Facebook from people I sort of knew in middle school. We went to different high schools, and so I haven't talked to them in five years, as I've just finished my first year in college.
I prefer to keep my Facebook friends to people I would really characterize as my friends. Ma... | 2017/07/13 | [
"https://interpersonal.stackexchange.com/questions/603",
"https://interpersonal.stackexchange.com",
"https://interpersonal.stackexchange.com/users/102/"
] | >
> As has been pointed out, folks don't get notified if their request is
> declined, and so I could simply leave things in limbo by not acting on
> the request. I'm not too enthusiastic about that suggestion; it feels
> like lying if I try to make them believe that I simply haven't seen
> the requests. I'm not ve... | I too am a person that never *wants* anyone to feel slighted if I can help it. So Facebook is one that took me a long time to *feel* at ease about.
So how I handle things now when I get a request is to simply accept, reject it or leave it alone if I want to think about it. I have been friend requested by literally hu... |
603 | Recently, I got several friend requests on Facebook from people I sort of knew in middle school. We went to different high schools, and so I haven't talked to them in five years, as I've just finished my first year in college.
I prefer to keep my Facebook friends to people I would really characterize as my friends. Ma... | 2017/07/13 | [
"https://interpersonal.stackexchange.com/questions/603",
"https://interpersonal.stackexchange.com",
"https://interpersonal.stackexchange.com/users/102/"
] | >
> As has been pointed out, folks don't get notified if their request is
> declined, and so I could simply leave things in limbo by not acting on
> the request. I'm not too enthusiastic about that suggestion; it feels
> like lying if I try to make them believe that I simply haven't seen
> the requests. I'm not ve... | Maybe it's just me but I get "itchy" seeing notifications pile up. It's like a growing "to do" list and I want to cross things off. I have added a pretty wide array of people on facebook and I honestly feel like it's an email account that's been overrun with spam and can no longer really be used in the way originally i... |
4,157,683 | I have got the following task:
(1) For each $n \in \mathbb{N}$, specify matrices $A, B \in \mathbb{R}^{n \times n}$ for which $A B \neq B A$ is true.
(2) Determine
$$
M:=\left\{A \in \mathbb{R}^{2 \times 2}: A B=B A \quad \forall B \in \mathbb{R}^{2 \times 2}\right\}
$$
thus the matrices $A \in \mathbb{R}^{2 \times 2... | 2021/06/01 | [
"https://math.stackexchange.com/questions/4157683",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/717569/"
] | Geometrically it's obvious, as $D\_6$ is the group of symmetries of a hexagon, and the $\sigma^k\rho$ terms are the six reflection symmetries. They clearly all have order 2.
Algebraically, in order to solve this, you have to know that in any dihedral group we have $\sigma\rho=\rho\sigma^{-1}$ (which in $D\_6$ also hap... | Label the vertices of the hexagon $0,\dots,5$. A rotation maps vertex $k$ to $k+1\pmod 6$, and a reflection maps vertex $k$ to $6-k\pmod 6$.
Then $\sigma^k\rho$ maps vertex $j$ to $j+k \pmod 6$ and then to $6-(j+k)=6-j-k \pmod 6$. Repeating the operations maps $6-j-k \pmod 6$ to $6-j-k+k=6-j \pmod 6$, and then back to... |
3,323,040 | Define the Baire algebra $Ba(X)$ of a Boolean space $X$ as the $\sigma$-algebra generated by the class of clopen subsets of $X$.
Clearly, every clopen set is a Baire set. An example of open Baire set is the countable union of a family of clopen subsets of $X$, and, as it happens, these are the only one open Baire sets... | 2019/08/14 | [
"https://math.stackexchange.com/questions/3323040",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/101239/"
] | Suppose $X$ is a Boolean space (also known as a Stone space). Let $C\subseteq X$ be a clopen set, let $U\subseteq C$ be a Baire set which is open but not closed, and let $V\subseteq (X\setminus C)$ be a Baire set which is closed but not open. Then $W = U\cup V$ is a Baire set which is neither open nor closed.
Indeed,... | Of course there are other Baire sets: the standard Cantor set $X$ has a base of clopen sets and is second countable, so every open set is Baire too and so $\text{Ba}(X)=\text{Bor}(X)$, the Borel sets of $X$. And the rationals in $X$ are countable (so Borel hence Baire) and dense (so not closed) and not open, e.g. |
58,013,976 | My instructions state:
>
> Main gets the file name from the command line (i.e., `args[0]`).
>
>
>
I am just pretty clueless on how to approach this. I have put the text file in the same folder as my code and then my first attempt was just to the set my `String fileName = args[0]`. That did not work and do not kn... | 2019/09/19 | [
"https://Stackoverflow.com/questions/58013976",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11923494/"
] | **Using Swift 5**
First you would need to declare a MKPolyline with your array of CLLocationCoordinate2D:
```
let polyline = MKPolyline(coordinates: coordinates, count: coordinates.count)
mapView.addOverlay(polyline)
```
Then on your MKMapViewDelegate you would need to add color to your polyline like in this exampl... | First, confirm whether your `locations` was empty array or not.
Second, the [`viewForOverlay`](https://developer.apple.com/documentation/mapkit/mkmapviewdelegate/1616210-mapview) is an old method that isn’t used any more (and even then, the method signature is incorrect).
Instead, put your code that creates the rend... |
678,833 | How can you calculate with them and what can you actually make up from the calculations? And what is exactly meant by normed division-algebras? | 2014/02/16 | [
"https://math.stackexchange.com/questions/678833",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/129287/"
] | The flaw in your proof (unless I misunderstood what you're doing) is that you're taking the statement "$f$ is a mapping from $[0,1]$ to $[0,1]$" as "$f$ maps $[0,1]$ to $[0,1]$" (i.e. $f([0,1])=[0,1]$). This is not the case—$f$ need not be surjective.
A proof of the result you seek:
* $f\colon[0,1]\to[0,1]$ is contin... | Your proof is wrong. Why should $g(x)$ not be an element of $[0,1]$? For example, why couldn't you have $f(x) \in [2/3, 1]$ and $g(x) \in [0,1/3]$ for all $x$? |
678,833 | How can you calculate with them and what can you actually make up from the calculations? And what is exactly meant by normed division-algebras? | 2014/02/16 | [
"https://math.stackexchange.com/questions/678833",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/129287/"
] | We first suppose $f$ is increasing on $[0, 1]$.Let $h(x) = g(x) - x$, then $h$ is continous on $[0, 1]$, and $h(0) = g(0) > 0$ and $h(1) = g(1) - 1 < 0$. So the intermediate value theorem implies there is an $r$ in $[0, 1]$ with $h(r) = 0$ or $g(r) = r$.
Now if $f(r) = r$, then we're done. If $f(r) \ne r$, define a se... | Your proof is wrong. Why should $g(x)$ not be an element of $[0,1]$? For example, why couldn't you have $f(x) \in [2/3, 1]$ and $g(x) \in [0,1/3]$ for all $x$? |
678,833 | How can you calculate with them and what can you actually make up from the calculations? And what is exactly meant by normed division-algebras? | 2014/02/16 | [
"https://math.stackexchange.com/questions/678833",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/129287/"
] | Without loss of generality some $\epsilon >0$ exists such that $f(x)\geq g(x)+\epsilon$ for all $x\in [0,1]$.
Take $n\in \mathbb Z^+$.
We now prove $f^n\geq g^n + n\epsilon$ for all $n\in \mathbb Z^+$.
We proceed by induction, $n=1$ is clear.
Inductive step: $f^{n+1}(x)\geq g(f^n(x))+\epsilon = f^n(g(x))+\epsilon \... | Your proof is wrong. Why should $g(x)$ not be an element of $[0,1]$? For example, why couldn't you have $f(x) \in [2/3, 1]$ and $g(x) \in [0,1/3]$ for all $x$? |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.