Trouble with geometric proof of gravitational force inside a sphere
Gravitational field intensity inside a hollow sphere
Changing Posts Per Page and offset with pre_get_posts I have a filter using pre_get_posts to change the number of posts per page from 4 on the news landing page to 8 on all other pages (page 2, 3, etc). However I don't seem to have got the offset correct, or something, because my get_next_posts_page_link doesn't show a page 3, even though it does exist if I go to the url manually. The current offset is something I somehow managed to conjure up accidentally, I thought it worked as page 2 was correct but as I added more test posts, I realised it didn't work.  function page_2_posts_per_page_filter( $query ) {      $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;      if ( !is_admin() &amp;&amp; $query-&gt;is_paged &amp;&amp; $query-&gt;is_main_query() ) {          $offset = 4 + (($paged - 2) * 8);         $query-&gt;set( 'offset', $offset );         $query-&gt;set( 'posts_per_page', 8 );      } else if (!is_admin() &amp;&amp; $query-&gt;is_main_query()) {          $query-&gt;set( 'posts_per_page', 4 );      }     return; } add_action( 'pre_get_posts', 'page_2_posts_per_page_filter', 1 );   EDIT: SOLUTION  function page_2_posts_per_page_filter( $query ) {      $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;     $offset = 4;      if ( !is_admin() &amp;&amp; $query-&gt;is_paged &amp;&amp; $query-&gt;is_main_query() ) {          $offset = (($paged - 1) * 8) - $offset;         $query-&gt;set( 'posts_per_page', 8 );         $query-&gt;set( 'offset', $offset );      } else if (!is_admin() &amp;&amp; $query-&gt;is_main_query()) {          $query-&gt;set( 'posts_per_page', 4 );      }     return; } add_action( 'pre_get_posts', 'page_2_posts_per_page_filter');  function found_offset( $found_posts, $query ) {      $offset = 4;      if( !is_admin() &amp;&amp; $query-&gt;is_main_query() ) {         $found_posts = $found_posts + $offset;     }     return $found_posts; } add_action( 'found_posts', 'found_offset', 10, 2 ); Finding an example of a discrete-time strict local martingale. Should I let potential employers know I have a job offer? I've interviewed for a few positions, one of which has made me an offer.  I'm very pleased with the offer, but I prefer some of the other positions.  I have the luxury of being able to take a lot of time to decide whether or not I accept this offer, so I'm certain I will hear back (either positively or negatively) from the other positions before a decision is required for the offer I've received.  I'm trying to decide between two courses of action, and I want to choose the one that will best help my candidacy with the positions I've yet to hear from.  Plan 1 is to do nothing and simply wait to hear back from the other positions for which I've already interviewed.  Plan 2 is to be in touch with the other positions to let them know I have an offer, and ask where I stand with them.  Would Plan 2 make me a more desirable candidate with the other positions, as they might see my offer as further validation of my credentials?  Or, might initiating with the interviewers in this way be detrimental to my candidacy, perhaps making me seem pushy or self-centered?  If so, I would rather just wait for them to run their course of action (Plan 1).  As I've said, I have plenty of time, so I don't want impatience to hurt me.  If there is a good chance that my meddling will be detrimental, then I'd rather be hands-off here.  However, if it's more likely that informing the other interviewers of my offer will give me a boost, then I'd want to do so.  Thanks for any clarity you can provide!  Edit: For a bit more information and context, the position I've been offered is a non-academic research position that my advisor has described as "prestigious."  The other positions for which I've interviewed (and which I prefer) are mostly academic teaching-centered positions (visiting assistant professors, tenure-track at smaller four year institutions). I have 2 equation in terms of $a,b$ and $c$ .  $3a + 10b + 5c =0$ and $4a + 6b + 2c =0$  I need to find a:b:c and answer is $\dfrac a5 = \dfrac {b}{-7} = \dfrac {c}{11}$  I want to know how to get that?  My attempt:  Given equations can be written in form   $$\left ( \begin{matrix}           3 &amp; 10 &amp; 5 \\           4 &amp; 6 &amp;  2 \\           \end{matrix} \right )  \left ( \begin{matrix}           a\\         b\\         c\\         \end{matrix} \right ) =  \left ( \begin{matrix}            0 \\          0\\         \end{matrix} \right ) $$  But here I don't have any idea how to proceed. I can do for 3×3 matrix and I thought it can be done in same way.  Thanks. A Riemann integrable function must have infinitely many points of continuity Why can't you add attributes to object in python? Is a business card necessary for a graduate student? I know some PhD students have their own business cards, but I don't know if it is a standard practice for PhD students to have their own business cards. I think a business card can be useful for networking in conference or collaborating with some industrial partners. So, is are business cards necessary for a PhD student or other graduate students attending conferences?   PS: in case it is field-specific, I would like to know the different practices in different fields What is the best way to convert an array to a hash in Ruby In Ruby, given an array in one of the following forms...  [apple, 1, banana, 2] [[apple, 1], [banana, 2]]   ...what is the best way to convert this into a hash in the form of...  {apple =&gt; 1, banana =&gt; 2} @track vs @api (Lightning Web Components) Let's say we have this code for a LWC:  &lt;!-- helloExpressions.html --&gt; &lt;template&gt;     &lt;div class="slds-m-around_medium"&gt;         &lt;lightning-input name='firstName' label="First Name" onchange={handleChange}&gt;&lt;/lightning-input&gt;         &lt;lightning-input name='lastName' label="Last Name" onchange={handleChange}&gt;&lt;/lightning-input&gt;         &lt;p class="slds-m-top_medium"&gt;Uppercased Full Name: {uppercasedFullName}&lt;/p&gt;     &lt;/div&gt; &lt;/template&gt;   and this is the JS file:  // helloExpressions.js import { LightningElement, track } from 'lwc';  export default class HelloExpressions extends LightningElement {     @track firstName = '';     @track lastName = '';      handleChange(event) {         const field = event.target.name;         if (field === 'firstName') {             this.firstName = event.target.value;         } else if (field === 'lastName') {             this.lastName = event.target.value;         }     }      get uppercasedFullName() {         return `${this.firstName} ${this.lastName}`.toUpperCase();     } }   firstName and lastName have been decorated with @track. Now as per the documentation, decorating a property with @track makes it private and reactive, while to mark a property public and reactive, use @api.  So if I just change the decorator to @api for both these variables, it should work. I am referring these from the same component only. But it's not working.  UPDATE: 27th Feb -------------------- Somehow it's working today. I just changed the decorator of the variables to api.  import { LightningElement, api } from 'lwc';  export default class HelloExpressions extends LightningElement {     @api firstName = '';     @api lastName = '';      handleChange(event) {         const field = event.target.name;         if (field === 'firstName') {             this.firstName = event.target.value;         } else if (field === 'lastName') {             this.lastName = event.target.value;         }     }      get uppercasedFullName() {         return `${this.firstName} ${this.lastName}`.toUpperCase();     } }   So it's working. How are embedded quotations used? How would embedded quotations be used when quoting from passages/sources within an essay? What would be the difference between normal quotations and embedded quotations? According to the , you can harden a MySQL server by adding passwords, or removing the anonymous accounts.      If you want to prevent clients from connecting as anonymous users   without a password, you should either assign a password to each   anonymous account or else remove the accounts.   Before hardening, my users table looked like this.   mysql&gt; select user,host,password from mysql.user; +------------------+-----------+-------------------------------------------+ | user             | host      | password                                  | +------------------+-----------+-------------------------------------------+ | root             | localhost | *F3A2A51A9B0F2BE246XXXXXXXXXXXXXXXXXXXXXX | | root             | gitlab    |                                           | | root             | 127.0.0.1 |                                           | | root             | ::1       |                                           | |                  | localhost |                                           | |                  | gitlab    |                                           | | debian-sys-maint | localhost | *95C1BF709B26A5BAXXXXXXXXXXXXXXXXXXXXXXXX | | myuser           | localhost | *6C8989366EAF75BB6XXXXXXXXXXXXXXXXXXXXXXX | +------------------+-----------+-------------------------------------------+   I've remove all anonymous accounts, so that the user table now looks like this.  (I'm using puppet to manage the users, but puppet effectively performs a DROP USER command).   mysql&gt; select user,host,password from mysql.user; +------------------+-----------+-------------------------------------------+ | user             | host      | password                                  | +------------------+-----------+-------------------------------------------+ | root             | localhost | *F3A2A51A9B0F2BE246XXXXXXXXXXXXXXXXXXXXXX | | debian-sys-maint | localhost | *95C1BF709B26A5BAXXXXXXXXXXXXXXXXXXXXXXXX | | myuser           | localhost | *6C8989366EAF75BB6XXXXXXXXXXXXXXXXXXXXXXX | +------------------+-----------+-------------------------------------------+   Why is it that I am still able to login to my test system without a username or a password? What do I need to do to prevent any unwanted users from logging in?   root@gitlab:~# mysql Welcome to the MySQL monitor.  Commands end with ; or \g. Your MySQL connection id is 98 Server version: 5.5.32-0ubuntu0.12.04.1 (Ubuntu) .... mysql&gt;    Update:  I've also just discovered that I can login as root, without entering a password.  Update2: I found  which has some good information, but does not solve the issue.   There are no anonymous users.  mysql&gt; select user,host,password from mysql.user where user=''; Empty set (0.00 sec)   I login as root@localhost.  mysql&gt; select USER(),CURRENT_USER(); +----------------+----------------+ | USER()         | CURRENT_USER() | +----------------+----------------+ | root@localhost | root@localhost | +----------------+----------------+    I do not have a default password, or skip-grant-tables defined in my.cnf  root@gitlab:~# cat /etc/mysql/my.cnf |grep -i 'skip-grant-tables'|wc -l 0 root@gitlab:~# cat /etc/mysql/my.cnf |grep -i 'pass'|wc -l 0   Update3:  I have tried performing these steps with puppet, (which should perform a flush privileges automatically). I have also manually flushed privileges and also tried restarting mysql.   Update4: I've also tried changing the mysql root password and flushed privileges. No luck, I can still log in as any user without a password. How to integrate $ \int x^n e^x dx$? An inequality involving 4 real or complex numbers What are the differences between "=" and "<-" assignment operators in R? In my experience, input type="text" onchange event usually occurs only after you leave (blur) the control.  Is there a way to force browser to trigger onchange every time textfield content changes? If not, what is the most elegant way to track this “manually”?  Using onkey* events is not reliable, since you can right-click the field and choose Paste, and this will change the field without any keyboard input.  Is setTimeout the only way?.. Ugly :-) How to find an ellipse , given 2 passing points and the tangents at them? Please answer to a question , how to find an ellipse which passes the 2 given points and has the given tangents at them. And one related question is that the given condition can decide just one ellipse which satisfies it?  Thank you in advance.  Edit : May be , I can say the first answer (by Mr. André Nicolas) is for the general case. Is there no special case where only a finite set of ellipses satisfies the condition?  Edit : According to the answers and comments , I can compute an arbitrary chosen ellipse for my condition (using the method by Mr.Patrick Da Silva). But there are possibly many others which satisfy my conditions. Am I right? Downgrade Windows 7 Ultimate to Home Premium without a clean install Currently I've got an installation of Windows 7 Ultimate x64. I would like to downgrade to Windows 7 Home Premium x64 without a clean install. I've got a (legal) retail disc and tried the following tricks:        Still the Windows setup keeps telling me I can't upgrade because I've got a higher version installed (Ultimate). The trick seems dead. Does anyone know a way to change from Ultimate to Home Premium without the hassle of a clean install? Find a quadratic equation with root $x_1^2$ and $x_2^2$ I'm struggling to solve this problem:  "If the equation $ax^2 + bx +c$ $(a \neq 0)$ admits real and not null roots of $x_1$ and $x_2$, obtain the equation which evaluates to roots $(x_1)^2$ and $(x_2)^2$"  I know the answer is $a^2x^2 -(b^2 - 2ac)x + c^2$ but I am not able to get to this answer, I was trying to derive it from the sum and product equations $S=-b/a$ and $P=c/a$ but the answer I'm getting to is a monstruous different thing.  Could someone explain to me how to get to this answer?  Thanks Paucity of words for relationships Please refer the following questions asked elsewhere on this site:       I am a native Hindi speaker; Hindi has a plethora of terms referring to relationships. To take a trivial example, the term uncle may refer to father's elder brother, father's younger brother, mother's brothers, father's sister's husband, mother's sister's husband, all of which have specific addresses in Hindi.  I discussed the same with one of my teachers. She had the opinion that the development of language mirrors the cultural moorings of the society that uses the language. Now, since all of the above relationships have distinct status and reverence in the Hindi speaking society, that calls for different addresses. That may well not be the case in English speaking societies.  Is that correct? What other linguistic reasons may account for such a dearth of vocabulary in English in this area? Is AES in CBC mode secure if a known and/or fixed IV is used? I have a need to encrypt credentials for a third-party app used by a secured internal app. Over on ITSec.SE, I was helpfully shown a scheme to encrypt the third-party credentials based on a hash of the credentials for the internal app.   I picked AES as the encryption algorithm, but the problem is that the password-based scheme doesn't produce a "secret" IV. So, the IV must at least be known to an attacker (stored alongside the encrypted data). A hash value used for password verification could work, or I could just generate a pseudorandom byte array and drop it in the DB as a new column. I was further considering, for simplicity, to use a constant IV.   What adverse effect will either of these choices have on the security of the encryption? Does AES depend, as many block ciphers do, on an unpredictable IV? Does it matter if the IV is stored as unencrypted plaintext?