qid int64 1 74.7M | question stringlengths 15 58.3k | date stringlengths 10 10 | metadata list | response_j stringlengths 4 30.2k | response_k stringlengths 11 36.5k |
|---|---|---|---|---|---|
9,074,585 | I have the following image ontop of an image that is exactly 424x318

And it is wrapped in a div that is 444x338.
And I have a "cropping tool" (the circle center piece) that is 185x185, BUT can resize to be a minimum of 50x50 and a max of about 300x300 (depending on pl... | 2012/01/31 | [
"https://Stackoverflow.com/questions/9074585",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/150062/"
] | I think a custom target is what you are looking for: [add\_custom\_target](http://www.cmake.org/cmake/help/v2.8.8/cmake.html#command:add_custom_target)
From the documentation:
>
> Add a target with no output so it will always be built.
>
>
>
Or if you are generating a code file,
<https://cmake.org/cmake/help/v... | This is afaik not possible with CMake, and is therefore ***a missing feature*** for sure.
The answer from Tarydon in the question you refer to, is about setting up precisely what you want - a "**Custom Build Step**". This means that you still only have your main target (VS Project), with something that looks like a "*... |
46,386,407 | Bit of a long post, but I'm having difficulty trying to make this program read through the entirety of a text file instead of what it seems like just the first line.
```
// return true only if the code is valid
bool PriceList::isValid(string code) const {
ifstream myfile;
string line;
myfile.open("priceli... | 2017/09/24 | [
"https://Stackoverflow.com/questions/46386407",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8663188/"
] | Both these cases are problematic.
>
> `if (lhs == null || rhs == null) return 0;`
>
>
>
If you have `[123, null, 234]`, then you compare `123` as equal to `null`, `null` as equal to `234`, and by transitivity you should get `123` equals `234`. But that is not what your comparator returns.
The solution here would... | The "general contract" of the comparison method is well documented in the javadoc of the [`compare(T o1, T o2)`](https://docs.oracle.com/javase/8/docs/api/java/util/Comparator.html#compare-T-T-) method:
>
> The implementor must ensure that `sgn(compare(x, y)) == -sgn(compare(y, x))` for all `x` and `y`. (This implies... |
182,481 | I go to
<http://www.tug.dk/FontCatalogue/>
to browse for a suitable font.
Most of them don't seem to work with pdftex. For example
<http://www.tug.dk/FontCatalogue/inslrmaj/>
I download the sample .tex, the `inslrmaj` package loads without error. I get two errors that can be resolved by commenting out:
```
\input... | 2014/05/31 | [
"https://tex.stackexchange.com/questions/182481",
"https://tex.stackexchange.com",
"https://tex.stackexchange.com/users/19311/"
] | For example, here's a simplified version of the sample TeX file:
```
\documentclass{article}
\usepackage{inslrmaj, kantlipsum}
\usepackage[T1]{fontenc}
\begin{document}
\normalfont\imajfamily
\kant[1]
\end{document}
```
 | `\input catalog` inserts the text listed on the webpage and `\input testfont` prints the font table. Both can be done from within a test document. A solution which uses the package `fonttable` instead:
```
\documentclass[danish,a4paper,11pt]{scrartcl}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage{slantsc}... |
546,461 | Is it possible to redirect to a different view from a controller?
For example, all my controllers inherit from a custom controller that has a constructor that I want to redirect to different view if certain criteria is not met.
Hope that makes sense. | 2009/02/13 | [
"https://Stackoverflow.com/questions/546461",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/66058/"
] | Here's what you can do:
```
return View("another view name", anotherviewmodel);
``` | ```cs
return RedirectToAction("index");
```
This is how I use it in the controller and actionresult that needs to be redirected. |
546,461 | Is it possible to redirect to a different view from a controller?
For example, all my controllers inherit from a custom controller that has a constructor that I want to redirect to different view if certain criteria is not met.
Hope that makes sense. | 2009/02/13 | [
"https://Stackoverflow.com/questions/546461",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/66058/"
] | You can use the `RedirectToAction()` method, then the action you redirect to can return a View. The easiest way to do this is:
```
return RedirectToAction("Index", model);
```
Then in your Index method, return the view you want. | ```
if (true)
{
return View();
}
else
{
return View("another view name");
}
``` |
546,461 | Is it possible to redirect to a different view from a controller?
For example, all my controllers inherit from a custom controller that has a constructor that I want to redirect to different view if certain criteria is not met.
Hope that makes sense. | 2009/02/13 | [
"https://Stackoverflow.com/questions/546461",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/66058/"
] | The simplest way is use return View.
```
return View("ViewName");
```
Remember, the physical name of the "ViewName" should be something like ViewName.cshtml in your project, if your are using MVC C# / .NET. | Here's what you can do:
```
return View("another view name", anotherviewmodel);
``` |
546,461 | Is it possible to redirect to a different view from a controller?
For example, all my controllers inherit from a custom controller that has a constructor that I want to redirect to different view if certain criteria is not met.
Hope that makes sense. | 2009/02/13 | [
"https://Stackoverflow.com/questions/546461",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/66058/"
] | The simplest way is use return View.
```
return View("ViewName");
```
Remember, the physical name of the "ViewName" should be something like ViewName.cshtml in your project, if your are using MVC C# / .NET. | ```cs
return RedirectToAction("index");
```
This is how I use it in the controller and actionresult that needs to be redirected. |
546,461 | Is it possible to redirect to a different view from a controller?
For example, all my controllers inherit from a custom controller that has a constructor that I want to redirect to different view if certain criteria is not met.
Hope that makes sense. | 2009/02/13 | [
"https://Stackoverflow.com/questions/546461",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/66058/"
] | ```
if (true)
{
return View();
}
else
{
return View("another view name");
}
``` | ```cs
return RedirectToAction("index");
```
This is how I use it in the controller and actionresult that needs to be redirected. |
546,461 | Is it possible to redirect to a different view from a controller?
For example, all my controllers inherit from a custom controller that has a constructor that I want to redirect to different view if certain criteria is not met.
Hope that makes sense. | 2009/02/13 | [
"https://Stackoverflow.com/questions/546461",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/66058/"
] | The simplest way is use return View.
```
return View("ViewName");
```
Remember, the physical name of the "ViewName" should be something like ViewName.cshtml in your project, if your are using MVC C# / .NET. | I am not 100% sure what the conditions are for this, but for me the above didn't work directly, thought it got close. I think it was because I needed "id" for my view by in the model it was called "ObjectID".
I had a model with a variety of pieces of information. I just needed the id.
Before the above I created a new... |
546,461 | Is it possible to redirect to a different view from a controller?
For example, all my controllers inherit from a custom controller that has a constructor that I want to redirect to different view if certain criteria is not met.
Hope that makes sense. | 2009/02/13 | [
"https://Stackoverflow.com/questions/546461",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/66058/"
] | ```
if (true)
{
return View();
}
else
{
return View("another view name");
}
``` | The simplest way is use return View.
```
return View("ViewName");
```
Remember, the physical name of the "ViewName" should be something like ViewName.cshtml in your project, if your are using MVC C# / .NET. |
546,461 | Is it possible to redirect to a different view from a controller?
For example, all my controllers inherit from a custom controller that has a constructor that I want to redirect to different view if certain criteria is not met.
Hope that makes sense. | 2009/02/13 | [
"https://Stackoverflow.com/questions/546461",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/66058/"
] | You can use the `RedirectToAction()` method, then the action you redirect to can return a View. The easiest way to do this is:
```
return RedirectToAction("Index", model);
```
Then in your Index method, return the view you want. | I am not 100% sure what the conditions are for this, but for me the above didn't work directly, thought it got close. I think it was because I needed "id" for my view by in the model it was called "ObjectID".
I had a model with a variety of pieces of information. I just needed the id.
Before the above I created a new... |
546,461 | Is it possible to redirect to a different view from a controller?
For example, all my controllers inherit from a custom controller that has a constructor that I want to redirect to different view if certain criteria is not met.
Hope that makes sense. | 2009/02/13 | [
"https://Stackoverflow.com/questions/546461",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/66058/"
] | You can use the `RedirectToAction()` method, then the action you redirect to can return a View. The easiest way to do this is:
```
return RedirectToAction("Index", model);
```
Then in your Index method, return the view you want. | The simplest way is use return View.
```
return View("ViewName");
```
Remember, the physical name of the "ViewName" should be something like ViewName.cshtml in your project, if your are using MVC C# / .NET. |
546,461 | Is it possible to redirect to a different view from a controller?
For example, all my controllers inherit from a custom controller that has a constructor that I want to redirect to different view if certain criteria is not met.
Hope that makes sense. | 2009/02/13 | [
"https://Stackoverflow.com/questions/546461",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/66058/"
] | ```
if (true)
{
return View();
}
else
{
return View("another view name");
}
``` | I am not 100% sure what the conditions are for this, but for me the above didn't work directly, thought it got close. I think it was because I needed "id" for my view by in the model it was called "ObjectID".
I had a model with a variety of pieces of information. I just needed the id.
Before the above I created a new... |
14,856,714 | Consider this code:
```
var weakRef = new WeakReference(new StringBuilder("Mehran"));
if (weakRef.IsAlive)
{
// Garbage Collection might happen.
Console.WriteLine((weakRef.Target as StringBuilder).ToString());
}
```
It's possible for `GC.Collect` to run after checking `weakRef.IsAlive` and before using the `... | 2013/02/13 | [
"https://Stackoverflow.com/questions/14856714",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1831530/"
] | That API already exists; `weakRef.Target` returns `null` if the object has already been garbage collected.
```
StringBuilder sb = weakRef.Target as StringBuilder;
if (sb != null)
{
Console.WriteLine(sb.ToString());
}
``` | Take a local copy of the target and check for null.
`WeakReference.Target` will return `null` if the target has been collected but you're concern is that it's collected between your `.IsAlive` check and getting the target.
```
var weakRef = new WeakReference(new StringBuilder("Mehran"));
if (weakRef.IsAlive)
{
v... |
14,856,714 | Consider this code:
```
var weakRef = new WeakReference(new StringBuilder("Mehran"));
if (weakRef.IsAlive)
{
// Garbage Collection might happen.
Console.WriteLine((weakRef.Target as StringBuilder).ToString());
}
```
It's possible for `GC.Collect` to run after checking `weakRef.IsAlive` and before using the `... | 2013/02/13 | [
"https://Stackoverflow.com/questions/14856714",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1831530/"
] | That API already exists; `weakRef.Target` returns `null` if the object has already been garbage collected.
```
StringBuilder sb = weakRef.Target as StringBuilder;
if (sb != null)
{
Console.WriteLine(sb.ToString());
}
``` | The `IsAlive` property does not exist for the benefit of code which will want to use the target if it is alive, but rather for the benefit of code which wants to find out if the target has died but wouldn't be interested in accessing it in any case. If code were to test `Target` against null, that would cause `Target` ... |
14,856,714 | Consider this code:
```
var weakRef = new WeakReference(new StringBuilder("Mehran"));
if (weakRef.IsAlive)
{
// Garbage Collection might happen.
Console.WriteLine((weakRef.Target as StringBuilder).ToString());
}
```
It's possible for `GC.Collect` to run after checking `weakRef.IsAlive` and before using the `... | 2013/02/13 | [
"https://Stackoverflow.com/questions/14856714",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1831530/"
] | That API already exists; `weakRef.Target` returns `null` if the object has already been garbage collected.
```
StringBuilder sb = weakRef.Target as StringBuilder;
if (sb != null)
{
Console.WriteLine(sb.ToString());
}
``` | I believe what you are looking for is `TryGetValue`. Your code should look like:
```
var weakRef = new WeakReference(new StringBuilder("Mehran"));
if (weakRef.TryGetValue(out StringBuilder sb)
{
Console.WriteLine(sb.ToString());
}
``` |
14,856,714 | Consider this code:
```
var weakRef = new WeakReference(new StringBuilder("Mehran"));
if (weakRef.IsAlive)
{
// Garbage Collection might happen.
Console.WriteLine((weakRef.Target as StringBuilder).ToString());
}
```
It's possible for `GC.Collect` to run after checking `weakRef.IsAlive` and before using the `... | 2013/02/13 | [
"https://Stackoverflow.com/questions/14856714",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1831530/"
] | The `IsAlive` property does not exist for the benefit of code which will want to use the target if it is alive, but rather for the benefit of code which wants to find out if the target has died but wouldn't be interested in accessing it in any case. If code were to test `Target` against null, that would cause `Target` ... | Take a local copy of the target and check for null.
`WeakReference.Target` will return `null` if the target has been collected but you're concern is that it's collected between your `.IsAlive` check and getting the target.
```
var weakRef = new WeakReference(new StringBuilder("Mehran"));
if (weakRef.IsAlive)
{
v... |
14,856,714 | Consider this code:
```
var weakRef = new WeakReference(new StringBuilder("Mehran"));
if (weakRef.IsAlive)
{
// Garbage Collection might happen.
Console.WriteLine((weakRef.Target as StringBuilder).ToString());
}
```
It's possible for `GC.Collect` to run after checking `weakRef.IsAlive` and before using the `... | 2013/02/13 | [
"https://Stackoverflow.com/questions/14856714",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1831530/"
] | Take a local copy of the target and check for null.
`WeakReference.Target` will return `null` if the target has been collected but you're concern is that it's collected between your `.IsAlive` check and getting the target.
```
var weakRef = new WeakReference(new StringBuilder("Mehran"));
if (weakRef.IsAlive)
{
v... | I believe what you are looking for is `TryGetValue`. Your code should look like:
```
var weakRef = new WeakReference(new StringBuilder("Mehran"));
if (weakRef.TryGetValue(out StringBuilder sb)
{
Console.WriteLine(sb.ToString());
}
``` |
14,856,714 | Consider this code:
```
var weakRef = new WeakReference(new StringBuilder("Mehran"));
if (weakRef.IsAlive)
{
// Garbage Collection might happen.
Console.WriteLine((weakRef.Target as StringBuilder).ToString());
}
```
It's possible for `GC.Collect` to run after checking `weakRef.IsAlive` and before using the `... | 2013/02/13 | [
"https://Stackoverflow.com/questions/14856714",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1831530/"
] | The `IsAlive` property does not exist for the benefit of code which will want to use the target if it is alive, but rather for the benefit of code which wants to find out if the target has died but wouldn't be interested in accessing it in any case. If code were to test `Target` against null, that would cause `Target` ... | I believe what you are looking for is `TryGetValue`. Your code should look like:
```
var weakRef = new WeakReference(new StringBuilder("Mehran"));
if (weakRef.TryGetValue(out StringBuilder sb)
{
Console.WriteLine(sb.ToString());
}
``` |
42,597,962 | When I run the shell doctrine:cache:clear-metadata for my project by symfony the redis key is very very big, the comment is
```
php app/frontend/console doctrine:cache:clear-metadata
```
the entity is cache by redis.but when I see the redis data by redis-cli . I find old metadata is exists. so , I think the cache ... | 2017/03/04 | [
"https://Stackoverflow.com/questions/42597962",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6800425/"
] | I see that this is not a new post but better later than never. The only thing that you need to do is to add --flush flag to your command:
```
php app/frontend/console doctrine:cache:clear-metadata --flush
```
That will delete the keys in the Redis database. If you are using more than 1 database and your entities are... | You could try running a similar script from the command line.
```
<?php
$redis = new Redis();
$redis->connect('127.0.0.1', 6379);
$keys = $redis->keys("*");
foreach ($keys as $key) {
echo $key ."\n";
$redis->del($key);
}
```
It might remove more than what is needed but it's been very useful to me.
For the... |
11,579,369 | How to remove random rows of zero quantities (all in string types) of a multiple array in C#? Coded please! :))
Ex: index Code,Color, Quantities, RetailPrice, WholeSalePrice
```
0 1002, red, 0, 150, 100
1 1003, blue, 0, 160, 100
2 1004, yellow, 3, 180, 130
3 1004, green, 6, 140, 103
4 1008, pink, 8, 200, 140
5 1008,... | 2012/07/20 | [
"https://Stackoverflow.com/questions/11579369",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1540696/"
] | If you are saying that the Matlab implementation is good because its results match the result for that frequency of a DFT or FFT of your data, then it's probably because the Matlab implementation is normalizing the results by a scaling factor as is done with the FFT.
Change your code to take this into account and see ... | Often you can just use the square of the magnitude in your computations,
for example for tone detection.
Some excellent examples of Goertzels are in the Asterisk PBX DSP code
[Asterisk DSP code (dsp.c)](http://www.asterisk.org/)
and in the spandsp library [SPANDSP DSP Library](http://www.soft-switch.org/downloads/spa... |
11,579,369 | How to remove random rows of zero quantities (all in string types) of a multiple array in C#? Coded please! :))
Ex: index Code,Color, Quantities, RetailPrice, WholeSalePrice
```
0 1002, red, 0, 150, 100
1 1003, blue, 0, 160, 100
2 1004, yellow, 3, 180, 130
3 1004, green, 6, 140, 103
4 1008, pink, 8, 200, 140
5 1008,... | 2012/07/20 | [
"https://Stackoverflow.com/questions/11579369",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1540696/"
] | If you are saying that the Matlab implementation is good because its results match the result for that frequency of a DFT or FFT of your data, then it's probably because the Matlab implementation is normalizing the results by a scaling factor as is done with the FFT.
Change your code to take this into account and see ... | Consider two input sample wave-forms:
1) a sine wave with amplitude A and frequency W
2) a cosine wave with the same amplitude and frequency A and W
Goertzel algorithm should yield the same results for two mentioned input wave-forms but the provided code results in different return values. I think the code should be... |
176,511 | Could you explain the term **lameduck** in this passage? Are the words **patronize**, **compassion** or **help** similar or different in this context?
Does **lameduck** have an opposite meaning (negative verb) as **lame**?
>
> Violence and force are wrong. If I use violence I descend to his
> level. It means that... | 2018/08/17 | [
"https://ell.stackexchange.com/questions/176511",
"https://ell.stackexchange.com",
"https://ell.stackexchange.com/users/80300/"
] | It seems to only be used this way in this book. But it is just a coined word taken from the noun "lame duck" and turned into a verb.
As a noun, a "lame duck" is literally an injured duck who cannot walk (waddle) or walks poorly because it is hurt and in pain.
**When seeing a "lame duck" or any injured small animal i... | From my point of view the general meaning of Lameducking is - forced restriction of free will. |
176,511 | Could you explain the term **lameduck** in this passage? Are the words **patronize**, **compassion** or **help** similar or different in this context?
Does **lameduck** have an opposite meaning (negative verb) as **lame**?
>
> Violence and force are wrong. If I use violence I descend to his
> level. It means that... | 2018/08/17 | [
"https://ell.stackexchange.com/questions/176511",
"https://ell.stackexchange.com",
"https://ell.stackexchange.com/users/80300/"
] | Following on [Jay A. Little](https://ell.stackexchange.com/users/67206/jay-a-little)'s excellent definition of lameduck in the answer above.
>
> As a noun, a "lame duck" is literally an injured duck who cannot walk (waddle) or walks poorly because it is hurt and in pain.
>
>
> When seeing a "lame duck" or any injur... | From my point of view the general meaning of Lameducking is - forced restriction of free will. |
44,088,682 | ```
#include <iostream>
#define DEF(A) #A
int main()
{
std::cout << DEF(qwer) << std::endl; //prints: qwer
std::cout << DEF("qwer") << std::endl; //prints: "qwer"
std::cout << DEF("qwer) << std::endl; //error, but I want to print "qwer without a second quote
}
```
How to pass an argument with only one q... | 2017/05/20 | [
"https://Stackoverflow.com/questions/44088682",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3514538/"
] | You can't do that.
The preprocessor has much, much less requirements on syntax than the compiler, but what you're feeding it still has to be a series of valid tokens, and an unterminated string literal is not a valid token. | If your system uses ASCII / ISO 8859-k as its single-byte encoding -- which is not fully portable but exceptions are pretty uncommon these days -- then you could write:
```
std::cout << DEF(\x22qwer) << std::endl;
```
Note that the apparently similar
```
std::cout << DEF(\u0022qwer) << std::endl;
```
will not wor... |
16,491,486 | The following lines are part from my really "useless" C++ program... which is calculating powers of 2 only up to 2^63 instead of 2^128 "which is being asked" due to the length of the "unsigned long long" variable which is proposed for numbers with 15 digits accuracy...!!!
Just that....I need a 16 bytes or more variabl... | 2013/05/10 | [
"https://Stackoverflow.com/questions/16491486",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2371531/"
] | SSE and AVX intrinsics go up to 256 bytes, given a modern CPU. They're named `__m128i` and `__m256i`. | 128 bit integer is a really big integer. You should implement your own data type. You can create an array of `short`s, store there numbers (digits) and implement multiplying, just like you do in your math notebook, that's probably the simplest approach.
` to output to ostream's, but if all you want to do is print out powers of 2 to a console or text string, and you don't need to actually do "bigint" math (except to compute those powers-of-2), there's a simpler approach that will give you powe... | 128 bit integer is a really big integer. You should implement your own data type. You can create an array of `short`s, store there numbers (digits) and implement multiplying, just like you do in your math notebook, that's probably the simplest approach.
{
return Test_PASSED
}
else{
return Test_FAIL... | 2013/06/11 | [
"https://Stackoverflow.com/questions/17047460",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2475077/"
] | You have to suffix `float` constants with `f`. I assume your variable `rms` is of type `float`. Because, constant `0.001` will implicitly have `double` type precision.
If I'm correct the following should work.
```
if(rms <0.001f){
return TestPassed
}
else{
return testFailed
}
``` | The original question didn't specify what `Test_PASSED` or `Test_FAILED` are. But one possible bug was that they were accidentally set to the same thing.
Another possible bug is the way that they're being tested, e.g. confusion between `==` and `=`. |
17,047,460 | I am wondering why this piece of code is not working properly. Rms is the value calculated by some processing and comes out to be 0.000146 and I want to see the result as Test passed, but I get test failed. What is wrong any suggestions?
```
If(rms <0.001){
return Test_PASSED
}
else{
return Test_FAIL... | 2013/06/11 | [
"https://Stackoverflow.com/questions/17047460",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2475077/"
] | You have to suffix `float` constants with `f`. I assume your variable `rms` is of type `float`. Because, constant `0.001` will implicitly have `double` type precision.
If I'm correct the following should work.
```
if(rms <0.001f){
return TestPassed
}
else{
return testFailed
}
``` | The if is written with upper case i, this is incorrect. Statements inside the if block are not finished with ;
The code should have been
```
if (rms < 0.001) {
return TestPassed;
}
else {
return testFailed;
}
```
Still, it's not clear what TestPassed and testFailed are - you copied an incomplete piece of co... |
16,845,605 | I have a need for inheriting scope from a parent controller in a directive. I don't necessarily want to leave scope: false. I also don't necessarily want to use an isolated scope, because it requires a lot of work to get the values I do care about linked properly (think lots of values in a parent controller).
Does it ... | 2013/05/30 | [
"https://Stackoverflow.com/questions/16845605",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1119895/"
] | Although @user1737909 already referenced the SO question to read ([What are the nuances of scope prototypal / prototypical inheritance in AngularJS?](https://stackoverflow.com/questions/14049480/what-are-the-nuances-of-scope-prototypal-prototypical-inheritance-in-angularjs), which will explain the problem and recommend... | Scope inheritance is not meaning setting the value of a child is setting the value of its parent.
Instead of doing `scope.name = newName` on the child scope, add a method to the parent scope, which will do the same job but on the parent scope, and call it from the child scope since the child inherits this method. |
16,845,605 | I have a need for inheriting scope from a parent controller in a directive. I don't necessarily want to leave scope: false. I also don't necessarily want to use an isolated scope, because it requires a lot of work to get the values I do care about linked properly (think lots of values in a parent controller).
Does it ... | 2013/05/30 | [
"https://Stackoverflow.com/questions/16845605",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1119895/"
] | Scope inheritance is not meaning setting the value of a child is setting the value of its parent.
Instead of doing `scope.name = newName` on the child scope, add a method to the parent scope, which will do the same job but on the parent scope, and call it from the child scope since the child inherits this method. | Within your link function you would write to the parent scope(the global "$scope" scope) like so: scope.$parent.name = newName; |
16,845,605 | I have a need for inheriting scope from a parent controller in a directive. I don't necessarily want to leave scope: false. I also don't necessarily want to use an isolated scope, because it requires a lot of work to get the values I do care about linked properly (think lots of values in a parent controller).
Does it ... | 2013/05/30 | [
"https://Stackoverflow.com/questions/16845605",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1119895/"
] | Although @user1737909 already referenced the SO question to read ([What are the nuances of scope prototypal / prototypical inheritance in AngularJS?](https://stackoverflow.com/questions/14049480/what-are-the-nuances-of-scope-prototypal-prototypical-inheritance-in-angularjs), which will explain the problem and recommend... | Within your link function you would write to the parent scope(the global "$scope" scope) like so: scope.$parent.name = newName; |
3,352,492 | **I am looking for some intuitive explanation based on the geometric transformation in 2D or 3D space.**
In general, for two matrices $A$ and $B$, $AB \neq BA$, i.e., the matrix product isn't commutative. This is sort of intuitive because the end result of two successive transformations, in general, depends on the ord... | 2019/09/11 | [
"https://math.stackexchange.com/questions/3352492",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/119034/"
] | Because, for all $x\in(-\infty, -2)\cup (0,\infty)$, $\sqrt{x^2+2x}=\lvert x\rvert\sqrt{1+\frac2x}$, as opposed to your suggestion $x\sqrt{1+\frac2x}$. | You are not dividing both the numerator and denominator by $x$, but by $|x|$(that is, $\sqrt{x^2}$). |
3,352,492 | **I am looking for some intuitive explanation based on the geometric transformation in 2D or 3D space.**
In general, for two matrices $A$ and $B$, $AB \neq BA$, i.e., the matrix product isn't commutative. This is sort of intuitive because the end result of two successive transformations, in general, depends on the ord... | 2019/09/11 | [
"https://math.stackexchange.com/questions/3352492",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/119034/"
] | I think you have done the following steps:
$ \frac{\sqrt{x^2+2x}}{x}= \sqrt{\frac{x^2+2x}{x^2}}.$
But this is only valid for $x>0$, since $ \sqrt{x^2}=|x|.$ | You are not dividing both the numerator and denominator by $x$, but by $|x|$(that is, $\sqrt{x^2}$). |
3,352,492 | **I am looking for some intuitive explanation based on the geometric transformation in 2D or 3D space.**
In general, for two matrices $A$ and $B$, $AB \neq BA$, i.e., the matrix product isn't commutative. This is sort of intuitive because the end result of two successive transformations, in general, depends on the ord... | 2019/09/11 | [
"https://math.stackexchange.com/questions/3352492",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/119034/"
] | Because, for all $x\in(-\infty, -2)\cup (0,\infty)$, $\sqrt{x^2+2x}=\lvert x\rvert\sqrt{1+\frac2x}$, as opposed to your suggestion $x\sqrt{1+\frac2x}$. | I think you have done the following steps:
$ \frac{\sqrt{x^2+2x}}{x}= \sqrt{\frac{x^2+2x}{x^2}}.$
But this is only valid for $x>0$, since $ \sqrt{x^2}=|x|.$ |
3,352,492 | **I am looking for some intuitive explanation based on the geometric transformation in 2D or 3D space.**
In general, for two matrices $A$ and $B$, $AB \neq BA$, i.e., the matrix product isn't commutative. This is sort of intuitive because the end result of two successive transformations, in general, depends on the ord... | 2019/09/11 | [
"https://math.stackexchange.com/questions/3352492",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/119034/"
] | Because, for all $x\in(-\infty, -2)\cup (0,\infty)$, $\sqrt{x^2+2x}=\lvert x\rvert\sqrt{1+\frac2x}$, as opposed to your suggestion $x\sqrt{1+\frac2x}$. | By forcibly putting $\frac1x$ into the square root, you need to consider $\pm\sqrt{\frac{1}{x^2}}$.
Otherwise, the below is correct:
$$f(x)=\frac{x}{\sqrt{x^2+2x}}=\frac{1}{\frac1x\sqrt{x^2+2x}}.$$ |
3,352,492 | **I am looking for some intuitive explanation based on the geometric transformation in 2D or 3D space.**
In general, for two matrices $A$ and $B$, $AB \neq BA$, i.e., the matrix product isn't commutative. This is sort of intuitive because the end result of two successive transformations, in general, depends on the ord... | 2019/09/11 | [
"https://math.stackexchange.com/questions/3352492",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/119034/"
] | I think you have done the following steps:
$ \frac{\sqrt{x^2+2x}}{x}= \sqrt{\frac{x^2+2x}{x^2}}.$
But this is only valid for $x>0$, since $ \sqrt{x^2}=|x|.$ | By forcibly putting $\frac1x$ into the square root, you need to consider $\pm\sqrt{\frac{1}{x^2}}$.
Otherwise, the below is correct:
$$f(x)=\frac{x}{\sqrt{x^2+2x}}=\frac{1}{\frac1x\sqrt{x^2+2x}}.$$ |
4,621,795 | When working on code from multiple authors, I often encounter the issue of curly-brace preference (same line vs new line). Is it good/bad practice or even a non-issue when it comes to matching the existing style vs using your own preference?
Does the situation change if you are adding new code to a Class vs modifying ... | 2011/01/07 | [
"https://Stackoverflow.com/questions/4621795",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/322939/"
] | Generally speaking, inconsistently formatted code will be more difficult to read and understand than code formatted in a style other than your own.
When working on an open source project, it is considered polite to match the style in use. For code you won't be sharing, either follow the style or run all the existing c... | Try to talk with your coworkers and decide on a consistent style. Once you do that, write all new code in that style and convert old code if necessary. This is an issue specific to the project and the people working on it.
On the rare occasion that you can't come to a consensus, I wouldn't worry too much; there are f... |
4,621,795 | When working on code from multiple authors, I often encounter the issue of curly-brace preference (same line vs new line). Is it good/bad practice or even a non-issue when it comes to matching the existing style vs using your own preference?
Does the situation change if you are adding new code to a Class vs modifying ... | 2011/01/07 | [
"https://Stackoverflow.com/questions/4621795",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/322939/"
] | Generally speaking, inconsistently formatted code will be more difficult to read and understand than code formatted in a style other than your own.
When working on an open source project, it is considered polite to match the style in use. For code you won't be sharing, either follow the style or run all the existing c... | It does not matter (code wise) where you place the curly braces, it is just a matter of preference. More experienced coders tend to put it on the same line, but I like to put it on the next line because it helps me see blocks of code easier. If you wish coding conventions to go as far as curly braces, then consult your... |
4,621,795 | When working on code from multiple authors, I often encounter the issue of curly-brace preference (same line vs new line). Is it good/bad practice or even a non-issue when it comes to matching the existing style vs using your own preference?
Does the situation change if you are adding new code to a Class vs modifying ... | 2011/01/07 | [
"https://Stackoverflow.com/questions/4621795",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/322939/"
] | If you will be sharing this, match his style for consistency. If not, do what you find comfortable. I personally prefer your style. | There is nothing that irks me more than perusing code and finding numerous mismatched styles sprinkled throughout. If you are going to collaborate with someone on a program, than either explicit or implicit, standards should be used. Something as simple as a curly brace doesn't matter in the least, but when your projec... |
4,621,795 | When working on code from multiple authors, I often encounter the issue of curly-brace preference (same line vs new line). Is it good/bad practice or even a non-issue when it comes to matching the existing style vs using your own preference?
Does the situation change if you are adding new code to a Class vs modifying ... | 2011/01/07 | [
"https://Stackoverflow.com/questions/4621795",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/322939/"
] | It matters a great deal if a lot of code has been checked into a version control system. There will be a lot of noisy change in the history for a mere brace style change. I wouldn't do it for its own sake. You're in Rome.... | It does not matter (code wise) where you place the curly braces, it is just a matter of preference. More experienced coders tend to put it on the same line, but I like to put it on the next line because it helps me see blocks of code easier. If you wish coding conventions to go as far as curly braces, then consult your... |
4,621,795 | When working on code from multiple authors, I often encounter the issue of curly-brace preference (same line vs new line). Is it good/bad practice or even a non-issue when it comes to matching the existing style vs using your own preference?
Does the situation change if you are adding new code to a Class vs modifying ... | 2011/01/07 | [
"https://Stackoverflow.com/questions/4621795",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/322939/"
] | Generally speaking, inconsistently formatted code will be more difficult to read and understand than code formatted in a style other than your own.
When working on an open source project, it is considered polite to match the style in use. For code you won't be sharing, either follow the style or run all the existing c... | There is nothing that irks me more than perusing code and finding numerous mismatched styles sprinkled throughout. If you are going to collaborate with someone on a program, than either explicit or implicit, standards should be used. Something as simple as a curly brace doesn't matter in the least, but when your projec... |
4,621,795 | When working on code from multiple authors, I often encounter the issue of curly-brace preference (same line vs new line). Is it good/bad practice or even a non-issue when it comes to matching the existing style vs using your own preference?
Does the situation change if you are adding new code to a Class vs modifying ... | 2011/01/07 | [
"https://Stackoverflow.com/questions/4621795",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/322939/"
] | Generally speaking, inconsistently formatted code will be more difficult to read and understand than code formatted in a style other than your own.
When working on an open source project, it is considered polite to match the style in use. For code you won't be sharing, either follow the style or run all the existing c... | If you will be sharing this, match his style for consistency. If not, do what you find comfortable. I personally prefer your style. |
4,621,795 | When working on code from multiple authors, I often encounter the issue of curly-brace preference (same line vs new line). Is it good/bad practice or even a non-issue when it comes to matching the existing style vs using your own preference?
Does the situation change if you are adding new code to a Class vs modifying ... | 2011/01/07 | [
"https://Stackoverflow.com/questions/4621795",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/322939/"
] | If you will be sharing this, match his style for consistency. If not, do what you find comfortable. I personally prefer your style. | It does not matter (code wise) where you place the curly braces, it is just a matter of preference. More experienced coders tend to put it on the same line, but I like to put it on the next line because it helps me see blocks of code easier. If you wish coding conventions to go as far as curly braces, then consult your... |
4,621,795 | When working on code from multiple authors, I often encounter the issue of curly-brace preference (same line vs new line). Is it good/bad practice or even a non-issue when it comes to matching the existing style vs using your own preference?
Does the situation change if you are adding new code to a Class vs modifying ... | 2011/01/07 | [
"https://Stackoverflow.com/questions/4621795",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/322939/"
] | Generally speaking, inconsistently formatted code will be more difficult to read and understand than code formatted in a style other than your own.
When working on an open source project, it is considered polite to match the style in use. For code you won't be sharing, either follow the style or run all the existing c... | It matters a great deal if a lot of code has been checked into a version control system. There will be a lot of noisy change in the history for a mere brace style change. I wouldn't do it for its own sake. You're in Rome.... |
4,621,795 | When working on code from multiple authors, I often encounter the issue of curly-brace preference (same line vs new line). Is it good/bad practice or even a non-issue when it comes to matching the existing style vs using your own preference?
Does the situation change if you are adding new code to a Class vs modifying ... | 2011/01/07 | [
"https://Stackoverflow.com/questions/4621795",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/322939/"
] | It matters a great deal if a lot of code has been checked into a version control system. There will be a lot of noisy change in the history for a mere brace style change. I wouldn't do it for its own sake. You're in Rome.... | Try to talk with your coworkers and decide on a consistent style. Once you do that, write all new code in that style and convert old code if necessary. This is an issue specific to the project and the people working on it.
On the rare occasion that you can't come to a consensus, I wouldn't worry too much; there are f... |
4,621,795 | When working on code from multiple authors, I often encounter the issue of curly-brace preference (same line vs new line). Is it good/bad practice or even a non-issue when it comes to matching the existing style vs using your own preference?
Does the situation change if you are adding new code to a Class vs modifying ... | 2011/01/07 | [
"https://Stackoverflow.com/questions/4621795",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/322939/"
] | It matters a great deal if a lot of code has been checked into a version control system. There will be a lot of noisy change in the history for a mere brace style change. I wouldn't do it for its own sake. You're in Rome.... | There is nothing that irks me more than perusing code and finding numerous mismatched styles sprinkled throughout. If you are going to collaborate with someone on a program, than either explicit or implicit, standards should be used. Something as simple as a curly brace doesn't matter in the least, but when your projec... |
213,747 | The Leviathan is an ancient deity that exists outside the mortal plane. It seeks to enter the human world, which is separated from him by an all-enclosing barrier protecting it. However, the Leviathan is not just another typical demon or eldritch god bent on world domination. It is formed as the manifestation of the te... | 2021/09/19 | [
"https://worldbuilding.stackexchange.com/questions/213747",
"https://worldbuilding.stackexchange.com",
"https://worldbuilding.stackexchange.com/users/52361/"
] | **It isn't control over the time line**
History might be rewritten, but one thing is certain. The god becomes real at a certain point. The way that happens can alter, but the point when it happens can not. That means some events cannot be altered, as they are requirements for the god to become real.
This goes much fu... | /establishing the cult as a far more prominent group in the modern day instead of a small organization forced to operate in secret./
**The small organization does not realize that it is a tiny subset of the far more prominent group.**
The small group bringing the Leviathan into the world succeeds. It brings the Levia... |
213,747 | The Leviathan is an ancient deity that exists outside the mortal plane. It seeks to enter the human world, which is separated from him by an all-enclosing barrier protecting it. However, the Leviathan is not just another typical demon or eldritch god bent on world domination. It is formed as the manifestation of the te... | 2021/09/19 | [
"https://worldbuilding.stackexchange.com/questions/213747",
"https://worldbuilding.stackexchange.com",
"https://worldbuilding.stackexchange.com/users/52361/"
] | **It isn't control over the time line**
History might be rewritten, but one thing is certain. The god becomes real at a certain point. The way that happens can alter, but the point when it happens can not. That means some events cannot be altered, as they are requirements for the god to become real.
This goes much fu... | **Control of the flow of time**
===============================
*(as opposed to **control of the timeline** that you used in your exposition ...)*
Leviathan simply takes note of everyone who attempts to alter history, and sets their flow of time to inordinately slow (1 second for offender = 100 years for the world). ... |
213,747 | The Leviathan is an ancient deity that exists outside the mortal plane. It seeks to enter the human world, which is separated from him by an all-enclosing barrier protecting it. However, the Leviathan is not just another typical demon or eldritch god bent on world domination. It is formed as the manifestation of the te... | 2021/09/19 | [
"https://worldbuilding.stackexchange.com/questions/213747",
"https://worldbuilding.stackexchange.com",
"https://worldbuilding.stackexchange.com/users/52361/"
] | The Leviathan Can't be Controlled or Reasoned with:
===================================================
The Leviathan exists because it will exist, and that necessitates that it always existed. But the very nature of its power is such that conscious goals and self-serving behavior are irrelevant to it. Despite it bein... | **Control of the flow of time**
===============================
*(as opposed to **control of the timeline** that you used in your exposition ...)*
Leviathan simply takes note of everyone who attempts to alter history, and sets their flow of time to inordinately slow (1 second for offender = 100 years for the world). ... |
213,747 | The Leviathan is an ancient deity that exists outside the mortal plane. It seeks to enter the human world, which is separated from him by an all-enclosing barrier protecting it. However, the Leviathan is not just another typical demon or eldritch god bent on world domination. It is formed as the manifestation of the te... | 2021/09/19 | [
"https://worldbuilding.stackexchange.com/questions/213747",
"https://worldbuilding.stackexchange.com",
"https://worldbuilding.stackexchange.com/users/52361/"
] | Leviathan is who we said he is
------------------------------
Leviathan only has the power to alter the timeline in so far as is required to make himself real. Before Leviathan entered our world, who he was, what he did, and what he is yet to do was already written into the collective consciousness of man. When he bec... | The Leviathan Can't be Controlled or Reasoned with:
===================================================
The Leviathan exists because it will exist, and that necessitates that it always existed. But the very nature of its power is such that conscious goals and self-serving behavior are irrelevant to it. Despite it bein... |
213,747 | The Leviathan is an ancient deity that exists outside the mortal plane. It seeks to enter the human world, which is separated from him by an all-enclosing barrier protecting it. However, the Leviathan is not just another typical demon or eldritch god bent on world domination. It is formed as the manifestation of the te... | 2021/09/19 | [
"https://worldbuilding.stackexchange.com/questions/213747",
"https://worldbuilding.stackexchange.com",
"https://worldbuilding.stackexchange.com/users/52361/"
] | ### History Isn't Real
The past is gone, and all that remains of it are memories, and the stories by which we rationalize the present state of things.
Your god cannot actually control the timeline. Once your cult brings him into existence, only *history* needs to change to accommodate him. History is not the past. | /establishing the cult as a far more prominent group in the modern day instead of a small organization forced to operate in secret./
**The small organization does not realize that it is a tiny subset of the far more prominent group.**
The small group bringing the Leviathan into the world succeeds. It brings the Levia... |
213,747 | The Leviathan is an ancient deity that exists outside the mortal plane. It seeks to enter the human world, which is separated from him by an all-enclosing barrier protecting it. However, the Leviathan is not just another typical demon or eldritch god bent on world domination. It is formed as the manifestation of the te... | 2021/09/19 | [
"https://worldbuilding.stackexchange.com/questions/213747",
"https://worldbuilding.stackexchange.com",
"https://worldbuilding.stackexchange.com/users/52361/"
] | /establishing the cult as a far more prominent group in the modern day instead of a small organization forced to operate in secret./
**The small organization does not realize that it is a tiny subset of the far more prominent group.**
The small group bringing the Leviathan into the world succeeds. It brings the Levia... | **Control of the flow of time**
===============================
*(as opposed to **control of the timeline** that you used in your exposition ...)*
Leviathan simply takes note of everyone who attempts to alter history, and sets their flow of time to inordinately slow (1 second for offender = 100 years for the world). ... |
213,747 | The Leviathan is an ancient deity that exists outside the mortal plane. It seeks to enter the human world, which is separated from him by an all-enclosing barrier protecting it. However, the Leviathan is not just another typical demon or eldritch god bent on world domination. It is formed as the manifestation of the te... | 2021/09/19 | [
"https://worldbuilding.stackexchange.com/questions/213747",
"https://worldbuilding.stackexchange.com",
"https://worldbuilding.stackexchange.com/users/52361/"
] | ### History Isn't Real
The past is gone, and all that remains of it are memories, and the stories by which we rationalize the present state of things.
Your god cannot actually control the timeline. Once your cult brings him into existence, only *history* needs to change to accommodate him. History is not the past. | >
> What could prevent a deity who can alter time from making itself the winner?
>
>
>
If the Tralfamadorian [view of time](https://www.sparknotes.com/lit/slaughter/quotes/character/tralfamadorians/) would be true, not even a deity could alter it. Simply said, time flow is the consequence of our incapacity of expe... |
213,747 | The Leviathan is an ancient deity that exists outside the mortal plane. It seeks to enter the human world, which is separated from him by an all-enclosing barrier protecting it. However, the Leviathan is not just another typical demon or eldritch god bent on world domination. It is formed as the manifestation of the te... | 2021/09/19 | [
"https://worldbuilding.stackexchange.com/questions/213747",
"https://worldbuilding.stackexchange.com",
"https://worldbuilding.stackexchange.com/users/52361/"
] | ### History Isn't Real
The past is gone, and all that remains of it are memories, and the stories by which we rationalize the present state of things.
Your god cannot actually control the timeline. Once your cult brings him into existence, only *history* needs to change to accommodate him. History is not the past. | **Control of the flow of time**
===============================
*(as opposed to **control of the timeline** that you used in your exposition ...)*
Leviathan simply takes note of everyone who attempts to alter history, and sets their flow of time to inordinately slow (1 second for offender = 100 years for the world). ... |
213,747 | The Leviathan is an ancient deity that exists outside the mortal plane. It seeks to enter the human world, which is separated from him by an all-enclosing barrier protecting it. However, the Leviathan is not just another typical demon or eldritch god bent on world domination. It is formed as the manifestation of the te... | 2021/09/19 | [
"https://worldbuilding.stackexchange.com/questions/213747",
"https://worldbuilding.stackexchange.com",
"https://worldbuilding.stackexchange.com/users/52361/"
] | ### History Isn't Real
The past is gone, and all that remains of it are memories, and the stories by which we rationalize the present state of things.
Your god cannot actually control the timeline. Once your cult brings him into existence, only *history* needs to change to accommodate him. History is not the past. | The Leviathan Can't be Controlled or Reasoned with:
===================================================
The Leviathan exists because it will exist, and that necessitates that it always existed. But the very nature of its power is such that conscious goals and self-serving behavior are irrelevant to it. Despite it bein... |
213,747 | The Leviathan is an ancient deity that exists outside the mortal plane. It seeks to enter the human world, which is separated from him by an all-enclosing barrier protecting it. However, the Leviathan is not just another typical demon or eldritch god bent on world domination. It is formed as the manifestation of the te... | 2021/09/19 | [
"https://worldbuilding.stackexchange.com/questions/213747",
"https://worldbuilding.stackexchange.com",
"https://worldbuilding.stackexchange.com/users/52361/"
] | >
> What could prevent a deity who can alter time from making itself the winner?
>
>
>
If the Tralfamadorian [view of time](https://www.sparknotes.com/lit/slaughter/quotes/character/tralfamadorians/) would be true, not even a deity could alter it. Simply said, time flow is the consequence of our incapacity of expe... | **Control of the flow of time**
===============================
*(as opposed to **control of the timeline** that you used in your exposition ...)*
Leviathan simply takes note of everyone who attempts to alter history, and sets their flow of time to inordinately slow (1 second for offender = 100 years for the world). ... |
52,636,662 | Spent hours on this so far and still struggling. I could do this easily in O(n^2) but the challenge is to do in O(nlog(n)) time.
1. Unsorted Array
2. Need to find the index of the minimum `A[j]` such that `A[j] > A[i]` and `j > i` for every element in the Unsorted Array
So essentially the smallest of the elements gr... | 2018/10/03 | [
"https://Stackoverflow.com/questions/52636662",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9330476/"
] | I think this question is very similar to finding the successor of a node. If you can imagine that all the values in the array are inside a BalancedBST something like an AVL tree for example.
The only trick here is that we need to find the successor from the values that are on the right of a number in an array. So the ... | Start traversing array from right to left and keep inserting elements in set and for each element find its upper bound in set and that will be minimum next greater element of current index.
**Algorithm:**
```
for i = n to 1
ans[i] = set.upper_bound(arr[i])
set.insert(arr[i])
return ans
```
*Time Complexity: O... |
15,065,427 | I have a problem in [OSQA](http://osqa.net). Anytime, I try to enter a user's page, "500 Error" occurs such as here: <http://turkrusforum.com/users/2/mertnuhoglu/>
I checked the error logs. But there was nothing there. I want to install `django-debug-toolbar` and debug the problem more.
I put `DEBUG = True` and `INT... | 2013/02/25 | [
"https://Stackoverflow.com/questions/15065427",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/29246/"
] | A few things to keep in mind:
1. Django\_Toolbar only displays when INTERNAL\_IPs matches the IP address of the machine requesting the page.
2. It looks at the HTTP\_X\_FORWARDED\_FOR header, which the WSGI Apache module should set (but might not, or might set incorrectly).
3. If it doesn't find that header, it looks ... | when you right click on webpage and inspect you can find in chrome console that some css and html files has 404 as response.
```
/static/debug_toolbar/css/toolbar.css
/static/debug_toolbar/js/toolbar.js
/static/debug_toolbar/img/ajax-loader.gif
```
These are static assets required by django toolbar to display the p... |
348,058 | I am trying to connect to mysql from php, it says i have not configured mysql-php, call to undefined function:mysql\_connect();. My server is not registered with RHN, hence i cannot yum install php-mysql. How do i configure php-mysql connection without yum install. Thanks.
cat /etc/\*-release
```
Red Hat Enterprise L... | 2012/01/09 | [
"https://serverfault.com/questions/348058",
"https://serverfault.com",
"https://serverfault.com/users/102715/"
] | You don't need to resompile if you've got dynamic loading support enabled.
You've already got the php-mysql rpm installed - so either it's not configured properly your php.ini or it has dependencies which have not been installed (which is a tricky scenarion to create).
running rpm --verify php-mysql will perform some... | You should look into installing the EPEL repository for your release of RedHat. This is going to be way easier to maintain than starting to compile software from sources.
See : <https://fedoraproject.org/wiki/EPEL> |
4,980 | We have been retiling my tub surround area and finished grouting the tile last night. I used non-sanded PolyBlend grout (sold at Home Depot) and added a bottle of [Grout Boost Advanced Pro](http://groutboost.com/consumer/products.cfm). Everything went okay, especially considering this was my first time tiling or grouti... | 2011/03/06 | [
"https://diy.stackexchange.com/questions/4980",
"https://diy.stackexchange.com",
"https://diy.stackexchange.com/users/262/"
] | It sure looks like you did a beautiful job on your shower, be a crying shame to see all that hard work ruined with stained grout. The glazing agent in the grout needs 8 to 10 days to harden completely. I suggest that you tape up some poly to protect the new grout if you really need to use the shower before the prescrib... | It's not realistic to wait that long. Most people are like myself who have no way to shower while they were building one.
Let the grout dry for a day, seal it, wait another day, go for it. People on the internet will always tell you things need to cure for about 20 times longer than in reality. Also, the product manu... |
4,980 | We have been retiling my tub surround area and finished grouting the tile last night. I used non-sanded PolyBlend grout (sold at Home Depot) and added a bottle of [Grout Boost Advanced Pro](http://groutboost.com/consumer/products.cfm). Everything went okay, especially considering this was my first time tiling or grouti... | 2011/03/06 | [
"https://diy.stackexchange.com/questions/4980",
"https://diy.stackexchange.com",
"https://diy.stackexchange.com/users/262/"
] | It sure looks like you did a beautiful job on your shower, be a crying shame to see all that hard work ruined with stained grout. The glazing agent in the grout needs 8 to 10 days to harden completely. I suggest that you tape up some poly to protect the new grout if you really need to use the shower before the prescrib... | Grout should CURE for up to 2 WEEKS. It is not just a manufacturer cop out. Getting water on the grout before then SLOWS the curing and allows breakdown, leading to cracking and chipping - the grout failing. READ AND FOLLOW the directions. |
4,980 | We have been retiling my tub surround area and finished grouting the tile last night. I used non-sanded PolyBlend grout (sold at Home Depot) and added a bottle of [Grout Boost Advanced Pro](http://groutboost.com/consumer/products.cfm). Everything went okay, especially considering this was my first time tiling or grouti... | 2011/03/06 | [
"https://diy.stackexchange.com/questions/4980",
"https://diy.stackexchange.com",
"https://diy.stackexchange.com/users/262/"
] | It sure looks like you did a beautiful job on your shower, be a crying shame to see all that hard work ruined with stained grout. The glazing agent in the grout needs 8 to 10 days to harden completely. I suggest that you tape up some poly to protect the new grout if you really need to use the shower before the prescrib... | We have only ever let our grout cure 24 hours. We have soft water and we've never had any of it crumble or crack. |
4,980 | We have been retiling my tub surround area and finished grouting the tile last night. I used non-sanded PolyBlend grout (sold at Home Depot) and added a bottle of [Grout Boost Advanced Pro](http://groutboost.com/consumer/products.cfm). Everything went okay, especially considering this was my first time tiling or grouti... | 2011/03/06 | [
"https://diy.stackexchange.com/questions/4980",
"https://diy.stackexchange.com",
"https://diy.stackexchange.com/users/262/"
] | It's not realistic to wait that long. Most people are like myself who have no way to shower while they were building one.
Let the grout dry for a day, seal it, wait another day, go for it. People on the internet will always tell you things need to cure for about 20 times longer than in reality. Also, the product manu... | We have only ever let our grout cure 24 hours. We have soft water and we've never had any of it crumble or crack. |
4,980 | We have been retiling my tub surround area and finished grouting the tile last night. I used non-sanded PolyBlend grout (sold at Home Depot) and added a bottle of [Grout Boost Advanced Pro](http://groutboost.com/consumer/products.cfm). Everything went okay, especially considering this was my first time tiling or grouti... | 2011/03/06 | [
"https://diy.stackexchange.com/questions/4980",
"https://diy.stackexchange.com",
"https://diy.stackexchange.com/users/262/"
] | Grout should CURE for up to 2 WEEKS. It is not just a manufacturer cop out. Getting water on the grout before then SLOWS the curing and allows breakdown, leading to cracking and chipping - the grout failing. READ AND FOLLOW the directions. | We have only ever let our grout cure 24 hours. We have soft water and we've never had any of it crumble or crack. |
204,112 | I just asked about the difference in totals of collectible cards between Expert packs and Goblins Versus Gnomes packs: [Card Counts for Expert and Goblins Versus Gnomes Packs](https://gaming.stackexchange.com/q/204085/53654)
So clearly Expert Packs are drawing from a larger pool. But I'd like to ask a couple follow up... | 2015/02/03 | [
"https://gaming.stackexchange.com/questions/204112",
"https://gaming.stackexchange.com",
"https://gaming.stackexchange.com/users/53654/"
] | I'll preface by saying that I have never set up a grinder in the dungeon. I just ran around killing things with battle potions and water candles for a couple hours to get all the gear I needed.
>
> What preparations do I need to make to make a safe dungeon grinder?
>
>
>
I am not actually sure that you can. Quite... | I will say that Dungeon farming is tricky as I have built a couple different ones. The issue is that 2 of the Post-Plantera casters in the dungeon are painful and can bypass walls with their spells.
However, since you are doing this Pre-Plantera, A simple lava pit with a either a honey pool/campfire/heart lantern (or... |
204,112 | I just asked about the difference in totals of collectible cards between Expert packs and Goblins Versus Gnomes packs: [Card Counts for Expert and Goblins Versus Gnomes Packs](https://gaming.stackexchange.com/q/204085/53654)
So clearly Expert Packs are drawing from a larger pool. But I'd like to ask a couple follow up... | 2015/02/03 | [
"https://gaming.stackexchange.com/questions/204112",
"https://gaming.stackexchange.com",
"https://gaming.stackexchange.com/users/53654/"
] | I'll preface by saying that I have never set up a grinder in the dungeon. I just ran around killing things with battle potions and water candles for a couple hours to get all the gear I needed.
>
> What preparations do I need to make to make a safe dungeon grinder?
>
>
>
I am not actually sure that you can. Quite... | What you should do is set up a honey/campfire/heartlamp/ healpad and get full tiki armor a raven staff, optic, staff, and a pygmy staff and then get a beetle thing ( i forgot its name but if you have a pygmy staff in your invetory the witch doctor will sell it) and a summoner emblem which increases minion damage and pu... |
204,112 | I just asked about the difference in totals of collectible cards between Expert packs and Goblins Versus Gnomes packs: [Card Counts for Expert and Goblins Versus Gnomes Packs](https://gaming.stackexchange.com/q/204085/53654)
So clearly Expert Packs are drawing from a larger pool. But I'd like to ask a couple follow up... | 2015/02/03 | [
"https://gaming.stackexchange.com/questions/204112",
"https://gaming.stackexchange.com",
"https://gaming.stackexchange.com/users/53654/"
] | I will say that Dungeon farming is tricky as I have built a couple different ones. The issue is that 2 of the Post-Plantera casters in the dungeon are painful and can bypass walls with their spells.
However, since you are doing this Pre-Plantera, A simple lava pit with a either a honey pool/campfire/heart lantern (or... | What you should do is set up a honey/campfire/heartlamp/ healpad and get full tiki armor a raven staff, optic, staff, and a pygmy staff and then get a beetle thing ( i forgot its name but if you have a pygmy staff in your invetory the witch doctor will sell it) and a summoner emblem which increases minion damage and pu... |
362,392 | I can't play drm-protected content from online movies in Ubuntu 13.10.
Anything that work before as workaround not work anymore.
I tried reinstall adobe flash player - still not working. | 2013/10/20 | [
"https://askubuntu.com/questions/362392",
"https://askubuntu.com",
"https://askubuntu.com/users/160771/"
] | The solution in my case was `Ctrl`+`C`. After that, the Update-Manager began to clean up the system and all was working fine after the upgrade was finished. | If your upgrade has stopped running: run `sudo dpkg --configure -a` and then run `sudo apt-get install`. |
362,392 | I can't play drm-protected content from online movies in Ubuntu 13.10.
Anything that work before as workaround not work anymore.
I tried reinstall adobe flash player - still not working. | 2013/10/20 | [
"https://askubuntu.com/questions/362392",
"https://askubuntu.com",
"https://askubuntu.com/users/160771/"
] | The solution in my case was `Ctrl`+`C`. After that, the Update-Manager began to clean up the system and all was working fine after the upgrade was finished. | I had a similar problem with the `saucy` update freezing, and I have put the solution [here](https://askubuntu.com/questions/361506/restarting-update-manager-after-freezing/361703#361703). Incidentally Ramachandra Apte's solution is not complete.
[Restarting update manager after freezing!](https://askubuntu.com/questi... |
26,375,630 | How do I stop this from crashing when a String is entered instead of an int?
Here is what i have. I've tried looking up some tutorials but I still couldn't figure it out.
Thanks for the help guys. When a String is entered i need it to tell the user to enter an int
```
import java.util.Scanner;
public class TaxC... | 2014/10/15 | [
"https://Stackoverflow.com/questions/26375630",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4068770/"
] | By checking the InputMismatchException you can inform the users that they have entered an invalid input, and you can ask them to re-enter only Numbers.
```
public static int inputInt(String prompt, Scanner keyboard) {
System.out.print(prompt);
try{
return keyboard.nextInt();
} catch... | Use
```
try
{
// Code here
}
catch (Exception e)
{
// Do anything in case of error
}
``` |
26,375,630 | How do I stop this from crashing when a String is entered instead of an int?
Here is what i have. I've tried looking up some tutorials but I still couldn't figure it out.
Thanks for the help guys. When a String is entered i need it to tell the user to enter an int
```
import java.util.Scanner;
public class TaxC... | 2014/10/15 | [
"https://Stackoverflow.com/questions/26375630",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4068770/"
] | By checking the InputMismatchException you can inform the users that they have entered an invalid input, and you can ask them to re-enter only Numbers.
```
public static int inputInt(String prompt, Scanner keyboard) {
System.out.print(prompt);
try{
return keyboard.nextInt();
} catch... | <http://www.tutorialspoint.com/java/java_exceptions.htm>
this website shows how to do exception handling on Java,
basically do something like
```
try {
int dependents = inputInt("Enter number of dependents: ", keyboard);
}
catch(Exception e) {
//do something because an error occured
}
``` |
26,375,630 | How do I stop this from crashing when a String is entered instead of an int?
Here is what i have. I've tried looking up some tutorials but I still couldn't figure it out.
Thanks for the help guys. When a String is entered i need it to tell the user to enter an int
```
import java.util.Scanner;
public class TaxC... | 2014/10/15 | [
"https://Stackoverflow.com/questions/26375630",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4068770/"
] | By checking the InputMismatchException you can inform the users that they have entered an invalid input, and you can ask them to re-enter only Numbers.
```
public static int inputInt(String prompt, Scanner keyboard) {
System.out.print(prompt);
try{
return keyboard.nextInt();
} catch... | Nonono, dont use exceptions (at least not Exception since there is a NumberFormatException) if you can avoid it.
If you want to be sure that only numbers are entered use
```
public double inputDouble(String prompt, Scanner keyboard){
try {
while (!keyboard.hasNextInt()) keyboard.next();
return keyboard.nextI... |
26,375,630 | How do I stop this from crashing when a String is entered instead of an int?
Here is what i have. I've tried looking up some tutorials but I still couldn't figure it out.
Thanks for the help guys. When a String is entered i need it to tell the user to enter an int
```
import java.util.Scanner;
public class TaxC... | 2014/10/15 | [
"https://Stackoverflow.com/questions/26375630",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4068770/"
] | By checking the InputMismatchException you can inform the users that they have entered an invalid input, and you can ask them to re-enter only Numbers.
```
public static int inputInt(String prompt, Scanner keyboard) {
System.out.print(prompt);
try{
return keyboard.nextInt();
} catch... | I think, it work with you.
```
public static int inputInt(String prompt, Scanner keyboard){
System.out.println(prompt);
if(keyboard.hasNextInt())
return keyboard.nextInt();
else {
System.out.println("please input a number");
keyboard.next();
return inputInt(p... |
173,080 | I have not read all the books but did any of the space fleet crew come home after the final attack? Mazer Rackham comments about it being the last exercise could be interpreted as these are the only ships left. | 2017/11/01 | [
"https://scifi.stackexchange.com/questions/173080",
"https://scifi.stackexchange.com",
"https://scifi.stackexchange.com/users/91797/"
] | Using only Ender's Game as reference.
Oh yeah, also ... **GIGANTIC SPOILERS HERE**
Sadly, I do not have a copy of the book to hand, but it is made clear that the transport ships that brought the fighters survive. Ender notes after [spoiler] explodes that those ships are still floating "at the very periphery of the si... | **MORE MAJOR SPOILERS:**
And, as the following books (*Ender in Exile*, *Speaker for the Dead*, etc) point out, the crews from those surviving ships help populate the formic worlds when the formics all died off such as the colony, Shakespeare, which Ender ends up being the governor for a while. |
173,080 | I have not read all the books but did any of the space fleet crew come home after the final attack? Mazer Rackham comments about it being the last exercise could be interpreted as these are the only ships left. | 2017/11/01 | [
"https://scifi.stackexchange.com/questions/173080",
"https://scifi.stackexchange.com",
"https://scifi.stackexchange.com/users/91797/"
] | Using only Ender's Game as reference.
Oh yeah, also ... **GIGANTIC SPOILERS HERE**
Sadly, I do not have a copy of the book to hand, but it is made clear that the transport ships that brought the fighters survive. Ender notes after [spoiler] explodes that those ships are still floating "at the very periphery of the si... | As well as the fact that not all of the ships in the final battle were destroyed:
>
> Only at the very periphery of the simulator did the M.D. field weaken. Two or three enemy ships were drifting away. Ender's own starships did not explode. But where the vast enemy fleet had been, and the planet they protected, there... |
173,080 | I have not read all the books but did any of the space fleet crew come home after the final attack? Mazer Rackham comments about it being the last exercise could be interpreted as these are the only ships left. | 2017/11/01 | [
"https://scifi.stackexchange.com/questions/173080",
"https://scifi.stackexchange.com",
"https://scifi.stackexchange.com/users/91797/"
] | The International Fleet was dispatched long before the book starts, and was sent to many different planets
----------------------------------------------------------------------------------------------------------
Immediately after the second invasion, the IF began sending out ships, timed so that they would all reach... | **MORE MAJOR SPOILERS:**
And, as the following books (*Ender in Exile*, *Speaker for the Dead*, etc) point out, the crews from those surviving ships help populate the formic worlds when the formics all died off such as the colony, Shakespeare, which Ender ends up being the governor for a while. |
173,080 | I have not read all the books but did any of the space fleet crew come home after the final attack? Mazer Rackham comments about it being the last exercise could be interpreted as these are the only ships left. | 2017/11/01 | [
"https://scifi.stackexchange.com/questions/173080",
"https://scifi.stackexchange.com",
"https://scifi.stackexchange.com/users/91797/"
] | The International Fleet was dispatched long before the book starts, and was sent to many different planets
----------------------------------------------------------------------------------------------------------
Immediately after the second invasion, the IF began sending out ships, timed so that they would all reach... | As well as the fact that not all of the ships in the final battle were destroyed:
>
> Only at the very periphery of the simulator did the M.D. field weaken. Two or three enemy ships were drifting away. Ender's own starships did not explode. But where the vast enemy fleet had been, and the planet they protected, there... |
2,020,321 | Not sure if this belongs here, but I'm slowly trudging through my studies for Math 1 and wondered if y'all could give feedback and/or corrections on the following factorisation question:
$$ \text{Factorise}: f(x) = x^3+4x^2+3x $$
Firstly, the GCD of the above is $x$:
$$x(x^2+4x+3)$$
Now take $x^2+4x+3$ and factoris... | 2016/11/18 | [
"https://math.stackexchange.com/questions/2020321",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/153228/"
] | To factor $x^3+4x^2+3x$, we notice that we can factor $x$ out. Therefore, we get$$x^3+4x^2+3x=x(x^2+4x+3)\tag1$$
Now, we need to see if $x^2+4x+3$ can be factored as a product of two linear terms. An easy way to factor a monic polynomial is to find two numbers $r,s$ that sum to the negated value of $b$ and have a produ... | Well done. And for those of us unaware of the box method, the following would have also worked: $$x^2+4x+3=x^2+4x+4-1=(x+2)^2-1=(x+2-1)(x+2+1)=(x+1)(x+3)$$ |
2,020,321 | Not sure if this belongs here, but I'm slowly trudging through my studies for Math 1 and wondered if y'all could give feedback and/or corrections on the following factorisation question:
$$ \text{Factorise}: f(x) = x^3+4x^2+3x $$
Firstly, the GCD of the above is $x$:
$$x(x^2+4x+3)$$
Now take $x^2+4x+3$ and factoris... | 2016/11/18 | [
"https://math.stackexchange.com/questions/2020321",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/153228/"
] | Had never heard of the box method before I saw you use it!
When you got to the part of factoring $x^2 + 4x + 3$ I would go and find the roots of it, because with the roots one can also factor the polynomial.
Upon finding that $-1$ and $-3$ are the roots, I would know $x^2 + 4x + 3 = (x - (-3))(x - (-1)) = (x + 1)(x +... | Everything is more or less correct about the way you approach the problem. You could have also opted for the [middle term factorisation method](http://www.mathhands.com/046/hw/046c06s03ns.pdf) or the [method of vanishing method](https://www.youtube.com/watch?v=D7s6Vj5ukXw). However you have to correct one thing ...
> ... |
2,020,321 | Not sure if this belongs here, but I'm slowly trudging through my studies for Math 1 and wondered if y'all could give feedback and/or corrections on the following factorisation question:
$$ \text{Factorise}: f(x) = x^3+4x^2+3x $$
Firstly, the GCD of the above is $x$:
$$x(x^2+4x+3)$$
Now take $x^2+4x+3$ and factoris... | 2016/11/18 | [
"https://math.stackexchange.com/questions/2020321",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/153228/"
] | I wouldn't know if this really qualifies as an answer, but what you're asking for is essentially an opinion of methodology.
First of all, your factorisation is correct: you can check the result simply by doing the multiplication.
That said, it looks like you could have saved a lot of effort by using a couple of diffe... | Avoid the 'box method' which will only work for quadratics with nice integer roots and doesn't really tell you anything about what's going on.
Suppose we have a quadratic $p(x)$ that factorizes as:
$$
p(x) = (x + s)(x + t)
$$
where we don't know what $s$ and $t$ are yet. If we multiply out the brackets, then we get... |
2,020,321 | Not sure if this belongs here, but I'm slowly trudging through my studies for Math 1 and wondered if y'all could give feedback and/or corrections on the following factorisation question:
$$ \text{Factorise}: f(x) = x^3+4x^2+3x $$
Firstly, the GCD of the above is $x$:
$$x(x^2+4x+3)$$
Now take $x^2+4x+3$ and factoris... | 2016/11/18 | [
"https://math.stackexchange.com/questions/2020321",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/153228/"
] | Had never heard of the box method before I saw you use it!
When you got to the part of factoring $x^2 + 4x + 3$ I would go and find the roots of it, because with the roots one can also factor the polynomial.
Upon finding that $-1$ and $-3$ are the roots, I would know $x^2 + 4x + 3 = (x - (-3))(x - (-1)) = (x + 1)(x +... | X(X+1)(X+3)
Therefore (X+1)(X+3) = X^2+4X+3.
Therefore multiplying this by X you get X^3+4X^2+3X.
So yes well done that is correct. |
2,020,321 | Not sure if this belongs here, but I'm slowly trudging through my studies for Math 1 and wondered if y'all could give feedback and/or corrections on the following factorisation question:
$$ \text{Factorise}: f(x) = x^3+4x^2+3x $$
Firstly, the GCD of the above is $x$:
$$x(x^2+4x+3)$$
Now take $x^2+4x+3$ and factoris... | 2016/11/18 | [
"https://math.stackexchange.com/questions/2020321",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/153228/"
] | I wouldn't know if this really qualifies as an answer, but what you're asking for is essentially an opinion of methodology.
First of all, your factorisation is correct: you can check the result simply by doing the multiplication.
That said, it looks like you could have saved a lot of effort by using a couple of diffe... | Everything is more or less correct about the way you approach the problem. You could have also opted for the [middle term factorisation method](http://www.mathhands.com/046/hw/046c06s03ns.pdf) or the [method of vanishing method](https://www.youtube.com/watch?v=D7s6Vj5ukXw). However you have to correct one thing ...
> ... |
2,020,321 | Not sure if this belongs here, but I'm slowly trudging through my studies for Math 1 and wondered if y'all could give feedback and/or corrections on the following factorisation question:
$$ \text{Factorise}: f(x) = x^3+4x^2+3x $$
Firstly, the GCD of the above is $x$:
$$x(x^2+4x+3)$$
Now take $x^2+4x+3$ and factoris... | 2016/11/18 | [
"https://math.stackexchange.com/questions/2020321",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/153228/"
] | Had never heard of the box method before I saw you use it!
When you got to the part of factoring $x^2 + 4x + 3$ I would go and find the roots of it, because with the roots one can also factor the polynomial.
Upon finding that $-1$ and $-3$ are the roots, I would know $x^2 + 4x + 3 = (x - (-3))(x - (-1)) = (x + 1)(x +... | Avoid the 'box method' which will only work for quadratics with nice integer roots and doesn't really tell you anything about what's going on.
Suppose we have a quadratic $p(x)$ that factorizes as:
$$
p(x) = (x + s)(x + t)
$$
where we don't know what $s$ and $t$ are yet. If we multiply out the brackets, then we get... |
2,020,321 | Not sure if this belongs here, but I'm slowly trudging through my studies for Math 1 and wondered if y'all could give feedback and/or corrections on the following factorisation question:
$$ \text{Factorise}: f(x) = x^3+4x^2+3x $$
Firstly, the GCD of the above is $x$:
$$x(x^2+4x+3)$$
Now take $x^2+4x+3$ and factoris... | 2016/11/18 | [
"https://math.stackexchange.com/questions/2020321",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/153228/"
] | I wouldn't know if this really qualifies as an answer, but what you're asking for is essentially an opinion of methodology.
First of all, your factorisation is correct: you can check the result simply by doing the multiplication.
That said, it looks like you could have saved a lot of effort by using a couple of diffe... | X(X+1)(X+3)
Therefore (X+1)(X+3) = X^2+4X+3.
Therefore multiplying this by X you get X^3+4X^2+3X.
So yes well done that is correct. |
2,020,321 | Not sure if this belongs here, but I'm slowly trudging through my studies for Math 1 and wondered if y'all could give feedback and/or corrections on the following factorisation question:
$$ \text{Factorise}: f(x) = x^3+4x^2+3x $$
Firstly, the GCD of the above is $x$:
$$x(x^2+4x+3)$$
Now take $x^2+4x+3$ and factoris... | 2016/11/18 | [
"https://math.stackexchange.com/questions/2020321",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/153228/"
] | I wouldn't know if this really qualifies as an answer, but what you're asking for is essentially an opinion of methodology.
First of all, your factorisation is correct: you can check the result simply by doing the multiplication.
That said, it looks like you could have saved a lot of effort by using a couple of diffe... | Well done. And for those of us unaware of the box method, the following would have also worked: $$x^2+4x+3=x^2+4x+4-1=(x+2)^2-1=(x+2-1)(x+2+1)=(x+1)(x+3)$$ |
2,020,321 | Not sure if this belongs here, but I'm slowly trudging through my studies for Math 1 and wondered if y'all could give feedback and/or corrections on the following factorisation question:
$$ \text{Factorise}: f(x) = x^3+4x^2+3x $$
Firstly, the GCD of the above is $x$:
$$x(x^2+4x+3)$$
Now take $x^2+4x+3$ and factoris... | 2016/11/18 | [
"https://math.stackexchange.com/questions/2020321",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/153228/"
] | To factor $x^3+4x^2+3x$, we notice that we can factor $x$ out. Therefore, we get$$x^3+4x^2+3x=x(x^2+4x+3)\tag1$$
Now, we need to see if $x^2+4x+3$ can be factored as a product of two linear terms. An easy way to factor a monic polynomial is to find two numbers $r,s$ that sum to the negated value of $b$ and have a produ... | X(X+1)(X+3)
Therefore (X+1)(X+3) = X^2+4X+3.
Therefore multiplying this by X you get X^3+4X^2+3X.
So yes well done that is correct. |
2,020,321 | Not sure if this belongs here, but I'm slowly trudging through my studies for Math 1 and wondered if y'all could give feedback and/or corrections on the following factorisation question:
$$ \text{Factorise}: f(x) = x^3+4x^2+3x $$
Firstly, the GCD of the above is $x$:
$$x(x^2+4x+3)$$
Now take $x^2+4x+3$ and factoris... | 2016/11/18 | [
"https://math.stackexchange.com/questions/2020321",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/153228/"
] | Had never heard of the box method before I saw you use it!
When you got to the part of factoring $x^2 + 4x + 3$ I would go and find the roots of it, because with the roots one can also factor the polynomial.
Upon finding that $-1$ and $-3$ are the roots, I would know $x^2 + 4x + 3 = (x - (-3))(x - (-1)) = (x + 1)(x +... | To factor $x^3+4x^2+3x$, we notice that we can factor $x$ out. Therefore, we get$$x^3+4x^2+3x=x(x^2+4x+3)\tag1$$
Now, we need to see if $x^2+4x+3$ can be factored as a product of two linear terms. An easy way to factor a monic polynomial is to find two numbers $r,s$ that sum to the negated value of $b$ and have a produ... |
41,034,838 | I need to produce a JSON document, that will be parsed by a SSI mechanism on a device. The document will actually be a json serialized dictionary. For the sake of simplicity, let's say, that it should look like this:
```
var x = new Dictionary<string,object>
{
["A"]=new {x = "<!-- ?A.x -->"},
["B"]=new {... | 2016/12/08 | [
"https://Stackoverflow.com/questions/41034838",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6180031/"
] | Using `grep` : `\K` is part of `perl` regex. It acts as assertion and checks if text supplied left to it is present or not. IF present prints as per regex ignoring the text left to it.
```
name=$(grep -oP 'name:\K.*' person.txt)
age=$(grep -oP 'age:\K.*' person.txt)
salary=$(grep -oP 'salary:\K.*' person.txt)
```
O... | You could try this
if your data is in a file: `data.txt`
```
name:vijay
age:23
salary:100
```
then you could use a script like this
```
#!/bin/bash
# read will read a line until it hits a record separator i.e. newline, at which
# point it will return true, and store the line in variable $REPLY
while read
do
... |
41,034,838 | I need to produce a JSON document, that will be parsed by a SSI mechanism on a device. The document will actually be a json serialized dictionary. For the sake of simplicity, let's say, that it should look like this:
```
var x = new Dictionary<string,object>
{
["A"]=new {x = "<!-- ?A.x -->"},
["B"]=new {... | 2016/12/08 | [
"https://Stackoverflow.com/questions/41034838",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6180031/"
] | Rather than running multiple `grep`s or `bash` loops, you could just run a single `read` that reads the output of a single invocation of `awk`:
```
read age salary name <<< $(awk -F: '/^age/{a=$2} /^salary/{s=$2} /^name/{n=$2} END{print a,s,n}' file)
```
**Results**
```
echo $age
23
echo $salary
100
echo $name
Mark... | You could try this
if your data is in a file: `data.txt`
```
name:vijay
age:23
salary:100
```
then you could use a script like this
```
#!/bin/bash
# read will read a line until it hits a record separator i.e. newline, at which
# point it will return true, and store the line in variable $REPLY
while read
do
... |
41,034,838 | I need to produce a JSON document, that will be parsed by a SSI mechanism on a device. The document will actually be a json serialized dictionary. For the sake of simplicity, let's say, that it should look like this:
```
var x = new Dictionary<string,object>
{
["A"]=new {x = "<!-- ?A.x -->"},
["B"]=new {... | 2016/12/08 | [
"https://Stackoverflow.com/questions/41034838",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6180031/"
] | Using `grep` : `\K` is part of `perl` regex. It acts as assertion and checks if text supplied left to it is present or not. IF present prints as per regex ignoring the text left to it.
```
name=$(grep -oP 'name:\K.*' person.txt)
age=$(grep -oP 'age:\K.*' person.txt)
salary=$(grep -oP 'salary:\K.*' person.txt)
```
O... | well if you can store data in json or other similar formate it will be very easy to access complex data
data.json
```
{
"name":"vijay",
"salary":"100",
"age": 23
}
```
then you can use jq to parse json and get data easily
```
jq -r '.name' data.json
vijay
``` |
41,034,838 | I need to produce a JSON document, that will be parsed by a SSI mechanism on a device. The document will actually be a json serialized dictionary. For the sake of simplicity, let's say, that it should look like this:
```
var x = new Dictionary<string,object>
{
["A"]=new {x = "<!-- ?A.x -->"},
["B"]=new {... | 2016/12/08 | [
"https://Stackoverflow.com/questions/41034838",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6180031/"
] | Rather than running multiple `grep`s or `bash` loops, you could just run a single `read` that reads the output of a single invocation of `awk`:
```
read age salary name <<< $(awk -F: '/^age/{a=$2} /^salary/{s=$2} /^name/{n=$2} END{print a,s,n}' file)
```
**Results**
```
echo $age
23
echo $salary
100
echo $name
Mark... | Using `grep` : `\K` is part of `perl` regex. It acts as assertion and checks if text supplied left to it is present or not. IF present prints as per regex ignoring the text left to it.
```
name=$(grep -oP 'name:\K.*' person.txt)
age=$(grep -oP 'age:\K.*' person.txt)
salary=$(grep -oP 'salary:\K.*' person.txt)
```
O... |
41,034,838 | I need to produce a JSON document, that will be parsed by a SSI mechanism on a device. The document will actually be a json serialized dictionary. For the sake of simplicity, let's say, that it should look like this:
```
var x = new Dictionary<string,object>
{
["A"]=new {x = "<!-- ?A.x -->"},
["B"]=new {... | 2016/12/08 | [
"https://Stackoverflow.com/questions/41034838",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6180031/"
] | Rather than running multiple `grep`s or `bash` loops, you could just run a single `read` that reads the output of a single invocation of `awk`:
```
read age salary name <<< $(awk -F: '/^age/{a=$2} /^salary/{s=$2} /^name/{n=$2} END{print a,s,n}' file)
```
**Results**
```
echo $age
23
echo $salary
100
echo $name
Mark... | well if you can store data in json or other similar formate it will be very easy to access complex data
data.json
```
{
"name":"vijay",
"salary":"100",
"age": 23
}
```
then you can use jq to parse json and get data easily
```
jq -r '.name' data.json
vijay
``` |
51,700,458 | ```
This is the code where it is breaking:
**ngOnInit() {
this.service.getTodosPromise().then(t => {
this.todos = t; });
}**
and this is the getTodosPromise() method in the Service:
**getTodosPromise() {
return this.http.get('...').pipe(map(r => r.json())).toPromise();
}**
And in the *.spect.ts fi... | 2018/08/06 | [
"https://Stackoverflow.com/questions/51700458",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5137530/"
] | The way I am currently doing this is with add\_action();
```
add_action( 'wp_head', 'my_theme_schema' );
```
Then in my\_theme\_schema, I build my schema, and just output it with the script tags. ( I typically build the schema with an array ).
```
function my_theme_schema() {
$schema = [];
... // build up the s... | I found a way to do this:
```
//here we enqueue a dummy script to help us with what we want to achieve
add_action('wp_enqueue_scripts', 'myslug_wp_load_files');
function myslug_wp_load_files()
{
wp_register_script( 'myslug-dummy-handle-json-footer', plugins_url('scripts/loader.js', __FILE__), [], '', true );
w... |
134,955 | I'm looking for a way to convert several paths into one shape (purple outline image). I don't want the space within the lines to become a filled shape. I just want the paths themselves, the 'outline' of the hand created by the paths to be a shape.
This is so I can place the path 'shape' outline on top of a solid (see ... | 2020/03/25 | [
"https://graphicdesign.stackexchange.com/questions/134955",
"https://graphicdesign.stackexchange.com",
"https://graphicdesign.stackexchange.com/users/148324/"
] | Here's one possible method.
You have already done the outlines/strokes (Step 1 below) and the solid object (Step 2 below)
3. Select the all outlines and do *Object > Expand*, then open the *Pathfinder* and hit *Unite*. This will outline all the strokes and combine them into one object, i.e. one single path with a fil... | You can fill the interior area with the Shape Builder. You'll get a new filled shape which has exactly the same outline as your paths except the open ended finger separations will be filled, too and that was NOT wanted.
Fortunately the finger separations are not deleted, you can dig them up and subtract them from the ... |
11,382,130 | I am new to Java and I couldn't understand the difference between
```
public static <V> void meth()
```
and
```
public static void meth()
```
Q1. What does <V> mean as a parameter? It's a generic type and does that mean the method returns/takes a parameter of type V??
Here's my code:
```
public static <V> void ... | 2012/07/08 | [
"https://Stackoverflow.com/questions/11382130",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1469292/"
] | Enclose your arguments with quotes "\" [args] \"". Also check if the path is absolute. | use `ProcessStartInfo`:
```
Process.Start(new ProcessStartInfo(filename, arguments));
``` |
11,382,130 | I am new to Java and I couldn't understand the difference between
```
public static <V> void meth()
```
and
```
public static void meth()
```
Q1. What does <V> mean as a parameter? It's a generic type and does that mean the method returns/takes a parameter of type V??
Here's my code:
```
public static <V> void ... | 2012/07/08 | [
"https://Stackoverflow.com/questions/11382130",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1469292/"
] | Enclose your arguments with quotes "\" [args] \"". Also check if the path is absolute. | With your given info, the error couldn't be reproduced and the process receives all arguments correctly, whether it was started using parent program in VS or using parent ' exe (shortcut). Maybe the problem resides in the process code or more info is required to answer this question. |
45,797,177 | This image took from Deep Relax app from Play Store:

How do I create a popup menu? I am creating an app I want to ask the user to provide feedback? | 2017/08/21 | [
"https://Stackoverflow.com/questions/45797177",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6200605/"
] | Document DB imposes limits on Response page size.
This link summarizes some of those limits:
[Azure DocumentDb Storage Limits - what exactly do they mean?](https://stackoverflow.com/questions/40143986/azure-documentdb-storage-limits-what-exactly-do-they-mean)
You can paginate your data using continuation tokens. The D... | Are you using .NET sdk to retrieve the data returned by your stored procedure? If so, take advantage of the .HasMoreResults. It automatically get the allowed size data results thus not showing the error you posted. Loop through it until there's no more fetched results.
<http://www.kevinkuszyk.com/2016/08/19/paging-thr... |
53,768,589 | I am trying to create a subhashmap from a huge hashmap without copy the original one.
currently I use this:
```
val map = hashMapOf<Job, Int>()
val copy = HashMap(map)
listToRemoveFromCopy.forEach { copy.remove(it) }
```
this cost me around 50% of my current algorithm. Because java is calculating the hash of the `j... | 2018/12/13 | [
"https://Stackoverflow.com/questions/53768589",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7927982/"
] | **First, you need to cache the hashcode for `Job`** because any approach you use will be inefficient if you cannot have a set or a map of `Job` objects that operate at top speed.
Hopefully, the parts that make it a hashcode are immutable otherwise it should not be used as a key. It is **very dangerous to mutate a key... | You can use `filterKeys` function. It will iterate map only once
```
val copy = map.filterKeys { it !in listToRemoveFromCopy }
``` |
53,768,589 | I am trying to create a subhashmap from a huge hashmap without copy the original one.
currently I use this:
```
val map = hashMapOf<Job, Int>()
val copy = HashMap(map)
listToRemoveFromCopy.forEach { copy.remove(it) }
```
this cost me around 50% of my current algorithm. Because java is calculating the hash of the `j... | 2018/12/13 | [
"https://Stackoverflow.com/questions/53768589",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7927982/"
] | **First, you need to cache the hashcode for `Job`** because any approach you use will be inefficient if you cannot have a set or a map of `Job` objects that operate at top speed.
Hopefully, the parts that make it a hashcode are immutable otherwise it should not be used as a key. It is **very dangerous to mutate a key... | In addition to Axel's direct answer:
Could calculating the hashcode of a Job be optimised? If the calculation can't be sped up, could it cache the result? (There's ample precedent for this, including `java.lang.String`.) Or if the class isn't under your control, could you create a delegate/wrapper that overrides th... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.