Creating object with dynamic keys
How to use a variable for a key in a JavaScript object literal?
$a$ and $b$ are natural numbers and $p$ is a prime number. Prove that if $a^{p}-b^{p}$ is divisible by $p$, then it is also divisible by $p^{2}$.  My attempt: Based on Fermat's theorem $(a^{p}-a)$ and $(b^{p}-b)$ are divisible by p, therefore their difference is divisible by $p$. I.e. $(a^{p}-a)-(b^{p}-b)=(a^{p}-b^{p})-(a-b)$ is divisible by $p$. Since the left hand side of this equation is divisible by $p$, the right hand side also should be divisible by $p$. Based on the problem's assumption $(a^{p}-b^{p})$ is divisible by $p$ therefore we conclude $(a-b)$ must be divisible by $p$. Now We can factorize $(a^{p}-b^{p})$ $$(a^{p}-b^{p})=(a-b)(a^{p-1}+a^{p-2}b+....+b^{p-1})$$ we have to prove $(a^{p}-b^{p})$ is multiple of $p^2$ which means we have to show the right hand side should be multiple of $p^{2}$. But $(a-b)$ is multiple of p therefore we have to show  $(a^{p-1}+a^{p-2}b+\cdots+b^{p-1})$ is multiple of $p$ and I am stuck here. Any help would be appreciated. How do I calculate the probability density function for a joint beta + uniform distribution? The PDF of a Beta distribution is $$ f_X(x) = {{x^{a-1}(1-x)^{b-1}}\over {B(a,b)}}  $$ and CDF $$ F_X(x) =  I_x(a,b) $$ The PDF of a uniform distribution is $$ f_Y(y) =  {1 \over {b-a}} \space for \space  x \in [a,b] $$ and CDF $$ { x - a} \over {b - a} $$ I've know that if X and Y are two independent, continuous random variables, described by probability density functions above of $f_X(x)$ and $f_Y(x)$ then probability density function of $Z = XY$ is $$  f_Z(z) = \int_\infty^\infty f_X(x)f_Y({z\over x}){1\over abs(x)}dx  $$ but I'm struggling with the algebra to get  from this to the PDF and the CDF of the joint distribution. I'm using the uniform distribution between 0 and 1. Viewing all my questions from Android app What is the proper way to handle data between scenes? I am developing my first 2D game in Unity and I have come across what seems an important question.  How do I handle data between scenes?  There seems to be different answers to this:   Someone mention using , while other people told me this should be used to store other things like screen brightness and so on. Someone told me that the best way was to make sure to write everything into a savegame everytime that I changed scenes, and to make sure that when the new scene loads, get the info from the savegame again. This seemed to me wasteful in performance. Was I wrong? The other solution, which is the one I have implemented so far is to have a global game object that isn't destroyed between scenes, handling all the data between scenes. So when the game starts, I load a Start Scene where this object is loaded. After this ends, it loads the first real game scene, usually a main menu.   This is my implementation:  using UnityEngine; using UnityEngine.UI; using System.Collections;  public class GameController : MonoBehaviour {      // Make global     public static GameController Instance {         get;         set;     }      void Awake () {         DontDestroyOnLoad (transform.gameObject);         Instance = this;     }      void Start() {         //Load first game scene (probably main menu)         Application.LoadLevel(2);     }      // Data persisted between scenes     public int exp = 0;     public int armor = 0;     public int weapon = 0;     //... }   This object can be handled on my other classes like this:  private GameController gameController = GameController.Instance;   While this has worked so far, it presents me with one big problem: If I want to load directly a scene, let's say for instance the final level of the game, I can't load it directly, since that scene does not contain this global game object.  Am I handling this problem the wrong way? Are there better practices for this kind of challenge? I would love to hear your opinions, thoughts and suggestions on this issue.  Thanks Given $f = f(u(t), t)$, is it possible to find the following derivative? ($f$,$u \in \mathbb{R}^n$, $t \in \mathbb{R}$)  $$ \frac{\partial f}{\partial||u||^2_2} $$  I am aware of the following derivatives:  $$ \frac{\partial||x||^2_2}{\partial x} = \frac{\partial ||x^Tx||_2}{\partial x} = 2x $$  So I can invert it to give me (elementwise division in the RHS)  $$ \frac{\partial x}{\partial||x||^2_2} = \frac{1}{2x} $$  This step does feel like abuse of notation I find it hard to convince myself of its validity.  If it's right though, I could just apply the chain rule to find  $$ \frac{\partial f}{\partial u} \frac{\partial u}{\partial||u||^2_2} $$  However, knowing that both $f$ and $u$ are a function of $t$, I am somehow doubting my own reasoning. Or does that just mean that the derivative will still be a function of $t$ and I have nothing to worry about? Can anyone shed some light?  UPDATE: I'm now doubting the existence of  $$ \frac{\partial u}{\partial ||u||^2_2} $$  because $u = u(||u||_2^2)$ is not injective. Is the inversion step I did above legitimate? Is there another possible approach? Is it possible to enforce unique values in a column, excluding nulls? Get total duration of video files in a directory I have a list of .ts files:   out1.ts ... out749.ts   out8159.ts  out8818.ts   How can I get the total duration (running time) of all these files? Showing 2 Distributions are the Same Let $X_1, X_2, \dots$ be i.i.d. exponentially distributed RVs. For $n = 1,2,\dots$ consider: $Y_n := \max(X_1, X_2, \dots, X_n)$ $U_n := \sum_{i=1}^{n}\frac{X_i}{i}$ Show that $Y_n$ and $U_n$ have the same distribution   What I've tried: $P(Y_n&lt;y)= P(X_i&lt;y)^n = (1- e^{\lambda y})^n =&gt; P(Y_n=y) = n(1- e^{\lambda y})^{n-1}$ But I get stuck with $U_n$. I tried an MGF, $U_n$ evaluates nicely but then $Y_n$ gets messy. Any thoughts? Is there any way to tell the compiler, inside the main file body, how to find the class? I would like to use a class that belongs not found in my MiKTeX database. I know I might as well pick up this class and put it in some directory inside the base and update MiKTeX, but I do not want to do that. What I want is to organize it into a subdirectory within the same directory as my main tex file. However, when compiling the tex file, the class is not found. Of course, if I put the direct class in the same directory as the main file I will solve the problem, but that's not what I want. So, I ask: Is there any way to tell the compiler, inside the main file body, how to find the class?  Note: I'm using MiKTeX as an example, but I'm really having the problem in overleaf. There was a revtex upgrade from version 4.1 to 4.2. However, overleaf does not find revtex4-2.cls, which is, in fact, the class I'd like to use.  Below, I show an example of how I would like to organize the files. Note that the class is in a subdirectory. jQuery: Uncheck other checkbox on one checked QGIS ->ArcGIS Server configuration possible? Is it possible to connect a QGIS Desktop 1.8.0 to an ArcGIS Server 10.0 ? and of course publish services on it?.   The configuration would be like this Quantum GIS-> ArcGIS Server 10.0 on Amazon EC2+ POstgreSQL (+PostGIS)-> web app.   Is it possible to create a configuration like this? Do you think I could use it for networking? Determining if trees within forest gaps are clustered using R? Is there a way in photoshop to convert k values to alpha values? Basically, I would like to make it so that the lighter a pixel is (the more white it has) the more transparent it becomes. Black pixels would be opaque, white pixels would be transparent.  I currently use the slider in blending options on the first tab to get rid of the white and make it transparent but find it works slightly better if I use the magic wand tool with delete.  I figure that there is some blending option out there but there are so many and I'm not sure which to use to achieve my goal.  (Using Photoshop CS6) update line based on previous line Xubuntu 18.04 Persistent Live USB: Will persistence be carried upon full installation to a machine? I've created an Xubuntu 18.04 persistent live USB stick and installed several softwares for web development, such as XAMPP, Sublime Text 3, Google Chrome, etc.. I did some configurations as well in the ~/.bashrc file.  I am wondering if these installation and configuration in my persistent live USB stick be carried over in a full installation in to a new machine using it. Do not load Facebook-based avatars directly from the Facebook CDN Users who register for their account via Facebook get  as their default avatar. However, the avatar is not copied to SE servers or Imgur, and thus the original URL is kept. This URL compromises the privacy of the user as it contains their Facebook user ID which everyone can easily extract and then view the profile.  The image is also not visible at all to those who have Facebook blocked for their own privacy (by extensions such as Ghostery or browser features ), or due to network policy (e.g. some work and school networks block Facebook).  With the new avatar system, it would be much better if the Facebook photo was stored like a manually uploaded avatar to avoid this problem. Prove $(1+a+b)(1+b+c)(1+c+a)\ge 9(ab+bc+ca)$ How one can prove the following.  Let $a$, $b$ and $c$ be non-negative real numbers. Then the inequality holds:  $(1+a+b)(1+b+c)(1+c+a)\ge9(ab+bc+ca).$  WLOG one can assume that $0\le a\le b\le c$.  It is not difficult to prove the statement when $0\le a\le b\le c\le 1$ or $1\le a\le b\le c$. I'd prefer as little formal definition as possible and simple mathematics. does anyone know the following result? If it holds in this form and any source which presents it? Thanks a lot.  Consider metric space $(X,d_{X})$.  Let $f:A \subset (X,d_{X}) \rightarrow \mathbb{R}$ be a Lipschitz continuous function i.e. $\exists K &gt; 0$ such that  \begin{align*} |f(x)-f(y)| \leq Kd_{X}(x,y) ~~~~\forall x,y \in A \end{align*}  then define functions  $$\bar{f_{1}}(x) := \sup\lbrace f(y) - Kd_{X}(x,y): y\in A \rbrace ~~ \forall x  \in X$$ and $$\bar{f_{2}}(x) := \inf\lbrace f(y) + Kd_{X}(x,y): y\in A \rbrace ~~ \forall x  \in X$$ it follows that  \begin{align*} \bar{f_{1}}, \bar{f_{2}}: X \rightarrow \mathbb{R}  \end{align*} are Lipschitz continuous with  \begin{align*} |\bar{f_{i}}(x)-\bar{f_{i}}(z)| \leq Kd_{X}(x,z) ~~~\forall x,z \in X \text{ and } \forall  i = 1,2 \end{align*} and  \begin{align*} \bar{f_{i}}(x) = f(x) ~~~ \forall x \in A \text{ and } \forall i =1,2 \end{align*} bash function cannot change the value of a local variable when called by $() The following code works differently depending on which way Parse_Short_Switches() is called.  After calling the function 'Parse_Short_Switches' by using result=$(Parse_Short_Switches), the value of $error_flag is NOT set to -1 as I would expect.  After calling the function 'Parse_Short_Switches' by simply using Parse_Short_Switches, the the value of $error_flag is set to -1 as I would expect.  Any help would be greatly appreciated.  Thanks  #!/bin/bash  function Parse_Short_Switches() { echo "error_flag inside of the function= $error_flag" 1&gt;&amp;2 error_flag="-1" echo "blah blah ..." }  # --- MAIN --- error_flag="999" echo "error_flag= $error_flag" #result=$(Parse_Short_Switches) Parse_Short_Switches echo "error_flag= $error_flag"