Cyclically sort lists of mixed element types?
How to represent a list as a cycle
Objects vs arrays in Javascript for key/value pairs Why did the first Linux developers choose to implement a non-preemptive kernel? Is it to save synchronization?  As far as I know, Linux was developed in the early '90s, when PCs had a single processor. What advantage does a non-preemptive kernel give in such PCs? Why, however, the advantage is reduced by multi-core processors? Review counts in top-bar and /review don't match So far, I thought that the number shown in the orange box in the top-bar was the number of items available for review. However, when I acually visit /review, the numbers don't match:    Note that top-bar shows 15 items (?) but the queues only add up to 8.  Since I can't think of a reason for this being by design (which, as experience shows, is not a good indicator for "this is not an SE feature) I'm tentatively labelling this a (UI) bug. I was asked this question during an interview for a trading position with a proprietary trading firm. I would very much like to know the answer to this question and the intuition behind it.  Amoeba Question:  A population of amoebas starts with 1. After 1 period that amoeba can divide into 1, 2, 3, or 0 (it can die) with equal probability. What is the probability that the entire population dies out eventually? How to count occurrences of one field grouped by values of another? Black screen when creating movie I've rendered about 300 frames for a short clip. The frames look fine, but when I compile into a movie all I get is a black screen. I haven't been able to find anything to solve this problem. The individual frames are well lit, capture what I want them to, look great. Just creating the AVI or MPEG results in a clip that has nothing but black. In Ubuntu releases prior to Ubuntu 19.10 Eoan Ermine, when I run a command with sudo, that command receives my home directory in the $HOME environment variable. This is the behavior I have long expected and . If I want sudo to reset the $HOME environment variable, so that it refers to the target user's home directory instead of my own, I have to pass the -H option (or -i, though that does more).    ek@Kip:~$ lsb_release -d Description:    Ubuntu 18.04.3 LTS ek@Kip:~$ sudo printenv HOME  # Shows ek's home, not root's. /home/ek ek@Kip:~$ sudo -u as printenv HOME  # Shows ek's home, not as's. /home/ek ek@Kip:~$ sudo -H printenv HOME  # Shows root's home. /root ek@Kip:~$ sudo -Hu as printenv HOME  # Shows as's home. /home/as   When I first upgraded to Ubuntu 19.10, I was surprised to discover that sudo seems to reset $HOME no matter what! I continue to observe this now that 19.10 is released and I've installed updates--both on newly installed systems and one I upgraded to 19.10.  ek@Cord:~$ lsb_release -d Description:    Ubuntu 19.10 ek@Cord:~$ sudo printenv HOME  # Shows root's home, even without -H or -i. /root ek@Cord:~$ sudo -u as printenv HOME  # Shows as's home, even without -H or -i. /home/as ek@Cord:~$ sudo -H printenv HOME  # Also shows root's home. /root ek@Cord:~$ sudo -Hu as printenv HOME  # Also shows as's home. /home/as   I thought this might be due to .  But I checked, and always_set_home does not appear in any Defaults line in my 19.10 /etc/sudoers file.  What makes sudo treat $HOME differently starting in 19.10, and why was this change made? Does this make it safe to use plain sudo in cases where I would previously have used sudo -H? Keeping an updated balance (Accounting) I have been struggling trying to find a way to properly and reliably maintain a balance for accounts in an order/payment system.  Currently, the process consists of three tables. Below example is very simplified but gets the point across.  Table one contains the account ID, name, total paid, total orders, balance etc.  Table two contains payments, date, the account ID (FK) and amount.  Table three contains orders, date, the account ID (FK) and amount.  Calculating the balance is of course as easy as  SELECT SUM(payments.AMOUNT) FROM payments WHERE ID = [account] SELECT SUM(orders.AMOUNT) FROM orders WHERE ID = [account]   Followed by some simple addition/subtraction math:  UPDATE accounts SET BALANCE = [balance] WHERE ID = [account]   All good - the problem is - how do I maintain this over let's assume years of activity and many, many transactions?  Currently the accounts table is updated every single time a transaction is made, meaning the above three statements run every time. There is of course an index on the ID column in all three tables, and everything is fast and neat for now, but I work with less than 100,000 transactions, meaning everything fits into the RAM and basically all I throw at the database gets executed immediately. Over time this will change, of course - so how do I handle this?  Is it better to mark the accounts as "dirty" and process balancing in a batch job later, or can I keep updating the balance real-time even when I reach the point where the orders and payments tables will not fit into the RAM?  Do I need to segment the orders and payments and "lock" everything before a given time, such as before last calculation? (I would rather not). I ask because then I could do a SUM WHERE DATE > [last lock timestamp] and update with UPDATE BALANCE = [balance] + [value for last lock] and prevent the problem from outgrowing resources.  I don't need a running balance for each transaction. That's all I can find results for when I try to research this problem. I just care about the total amount paid, the total amount ordered and the balance of accounts.  Why don't I calculate on the fly when I need the balance, you ask? Because one must be able to query the system and ask "Which of my (let's say) 50.000 accounts have a balance below 0?" - something we cannot do easily if we do not store the balance with every account. Graphics issues after/while installing Ubuntu 16.04/16.10 with NVIDIA graphics I installed or upgraded to Ubuntu 16.04, but I'm having some problems with my graphics card.   The display is blank The display flickers Items on the screen do not display correctly Certain programs complain of graphics issues The computer boots to low-graphics mode Your specific issue may not be here, but try the solutions described in the answers anyway.   This question is very broad, but each one of these issues likely has one solution.    If you are experiencing a login loop, check the last part of my answer.    If you experience one of the listed issues and have your own solution (mine didn't work, or there's a faster way), feel free to post another POLITE answer, describing your problem and how you fixed it.    Those attempting to install Ubuntu, please refer to the section titled: If you are unable to enter a TTY or are trying to install Ubuntu. Adverb between conjugated verb and infinitive? The judicial function in considering and applying statutes is one of interpretation and interpretation alone. The duty of the court in every case is loyally to endeavour to ascer­tain the intention of the legislature; and to ascertain that intention by reading and interpreting the language which the legislature itself has selected for the purpose of expres­sing it.    1. What's this phenomenon called? Is this placement unusual or due to  my English's primitiveness?  2. Why not situate the adverb after 'endeavour', or even split the infinitive 'to endeavour' and wedge it in between?  What are the similarities and differences due to a different position? I've been trying to photograph lightning lately, as we have had some great storms in Colorado. I've had some difficulty getting a good vantage point, however, as almost all of these storms include rain as well. To keep my camera from getting drenched (I have weather-sealed lenses, but my camera body, a Canon 450D, is not weather sealed as far as I can tell), I've had to shoot under the eve of a building or under a thick canopy of trees, however that has greatly limited my ability to adapt to the changing weather and get get a vantage point on the best lightning.  Is there any equipment, something I can purchase or something home-made that has easy-to-find parts, that can help me protect my lens from the rain while still being able to shoot? Additionally, I've been getting rain on a UV filter I have on the front of my lenses, simply to prevent rain from getting on the front lens element itself. However, once a storm really gets going, so does the rain. Is there a simple solution to keep rain off the front of the lens? Windows 10 internet speed capped at half the original speed on new PC calculator's angle answer for trig ratios that can work in more than 1 quadrant on the unit circle Why does the calculator do a cc (counterclockwise) rotation for positive trig ratios instead of clockwise,  and a clockwise rotation for negative sine &amp; tan instead of cc and a counterclockwise rotation for negative cos ratios instead of a clockwise   ie. in degree mode  $\cos^{-1}(-5/12)=114.62$  $\sin^{-1}(-5/12)=-24.62$  $\tan^{-1}(-5/12)=-22.61$  Is it maybe picking the value that involves the least amount of computing power? or is it a matter of convention? or am I overlooking something? Running own executable on Android shell I need a specific command line tool and I have made a C program in my Linux shell. I have compiled the program with an ARM cross-compiler. I have then moved the program into the Android file system and tried to run it.  The output is permission denied.  What do I have to do, in order to run my own compiled programs in Android file system? Handling jQuery Component Collision In plugin development, what is the best practice to prevent jQuery component collision on the front end?  For instance, let's say I include the jQuery Apprise dialog in a plugin that loads this on the front-end for something, yet another plugin may do the same. Because this gets loaded and declared twice, or perhaps one is forked and customized while mine is not, we get Javascript errors on the frontend (I assume).  (Note that I'm doing the best practice of using the wp_register_script() and wp_enqueue_script() strategy via a wp_head() action event in order to load a jQuery component on the frontend.) Get the real width and height of an image with JavaScript? (in Safari/Chrome) I am creating a jQuery plugin.  How do I get the real image width and height with Javascript in Safari?  The following works with Firefox 3, IE7 and Opera 9:  var pic = $("img")  // need to remove these in of case img-element has set width and height pic.removeAttr("width");  pic.removeAttr("height");  var pic_real_width = pic.width(); var pic_real_height = pic.height();   But in Webkit browsers like Safari and Google Chrome values are 0. Why does the Cauchy distribution have no mean? From the distribution density function we could identify a mean (=0) for Cauchy distribution just like the graph below shows. But why do we say Cauchy distribution has no mean? Does Python support short-circuiting? Show that if $n$, $a$, $b$, and $c$ are positive integers with $\gcd(a, b) = 1$ and $ab = c^n$, then there are positive integers $d$, and $e$ such that $a = d^n$ and $b = e^n$.   I know that (by Bezout) $\gcd\left(a,b\right) = 1$ implies $ax + by = 1$ for some integers $x$ and $y$, and also that $\gcd\left(a^n,b^n\right) = 1$, but this does not help me. How to set a letter to the margin of the page and position it vertically according to alphabetical order?