sorting list based on value of key in dictionary items
How do I sort a list of dictionaries by a value of the dictionary?
How to add “jQuery” onclick functionality for a column each row in jQgrid to display different popups for different rows How do I get the number of days between two dates in JavaScript? How do I get the number of days between two dates in JavaScript? For example, given two dates in input boxes:  &lt;input id="first" value="1/1/2000"/&gt; &lt;input id="second" value="1/1/2001"/&gt;  &lt;script&gt;   alert(datediff("day", first, second)); // what goes here? &lt;/script&gt; In Windows I used command-line clipboard copy-and-paste utilities...      pclip.exe and gclip.exe     These were UnixUtils ports for Windows (but they only handled plain text). There were a couple of other native Windows utilities which could write/extract any format.    I've looked for something similar in Synaptic Package Manager, but I can't find anything.    Is there something there, that I've missed? ... or maybe this is available in Bash scripting?    The type of utility I'd like will be able to read/write via std-in/std-out or file-in/file-out, and handle Unicode, Rich Text Format, picture, etc. clipboard formats...    NB: I'm not after a clipboard manager. How can I start automatically a command on Ubuntu 18.04? Does $\sum\limits_{k=1}^n 1 / k ^ 2$ converge when $n\rightarrow\infty$? I can prove this sum has a constant upper bound like this: $$\sum_{k=1}^n \frac1{k ^ 2} \lt 1 + \sum_{k=2}^n \frac 1  {k (k - 1)} = 2 - \frac 1 n \lt 2$$ And computer calculation shows that sum seems to converge to 1.6449.  But I still want to know:  Does this sum converge? Is there a name of this sum (or the series $\frac{1}{k^2} $)? Contains and Custom Label in Rule Criteria - Workflow I have a picklist field-XYZ which contains a lot of values.Lets say (A,b,c,d...z) I am trying to write a rule criteria which will execute if the picklist value is any of the following (A,b,c...p).So instead of mentioning all the values in rule criteria , i created a custom label and put the values (a,b,c,d..p) in that and wrote the following in the rule criteria :   CONTAINS(TEXT(XYZ__c) ,$Label.CustomLabel))   This is not working even is the value of the picklist is equal to the one mentioned in the Custom Label.I guess the CONTAINS function is matching the whole value of custom label with Picklist.Is there other workaround/solution for this? What is the inverse of CoefficientList? How can I simulate a slow machine in a VM? HTML text input allow only numeric input The functions of each pair are inverse to each other. For each pair, check that both compositions give the identity function.  $F: \mathbb{R} \to \mathbb{R}$ and $F^{−1}:\mathbb{R} \to \mathbb{R}$ are defined by $F(x)=3x+2$ and $F^{−1}(y)=\dfrac{y−2}{3}$. for all y ∈ R  My attempt:     Inverse Function  For each particular but arbitrarily chosen $y \in \mathbb{R}$, according to the definition of $f^{-1}$, $f^{-1}(y) = \dfrac{y-2}{3}$ is a unique real number $x$ such that $f(x) = y$. \begin{align*} F(x) &amp; = y\\ 3x + 2 &amp; = y\\ x &amp; = \frac{y-2}{3} \end{align*} Therefore, $f^{-1}(y) = \frac{y-2}{3}$.  Compositions of Functions  The functions $g \circ f$ and $f \circ g$ are defined as follows: $$(g \circ f)(x) = g(f(x)) = g(3x + 2) = 3x + 2$$  for all $x \in \mathbb{Z}$. I've found plenty of posts about changing the visibility of a block programatically.  My problem is the opposite. Given a block's ID/delta, how do I find out if it should be displayed at the current path?  I have a field collection that allows you to append a block using the Block Reference module (I preprocess the field collection and use my own template, so the logic has been taken away from the Block Reference module). It works, but I only want it to kick in if the "Show block on specific pages" rule says that block should be displayed. Custom plugin giving: wp-admin/admin-ajax.php 400 (Bad Request) I am having trouble debugging an issue with a plugin that I'm writing. I want to do an Ajax request when a user changes the option on a select input. The thing is it was fully working as expected yesterday, then when I test the website today (no code changes were made at all since yesterday) I'm getting an:   domain.com/wp-admin/admin-ajax.php 400 (Bad Request)  message in my Chrome console. If I try in Internet Explorer/FireFox it doesn't give the error in console but the Ajax request is still not working.  The plugin I'm creating is on a DigitalOcean droplet which was made using their one click app for WordPress.  Here is the barebones code I'm using on the plugin for the ajax:  //This is in a class' constructor method add_action('wp_enqueue_scripts', array($this, 'plugin_prefix_scripts'));  //PLUGIN_URL is a constant created earlier in the plugin public function plugin_prefix_scripts() { wp_enqueue_script('plugin_prefix_scripts', PLUGIN_URL . 'scripts/frontend_script.js'); wp_localize_script('plugin_prefix_scripts', 'js_object',   array(     'ajax_url' =&gt; admin_url('admin-ajax.php')   ) );   }  frontend_script.js:  $('#plugin-prefix-option-one, #plugin-prefix-option-two').on('change', function() {     var data = {         'action': 'plugin_prefix_page_change',         'option_val': 'some_val',     }      $.post(js_object.ajax_url, data, function(response) {         console.log(response); });   Back in the class:  add_action('wp_ajax_plugin_prefix_page_change', array($this, 'plugin_prefix_page_change'));  public function plugin_prefix_page_change() {     $arr = array(1, 2, 3, 4, 5);      wp_send_json($arr);      //I've also tried wp_die() and no die call at all but same outcome     die(); }   I'm unsure how to debug this further. Any help is much appreciated.  Thanks How this java code produces deadlock? Is there a fast way (without looping over all edges/faces/verts) using ops.mesh or bmesh to get the lists of indices associated with mesh islands as shown below? These islands are part of one mesh but are disjoint from each other.    I know how to select the boundaries by running the operator Select boundary Loop or calling bpy.ops.mesh.region_to_loop() but can't find any API calls to return the vert/edge/face indices associated with the individual islands. How to validate an email address in JavaScript Is there a regular expression to validate an email address in JavaScript? Unable to see anything after importing .obj file Is it a goal if, during kicks from the penalty mark, the ball goes outside the penalty area and then into the goal? The following is an excerpt from Folland's Introduction to Partial Differential Equations:  Let the open set $\Omega\subset{\mathbb R}^n$, and $k$ be a positive integer. $C^k(\Omega)$ will denote the space of functions possessing continuous derivatives up to order $k$ on $\Omega$, and $C^k(\overline{\Omega})$ will denote the space of all $u\in C^k(\Omega)$ such that $\partial^{\alpha}u$ extends continuously to the closure $\overline{\Omega}$ for $0\leq|\alpha|\leq k$.  As I understand, an extension means that there exists $\widetilde{\partial^{\alpha}u}$ which is defined on $\overline{\Omega}$ and $\widetilde{\partial^{\alpha}u}|_{\Omega}=\partial^{\alpha}u$. And "extends continuously" means $\widetilde{\partial^{\alpha}u}$ is continuous with respect to the relative topology on $\overline{\Omega}$.  Here are my questions:        How do people usually do such extension?   When does such extension exist and when does not?   Let $\Omega$ be an open subset of ${\mathbb R}$. Is there any   non-trivial counterexample such that   this kind of extension does not exist? Does there exist a holomorphic function with the following property? I'd like to highlight paragraphs such that the highlight color appears as one whole rectangle underlying the entire paragraph. I have looked around but nothing gives me the desired effect so far.  For example \fcolorbox{} from xcolor cannot highlight an entire paragraph; \hl{} from soul leaves out spacings between lines uncolored.  I am wondering how I can do this?