I made some code that looks like this:  int foo, bar1 = 4, bar2 = 7;  foo = bar1, bar2; // Look at this expression.  printf("%d", foo);   Compiled it with GCC, with -Wall and -Wextra. The output was 4.  Apart from being ugly, is this expression undefined behaviour, or is foo always set to bar1?
How does the comma operator work in C++?  For instance, if I do:  a = b, c;     Does a end up equaling b or c?   (Yes, I know this is easy to test - just documenting on here for someone to find the answer quickly.)  Update:  This question has exposed a nuance when using the comma operator.  Just to document this:  a = b, c;    // a is set to the value of b!  a = (b, c);  // a is set to the value of c!   This question was actually inspired by a typo in code.  What was intended to be  a = b; c = d;   Turned into  a = b,    //  &lt;-  Note comma typo! c = d;
It's clear to me by inspection that if we fix $\beta = \frac{1-\mu}{\mu} \alpha$ (thereby fixing the mean) and let $\alpha \rightarrow 0$, the Beta distribution approaches a Bernoulli($\mu$) distribution.  For example:  par(mfrow = c(1, 2),     oma = c(0, 0, 1.5, 0)) xx = seq(0, 1, length.out = 1000) mus = c(.2, .7) for (ii in 1:2) {   mu = mus[ii]   matplot(xx, sapply(10^(-1:-5), function(al)      pbeta(xx, al, (1-mu)/mu * al)),     type = 'l', lty = ii,     main = paste('Mean:', mu),     ylab = 'Cumulative Probability', xlab = 'x') } title('Beta Approaches Bernoulli', outer = TRUE)     That is, if $X \sim B(\alpha, \frac{1-\mu}{\mu} \alpha)$, its CDF $F_X(x; \alpha, \mu)$, satisfies  $$ \lim_{\alpha \rightarrow 0} F_X(x; \alpha, \mu) = 1 - \mu = F_Y(x) \quad \forall x \in (0, 1)$$  Where $Y \sim$ Bernoulli($\mu$), and the convergence is non-uniform. I tried to do a more formal proof of this but couldn't make any progress, even in simple cases (like $\mu = \frac12$). The  makes reference to the $\mu = \frac12$ case several times without proof. Perhaps I'm missing something easy about doing the integral, or some fact about the Beta/incomplete Beta function. Any help would be appreciated! How do I alter a language item link? I am looking to modify the default output of Drupal 8 of links in a certain situation, the language switcher. Ideally I want to be able to do that in a twig template and not have to produce a  that overwwrites that whole link generation system and add a BIG if for the cases I need to overwrite.  I think the output layout should be controllable in the twig template similar to  (this answer outputs the same url for every languages)  I am using bootstrap as a base theme so i'd like to use the bootstrap markup for my links (btn btn-primary, dropdown)  Here is my code I am trying to make links--language-block.html.twig  {%- if links|length == 2 -%}     {# show only alternate language button #}     {%- for key, item in links -%}         {%- if not item.attributes['#options']['set_active_class'] -%} {# &lt;--- this is always true!? #}             &lt;a href="{{ item.link['#url'] }}" class="btn btn-primary"&gt;{{ item.link['#title'] }}&lt;/a&gt; {# #url is always the same what ever the language it is pointing to! #}         {%- endif -%}     {%- endfor -%} {%- elseif links|length &gt; 2  -%}     {# show selected language in button and other languages in drop down #}     &lt;button class="btn btn-primary dropdown-toggle" type="button" data-toggle="dropdown"&gt;{{ selectedLanguage }}&lt;span class="caret"&gt;&lt;/span&gt;&lt;/button&gt;     &lt;ul class="dropdown-menu"&gt;         {% for key, item in links %}             {%- if not item.attributes['#options']['set_active_class'] -%} {# &lt;--- this is always true!? #}             &lt;li&gt;&lt;a href="{{ item.link['#url'] }}"&gt;{{ item.link['#title'] }}&lt;/a&gt;&lt;/li&gt;             {% endif %}         {% endfor %}     &lt;/ul&gt; {%- endif -%}   Anyone has an idea on how to do this? What makes RSA secure by using prime numbers? I am just learning about the RSA algorithm. Looking at the first two steps:   Choose two distinct prime numbers $p$ and $q$. Compute $n = pq$.    I have some probably stupid questions:   Why do $p$ and $q$ have to be prime numbers? Why couldn't they be any integers or odd integers? Or does that break the whole algorithm? Because prime numbers are rare in comparison to regular integers, does restricting the algorithm to only prime numbers reduce security? It would seem easier to find the private key if an attacker knows it's only going to be some prime number? I have a very simple question. When I do this:  \catcode`\@=0 \catcode`\\=11 @mycommand{a} @catcode`@\=0 \catcode`\@=11   It works perfectly and calls \mycommand correctly. However, when I try to define \mycommand with similar trickery:  \newcommand\mycommand[1]{   \catcode`\@=0   \catcode`\\=11   @textbf{Hello #1}   @catcode`@\=0   \catcode`\@=11 }   compilation stalls and gives me the * prompt. If I give it Ctrl+D, it terminates without producing any output. Indeed, it seems that changing the catcodes inside a command has no effect whatsoever, because the following works perfectly (whereas, from my understanding, it shouldn't):  \newcommand\mycommand[1]{   \catcode`\@=0   \catcode`\\=11   \textbf{Hello #1} }   Can anybody please explain to me what's happening? I read about Drupal behaviors today, and I tried writing the following code.  (function ($) {    Drupal.behaviors.mymodule = {     attach: function (context, settings) {       $('#mymodule_id', context).change(function () {         alert('Handler for .change() called.');       });     }   };  }(jQuery));    Is Drupal.behaviors.mymodule the namespace? What are the context and settings parameters passed to the Drupal behavior? Is this the equivalent of document.ready()?   Can I attach any number of functions?  Can I define JavaScript functions which will be called somewhere? Does Java have buffer overflows? I'm running into this weird problem with Google spreadsheets: if the cells have comments on them and I sort the spreadsheet, the rows sort but the comments stay in the same position, and don't move with the cells they're attached to.  In other words, the cells look like this:  A C  &lt;-- comment on this cell B   and then I sort by this column:  A B  &lt;-- comment remains on this cell (stays in position) C  &lt;-- comment should have remained attached to this cell   This means that sorting is completely broken and I can't use it at all, because I clearly need the cell comments to stay with the cell they're attached to.  Is this a bad bug in Google Spreadsheets, or am I missing something here? How do I set up a shipping condition that accesses the value of a specific field in product? I have a term reference field in product called "Weight" with values "Light", "Medium" &amp; "heavy". I am using flat rate shipping service and trying to check the value of "Weight" field in Calculation rules.I know that I need to expose it by using "entity has field" but I end up having  commerce-line-item:order:commerce-line-items:0 commerce-line-item:order:commerce-line-items:1 commerce-line-item:order:commerce-line-items:2 commerce-line-item:order:commerce-line-items:3 commerce-line-item:order:commerce-line-items:0... commerce-line-item:order:commerce-line-items:1... commerce-line-item:order:commerce-line-items:2... commerce-line-item:order:commerce-line-items:3...    I was able to get to the weight field by using any of them and then did a Data Comparison  commerce-line-item:order:commerce-line-items:0:commerce-product:field-product-weight   this condition worked ok first time but not after that. can anyone please help me on this or if you think of another solution please let me know. Thanks Determining "level" of an NPC ally for purpose of budgeting encounter XP How to rename objects with python? I want to rename the number 1->picture (32) with python not the number 2->picture with the (3745), can someone help me with that ? Setting up a bicycle for someone with restricted knee articulation My father, now in his 70's, had a left knee replacement several years ago. He has limited movement in that knee - probably about 85 degrees on a good day. His knee can extend fully, but cannot bend as much as it should. As a result, he cannot pedal a bike he cannot get his left leg over the top of the pedal stroke.   He is desperate to get back onto a bike, he knows he won't be ripping up the road and winning races like the old days, but wants the freedom to go for a slow easy rides.    Does anyone have suggestions as to a solution to the problem. We don't mind spending money if we know the solution will work, but he can't afford to throw big money at wild ideas that may or may not work. If we find a solution, a new bike is likely.   We have access several mountain bikes in a range of sizes to trail ideas, and we have all the tools and skills to build bikes up from parts and rearrange things as needed.    EDIT: Thanks everyone - all great suggestions. What am am going to do is got tto the LBS and get hold of a cheap set of short cranks for around $30- probably from a kids bike, in the 120-150 size range, and see if he can ride that. Depending how he goes, I'll try a standard right crank and a short left crank. If all else fails, we will go for the Power Cranks   UPDATE: In case anyone else has similar problems. Got some 152mm cranks for $30. Set an old  mountain bike up with the seat as far back as possible. The old man is able to ride reasonably comfortably, now has a smile from ear to ear - any suggestions how to remove it - doesn't fit with the grumpy old man image :)   Has got me wondering how many people with minor knee problems would benefit from short(er) cranks....... How can I find the files that were stored on my flash drive before I installed Ubuntu to it?   Edit: No, I didn't format it, my files are still on the flash drive root. I just need to know how to access them there. $$\tan(\theta_1+\theta_2+\cdots+\theta_n)=\frac{S_1-S_3+S_5+\cdots}{1-S_2+S_4+\cdots}$$  where  $S_i$ denotes the sum of product of tangent of angles taken $i$ at a time.     For example,$$\tan(\theta_1+\theta_2)=\frac{S_1}{1-S_2}=\frac{\tan\theta_1+\tan\theta_2} {1-\tan\theta_1\tan\theta_2}$$   (This formula is given  in my textbook with no derivation or background)  How to derive this? How to save the render result within Blender Is it possible to render an image and have blender remember it, so that next time I open the file the render result will not be blank?  I am not talking about saving to an external file.  Specifically I would like to render an image, close blender, and come back later and be able to do some compositing on the render without having to waste a half an hour rendering it again (my GPU drivers are messed up so I have to use the CPU).  Currently the render result is blank when ever I open a file. How to typeset asymmetrical confidence level limits / uncertainties? Below is an example of an asymmetrical limit (or uncertainty)  How can I typeset this in a \LaTeX equation? Such pair of numbers should be vertically stacked while being vertically center-aligned with rest of the equation. Solution $X^{+Y}_{-Z}$ What is this weird colon-member (" : ") syntax in the constructor? Why are neural networks becoming deeper, but not wider? In recent years, convolutional neural networks (or perhaps deep neural networks in general) have become deeper and deeper, with state-of-the-art networks going from 7 layers () to 1000 layers ( in the space of 4 years. The reason behind the boost in performance from a deeper network, is that a more complex, non-linear function can be learned. Given sufficient training data, this enables the networks to more easily discriminate between different classes.  However, the trend seems to not have followed with the number of parameters in each layer. For example, the number of feature maps in the convolutional layers, or the number of nodes in the fully-connected layers, has remained roughly the same and is still relatively small in magnitude, despite the large increase in the number of layers. From my intuition though, it would seem that increasing the number of parameters per layer would give each layer a richer source of data from which to learn its non-linear function; but this idea seems to have been overlooked in favour of simply adding more layers, each with a small number of parameters.  So whilst networks have become "deeper", they have not become "wider". Why is this? Is it possible to perform a power analysis for the Kruskal-Wallis and Mann-Whitney U test? If yes, are there any R packages/functions that perform it? How would one throw an unwilling creature? My bugbear barbarian, who can lift about double the weight of a wolf, wanted to throw the wolf at a second wolf. How would we go about doing that given existing rules options? Do MOSFETs have a diode built into them? I have noticed that a MOSFET symbol has a little diode in it (or at least what looks like a diode). Does this mean I do not have to worry about using a diode in a circuit that runs a motor using one? I would have used a diode in order to prevent reverse voltage from turning the motor by hand.