I have an associative array filled with more or less randomly mixed numeric and string keys, let's go with such example: $arr = array('third'=&gt;321, 4=&gt;1, 65=&gt;6, 'first'=&gt;63, 5=&gt;88, 'second'=&gt;0);  Now I'd like to sort it in such way:  Sort the array so the numeric keys would be first, and string keys after. The numeric values sholud be in specific order: 5, 4, 65 The string keys should be ordered by specific order as well: 'first', 'second', 'third' Output in this case should look like: array(5=&gt;88, 4=&gt;1, 65=&gt;6, 'first'=&gt;63, 'second'=&gt;0, 'third'=&gt;321) Each element might not be present at all in the original $arr, which might be additional problem...  My guess would be to split the array and make separate one with string keys, and one with numerc keys. Than sort each one and glue them together... But I do't know how to do it? Edit: Turned out to be a very poor idea, much better approach is in the answer below.
Is it possible in PHP to do something like this? How would you go about writing a function? Here is an example. The order is the most important thing.  $customer['address'] = '123 fake st'; $customer['name'] = 'Tim'; $customer['dob'] = '12/08/1986'; $customer['dontSortMe'] = 'this value doesnt need to be sorted';   And I'd like to do something like   $properOrderedArray = sortArrayByArray($customer, array('name', 'dob', 'address'));   Because at the end I use a foreach() and they're not in the right order (because I append the values to a string which needs to be in the correct order and I don't know in advance all of the array keys/values).  I've looked through PHP's internal array functions but it seems you can only sort alphabetically or numerically.
How do I determine whether a drive is an HDD or SSD in Windows 8? I've recently received an assembled PC. I don't know if the disk is an SSD or old HDD (whether SATA or other technologies).  I can't find a way to tell if the disk is SSD or not, apart from the size of the disk. However, now that the sizes of SSDs are getting close to that of HDDs, checking the size is not a good and robust way to distinguish drive type. Is there some other way to determine if the disk is an SSD? $\mathbb{Q}(\sqrt{p},\sqrt[3]{q})= \mathbb{Q}(\sqrt{p}\cdot \sqrt[3]{q})$ ?? Assign material to part of mesh Is there a way to get new dwellers with higher than normal stats? How to install GUI desktop on a server? After installing Ubuntu server how do I install the desktop environment? Maximum total distance between points on a sphere What is the configuration (set of locations) of $n$ points on the surface of a sphere such that the sum of distances is maximum for $n=1,2,3,...$?  The sum of distances is measured by summing the lengths of every straight line (through the sphere) connecting every possible combination of $2$ points.  All the points are on a single sphere of radius $R$.  Here's a visualization:   Acknowledgements: Based on  Physics S.E. question. Image from . Whenever I try to Get then Install any app from the App Store, I get this message:     We could not complete your purchase.  cancelled   I did some searching online, but barely found any useful hits. What is this about?! What do I need to know before upgrading the CPU of a laptop? I have an AMD laptop, which has AMD APU (e1-2500). I don't really like the speed of it and would love to upgrade to faster APU. There are some AMD APUs available in ebay. So the question is:   What do I need to check to be sure that a new APU will work without problems? Chen weibull distribution Exclamation(!) turned in to question mark(?) in title field I just submitted a question () with an exclamation (!) at the end of the title (with one space between the word and the exclamation) but it turned in to question mark (?).   I removed the space between the word and the exclamation, then it shows normal.   Is this an intended feature? What's the mathematics definition of the F value in Analysis of Variance Table? Suppose I have a linear regression model Y ~ b1*x1 + b2*x2 with the sample data:          x1      x2        y 0  -0.7251 -0.6033  10.2508 1  -1.3148  3.7067  10.3054 2  -1.2818 -5.8136   7.2010 3   0.6154  3.6336  11.2807 4   1.4887 -2.8337  10.6299 5  -2.0224 -0.3931   7.4502 6   0.5419 -1.7807  10.7339 7  -1.0745 -5.0296   5.8734 8   3.2116 -0.4681  11.7184 9   1.6767 -4.6040   9.0145 10 -1.3355 -2.6874   6.5014 11  0.8296  2.6793  11.8295 12 -2.8647  4.2916   7.8414 13  1.8445 -3.3924   9.6520 14 -0.1036  2.4273  11.9766 15  1.0886 -3.5636  10.6023 16 -3.3026 -6.9837   4.9962 17  1.4050 -3.8453  10.4630 18 -0.3111 -1.4278   9.2283 19 -3.5454  2.4960   7.3720   And using the following R code to get the Analysis of Variance Table:  &gt; df &lt;- read.csv('f:/data.csv', header=T, sep=",") &gt; model_All &lt;- lm(y ~ x1 + x2, data=df) &gt; anova(model_All) Analysis of Variance Table  Response: y           Df Sum Sq Mean Sq F value    Pr(&gt;F)     x1         1 44.440  44.440  58.277 6.865e-07 *** x2         1 26.640  26.640  34.934 1.711e-05 *** Residuals 17 12.964   0.763                       --- Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1   And I can calculate the F value of hypothesis test H0： b2=0 via:  &gt; model_Drop2 &lt;- lm(y ~ x1, data=df) &gt; SSR_All = sum(resid(model_All)^2) &gt; SSR_Dp2 = sum(resid(model_Drop2)^2) &gt; F_x2 = ((SSR_Dp2 - SSR_All) / 1) / (SSR_All / (20 - 3)) &gt; F_x2 [1] 34.93434   We can see that F_x2 is equal to F value of x2 in Analysis of Variance Table. However, the value F_x1 calculated as follow is not equal to F value of x1, I can't understand why:  &gt; model_Drop1 &lt;- lm(y ~ x2, data=df) &gt; SSR_Dp1 = sum(resid(model_Drop1)^2) &gt; F_x1 = ((SSR_Dp1 - SSR_All) / 1) / (SSR_All / (20 - 3)) &gt; F_x1 [1] 70.30392   So, what is the mathematics definition of the F value in table?  EDIT The result of the features reversed as commented by @Michael M:  &gt; model_All2 &lt;- lm(y ~ x2 + x1, data=df) &gt; anova(model_All2) Analysis of Variance Table  Response: y           Df Sum Sq Mean Sq F value    Pr(&gt;F)     x2         1 17.468  17.468  22.907 0.0001718 *** x1         1 53.612  53.612  70.304 1.914e-07 *** Residuals 17 12.964   0.763                       --- Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 Say I have a code to draw a flow chart, I want now a arrow from node 3 to node 1, how can I do that?  1&lt;--| |   | 2   | |   | 3----   MWE  \documentclass[class=article,border=0pt]{standalone}  \usepackage{tikz} \usetikzlibrary{shapes,arrows}  % Define block styles \tikzset{     block/.style={rectangle, draw, line width=0.5mm, black, text width=5em, text centered,                   rounded corners, minimum height=2em},     line/.style={draw, -latex} }% &lt;- if you insist in using this in the document add this % here. \begin{document} \begin{tikzpicture}[node distance = 1cm, auto]     % Place nodes     \node [block] (BLOCK1) {a};     \node [block, below of=BLOCK1] (BLOCK2) {b};     \node [block, below of=BLOCK2, node distance=1cm] (BLOCK3) {c};     % Draw edges     \path [line] (BLOCK1) -- (BLOCK2);     \path [line] (BLOCK2) -- (BLOCK3); \end{tikzpicture} \end{document} I'm trying to test a page that has an input but really its a drop down list. The user enters text and then a dropdown appears based on what the user inputted. They are groups that are in the database. If I look for these elements before typing anything they dont exist but once I start typing they do exist.  The problem is I cant just type the whole name and then press enter or return because an option has to be selected from the list.  I can press arrow down to get the focus on the item from the list but then if I say enter it doesnt select, it sends that enter to the original element and nothing gets selected.  I can find the select element:  var ddList = driver.FindElement(By.CssSelector(".ui-autocomplete-input")); ddList.SendKeys("Admins");   This is the first time the list appears in the html.  It looks like this:  &lt;li class="ui-menu-item" role="presentation"&gt; In a few large projects i have been working on lately it seems to become increasingly important to choose one or the other (XML or Annotation). As projects grow, consistency is very important for maintainability.   My questions are: what are the advantages of XML-based configuration over Annotation-based configuration and what are the advantages of Annotation-based configuration over XML-based configuration? Which Pokémon can speak with humans? Inspired by Detective Pikachu, I was wondering which Pokémon can "speak" with humans.  I would like to include  Pokémon like Meowth in the anime that speak English/Japanese with their mouths, Pokémon like Mewtwo in the anime/movies that speak telepathically, or other Pokémon we've seen like Lugia/Entei that seem to speak without moving their mouths but still out loud for all to hear (presumably).  The format doesn't matter (manga, anime, video games). And while this is inspired by Detective Pikachu, it's not about it, as the movie is not out yet      And it seems like the human character has the special ability, not the Pikachu A potential customer wants to evaluate our storage system. They run Windows 2008R2 x64 with 4KB NTFS on a virtual test machine they've sent us. They did not seem to know this at hand, so I think it's reasonable to assume that environment was not tweaked. The tests are inserting, indexing, searching, deleting. Tool is not known to me.  Given that the windows NTFS block size is 4KB, and SQL write in 64KB chunks - is it safe to assume that a block size of 64k on the SAN is a good choice?  They run SQL Server 2008, perhaps standard. It seems the .NET Regex.Replace method automatically replaces all matching occurrences.  I could provide a MatchEvaluator delegate that returns the matched string after the first replacement, rendering no change, but that sounds very inefficient to me.  What is the most efficient way to stop after the first replacement? How to use notify-send with crontab? I really read many tutorials, but crontab doesn't start notify send.  What I've tried:   etc/crontab  added at the end:  15 * * * * notify-send 'crontab' 'test'  with crontab interface:  crontab -e   added at the end:  15 * * * * notify-send 'crontab' 'test' Why do regex constructors need to be double escaped? Continuous injective map is strictly monotonic