In ruby, why does array append fail on a hash with a default value of empty array?
Strange, unexpected behavior (disappearing/changing values) when using Hash default value, e.g. Hash.new([])
I need to be able to merge two (very simple) JavaScript objects at runtime.  For example I'd like to:  var obj1 = { food: 'pizza', car: 'ford' } var obj2 = { animal: 'dog' }  obj1.merge(obj2);  //obj1 now has three properties: food, car, and animal   Does anyone have a script for this or know of a built in way to do this?  I do not need recursion, and I do not need to merge functions, just methods on flat objects. How can I set the location (as it's picked up in CoreLocation services) in the iPhone Simulator? How to store and preserve film negatives and slides? I bought 35mm dedicated film scanner (Nikon CoolScan III) and I'm planning to digitize old negatives and slides I found at home.  How should I store and preserve these slides and films after I cut them and scan? How to choose best negative pages/sleeves, binders etc. and what to avoid? Building where clause based upon parameters Proving $\gcd \left(\frac{a}{\gcd (a,b)},\frac{b}{\gcd (a,b)}\right)=1$ How would you go about proving that $$\gcd \left(\frac{a}{\gcd (a,b)},\frac{b}{\gcd (a,b)}\right)=1$$  for any two integers $a$ and $b$?  Intuitively it is true because when you divide $a$ and $b$ by $\gcd(a,b)$ you cancel out any common factors between them resulting in them becoming coprime. However, how would you prove this rigorously and mathematically? "put X down to" vs. "put down X to": subjects of verbs with two particles I expect I would have to put down many coats to do the job. ()   One factor to distinguish phrasal verbs from prepositional verbs is particle movement. Phrasal verbs can place the particle before or after direct object, whereas the preposition in prepositional verbs must precede the noun. (Biber et al. 1999)    So, I'm confused when analyzing the fragment "put down many coats to" because I'm not able to distinguish whether "put ... " is a phrasal verb or a prepositional verb. The confusion arises when I read in the Oxford Dictionary of English, under 'put' &rarr; 'phrasal verb', the form "put something down to" is correct.  So, the above sentence would be rewritten as follows :     I expect I would have to put many coats down to do the job.   Am I right? If not, how do I correctly distinguish phrasal verbs from prepositional verbs in the cases, like this one, where there are two particles (in this case 'down' and 'to')? Sorting grid cells in fishnet grid by location and number using QGIS? I am using QGIS 3.2.0 on a Mac (and also have QGIS 2), and I have a fishnet grid (probably created in Arc) that comprises of nearly 2 million grid cells. As a result, every change I make to the attribute table takes hours, so I can't experiment as I would usually.  I need to label each grid cell such that the north-westernmost cell is "1", and the numbers proceed by rows, until the last number goes into the south-easternmost cell. Using the row-number doesn't work, as that's not how the table is sorted. I've done this before, but cannot remember how. Block apps from accessing the Internet on Android device In Android, is it possible to block apps from accessing the Internet? Many apps will often connect to remote servers in the background, including Google's own apps or system services. Over time this can eat away at a user's data limit set by a mobile carrier. Does Android allow an app to act as a firewall whereby the user can select which apps have access to the Internet? Or does the device have to be rooted to have that ability? The expected value of $1/(1+X)$ where $X$ has geometric distribution Let $X$ be a random variable with a geometric distribution with parameter $p$.       Calculate $\Bbb E[1/(1+X)]$   I've looked at answers online but still do not understand how to solve this.   Specifically, I do not understand how to to get from $$\frac{p}{1-p} \sum_{x=0}^\infty (1/(1+x))((1-p)^x+1)$$  to  $-p\ln(p)  /(1-p)$. Passing Javascript variable to Schengen Visa Refusal: Justification for the purpose and conditions of the intended stay was not provided Schengen refusal formulae can be difficult to understand sometimes.    When an applicant receives a refusal with "Justification for the purpose and conditions of the intended stay was not provided", what does it mean? I am trying to prove the following:  In $C[0,1]$ the functions that preserve the rationals (i.e. $f(\mathbb{Q})\subseteq \mathbb{Q}$) are dense.  So far, I have not made much progress- I am aware that $A$ is dense in $B$ iff $A$ has non-empty intersection with each open set $U$ in $B$ but am not sure how to apply this definition. I have also thought about showing that the closure of $X$ (where $X$ is the set of functions that preserve the rationals) is equal to $C[0,1]$ by a double-inclusion proof but I have also made no progress with this approach. Am I on the right track or should I change my approach? How did Harry remove the Philosopher's Stone from the Mirror of Erised? ‘How did I get the Stone out of the Mirror?’   ‘Ah, now, I’m glad you asked me that. It was one of my more brilliant ideas, and between you and me, that’s saying something. You see, only one who wanted to find the Stone – find it, but not use it – would be able to get it, otherwise they’d just see themselves making gold or drinking Elixir of Life.’   Philosopher's Stone - page 217 - Bloomsbury - chapter seventeen, The Man With Two Faces - Harry talking with Dumbledore   Dumbledore doesn't directly answer Harry's question, but rather describes under what circumstances a person could collect the Philosopher's Stone from the mirror. Did Harry have to do anything to retrieve the stone, such as reach into the mirror and take it? If not, what kind of magic could have removed the stone from the mirror and put it into Harry's possession?  A canon-based answer is preferred, such as the books, interviews with J.K. Rowling, or info from Pottermore, but subjective answers within the spirit of canon are welcome. Main page of StackOverflow на Русском Meta gives error The data for the tag search is still loading; please retry in a moment. Let $a,b,c\in \mathbb{Z}$. If $ac&gt;bc$ and $c&gt;0$, then $a&gt;b$   I think I would use contrapositive to prove this. But I am not sure proper contrapositive statement.   Is it If $a&lt;b$, then $ac&lt;bc$, and $c&lt;0$.? If so, contrapositive is not a good choice, isn't it? If a group mod its commutator subgroup is cyclic, then the group is abelian? Let $G$ be a group and let $G'$ denotes its commutator subgroup, that is the group generated by all elements of the form $g^{-1}h^{-1}gh$.  Is the following true:      If $G/G'$ is cyclic, then G is abelian.   Recall that the claim is true for the $G$ modulo the center of $G$.  See Adverb between conjugated verb and infinitive? The judicial function in considering and applying statutes is one of interpretation and interpretation alone. The duty of the court in every case is loyally to endeavour to ascer­tain the intention of the legislature; and to ascertain that intention by reading and interpreting the language which the legislature itself has selected for the purpose of expres­sing it.    1. What's this phenomenon called? Is this placement unusual or due to  my English's primitiveness?  2. Why not situate the adverb after 'endeavour', or even split the infinitive 'to endeavour' and wedge it in between?  What are the similarities and differences due to a different position? Phone : nexus 5 version 2013 Android version : 6.0 Kernel version : 3.4.0-g2aa165e Build number : MRA58N   For the last few days, 10118 has been draining my phone's battery. It drains battery by using GPS. I typed 'ps' in a terminal emulator, and there was no application with PID 10118. I don't know what exactly 10118 is. My guess is that it's one of recently installed weather apps.  How can I fix this?    Screenshots (click images for larger variants) Why isn't the eigenclass equivalent to self.class, when it looks so similar? I'd like to put some shared Javascript to Resource file to reuse it between several components. This Javascript is general purpose set of utility functions. However, functions from my resource file are not available from the Components. Static resource (named TestScript):  function helloWorld() {      return 42; }   Component:  &lt;ltng:require scripts="{!$Resource.TestScript}" &lt;ui:button label="Do job" press="{!c.doJob}"/&gt;   Controller:  doJob: function(cmp, event, helper) {      var i = helloWorld();      // failed with Uncaught ReferenceError: helloWorld is not defined }   I don't like to use  &lt;ltng:require scripts="{!$Resource.***resourceName***}" afterScriptsLoaded="{!c.afterScriptsLoaded}" /&gt;   because my static resource is a set of functions and I'd like just use them as functions later in my controllers. How can I achieve that (if possible)? If not, what's the suggested solution?