qid
int64
1
74.7M
question
stringlengths
0
58.3k
date
stringlengths
10
10
metadata
list
response_j
stringlengths
2
48.3k
response_k
stringlengths
2
40.5k
3,816,718
I have an enum that I'd like to display all possible values of. Is there a way to get an array or list of all the possible values of the enum instead of manually creating such a list? e.g. If I have an enum: ``` public enum Enumnum { TypeA, TypeB, TypeC, TypeD } ``` how would I be able to get a `List<Enumnum>` that ...
2010/09/28
[ "https://Stackoverflow.com/questions/3816718", "https://Stackoverflow.com", "https://Stackoverflow.com/users/388739/" ]
If you prefer a more generic way, here it is. You can add up more converters as per your need. ``` public static class EnumConverter { public static string[] ToNameArray<T>() { return Enum.GetNames(typeof(T)).ToArray(); } public static Array ToValueArray<T>() ...
The OP asked for How to get an array of all `enum` values in C# ? **What if you want to get an array of selected `enum` values in C# ?** **Your Enum** ``` enum WeekDays { Sunday, Monday, Tuesday } ``` If you want to just select `Sunday` from your `Enum`. ``` WeekDays[] week...
3,816,718
I have an enum that I'd like to display all possible values of. Is there a way to get an array or list of all the possible values of the enum instead of manually creating such a list? e.g. If I have an enum: ``` public enum Enumnum { TypeA, TypeB, TypeC, TypeD } ``` how would I be able to get a `List<Enumnum>` that ...
2010/09/28
[ "https://Stackoverflow.com/questions/3816718", "https://Stackoverflow.com", "https://Stackoverflow.com/users/388739/" ]
This gets you a plain array of the enum values using [`Enum.GetValues`](http://msdn.microsoft.com/en-us/library/system.enum.getvalues.aspx): ``` var valuesAsArray = Enum.GetValues(typeof(Enumnum)); ``` And this gets you a generic list: ``` var valuesAsList = Enum.GetValues(typeof(Enumnum)).Cast<Enumnum>().ToList();...
Try this code: ``` Enum.GetNames(typeof(Enumnum)); ``` This return a `string[]` with all the enum names of the chosen enum.
19,041,174
``` a = 0 b = 1 print a print b for i in range (102): c = a + b a = b b = c print c print "The 103rd number is", c ``` I don't understand how the for statement works. I understand everything except how the program continues till the 103rd element and understands that it has to add the last two number...
2013/09/27
[ "https://Stackoverflow.com/questions/19041174", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2821664/" ]
F0=0, F1=1, F2=1, F3=2, F4=3 ... ``` for i in range (102): c = a + b a = b b = c print c ``` Notice that in your first loop , c=a+b=0+1=F0+F1=F2, so the result you print is F2 not F1, thus F103 is printed in the 102nd loop.
Examine: ``` for f in [1, 2, "foo"]: print f ``` Then recall that `range(102)` creates a list `[1, 2, 3,` ... `101, 102]`.
19,041,174
``` a = 0 b = 1 print a print b for i in range (102): c = a + b a = b b = c print c print "The 103rd number is", c ``` I don't understand how the for statement works. I understand everything except how the program continues till the 103rd element and understands that it has to add the last two number...
2013/09/27
[ "https://Stackoverflow.com/questions/19041174", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2821664/" ]
Let's expand the for loop and see what happens: ``` a = 0 b = 1 # this is the first fibonacci number # First iteration of for loop c = a + b # c is now 1, the second fibonacci number a = b # a is now 1 b = c # b is now 1 # Second iteration c = a + b # c is now 2, the third fibonacci number a = b ...
F0=0, F1=1, F2=1, F3=2, F4=3 ... ``` for i in range (102): c = a + b a = b b = c print c ``` Notice that in your first loop , c=a+b=0+1=F0+F1=F2, so the result you print is F2 not F1, thus F103 is printed in the 102nd loop.
19,041,174
``` a = 0 b = 1 print a print b for i in range (102): c = a + b a = b b = c print c print "The 103rd number is", c ``` I don't understand how the for statement works. I understand everything except how the program continues till the 103rd element and understands that it has to add the last two number...
2013/09/27
[ "https://Stackoverflow.com/questions/19041174", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2821664/" ]
There are infinite uses of the `for` statement, for in your case, it just does whatever in it for 102 times. So, **in your specific case**, the `for` statement does... ``` c = a + b a = b b = c print c c = a + b a = b b = c print c c = a + b a = b b = c print c # ... (99 more times) ``` and when it is done, the p...
This line will repeat anything below it that is indented 102 times. ``` for i in range(102): ```
19,041,174
``` a = 0 b = 1 print a print b for i in range (102): c = a + b a = b b = c print c print "The 103rd number is", c ``` I don't understand how the for statement works. I understand everything except how the program continues till the 103rd element and understands that it has to add the last two number...
2013/09/27
[ "https://Stackoverflow.com/questions/19041174", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2821664/" ]
Let's expand the for loop and see what happens: ``` a = 0 b = 1 # this is the first fibonacci number # First iteration of for loop c = a + b # c is now 1, the second fibonacci number a = b # a is now 1 b = c # b is now 1 # Second iteration c = a + b # c is now 2, the third fibonacci number a = b ...
There are infinite uses of the `for` statement, for in your case, it just does whatever in it for 102 times. So, **in your specific case**, the `for` statement does... ``` c = a + b a = b b = c print c c = a + b a = b b = c print c c = a + b a = b b = c print c # ... (99 more times) ``` and when it is done, the p...
19,041,174
``` a = 0 b = 1 print a print b for i in range (102): c = a + b a = b b = c print c print "The 103rd number is", c ``` I don't understand how the for statement works. I understand everything except how the program continues till the 103rd element and understands that it has to add the last two number...
2013/09/27
[ "https://Stackoverflow.com/questions/19041174", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2821664/" ]
Let's expand the for loop and see what happens: ``` a = 0 b = 1 # this is the first fibonacci number # First iteration of for loop c = a + b # c is now 1, the second fibonacci number a = b # a is now 1 b = c # b is now 1 # Second iteration c = a + b # c is now 2, the third fibonacci number a = b ...
`range` is a function that returns a list of integers. If you specify a single argument `n`, you get all integers from 0 through `n-1`. A statement of the form `for x in y: <do something>`, where `y` is iterable, iterates over every element in `y`. For each such element `z`, it binds the variable `x` to `z` and then e...
19,041,174
``` a = 0 b = 1 print a print b for i in range (102): c = a + b a = b b = c print c print "The 103rd number is", c ``` I don't understand how the for statement works. I understand everything except how the program continues till the 103rd element and understands that it has to add the last two number...
2013/09/27
[ "https://Stackoverflow.com/questions/19041174", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2821664/" ]
`range` is a function that returns a list of integers. If you specify a single argument `n`, you get all integers from 0 through `n-1`. A statement of the form `for x in y: <do something>`, where `y` is iterable, iterates over every element in `y`. For each such element `z`, it binds the variable `x` to `z` and then e...
Fibonacci's formula is : ``` f(n) = f(n-1) + f(n-2); (n > 1, n is integer) f(0) = 0 f(1) = 1 ``` And range(102) = [0, 1, 2, ..., 101] so `for i in range (102):` means for loop runs 102 times ``` c = a + b a = b b = c ``` means b stand for f(n-1), and a stand for f(n-2), so c stand for f(n). the for loop runs 10...
19,041,174
``` a = 0 b = 1 print a print b for i in range (102): c = a + b a = b b = c print c print "The 103rd number is", c ``` I don't understand how the for statement works. I understand everything except how the program continues till the 103rd element and understands that it has to add the last two number...
2013/09/27
[ "https://Stackoverflow.com/questions/19041174", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2821664/" ]
F0=0, F1=1, F2=1, F3=2, F4=3 ... ``` for i in range (102): c = a + b a = b b = c print c ``` Notice that in your first loop , c=a+b=0+1=F0+F1=F2, so the result you print is F2 not F1, thus F103 is printed in the 102nd loop.
This line will repeat anything below it that is indented 102 times. ``` for i in range(102): ```
19,041,174
``` a = 0 b = 1 print a print b for i in range (102): c = a + b a = b b = c print c print "The 103rd number is", c ``` I don't understand how the for statement works. I understand everything except how the program continues till the 103rd element and understands that it has to add the last two number...
2013/09/27
[ "https://Stackoverflow.com/questions/19041174", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2821664/" ]
Let's expand the for loop and see what happens: ``` a = 0 b = 1 # this is the first fibonacci number # First iteration of for loop c = a + b # c is now 1, the second fibonacci number a = b # a is now 1 b = c # b is now 1 # Second iteration c = a + b # c is now 2, the third fibonacci number a = b ...
Examine: ``` for f in [1, 2, "foo"]: print f ``` Then recall that `range(102)` creates a list `[1, 2, 3,` ... `101, 102]`.
19,041,174
``` a = 0 b = 1 print a print b for i in range (102): c = a + b a = b b = c print c print "The 103rd number is", c ``` I don't understand how the for statement works. I understand everything except how the program continues till the 103rd element and understands that it has to add the last two number...
2013/09/27
[ "https://Stackoverflow.com/questions/19041174", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2821664/" ]
Examine: ``` for f in [1, 2, "foo"]: print f ``` Then recall that `range(102)` creates a list `[1, 2, 3,` ... `101, 102]`.
This line will repeat anything below it that is indented 102 times. ``` for i in range(102): ```
19,041,174
``` a = 0 b = 1 print a print b for i in range (102): c = a + b a = b b = c print c print "The 103rd number is", c ``` I don't understand how the for statement works. I understand everything except how the program continues till the 103rd element and understands that it has to add the last two number...
2013/09/27
[ "https://Stackoverflow.com/questions/19041174", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2821664/" ]
There are infinite uses of the `for` statement, for in your case, it just does whatever in it for 102 times. So, **in your specific case**, the `for` statement does... ``` c = a + b a = b b = c print c c = a + b a = b b = c print c c = a + b a = b b = c print c # ... (99 more times) ``` and when it is done, the p...
Fibonacci's formula is : ``` f(n) = f(n-1) + f(n-2); (n > 1, n is integer) f(0) = 0 f(1) = 1 ``` And range(102) = [0, 1, 2, ..., 101] so `for i in range (102):` means for loop runs 102 times ``` c = a + b a = b b = c ``` means b stand for f(n-1), and a stand for f(n-2), so c stand for f(n). the for loop runs 10...
38,788,888
I have a problem with my Python code. I am trying to display the ordinal number of the users input. So if I typed 32 it would display 32nd, or if I typed 576 it would display 576th. The only thing that doesn't work is 93, it displays 93th. Every other number works and I am not sure why. Here is my code: ``` num = inpu...
2016/08/05
[ "https://Stackoverflow.com/questions/38788888", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6232881/" ]
You use `endswith()` at 2 places, instead of 3: ``` if num.endswith('1'): end = 'st' elif num.endswith('2'): end = 'nd' #elif num == '3': WRONG elif num.endswith('3'): end = 'rd' ``` In your code, it will test 'if num is equal to 3' instead of 'if num ends with 3'.
For some reason you forgot to check `endswith()` when it comes to `3`: ``` elif num.endswith('3'): end = 'rd' ``` On a side note, you can improve your code by reading [this question](https://codereview.stackexchange.com/questions/41298/producing-ordinal-numbers) on SE Code Review, which included this awesome ver...
12,532
I am about to train a big LSTM network with 2-3 million articles and am struggling with Memory Errors (I use AWS EC2 g2x2large). I found out that one solution is to reduce the `batch_size`. However, I am not sure if this parameter is only related to memory efficiency issues or if it will effect my results. As a matter...
2016/07/01
[ "https://datascience.stackexchange.com/questions/12532", "https://datascience.stackexchange.com", "https://datascience.stackexchange.com/users/17484/" ]
After one and a half years, I come back to my answer because my previous answer was wrong. Batch size impacts learning significantly. What happens when you put a batch through your network is that you average the gradients. The concept is that if your batch size is big enough, this will provide a stable enough estima...
Oddly enough, I found that larger batch sizes with keras require more epochs to converge. For example, the output of [this script](https://github.com/shadiakiki1986/test-ml/blob/master/t4-LSTM%20stateful/test_temporal_regression.py) based on keras' [integration test](https://github.com/fchollet/keras/blob/master/tests...
12,532
I am about to train a big LSTM network with 2-3 million articles and am struggling with Memory Errors (I use AWS EC2 g2x2large). I found out that one solution is to reduce the `batch_size`. However, I am not sure if this parameter is only related to memory efficiency issues or if it will effect my results. As a matter...
2016/07/01
[ "https://datascience.stackexchange.com/questions/12532", "https://datascience.stackexchange.com", "https://datascience.stackexchange.com/users/17484/" ]
After one and a half years, I come back to my answer because my previous answer was wrong. Batch size impacts learning significantly. What happens when you put a batch through your network is that you average the gradients. The concept is that if your batch size is big enough, this will provide a stable enough estima...
I feel the accepted answer is possibly wrong. There are variants in *Gradient Descent Algorithms*. 1. **Vanilla Gradient Descent**: Here the Gradient is being calculated on all the data points at a single shot and the average is taken. Hence we have a smoother version of the gradient takes longer time to learn. 2. **S...
12,532
I am about to train a big LSTM network with 2-3 million articles and am struggling with Memory Errors (I use AWS EC2 g2x2large). I found out that one solution is to reduce the `batch_size`. However, I am not sure if this parameter is only related to memory efficiency issues or if it will effect my results. As a matter...
2016/07/01
[ "https://datascience.stackexchange.com/questions/12532", "https://datascience.stackexchange.com", "https://datascience.stackexchange.com/users/17484/" ]
After one and a half years, I come back to my answer because my previous answer was wrong. Batch size impacts learning significantly. What happens when you put a batch through your network is that you average the gradients. The concept is that if your batch size is big enough, this will provide a stable enough estima...
A couple of papers have been published showing – and conventional wisdom in 2020 seems to still be persuaded— that, as [Yann LeCun](https://twitter.com/ylecun/status/989610208497360896) put, large batches are bad for your health. Two relevant papers are * [Revisiting Small Batch Training For Deep Neural Networks, Dom...
12,532
I am about to train a big LSTM network with 2-3 million articles and am struggling with Memory Errors (I use AWS EC2 g2x2large). I found out that one solution is to reduce the `batch_size`. However, I am not sure if this parameter is only related to memory efficiency issues or if it will effect my results. As a matter...
2016/07/01
[ "https://datascience.stackexchange.com/questions/12532", "https://datascience.stackexchange.com", "https://datascience.stackexchange.com/users/17484/" ]
I feel the accepted answer is possibly wrong. There are variants in *Gradient Descent Algorithms*. 1. **Vanilla Gradient Descent**: Here the Gradient is being calculated on all the data points at a single shot and the average is taken. Hence we have a smoother version of the gradient takes longer time to learn. 2. **S...
Oddly enough, I found that larger batch sizes with keras require more epochs to converge. For example, the output of [this script](https://github.com/shadiakiki1986/test-ml/blob/master/t4-LSTM%20stateful/test_temporal_regression.py) based on keras' [integration test](https://github.com/fchollet/keras/blob/master/tests...
12,532
I am about to train a big LSTM network with 2-3 million articles and am struggling with Memory Errors (I use AWS EC2 g2x2large). I found out that one solution is to reduce the `batch_size`. However, I am not sure if this parameter is only related to memory efficiency issues or if it will effect my results. As a matter...
2016/07/01
[ "https://datascience.stackexchange.com/questions/12532", "https://datascience.stackexchange.com", "https://datascience.stackexchange.com/users/17484/" ]
Oddly enough, I found that larger batch sizes with keras require more epochs to converge. For example, the output of [this script](https://github.com/shadiakiki1986/test-ml/blob/master/t4-LSTM%20stateful/test_temporal_regression.py) based on keras' [integration test](https://github.com/fchollet/keras/blob/master/tests...
A couple of papers have been published showing – and conventional wisdom in 2020 seems to still be persuaded— that, as [Yann LeCun](https://twitter.com/ylecun/status/989610208497360896) put, large batches are bad for your health. Two relevant papers are * [Revisiting Small Batch Training For Deep Neural Networks, Dom...
12,532
I am about to train a big LSTM network with 2-3 million articles and am struggling with Memory Errors (I use AWS EC2 g2x2large). I found out that one solution is to reduce the `batch_size`. However, I am not sure if this parameter is only related to memory efficiency issues or if it will effect my results. As a matter...
2016/07/01
[ "https://datascience.stackexchange.com/questions/12532", "https://datascience.stackexchange.com", "https://datascience.stackexchange.com/users/17484/" ]
I feel the accepted answer is possibly wrong. There are variants in *Gradient Descent Algorithms*. 1. **Vanilla Gradient Descent**: Here the Gradient is being calculated on all the data points at a single shot and the average is taken. Hence we have a smoother version of the gradient takes longer time to learn. 2. **S...
A couple of papers have been published showing – and conventional wisdom in 2020 seems to still be persuaded— that, as [Yann LeCun](https://twitter.com/ylecun/status/989610208497360896) put, large batches are bad for your health. Two relevant papers are * [Revisiting Small Batch Training For Deep Neural Networks, Dom...
325,305
Debian Lenny. For every user, including root: ``` # cat /proc/sys/fs/file-max 262144 # sysctl fs.file-max fs.file-max = 262144 # ulimit -Hn 1024 # ulimit -Sn 1024 ``` File `/etc/security/limits.conf` has no uncommented lines. Where does it get that 1024?
2011/08/19
[ "https://superuser.com/questions/325305", "https://superuser.com", "https://superuser.com/users/88337/" ]
The [`fs.file-max` sysctl](http://git.kernel.org/?p=linux/kernel/git/torvalds/linux.git;a=blob;f=Documentation/sysctl/fs.txt;h=88fd7f5c8dcd61307171b3af852541d06a984380;hb=HEAD#87) shows how many file handles can be allocated *system-wide*, while `ulimit` resource limits are per-process (or per-UID). The former is descr...
For the question @grawity brought up, this kernel commit can explain: ``` commit 0ac1ee0bfec2a4ad118f907ce586d0dfd8db7641 Author: Tim Gardner Date: Tue May 24 17:13:05 2011 -0700 ulimit: raise default hard ulimit on number of files to 4096 ``` At lease in RHEL5.4 it's 1024/1024, and in RHEL6.2 it's 1024/409...
9,133
I get regularly the feedback in comments to use Latex or MathJax. Also I would write beautiful formulas what I can do only on pen & paper. Where can I get info about these?
2016/09/10
[ "https://physics.meta.stackexchange.com/questions/9133", "https://physics.meta.stackexchange.com", "https://physics.meta.stackexchange.com/users/32426/" ]
(La)tex is a extensible textual document format for mathematical symbols. Although it is huge, you need only to know a very small subset of it to be able to write real formulas in your posts. MathJax is a Javascript library what makes the Latex formatting usable in a HTML/Javascript/Css environment. The StackExchange ...
While this seems like a well-intentioned thread, there is already a comprehensive tutorial over on the [Mathematics Meta Stack Exchange](https://math.meta.stackexchange.com/) site, at > > [MathJax basic tutorial and quick reference](https://math.meta.stackexchange.com/questions/5020/mathjax-basic-tutorial-and-quick-r...
314,892
I've been using MongoDB on CentOS with ext4 for a few months now with no problems. I'm potentially going to be moving to Joyentcloud, and their SmartOS is based off of OpenSolaris and uses ZFS. I'm wondering if there could be some downsides to switching to this for MongoDB?
2011/09/23
[ "https://serverfault.com/questions/314892", "https://serverfault.com", "https://serverfault.com/users/8964/" ]
If you want all mails redirected to Gmail, then you can accept it there instead. Without redirecting. All mails are handled at Google directly. This is called [Google Apps](http://www.google.com/apps/intl/en/business/index.html) and is free for no charge for a limited amount of users. And as I understood you only have ...
MailEnable is a lightwieght and free Windows mail server, dead easy too Google for it, you can set it up as easy or as complex as you like Good luck
45,825,541
I seem to be doing something improper here and I am dumbfounded on what it is. I am trying to launch The Foundry NUKE from within Maya, and when I try I get this error relating to a module not found. But if I load up Nuke on a regular command line it loads up perfect fine. Seems something related to Maya's Python inter...
2017/08/22
[ "https://Stackoverflow.com/questions/45825541", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5416347/" ]
I think you can use built in subprocess to call nuke like this ``` import subprocess nukeProcess = subprocess.Popen(["C:/Program Files/Nuke9.0v8/Nuke9.0.exe", "-x", "B:/home/nukePBTemplate.nk"]) ``` And I think you never use a mel.eval("system /whatever") since you trying from python, already python has many built ...
You should run `system` MEL command inside your Python script. To do that you need to use `mel.eval` method with string argument (string inside string). The purpose of the `eval` command is to provide a way for the user to execute a MEL command or procedure which can only be determined at runtime. ``` import maya.mel ...
130,682
As far as I can see a cape and a hood are mostly identical type of clothing. Does that mean that they are synonyms? What's the difference between them? I was watching the cartoon and the movie and she isn't wearing a hood, she wears a cape and a hat there. Why is her name Red Riding Hood, what does riding mean? And wh...
2017/05/27
[ "https://ell.stackexchange.com/questions/130682", "https://ell.stackexchange.com", "https://ell.stackexchange.com/users/44134/" ]
Capes and hoods are not identical. They can be worn together, but they are separate pieces of clothing. Capes are sleeveless cloaks, often associated with superhero attire. Long, flowing pieces of material affixed to the neck/shoulder area in some fashion. [![superhero cape](https://i.stack.imgur.com/MUFOom.jpg)](http...
A riding hood is [*an enveloping hood or hooded cloak worn for riding and as an outdoor wrap by women and children.* - M-W](https://www.merriam-webster.com/dictionary/riding%20hood) This kind of garb was probably more common when people routinely got around on horseback (like in the days when popular old children's sto...
2,085,878
Need to calculate the following limit without using L'Hopital's Rule: $$ \lim\_{x \to 0} \frac{5x - e^{2x}+1}{3x +3e^{4x}-3} $$ The problem I'm facing is that no matter what I do I still get expression of the form $$ \frac{0}{0} $$ I thought maybe to use $$ t = e^{2x} $$ But I still can't simplify it enough.. Thank...
2017/01/06
[ "https://math.stackexchange.com/questions/2085878", "https://math.stackexchange.com", "https://math.stackexchange.com/users/306907/" ]
HINT: As $x\to0,x\ne0$ so safely divide numerator & denominator by $x$ and use $$\lim\_{h\to0}\dfrac{e^h-1}h=1$$ Observe that the exponent of $e,$ the limit variable and the denominator are **same**.
**Hint**: We can divide by $x $ to get $$\lim\_{x \to 0} \frac {5-(\frac {e^{2x}-1}{2x}(2))}{3+3 (\frac {e^{4x}-1}{4x}(4))} $$ Can you take it from here?
2,085,878
Need to calculate the following limit without using L'Hopital's Rule: $$ \lim\_{x \to 0} \frac{5x - e^{2x}+1}{3x +3e^{4x}-3} $$ The problem I'm facing is that no matter what I do I still get expression of the form $$ \frac{0}{0} $$ I thought maybe to use $$ t = e^{2x} $$ But I still can't simplify it enough.. Thank...
2017/01/06
[ "https://math.stackexchange.com/questions/2085878", "https://math.stackexchange.com", "https://math.stackexchange.com/users/306907/" ]
Using Taylor's series: $$\frac{5x - e^{2x}+1}{3x +3e^{4x}-3} = \frac{5x - (1+2x + O(x^2))+1}{3x +3(1+4x+O(x^2))-3} = \frac{3x - O(x^2)}{15x+ O(x^2)} .$$ Thus, $$\lim\_{x \rightarrow 0} \frac{3x - O(x^2)}{15x+ O(x^2)} = \frac{1}{5}.$$
**Hint**: We can divide by $x $ to get $$\lim\_{x \to 0} \frac {5-(\frac {e^{2x}-1}{2x}(2))}{3+3 (\frac {e^{4x}-1}{4x}(4))} $$ Can you take it from here?
2,085,878
Need to calculate the following limit without using L'Hopital's Rule: $$ \lim\_{x \to 0} \frac{5x - e^{2x}+1}{3x +3e^{4x}-3} $$ The problem I'm facing is that no matter what I do I still get expression of the form $$ \frac{0}{0} $$ I thought maybe to use $$ t = e^{2x} $$ But I still can't simplify it enough.. Thank...
2017/01/06
[ "https://math.stackexchange.com/questions/2085878", "https://math.stackexchange.com", "https://math.stackexchange.com/users/306907/" ]
$$ \lim\_{x \to 0} \frac{5x - e^{2x}+1}{3x +3e^{4x}-3}=\\ \lim\_{x \to 0} \frac{5x - (1+2x+\frac{(2x)^2}{2!}+o(x^3))+1}{3x +3(1+4x+\frac{(4x)^2}{2!}+o(x^3))-3} =\\ \lim\_{x \to 0} \frac{3x-\frac{(2x)^2}{2!}-o(x^3)}{15x +3\frac{(4x)^2}{2!}+o(x^3)} = \lim\_{x \to 0} \frac{3x}{15x } =\frac{3}{15}$$
$$ \frac{5x - e^{2x}+1}{3x +3e^{4x}-3}=\frac12\frac{\dfrac52-\dfrac{e^{2x}-1}{2x}}{\dfrac34+3\dfrac{e^{4x}-1}{4x}}\to\frac12\frac{\dfrac52-L}{\dfrac34+3L}.$$ (by a scaling of $x$, the two ratios tend to $L$). Then you can take for granted that $L=1$, giving the answer $\dfrac15$.
2,085,878
Need to calculate the following limit without using L'Hopital's Rule: $$ \lim\_{x \to 0} \frac{5x - e^{2x}+1}{3x +3e^{4x}-3} $$ The problem I'm facing is that no matter what I do I still get expression of the form $$ \frac{0}{0} $$ I thought maybe to use $$ t = e^{2x} $$ But I still can't simplify it enough.. Thank...
2017/01/06
[ "https://math.stackexchange.com/questions/2085878", "https://math.stackexchange.com", "https://math.stackexchange.com/users/306907/" ]
HINT: As $x\to0,x\ne0$ so safely divide numerator & denominator by $x$ and use $$\lim\_{h\to0}\dfrac{e^h-1}h=1$$ Observe that the exponent of $e,$ the limit variable and the denominator are **same**.
Do you know the Taylor formula? If so, then $$ e^x = 1 + x + o(x) $$ as $x \to 0$. Here, $o(x)$ is a function such that $o(x)/x \to 0$ as $x \to 0$. Hence $$ \frac{5x - e^{2x}+1}{3x +3e^{4x}-3} = \frac{5x - (1 + 2x + o(x)) + 1}{3x + 3(1 + 4x + o(x))-3} = \frac{3x+ o(x)}{15x+o(x)} = \frac{3+o(x)/x}{15+o(x)/x} $$ which s...
2,085,878
Need to calculate the following limit without using L'Hopital's Rule: $$ \lim\_{x \to 0} \frac{5x - e^{2x}+1}{3x +3e^{4x}-3} $$ The problem I'm facing is that no matter what I do I still get expression of the form $$ \frac{0}{0} $$ I thought maybe to use $$ t = e^{2x} $$ But I still can't simplify it enough.. Thank...
2017/01/06
[ "https://math.stackexchange.com/questions/2085878", "https://math.stackexchange.com", "https://math.stackexchange.com/users/306907/" ]
Using Taylor's series: $$\frac{5x - e^{2x}+1}{3x +3e^{4x}-3} = \frac{5x - (1+2x + O(x^2))+1}{3x +3(1+4x+O(x^2))-3} = \frac{3x - O(x^2)}{15x+ O(x^2)} .$$ Thus, $$\lim\_{x \rightarrow 0} \frac{3x - O(x^2)}{15x+ O(x^2)} = \frac{1}{5}.$$
$$ \frac{5x - e^{2x}+1}{3x +3e^{4x}-3}=\frac12\frac{\dfrac52-\dfrac{e^{2x}-1}{2x}}{\dfrac34+3\dfrac{e^{4x}-1}{4x}}\to\frac12\frac{\dfrac52-L}{\dfrac34+3L}.$$ (by a scaling of $x$, the two ratios tend to $L$). Then you can take for granted that $L=1$, giving the answer $\dfrac15$.
2,085,878
Need to calculate the following limit without using L'Hopital's Rule: $$ \lim\_{x \to 0} \frac{5x - e^{2x}+1}{3x +3e^{4x}-3} $$ The problem I'm facing is that no matter what I do I still get expression of the form $$ \frac{0}{0} $$ I thought maybe to use $$ t = e^{2x} $$ But I still can't simplify it enough.. Thank...
2017/01/06
[ "https://math.stackexchange.com/questions/2085878", "https://math.stackexchange.com", "https://math.stackexchange.com/users/306907/" ]
HINT: As $x\to0,x\ne0$ so safely divide numerator & denominator by $x$ and use $$\lim\_{h\to0}\dfrac{e^h-1}h=1$$ Observe that the exponent of $e,$ the limit variable and the denominator are **same**.
Using Taylor's series: $$\frac{5x - e^{2x}+1}{3x +3e^{4x}-3} = \frac{5x - (1+2x + O(x^2))+1}{3x +3(1+4x+O(x^2))-3} = \frac{3x - O(x^2)}{15x+ O(x^2)} .$$ Thus, $$\lim\_{x \rightarrow 0} \frac{3x - O(x^2)}{15x+ O(x^2)} = \frac{1}{5}.$$
2,085,878
Need to calculate the following limit without using L'Hopital's Rule: $$ \lim\_{x \to 0} \frac{5x - e^{2x}+1}{3x +3e^{4x}-3} $$ The problem I'm facing is that no matter what I do I still get expression of the form $$ \frac{0}{0} $$ I thought maybe to use $$ t = e^{2x} $$ But I still can't simplify it enough.. Thank...
2017/01/06
[ "https://math.stackexchange.com/questions/2085878", "https://math.stackexchange.com", "https://math.stackexchange.com/users/306907/" ]
Using Taylor's series: $$\frac{5x - e^{2x}+1}{3x +3e^{4x}-3} = \frac{5x - (1+2x + O(x^2))+1}{3x +3(1+4x+O(x^2))-3} = \frac{3x - O(x^2)}{15x+ O(x^2)} .$$ Thus, $$\lim\_{x \rightarrow 0} \frac{3x - O(x^2)}{15x+ O(x^2)} = \frac{1}{5}.$$
Do you know the Taylor formula? If so, then $$ e^x = 1 + x + o(x) $$ as $x \to 0$. Here, $o(x)$ is a function such that $o(x)/x \to 0$ as $x \to 0$. Hence $$ \frac{5x - e^{2x}+1}{3x +3e^{4x}-3} = \frac{5x - (1 + 2x + o(x)) + 1}{3x + 3(1 + 4x + o(x))-3} = \frac{3x+ o(x)}{15x+o(x)} = \frac{3+o(x)/x}{15+o(x)/x} $$ which s...
2,085,878
Need to calculate the following limit without using L'Hopital's Rule: $$ \lim\_{x \to 0} \frac{5x - e^{2x}+1}{3x +3e^{4x}-3} $$ The problem I'm facing is that no matter what I do I still get expression of the form $$ \frac{0}{0} $$ I thought maybe to use $$ t = e^{2x} $$ But I still can't simplify it enough.. Thank...
2017/01/06
[ "https://math.stackexchange.com/questions/2085878", "https://math.stackexchange.com", "https://math.stackexchange.com/users/306907/" ]
$$ \lim\_{x \to 0} \frac{5x - e^{2x}+1}{3x +3e^{4x}-3}=\\ \lim\_{x \to 0} \frac{5x - (1+2x+\frac{(2x)^2}{2!}+o(x^3))+1}{3x +3(1+4x+\frac{(4x)^2}{2!}+o(x^3))-3} =\\ \lim\_{x \to 0} \frac{3x-\frac{(2x)^2}{2!}-o(x^3)}{15x +3\frac{(4x)^2}{2!}+o(x^3)} = \lim\_{x \to 0} \frac{3x}{15x } =\frac{3}{15}$$
**Hint**: We can divide by $x $ to get $$\lim\_{x \to 0} \frac {5-(\frac {e^{2x}-1}{2x}(2))}{3+3 (\frac {e^{4x}-1}{4x}(4))} $$ Can you take it from here?
2,085,878
Need to calculate the following limit without using L'Hopital's Rule: $$ \lim\_{x \to 0} \frac{5x - e^{2x}+1}{3x +3e^{4x}-3} $$ The problem I'm facing is that no matter what I do I still get expression of the form $$ \frac{0}{0} $$ I thought maybe to use $$ t = e^{2x} $$ But I still can't simplify it enough.. Thank...
2017/01/06
[ "https://math.stackexchange.com/questions/2085878", "https://math.stackexchange.com", "https://math.stackexchange.com/users/306907/" ]
HINT: As $x\to0,x\ne0$ so safely divide numerator & denominator by $x$ and use $$\lim\_{h\to0}\dfrac{e^h-1}h=1$$ Observe that the exponent of $e,$ the limit variable and the denominator are **same**.
$$ \frac{5x - e^{2x}+1}{3x +3e^{4x}-3}=\frac12\frac{\dfrac52-\dfrac{e^{2x}-1}{2x}}{\dfrac34+3\dfrac{e^{4x}-1}{4x}}\to\frac12\frac{\dfrac52-L}{\dfrac34+3L}.$$ (by a scaling of $x$, the two ratios tend to $L$). Then you can take for granted that $L=1$, giving the answer $\dfrac15$.
2,085,878
Need to calculate the following limit without using L'Hopital's Rule: $$ \lim\_{x \to 0} \frac{5x - e^{2x}+1}{3x +3e^{4x}-3} $$ The problem I'm facing is that no matter what I do I still get expression of the form $$ \frac{0}{0} $$ I thought maybe to use $$ t = e^{2x} $$ But I still can't simplify it enough.. Thank...
2017/01/06
[ "https://math.stackexchange.com/questions/2085878", "https://math.stackexchange.com", "https://math.stackexchange.com/users/306907/" ]
HINT: As $x\to0,x\ne0$ so safely divide numerator & denominator by $x$ and use $$\lim\_{h\to0}\dfrac{e^h-1}h=1$$ Observe that the exponent of $e,$ the limit variable and the denominator are **same**.
$$ \lim\_{x \to 0} \frac{5x - e^{2x}+1}{3x +3e^{4x}-3}=\\ \lim\_{x \to 0} \frac{5x - (1+2x+\frac{(2x)^2}{2!}+o(x^3))+1}{3x +3(1+4x+\frac{(4x)^2}{2!}+o(x^3))-3} =\\ \lim\_{x \to 0} \frac{3x-\frac{(2x)^2}{2!}-o(x^3)}{15x +3\frac{(4x)^2}{2!}+o(x^3)} = \lim\_{x \to 0} \frac{3x}{15x } =\frac{3}{15}$$
2,410
We often seem to accept the idea that there were periods of time in which the entire surface of Earth was frozen, for the most part. This implies that there were periods of time in which the entire surface was NOT frozen over. Thus, there must have been heat and energy present on the surface. How did all that energy mo...
2014/08/27
[ "https://earthscience.stackexchange.com/questions/2410", "https://earthscience.stackexchange.com", "https://earthscience.stackexchange.com/users/813/" ]
I'm not quite sure if the question is asking about glacial, ice ages, or snowball Earth, and whether it's about the onset or end of a glacial period. I'll try to hit all three. Ice Ages and Milankovitch Cycles -------------------------------- Ice ages are long spans of time that marked by periods of time during which...
Of course it isn't "absurd", and looking at the ball-park energy budget figures you'll see why: First, I don't think anyone is claiming the Earth is completely frozen. More of a "slushy at the Equator" scenario. But let's assume an average 1 km thickness of ice for arguments sake (i.e. probably an exaggeration althoug...
2,410
We often seem to accept the idea that there were periods of time in which the entire surface of Earth was frozen, for the most part. This implies that there were periods of time in which the entire surface was NOT frozen over. Thus, there must have been heat and energy present on the surface. How did all that energy mo...
2014/08/27
[ "https://earthscience.stackexchange.com/questions/2410", "https://earthscience.stackexchange.com", "https://earthscience.stackexchange.com/users/813/" ]
Of course it isn't "absurd", and looking at the ball-park energy budget figures you'll see why: First, I don't think anyone is claiming the Earth is completely frozen. More of a "slushy at the Equator" scenario. But let's assume an average 1 km thickness of ice for arguments sake (i.e. probably an exaggeration althoug...
What's not been touched yet, and the current answers do cover a lot of ground, is the variability of solar input. Even IF the amount of energy radiated out by the earth remains the same (and it probably would, roughly), solar input is highly variable and is a major factor in determining the total energy budget of th...
2,410
We often seem to accept the idea that there were periods of time in which the entire surface of Earth was frozen, for the most part. This implies that there were periods of time in which the entire surface was NOT frozen over. Thus, there must have been heat and energy present on the surface. How did all that energy mo...
2014/08/27
[ "https://earthscience.stackexchange.com/questions/2410", "https://earthscience.stackexchange.com", "https://earthscience.stackexchange.com/users/813/" ]
Of course it isn't "absurd", and looking at the ball-park energy budget figures you'll see why: First, I don't think anyone is claiming the Earth is completely frozen. More of a "slushy at the Equator" scenario. But let's assume an average 1 km thickness of ice for arguments sake (i.e. probably an exaggeration althoug...
, I propose that the “snow ball Earth” was brought to a close by the dust from a huge meteorite (the largest known on Earth) impacting Australia (see <http://charles_w.tripod.com/antipode.html> ) settling onto the ice and melting it by a bare soil warming affect (see <http://charles_w.tripod.com/climate.html> ) and th...
2,410
We often seem to accept the idea that there were periods of time in which the entire surface of Earth was frozen, for the most part. This implies that there were periods of time in which the entire surface was NOT frozen over. Thus, there must have been heat and energy present on the surface. How did all that energy mo...
2014/08/27
[ "https://earthscience.stackexchange.com/questions/2410", "https://earthscience.stackexchange.com", "https://earthscience.stackexchange.com/users/813/" ]
Of course it isn't "absurd", and looking at the ball-park energy budget figures you'll see why: First, I don't think anyone is claiming the Earth is completely frozen. More of a "slushy at the Equator" scenario. But let's assume an average 1 km thickness of ice for arguments sake (i.e. probably an exaggeration althoug...
One cause of glaciation on earth is dust from volcanic activities ie you have heard the term volcanic or nuclear winter. During glaciation continental plates with a mile or two of ice piled upon them increase vastly in weight and actually sink. When we see a rock we see a hard stone object, but that rock within the ea...
2,410
We often seem to accept the idea that there were periods of time in which the entire surface of Earth was frozen, for the most part. This implies that there were periods of time in which the entire surface was NOT frozen over. Thus, there must have been heat and energy present on the surface. How did all that energy mo...
2014/08/27
[ "https://earthscience.stackexchange.com/questions/2410", "https://earthscience.stackexchange.com", "https://earthscience.stackexchange.com/users/813/" ]
I'm not quite sure if the question is asking about glacial, ice ages, or snowball Earth, and whether it's about the onset or end of a glacial period. I'll try to hit all three. Ice Ages and Milankovitch Cycles -------------------------------- Ice ages are long spans of time that marked by periods of time during which...
What's not been touched yet, and the current answers do cover a lot of ground, is the variability of solar input. Even IF the amount of energy radiated out by the earth remains the same (and it probably would, roughly), solar input is highly variable and is a major factor in determining the total energy budget of th...
2,410
We often seem to accept the idea that there were periods of time in which the entire surface of Earth was frozen, for the most part. This implies that there were periods of time in which the entire surface was NOT frozen over. Thus, there must have been heat and energy present on the surface. How did all that energy mo...
2014/08/27
[ "https://earthscience.stackexchange.com/questions/2410", "https://earthscience.stackexchange.com", "https://earthscience.stackexchange.com/users/813/" ]
I'm not quite sure if the question is asking about glacial, ice ages, or snowball Earth, and whether it's about the onset or end of a glacial period. I'll try to hit all three. Ice Ages and Milankovitch Cycles -------------------------------- Ice ages are long spans of time that marked by periods of time during which...
, I propose that the “snow ball Earth” was brought to a close by the dust from a huge meteorite (the largest known on Earth) impacting Australia (see <http://charles_w.tripod.com/antipode.html> ) settling onto the ice and melting it by a bare soil warming affect (see <http://charles_w.tripod.com/climate.html> ) and th...
2,410
We often seem to accept the idea that there were periods of time in which the entire surface of Earth was frozen, for the most part. This implies that there were periods of time in which the entire surface was NOT frozen over. Thus, there must have been heat and energy present on the surface. How did all that energy mo...
2014/08/27
[ "https://earthscience.stackexchange.com/questions/2410", "https://earthscience.stackexchange.com", "https://earthscience.stackexchange.com/users/813/" ]
I'm not quite sure if the question is asking about glacial, ice ages, or snowball Earth, and whether it's about the onset or end of a glacial period. I'll try to hit all three. Ice Ages and Milankovitch Cycles -------------------------------- Ice ages are long spans of time that marked by periods of time during which...
One cause of glaciation on earth is dust from volcanic activities ie you have heard the term volcanic or nuclear winter. During glaciation continental plates with a mile or two of ice piled upon them increase vastly in weight and actually sink. When we see a rock we see a hard stone object, but that rock within the ea...
2,410
We often seem to accept the idea that there were periods of time in which the entire surface of Earth was frozen, for the most part. This implies that there were periods of time in which the entire surface was NOT frozen over. Thus, there must have been heat and energy present on the surface. How did all that energy mo...
2014/08/27
[ "https://earthscience.stackexchange.com/questions/2410", "https://earthscience.stackexchange.com", "https://earthscience.stackexchange.com/users/813/" ]
What's not been touched yet, and the current answers do cover a lot of ground, is the variability of solar input. Even IF the amount of energy radiated out by the earth remains the same (and it probably would, roughly), solar input is highly variable and is a major factor in determining the total energy budget of th...
, I propose that the “snow ball Earth” was brought to a close by the dust from a huge meteorite (the largest known on Earth) impacting Australia (see <http://charles_w.tripod.com/antipode.html> ) settling onto the ice and melting it by a bare soil warming affect (see <http://charles_w.tripod.com/climate.html> ) and th...
2,410
We often seem to accept the idea that there were periods of time in which the entire surface of Earth was frozen, for the most part. This implies that there were periods of time in which the entire surface was NOT frozen over. Thus, there must have been heat and energy present on the surface. How did all that energy mo...
2014/08/27
[ "https://earthscience.stackexchange.com/questions/2410", "https://earthscience.stackexchange.com", "https://earthscience.stackexchange.com/users/813/" ]
What's not been touched yet, and the current answers do cover a lot of ground, is the variability of solar input. Even IF the amount of energy radiated out by the earth remains the same (and it probably would, roughly), solar input is highly variable and is a major factor in determining the total energy budget of th...
One cause of glaciation on earth is dust from volcanic activities ie you have heard the term volcanic or nuclear winter. During glaciation continental plates with a mile or two of ice piled upon them increase vastly in weight and actually sink. When we see a rock we see a hard stone object, but that rock within the ea...
157,981
On MySQL 5.7.11 running on Amazon RDS with InnoDB I have a fairly heavy reporting query that takes about 3 minutes to run. During this time I can't access my reporting screen, which reads some min and max dates from one of the tables that is included in the report. I would have thought by setting "SET TRANSACTION ISO...
2016/12/13
[ "https://dba.stackexchange.com/questions/157981", "https://dba.stackexchange.com", "https://dba.stackexchange.com/users/2599/" ]
Here is the original model -- at least as worded in the question. [![school_county_1](https://i.stack.imgur.com/OV4gj.png)](https://i.stack.imgur.com/OV4gj.png) Though there is nothing cyclical here it does have few problems. For example, the model has no relationship between `County` and `District`, although you do ...
It is ok to have relationships with everyone. As long as there's a reason for that, meaning, as long as the concepts have an independent relationship amongst themselves. If your student lives in a county and you want to keep that info; and their teacher is a teacher in a different county, that's ok. But if the student ...
39,165,196
so I have a variable called multiplier that contains a certain value depending on what the user registered with. What I am trying to write here is If multiplier is equal to "sedentary" then give it the value of `$sedmultiplier` If multiplier is equal to "lightly" then give it the value of `$lightmultiplier` Im stuck...
2016/08/26
[ "https://Stackoverflow.com/questions/39165196", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2023527/" ]
The option to preview all screen sizes is not available in Android Studio 2.2 Beta 2. However, you can resize the preview screen to see how your layout would look on different screen sizes, as shown in the attached gif. [![Android Studio 2.2 Beta 3 Preview Screen resize example ](https://i.stack.imgur.com/um1y0.gif)](...
While preview all screen sizes seems to be gone, it is possible in 2.3 to view more than one screen size at the same time. Right-click on the activity\_main.xml (or whichever xml file) tab, and from the pop-up menu select split-vertically or split-horizontally. This will create a second xml tab that can use a differ...
39,165,196
so I have a variable called multiplier that contains a certain value depending on what the user registered with. What I am trying to write here is If multiplier is equal to "sedentary" then give it the value of `$sedmultiplier` If multiplier is equal to "lightly" then give it the value of `$lightmultiplier` Im stuck...
2016/08/26
[ "https://Stackoverflow.com/questions/39165196", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2023527/" ]
The option to preview all screen sizes is not available in Android Studio 2.2 Beta 2. However, you can resize the preview screen to see how your layout would look on different screen sizes, as shown in the attached gif. [![Android Studio 2.2 Beta 3 Preview Screen resize example ](https://i.stack.imgur.com/um1y0.gif)](...
The Previews are back! Try this: 1. open your layout xml 2. open the new tab **Layout Validation** If you can't find the tab, try double-shift and search for "Layout Validation". [![enter image description here](https://i.stack.imgur.com/2s6yk.gif)](https://i.stack.imgur.com/2s6yk.gif) ([source](https://developer....
39,165,196
so I have a variable called multiplier that contains a certain value depending on what the user registered with. What I am trying to write here is If multiplier is equal to "sedentary" then give it the value of `$sedmultiplier` If multiplier is equal to "lightly" then give it the value of `$lightmultiplier` Im stuck...
2016/08/26
[ "https://Stackoverflow.com/questions/39165196", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2023527/" ]
While preview all screen sizes seems to be gone, it is possible in 2.3 to view more than one screen size at the same time. Right-click on the activity\_main.xml (or whichever xml file) tab, and from the pop-up menu select split-vertically or split-horizontally. This will create a second xml tab that can use a differ...
The Previews are back! Try this: 1. open your layout xml 2. open the new tab **Layout Validation** If you can't find the tab, try double-shift and search for "Layout Validation". [![enter image description here](https://i.stack.imgur.com/2s6yk.gif)](https://i.stack.imgur.com/2s6yk.gif) ([source](https://developer....
9,323,338
I am having trouble coding a hw program that is made to generate test with multiple choice and essay questions. Everything works except my program skips lines when it goes to read a part of the essay class. I know it has to do with the scanner and scan.nextline, scan.nextInt and scan.next, etc but I am confused on how ...
2012/02/17
[ "https://Stackoverflow.com/questions/9323338", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1049017/" ]
Using scan.nextInt() will generate the following problems If your input is "5 5", nextInt() will get the next integer leaving the remaining " 5" of the buffer line. Of which the remaining " 5" will be caught by `type = scan.next();` In the class test writer: ``` System.out.println("How many questions are on your ...
Your `readQuestion` function should be ... ``` public void readQuestion() { System.out.println("How many lines?"); line = scan.nextInt(); scan.nextLine(); System.out.println("Enter the question"); question = scan.nextLine(); } ``` It should be `scan.nextLine();` to add an empty new line at the end
9,323,338
I am having trouble coding a hw program that is made to generate test with multiple choice and essay questions. Everything works except my program skips lines when it goes to read a part of the essay class. I know it has to do with the scanner and scan.nextline, scan.nextInt and scan.next, etc but I am confused on how ...
2012/02/17
[ "https://Stackoverflow.com/questions/9323338", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1049017/" ]
Using scan.nextInt() will generate the following problems If your input is "5 5", nextInt() will get the next integer leaving the remaining " 5" of the buffer line. Of which the remaining " 5" will be caught by `type = scan.next();` In the class test writer: ``` System.out.println("How many questions are on your ...
In your TestWriter.main() method what are you expecting at 3 line in following code: ``` System.out.println("Question " + (i+1) + ": Essay or multiple choice question? (e/m)"); type = scan.next(); scan.nextLine(); //LINE 3: What are you expecting user to enter over here. ``` the control flow will stuck at this ...
5,612,791
So, I heard that C++ templates shouldn't be separated into a header (.h) and source (.cpp) files. For instance, a template like this: ``` template <class T> class J { T something; }; ``` Is this true? Why is it so? If because of that I'm gonna have to put both declaration and implementation in the same file,...
2011/04/10
[ "https://Stackoverflow.com/questions/5612791", "https://Stackoverflow.com", "https://Stackoverflow.com/users/380714/" ]
Headers. It's because templates are instantiated at compile-time, not link-time, and different translation units (roughly equivalent to your `.cpp` files) only "know about" each other at link-time. Headers tend to be widely "known about" at compile-time because you `#include` them in any translation unit that needs th...
If you need the template code to be usable by other translation units (.cpp files), you need to put the implementation in the .h file or else those other units won't be able to instantiate the template (expand it according to the types they use). If your template function is only instantiated in one .cpp file, you can...
5,612,791
So, I heard that C++ templates shouldn't be separated into a header (.h) and source (.cpp) files. For instance, a template like this: ``` template <class T> class J { T something; }; ``` Is this true? Why is it so? If because of that I'm gonna have to put both declaration and implementation in the same file,...
2011/04/10
[ "https://Stackoverflow.com/questions/5612791", "https://Stackoverflow.com", "https://Stackoverflow.com/users/380714/" ]
The reason you can't put a templated class into a .cpp file is because in order to "compile" a .cpp file you need to know what the type that is being used in place of T. As it stands a templated class (like your class J) doesn't have enough information to compile. Thus it must be all in headers. If you want the break...
If you need the template code to be usable by other translation units (.cpp files), you need to put the implementation in the .h file or else those other units won't be able to instantiate the template (expand it according to the types they use). If your template function is only instantiated in one .cpp file, you can...
5,612,791
So, I heard that C++ templates shouldn't be separated into a header (.h) and source (.cpp) files. For instance, a template like this: ``` template <class T> class J { T something; }; ``` Is this true? Why is it so? If because of that I'm gonna have to put both declaration and implementation in the same file,...
2011/04/10
[ "https://Stackoverflow.com/questions/5612791", "https://Stackoverflow.com", "https://Stackoverflow.com/users/380714/" ]
Headers. It's because templates are instantiated at compile-time, not link-time, and different translation units (roughly equivalent to your `.cpp` files) only "know about" each other at link-time. Headers tend to be widely "known about" at compile-time because you `#include` them in any translation unit that needs th...
Yes, it's true. Declaration and implementation are generally put into the header file all together. Some compilers experimented with an `export` keyword that would allow them to be separated, but that has been removed from C++0x. Check out [this FAQ entry](http://www.parashift.com/c++-faq-lite/templates.html#faq-35.12)...
5,612,791
So, I heard that C++ templates shouldn't be separated into a header (.h) and source (.cpp) files. For instance, a template like this: ``` template <class T> class J { T something; }; ``` Is this true? Why is it so? If because of that I'm gonna have to put both declaration and implementation in the same file,...
2011/04/10
[ "https://Stackoverflow.com/questions/5612791", "https://Stackoverflow.com", "https://Stackoverflow.com/users/380714/" ]
The reason you can't put a templated class into a .cpp file is because in order to "compile" a .cpp file you need to know what the type that is being used in place of T. As it stands a templated class (like your class J) doesn't have enough information to compile. Thus it must be all in headers. If you want the break...
Yes, it's true. Declaration and implementation are generally put into the header file all together. Some compilers experimented with an `export` keyword that would allow them to be separated, but that has been removed from C++0x. Check out [this FAQ entry](http://www.parashift.com/c++-faq-lite/templates.html#faq-35.12)...
5,612,791
So, I heard that C++ templates shouldn't be separated into a header (.h) and source (.cpp) files. For instance, a template like this: ``` template <class T> class J { T something; }; ``` Is this true? Why is it so? If because of that I'm gonna have to put both declaration and implementation in the same file,...
2011/04/10
[ "https://Stackoverflow.com/questions/5612791", "https://Stackoverflow.com", "https://Stackoverflow.com/users/380714/" ]
Headers. It's because templates are instantiated at compile-time, not link-time, and different translation units (roughly equivalent to your `.cpp` files) only "know about" each other at link-time. Headers tend to be widely "known about" at compile-time because you `#include` them in any translation unit that needs th...
The reason you can't put a templated class into a .cpp file is because in order to "compile" a .cpp file you need to know what the type that is being used in place of T. As it stands a templated class (like your class J) doesn't have enough information to compile. Thus it must be all in headers. If you want the break...
517,830
How do I set my settings such that even if I close my lid (Laptop) My downloads don't stop or pause in utransmission I have set the setting in power options to not suspend after closing lid still doesn't have Time out is off as well in power option but this doesn't help also wifi goes off when I close the lid . I ...
2014/08/29
[ "https://askubuntu.com/questions/517830", "https://askubuntu.com", "https://askubuntu.com/users/321468/" ]
`/etc/environment` takes a proper re-login to take effect, because it is processed by PAM at login. Further, as @przemo noted, it is not run or sourced as a script, so variables are not expanded. Put such variables in a `.sh` file in `/etc/profile.d/`: ```bsh sudo tee -a /etc/profile.d/my_vars.sh <<"EOF" export M2_HOM...
`/etc/environment` is not a script file, you cannot use variables, for further reading I recommend <https://help.ubuntu.com/community/EnvironmentVariables>
54,372,246
I'm trying to use lit-element component in my React project, and I'd like to pass in the callback function to lit-element component from React but with no luck. I've tried a couple of different ways, like change property type, and pass function in as a string, but none of them works. **lit-element component code:** ...
2019/01/25
[ "https://Stackoverflow.com/questions/54372246", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10958745/" ]
What I found that works is adding a ref in the react component to the lit element, then literally setting the property on it. So, for the following JSX: ``` <some-webcomponent ref={this.myRef}></some-webcomponent> ``` You can pass a property to ‘some-webcomponent’ in i.e. componentDidMount: ``` componentDidMount (...
Have a look at the menu button click function for the no redux pwa-starter-kit at <https://github.com/Polymer/pwa-starter-kit/blob/template-no-redux/src/components/my-app.js>. I believe that provides the example that may work for you.
54,372,246
I'm trying to use lit-element component in my React project, and I'd like to pass in the callback function to lit-element component from React but with no luck. I've tried a couple of different ways, like change property type, and pass function in as a string, but none of them works. **lit-element component code:** ...
2019/01/25
[ "https://Stackoverflow.com/questions/54372246", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10958745/" ]
This question probably isn't just valid for react. It's quite general, how do I pass a handler from parent to child component, either it's a lit-element or html element. According to the property doc, <https://lit-element.polymer-project.org/guide/properties> ``` <my-element mystring="hello world" mynumber="5" ...
Have a look at the menu button click function for the no redux pwa-starter-kit at <https://github.com/Polymer/pwa-starter-kit/blob/template-no-redux/src/components/my-app.js>. I believe that provides the example that may work for you.
54,372,246
I'm trying to use lit-element component in my React project, and I'd like to pass in the callback function to lit-element component from React but with no luck. I've tried a couple of different ways, like change property type, and pass function in as a string, but none of them works. **lit-element component code:** ...
2019/01/25
[ "https://Stackoverflow.com/questions/54372246", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10958745/" ]
This question probably isn't just valid for react. It's quite general, how do I pass a handler from parent to child component, either it's a lit-element or html element. According to the property doc, <https://lit-element.polymer-project.org/guide/properties> ``` <my-element mystring="hello world" mynumber="5" ...
What I found that works is adding a ref in the react component to the lit element, then literally setting the property on it. So, for the following JSX: ``` <some-webcomponent ref={this.myRef}></some-webcomponent> ``` You can pass a property to ‘some-webcomponent’ in i.e. componentDidMount: ``` componentDidMount (...
3,579,638
Below is a sample: ``` private function loadLevel(name:String):void{ level1 = new Level1(name); level1.onInitialize.addOnce(onLevelReady); level1.loadData(); } ``` Loads only level1 class, now I dont want to create another function just to load another level.. I w...
2010/08/26
[ "https://Stackoverflow.com/questions/3579638", "https://Stackoverflow.com", "https://Stackoverflow.com/users/115330/" ]
``` private function loadLevel(level : int, name : String) : void { try { var LevelClass : Class = getDefinitionByName("Level" + level) as Class; // i think you should also create an ILevel interface for your levels var level : ILevel = new LevelClass(name) as ILevel; level.onInitial...
``` private function loadLevel(name:String, level:Number):void{ var Level:Class = getDefinitionByName("Level" + level) as Class; level1 = new Level(name); level1.onInitialize.addOnce(onLevelReady); level1.loadData(); } ``` If your class requires a class path. ``` var Level:C...
3,579,638
Below is a sample: ``` private function loadLevel(name:String):void{ level1 = new Level1(name); level1.onInitialize.addOnce(onLevelReady); level1.loadData(); } ``` Loads only level1 class, now I dont want to create another function just to load another level.. I w...
2010/08/26
[ "https://Stackoverflow.com/questions/3579638", "https://Stackoverflow.com", "https://Stackoverflow.com/users/115330/" ]
``` private function loadLevel(level : int, name : String) : void { try { var LevelClass : Class = getDefinitionByName("Level" + level) as Class; // i think you should also create an ILevel interface for your levels var level : ILevel = new LevelClass(name) as ILevel; level.onInitial...
This is what I use: ``` private function loadLevel(level:Level):void{ level.onInitialize.addOnce(onLevelReady); level.loadData(); } ``` and call it using: ``` loadLevel(new Level1()); ``` And make sure that all levels extends from the class Level ``` class Level1 extends Level ``` B...
3,579,638
Below is a sample: ``` private function loadLevel(name:String):void{ level1 = new Level1(name); level1.onInitialize.addOnce(onLevelReady); level1.loadData(); } ``` Loads only level1 class, now I dont want to create another function just to load another level.. I w...
2010/08/26
[ "https://Stackoverflow.com/questions/3579638", "https://Stackoverflow.com", "https://Stackoverflow.com/users/115330/" ]
``` private function loadLevel(level : int, name : String) : void { try { var LevelClass : Class = getDefinitionByName("Level" + level) as Class; // i think you should also create an ILevel interface for your levels var level : ILevel = new LevelClass(name) as ILevel; level.onInitial...
Here's another answer: Keep your levels in an array. ``` private const levels = [null, Level1, Level2, Level3] ``` And then: ``` private function loadLevel(name:String, n:int):void{ level = new (levels[n])(name); level.onInitialize.addOnce(onLevelReady); level.loadData(); } ```
3,579,638
Below is a sample: ``` private function loadLevel(name:String):void{ level1 = new Level1(name); level1.onInitialize.addOnce(onLevelReady); level1.loadData(); } ``` Loads only level1 class, now I dont want to create another function just to load another level.. I w...
2010/08/26
[ "https://Stackoverflow.com/questions/3579638", "https://Stackoverflow.com", "https://Stackoverflow.com/users/115330/" ]
Here's another answer: Keep your levels in an array. ``` private const levels = [null, Level1, Level2, Level3] ``` And then: ``` private function loadLevel(name:String, n:int):void{ level = new (levels[n])(name); level.onInitialize.addOnce(onLevelReady); level.loadData(); } ```
``` private function loadLevel(name:String, level:Number):void{ var Level:Class = getDefinitionByName("Level" + level) as Class; level1 = new Level(name); level1.onInitialize.addOnce(onLevelReady); level1.loadData(); } ``` If your class requires a class path. ``` var Level:C...
3,579,638
Below is a sample: ``` private function loadLevel(name:String):void{ level1 = new Level1(name); level1.onInitialize.addOnce(onLevelReady); level1.loadData(); } ``` Loads only level1 class, now I dont want to create another function just to load another level.. I w...
2010/08/26
[ "https://Stackoverflow.com/questions/3579638", "https://Stackoverflow.com", "https://Stackoverflow.com/users/115330/" ]
Here's another answer: Keep your levels in an array. ``` private const levels = [null, Level1, Level2, Level3] ``` And then: ``` private function loadLevel(name:String, n:int):void{ level = new (levels[n])(name); level.onInitialize.addOnce(onLevelReady); level.loadData(); } ```
This is what I use: ``` private function loadLevel(level:Level):void{ level.onInitialize.addOnce(onLevelReady); level.loadData(); } ``` and call it using: ``` loadLevel(new Level1()); ``` And make sure that all levels extends from the class Level ``` class Level1 extends Level ``` B...
12,459,390
Our customer has their public RSA key stored in a certificate. We need this key hardcoded in our WinRT app, so we can encrypt client-side. However, we're having issues importing the key into an instance of the CryptographicKey class. We're using the ImportPublicKey on the RSAProvider: ``` rsaProvider = AsymmetricKey...
2012/09/17
[ "https://Stackoverflow.com/questions/12459390", "https://Stackoverflow.com", "https://Stackoverflow.com/users/71515/" ]
I found this article in the MSDN Forum very helpful. Carlos Lopez postet some code to get the Public Key out of a Base64 encoded Certificate. <http://social.msdn.microsoft.com/Forums/en-US/17e1467a-2de7-47d2-8d8c-130518eaac68/how-to-use-a-x509-certificate-not-a-pfx-to-verify-a-signature> Here the code: ``` public st...
Two things: 1. The argument to ImportPublicKey key is an IBuffer. The easiest way to get this is using the ToBuffer extension method for a byte[]. 2. Use the override of [ImportPublicKey](http://msdn.microsoft.com/en-us/library/windows/apps/windows.security.cryptography.core.cryptographicpublickeyblobtype.aspx) that ...
12,459,390
Our customer has their public RSA key stored in a certificate. We need this key hardcoded in our WinRT app, so we can encrypt client-side. However, we're having issues importing the key into an instance of the CryptographicKey class. We're using the ImportPublicKey on the RSAProvider: ``` rsaProvider = AsymmetricKey...
2012/09/17
[ "https://Stackoverflow.com/questions/12459390", "https://Stackoverflow.com", "https://Stackoverflow.com/users/71515/" ]
I found this article in the MSDN Forum very helpful. Carlos Lopez postet some code to get the Public Key out of a Base64 encoded Certificate. <http://social.msdn.microsoft.com/Forums/en-US/17e1467a-2de7-47d2-8d8c-130518eaac68/how-to-use-a-x509-certificate-not-a-pfx-to-verify-a-signature> Here the code: ``` public st...
For those banging his head as how you can use a public key stored in a certificate in a WinRT app, let me ease your pain: You can't, at least not directly. The `AsymmetricKeyAlgorithmProvider.ImportPublicKey` function takes an IBuffer and a CryptographicPublicKeyBlobType, the keyBlob (IBuffer) parameter it's the publi...
52,429,600
I wish to validate attribute `amount`. The allowed amount differ per admin user role. So need to update (or not) based on role of the admin who updates the funds, not the user who the funds belong to. ``` class UserFund validate :validate_amount def validate_amount if current_user.admin? ...
2018/09/20
[ "https://Stackoverflow.com/questions/52429600", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9612162/" ]
If `current_user` has no relations to `UserFund` object which is going to be saved, then I think it would be better to transform validator into a separate method. And since that method implies some knowledge about `User` class, it would make sense to move it to `User` class as an instance method (or if admin and user a...
If this validation is based on data from the same model, you can just skip `current_user`. For example, assuming this validation is for `User` model with instance methods `admin?`, `cs?` and `staff?`, it can be written as: ``` class User < ApplicationRecord validate :validate_amount def validate_amount if adm...
52,429,600
I wish to validate attribute `amount`. The allowed amount differ per admin user role. So need to update (or not) based on role of the admin who updates the funds, not the user who the funds belong to. ``` class UserFund validate :validate_amount def validate_amount if current_user.admin? ...
2018/09/20
[ "https://Stackoverflow.com/questions/52429600", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9612162/" ]
If `current_user` has no relations to `UserFund` object which is going to be saved, then I think it would be better to transform validator into a separate method. And since that method implies some knowledge about `User` class, it would make sense to move it to `User` class as an instance method (or if admin and user a...
I think this is a good case for the "context" on validations <https://guides.rubyonrails.org/active_record_validations.html#on> You can define different validations on different contexts (ie: different roles). ``` validate :admin_amount, on: :admin validate :cs_amount, on: :cs validate :staff_amount, on: :staff def ...
8,581
### Context: I'm a Psychology PhD student. As with many psychology PhD students, I know how to perform various statistical analyses using statistical software, up to techniques such as PCA, classification trees, and cluster analysis. But it's not really satisfying because though I can explain why I did an analysis and...
2011/03/21
[ "https://stats.stackexchange.com/questions/8581", "https://stats.stackexchange.com", "https://stats.stackexchange.com/users/3827/" ]
### Overview: * My impression is that your experience is common to a lot of students in the social sciences. * The starting point is a motivation to learn. * You can go down either **self-taught** or **formal instruction** routes. ### Formal instruction: There are many options in this regard. You might consider a ma...
I understand your difficulty as I have a similar problem when I try to do something new in statistics (I'm also a grad student, but in a different field). I have found examining the R code quite useful to get an idea how something is calculated. For example, I have been recently learning how to use `kmeans` clustering ...
8,581
### Context: I'm a Psychology PhD student. As with many psychology PhD students, I know how to perform various statistical analyses using statistical software, up to techniques such as PCA, classification trees, and cluster analysis. But it's not really satisfying because though I can explain why I did an analysis and...
2011/03/21
[ "https://stats.stackexchange.com/questions/8581", "https://stats.stackexchange.com", "https://stats.stackexchange.com/users/3827/" ]
### Overview: * My impression is that your experience is common to a lot of students in the social sciences. * The starting point is a motivation to learn. * You can go down either **self-taught** or **formal instruction** routes. ### Formal instruction: There are many options in this regard. You might consider a ma...
I get the impression that you think that you can get insight into a statistical equation by programming it into either R or C++; you can't. To understand a statistical equation, find an "undergraduate" textbook with lots of homework problems at the end of each chapter that contains the equation, and then do the homewor...
24,211,129
* I'm looking for a generic solution so sysctl.conf is just an example. I have several lines of configuration I need to be sure exist in all my servers' sysctl.conf: ``` net.ipv4.tcp_syncookies = 1 net.bridge.bridge-nf-call-ip6tables = 0 net.bridge.bridge-nf-call-iptables = 0 net.bridge.bridge-nf-call-arptables = 0 k...
2014/06/13
[ "https://Stackoverflow.com/questions/24211129", "https://Stackoverflow.com", "https://Stackoverflow.com/users/189395/" ]
There are different ways to go about this. Personally I think keeping the whole file as one string in your YAML is a poor choice, but the [syntax](http://en.wikipedia.org/wiki/YAML#Syntax) for that would be ``` sysctl_content: | net.ipv4.tcp_syncookies = 1 net.bridge.bridge-nf-call-ip6tables = 0 ......
Managing sysctl conf with templates and files is an awful idea. There are dozens of applications that might need to make alterations, so you don't want 1 module to control them all. This is a much better way to do it : [link](http://projects.puppetlabs.com/projects/1/wiki/puppet_augeas#etcsysctlconf) Now you can s...
24,211,129
* I'm looking for a generic solution so sysctl.conf is just an example. I have several lines of configuration I need to be sure exist in all my servers' sysctl.conf: ``` net.ipv4.tcp_syncookies = 1 net.bridge.bridge-nf-call-ip6tables = 0 net.bridge.bridge-nf-call-iptables = 0 net.bridge.bridge-nf-call-arptables = 0 k...
2014/06/13
[ "https://Stackoverflow.com/questions/24211129", "https://Stackoverflow.com", "https://Stackoverflow.com/users/189395/" ]
There are different ways to go about this. Personally I think keeping the whole file as one string in your YAML is a poor choice, but the [syntax](http://en.wikipedia.org/wiki/YAML#Syntax) for that would be ``` sysctl_content: | net.ipv4.tcp_syncookies = 1 net.bridge.bridge-nf-call-ip6tables = 0 ......
Although your approach may not be the best idea and the other answers show better approaches: Your white space in front of each line but the first is there, because you put it there: ``` content: "kernel.msgmnb = 65536\n kernel.msgmax = 65536\n kernel.shmmax = 1519344680\n kernel.shmall = 4294967296\n net.core.rmem_m...
62,128,845
"a specified logon session does not exist. it may already have been terminated" after i joined the device to azure active directory -i can't access our shared folder in our server after i joined the device to azure AD and use office 365 account (Please see click the link below to see the error image for your reference...
2020/06/01
[ "https://Stackoverflow.com/questions/62128845", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4002256/" ]
The repository run by Boundless has been replaced by one hosted by OSGeo. The OSGeo webdav repo was merged into the new OSGeo repo. Details are here (<https://docs.geotools.org/latest/userguide/tutorial/quickstart/maven.html>) Replace this block ``` <repository> <id>osgeo</id> <name>Open Source Geospatial Fo...
If you paste the `Open Source Geospatial Foundation Repository` URL in your web browser and hit enter it will return `404 Not Found` error. This happens when Maven attempts to connect to that resource to fetch dependency for you but it's no longer available. However, if you pay close attention to `Maven Repo` link, the...
7,903,550
I made a web page with the following code and viewed it in Google Chrome. ``` <html> <head> <style type="text/css"> html {padding:30px; background-color:blue;} body {margin:0px; background-color:red;} </style> </head> <body> hello world </body> </html> ``` The result i...
2011/10/26
[ "https://Stackoverflow.com/questions/7903550", "https://Stackoverflow.com", "https://Stackoverflow.com/users/27305/" ]
if i understand you correctly, set your html & body width to 100% , height 100% > > <http://jsfiddle.net/Diezel23/Lv6Vw/#base> > > >
You could add an additional div: ``` <html> <head> <style> body { padding: 30px; margin: 0px; } div { width: 100%; height: 100%; background-color: blue; } </style> </h...
7,903,550
I made a web page with the following code and viewed it in Google Chrome. ``` <html> <head> <style type="text/css"> html {padding:30px; background-color:blue;} body {margin:0px; background-color:red;} </style> </head> <body> hello world </body> </html> ``` The result i...
2011/10/26
[ "https://Stackoverflow.com/questions/7903550", "https://Stackoverflow.com", "https://Stackoverflow.com/users/27305/" ]
For this I think you have to resort to absolute or relative positioning; otherwise, your height/margin combo will push the bottom blue line off the screen. This works cross browser for this simple case. Hopefully it works for your more complicated use case. ``` <!DOCTYPE html> <html> <head> <style type="text/css...
if i understand you correctly, set your html & body width to 100% , height 100% > > <http://jsfiddle.net/Diezel23/Lv6Vw/#base> > > >
7,903,550
I made a web page with the following code and viewed it in Google Chrome. ``` <html> <head> <style type="text/css"> html {padding:30px; background-color:blue;} body {margin:0px; background-color:red;} </style> </head> <body> hello world </body> </html> ``` The result i...
2011/10/26
[ "https://Stackoverflow.com/questions/7903550", "https://Stackoverflow.com", "https://Stackoverflow.com/users/27305/" ]
For this I think you have to resort to absolute or relative positioning; otherwise, your height/margin combo will push the bottom blue line off the screen. This works cross browser for this simple case. Hopefully it works for your more complicated use case. ``` <!DOCTYPE html> <html> <head> <style type="text/css...
You could add an additional div: ``` <html> <head> <style> body { padding: 30px; margin: 0px; } div { width: 100%; height: 100%; background-color: blue; } </style> </h...
210,811
So I created the text with the add text button - I'm using version 2.91 - then I went to the right tab with all the properties functions: world properties, materials properties, physics properties, etc., then I extruded the text a bit(stretched it). Next, I went to the materials tab to color it, clicked on new , the s...
2021/02/06
[ "https://blender.stackexchange.com/questions/210811", "https://blender.stackexchange.com", "https://blender.stackexchange.com/users/116368/" ]
You probably need to switch preview modes. Press Z in the 3D viewport and pick either "Material Preview" or "Rendered" from the pie menu. The Preview Modes and Viewport Shading Options can also be accessed from the 4 circles and the little down arrow, respectively, at the top right of the viewport: [![Previews](https:...
Make sure you are on Render preview or material preview tab [![enter image description here](https://i.stack.imgur.com/3dQ7G.png)](https://i.stack.imgur.com/3dQ7G.png)
696,551
We had feedback from our pentest report saying we should turn off server tokens. This is stop people being able to see which version of PHP we are using, and limit their ability to target the specific PHP version. I have added the following to nginx.conf, under the http block: ``` server_tokens off; ``` But what to...
2015/06/04
[ "https://serverfault.com/questions/696551", "https://serverfault.com", "https://serverfault.com/users/202300/" ]
From the [manual](http://nginx.org/en/docs/http/ngx_http_core_module.html#server_tokens) you know what the setting does: > > **Syntax**: `server_tokens on | off`; > > **Default**: `server_tokens on`; > > **Context**: http, server, location > > > *Enables or disables emitting nginx version in error messages a...
Take a look at InSpec, a tool that allows you "turn your compliance, security, and other policy requirements into automated tests." <https://www.inspec.io> It can do all the configuration testing that you need for your Nginx server. Here's one way to test for the existence of the conf file and the value of `server_to...
696,551
We had feedback from our pentest report saying we should turn off server tokens. This is stop people being able to see which version of PHP we are using, and limit their ability to target the specific PHP version. I have added the following to nginx.conf, under the http block: ``` server_tokens off; ``` But what to...
2015/06/04
[ "https://serverfault.com/questions/696551", "https://serverfault.com", "https://serverfault.com/users/202300/" ]
From the [manual](http://nginx.org/en/docs/http/ngx_http_core_module.html#server_tokens) you know what the setting does: > > **Syntax**: `server_tokens on | off`; > > **Default**: `server_tokens on`; > > **Context**: http, server, location > > > *Enables or disables emitting nginx version in error messages a...
Also, if you serve PHP projects, you may need to change in `/etc/nginx/{fastcgi,fastcgi_params).conf` ``` fastcgi_param SERVER_SOFTWARE nginx; ```
696,551
We had feedback from our pentest report saying we should turn off server tokens. This is stop people being able to see which version of PHP we are using, and limit their ability to target the specific PHP version. I have added the following to nginx.conf, under the http block: ``` server_tokens off; ``` But what to...
2015/06/04
[ "https://serverfault.com/questions/696551", "https://serverfault.com", "https://serverfault.com/users/202300/" ]
After a bit more googling, I have found curl command can check the server headers which shows both server tokens and php versions: ``` curl -I -L www.example.com ``` Thanks to Alexey for pointing out the change needed in PHP. ``` HTTP/1.1 301 Moved Permanently Server: nginx Date: Thu, 04 Jun 2015 10:49:35 GMT Conte...
Take a look at InSpec, a tool that allows you "turn your compliance, security, and other policy requirements into automated tests." <https://www.inspec.io> It can do all the configuration testing that you need for your Nginx server. Here's one way to test for the existence of the conf file and the value of `server_to...
696,551
We had feedback from our pentest report saying we should turn off server tokens. This is stop people being able to see which version of PHP we are using, and limit their ability to target the specific PHP version. I have added the following to nginx.conf, under the http block: ``` server_tokens off; ``` But what to...
2015/06/04
[ "https://serverfault.com/questions/696551", "https://serverfault.com", "https://serverfault.com/users/202300/" ]
After a bit more googling, I have found curl command can check the server headers which shows both server tokens and php versions: ``` curl -I -L www.example.com ``` Thanks to Alexey for pointing out the change needed in PHP. ``` HTTP/1.1 301 Moved Permanently Server: nginx Date: Thu, 04 Jun 2015 10:49:35 GMT Conte...
Also, if you serve PHP projects, you may need to change in `/etc/nginx/{fastcgi,fastcgi_params).conf` ``` fastcgi_param SERVER_SOFTWARE nginx; ```
696,551
We had feedback from our pentest report saying we should turn off server tokens. This is stop people being able to see which version of PHP we are using, and limit their ability to target the specific PHP version. I have added the following to nginx.conf, under the http block: ``` server_tokens off; ``` But what to...
2015/06/04
[ "https://serverfault.com/questions/696551", "https://serverfault.com", "https://serverfault.com/users/202300/" ]
Also, if you serve PHP projects, you may need to change in `/etc/nginx/{fastcgi,fastcgi_params).conf` ``` fastcgi_param SERVER_SOFTWARE nginx; ```
Take a look at InSpec, a tool that allows you "turn your compliance, security, and other policy requirements into automated tests." <https://www.inspec.io> It can do all the configuration testing that you need for your Nginx server. Here's one way to test for the existence of the conf file and the value of `server_to...
36,077,108
``` private void btnAssemble_Click(object sender, EventArgs e) { txtAssembled.Text = (cboTitle.Text + txtFirstName.Text[0] + txtMiddle.Text + txtLastName.Text + "\r\n" +txtStreet.Text + "\r\n"+ cboCity.Text); } ``` I'm trying to get 1 character white space inbetween cboTitle.Text, txtFirn...
2016/03/18
[ "https://Stackoverflow.com/questions/36077108", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5650181/" ]
If you just want a space between those specific fields in btnAssemble\_Click, you can just insert them like this: `string myStr = foo + " " + bar + " " + baz;` So your first function would be modified to read: `private void btnAssemble_Click(object sender, EventArgs e) { txtAssembled.Text = (cboTitle.Text + " " + t...
It seems that you want `String.Join`; whenever you want to combine strings with a delimiter, say, `" "` (space) all you need is to put ``` String combined = String.Join(" ", cboTitle.Text, txtFirstName.Text[0], txtMidd...
36,077,108
``` private void btnAssemble_Click(object sender, EventArgs e) { txtAssembled.Text = (cboTitle.Text + txtFirstName.Text[0] + txtMiddle.Text + txtLastName.Text + "\r\n" +txtStreet.Text + "\r\n"+ cboCity.Text); } ``` I'm trying to get 1 character white space inbetween cboTitle.Text, txtFirn...
2016/03/18
[ "https://Stackoverflow.com/questions/36077108", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5650181/" ]
Using String.format() should feet the bill. It also make your code easy to read. ``` txt.assembled.text = String.Format("{0} {1} {2} {3}", cboTitle.Text, txtFirstName.Text[0], txtMiddle.Text, txtLastName.Text ); ```
It seems that you want `String.Join`; whenever you want to combine strings with a delimiter, say, `" "` (space) all you need is to put ``` String combined = String.Join(" ", cboTitle.Text, txtFirstName.Text[0], txtMidd...
36,077,108
``` private void btnAssemble_Click(object sender, EventArgs e) { txtAssembled.Text = (cboTitle.Text + txtFirstName.Text[0] + txtMiddle.Text + txtLastName.Text + "\r\n" +txtStreet.Text + "\r\n"+ cboCity.Text); } ``` I'm trying to get 1 character white space inbetween cboTitle.Text, txtFirn...
2016/03/18
[ "https://Stackoverflow.com/questions/36077108", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5650181/" ]
It would be like this ``` private void btnAssemble_Click(object sender, EventArgs e) { txtAssembled.Text = (cboTitle.Text + " " + txtFirstName.Text[0] + " " +txtMiddle.Text + " " + txtLastName.Text + "\r\n" +txtStreet.Text + "\r\n"+ cboCity.Text); } ```
It seems that you want `String.Join`; whenever you want to combine strings with a delimiter, say, `" "` (space) all you need is to put ``` String combined = String.Join(" ", cboTitle.Text, txtFirstName.Text[0], txtMidd...
11,193,183
I use backbone.js and have a model without a collection. In the view I call fetch on the model with a callback to render the view. ``` this.user.fetch({success: function(d) { self.randomUserView.render() }}) ``` how can I make the view update automatically when the model change? e.g. I don't want to specify the abov...
2012/06/25
[ "https://Stackoverflow.com/questions/11193183", "https://Stackoverflow.com", "https://Stackoverflow.com/users/69636/" ]
On the view, add an event handler to the view's model: ``` initialize: function() { this.model.on('change',this.render,this); } ```
Backbone is event-driven, not callback driven framework (although technically they are callbacks). And your approach does not seem to be native to Backbone. When you do fetch(), user model will automatically trigger "add" event. All you need to do is in the corresponding view add this in initialize: ``` initialize: fu...
11,193,183
I use backbone.js and have a model without a collection. In the view I call fetch on the model with a callback to render the view. ``` this.user.fetch({success: function(d) { self.randomUserView.render() }}) ``` how can I make the view update automatically when the model change? e.g. I don't want to specify the abov...
2012/06/25
[ "https://Stackoverflow.com/questions/11193183", "https://Stackoverflow.com", "https://Stackoverflow.com/users/69636/" ]
On the view, add an event handler to the view's model: ``` initialize: function() { this.model.on('change',this.render,this); } ```
Actually if you want to have a view refresh on fetch on a collection you need to bind RESET! ``` this.model.bind('reset', this.render, this); ``` Update is only fired if the current collection is edited. ps bindAll is dangerous and lazy. (and probably going to cause you problems down the line)
11,193,183
I use backbone.js and have a model without a collection. In the view I call fetch on the model with a callback to render the view. ``` this.user.fetch({success: function(d) { self.randomUserView.render() }}) ``` how can I make the view update automatically when the model change? e.g. I don't want to specify the abov...
2012/06/25
[ "https://Stackoverflow.com/questions/11193183", "https://Stackoverflow.com", "https://Stackoverflow.com/users/69636/" ]
Backbone is event-driven, not callback driven framework (although technically they are callbacks). And your approach does not seem to be native to Backbone. When you do fetch(), user model will automatically trigger "add" event. All you need to do is in the corresponding view add this in initialize: ``` initialize: fu...
Actually if you want to have a view refresh on fetch on a collection you need to bind RESET! ``` this.model.bind('reset', this.render, this); ``` Update is only fired if the current collection is edited. ps bindAll is dangerous and lazy. (and probably going to cause you problems down the line)
11,140,010
I've found a method using reflection (and got it's `MethodInfo`). How can I invoke it without getting `TargetInvocationException` when exceptions are thrown? **Update** I'm creating a command implementation where the commands are handled by classes which implemement ``` public interface ICommandHandler<T> where T : ...
2012/06/21
[ "https://Stackoverflow.com/questions/11140010", "https://Stackoverflow.com", "https://Stackoverflow.com/users/70386/" ]
You can't. That's the specified way that exceptions are propagated by invoking a method via reflection. You can always catch `TargetInvocationException` and then throw the "inner" exception obtained via the [`InnerException`](http://msdn.microsoft.com/en-us/library/system.exception.innerexception.aspx) property, if you...
You can call Invoke on the mehtodinfo instance, but the first argument of the call is the target (The object that the method info belongs to). If you pass this and it has access to call it, you should not get the exception.
11,140,010
I've found a method using reflection (and got it's `MethodInfo`). How can I invoke it without getting `TargetInvocationException` when exceptions are thrown? **Update** I'm creating a command implementation where the commands are handled by classes which implemement ``` public interface ICommandHandler<T> where T : ...
2012/06/21
[ "https://Stackoverflow.com/questions/11140010", "https://Stackoverflow.com", "https://Stackoverflow.com/users/70386/" ]
Create a `Delegate` from the `MethodInfo` (through one of the overloads of [`Delegate.CreateDelegate`](http://msdn.microsoft.com/en-us/library/system.delegate.createdelegate.aspx)) and invoke that instead. This *won't* wrap any exception thrown by the method inside a `TargetInvocationException` like `MethodInfo.Invoke`...
You can call Invoke on the mehtodinfo instance, but the first argument of the call is the target (The object that the method info belongs to). If you pass this and it has access to call it, you should not get the exception.
11,140,010
I've found a method using reflection (and got it's `MethodInfo`). How can I invoke it without getting `TargetInvocationException` when exceptions are thrown? **Update** I'm creating a command implementation where the commands are handled by classes which implemement ``` public interface ICommandHandler<T> where T : ...
2012/06/21
[ "https://Stackoverflow.com/questions/11140010", "https://Stackoverflow.com", "https://Stackoverflow.com/users/70386/" ]
Create a `Delegate` from the `MethodInfo` (through one of the overloads of [`Delegate.CreateDelegate`](http://msdn.microsoft.com/en-us/library/system.delegate.createdelegate.aspx)) and invoke that instead. This *won't* wrap any exception thrown by the method inside a `TargetInvocationException` like `MethodInfo.Invoke`...
You can't. That's the specified way that exceptions are propagated by invoking a method via reflection. You can always catch `TargetInvocationException` and then throw the "inner" exception obtained via the [`InnerException`](http://msdn.microsoft.com/en-us/library/system.exception.innerexception.aspx) property, if you...
63,254,737
I would like a help on my code, it is a menu where the customer must choose three options and quantity, the base of it is done, but I am having difficulties when the customer chooses the same product twice, my code does not add both purchases, but replaces it. For example, the person chooses the second option and 5 of...
2020/08/04
[ "https://Stackoverflow.com/questions/63254737", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14050309/" ]
With reasonable sum limit this problem might be solved using extension of dynamic programming approach for subset sum problem or coin change problem with predetermined number of coins. Note that we can `count` all variants in pseudopolynomial time `O(x*n)`, but output size might grow exponentially, so generation of all...
You should first sort the so called array. Secondly, you should determine if the problem is actually solvable, to save time... So what you do is you take the last k elements and see if the sum of those is larger or equal to the x value, if it is smaller, you are done it is not possible to do something like that.... If ...
63,254,737
I would like a help on my code, it is a menu where the customer must choose three options and quantity, the base of it is done, but I am having difficulties when the customer chooses the same product twice, my code does not add both purchases, but replaces it. For example, the person chooses the second option and 5 of...
2020/08/04
[ "https://Stackoverflow.com/questions/63254737", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14050309/" ]
Here is a complete solution in Python. Translation to C++ is left to the reader. Like the usual subset sum, generation of the doubly linked summary of the solutions is pseudo-polynomial. It is `O(count_values * distinct_sums * depths_of_sums)`. However actually iterating through them can be exponential. But using gene...
You should first sort the so called array. Secondly, you should determine if the problem is actually solvable, to save time... So what you do is you take the last k elements and see if the sum of those is larger or equal to the x value, if it is smaller, you are done it is not possible to do something like that.... If ...
63,254,737
I would like a help on my code, it is a menu where the customer must choose three options and quantity, the base of it is done, but I am having difficulties when the customer chooses the same product twice, my code does not add both purchases, but replaces it. For example, the person chooses the second option and 5 of...
2020/08/04
[ "https://Stackoverflow.com/questions/63254737", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14050309/" ]
With reasonable sum limit this problem might be solved using extension of dynamic programming approach for subset sum problem or coin change problem with predetermined number of coins. Note that we can `count` all variants in pseudopolynomial time `O(x*n)`, but output size might grow exponentially, so generation of all...
A brute force method using recursion might look like this... For example, given variables set, x, k, the following pseudo code might work: ``` setSumStructure find(int[] set, int x, int k, int setIdx) { int sz = set.length - setIdx; if (sz < x) return null; if (sz == x) check sum of set[setIdx] -> set[set.si...
63,254,737
I would like a help on my code, it is a menu where the customer must choose three options and quantity, the base of it is done, but I am having difficulties when the customer chooses the same product twice, my code does not add both purchases, but replaces it. For example, the person chooses the second option and 5 of...
2020/08/04
[ "https://Stackoverflow.com/questions/63254737", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14050309/" ]
Here is a complete solution in Python. Translation to C++ is left to the reader. Like the usual subset sum, generation of the doubly linked summary of the solutions is pseudo-polynomial. It is `O(count_values * distinct_sums * depths_of_sums)`. However actually iterating through them can be exponential. But using gene...
A brute force method using recursion might look like this... For example, given variables set, x, k, the following pseudo code might work: ``` setSumStructure find(int[] set, int x, int k, int setIdx) { int sz = set.length - setIdx; if (sz < x) return null; if (sz == x) check sum of set[setIdx] -> set[set.si...
21,419
For us IIS URL Rewrite module is the way to go. How can sitemanager maintain Urls and publish on demand? Do we need to make an exception in cd deployer to publish it to disk? Before DXA we published Rewrite.config to filesystem and used that file from web.config. With DXA it can be created [like this](http://www....
2021/01/24
[ "https://tridion.stackexchange.com/questions/21419", "https://tridion.stackexchange.com", "https://tridion.stackexchange.com/users/3158/" ]
You can publish the rewrite.config to the broker and extend something like the [URLRewrite.NET](https://github.com/Bikeman868/UrlRewrite.Net) module to load the configuration from the database instead of the filesystem. The cool thing is that you can use it ahead of the DXA Static context module and before DXA starts p...
Please refer to the link from the documentation [link](https://docs.sdl.com/792164/573605/sdl-digital-experience-accelerator-2-0/adding-a-redirect-page) If you still want to manage the redirection you can use the re-write module on IIS web config
21,419
For us IIS URL Rewrite module is the way to go. How can sitemanager maintain Urls and publish on demand? Do we need to make an exception in cd deployer to publish it to disk? Before DXA we published Rewrite.config to filesystem and used that file from web.config. With DXA it can be created [like this](http://www....
2021/01/24
[ "https://tridion.stackexchange.com/questions/21419", "https://tridion.stackexchange.com", "https://tridion.stackexchange.com/users/3158/" ]
You can publish the rewrite.config to the broker and extend something like the [URLRewrite.NET](https://github.com/Bikeman868/UrlRewrite.Net) module to load the configuration from the database instead of the filesystem. The cool thing is that you can use it ahead of the DXA Static context module and before DXA starts p...
We have come across a legacy solution which was maintaining URL redirects and rewrites in a component and publish that as a config file to the file system (you need to configure .config extension in the storage config to publish this to the file system). Here is an issue with this approach: * The config file have it's...
21,412,021
In my database i have a column name called `IsStaff` which has a return value as a bit. So staff in a company can have a illness(1) or that staff had no illness(0). How would i write a sql query that can count all the numbers of 1's and 0's between a specific date's and represent it in a jquery table. This is what i ha...
2014/01/28
[ "https://Stackoverflow.com/questions/21412021", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Why don´t you compute the values in the SQL? ``` SqlCommand command = new SqlCommand(@"SELECT StaffID, Name, sum(IsStaff), sum(case when IsStaff = 1 then 0 else 1 end) From TableName ...
To count all the numbers of 1's and 0's between a specific date's use: ``` SELECT StaffID, count(IsStaff) From TableName WHERE Cast([Time] AS DATE) > @Time AND CAST([Time] AS DATE) < @Time2 GROUP BY StaffID ORDER BY count(IsStaff) desc ``` To get total number of ...
45,860,963
As the title says, I want to remove the `/presta` from my URL. I can access it now with `domain.com/presta` but if I change from `Preferences > SEO & URL > Base URL` as "/", I can't access the site and if I connect to admin panel it's without GUI, just text. Seems a little bit confusing. Thanks in advance, sorry for...
2017/08/24
[ "https://Stackoverflow.com/questions/45860963", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6161289/" ]
The problem is that your `Function1` and `Function2` (horrible names!) return `Unit`, and `getValue` is declared to return a `String` A declaration of a function looks like `def functionName(args): ReturnType = { ... }` Some parts of this can be omitted, and then defaults are assumed. In your case, you omitted the `...
Function1 and Function2 should return strings. Also, you cannot use println, since the result of it is Unit, in this case, you can throw an exception: ``` def getValue(x: Any):Unit = x match { case "Value1"=> function1(1) case "Value2"=> function2(2) case _ => throw new IllegalArgumentException("This is ...
15,363,595
I'm practicing ACM problems to become a better programmer, but I'm still fairly new to c++ and I'm having trouble interpreting some of the judges code I'm reading. The beginning of a class starts with ``` public: State(int n) : _n(n), _p(2*n+1) { ``` and then later it's initialized with ``` State s(n); s(0,0...
2013/03/12
[ "https://Stackoverflow.com/questions/15363595", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1874415/" ]
You are confusing a call to `state::operator()(int, int)` with an initialization. That operator call lets you set the value of an element of the class instance. ``` State s(n); // this is the only initialization s(0,0) = 1; // this calls operator()(int, int) on instance s ```
In this line: ``` s(0,0) = 1; ``` it's calling this: ``` double& operator()(int i, int m) ``` and because it returns a reference to a double, you can assign to it.
15,363,595
I'm practicing ACM problems to become a better programmer, but I'm still fairly new to c++ and I'm having trouble interpreting some of the judges code I'm reading. The beginning of a class starts with ``` public: State(int n) : _n(n), _p(2*n+1) { ``` and then later it's initialized with ``` State s(n); s(0,0...
2013/03/12
[ "https://Stackoverflow.com/questions/15363595", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1874415/" ]
You are confusing a call to `state::operator()(int, int)` with an initialization. That operator call lets you set the value of an element of the class instance. ``` State s(n); // this is the only initialization s(0,0) = 1; // this calls operator()(int, int) on instance s ```
The second line is no longer initialization. The constructor was invoked in line 1, the second line invokes > > double& operator()(int i, int m) > > > with n=0 and m=0 and writing 1 to the reference that is returned.