I creating functions in my function.php and I have a question regarding passing local variables between functions.  Let say I have the functions below, A and B, and I have the variable $amount.  Now let's say in Function A, $amount changes according to certain conditions.  How do I make sure that the $amount used in Function B, is the updated variable and not just the variable I declared at the beginning.  I thought of using static or globals but I am not sure how this applies to a variable which is dynamic.   function A () {     $amount = 5;      if(isset($_POST['term_id']))     {       if ($_POST['term_id'] == '74' )         $amount = -20;        elseif ($_POST['term_id'] == '75' )         $amount = 500;     }    }    function B () {     echo $amount;   }   Edit:  To toscho, I understand the similarities between the two questions, but my variable is a dynamic variable, whereas the user's variable in the other questions is always constant.
I'm setting up a child theme in WordPress and I can't make add_action to be fired within functions.php.  Functions.php is called and I can run code from within. Any idea on what I'm doing wrong?  $debug_msg = "Hi there!";  function test_function() {     error_log($debug_msg, 0);  } add_action('init', 'test_function', 20);
I'd like to find a place to store stuff while I'm out adventuring, without spending 5000 on a house (at least, until I can afford that...). Where can I safely store items without worrying about them disappearing?   There are two possible places that come to mind,  (to which I have the key and was told I could stay), and the small bedroom given to me at the  (which I was told was mine, despite seeing J'zaro sitting in it later). Can I store items safely in either of these places? Enumerate in multicols how to move the last element upwards Code: \documentclass{article} \usepackage[a5paper]{geometry} \usepackage{multicol} \setlength{\parindent}{0cm} \begin{document} \begin{multicols}{2}   \begin{enumerate}   \item text 1   \item text 2   \item text 3   \item text 4   \item text 5   \end{enumerate} \end{multicols} \end{document}  Gives this:  How to move &quot;text 5&quot; upwards adjacent to &quot;text 4&quot;? How can I install apt packages non-interactively? If I run:  sudo apt-get --yes install postfix    or  sudo bash -c 'yes | apt-get --yes install postfix'   an interactive prompt appears to configure postfix. I need to automate the installation of postfix (I can modify the configuration files after the install).  Is there some magic that lets me install postfix (and other package) without human intervention? Word for person who looks for flattery What word could be used to describe a person who seeks and seems to depend on constant positive feedback from the people around him. I have read , but it was asked in the context of servers not desktops or notebooks.  If a good amount of RAM is installed on a notebook, say 8 GB, do we still need a swap space? Convert shapely polygon coordinates I am trying to work with a shapefile using shapely, fiona and python. The original coordinate system is in latitude and longitude that I am trying to convert to state plane system. So I want an updated shapefile with coordinates as statePlane. I converted the json object:  fc = fiona.open("sample.shp")    geoJsonObj = shapefile_record['geometry'] array_coordinates = np.array(geoJsonObj['coordinates']) array_newCoordinates = copy.deepcopy(array_coordinates) for counter in range(0,len(array_coordinates[0])):     long,lat = p1(array_coordinates[0][counter][0],array_coordinates[0][counter][1])     #where p1 is a function to do the conversion     array_newCoordinates[0][counter][0] = long     array_newCoordinates[0][counter][1] = lat  geoJsonObj['coordinates'] = array_newCoordinates.tolist()   when i check the coordinates, i get state plane coordinates according to the transformation.  n. However, when i open the individual shapes/polygons within the shapefile, the coordinates are still latitude and longitude. why does this happen?  ----EDIT 1-----  from pyproj import Proj, transform import fiona from fiona.crs import from_epsg  dest_crs = from_epsg(4269) shape = fiona.open("Sample.shp") original = Proj(shape.crs) # EPSG:4326 in your case destination = Proj('+proj=lcc +lat_1=36.41666666666666 +lat_2=35.25      +lat_0=34.33333333333334 +lon_0=-86 +x_0=600000 +y_0=0 +ellps=GRS80 +datum=NAD83  +no_defs') with fiona.open('new.shp', 'w', 'ESRI Shapefile',shape.schema.copy(),crs = dest_crs) as output:     for feat in shape:                print feat['geometry']['coordinates']         for counter in range(0,len(feat['geometry']['coordinates'][0])):             long,lat =  feat['geometry']['coordinates'][0][counter]             x,y = transform(original, destination,long,lat)             feat['geometry']['coordinates'][0][counter] = (x,y)         output.write(feat) How to type en-dash and em-dash in Windows 7/8? I write blog posts, and I often need to type en-dash (–) and sometimes em-dash (—) in my blog posts. Currently I keep these characters saved in a text file, and copy-paste them whenever I need them. Unnecessary to say, it is a headache to move between keyboard and mouse when you type large texts.  It would be better for me if there ware a keyboard shortcuts available for these two characters. Is there a way to type en-dash and em-dash in Windows? I use Windows 7 and Windows 8 in different computers.    Here's an aligned comparison of dashes, if you need to see the difference for some reason.   Here's-dash Here's–en-dash Here's—em-dash Destructors of builtin types (int, char etc..) In C++ the following code gives a compiler error:  void destruct1 (int * item) {   item-&gt;~int(); }   This code is nearly the same, I just typedef the int to another type and something magic happens:  typedef int myint;  void destruct2 (myint * item) {   item-&gt;~myint(); }   Why does the second code work? Does an int get a destructor just because it has been typedefed?  In case you wonder why one ever would like to do this: This comes from refactoring C++ code. We're removing the standard heap and replacing it with selfmade pools. This requires us to call placement-new and the destructors. I know that calling destructors for primitive types is useless, but we want them in the code nevertheless in case we later replace PODs with real classes.  Finding out that naked int's don't work but typedefed ones do was quite a surprise.  Btw - I have a solution that involves template-functions. We just typedef inside the template and everything is fine. Pattern in Isomorphisms between $\mathbb Z_m \times \mathbb Z_n$ and $\mathbb Z_{mn}$ In general, the group $\mathbb Z_{mn}$ under addition $\bmod mn$ is isomorphic to the direct product $\mathbb Z_m \times \mathbb Z_n$ if and only if $\gcd(m,n)=1.$ This is easy to see since $\mathbb Z_{mn}$ is generated by the element $(1,1)$, and if $\gcd(m,n)=1$, then this will only be zero if it is multiplied by itself $mn$ times (resulting in the cyclic group).   However I'm interested in constructing an isomorphism between the two groups as an explicit expression. I've been playing around a bit with some examples, one of which is the function $\phi : \mathbb Z_2 \times \mathbb Z_3 \to \mathbb Z_6$ where $\phi(a,b) = 3a + 4b \pmod 6$, which gives us the desired isomorphism. I'm interested here in the relationship between the integers $2$, $3$, and the coefficients $3, 4$ of $a$ and $b$. After playing around in Wolfram|Mathematica, I managed to obtain the following isomorphisms $\phi_{m,n} : \mathbb Z_m \times \mathbb Z_n \to \mathbb Z_{mn}$ for coprime $m,n$ in $\{1, 2, \dots, 10\}$.   First of all, the following results seem to hold in general.  $$\phi_{1, n}(a, b) = a + b \qquad \text{for all $n$}$$  $$\phi_{m, 1}(a, b) = a + b \qquad \text{for all $m$}$$  $$\phi_{2, n}(a, b) = na + (n + 1)b \qquad \text{for all $n$}$$ $$\phi_{m, n}(a, b) = K a + L b \iff \phi_{n,m}(a, b) = L a + K b \qquad \text{for all $m, n$}$$  Beyond this point, I could not spot a general pattern. The isomorphisms I obtained are:  $$\phi_{3, 4}(a, b) = 4a + 9b$$ $$\phi_{3, 5}(a, b) = 10a + 6b$$ $$\phi_{3, 7}(a, b) = 7a + 15b$$ $$\phi_{3, 8}(a, b) = 16a + 9b$$ $$\phi_{3, 10}(a, b) = 10a + 21b$$ $$\phi_{4, 5}(a, b) = 5a + 16b$$ $$\phi_{4, 7}(a, b) = 21a + 8b$$ $$\phi_{4, 9}(a, b) = 9a + 28b$$ $$\phi_{5, 6}(a, b) = 6a + 25b$$ $$\phi_{5, 7}(a, b) = 21a + 15b$$ $$\phi_{5, 8}(a, b) = 16a + 25b$$ $$\phi_{5, 9}(a, b) = 36a + 10b$$ $$\phi_{6, 7}(a, b) = 7a + 36b$$ $$\phi_{7, 8}(a, b) = 8a + 49b$$ $$\phi_{7, 9}(a, b) = 36a + 28b$$ $$\phi_{7, 10}(a, b) = 50a + 21b$$ $$\phi_{8, 9}(a, b) = 9a + 64b$$ $$\phi_{9, 10}(a, b) = 10a + 81b$$ If you want to try and generate a few yourself, here is the Mathematica function I implemented. I'm sure it can be optimised, but for the first 10 coprime integers it sufficed.  isomorphism[{m_, n_}] :=       Module[{x = Null},       For[i = 1, i &lt; m*n,           i++, (If[#[[2]] == Table[i, {i, 0, m*n - 1}],           x = ToString[#[[1]][[1]]] &lt;&gt; "a+" &lt;&gt; ToString[#[[1]][[2]]] &lt;&gt;          "b"; Break[]] &amp;) /@       Table[{{i, j},       Mod[i #[[1]] + j #[[2]], m*n] &amp; /@       Table[{Mod[i, m], Mod[i, n]}, {i, 0, m*n - 1}]}, {i, 1,      m*n}, {j, 1, m*n}][[i]]]; x];   I'd appreciate if anyone can help me find the pattern to determine $\phi_{m, n}$ in general. Let $p, q \in \mathbb{R}^n$ such that $\|p\| = \|q\| = 1$ and define $$A = pq^T + qp^T$$ Find the null space of $A$.    I am not having very much luck. I have managed to show that $p + q$ and $p - q$ are eigenvectors, but I can't seem to connect those two. I know that since $A$ is generated by an outer product, it is of rank one. That implies that the rank of the null space is $n - 1$, but I can't seem to get any further. Can anyone help? How to prevent negative comments/downvoted being deleted by re-posting answers What is my login username and password? Seasonal Loan Amortization Hi I can compute a Basic Loan Amortization Schedule, But now I'm trying to Calculate a Seasonal Loan Amortization Schedule . So for example A loan starts at January And Will go on for 3 years, with Monthly Payments. Interest is at 3% Annually and is compounded Annually. During the months of September, October, November, December It'll only accumulate Interest But no payments and principal. Principal is 100000. How Do I calculate Payments and interest. Java code needs a system.out.println statement to run How do you set, clear, and toggle a bit? When we define the S-matrix, what are "in" and "out" states? I have seen the scattering matrix defined using initial ("in") and final ("out") eigenstates of the free hamiltonian, with  $$\left| \vec{p}_1 \cdots \vec{p}_n \; \text{out} \right\rangle = S^{-1} \left| \vec{p}_1 \cdots \vec{p}_n \; \text{in} \right\rangle$$  so that  $$\left\langle \vec{p}_1 \cdots \vec{p}_n \; \text{out} \mid \vec{q}_1 \cdots \vec{q}_m \; \text{in} \right\rangle = \left\langle \vec{p}_1 \cdots \vec{p}_n \; \text{in} \mid S \mid \vec{q}_1 \cdots \vec{q}_m \; \text{in} \right\rangle.$$  1) What are "in" and "out" states?   2) Are they Fock states?   3) In Schrödinger or Heisenberg or interaction representation?   4) How are they related? (I believe that I see what they handwavily represent physically, but not formally.)  My main issue is that, if "in" and "out" states are one-particle eigenstates of the free hamiltonian, i.e. if $\left| \vec{p}_1 \text{out} \right\rangle$ describes a free particle with momentum $\vec{p}_1$, and $\left| \vec{p}_1 \text{in} \right\rangle$ also describes a free particle with momentum $\vec{p}_1$, then $\left| \vec{p}_1 \text{out} \right\rangle = \left| \vec{p}_1 \text{in} \right\rangle$ ... which is false. Still, books (some at least) describe these "in" and "out" states like that.  Moreover, I have seen (e.g. in Wikipedia, but also ) that the scattering matrix is a map between two different Fock states, and I don't understand that.   5) Do states of the interacting system live in the same Fock space that asymptotic free states?   6) And if not, where do they live?  Understandable references would be appreciated. I've been using mkvmerge to merge a video file and subtitles, I'm using the following command  mkvmerge -o output.mkv video.mp4 subtitles.srt   Which is working fine but as you can probably guess this is really slow operation   I've to open terminal in every one of those directories where movies are stored. Then I've to copy and paste the names of the files in the command Then I've to rename the output file Then delete the original files which I used   This is a lengthy process.     Ideal situation that I want.   I'll go into the folder which contains a movie file and a subtitle file with the same name. I select a movie file and and a subtitles file, right click and run a nautilus script on them. They get merged Original file gets deleted. Rename the merged file with the name of the orignal file with mkv extension      This doesn't need to be recursive, I don't want my HDD creating and deleting 100's of files at ones. Movie files and Subtitle files generally have the same name but some times have "_en" post fixed to subtitle files. If you have another approach of doing it I'm on board with that too. How can I find the cheapest prepaid SIM card for a given country? how to represent geography or zip code in machine learning model or recommender system? I am building a model and I think that geographic location is likely to be very good at predicting my target variable.  I have the zip code of each of my users. I am not entirely sure about the best way to include zip code as a predictor feature in my model though.  Although zip code is a number, it doesn't mean anything if the number goes up or down.   I could binarize all 30,000 zip codes and then include them as features or new columns (e.g., {user_1: {61822: 1, 62118: 0, 62444: 0, etc.}}.  However, this seems like it would add a ton of features to my model.   Any thoughts on the best way to handle this situation? Upgrade Debian Jessie (8) to Buster (10) possible or need to go sequential in versions upgrades? Just started working with a Debian Jessie (8) in a production environnent. While presently deployed it is not seeing any heavy use yet. I was looking at the OS , and I was thinking about how convenient it would be to just upgrade it before is start seeing some more steady use in our environment and possibly making things more complicated with a later upgrade.  I was looking for a procedure to upgrade from Debian v.8 to v.10 but most documented  are sequential in order (e.g. 8 -> 9, or 9 -> 10).  My question: should I upgrade sequentially, or there is some proper documented way to skip a main version while upgrading?