I want to sort this array on basis of 'eta'.Lowest eta must come to first.  My array is :       Array (     [0] =&gt; Array         (             [company] =&gt; Uber             [type] =&gt; Saloon             [eta] =&gt; 8             [destination_required] =&gt; N             [reject_booking_request] =&gt; N         )      [1] =&gt; Array         (             [company] =&gt; greentomato             [type] =&gt; Saloon             [company_rating] =&gt; 80%             [eta] =&gt; 10             [destination_required] =&gt; N             [reject_booking_request] =&gt; N         )      [2] =&gt; Array         (             [company] =&gt; CATALINA             [type] =&gt; Exec             [eta] =&gt; 12             [destination_required] =&gt; Y             [reject_booking_request] =&gt; N         )      [3] =&gt; Array         (             [company] =&gt; Uber             [type] =&gt; Exec             [eta] =&gt; 15             [destination_required] =&gt; N             [reject_booking_request] =&gt; N         )      [4] =&gt; Array         (             [company] =&gt; Hailo             [type] =&gt; Taxi             [eta] =&gt; 1             [destination_required] =&gt; Y             [reject_booking_request] =&gt; Y         )  )   I want to sort this array on basis of 'eta'.Lowest eta must come to first.  I tried to use this :   $result = Set::sort($array, '{n}', 'asc');   But it gives some error.
I have CSV data loaded into a multidimensional array. In this way each "row" is a record and each "column" contains the same type of data.  I am using the function below to load my CSV file.  function f_parse_csv($file, $longest, $delimiter) {   $mdarray = array();   $file    = fopen($file, "r");   while ($line = fgetcsv($file, $longest, $delimiter))   {     array_push($mdarray, $line);   }   fclose($file);   return $mdarray; }   I need to be able to specify a column to sort so that it rearranges the rows.  One of the columns contains date information in the format of Y-m-d H:i:s and I would like to be able to sort with the most recent date being the first row.
Edits that shadow a suggested edit inconsistently reject but include the suggestion java.lang.NullPointerException at org.glassfish.hk2.classmodel.reflect.impl.TypesImpl.getType Assigning point IDs to respective start and end attributes of polyline? I have two shapefiles, Point and Polyline. I'm trying to populate my polyline layer with the point data ID (systemID) where the lines start to where they end; eg. create two columns (from and to). The lines already have flow direction assigned to them. I am using ArcHydro tools but Arcpy is also fine.  In ArcHydro I have tried using Attribute Tools > Generate From/To Nodes for lines but it creates values for To and From that are not from my point data. My other alternative was using Feature to Vertices and joining the result to my point data table to get the systemID. But then I would have to update the polyline layer as well. I am sure there is a easier way of doing it.  Note: not all the lines have points at the vertices, blank values are fine for them. How can I convince new players to read and learn the basic rules before sitting down to play? Everyone in this story works mostly together. Some work friends and my wife were talking about playing D&amp;D, and I was appointed the DM. I've played the game once 20 years ago, so I've spent the past few months buying the resources and learning as much as I can about the game so I can make it as enjoyable for then as possible, we are yet to have our first session.  But to make it easier so I don't have to teach them literally everything I asked them to read the Basic Rules so they have some idea of what they are in for and the expectations of them and me are.  But they came back with "its too hard to read it, I learn by doing, that's what we have you for".  I'm super pissed by this, I've spent so much time and effort learning this game and they can't be bothered to put any effort in.  My question is should I let them know how much it's annoyed me, and reiterate they need to know stuff, or just ignore it and carry on? I am getting the following error in the top menu bar:     An error occurred.Please run the Package Manger form the right-click menu or apt-get in a terminal to see what is wrong.The error message was:'Error:BrokenCount>0'.This usually means that your installed packages have unmet dependencies. I am currently reading about the interactions between light and matter, but I keep coming across conflicting explanations.  My initial understanding (using classical electrodynamics) was that light (EM) waves do not actually travel through glass. Instead, they are absorbed by the atoms and/or electrons within the glass, which then emit new EM waves. The new EM waves emitted by the energised particles make up the forward-radiation, which is the light observed from the opposite side of the glass. So it appears as if light is travelling through the glass, but it's actually being absorbed and then re-emitted with (mostly) the same properties.  The article  by Chad Orzel, based on a related SE question, confirms the above:      To understand the propagation of a wave through a medium, you can   think of each component of the medium– atoms, in the case of a glass   block– as being set into motion by the incoming wave, and then acting   as a point source of its own waves.   But an answer to a different but related question,  conflicts with the above:     the electrons in glass are tightly bound to atoms so they are not free   to move like the electrons in a metal and therefore they do not absorb   the photons.   I know the above is referring to the quantum electrodynamics understanding, but I think it still conflicts as it claims that EM waves are not absorbed by the electrons in glass because they are too tightly bound to their atoms.  Also, the  provides a small explanation of the mechanics behind refraction within glass, which kind of conflicts with both of the above:     In the case of dielectrics such as glass, the electric field of the   light acts on the electrons in the material, and the moving electrons   generate fields and become new radiators. The refracted light in the   glass is the combination of the forward radiation of the electrons and   the incident light. The reflected light is the combination of the   backward radiation of all of the electrons.   From my understanding, the above claims that some of the light is absorbed and re-emitted by the electrons (which conflicts with the linked answer), and that the rest of the incident light travels through the glass (makes up the rest of the refracted light) (which I think conflicts with the linked article, claiming the light is absorbed (although the article doesn't technically state whether all of the light is absorbed and re-emitted, so maybe that's where I'm going wrong(?))  I'm sure this is my misunderstanding, so I would be very grateful if you could clear it up for me:  When a light wave is incident on a sheet of glass, do the particles that make up the glass absorb the waves and re-emit them in the forward direction? Or do the light waves manage to travel through the glass, without being absorbed and then exit the glass? block certain dangerous commands? In my  High school there are few computer having Ubuntu 14.04 installed and many students know the Root  password, how  can I block/disable  certain dangerous  commands like :- rm -rf / rm -rf * :(){:|:&amp;};: to avoid Data loss ? If each suit is represented then we will have two cards from one suit and one card each from the remaining suits. So I am counting the ways this can happen like so -  ${52 \choose 1}$ ways of selecting the first card.  ${12 \choose 1}$ ways of selecting a card from the same suit as the first.  ${13 \choose 1}$ ways of selecting a card for each of the 3 remaining suits.  So I have -  $${52 \choose 1}{12 \choose 1}{13 \choose 1}{13 \choose 1}{13 \choose 1}$$  Then I have the sample space as $52 P 5$ as we are counting with regard to order on the numerator so we need to do the same for the denominator.  So I have $$\frac{{52 \choose 1}{12 \choose 1}{13 \choose 1}{13 \choose 1}{13 \choose 1}}{52P5}$$  Does that look correct? What is the limit of cabin baggage on Wizz Air flights? What's the weight limit on Wizz Air, for cabin baggage?    I can't find anything about the weight on their website. I know that for Ryanair is 10kg, and EasyJet say they don't have a limit for weight. When does the Death Saving Throw happen with respect to sources of automatic ongoing damage? If a character is knocked unconscious with 0HP with a source of automatically dealt damage, for example, into a fire, and takes damage from it each turn, does the automatic Death Saving Throw failure from taking damage at 0hp happen before or after the player's regular Death Saving Throw roll?  If the unconscious PC takes the auto-fail first then they effectively only get 1 Death Saving Throw to survive, because they'd autofail and roll a failure the first turn, then autofail again and die the next turn.   If they get to roll first, then they only effectively get two death saving throws before they die. Automatically redirect anonymous user from unanswered duplicate question to corresponding answered version How prove this $\prod_{1\le i<j\le n}\frac{a_{j}-a_{i}}{j-i}$ is integer Constraints of relativistic point particle in Hamiltonian mechanics I try to understand constructing of Hamiltonian mechanics with constraints. I decided to start with the simple case: free relativistic particle. I've constructed hamiltonian with constraint:  $$S=-m\int d\tau \sqrt{\dot x_{\nu}\dot x^{\nu}}.$$  Here $\phi=p_{\mu}p^{\mu}-m^2=0$  $-$ .  Then $$H=H_{0}+\lambda \phi=\lambda \phi.$$   So, I want to show that I can obtain from this Hamiltonian the same equation of motion, as obtained from Lagrangian.  But the problem is that I'm not sure what to do with $\lambda=\lambda(q,p)$. I tried the following thing:  $$\dot x_{\mu}=\{x_{\mu},\lambda \phi\}=\{x_{\mu},\lambda p^2\}-m^2\{x_{\mu},\lambda\}=\lambda\{x_{\mu},p^2\}+p^2\{x_{\mu},\lambda\}-m^2\{x_{\mu},\lambda\}$$$$=2\lambda \eta_{\mu b} p^b+p^2\{x_{\mu},\lambda\}-m^2\{x_{\mu},\lambda\}=2\lambda \eta_{\mu b} p^b+p^2\frac{\partial \lambda}{\partial p^{\mu}}-m^2\frac{\partial \lambda}{\partial p^{\mu}},$$  $$\dot \lambda=\{\lambda, \lambda \phi \}=\{\lambda,\lambda p^2\}-m^2\{\lambda,\lambda\}=\lambda\{\lambda,p^2\}+p^2\{\lambda,p^2\}=2\lambda\eta_{ak}p^{a}\frac{\partial \lambda}{\partial x^{k}},$$  $$\dot p_{\mu}=\{p_{\mu},\lambda p^{2}-m^2\lambda \}=p^{2}\{p_{\mu},\lambda\}-m^2\{p_{\mu},\lambda\}=-p^{2}\frac{\partial \lambda}{\partial x^{\mu}}+m^2\frac{\partial \lambda}{\partial x^{\mu}}.$$  If we recall that $p^2-m^2=0$, then we get from the third equation: $\dot p=0$, and from the first: $$\dot x_{\mu}=2\lambda\eta_{ak}p^{a}.$$  So we have    $\dot x_{\mu}=2\lambda\eta_{\mu b}p^{b}.$ $\dot \lambda=2\lambda\eta_{ak}p^{a}\frac{\partial \lambda}{\partial x^{k}}.$ $\dot p=0.$   But I don't know what to do next. Can you help me? How do I resolve unmet dependencies after adding a PPA? Algorithms for automatic model selection After enabling hibernate grub menu appears on start-up with 30s timeout My system is not dual boot just single OS UBUNTU 16.04. Prior to making the following changes, the Grub screen would not appear at start-up (OK).  After following these steps from  to enable hibernate in the system menu:   Open terminal and enter;   sudo nano /etc/polkit-1/localauthority/50-local.d/com.ubuntu.enable-hibernate.pkla  add the lines into the empty file;  [Re-enable hibernate by default in upower] Identity=unix-user:* Action=org.freedesktop.upower.hibernate ResultActive=yes  [Re-enable hibernate by default in logind] Identity=unix-user:* Action=org.freedesktop.login1.hibernate;org.freedesktop.login1.handle-hibernate-key;org.freedesktop.login1;org.freedesktop.login1.hibernate-multiple-sessions;org.freedesktop.login1.hibernate-ignore-inhibit ResultActive=yes  ^X then Y to save (a filename was suggested and I accepted without taking note).  Reboot for the changes to take effect.   hibernate now works and appears in the menu (OK) but whenever I reboot I now get a Grub menu at start up with a full 30 second timeout (NOK). I tried playing around with the Grub menu timeout settings but still get the full 30 sec timeout.  How do I stop the Grub menu from appearing and reduce my boot time to what it was before I made these changes.   Current Grub settings;   GRUB_DEFAULT="0" GRUB_HIDDEN_TIMEOUT="0" GRUB_HIDDEN_TIMEOUT_QUIET="true" GRUB_TIMEOUT="1" GRUB_DISTRIBUTOR="`lsb_release -i -s 2&gt; /dev/null || echo Debian`" GRUB_CMDLINE_LINUX_DEFAULT="quiet splash" GRUB_CMDLINE_LINUX="" On average, how many times must I roll a dice until I get a $6$?  I got this question from a book called Fifty Challenging Problems in Probability.   The answer is $6$, and I understand the solution the book has given me. However, I want to know why the following logic does not work: The chance that we do not get a $6$ is $5/6$. In order to find the number of dice rolls needed, I want the probability of there being a $6$ in $n$ rolls being $1/2$ in order to find the average. So I solve the equation $(5/6)^n=1/2$, which gives me $n=3.8$-ish. That number makes sense to me intuitively, where the number $6$ does not make sense intuitively. I feel like on average, I would need to roll about $3$-$4$ times to get a $6$. Sometimes, I will have to roll less than $3$-$4$ times, and sometimes I will have to roll more than $3$-$4$ times.  Please note that I am not asking how to solve this question, but what is wrong with my logic above.  Thank you! Clusering based on categorical variables? I am working on a project and currently experimenting cluster analysis. The dataset is mainly categorical variables and discrete numbers. Please pardon my poor programming skills as I am not very familiar with MathJax, but I will try to summarize the data set in words in the following three examples.   imagine column 1 is participants names of course, from column2 - 5, each column's value range from 1 (least important) - 5 (most important). so in this case, column 2-8 only have discrete data.  column 6 for example, since this is a multiple choice question. row 1 chose "nice" as an answer, however, row 2 chose "poor". In this case, we have one column that contains multiple categorical answers. for column 7-9, this is another type of multiple choice questions. However this time, each column represents only one answer. column 7 only allows string values "true", column 8 only allows string "somewhat". So in this case, we have multiple columns that represent multiple answers of the same question.    Any ideas how to solve this? Thankful to any input!   A2       A3       A4       A5       A6       A7         A8         A9 1        4        5        4        nice     true       somewhate  false 2        4        3        1        poor     true                  false 1        5        2        1        nice                somewhate     3        2        1        5        nice     true                  false How can I restore configuration files? How do I use superposition to solve a circuit? Yes, this is a pedagogical question. While answering another recent question, I wanted to refer the OP to concise instructions for using superposition to solve circuits. I found that all the easily found resources online were somewhat deficient. Typically they were unclear about what kinds of circuits superposition applies to, or about the actual method to apply the superposition theorem to a circuit problem. So,   What kinds of circuits can be solved by superposition?  How are different kinds of sources treated when solving by superposition?  What are the steps to solve a circuit using the superposition theorem?