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,847,440
I have been doing a lot of unit testing lately with mocking. The one thing that strikes me as a bit of a problem are the differences between querying against an in memory list (via a mock of my repository) and querying directly against the database via entity framework. Some of these situations might be: 1. Testing ...
2012/03/23
[ "https://Stackoverflow.com/questions/9847440", "https://Stackoverflow.com", "https://Stackoverflow.com/users/461131/" ]
Besides the unit tests you do you should also create integration tests which run against a real database setup as encountered in production. I'm not an expert for EF but with NHibernate for example you can create a configuration which points to an in-memory instance of SQLite where you then run your quick tests agains...
You can use [DevMagicFake](http://devmagicfake.codeplex.com/), this framework will fake the DB for you and can also generate data so you can test your application without testing the DB
9,847,440
I have been doing a lot of unit testing lately with mocking. The one thing that strikes me as a bit of a problem are the differences between querying against an in memory list (via a mock of my repository) and querying directly against the database via entity framework. Some of these situations might be: 1. Testing ...
2012/03/23
[ "https://Stackoverflow.com/questions/9847440", "https://Stackoverflow.com", "https://Stackoverflow.com/users/461131/" ]
Besides the unit tests you do you should also create integration tests which run against a real database setup as encountered in production. I'm not an expert for EF but with NHibernate for example you can create a configuration which points to an in-memory instance of SQLite where you then run your quick tests agains...
First and most important is you can define any behavior data within your mock. Second is speed. From unit testing perspective testing speed counts. Database connections are bottleneck most of time so that's why you mock it with tests. To implement testing properly you need to work on your overall arch first. For instan...
9,847,440
I have been doing a lot of unit testing lately with mocking. The one thing that strikes me as a bit of a problem are the differences between querying against an in memory list (via a mock of my repository) and querying directly against the database via entity framework. Some of these situations might be: 1. Testing ...
2012/03/23
[ "https://Stackoverflow.com/questions/9847440", "https://Stackoverflow.com", "https://Stackoverflow.com/users/461131/" ]
Besides the unit tests you do you should also create integration tests which run against a real database setup as encountered in production. I'm not an expert for EF but with NHibernate for example you can create a configuration which points to an in-memory instance of SQLite where you then run your quick tests agains...
I would make my mocks more granular, so that you don't actually query against a larger set in a mock repository. I typically have setters on my mock repository that I set in each test to control the output of the mocked repository. This way you don't have to rely on writing queries against a generic mock, and your focu...
5,307
* I have 2 accounts on the iTunes store * Each account is set to a different e-mail address, both of which I control * One account is valid in the USA iTunes Store only * One account is valid in the Dutch iTunes Store only When I was just buying music and loading free TVShows this wasn't much of a problem. Now that I ...
2009/07/16
[ "https://superuser.com/questions/5307", "https://superuser.com", "https://superuser.com/users/32/" ]
The final answer seems t be a big fat **No**. I have found messages of people that have contacted Apple with the same question (for exmaple, <http://discussions.apple.com/thread.jspa?threadID=903657>), and they said they can't or won't do it.
From my understanding of the iTunes account policies this is not possible, as they do not support cross country accounts. This is validate via your credit card number, which is required to have a iTunes account.
42,063,542
I have to draw a triangle in Python using mathplotlib. [This](https://i.stack.imgur.com/42jqU.png) is how it should eventually look like: ![](https://i.stack.imgur.com/42jqU.png) My objective is, once drawn the triangle, to plot some points on it. At the moment I can draw the triangle just fine: ``` import m...
2017/02/06
[ "https://Stackoverflow.com/questions/42063542", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7522051/" ]
There is an [example on the matplotlib page](http://matplotlib.org/examples/pylab_examples/image_clip_path.html) showing how to use a clip path for an image. Adapting this to your case would give this: ``` import matplotlib.pyplot as plt import numpy as np from matplotlib.path import Path from matplotlib.patches i...
In response to the comment by Stücke, here is an example of a rotation (in degrees) of a 2-colour pattern for an arbitrary closed geometry: MWE === This is an example for a geometry with a 2 colour pattern rotated 10 degrees counter clock wise (ccw). ``` def create_gradient_rectangle(): """Creates a gradient in ...
26,697,524
I have the following element in a user control, as the sole child of the default `Grid`: ``` <ListView ItemsSource="{Binding LogCollection}" Name="LogView"> <ListView.View> <GridView> <GridView.Columns> <GridViewColumn DisplayMemberBinding="{Binding Level}" Header="Level"/> ...
2014/11/02
[ "https://Stackoverflow.com/questions/26697524", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8741/" ]
As mentioned in comments it seems like binding context for `ListView.ItemsSource` binding is wrong. `DataContext`. In your case setting `DataContext` manually could solve the problem ``` this.DataContext = this; ``` But this needs to be done after `LogCollection` is created as the property itself does not raise `IN...
Are you sure that LogCollection that you are actually adding items is the one that you are binding your grid to? I have created a sample application that has your code but works as expected? Maybe you need to post more of your code. [Here is my sample application](https://www.dropbox.com/s/ploicaku01mmyj1/WpfApplicati...
12,717,178
My situation is that I have two threads. The 1st thread produces a number of objects which the 2nd thread does not have access to until all of them are created. After that the 2nd thread reads fields in those objects but does so concurrently with the 1st. At this point no thread is changing the values of the fields of ...
2012/10/03
[ "https://Stackoverflow.com/questions/12717178", "https://Stackoverflow.com", "https://Stackoverflow.com/users/840997/" ]
What I would recommend is to use an `AtomicReference<Collection<SomeObject>>`. The first thread would produce the collection of objects and do a `reference.put(collection)`. The 2nd thread would see the objects (`reference.get()`) after they have been set on the `AtomicReference` only. Here are the [javadocs for `Atomi...
There's nothing wrong with reading data from multiple threads at the same time. Issues arise when you attempt to modify that data. So long as the objects are fully initialized and the values are such that the second thread receives the actual value (no issues with caching etc), there no problem with reading data from m...
2,627,165
Let $(X,T)$ be a topological space and let $Y\subset X$ 1) Assume that Y is an open subset of X. Find and prove a theorem that describes the topology $T\_Y$ in simpler terms. Originally i thought the statement that i was looking for was $B\_Y= \{ B\cap Y | B \in B' \}$ where $B'$ is a basis for T and $B\_Y$ was a bas...
2018/01/29
[ "https://math.stackexchange.com/questions/2627165", "https://math.stackexchange.com", "https://math.stackexchange.com/users/60353/" ]
Consider the elements of the Weyl group just as simple reflections on an euclidian space. These reflections form a group. When these reflections acts on specific vectors called "roots" that belongs to a "root system" they leave the "root system" unchanged. I'll give you an example. Start from an Euclidan space $E$ wit...
By **permutation** he means that the reflection is a bijection from the root system to itself. Since the reflection leaves the root system invariant, you need only check it's injective and surjective. Both of these follow easily from the definition of reflection (and the fact that it's order 2).
540,751
Here we go down the subjective alley .. Lately, I have been adding a file called 'whiteboard.txt' in some of my repositories. I use Mercurial, but this applies to any DVCS. The purpose of the text file is to hash out formats, flow, ideas, etc. Given that most distributed version control systems have some sort of web ...
2009/02/12
[ "https://Stackoverflow.com/questions/540751", "https://Stackoverflow.com", "https://Stackoverflow.com/users/50049/" ]
See also [Hatta](http://hatta.sheep.art.pl/). I've been trying unsuccessfully to get it to work, but that's just cause I'm lousy with setting up Python.
Nice idea, but I would keep the wiki in a separate repository. Somewhat like [Bitbucket.org](http://bitbucket.org) do (when you register a branch, you get two hg repositories, one for the source, and one for the wiki).
540,751
Here we go down the subjective alley .. Lately, I have been adding a file called 'whiteboard.txt' in some of my repositories. I use Mercurial, but this applies to any DVCS. The purpose of the text file is to hash out formats, flow, ideas, etc. Given that most distributed version control systems have some sort of web ...
2009/02/12
[ "https://Stackoverflow.com/questions/540751", "https://Stackoverflow.com", "https://Stackoverflow.com/users/50049/" ]
There's a project called [Fossil](http://www.fossil-scm.org/index.html/doc/tip/www/index.wiki) that does exactly this. I haven't used it personally, but it's made by the same person that wrote SQLite, so my guess is it's small and fast. In fact, according to the site, everything is stored inside a small SQLite database...
Try jscreolewiki, It works off line in a browser, and it's a good idea to store wiki content in a DVCS. <http://jscreolewiki.googlecode.com/svn/trunk/jscreolewiki/index.html>
540,751
Here we go down the subjective alley .. Lately, I have been adding a file called 'whiteboard.txt' in some of my repositories. I use Mercurial, but this applies to any DVCS. The purpose of the text file is to hash out formats, flow, ideas, etc. Given that most distributed version control systems have some sort of web ...
2009/02/12
[ "https://Stackoverflow.com/questions/540751", "https://Stackoverflow.com", "https://Stackoverflow.com/users/50049/" ]
perhaps <http://ikiwiki.info/> A wiki compiler. You can instruct it to store the wiki sources (markdown text files) in a repository (e.g. git, mercurial, subversion). Edits can be done via web, or working copy.
To annotate your commits with information about what was done and why is partly the reason why I use an issue tracking system such as [Trac](http://trac.edgewall.org/). A Trac site (or environment as they call it) can be attached with a version control. You can refer to revisions in version control with 'r', to tickets...
540,751
Here we go down the subjective alley .. Lately, I have been adding a file called 'whiteboard.txt' in some of my repositories. I use Mercurial, but this applies to any DVCS. The purpose of the text file is to hash out formats, flow, ideas, etc. Given that most distributed version control systems have some sort of web ...
2009/02/12
[ "https://Stackoverflow.com/questions/540751", "https://Stackoverflow.com", "https://Stackoverflow.com/users/50049/" ]
There's a project called [Fossil](http://www.fossil-scm.org/index.html/doc/tip/www/index.wiki) that does exactly this. I haven't used it personally, but it's made by the same person that wrote SQLite, so my guess is it's small and fast. In fact, according to the site, everything is stored inside a small SQLite database...
See also [Hatta](http://hatta.sheep.art.pl/). I've been trying unsuccessfully to get it to work, but that's just cause I'm lousy with setting up Python.
540,751
Here we go down the subjective alley .. Lately, I have been adding a file called 'whiteboard.txt' in some of my repositories. I use Mercurial, but this applies to any DVCS. The purpose of the text file is to hash out formats, flow, ideas, etc. Given that most distributed version control systems have some sort of web ...
2009/02/12
[ "https://Stackoverflow.com/questions/540751", "https://Stackoverflow.com", "https://Stackoverflow.com/users/50049/" ]
perhaps <http://ikiwiki.info/> A wiki compiler. You can instruct it to store the wiki sources (markdown text files) in a repository (e.g. git, mercurial, subversion). Edits can be done via web, or working copy.
See also [Hatta](http://hatta.sheep.art.pl/). I've been trying unsuccessfully to get it to work, but that's just cause I'm lousy with setting up Python.
540,751
Here we go down the subjective alley .. Lately, I have been adding a file called 'whiteboard.txt' in some of my repositories. I use Mercurial, but this applies to any DVCS. The purpose of the text file is to hash out formats, flow, ideas, etc. Given that most distributed version control systems have some sort of web ...
2009/02/12
[ "https://Stackoverflow.com/questions/540751", "https://Stackoverflow.com", "https://Stackoverflow.com/users/50049/" ]
perhaps <http://ikiwiki.info/> A wiki compiler. You can instruct it to store the wiki sources (markdown text files) in a repository (e.g. git, mercurial, subversion). Edits can be done via web, or working copy.
Nice idea, but I would keep the wiki in a separate repository. Somewhat like [Bitbucket.org](http://bitbucket.org) do (when you register a branch, you get two hg repositories, one for the source, and one for the wiki).
540,751
Here we go down the subjective alley .. Lately, I have been adding a file called 'whiteboard.txt' in some of my repositories. I use Mercurial, but this applies to any DVCS. The purpose of the text file is to hash out formats, flow, ideas, etc. Given that most distributed version control systems have some sort of web ...
2009/02/12
[ "https://Stackoverflow.com/questions/540751", "https://Stackoverflow.com", "https://Stackoverflow.com/users/50049/" ]
There's a project called [Fossil](http://www.fossil-scm.org/index.html/doc/tip/www/index.wiki) that does exactly this. I haven't used it personally, but it's made by the same person that wrote SQLite, so my guess is it's small and fast. In fact, according to the site, everything is stored inside a small SQLite database...
I have a couple of suggestions: * [GitHub](http://github.com/) has an integrated wiki ([e.g.](http://wiki.github.com/rails/rails)). So do many other hosted VCS solutions, such as Google Code. * [Trac](http://trac.edgewall.org/) is a wiki with very tight VCS bindings and a development-oriented focus.
540,751
Here we go down the subjective alley .. Lately, I have been adding a file called 'whiteboard.txt' in some of my repositories. I use Mercurial, but this applies to any DVCS. The purpose of the text file is to hash out formats, flow, ideas, etc. Given that most distributed version control systems have some sort of web ...
2009/02/12
[ "https://Stackoverflow.com/questions/540751", "https://Stackoverflow.com", "https://Stackoverflow.com/users/50049/" ]
There's a project called [Fossil](http://www.fossil-scm.org/index.html/doc/tip/www/index.wiki) that does exactly this. I haven't used it personally, but it's made by the same person that wrote SQLite, so my guess is it's small and fast. In fact, according to the site, everything is stored inside a small SQLite database...
Nice idea, but I would keep the wiki in a separate repository. Somewhat like [Bitbucket.org](http://bitbucket.org) do (when you register a branch, you get two hg repositories, one for the source, and one for the wiki).
540,751
Here we go down the subjective alley .. Lately, I have been adding a file called 'whiteboard.txt' in some of my repositories. I use Mercurial, but this applies to any DVCS. The purpose of the text file is to hash out formats, flow, ideas, etc. Given that most distributed version control systems have some sort of web ...
2009/02/12
[ "https://Stackoverflow.com/questions/540751", "https://Stackoverflow.com", "https://Stackoverflow.com/users/50049/" ]
perhaps <http://ikiwiki.info/> A wiki compiler. You can instruct it to store the wiki sources (markdown text files) in a repository (e.g. git, mercurial, subversion). Edits can be done via web, or working copy.
I have a couple of suggestions: * [GitHub](http://github.com/) has an integrated wiki ([e.g.](http://wiki.github.com/rails/rails)). So do many other hosted VCS solutions, such as Google Code. * [Trac](http://trac.edgewall.org/) is a wiki with very tight VCS bindings and a development-oriented focus.
540,751
Here we go down the subjective alley .. Lately, I have been adding a file called 'whiteboard.txt' in some of my repositories. I use Mercurial, but this applies to any DVCS. The purpose of the text file is to hash out formats, flow, ideas, etc. Given that most distributed version control systems have some sort of web ...
2009/02/12
[ "https://Stackoverflow.com/questions/540751", "https://Stackoverflow.com", "https://Stackoverflow.com/users/50049/" ]
perhaps <http://ikiwiki.info/> A wiki compiler. You can instruct it to store the wiki sources (markdown text files) in a repository (e.g. git, mercurial, subversion). Edits can be done via web, or working copy.
Try jscreolewiki, It works off line in a browser, and it's a good idea to store wiki content in a DVCS. <http://jscreolewiki.googlecode.com/svn/trunk/jscreolewiki/index.html>
2,974,937
I'd appreciate some help for the following exercise: Construct a (as simple as possible) deductive system where all sequences of the form 1n (which means 111... n-times) is provable if and only if n is not prime. (Note: As simple as possible means that the deductive rules and axioms should follow a simple schema. For ...
2018/10/28
[ "https://math.stackexchange.com/questions/2974937", "https://math.stackexchange.com", "https://math.stackexchange.com/users/446931/" ]
Let $f(x) = 4x^3 + dx^2 + 55x - 100 = (ax+b)^2(x+c)$. It is trivial to see $a = \pm 2$. We will only consider the case $a = 2$. The key of this problem is $f(x)$ contains a squared factor $(ax+b)^2$. This means $f'(x) = 12x^2+2dx+55$ contain $(ax+b)$ as a factor. Given any two polynomials $g(x), h(x) \in \mathbb{C}...
It cannot be done, assuming these coefficients are supposed to be integers. You have established that $a$ may be assumed to be $2$, assuming $a$ is positive. Note that $b^2c=-100$, so $|b|$ is either $1$, $2$, $5$, or $10$. But $b$ cannot be even, or all coeffficients of the right side would be even. And there is tha...
2,974,937
I'd appreciate some help for the following exercise: Construct a (as simple as possible) deductive system where all sequences of the form 1n (which means 111... n-times) is provable if and only if n is not prime. (Note: As simple as possible means that the deductive rules and axioms should follow a simple schema. For ...
2018/10/28
[ "https://math.stackexchange.com/questions/2974937", "https://math.stackexchange.com", "https://math.stackexchange.com/users/446931/" ]
Just do it: $(ax+b)^2(x+c)$ expands to $(a^2x^2 + 2abx + b^2)(x+c) = a^2x^3 + 2abx^2 + b^2 x + a^2cx^2 + 2abcx + b^2c= a^2x^3 + (2ab + a^2c)x^2 + (b^2 +2abc)x + b^2 c$ So $a^2x^3 + (2ab + a^2c)x^2 + (b^2 +2abc)x + b^2 c= 4x^3 + dx^2 + 55x - 100$ So you get three sets of equations: $a^2 = 4$ $2ab + a^2c = d$ $b^2...
You can expand out the left side. The coefficient of each power of $x$ on the left must match the corresponding coefficient on the right. But you'll end up solving a cubic equation for $b$, $c$ or $d$.
2,974,937
I'd appreciate some help for the following exercise: Construct a (as simple as possible) deductive system where all sequences of the form 1n (which means 111... n-times) is provable if and only if n is not prime. (Note: As simple as possible means that the deductive rules and axioms should follow a simple schema. For ...
2018/10/28
[ "https://math.stackexchange.com/questions/2974937", "https://math.stackexchange.com", "https://math.stackexchange.com/users/446931/" ]
Let $f(x) = 4x^3 + dx^2 + 55x - 100 = (ax+b)^2(x+c)$. It is trivial to see $a = \pm 2$. We will only consider the case $a = 2$. The key of this problem is $f(x)$ contains a squared factor $(ax+b)^2$. This means $f'(x) = 12x^2+2dx+55$ contain $(ax+b)$ as a factor. Given any two polynomials $g(x), h(x) \in \mathbb{C}...
Hint: $$(ax+b)^2(x+c)={a}^{2}c{x}^{2}+{a}^{2}{x}^{3}+2\,abcx+2\,ab{x}^{2}+{b}^{2}c+x{b}^{2}=a^2x^3+x^2(a^2c+2ab)+x(2abc+b^2)+b^2c$$
2,974,937
I'd appreciate some help for the following exercise: Construct a (as simple as possible) deductive system where all sequences of the form 1n (which means 111... n-times) is provable if and only if n is not prime. (Note: As simple as possible means that the deductive rules and axioms should follow a simple schema. For ...
2018/10/28
[ "https://math.stackexchange.com/questions/2974937", "https://math.stackexchange.com", "https://math.stackexchange.com/users/446931/" ]
Hint: $$(ax+b)^2(x+c)={a}^{2}c{x}^{2}+{a}^{2}{x}^{3}+2\,abcx+2\,ab{x}^{2}+{b}^{2}c+x{b}^{2}=a^2x^3+x^2(a^2c+2ab)+x(2abc+b^2)+b^2c$$
You can expand out the left side. The coefficient of each power of $x$ on the left must match the corresponding coefficient on the right. But you'll end up solving a cubic equation for $b$, $c$ or $d$.
2,974,937
I'd appreciate some help for the following exercise: Construct a (as simple as possible) deductive system where all sequences of the form 1n (which means 111... n-times) is provable if and only if n is not prime. (Note: As simple as possible means that the deductive rules and axioms should follow a simple schema. For ...
2018/10/28
[ "https://math.stackexchange.com/questions/2974937", "https://math.stackexchange.com", "https://math.stackexchange.com/users/446931/" ]
Just do it: $(ax+b)^2(x+c)$ expands to $(a^2x^2 + 2abx + b^2)(x+c) = a^2x^3 + 2abx^2 + b^2 x + a^2cx^2 + 2abcx + b^2c= a^2x^3 + (2ab + a^2c)x^2 + (b^2 +2abc)x + b^2 c$ So $a^2x^3 + (2ab + a^2c)x^2 + (b^2 +2abc)x + b^2 c= 4x^3 + dx^2 + 55x - 100$ So you get three sets of equations: $a^2 = 4$ $2ab + a^2c = d$ $b^2...
It cannot be done, assuming these coefficients are supposed to be integers. You have established that $a$ may be assumed to be $2$, assuming $a$ is positive. Note that $b^2c=-100$, so $|b|$ is either $1$, $2$, $5$, or $10$. But $b$ cannot be even, or all coeffficients of the right side would be even. And there is tha...
2,974,937
I'd appreciate some help for the following exercise: Construct a (as simple as possible) deductive system where all sequences of the form 1n (which means 111... n-times) is provable if and only if n is not prime. (Note: As simple as possible means that the deductive rules and axioms should follow a simple schema. For ...
2018/10/28
[ "https://math.stackexchange.com/questions/2974937", "https://math.stackexchange.com", "https://math.stackexchange.com/users/446931/" ]
Let $f(x) = 4x^3 + dx^2 + 55x - 100 = (ax+b)^2(x+c)$. It is trivial to see $a = \pm 2$. We will only consider the case $a = 2$. The key of this problem is $f(x)$ contains a squared factor $(ax+b)^2$. This means $f'(x) = 12x^2+2dx+55$ contain $(ax+b)$ as a factor. Given any two polynomials $g(x), h(x) \in \mathbb{C}...
Just do it: $(ax+b)^2(x+c)$ expands to $(a^2x^2 + 2abx + b^2)(x+c) = a^2x^3 + 2abx^2 + b^2 x + a^2cx^2 + 2abcx + b^2c= a^2x^3 + (2ab + a^2c)x^2 + (b^2 +2abc)x + b^2 c$ So $a^2x^3 + (2ab + a^2c)x^2 + (b^2 +2abc)x + b^2 c= 4x^3 + dx^2 + 55x - 100$ So you get three sets of equations: $a^2 = 4$ $2ab + a^2c = d$ $b^2...
2,974,937
I'd appreciate some help for the following exercise: Construct a (as simple as possible) deductive system where all sequences of the form 1n (which means 111... n-times) is provable if and only if n is not prime. (Note: As simple as possible means that the deductive rules and axioms should follow a simple schema. For ...
2018/10/28
[ "https://math.stackexchange.com/questions/2974937", "https://math.stackexchange.com", "https://math.stackexchange.com/users/446931/" ]
Hint: $$(ax+b)^2(x+c)={a}^{2}c{x}^{2}+{a}^{2}{x}^{3}+2\,abcx+2\,ab{x}^{2}+{b}^{2}c+x{b}^{2}=a^2x^3+x^2(a^2c+2ab)+x(2abc+b^2)+b^2c$$
There are four unknown in $$(ax+b)^2(x+c) = 4x^3 + dx^2 + 55x - 100$$, so by assigning four values to $x$ and solving the resulting equations you find your unknowns. For example for $x=0$ we get $$2bc = - 100$$ For x=1, you get $$(a+b)^2(1+c) = 4 + d + 55 - 100$$ The rest is simple algebra and you can manage it.
2,974,937
I'd appreciate some help for the following exercise: Construct a (as simple as possible) deductive system where all sequences of the form 1n (which means 111... n-times) is provable if and only if n is not prime. (Note: As simple as possible means that the deductive rules and axioms should follow a simple schema. For ...
2018/10/28
[ "https://math.stackexchange.com/questions/2974937", "https://math.stackexchange.com", "https://math.stackexchange.com/users/446931/" ]
Hint: $$(ax+b)^2(x+c)={a}^{2}c{x}^{2}+{a}^{2}{x}^{3}+2\,abcx+2\,ab{x}^{2}+{b}^{2}c+x{b}^{2}=a^2x^3+x^2(a^2c+2ab)+x(2abc+b^2)+b^2c$$
It cannot be done, assuming these coefficients are supposed to be integers. You have established that $a$ may be assumed to be $2$, assuming $a$ is positive. Note that $b^2c=-100$, so $|b|$ is either $1$, $2$, $5$, or $10$. But $b$ cannot be even, or all coeffficients of the right side would be even. And there is tha...
2,974,937
I'd appreciate some help for the following exercise: Construct a (as simple as possible) deductive system where all sequences of the form 1n (which means 111... n-times) is provable if and only if n is not prime. (Note: As simple as possible means that the deductive rules and axioms should follow a simple schema. For ...
2018/10/28
[ "https://math.stackexchange.com/questions/2974937", "https://math.stackexchange.com", "https://math.stackexchange.com/users/446931/" ]
Just do it: $(ax+b)^2(x+c)$ expands to $(a^2x^2 + 2abx + b^2)(x+c) = a^2x^3 + 2abx^2 + b^2 x + a^2cx^2 + 2abcx + b^2c= a^2x^3 + (2ab + a^2c)x^2 + (b^2 +2abc)x + b^2 c$ So $a^2x^3 + (2ab + a^2c)x^2 + (b^2 +2abc)x + b^2 c= 4x^3 + dx^2 + 55x - 100$ So you get three sets of equations: $a^2 = 4$ $2ab + a^2c = d$ $b^2...
There are four unknown in $$(ax+b)^2(x+c) = 4x^3 + dx^2 + 55x - 100$$, so by assigning four values to $x$ and solving the resulting equations you find your unknowns. For example for $x=0$ we get $$2bc = - 100$$ For x=1, you get $$(a+b)^2(1+c) = 4 + d + 55 - 100$$ The rest is simple algebra and you can manage it.
2,974,937
I'd appreciate some help for the following exercise: Construct a (as simple as possible) deductive system where all sequences of the form 1n (which means 111... n-times) is provable if and only if n is not prime. (Note: As simple as possible means that the deductive rules and axioms should follow a simple schema. For ...
2018/10/28
[ "https://math.stackexchange.com/questions/2974937", "https://math.stackexchange.com", "https://math.stackexchange.com/users/446931/" ]
Let $f(x) = 4x^3 + dx^2 + 55x - 100 = (ax+b)^2(x+c)$. It is trivial to see $a = \pm 2$. We will only consider the case $a = 2$. The key of this problem is $f(x)$ contains a squared factor $(ax+b)^2$. This means $f'(x) = 12x^2+2dx+55$ contain $(ax+b)$ as a factor. Given any two polynomials $g(x), h(x) \in \mathbb{C}...
You can expand out the left side. The coefficient of each power of $x$ on the left must match the corresponding coefficient on the right. But you'll end up solving a cubic equation for $b$, $c$ or $d$.
72,203,853
I created a form and within I want 2 ways of submit : * one by filling input field and press enter * one by recording voice (I use the library react-speech-recognition) Since I added the second way, the input field doesn't work. I can write something and press enter but it will necessarily call the function bind to t...
2022/05/11
[ "https://Stackoverflow.com/questions/72203853", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10971146/" ]
Solution -------- Your stop and reset buttons must have `type="button"`, or else the first of the two will behave as a submit button. If you need a form submission button, use an explicit submit button of `type="submit"`. Why this happens ---------------- [By default](https://developer.mozilla.org/en-US/docs/Web/HTM...
Try using `onclick="event.preventDefault()";` to prevent the default behavior of the buttons. [More info here](https://developer.mozilla.org/en-US/docs/Web/API/Event/preventDefault)
21,491,307
I am trying to make an onscreen keyboard program, wherein when I press a given key a picture of it shows up on the screen, but I found that when I pressed A, B, C, and D altogether on my keyboard, only A, B, and C showed up. When I tried to press the keys in a different order, there was always one letter that didn't sh...
2014/01/31
[ "https://Stackoverflow.com/questions/21491307", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3080524/" ]
You can do this on each Series/column using [str.replace](http://pandas.pydata.org/pandas-docs/stable/generated/pandas.DataFrame.replace.html): ``` In [11]: s = pd.Series(['potatoes are "great"', 'they are']) In [12]: s Out[12]: 0 potatoes are "great" 1 they are dtype: object In [13]: s.str.replac...
This will do what you want: ``` returnlist=[] for char in string: if char != '"': returnlist.append(char) string="".join(returnlist) ```
21,491,307
I am trying to make an onscreen keyboard program, wherein when I press a given key a picture of it shows up on the screen, but I found that when I pressed A, B, C, and D altogether on my keyboard, only A, B, and C showed up. When I tried to press the keys in a different order, there was always one letter that didn't sh...
2014/01/31
[ "https://Stackoverflow.com/questions/21491307", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3080524/" ]
use `DataFrame.apply()` and `Series.str.replace()`: ``` import numpy as np import pandas as pd import random a = np.array(["".join(random.sample('abcde"', 3)) for i in range(100)]).reshape(10, 10) df = pd.DataFrame(a) df.apply(lambda s:s.str.replace('"', "")) ``` If just `string` columns: ``` df.ix[:,df.dtypes==ob...
This will do what you want: ``` returnlist=[] for char in string: if char != '"': returnlist.append(char) string="".join(returnlist) ```
21,491,307
I am trying to make an onscreen keyboard program, wherein when I press a given key a picture of it shows up on the screen, but I found that when I pressed A, B, C, and D altogether on my keyboard, only A, B, and C showed up. When I tried to press the keys in a different order, there was always one letter that didn't sh...
2014/01/31
[ "https://Stackoverflow.com/questions/21491307", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3080524/" ]
You can do this on each Series/column using [str.replace](http://pandas.pydata.org/pandas-docs/stable/generated/pandas.DataFrame.replace.html): ``` In [11]: s = pd.Series(['potatoes are "great"', 'they are']) In [12]: s Out[12]: 0 potatoes are "great" 1 they are dtype: object In [13]: s.str.replac...
use `DataFrame.apply()` and `Series.str.replace()`: ``` import numpy as np import pandas as pd import random a = np.array(["".join(random.sample('abcde"', 3)) for i in range(100)]).reshape(10, 10) df = pd.DataFrame(a) df.apply(lambda s:s.str.replace('"', "")) ``` If just `string` columns: ``` df.ix[:,df.dtypes==ob...
90,403
Where is the world's longest publicly accessible purpose-built pedestrian tunnel? Wikipedia has: * [List of long tunnels by type, bicycle and pedestrian](https://en.wikipedia.org/wiki/List_of_long_tunnels_by_type#Bicycle_and_Pedestrian). This is incomplete, as the only long pedestrian tunnel I've been in, the [1.6 km...
2017/03/23
[ "https://travel.stackexchange.com/questions/90403", "https://travel.stackexchange.com", "https://travel.stackexchange.com/users/2509/" ]
Your conditions are quite strict - "Longest", "publicly accessible", AND "purpose-built". A "simple tunnel connecting A to B". There is indeed a tunnel that meets these criteria that at 1,635 metres is slightly longer than the one you've mentioned. The tunnel itself IS publicly accessible, although at the current time...
[Tunnel de la Croix-Rousse](https://en.wikipedia.org/wiki/Tunnel_de_la_Croix-Rousse) in Lyon, France, is a pair of tunnels, the first one for cars, the other one for sustainable transport (pedestrians, cyclists, busses). Their length is 1782m.
90,403
Where is the world's longest publicly accessible purpose-built pedestrian tunnel? Wikipedia has: * [List of long tunnels by type, bicycle and pedestrian](https://en.wikipedia.org/wiki/List_of_long_tunnels_by_type#Bicycle_and_Pedestrian). This is incomplete, as the only long pedestrian tunnel I've been in, the [1.6 km...
2017/03/23
[ "https://travel.stackexchange.com/questions/90403", "https://travel.stackexchange.com", "https://travel.stackexchange.com/users/2509/" ]
Your conditions are quite strict - "Longest", "publicly accessible", AND "purpose-built". A "simple tunnel connecting A to B". There is indeed a tunnel that meets these criteria that at 1,635 metres is slightly longer than the one you've mentioned. The tunnel itself IS publicly accessible, although at the current time...
The pedestrian-part of the [Galleria ENEL Alpe Croppi di Lago](https://map.geo.admin.ch/?lang=en&topic=ech&bgLayer=ch.swisstopo.pixelkarte-farbe&layers=ch.swisstopo.zeitreihen,ch.bfs.gebaeude_wohnungs_register,ch.bav.haltestellen-oev,ch.swisstopo.swisstlm3d-wanderwege,KML%7C%7Chttps:%2F%2Fpublic.geo.admin.ch%2FV08dxMkN...
90,403
Where is the world's longest publicly accessible purpose-built pedestrian tunnel? Wikipedia has: * [List of long tunnels by type, bicycle and pedestrian](https://en.wikipedia.org/wiki/List_of_long_tunnels_by_type#Bicycle_and_Pedestrian). This is incomplete, as the only long pedestrian tunnel I've been in, the [1.6 km...
2017/03/23
[ "https://travel.stackexchange.com/questions/90403", "https://travel.stackexchange.com", "https://travel.stackexchange.com/users/2509/" ]
Your conditions are quite strict - "Longest", "publicly accessible", AND "purpose-built". A "simple tunnel connecting A to B". There is indeed a tunnel that meets these criteria that at 1,635 metres is slightly longer than the one you've mentioned. The tunnel itself IS publicly accessible, although at the current time...
There's a pedestrian tunnel [under construction under Løvstakken](https://www.bt.no/nyheter/lokalt/i/Eo3zL3/bergen-faar-verdens-lengste-sykkeltunnel-i-2023), in Bergen, Norway. The length is 2900m. It's scheduled to open in 2023. > > Parallelt med traseen bygges det en gang- og sykkeltunnel. Tunnelen vil bli en tovei...
90,403
Where is the world's longest publicly accessible purpose-built pedestrian tunnel? Wikipedia has: * [List of long tunnels by type, bicycle and pedestrian](https://en.wikipedia.org/wiki/List_of_long_tunnels_by_type#Bicycle_and_Pedestrian). This is incomplete, as the only long pedestrian tunnel I've been in, the [1.6 km...
2017/03/23
[ "https://travel.stackexchange.com/questions/90403", "https://travel.stackexchange.com", "https://travel.stackexchange.com/users/2509/" ]
The pedestrian-part of the [Galleria ENEL Alpe Croppi di Lago](https://map.geo.admin.ch/?lang=en&topic=ech&bgLayer=ch.swisstopo.pixelkarte-farbe&layers=ch.swisstopo.zeitreihen,ch.bfs.gebaeude_wohnungs_register,ch.bav.haltestellen-oev,ch.swisstopo.swisstlm3d-wanderwege,KML%7C%7Chttps:%2F%2Fpublic.geo.admin.ch%2FV08dxMkN...
[Tunnel de la Croix-Rousse](https://en.wikipedia.org/wiki/Tunnel_de_la_Croix-Rousse) in Lyon, France, is a pair of tunnels, the first one for cars, the other one for sustainable transport (pedestrians, cyclists, busses). Their length is 1782m.
90,403
Where is the world's longest publicly accessible purpose-built pedestrian tunnel? Wikipedia has: * [List of long tunnels by type, bicycle and pedestrian](https://en.wikipedia.org/wiki/List_of_long_tunnels_by_type#Bicycle_and_Pedestrian). This is incomplete, as the only long pedestrian tunnel I've been in, the [1.6 km...
2017/03/23
[ "https://travel.stackexchange.com/questions/90403", "https://travel.stackexchange.com", "https://travel.stackexchange.com/users/2509/" ]
The pedestrian-part of the [Galleria ENEL Alpe Croppi di Lago](https://map.geo.admin.ch/?lang=en&topic=ech&bgLayer=ch.swisstopo.pixelkarte-farbe&layers=ch.swisstopo.zeitreihen,ch.bfs.gebaeude_wohnungs_register,ch.bav.haltestellen-oev,ch.swisstopo.swisstlm3d-wanderwege,KML%7C%7Chttps:%2F%2Fpublic.geo.admin.ch%2FV08dxMkN...
There's a pedestrian tunnel [under construction under Løvstakken](https://www.bt.no/nyheter/lokalt/i/Eo3zL3/bergen-faar-verdens-lengste-sykkeltunnel-i-2023), in Bergen, Norway. The length is 2900m. It's scheduled to open in 2023. > > Parallelt med traseen bygges det en gang- og sykkeltunnel. Tunnelen vil bli en tovei...
432,478
> > Институт открыт для всех при одном условии: **принимаются только дети > богатых родителей.** > > > Помогите пожалуйста определить: что "*принимаются только дети богатых родителей*" с синтаксической точки зрения? Если я правильно интерпретирую, после двоеточия называется условие. Но это не придаточное условия...
2017/06/10
[ "https://rus.stackexchange.com/questions/432478", "https://rus.stackexchange.com", "https://rus.stackexchange.com/users/177434/" ]
> > Если я правильно интерпретирую, после двоеточия называется условие. Но > это не придаточное условия. Простое предложение? > > > Это не придаточное. Примерный ход ваших рассуждений должен быть таким. Придаточные в русском языке бывают только в сложноподчиненных предложениях (ССП), а они присоединяются тольк...
Это бессоюзное сложное предложение. Соответственно, выделенная вами часть – одна из основ.
432,478
> > Институт открыт для всех при одном условии: **принимаются только дети > богатых родителей.** > > > Помогите пожалуйста определить: что "*принимаются только дети богатых родителей*" с синтаксической точки зрения? Если я правильно интерпретирую, после двоеточия называется условие. Но это не придаточное условия...
2017/06/10
[ "https://rus.stackexchange.com/questions/432478", "https://rus.stackexchange.com", "https://rus.stackexchange.com/users/177434/" ]
**Это бессоюзное сложное предложение,** так как содержит две предикативные основы (институт открыт и принимаются дети), но не содержит союза. Соответственно, связь является бессоюзной, отношение между частями предложения выражается интонацией и дополнительными структурными элементами. В данном случае второе предложен...
Это бессоюзное сложное предложение. Соответственно, выделенная вами часть – одна из основ.
432,478
> > Институт открыт для всех при одном условии: **принимаются только дети > богатых родителей.** > > > Помогите пожалуйста определить: что "*принимаются только дети богатых родителей*" с синтаксической точки зрения? Если я правильно интерпретирую, после двоеточия называется условие. Но это не придаточное условия...
2017/06/10
[ "https://rus.stackexchange.com/questions/432478", "https://rus.stackexchange.com", "https://rus.stackexchange.com/users/177434/" ]
**Это бессоюзное сложное предложение,** так как содержит две предикативные основы (институт открыт и принимаются дети), но не содержит союза. Соответственно, связь является бессоюзной, отношение между частями предложения выражается интонацией и дополнительными структурными элементами. В данном случае второе предложен...
> > Если я правильно интерпретирую, после двоеточия называется условие. Но > это не придаточное условия. Простое предложение? > > > Это не придаточное. Примерный ход ваших рассуждений должен быть таким. Придаточные в русском языке бывают только в сложноподчиненных предложениях (ССП), а они присоединяются тольк...
271,480
I have two questions: **1. Why do I get update conflict in this situation instead of just blocking:** ``` -- prepare drop database if exists [TestSI]; go create database [TestSI]; go alter database [TestSI] set READ_COMMITTED_SNAPSHOT ON; alter database [TestSI] set ALLOW_SNAPSHOT_ISOLATION ON; go use [TestSI]; go dr...
2020/07/23
[ "https://dba.stackexchange.com/questions/271480", "https://dba.stackexchange.com", "https://dba.stackexchange.com/users/212910/" ]
> > Why do I get update conflict in this situation instead of just blocking > > > It is a product defect, which is fixed in SQL Server 2019. A snapshot write conflict occurs when a snapshot transaction attempts to modify a row that has been modified by another transaction that **committed** after the snapshot tra...
> > 2. And the second theoretical question: > > > How does SQL Server handle include columns update? > > I mean how does SQL Server update all nonclustered index which have an include columns when we update this value? I don't see anything related in the query plan. > > > I'm not sure I understand what's goin...
8,857,269
I've got this string: `"37:48.1234567"` (there's a colon and there's a decimal in there) I need to remove everything from the decimal and past it. The number before the decimal could be any length (ie. `1:23:39.12357`).
2012/01/13
[ "https://Stackoverflow.com/questions/8857269", "https://Stackoverflow.com", "https://Stackoverflow.com/users/147586/" ]
``` str.split(".")[0] ``` Hope that helps!
``` result = subject.gsub(/\.[^.]*\Z/, '') ``` does exactly this. It makes sure that if there is more than one decimal, only the last one will be affected.
8,857,269
I've got this string: `"37:48.1234567"` (there's a colon and there's a decimal in there) I need to remove everything from the decimal and past it. The number before the decimal could be any length (ie. `1:23:39.12357`).
2012/01/13
[ "https://Stackoverflow.com/questions/8857269", "https://Stackoverflow.com", "https://Stackoverflow.com/users/147586/" ]
``` str.split(".")[0] ``` Hope that helps!
I made a little benchmark with the solutions up to now. I modified the solutions a bit. One unclear problem: Whats the result for `1:23:39.123.57`? `1:23:39` or `1:23:39.123`? I choosed `1:23:39`, only test regex has the other solution (see [Tims answer](https://stackoverflow.com/a/8857283/676874)) The `split`varian...
6,004,954
I have this [page](http://dev.petmate.com/category/tips-from-the-expert) and I am trying to link to the /our-other-brands page and i have this actionscript code. All the links are working but the our other brands in the top nav...here is the line i cant seem to understand what its doing ``` var sectionName:String = m...
2011/05/14
[ "https://Stackoverflow.com/questions/6004954", "https://Stackoverflow.com", "https://Stackoverflow.com/users/223367/" ]
In the answer you choose there's a difference between the C# and VB.NET version. The VB.NET version won't even compile whereas the C# is correct. This won't compile: ``` Dim tw as TextWriter = New FileStream("Hello.dat", FileMode.Create) ``` This is OK: ``` TextWriter tw = new StreamWriter("Hello.dat"); ``` The ...
They're right - you can't set a TextWriter equal to an instance of FileStream as FileStream does not inherit from TextWriter - you need to use a StreamWriter based on the FileStream as StreamWriter *does* inherit from TextWriter.
45,698,659
I have such code in the controller: ``` for($i=0; $i<$number_of_tourists; $i++) { $tourist = Tourist::updateOrCreate(['doc_number' => $request['doc_number'][$i]], $tourist_to_update); } ``` so, the updateOrCreate method can 1) Update record, 2) Create a new one 3) Leave record untouched if $tourist\_to\_update equ...
2017/08/15
[ "https://Stackoverflow.com/questions/45698659", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5655042/" ]
This is a bit more complex approach, but if you want to get only updated records which have their data changed this is working. In your controller method add: ``` app()->singleton('touristsCollector', function ($app) { $collector = new \stdClass; $collector->updated = []; return $collector; }); for($i = ...
If the model has been created the property `wasRecentlyCreated` will be set to true, so this is how you can check if the model is new or updated: ``` $updated = []; for($i = 0; $i < $number_of_tourists; $i++) { $currentTourist = ['doc_number' => $request['doc_number'][$i]]; $tourist = Tourist::updateOrCreate(...
45,698,659
I have such code in the controller: ``` for($i=0; $i<$number_of_tourists; $i++) { $tourist = Tourist::updateOrCreate(['doc_number' => $request['doc_number'][$i]], $tourist_to_update); } ``` so, the updateOrCreate method can 1) Update record, 2) Create a new one 3) Leave record untouched if $tourist\_to\_update equ...
2017/08/15
[ "https://Stackoverflow.com/questions/45698659", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5655042/" ]
This is a bit more complex approach, but if you want to get only updated records which have their data changed this is working. In your controller method add: ``` app()->singleton('touristsCollector', function ($app) { $collector = new \stdClass; $collector->updated = []; return $collector; }); for($i = ...
If you always want to execute a specific code when a row in tourist table was updated, I would recommend to create an [observer](https://laravel.com/docs/5.5/eloquent#observers) to listen for `updated` or `create` calls. ``` <?php namespace App\Observers; use App\Tourist; class TouristObserver { /** * List...
52,542,908
I am trying to post the states as data to MongoDB through Express and Node with Axios. ``` class App extends React.Component { constructor(props){ super(props) this.state={ items: [{ desc:"Manage", price: 5000, purchased: false, }, { desc:"Deliv...
2018/09/27
[ "https://Stackoverflow.com/questions/52542908", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7873279/" ]
To access the `req.body` we need to use body-parser middleware which Parse incoming request bodies in a middleware before your handlers. **Installation** ---------------- ``` $ npm install body-parser ``` > ``` var app = require('express')(); var bodyParser = require('body-parser'); app.use(bodyParser.json()); //...
Please use `app.post` in the server, currently you are creating a get endpoint you should first make a post endpoint to make a post request. Please also check <https://expressjs.com/en/guide/routing.html>
131,498
I'm 29 years old. I couldn't continue my studies after grade 10 due to some financial issues and I didn't have time to practice mathematics. It's been more than 11 years since I left studies. Now I want to continue in the field of programming. I have grasped the knowledge of basic programing concepts like variables, da...
2020/10/23
[ "https://cs.stackexchange.com/questions/131498", "https://cs.stackexchange.com", "https://cs.stackexchange.com/users/127687/" ]
An employer needs *one* person who is good at maths. Unless you go deep into scientific software, 90% of all programming jobs rarely require any mathematical skills at all. You will sometimes find problems in programming contests that have clever solutions if you have mathematical skills, but often very similar proble...
I assume you are familiar with algebra. You should be comfortable with the concept of functions. You should be able to recognize and categorize basic functions (e.g., linear, polynomial, logarithmic, exponential). If you are not familiar with exponents and logarithms, I'd study those too. This is because the logarithmi...
131,498
I'm 29 years old. I couldn't continue my studies after grade 10 due to some financial issues and I didn't have time to practice mathematics. It's been more than 11 years since I left studies. Now I want to continue in the field of programming. I have grasped the knowledge of basic programing concepts like variables, da...
2020/10/23
[ "https://cs.stackexchange.com/questions/131498", "https://cs.stackexchange.com", "https://cs.stackexchange.com/users/127687/" ]
An employer needs *one* person who is good at maths. Unless you go deep into scientific software, 90% of all programming jobs rarely require any mathematical skills at all. You will sometimes find problems in programming contests that have clever solutions if you have mathematical skills, but often very similar proble...
For data structures and algorithms, basic algebra, exponential and logarithmic functions, and a basic course or book on discrete mathematics like one by Kenneth Rosen, should get you warmed up.
10,312,229
When i try to start a ASP.net site on IIS 7.5, i get the following error ``` BC2000: compiler initialization failed unexpectedly: 0x80070005 ``` Searching around i found a possible solution: Go to security settings of C:\Windows\Temp folder and add Full Control permission to users "NETWORK SERVICE" and IIS\_IUSRS. ...
2012/04/25
[ "https://Stackoverflow.com/questions/10312229", "https://Stackoverflow.com", "https://Stackoverflow.com/users/242076/" ]
Try below steps- 1. Set True "Enable 32-bit Applications" for your default application pool if you are running on x64 machine. 2. Grant Full Accesses for **NETWORK SERVICE** and **IIS\_IUSRS** on > > C:\Windows\Temp\ > > > 3. Grant Full Accesses for **NETWORK SERVICE** and **IIS\_IUSRS** on > > C:\Windows\Micr...
Grant Full Access to the user "Network Service" to the folder C:\Windows\Temp
45,374,136
I have a UICollection view which looks like this (see two purple and blue borders): [![UICollectionView with issue](https://i.stack.imgur.com/ADXNg.png)](https://i.stack.imgur.com/ADXNg.png) On iOS 10 there is no header/whitespace, but on iOS11 there is. I've tried everything mentioned here: [How can I enable/disable...
2017/07/28
[ "https://Stackoverflow.com/questions/45374136", "https://Stackoverflow.com", "https://Stackoverflow.com/users/127853/" ]
In iOS 11, there have been some changes to UIScrollView. Try setting the [contentInsetAdjustmentBehavior](https://developer.apple.com/documentation/uikit/uiscrollview/2902261-contentinsetadjustmentbehavior) property ``` collectionView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever; ```
Try this: ``` self.automaticallyAdjustsScrollViewInsets = false - (CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout minimumInteritemSpacingForSectionAtIndex:(NSInteger)section { return 0; } - (CGFloat)collectionView:(UICollectionView *)col...
1,126,165
I am having some problems getting started with this problem, as I never had to deal with an inequality that was between two values with absolute values. Any help is appreciated. The problem is find all values of $x$ in $\mathbb{R}$ that satisfy $4 < |x+2| + |x-1| < 5$. I keep trying to find cases with $x < -2$ or $x \g...
2015/01/30
[ "https://math.stackexchange.com/questions/1126165", "https://math.stackexchange.com", "https://math.stackexchange.com/users/211714/" ]
You can think of it as drawing the graph of such double-absolute value functions. So it is obvious that $-2$ and $1$ are two special points. If $x \leq -2$, then $|x+2|=-x-2$ and $|x-1|=1-x$, so the $f(x) = -x-2+1-x = -1 - 2x $. Solve the inequality of $4<-1-2x<5$ and combine with $x\leq-2$. If $-2<x<1$, then $|x+2|...
I would think about it first in terms of positive numbers. Trying to minimize and maximum the inner expression gives you values of $x=\frac{3}{2}$ and $x=2$; however, these give you back the numbers $4$ and $5$, respectively. Thus, you may only use points very close to $x=\frac{3}{2}$ and $x=2$ (so the endpoints are op...
1,126,165
I am having some problems getting started with this problem, as I never had to deal with an inequality that was between two values with absolute values. Any help is appreciated. The problem is find all values of $x$ in $\mathbb{R}$ that satisfy $4 < |x+2| + |x-1| < 5$. I keep trying to find cases with $x < -2$ or $x \g...
2015/01/30
[ "https://math.stackexchange.com/questions/1126165", "https://math.stackexchange.com", "https://math.stackexchange.com/users/211714/" ]
I would think about it first in terms of positive numbers. Trying to minimize and maximum the inner expression gives you values of $x=\frac{3}{2}$ and $x=2$; however, these give you back the numbers $4$ and $5$, respectively. Thus, you may only use points very close to $x=\frac{3}{2}$ and $x=2$ (so the endpoints are op...
If $4 < |x+2| + |x-1| < 5$ then $\ \pm (x+2) \pm (x-1) < 5$. Note that for an opposite choice of sign the inequality is never satisfied since $(x+2) - (x-1)=3$. So the inequality implies $$ 4 < (x+2) + (x-1) < 5$$ or $$4 < -(x+2) -(x-1) < 5$$ The inequality $ 4 < (x+2) + (x-1) < 5$ is equivalent to $4 < 2x+1<5 \iff...
1,126,165
I am having some problems getting started with this problem, as I never had to deal with an inequality that was between two values with absolute values. Any help is appreciated. The problem is find all values of $x$ in $\mathbb{R}$ that satisfy $4 < |x+2| + |x-1| < 5$. I keep trying to find cases with $x < -2$ or $x \g...
2015/01/30
[ "https://math.stackexchange.com/questions/1126165", "https://math.stackexchange.com", "https://math.stackexchange.com/users/211714/" ]
I would think about it first in terms of positive numbers. Trying to minimize and maximum the inner expression gives you values of $x=\frac{3}{2}$ and $x=2$; however, these give you back the numbers $4$ and $5$, respectively. Thus, you may only use points very close to $x=\frac{3}{2}$ and $x=2$ (so the endpoints are op...
Think of it as a two variable inequality 4<|x+2|+|y-1|<5 Then pairs x,y may be represented by points, and the condition states that their taxi-cab distances to (-2,1) are bigger than 4, smaller than 5. Draw the two taxi-cab balls (same center (2,-1), different radius 4 and 5). The solution is the 'disk' left between t...
1,126,165
I am having some problems getting started with this problem, as I never had to deal with an inequality that was between two values with absolute values. Any help is appreciated. The problem is find all values of $x$ in $\mathbb{R}$ that satisfy $4 < |x+2| + |x-1| < 5$. I keep trying to find cases with $x < -2$ or $x \g...
2015/01/30
[ "https://math.stackexchange.com/questions/1126165", "https://math.stackexchange.com", "https://math.stackexchange.com/users/211714/" ]
You can think of it as drawing the graph of such double-absolute value functions. So it is obvious that $-2$ and $1$ are two special points. If $x \leq -2$, then $|x+2|=-x-2$ and $|x-1|=1-x$, so the $f(x) = -x-2+1-x = -1 - 2x $. Solve the inequality of $4<-1-2x<5$ and combine with $x\leq-2$. If $-2<x<1$, then $|x+2|...
If $4 < |x+2| + |x-1| < 5$ then $\ \pm (x+2) \pm (x-1) < 5$. Note that for an opposite choice of sign the inequality is never satisfied since $(x+2) - (x-1)=3$. So the inequality implies $$ 4 < (x+2) + (x-1) < 5$$ or $$4 < -(x+2) -(x-1) < 5$$ The inequality $ 4 < (x+2) + (x-1) < 5$ is equivalent to $4 < 2x+1<5 \iff...
1,126,165
I am having some problems getting started with this problem, as I never had to deal with an inequality that was between two values with absolute values. Any help is appreciated. The problem is find all values of $x$ in $\mathbb{R}$ that satisfy $4 < |x+2| + |x-1| < 5$. I keep trying to find cases with $x < -2$ or $x \g...
2015/01/30
[ "https://math.stackexchange.com/questions/1126165", "https://math.stackexchange.com", "https://math.stackexchange.com/users/211714/" ]
You can think of it as drawing the graph of such double-absolute value functions. So it is obvious that $-2$ and $1$ are two special points. If $x \leq -2$, then $|x+2|=-x-2$ and $|x-1|=1-x$, so the $f(x) = -x-2+1-x = -1 - 2x $. Solve the inequality of $4<-1-2x<5$ and combine with $x\leq-2$. If $-2<x<1$, then $|x+2|...
Think of it as a two variable inequality 4<|x+2|+|y-1|<5 Then pairs x,y may be represented by points, and the condition states that their taxi-cab distances to (-2,1) are bigger than 4, smaller than 5. Draw the two taxi-cab balls (same center (2,-1), different radius 4 and 5). The solution is the 'disk' left between t...
4,137,374
I have a swing app with a text box bound to a property on my model (this is a READ\_WRITE AutoBinding). The model also has an isDirty property that I want to bind to a button's enabled property. How do I properly notify the binding when I change the state of isDirty. Here is my binding code: ``` BeanProperty<PaChann...
2010/11/09
[ "https://Stackoverflow.com/questions/4137374", "https://Stackoverflow.com", "https://Stackoverflow.com/users/445087/" ]
You shouldn't use base64 to copy the canvas. You can pass the source canvas into the destination canvas' context method, drawImage. Otherwise you will suffer a serious performance hit. See my jsperf test at <http://jsperf.com/copying-a-canvas-element>. `drawImage()` will accept a `Canvas` as well as an `Image` object...
1. First create an Image Element & give the Image source as the cached `.DataURL()` source 2. Using the Image `<img />` (which we created earlier) draw the Image Content onto second Canvas element E.g.: ``` window.onload = function() { var canvas1 = document.getElementById('canvas1'); var canvas2 = document....
55,888,809
First, I want to simulate let 20 data sets using for loop. Once these data sets are generated, I want to add a new variable (column) to these data sets on each iteration. The new variable is the sum of all columns of each data set. ``` library(bindata) set.seed(485) cor.mat = diag(1, nrow = 3) for (i in 1:nrow(cor.mat...
2019/04/28
[ "https://Stackoverflow.com/questions/55888809", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11422344/" ]
**No additional vulnerabilities are added through this.** They would either be already present, or already secured. --- **In HTML**, the single quote `'` has no special meaning, removing backslashes is fine. **In JavaScript**, single quotes are used to delimitate strings. * If the content is outputted directly in a...
What I understand in this case is that the output is following the [addslashes](https://php.net/manual/es/function.addslashes.php) rule. I don't think that it will be conditioning the security, because it is only changing the string value. It is important then if you connect to the Data Base to use PREPARED SQL Queries...
19,903,665
I have an app which has been extensively tested with iOS 6 and works well, while on iOS 7 it crashes almost always (but not 100% times) with an `Thread 1: EXC_BAD_ACCESS` error in the main, without much to trace. I am completely clueless of its whereabouts. I believe something in my code is not compatible with the core...
2013/11/11
[ "https://Stackoverflow.com/questions/19903665", "https://Stackoverflow.com", "https://Stackoverflow.com/users/899216/" ]
OK, Finally I got it working. That was a nice learning experience overall :). Actually the very nature of "EXE\_BAD\_ACCESS" did hint towards bad memory management, i.e. I was requesting access to something non-existent. Unfortunately, (or quite logically, which I missed earlier) leaks would not find it. But they were...
Got few similar problems with iOS7, due to autolayout issues (my issues). Be sure that the size exist and is valid, for example a size with 0,0, can't create a valid graphics context. I also add a method that you can us as a category on UIView to get screenshot of a particular view. If on iOS6 or lower it uses the w...
19,903,665
I have an app which has been extensively tested with iOS 6 and works well, while on iOS 7 it crashes almost always (but not 100% times) with an `Thread 1: EXC_BAD_ACCESS` error in the main, without much to trace. I am completely clueless of its whereabouts. I believe something in my code is not compatible with the core...
2013/11/11
[ "https://Stackoverflow.com/questions/19903665", "https://Stackoverflow.com", "https://Stackoverflow.com/users/899216/" ]
If your UIView's height is nearly zero(such as 0.1), `drawViewHierarchyInRect: afterScreenUpdates:` will crash. So check the size before you call it. PS: This only happens on iOS 7
Got few similar problems with iOS7, due to autolayout issues (my issues). Be sure that the size exist and is valid, for example a size with 0,0, can't create a valid graphics context. I also add a method that you can us as a category on UIView to get screenshot of a particular view. If on iOS6 or lower it uses the w...
19,903,665
I have an app which has been extensively tested with iOS 6 and works well, while on iOS 7 it crashes almost always (but not 100% times) with an `Thread 1: EXC_BAD_ACCESS` error in the main, without much to trace. I am completely clueless of its whereabouts. I believe something in my code is not compatible with the core...
2013/11/11
[ "https://Stackoverflow.com/questions/19903665", "https://Stackoverflow.com", "https://Stackoverflow.com/users/899216/" ]
OK, Finally I got it working. That was a nice learning experience overall :). Actually the very nature of "EXE\_BAD\_ACCESS" did hint towards bad memory management, i.e. I was requesting access to something non-existent. Unfortunately, (or quite logically, which I missed earlier) leaks would not find it. But they were...
If your UIView's height is nearly zero(such as 0.1), `drawViewHierarchyInRect: afterScreenUpdates:` will crash. So check the size before you call it. PS: This only happens on iOS 7
40,870,519
We track IPs that attack our site. First attack, we temp block them. Tf they ever attack again then we permanently blacklist them. Information for each attack by each IP is stored in perpetuum. Twice daily, reports with an Excel spreadsheet with all pertinent information is emailed to various people, and then the infor...
2016/11/29
[ "https://Stackoverflow.com/questions/40870519", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7226221/" ]
You can make use of the SQL Server Integration Services(SSIS). You can write an SSIS package that import the data from the given Excel spreadsheet to a table and then from that table you can write insert or update statements to your production table. You can use "Data Flow task" to Import the Data from the excel file ...
> > Twice daily, reports with an Excel spreadsheet with all pertinent information is emailed to various people, > > > Try saving the File to a location and then use SSMS Export,Import Wizard ..This package can be saved and set to Run Daily Here is a step by step tutorial covering the same.. <https://www.mssqltip...
51,777,801
I have 2 activities and I have a transition animation between the 2. After going from activity 1 to activity 2 I want to remove activity 1 from the stack I can't use Intent.FLAG\_ACTIVITY\_CLEAR\_TASK because that causes the first activity to be killed before the animation is done and causes weird animations. Is ther...
2018/08/10
[ "https://Stackoverflow.com/questions/51777801", "https://Stackoverflow.com", "https://Stackoverflow.com/users/242769/" ]
The problem is that your code is adding two events to the click handler for the object. All of your code is executed before the button is ever pressed, so both things happen on every button press. To correct this, you can either change your click event after the button has been clicked: ```js $('.gameboy-button').clic...
``` $('.gameboy-button').click(function(){ $('.gb1').fadeOut(500); $('.gb2').fadeIn(3000); $('.gameboy-button').off('click').click(function(){ $('.gb2').fadeOut(500); $('.gb3').fadeIn(3000); }); ```
51,777,801
I have 2 activities and I have a transition animation between the 2. After going from activity 1 to activity 2 I want to remove activity 1 from the stack I can't use Intent.FLAG\_ACTIVITY\_CLEAR\_TASK because that causes the first activity to be killed before the animation is done and causes weird animations. Is ther...
2018/08/10
[ "https://Stackoverflow.com/questions/51777801", "https://Stackoverflow.com", "https://Stackoverflow.com/users/242769/" ]
The problem is that your code is adding two events to the click handler for the object. All of your code is executed before the button is ever pressed, so both things happen on every button press. To correct this, you can either change your click event after the button has been clicked: ```js $('.gameboy-button').clic...
Would you try this tried to grab all in function ```js var index = 1; function fadeInPic() { $('.gb1').fadeIn(3000).delay(500); } function fadeInPicByClick() { console.log($('.toggleDiv').length); var currentIndex = index; index++; if ($('.toggleDiv').length + 1 == index) { currentindex = $('....
51,777,801
I have 2 activities and I have a transition animation between the 2. After going from activity 1 to activity 2 I want to remove activity 1 from the stack I can't use Intent.FLAG\_ACTIVITY\_CLEAR\_TASK because that causes the first activity to be killed before the animation is done and causes weird animations. Is ther...
2018/08/10
[ "https://Stackoverflow.com/questions/51777801", "https://Stackoverflow.com", "https://Stackoverflow.com/users/242769/" ]
You just need to cycle the images... But be cautious about the fade delays... It can lead to many concurring animations if you click too fast. That's why [`.stop()`](https://api.jquery.com/stop/) is used here, to stop the current animation queue. Then, if you have 3 images, what happens after 4 click? You have to...
``` $('.gameboy-button').click(function(){ $('.gb1').fadeOut(500); $('.gb2').fadeIn(3000); $('.gameboy-button').off('click').click(function(){ $('.gb2').fadeOut(500); $('.gb3').fadeIn(3000); }); ```
51,777,801
I have 2 activities and I have a transition animation between the 2. After going from activity 1 to activity 2 I want to remove activity 1 from the stack I can't use Intent.FLAG\_ACTIVITY\_CLEAR\_TASK because that causes the first activity to be killed before the animation is done and causes weird animations. Is ther...
2018/08/10
[ "https://Stackoverflow.com/questions/51777801", "https://Stackoverflow.com", "https://Stackoverflow.com/users/242769/" ]
You just need to cycle the images... But be cautious about the fade delays... It can lead to many concurring animations if you click too fast. That's why [`.stop()`](https://api.jquery.com/stop/) is used here, to stop the current animation queue. Then, if you have 3 images, what happens after 4 click? You have to...
Would you try this tried to grab all in function ```js var index = 1; function fadeInPic() { $('.gb1').fadeIn(3000).delay(500); } function fadeInPicByClick() { console.log($('.toggleDiv').length); var currentIndex = index; index++; if ($('.toggleDiv').length + 1 == index) { currentindex = $('....
34,447,032
I have built an Angular app with Django Rest Framework as a backend. In the user profile edit page, it contains the picture cropping using [ngImgCrop](https://github.com/alexk111/ngImgCrop). Then I got the cropped image result as **data:image/png;base64**. But when I call $http patch in the controller to update the p...
2015/12/24
[ "https://Stackoverflow.com/questions/34447032", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1495802/" ]
Instead of ``` function(input_1, callback_outer){ console.log("Outer function 2"); // Run the inner function, and get the results // How should this be structured??? callback_outer(null, InnerAsync()) } ``` it should be ``` function(input_1, callback_outer){ console.log("Outer function 2"); ...
I think you are calling the **InnerAsync** without any argument; so while calling the **InnerAsync** you are not passing the callback function **callback\_inner\_async** that by you are getting the error. try this: ``` async.waterfall([ function(callback_outer){ console.log("Outer function 1"); ca...
58,905,837
I'm trying to split a string into an array. This should be fine as `str.split(" ")` should work fine, however the string is actually in the form of `"xyz 100b\nabc 200b\ndef 400b"`. I'm wondering what the best way to handle this is. I also need to return 4 strings in the format they gave. Below is how I'm trying it now...
2019/11/17
[ "https://Stackoverflow.com/questions/58905837", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8704603/" ]
I hope i understood your question right but if you're looking to extract the number and return them in the specific format you could go like this : ``` // Assuming the String would be like a repetition of [word][space][number][b][\n] String testString = "xyz 100b\nabc 200b\ndef 400b"; // Split by both end...
You should put this code in the "return" instead of the one you already have: ``` return "answer 1" + array[0] + "b\n" + "answer 2 " + array[1] + "b\n" + "answer 3" + array[2] + "b\n" + "answer 4 " + array[3] + "b\n"; ```
58,905,837
I'm trying to split a string into an array. This should be fine as `str.split(" ")` should work fine, however the string is actually in the form of `"xyz 100b\nabc 200b\ndef 400b"`. I'm wondering what the best way to handle this is. I also need to return 4 strings in the format they gave. Below is how I'm trying it now...
2019/11/17
[ "https://Stackoverflow.com/questions/58905837", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8704603/" ]
I hope i understood your question right but if you're looking to extract the number and return them in the specific format you could go like this : ``` // Assuming the String would be like a repetition of [word][space][number][b][\n] String testString = "xyz 100b\nabc 200b\ndef 400b"; // Split by both end...
1. The `split()` method takes one regular expression as argument. This: `input.split("\\s+")` will split on whitespace (\s = space, + = 1 or more). 2. Your question is unclear, but if you're supposed to extract the '100', '200', etc, regular expressions are also pretty good at that. You can throw each line through a re...
133,867
Our home appliances are mostly resistive loads and the bill we pay for consuming power is actually real power. If we use more inductive loads at our home, will it just cause problems in power factor or does it affect our bill as well (in the form of consuming more units despite it consume reactive power)?
2014/09/04
[ "https://physics.stackexchange.com/questions/133867", "https://physics.stackexchange.com", "https://physics.stackexchange.com/users/58491/" ]
yes, you will have to pay more if your load is inductive. most of energy meters work with the voltage and current to calculate energy. When we have inductive load it takes more current than resistive load to produce same power or output. P=V.I.Cosx where x is the phase angle between voltage(V) and current(I). if th...
A load is only purely inductive as long as you aren't taking any energy out of it. So a purely inductive load would certainly give us a low (zero!) electricity bill, but it wouldn't be much use as a domestic appliance since it couldn't do anything. Once your appliance starts doing any work it is no longer a purely indu...
27,943,365
I'm trying to build a *WebComponent* where you can edit items in an array, with the Polymer javascript framework. Model to DOM bindings work OK, but DOM to Model doesn't - simplified example: ``` <polymer-element name="rep-test"> <template> <template repeat="{{item in items}}"> <input type="tex...
2015/01/14
[ "https://Stackoverflow.com/questions/27943365", "https://Stackoverflow.com", "https://Stackoverflow.com/users/762488/" ]
Since changes in array’s elements are not reflected to `itemsChanged`, I would suggest you to listen on the input changes: ``` <!-- ⇓⇓⇓⇓⇓⇓⇓⇓⇓ --> <input type="text" on-change="{{ itemChanged }}" value="{{item}}" placeholder="changes don't work!"> [...] <!-- inside script --> itemChanged: ...
Here is an example of bidirectional binding: as you change the values in the input fields model is updated: [Plunk](http://plnkr.co/edit/zpiOIMOgDzdmaWpkS7Vd?p=preview) ``` Follow data changes: <br> {{testData.employees[0].firstName}} <br> {{testData.employees[3].firstName}} <br><br> ...
1,761,410
``` /bin/sh: python3.11.1: command not found [Done] exited with code=127 in 0.003 seconds ``` I am using VS for macOS.
2023/01/06
[ "https://superuser.com/questions/1761410", "https://superuser.com", "https://superuser.com/users/1761612/" ]
You haven't installed Python, or VS is not correctly set configured. First, Python and VS Code need to be correctly installed. Second, you need to install the [Python extension for VS Code](https://marketplace.visualstudio.com/items?itemName=ms-python.python) from the Visual Studio Marketplace. Third, for Python3, V...
There might be several reasons /bin/sh not to find your python binary. You should revisit [VSCode manual](https://code.visualstudio.com/docs/python/environments) on adding python environment variables to your VSCode, specifically you should re-select your interpreter as shown in above link. Next thing is to check (ou...
63,869,859
Based on this question [Detect click outside element](https://stackoverflow.com/questions/36170425/detect-click-outside-element) and this answer <https://stackoverflow.com/a/42389266>, I'm trying to migrate the directive from Vue 2 to Vue 3. It seems that `binding.expression` and `vnode.context` not exists more. How ca...
2020/09/13
[ "https://Stackoverflow.com/questions/63869859", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4963176/" ]
You can use `binding.value` instead like this: ```js const { createApp } = Vue; const highlightEl = (color ) => (event, el) => { if (el) { el.style.background = color; } else { event.target.style.background = color; } } const clearHighlightEl = (event, el) => { if (el) { el.style.background = ''; ...
out of the context, there's an easier way in vue3 with composition. [Link to Vueuse ClickOutside (Vue 3)](https://vueuse.org/core/onClickOutside/) [Link to Vueuse ClickOutside(Vue 2)](https://v5-3-0.vueuse.org/core/onClickOutside/) ```js <template> <div ref="target"> Hello world </div> <div> Outside el...
63,869,859
Based on this question [Detect click outside element](https://stackoverflow.com/questions/36170425/detect-click-outside-element) and this answer <https://stackoverflow.com/a/42389266>, I'm trying to migrate the directive from Vue 2 to Vue 3. It seems that `binding.expression` and `vnode.context` not exists more. How ca...
2020/09/13
[ "https://Stackoverflow.com/questions/63869859", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4963176/" ]
You can use `binding.value` instead like this: ```js const { createApp } = Vue; const highlightEl = (color ) => (event, el) => { if (el) { el.style.background = color; } else { event.target.style.background = color; } } const clearHighlightEl = (event, el) => { if (el) { el.style.background = ''; ...
you can use ref to find out if the element contains the element clicked ``` <template> <div ref="myref"> Hello world </div> <div> Outside element </div> </template> <script> export default { data() { return { show=false } }, mounted(){ ...
63,869,859
Based on this question [Detect click outside element](https://stackoverflow.com/questions/36170425/detect-click-outside-element) and this answer <https://stackoverflow.com/a/42389266>, I'm trying to migrate the directive from Vue 2 to Vue 3. It seems that `binding.expression` and `vnode.context` not exists more. How ca...
2020/09/13
[ "https://Stackoverflow.com/questions/63869859", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4963176/" ]
You can use `binding.value` instead like this: ```js const { createApp } = Vue; const highlightEl = (color ) => (event, el) => { if (el) { el.style.background = color; } else { event.target.style.background = color; } } const clearHighlightEl = (event, el) => { if (el) { el.style.background = ''; ...
vue2 solution: ```html <script> export default { name: 'onClickOutside', props: ['clickOutside'], mounted() { const listener = e => { if (e.target === this.$el || this.$el.contains(e.target)) { return } this.clickOutside() } document.addEventListener('...
63,869,859
Based on this question [Detect click outside element](https://stackoverflow.com/questions/36170425/detect-click-outside-element) and this answer <https://stackoverflow.com/a/42389266>, I'm trying to migrate the directive from Vue 2 to Vue 3. It seems that `binding.expression` and `vnode.context` not exists more. How ca...
2020/09/13
[ "https://Stackoverflow.com/questions/63869859", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4963176/" ]
out of the context, there's an easier way in vue3 with composition. [Link to Vueuse ClickOutside (Vue 3)](https://vueuse.org/core/onClickOutside/) [Link to Vueuse ClickOutside(Vue 2)](https://v5-3-0.vueuse.org/core/onClickOutside/) ```js <template> <div ref="target"> Hello world </div> <div> Outside el...
you can use ref to find out if the element contains the element clicked ``` <template> <div ref="myref"> Hello world </div> <div> Outside element </div> </template> <script> export default { data() { return { show=false } }, mounted(){ ...
63,869,859
Based on this question [Detect click outside element](https://stackoverflow.com/questions/36170425/detect-click-outside-element) and this answer <https://stackoverflow.com/a/42389266>, I'm trying to migrate the directive from Vue 2 to Vue 3. It seems that `binding.expression` and `vnode.context` not exists more. How ca...
2020/09/13
[ "https://Stackoverflow.com/questions/63869859", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4963176/" ]
out of the context, there's an easier way in vue3 with composition. [Link to Vueuse ClickOutside (Vue 3)](https://vueuse.org/core/onClickOutside/) [Link to Vueuse ClickOutside(Vue 2)](https://v5-3-0.vueuse.org/core/onClickOutside/) ```js <template> <div ref="target"> Hello world </div> <div> Outside el...
vue2 solution: ```html <script> export default { name: 'onClickOutside', props: ['clickOutside'], mounted() { const listener = e => { if (e.target === this.$el || this.$el.contains(e.target)) { return } this.clickOutside() } document.addEventListener('...
29,602,728
I have a bin file **en-parser-chunking.bin** which does the chunking part in my project.I am using it as follows ``` InputStream modelInParse = null; try { //load chunking model Log.i(TAG,"1"); modelInParse = new FileInputStream("...
2015/04/13
[ "https://Stackoverflow.com/questions/29602728", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4782311/" ]
You must check `instanceof` instead of `typeof`. `typeof` will give you only the data type which is object. ``` console.log(a instanceof Furniture); console.log(b instanceof Chair); ``` Refer **[How do I get the name of an object's type in JavaScript?](https://stackoverflow.com/questions/332422/how-do-i-get-the-nam...
It's the correct behavior. [Mozilla developer network](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Operators/typeof) has useful table with results description of typeof operator: ![typeof return values](https://i.stack.imgur.com/GPVz3.png) I think it'll be really usefull to learn about js a bit. Ja...
29,602,728
I have a bin file **en-parser-chunking.bin** which does the chunking part in my project.I am using it as follows ``` InputStream modelInParse = null; try { //load chunking model Log.i(TAG,"1"); modelInParse = new FileInputStream("...
2015/04/13
[ "https://Stackoverflow.com/questions/29602728", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4782311/" ]
You must check `instanceof` instead of `typeof`. `typeof` will give you only the data type which is object. ``` console.log(a instanceof Furniture); console.log(b instanceof Chair); ``` Refer **[How do I get the name of an object's type in JavaScript?](https://stackoverflow.com/questions/332422/how-do-i-get-the-nam...
This will work for you ``` var toType = function(obj) { return ({}).toString.call(obj).match(/\s([a-zA-Z]+)/)[1].toLowerCase() } var b = new Chair(); console.log(toType(b)); // Chair ``` Visit here [typeOf Does not return correct class type](https://javascriptweblog.wordpress.com/2011/08/08/fi...
73,440,714
``` const ref = useRef(null) const handleClick = () => { if(ref.current.classList.contains('hidden')){ ref.current.classList.remove('hidden') }else{ ref.current.classList.add('hidden') } } ``` > > Uncaught TypeError: Cannot read properties of null (reading 'classList') > > > ``` ...
2022/08/22
[ "https://Stackoverflow.com/questions/73440714", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19526049/" ]
I found that the error occurs because the BannerCarousal component is trying to find the `ref.current`. The `ref.current` is gone when the user is redirected to the Login screen. That's why the error `null is not an object` occurs. This is the solution that I did: ```js export const BannerCarousel = React.forwardRef((...
Where you are referencing the useRef flatListRef ? it seems like its not referencing any Valid Node. So it returns.. ``` TypeError: null is not an object (evaluating 'flatListRef.current.scrollToIndex') ```
73,440,714
``` const ref = useRef(null) const handleClick = () => { if(ref.current.classList.contains('hidden')){ ref.current.classList.remove('hidden') }else{ ref.current.classList.add('hidden') } } ``` > > Uncaught TypeError: Cannot read properties of null (reading 'classList') > > > ``` ...
2022/08/22
[ "https://Stackoverflow.com/questions/73440714", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19526049/" ]
Where you are referencing the useRef flatListRef ? it seems like its not referencing any Valid Node. So it returns.. ``` TypeError: null is not an object (evaluating 'flatListRef.current.scrollToIndex') ```
Hey initially ref might not be attached in first render, hence you could have done it like this @Nomel ``` setInterval (() => { index = index + 1; if(index < totalIndex) { ref?.current?.scrollToIndex({animated: true, index: index}) } else { ref?.curr...
73,440,714
``` const ref = useRef(null) const handleClick = () => { if(ref.current.classList.contains('hidden')){ ref.current.classList.remove('hidden') }else{ ref.current.classList.add('hidden') } } ``` > > Uncaught TypeError: Cannot read properties of null (reading 'classList') > > > ``` ...
2022/08/22
[ "https://Stackoverflow.com/questions/73440714", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19526049/" ]
I found that the error occurs because the BannerCarousal component is trying to find the `ref.current`. The `ref.current` is gone when the user is redirected to the Login screen. That's why the error `null is not an object` occurs. This is the solution that I did: ```js export const BannerCarousel = React.forwardRef((...
Hey initially ref might not be attached in first render, hence you could have done it like this @Nomel ``` setInterval (() => { index = index + 1; if(index < totalIndex) { ref?.current?.scrollToIndex({animated: true, index: index}) } else { ref?.curr...
1,746,125
I have two tables... table1 ( id, item, price ) values: ``` id | item | price ------------- 10 | book | 20 20 | copy | 30 30 | pen | 10 ``` ....table2 ( id, item, price) values: ``` id | item | price ------------- 10 | book | 20 20 | book | 30 ``` Now I want to: ``` update table1 set table1.Price = ta...
2009/11/17
[ "https://Stackoverflow.com/questions/1746125", "https://Stackoverflow.com", "https://Stackoverflow.com/users/179867/" ]
Something like this should do it : ``` UPDATE table1 SET table1.Price = table2.price FROM table1 INNER JOIN table2 ON table1.id = table2.id ``` You can also try this: ``` UPDATE table1 SET price=(SELECT price FROM table2 WHERE table1.id=table2.id); ```
This will surely work: ``` UPDATE table1 SET table1.price=(SELECT table2.price FROM table2 WHERE table2.id=table1.id AND table2.item=table1.item); ```
2,358,276
$\{ n^3 \}$ I know this approaches infinity therefore it diverges. How do I prove a sequence diverges? I guess I'll assume the contradiction that it converges. $\exists L \in \mathbb R, \forall \epsilon > 0, \exists N > 0$, such that for all $n \in \mathbb N$, if $n > N$, then $\left| n^3 - L \right| < \epsilon$ Le...
2017/07/14
[ "https://math.stackexchange.com/questions/2358276", "https://math.stackexchange.com", "https://math.stackexchange.com/users/280646/" ]
Here's something slightly easier than the usual conditions, where $A$ is strictly positive definite, and $B$ is known to be Hermitian: $$ A \otimes I - B \succeq 0 \iff\\ A \otimes I \succeq B \iff\\ I \succeq [A^{-1/2} \otimes I]B[A^{-1/2} \otimes I] $$ So, your matrix will be positive definite if and only if and onl...
$B$ of course must be hermitian, and then all the principal minors of $A \otimes I - B$ must be nonnegative. These are polynomials in the entries of $A$ and $B$ that are not particularly enlightening.
5,103,735
We can code out some sort of logging decorator to echo function/method calls like the following: ``` def log(fn): ... @log def foo(): ... class Foo(object): @log def foo(self): ... @log def bar(self, a, b): ... @log def foobar(self, x, y, z): ... ``` But wh...
2011/02/24
[ "https://Stackoverflow.com/questions/5103735", "https://Stackoverflow.com", "https://Stackoverflow.com/users/261718/" ]
See [Attaching a decorator to all functions within a class](https://stackoverflow.com/questions/3467526/attaching-a-decorator-to-all-functions-within-a-class) However, as the accepted answer to that question points out, it generally isn't a good idea. If you decide to go the aspect oriented programming route, I sugge...
Well, If you do not want to explicitly decorate all your functions, you can get all the functions/methods of a given module and apply your decorator automatically. not the easiest thing but not infeasible in python :) You can also try an aspect oriented programming framework. my2c
5,103,735
We can code out some sort of logging decorator to echo function/method calls like the following: ``` def log(fn): ... @log def foo(): ... class Foo(object): @log def foo(self): ... @log def bar(self, a, b): ... @log def foobar(self, x, y, z): ... ``` But wh...
2011/02/24
[ "https://Stackoverflow.com/questions/5103735", "https://Stackoverflow.com", "https://Stackoverflow.com/users/261718/" ]
I'm not sure what your use case is for this, but generally, I would think more about what exactly is the problem that you're trying to solve. That said, here's an example that might do what you want but without a decorator: ``` #!/usr/bin/env python import inspect class Foo(object): def foo(self): pass ...
Well, If you do not want to explicitly decorate all your functions, you can get all the functions/methods of a given module and apply your decorator automatically. not the easiest thing but not infeasible in python :) You can also try an aspect oriented programming framework. my2c
5,103,735
We can code out some sort of logging decorator to echo function/method calls like the following: ``` def log(fn): ... @log def foo(): ... class Foo(object): @log def foo(self): ... @log def bar(self, a, b): ... @log def foobar(self, x, y, z): ... ``` But wh...
2011/02/24
[ "https://Stackoverflow.com/questions/5103735", "https://Stackoverflow.com", "https://Stackoverflow.com/users/261718/" ]
This might be overkill, but there is a trace function facility that will inform you of a great deal of activity within your program: ``` import sys def trace(frame, event, arg): if event == "call": filename = frame.f_code.co_filename if filename == "path/to/myfile.py": lineno = frame.f...
Well, If you do not want to explicitly decorate all your functions, you can get all the functions/methods of a given module and apply your decorator automatically. not the easiest thing but not infeasible in python :) You can also try an aspect oriented programming framework. my2c
5,103,735
We can code out some sort of logging decorator to echo function/method calls like the following: ``` def log(fn): ... @log def foo(): ... class Foo(object): @log def foo(self): ... @log def bar(self, a, b): ... @log def foobar(self, x, y, z): ... ``` But wh...
2011/02/24
[ "https://Stackoverflow.com/questions/5103735", "https://Stackoverflow.com", "https://Stackoverflow.com/users/261718/" ]
It can be done many different ways. I will show how to make it through ***meta-class***, ***class decorator*** and ***inheritance***. by **changing meta class** ``` import functools class Logger(type): @staticmethod def _decorator(fun): @functools.wraps(fun) def wrapper(*args, **kwargs): ...
Well, If you do not want to explicitly decorate all your functions, you can get all the functions/methods of a given module and apply your decorator automatically. not the easiest thing but not infeasible in python :) You can also try an aspect oriented programming framework. my2c
5,103,735
We can code out some sort of logging decorator to echo function/method calls like the following: ``` def log(fn): ... @log def foo(): ... class Foo(object): @log def foo(self): ... @log def bar(self, a, b): ... @log def foobar(self, x, y, z): ... ``` But wh...
2011/02/24
[ "https://Stackoverflow.com/questions/5103735", "https://Stackoverflow.com", "https://Stackoverflow.com/users/261718/" ]
This might be overkill, but there is a trace function facility that will inform you of a great deal of activity within your program: ``` import sys def trace(frame, event, arg): if event == "call": filename = frame.f_code.co_filename if filename == "path/to/myfile.py": lineno = frame.f...
See [Attaching a decorator to all functions within a class](https://stackoverflow.com/questions/3467526/attaching-a-decorator-to-all-functions-within-a-class) However, as the accepted answer to that question points out, it generally isn't a good idea. If you decide to go the aspect oriented programming route, I sugge...
5,103,735
We can code out some sort of logging decorator to echo function/method calls like the following: ``` def log(fn): ... @log def foo(): ... class Foo(object): @log def foo(self): ... @log def bar(self, a, b): ... @log def foobar(self, x, y, z): ... ``` But wh...
2011/02/24
[ "https://Stackoverflow.com/questions/5103735", "https://Stackoverflow.com", "https://Stackoverflow.com/users/261718/" ]
This might be overkill, but there is a trace function facility that will inform you of a great deal of activity within your program: ``` import sys def trace(frame, event, arg): if event == "call": filename = frame.f_code.co_filename if filename == "path/to/myfile.py": lineno = frame.f...
I'm not sure what your use case is for this, but generally, I would think more about what exactly is the problem that you're trying to solve. That said, here's an example that might do what you want but without a decorator: ``` #!/usr/bin/env python import inspect class Foo(object): def foo(self): pass ...
5,103,735
We can code out some sort of logging decorator to echo function/method calls like the following: ``` def log(fn): ... @log def foo(): ... class Foo(object): @log def foo(self): ... @log def bar(self, a, b): ... @log def foobar(self, x, y, z): ... ``` But wh...
2011/02/24
[ "https://Stackoverflow.com/questions/5103735", "https://Stackoverflow.com", "https://Stackoverflow.com/users/261718/" ]
This might be overkill, but there is a trace function facility that will inform you of a great deal of activity within your program: ``` import sys def trace(frame, event, arg): if event == "call": filename = frame.f_code.co_filename if filename == "path/to/myfile.py": lineno = frame.f...
It can be done many different ways. I will show how to make it through ***meta-class***, ***class decorator*** and ***inheritance***. by **changing meta class** ``` import functools class Logger(type): @staticmethod def _decorator(fun): @functools.wraps(fun) def wrapper(*args, **kwargs): ...
20,645,270
I don't think I fully understand groups and users. I have determined that php runs as user `apache` I have 2 files on my server, but of which I can run without any problems. Below are the file permissions. ``` -rwxrwxr-x 1 staging staging 2100 Sep 6 14:47 hardware.php -rwxrwxr-x 1 staging apache 69 Dec ...
2013/12/17
[ "https://Stackoverflow.com/questions/20645270", "https://Stackoverflow.com", "https://Stackoverflow.com/users/627473/" ]
In order to call this across 2 different methods both methods will need access to the value. Since they are on the same type the easiest way to share out the `listener` value is to make it a field ``` public class Lru_Listen { HttpListener listener; public void ListenForAag() { listener = new HttpListener(); ...
you need to read up on scope. basically your listener does not exist except in the scope of the ListenForAag function. Assuming you need to instantiate the listener in the function. however you might be better off with a constructor. ``` public class Lru_Listen { HttpListener listener; // 1st method creates an objec...
20,645,270
I don't think I fully understand groups and users. I have determined that php runs as user `apache` I have 2 files on my server, but of which I can run without any problems. Below are the file permissions. ``` -rwxrwxr-x 1 staging staging 2100 Sep 6 14:47 hardware.php -rwxrwxr-x 1 staging apache 69 Dec ...
2013/12/17
[ "https://Stackoverflow.com/questions/20645270", "https://Stackoverflow.com", "https://Stackoverflow.com/users/627473/" ]
In order to call this across 2 different methods both methods will need access to the value. Since they are on the same type the easiest way to share out the `listener` value is to make it a field ``` public class Lru_Listen { HttpListener listener; public void ListenForAag() { listener = new HttpListener(); ...
You can return the listener and receive it in the second method, also. ``` public HttpListener ListenForAag() { listener = new HttpListener(); return listener; } public void LruListenAccReq(HttpListener listener) { HttpListenerContext context = listener.Getcontext(); } ```
20,645,270
I don't think I fully understand groups and users. I have determined that php runs as user `apache` I have 2 files on my server, but of which I can run without any problems. Below are the file permissions. ``` -rwxrwxr-x 1 staging staging 2100 Sep 6 14:47 hardware.php -rwxrwxr-x 1 staging apache 69 Dec ...
2013/12/17
[ "https://Stackoverflow.com/questions/20645270", "https://Stackoverflow.com", "https://Stackoverflow.com/users/627473/" ]
The problem is purely within the `Lru_Listen` class - the variable you declared is local to the `ListenForAag` member. If you make it a class level variable (a field), you won't have this issue: ``` // Make an instance variable: HttpListener listener; // 1st method creates an object from a different class (HttpListen...
you need to read up on scope. basically your listener does not exist except in the scope of the ListenForAag function. Assuming you need to instantiate the listener in the function. however you might be better off with a constructor. ``` public class Lru_Listen { HttpListener listener; // 1st method creates an objec...
20,645,270
I don't think I fully understand groups and users. I have determined that php runs as user `apache` I have 2 files on my server, but of which I can run without any problems. Below are the file permissions. ``` -rwxrwxr-x 1 staging staging 2100 Sep 6 14:47 hardware.php -rwxrwxr-x 1 staging apache 69 Dec ...
2013/12/17
[ "https://Stackoverflow.com/questions/20645270", "https://Stackoverflow.com", "https://Stackoverflow.com/users/627473/" ]
The problem is purely within the `Lru_Listen` class - the variable you declared is local to the `ListenForAag` member. If you make it a class level variable (a field), you won't have this issue: ``` // Make an instance variable: HttpListener listener; // 1st method creates an object from a different class (HttpListen...
You can return the listener and receive it in the second method, also. ``` public HttpListener ListenForAag() { listener = new HttpListener(); return listener; } public void LruListenAccReq(HttpListener listener) { HttpListenerContext context = listener.Getcontext(); } ```
38,141,516
I want to copy file in THE SAME HDFS ,just like copy file from HDFS://abc:9000/user/a.txt to HDFS://abc:9000/user/123/ Can I do that by using JAVA API? Thanks
2016/07/01
[ "https://Stackoverflow.com/questions/38141516", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6284820/" ]
[FileUtil](https://hadoop.apache.org/docs/stable/api/org/apache/hadoop/fs/FileUtil.html) provides a method for copying files. ``` Configuration configuration = new Configuration(); configuration.set("fs.defaultFS", "hdfs://abc:9000"); FileSystem filesystem = FileSystem.get(configuration); FileUtil.copy(filesystem, new...
``` If you want to move files from directory it is little bit tricky below code done same task for me !! val conf = new org.apache.hadoop.conf.Configuration() val src:Path = new org.apache.hadoop.fs.Path(hdfsDirectory) val fs = FileSystem.get(src.toUri,conf) val srcPath: Path = new Path("hdfs://sourcePath/"...
49,584,394
I have the following string: ``` var x = '<p>Hello there <span contenteditable="false" class="fr-deletable">aaa</span>,<br></p><p>Hi <span contenteditable="false" class="fr-deletable">bbbb</span>,<br></p>'; ``` I basically want to strip out all of the `<span></span>` tags but keep the inner content in tact. So the a...
2018/03/31
[ "https://Stackoverflow.com/questions/49584394", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5429504/" ]
```js const input = '<p>Hello there <span contenteditable="false" class="fr-deletable">aaa</span>,<br></p><p>Hi <span contenteditable="false" class="fr-deletable">bbbb</span>,<br></p>'; const output = input.replace(/<span [^>]+>([^<]+)<\/span>/g, '$1'); console.log(output); ```
It's better to do after parsing the HTML, which can be done using jQuery. ```js var x = '<p>Hello there <span contenteditable="false" class="fr-deletable">aaa</span>,<br></p><p>Hi <span contenteditable="false" class="fr-deletable">bbbb</span>,<br></p>'; console.log( $('<div>', { html: x }).find('span').re...
49,584,394
I have the following string: ``` var x = '<p>Hello there <span contenteditable="false" class="fr-deletable">aaa</span>,<br></p><p>Hi <span contenteditable="false" class="fr-deletable">bbbb</span>,<br></p>'; ``` I basically want to strip out all of the `<span></span>` tags but keep the inner content in tact. So the a...
2018/03/31
[ "https://Stackoverflow.com/questions/49584394", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5429504/" ]
```js const input = '<p>Hello there <span contenteditable="false" class="fr-deletable">aaa</span>,<br></p><p>Hi <span contenteditable="false" class="fr-deletable">bbbb</span>,<br></p>'; const output = input.replace(/<span [^>]+>([^<]+)<\/span>/g, '$1'); console.log(output); ```
Try this: ```js var x = '<p>Hello there <span contenteditable="false" class="fr-deletable">aaa</span>,<br></p><p>Hi <span contenteditable="false" class="fr-deletable">bbbb</span>,<br></p>'; var y = x.replace(/(<sp|<\/sp)[^>]+>/g, ""); console.log(y); ```
26,014,426
I config the multi-language setting dynamically using the `locale` filter. Which fetch the sub-domain name to determine the language. ``` function load_custom_language($locale) { // get the locale code according to the sub-domain name. // en.mysite.com => return `en` // zh.mysite.com => return `zh_CN` ...
2014/09/24
[ "https://Stackoverflow.com/questions/26014426", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2544762/" ]
You can override the admin settings in the wp-config.php file. So if you want something dynamic, the following should work: ``` //presumes server is set up to deliver over https define('WP_SITEURL', 'https://' . $_SERVER['HTTP_HOST']); define('WP_HOME', 'https://' . $_SERVER['HTTP_HOST']); ``` This needs to added b...
I've found another pretty way to achieve the work: After I checked for the source code of the kernel, I found that there are distinct filters called `option_xxx` on each options. So, for my task, I tried to use the `option_siteurl` and `option_home` filter to hold that options to load, just to prevent the option to l...
26,014,426
I config the multi-language setting dynamically using the `locale` filter. Which fetch the sub-domain name to determine the language. ``` function load_custom_language($locale) { // get the locale code according to the sub-domain name. // en.mysite.com => return `en` // zh.mysite.com => return `zh_CN` ...
2014/09/24
[ "https://Stackoverflow.com/questions/26014426", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2544762/" ]
You can override the admin settings in the wp-config.php file. So if you want something dynamic, the following should work: ``` //presumes server is set up to deliver over https define('WP_SITEURL', 'https://' . $_SERVER['HTTP_HOST']); define('WP_HOME', 'https://' . $_SERVER['HTTP_HOST']); ``` This needs to added b...
To **set dynamically the domain and as well as the protocol** (*http* or *https*), use: ```php // Identify the relevant protocol for the current request $protocol = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' || $_SERVER['SERVER_PORT'] == 443) ? "https" : "http"; // Set SITEURL and HOME using a dynamic ...