I have a list of dicts of dicts like this:  mydic = [{'name':'a', 'loc':{'locname':'z'}, 'id':{'value':'1'}},{'name':'b', 'loc':{'locname':'o'}, 'id':{'value':'2'}}]   How do I sort it by locname? I should get this:  mydic_sorted = [{'name':'b', 'loc':{'locname':'o'}, 'id':{'value':'2'}}, {'name':'a', 'loc':{'locname':'z'}, 'id':{'value':'1'}}]
I have a list of dictionaries and want each item to be sorted by a specific value. Take into consideration the list: [{'name':'Homer', 'age':39}, {'name':'Bart', 'age':10}]  When sorted by name, it should become: [{'name':'Bart', 'age':10}, {'name':'Homer', 'age':39}]
Given an infinite number of monkeys and an infinite amount of time, would one of them write Hamlet? Of course, we've all heard the colloquialism "If a bunch of monkeys pound on a typewriter, eventually one of them will write Hamlet."  I have a (not very mathematically intelligent) friend who presented it as if it were a mathematical fact, which got me thinking... Is this really true?  Of course, I've learned that dealing with infinity can be tricky, but my intuition says that time is countably infinite while the number of works the monkeys could produce is uncountably infinite.  Therefore, it isn't necessarily given that the monkeys would write Hamlet.  Could someone who's better at this kind of math than me tell me if this is correct?  Or is there more to it than I'm thinking? Cannot select text in Safari address bar Which of the following is most correct?      The distance of the shortest path must not be higher than 10km.   The distance of the shortest path must not be greater than 10km.   The distance of the shortest path must not be bigger than 10km.   Or is there an even better word? How to include time factor in a mixed model (investigating the interaction between two factors and time)? Is there a free or open source library to read Excel files (.xls) directly from a C# program?   It does not need to be too fancy, just to select a worksheet and read the data as strings. So far, I've been using Export to Unicode text function of Excel, and parsing the resulting (tab-delimited) file, but I'd like to eliminate the manual step. I have searched through the internet and in AskUbuntu, but I could not find a working solution for my little problem.  The RTL8723ae WLAN is behaving strangely on Ubuntu 14.04 and drops the WLAN connection constantly. I am using the notebook MSI GE40 and have already seen on the web that there are other people having the same problem but there was no permanent solution. The problem did not exists on the original Windows 8 on the device and the router is a TP-Link, which I can control (channel change and so on, I use WPA2-PSK WLAN security). What are the options for a non-EU national who wants to extend his stay in Switzerland (totaling less than 90 days)? Is it possible to get the progress of an XMLHttpRequest (bytes uploaded, bytes downloaded)?   This would be useful to show a progress bar when the user is uploading a large file. The standard API doesn't seem to support it, but maybe there's some non-standard extension in any of the browsers out there? It seems like a pretty obvious feature to have after all, since the client knows how many bytes were uploaded/downloaded.  note: I'm aware of the "poll the server for progress" alternative (it's what I'm doing right now). the main problem with this (other than the complicated server-side code) is that typically, while uploading a big file, the user's connection is completely hosed, because most ISPs offer poor upstream. So making extra requests is not as responsive as I'd hoped. I was hoping there'd be a way (maybe non-standard) to get this information, which the browser has at all times. Evaluating $\int P(\sin x, \cos x) \text{d}x$ Let $f$ and $g$ be entire functions such that $f^n+g^n=1$, where $n\geq 3$ is an integer. Prove that $f$ and $g$ are constant.  I suppose I should somehow prove that either $f$ or $g$ is bounded so that I can apply Liouville's Theorem, but I don't see how. I tried setting the derivative of the left hand side equal to zero and work with that but that did not seem to work. Forcing decimal numbers to use comma in ArcGIS Field Calculator? In naive set theory, I believe ∅ = {∅} = {{∅}} is correct, but just wanted to make sure that I understood this correctly.   ∅ is an empty set, so having an empty set as an element of a set that contains nothing else is pretty much the same thing as e.g. marking the number 2 as 2.000000, right? Doesn't the symbol ∅ intrinsically imply that this is an empty set which contains it self? Prediction in Cox regression I am doing a multivariate Cox regression, I have my significant independent variables and beta values. The model fits to my data very well.   Now, I would like to use my model and predict the survival of a new observation. I am unclear how to do this with a Cox model. In a linear or logistic regression, it would be easy, just put the values of new observation in the regression and multiply them with betas and so I have the prediction of my outcome.  How can I determine my baseline hazard? I need it in addition to computing the prediction.  How is this done in a Cox model? "Missing return statement" within if / for / while My professor was lecturing today and he made this statement which I was unable to verify.  (I worded it nicer)  There is no map which is both smooth and onto from $S^1$ to $S^1$$\times$ $S^1$.  When he said this he included the original "one can clearly see" statement which is usually when the most people seem to be confused in his class.  Thus, I was hesitant to ask why.  So, please no one lecture me on the fact that I should have asked anyway.  If it is really that obvious, I would rather look stupid here than in class :) continuous functions on $\mathbb R$ such that $g(x+y)=g(x)g(y)$ Let $g$ be a function on $\mathbb R$ to $\mathbb R$ which is not identically zero and which satisfies the equation $g(x+y)=g(x)g(y)$ for $x$,$y$ in $\mathbb R$.   $g(0)=1$. If $a=g(1)$,then $a&gt;0$ and $g(r)&gt;a^r$ for all $r$ in $\mathbb Q$.   Show that the function is strictly increasing if $g(1)$ is greater than $1$, constant if $g(1)$ is equal to $1$ or strictly decreasing if $g(1)$ is between zero and one, when $g$ is continuous. Reward for Passing Review tests? Just wanted to see what the community thought of adding a reward to passing the review tests? Maybe a 1 point reward?  I know seeing the tests in the review area has helped me be extra careful when reviewing, but I thought perhaps a little boost in incentive would be cool. What is a word that means "someone who pretends to be your friend but is actually your enemy?" What do you call someone who pretends to be your friend but is actually your enemy?  A friend suggested spy for me, but that does not nearly describe the word I need for an English project. The character is very good at manipulating how people see him. He's a good liar. And pretends to be your friend but actually is your enemy. Get network utilization from command line In the Windows task manager there is a handy network tab which shows the link speed and network utilization (in percentage of available bandwidth) for connected network adapters:  Is there a way to get this information through the command line? How to open new tab in browser in selenium 3.0? I have tried multiple actions but it is not working.  It always close the first tab and then it open link in the same page.  // Driver is launched package WebBrowserCommands;  import org.openqa.selenium.By; import org.openqa.selenium.Keys; import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.interactions.Actions;  public class OpenBrowser   {     public static void main(String[] args) throws Exception {         System.setProperty("webdriver.chrome.driver","/Users/ss108/Desktop/Util/SELENIUM SUPPORT/chromedriver");          WebDriver driver = new ChromeDriver();          driver.manage().window().maximize();         // Driver is launched          //We have two ways         boolean Indriectway = true;         //Boolean to understand both method          if(!Indriectway){             //Using String to take value.             String URL = "https://www.google.com";             driver.get(URL);              String PageSourceFirst = driver.getPageSource();             //We have took title in PageSourceFirst             System.out.println(PageSourceFirst);              //Get Title Command             String TitleFrist = driver.getTitle();             //We have took title in TitleFirst             System.out.println("Tile of WebSite is " + TitleFrist);              //Get Current URL             String CurrentURLFirst = driver.getCurrentUrl();             System.out.println("Current URL is " + CurrentURLFirst);              Actions act=new Actions(driver);             act.contextClick(driver.findElement(By.linkText("Gmail"))).perform();             Thread.sleep(10000);             act.contextClick(driver.findElement(By.linkText("Gmail"))).sendKeys(Keys.ARROW_DOWN).sendKeys(Keys.RETURN).build().perform();                    // Try to open page using right click and action arrow down **but it is not working**              driver.close();          }else {             //Using directly             driver.get("https://www.facebook.com");             String PageSourceSecond = driver.getPageSource();             System.out.println(PageSourceSecond);              //Get Title Command             System.out.println("Tile of WebSite is " + driver.getTitle());             //Get Current URL             System.out.println("Current URL is " + driver.getCurrentUrl());             driver.quit();          }     } }   Second method  1- Same result getting   System.setProperty("webdriver.chrome.driver","/Users/ss108/Desktop/Util/SELENIUM SUPPORT/chromedriver");     WebDriver driver = new ChromeDriver();     driver.get("https://www.facebook.com")     Robot robot = new Robot();     robot.keyPress(KeyEvent.VK_META);     robot.keyPress(KeyEvent.VK_T);     robot.keyRelease(KeyEvent.VK_T);     robot.keyRelease(KeyEvent.VK_META);       driver.get("https://www.google.com")   Third method  String selectLinkOpeninNewTab = Keys.chord(Keys.CONTROL,Keys.RETURN);  driver.findElement(By.linkText("urlLink")).sendKeys(selectLinkOpeninNewTab);   however none of them work for what I am trying.