My test involving a mock function (React, Enzyme and Jest) works:  it('should do a thing', () =&gt; {   const myButton = wrapper.find('Button');   expect(mockFunction.mock.calls.length).toBe(0);   myButton.simulate('click');   expect(mockFunction.mock.calls.length).toBe(1); });   However when I try to simplify the code with a variable the test fails. numberClicks is 0 both times.  it('should do a thing', () =&gt; {   const myButton = wrapper.find('Button');   const numberClicks = mockFunction.mock.calls.length;   expect(numberClicks).toBe(0);   myButton.simulate('click');   expect(numberClicks).toBe(1); });   Is this normal JavaScript behaviour or some weirdness with the testing libraries?
The primitive types (number, string, etc.) are passed by value, but objects are unknown, because they can be both passed-by-value (in case we consider that a variable holding an object is in fact a reference to the object) and passed-by-reference (when we consider that the variable to the object holds the object itself).  Although it doesn't really matter at the end, I want to know what is the correct way to present the arguments passing conventions. Is there an excerpt from JavaScript specification, which defines what should be the semantics regarding this?
I want to turn a photo in a engraving style picture, like  using GIMP and, if possible, then make an SVG out of it with Inkscape.  Can you recommend any filters/tools/plugins/tutorials for this? Extracting embedded images from a PDF Difference between  and  in Java Counting unique records across 2 columns and computing a score based on boolean values I have a table that looks like this in Google Big Query:  custID  InteractionDate Purchased?  Sales 1       20150312           F         0 1       20150312           T         200 1       20150314           T         150 2       20150221           T         400 2       20150221           F         0 2       20150221           T         120   ..that I need to transform to the following structure:   custID InteractionDate Success Sales  1     20150312          0.5    200  1     20150314           1     150  2     20150221         0.66    520   ..where in this second table the success column is defined as  count(purchase=Yes)/(count(purchase=Yes) + count(purchase=No)),   and sales is just the sum.  I'm quite new to BQ and no-SQL languages. I simply don't know how to do this, I've searched and seen examples that suggest using partition over but I simply haven't seen any example that does just this. Thanks a lot in advance. How to parse hundred html source code files in shell? How to prove that the ideal $I=(x^3-y^2)$ in $k[x,y]$ is prime?    I have constructed a map from $k[x,y]$ to $k[t]$, which maps $x$ to $t^2$, and $y$ to $t^3$. Then, I want to show that the kernel is exactly $I$. But the difficulty is that how to prove the kernel is contained in $I$.  Could you help me? Thanks a lot! How to decide on the correct number of clusters? We find the cluster centers and assign points to k different cluster bins in  which is a very well known algorithm and is found almost in every machine learning package on the net. But the missing and most important part in my opinion is the choice of a correct k. What is the best value for it? And, what is meant by best?  I use MATLAB for scientific computing where looking at silhouette plots is given as a way to decide on k . However, I would be more interested in Bayesian approaches. Any suggestions are appreciated. I am firmly convinced he is innocent and his accusation is the result of the police conspiracy.     I am firmly convinced he is innocent and his accusation is the result of the police's conspiracy.    Which sentence do you think is a better choice? I'm trying to prove that if $A\neq 0$ is a commutative ring and there is an injective $A$-module homomorphism $A^m\hookrightarrow A^n$ then $m\leq n$ must necessarily hold.    This is exercise 2.11 from Atiyah and MacDonald's Introduction to Commutative Algebra, but unfortunately all the solutions available online are either very sparse with regard to this question or seem to use (to my surprise) a generalized version of Cramer's rule. Is there perhaps some other "cleaner" approach to solving this problem? I just installed Ubuntu and it is great.  However, I installed in beside the Windows Vista OS.  I now want to remove Windows in an effort to improve performance.  What is the easiest way to do this? What is color temperature and how does it affect my photography? I'm a trainee teacher and I need to pass a skills test in maths, but I'm having trouble in this particular area of algebra in finding the nth term of any sequence. I've been given a series of questions to answer one of them is:  Find the nth term of the sequence 3, 8, 15, 24.  I not only need to know the answer but more importantly the technique. This is GCSE level. Mock a service while running a BrowserTest? I am trying to test the output of a controller that returns some information in a given page. This controller has a custom http client injected into it.  I want to create a BrowserTest that can navigate to a fake node, and then test for certain text or values. I also want to change the mock to return different values, so I can further test the output to account for those cases.  I tried:      $client = $this-&gt;getMockBuilder('\Drupal\mymodule\Client\AuthorizeClient')       -&gt;disableOriginalConstructor()       -&gt;getMock();     $client-&gt;expects($this-&gt;any())       -&gt;method('request')       -&gt;with('w12345', FALSE)       -&gt;willReturn([]);      $this-&gt;container-&gt;set('mymodule.auth_client', $client);   But I get errors in the test that refer to the original class, and not the one I am trying to replace. I looked around in the core but wasn't really able to find what I was looking for. Does it make sense to do this? Is there a way to do a Kernel test to test responses from the route in question? I have a script in file bla.sh and it is executable. When I click on it, the script is executed and the window is closed. I'd like the window to stay open.  Something like command cmd /k** command in Windows.  P.S. I don't want to use pause, but I want to able to write more commands after the script was executed. Update: this is a lengthy post, you can     Note: The quick language list refers to the list in the screenshot below, accessible throught the shortcut Win + Space bar  I have two languages for windows spell check in my system, English (United States) and French (Switzerland), but despite both languages being properly configured with "Swiss French" input keyboard, US Keyboard input keeps appearing on this list:    Here's the settings for English (United States) language, you can see the only input is "Swiss French":    Same for Français (Suisse), the only input is "Swiss French":    In the Control Panel, both are also set as Swiss French:    All my settings are set to use "language list":     Here's a few things that I already tried:   I already managed to remove it by some language configuration gymnastics, by adding and removing languages, it always eventually comes back I have already done this:  There's no mention of US Keyboard in my registry settings either:     Please help, I'm desperate, this is my third computer with Windows 10 and they all do the same thing. Prove convergence of the sequence $(z_1+z_2+\cdots + z_n)/n$ of Cesaro means I created a interior scene and  i don't know how to bake a texture using cycles bake. Given that $xyz=1$, prove that $\frac{x}{1+x^4}+\frac{y}{1+y^4}+\frac{z}{1+z^4}\le \frac{3}{2}$ Similar matrices and field extensions What is the difference between Fact and Truth? I'm curious about the difference between Fact and Truth. I was searching on the internet if I could find it. But still I'm confused about the exact meaning. I first read the forum discussion here  where an author has given two examples for each like below     A fact is a reality that cannot be logically disputed or rejected. If   I say "fire is hot," I don't care how great your reasoning skills are,   if you touch fire your skin will burn (and don't give me that "but   people can walk on hot coals!" bull. There's a difference between the   transfer of heat through conduction and training one's body to deal   with the agonizing pain of said conduction). Now when I say this, I am   not speaking a truth, I am speaking a fact. If you say "fire is not   hot," you are not lying, you are incorrect. Facts are concrete   realities that no amount of reasoning will change. When one   acknowledges a fact, they are doing just that. Facts are not   discovered, facts are not created, facts are simply acknowledged.      A truth on the other hand, is almost the opposite. Truths are those   things that are not simply acknowledged, but must be discovered, or   created. If I say "God exists," and I possess strong reasoning for the   affirmative of that statement, then God really does exist, that is a   reality. However, if another individual possesses strong reasoning for   the negative, and because of this reasoning they believe that God does   not exist, then that is also a reality. If we were to debate our   ideologies, and my reasoning appeared stronger than theirs, they may   choose to adopt my belief that God does exist. If they do, then the   existence of God is just as true as the nonexistence of God which they   believed a week ago. Truths, as opposed to fact, are much more fluid   and malleable than their empirical counterparts.   and followed by further discussion.  Then I found this . Article from above link says like below:     Facts are notes and lyrics on sheet music.  Truth is what the singer   gives to the listener when she’s brave enough to open up and sing from   her heart.   But still curious about the difference between both of them.  In our daily life, in general conversation, we generally use these both terms interchangeably. Then what is the difference? Are they synonym or have specific difference?