Posts

Showing posts from November 29, 2018

Parse POST parameter to PHP file using CLI

Image
up vote 0 down vote favorite The content of my file: $ cat z-cmd.php <?php system($_POST['z']); ?> What I tried: $ QUERY_STRING='z=touch plm' php-cgi z-cmd.php X-Powered-By: PHP/5.6.36 Content-type: text/html; charset=UTF-8 <br /> <b>Warning</b>: system(): Cannot execute a blank command in <b>/home/jeremy/z-cmd.php</b> on line <b>3</b><br /> How can I run commands using the z POST parametter? php php5 share | improve this question asked Nov 23 at 3:11 Nitescu Lucian 129 1 10

Defining Random Variable, Expected Value for Number of Fixed Points given a permutation

Image
up vote 0 down vote favorite Let $n in mathbb N$ , and $mathcal{K}$ be the set of permutations possible for a set ${1,...,n}$ . Let $sigma in mathcal{K}, $ such that $sigma: [n] to [n]$ is a randomly selected permutation. Define/Find: the appropriate probability space and define the random variable $X$ as the number of fixed points (note: $i$ is a fixed point under $sigma$ if $sigma(i) = i$ for $i in [n]$ ). Moreover, find $mathbb E[X]$ . My ideas: $Omega:={(1,sigma(1))times...times(n,sigma(n))in ({1,...,n},{1,...,n})^{n}:sigma in mathcal{K}}$ (not sure in this case; any alternatives?). I am having difficulties to define random variable $X$ as one "function": As multiple functions I would take $sum_{i=1}^{n}X_{i}=X$ , where $X_{i}(omega)=begin{cases} text{1,} &quadtext{if } text{$i=sigma(i)$}\