Sorting a list which contains dictionaries
How do I sort a list of dictionaries by a value of the dictionary?
I have a question about inheritance in Java.  I have two classes A and B , and class B, inherits from A:  public class A {      public A() {          System.out.println("Hi!");      } }   public class B extends A {      public B() {          System.out.println("Bye!");      }       public static void main(String[] args) {          B b = new B();      } }   When I run program B, the output is:  Hi! Bye!      Question : why the constructor of class A is invoked, when I create and object of class B ?    I know that B inherits everything from A - all instance or class variables, and all methods, and in this sense an object of B has all characteristics of A plus some other characteristics defined in B. However, I didn't know and didn't imagine that when I create an object of type B, the constructor of A is also invoked. So, writing this:  B b = new B();   creates Two objects - one of type B, and one of type A.  This is getting interesting,   can somebody explain why exactly this happens? Macro for figure position? Why is the following minimal example not working?  I.e., what do I need to do, in order to define the float placement specifier of a figure within a macro? (I know that I should use \newcommand, but in the "full" example the error is part of an involved "superfigure" command. \newcommand is not working too btw.)  \documentclass{scrreprt} \usepackage{blindtext}  \def\PosNotWorking{h} \def\FramboxNotWorking{5cm} \def\CaptionWorking{Caption is working.}  \begin{document}  \Blindtext[1]  \begin{figure}[\PosNotWorking]   \centering     \framebox[5cm]{My special figure. (Pos: \PosNotWorking)}             \caption{\CaptionWorking} \end{figure}  \Blindtext[1]  \end{document}   If I compile this, the figure is at the top (default behaviour). If I enter \figure[h] instead of \figure[\PosNotWorking], the figure is of course between the two paragraphs. How do the review limits work? I got the brand new Custodian badge today for reviewing posts. Inspired by that, I reviewed some more suggested edits. Now I ran into a limit:     You have no more suggested edit votes today; come back in x hours.   How is that limit calculated? I made 61 reviews today which seems to be some calculated limit.  I searched for an answer on meta but found nothing helpful. How to remove symbolic link I was trying to create this symbolic link:  sudo ln -s /usr/share/phpmyadmin /var/www/phpmyadmin   but I accidentally typed:  sudo ln -s /usr/share/php,yad,in /var/www/phpmyadmin   So now I want to correct it but it says symbolic link already exist. In Unity, are there any pre-defined shortcuts, e.g. to open the dash or unhide the launcher? Can I attack a specific player? I was in a clan and someone kicked me from it.   I think I'm stronger than him. Is there any way I can attack him? The only method I see to attack is random players. Can I attack a specific player? Area 51 layout breaks when zoomed to 90% How do you prevent an ENTER key press from submitting a form in a web-based application? Any Set with Associativity, Left Identity, Left Inverse is a Group Related Link:    Reference: Fraleigh p. 49 Question 4.38 in A First Course in Abstract Algebra     I will present my proof (distinct from those in the link) for critique and then ask my question.  $G$ is a set and $ \times $ is an associative binary operation.  Suppose that there exists a $e \in G$ such that, for all $a \in G$, $ea = a$ and $a^{-1}a = e$ for some $a^{-1} \in G$.  Show that for the same $e$, $ae = a$ and $aa^{-1} = e$.  $a^{-1}(aa^{-1})a = (a^{-1}a)(a^{-1}a) = ee = e = a^{-1}a = a^{-1}(a^{-1}a)a$  Since $a^{-1} \in G$, it has a left inverse; apply it to both ends, and we have $(aa^{-1})a = (a^{-1}a)a$.  As a result, $ae$ = $a(a^{-1}a) = (aa^{-1})a = (a^{-1}a)a = ea$.  For the right inverse, start with $aa^{-1} = a(a^{-1}a)a^{-1} = (aa^{-1})(aa^{-1})$.  Since $\times$ is a binary operation, $aa^{-1} \in G$ and has a left inverse; apply it to both ends, and we have $e = aa^{-1}$.  In second comment following the question in the link, Mr. Derek Holt pointed out that the requester did not word his/her question correctly.  Specifically, the identity in the second axiom is not well-defined.     Let $(G, *)$ be a semi-group. Suppose    1. $ \exists e \in G$ such that $\forall a \in G,\  ae = a$;    2. $\forall a \in G, \exists a^{-1} \in G$ such that $aa^{-1} = e$.    How can we prove that $(G,*)$ is a group?    This formulation makes the same technical error as many textbooks. The $e$ in your second axiom is not well-defined. "But obviously it's intended to be the same $e$ as in the first axiom" you reply. But the first axiom does not necessarily specify a unique element $e$. So should we interpret the second axiom as meaning "for some $e$ as in 1" or "for all $e$ as in 1"? –  Derek Holt Sep 17 '11 at 15:31   Was he saying that if, in axiom 1, we have $ae_1 = a, ae_2 = a$, but $e_1 \neq e_2$,  when we get to axiom 2, do we have $aa^{-1} = e_1, aa^{-1} = e_2$, or two different inverses so that $aa_1^{-1} =  e_1, aa^{-1}_2 = e_2$?  I think my wording eliminated the ambiguity.  It does not imply that $e$ is unique, but if $e$ is a left identity and produces left inverses, then it is also a right identity and produces right inverses. I tried really hard on this one; please kindly point out my mistakes. I have 2-3 different column names that I want to look up in the entire DB and list out all tables which have those columns. Any easy script? Why do objects sometimes fall on their own? I have observed sometimes that when I keep some objects precariously balanced, for e.g. some objects in a cupboard, they seem quite stable at the time when I place them there but after a certain period, maybe even 8 - 12 hours suddenly you hear a noise and you can see that they have fallen for what seems like no apparent reason. What can be the reason for this? obviously, I am looking for a physics explanation and not a supernatural one. How to publish a GML file as a Web Feature Service (WFS)? How did "sinister", the Latin word for "left-handed", get its current meaning? Sinister is the Latin word for left-handed.  What evolution of meaning turned left-handed into evil and threatening? SQL Server FOR XML Enclosing Element? I've seen videos of some folks having several armor sets (4 is the most I've seen so far) standing about on their settlement. I'm wondering if having too many would cause some sets to disappear. They're not like guns/items that you can safely store in settlement crates, the suits kind of just... stand around. (I know there's the extra step of taking out the fusion cores, so that NPC's don't use them.)  Is there a limit to the number of Power Armor sets you can keep? How to activate quota for users on folders? How To Make Clickable Text In Minecraft I am trying to make clickable text in Minecraft in the chat box. It was used in the adventure map, "UP".   The idea is that you are given an option in the text to click, "Yes", or "No". Each word will give an output of a command.  How is this achieved? What is the simplest SQL Query to find the second largest value? How do I print all lines of a file with duplicate values in a certain column Given a file like this:  1,768,12,46576457,7898 1,123,435,134,146 2,345,6756856,12312,1311 5,234,567465,12341,1341 1,3245,4356345,2442,13 9,423,2342,121,463 9,989,342,121,1212   I would like to list all rows (in bash terminal) such that the value in column 1 appears at least twice (in column 1). The result should be  1,768,12,46576457,7898 1,123,435,134,146 1,3245,4356345,2442,13 9,423,2342,121,463 9,989,342,121,1212 Dynamically access object property using variable