C++ underflow example? I'm currently taking an introductory C++ class and the professor gave us the following example:  unsigned int TEST = -1; cout &lt;&lt; TEST;   Now, on his machine, TEST is returned as the maximum value for an integer, because he forced underflow. But on my machine, it is returned as 0.  Is this behavior compiler dependent or anything? In other words, why did my machine return 0 but his machine return the maximum?
How do I detect unsigned integer multiply overflow? I was writing a program in C++ to find all solutions of ab = c, where a, b and c together use all the digits 0-9 exactly once. The program looped over values of a and b, and it ran a digit-counting routine each time on a, b and ab to check if the digits condition was satisfied.  However, spurious solutions can be generated when ab overflows the integer limit. I ended up checking for this using code like:  unsigned long b, c, c_test; ... c_test=c*b;         // Possible overflow if (c_test/b != c) {/* There has been an overflow*/} else c=c_test;      // No overflow   Is there a better way of testing for overflow? I know that some chips have an internal flag that is set when overflow occurs, but I've never seen it accessed through C or C++.    Beware that signed int overflow is undefined behaviour in C and C++, and thus you have to detect it without actually causing it. For signed int overflow before addition, see .
Residence has changed - Must I re-apply for ESTA? I have an old, but still valid ESTA, with the country of residence showing my home country. However, I have recently moved for education in the UK. Do I have to apply for a new one?  Nothing else has changed - country of citizenship, passport, names etc How to add http:// if it doesn't exist in the URL Tachyons and Photons Is there a particle called a "tachyon" that can travel faster than light?  If so, would Einstein's relativity be wrong?  According to Einstein no particle can travel faster than light. How can I display site logo, name and slogan? Sometimes it is convenient to refer to a group of equations by a letter and a number.  For example:   2+1   (A1) 2+4   (A2) x^4   (B3) x^e   (B4)   Placing  \tag{A\theequation}\label{eqn:thisone}\stepcounter{equation}} instead of just \label{eqn:thisone} works, but seems hacky (especially manually stepping the counter).   Is there a better way? The latex file coding is not there but the pdf file is there I wrote all my coding in the .tex file. The next day when I opened it the coding is all gone and the pdf file is opening with it and is displayed as an output. How do I bring back my coding? Which equals operator (== vs ===) should be used in JavaScript comparisons? Fibonacci addition law $F_{n+m} = F_{n-1}F_m + F_n F_{m+1}$ Is it possible to perform a complete reinstall on an Android smartphone? I occasionally perform such a reinstall on my Windows PC. I repartition my hard drive, format the partitions, and then install Windows on a blank partition. Can this be done on an Android smartphone? (I have an unlocked Sony Xperia S.) Polygamma function series: $\sum_{k=1}^{\infty }\left(\Psi^{(1)}(k)\right)^2$ Applying the , I found: $$S=\displaystyle\sum_{k=1}^{\infty }\left(\Psi^{(1)}(k)\right)^2\lt\dfrac{2}{3}\pi^2$$ where $\Psi^{(1)}(k)$ is the polygamma function. Is it known any sharper bound for the sum $S$? Thanks. Orientation on $\mathbb{CP}^2$ I want to add additional items to the data returned as . So for every function/query that returns a WP_Post object I want my additional data added.  Example of returned result:  WP_Post (object) =&gt; [     // Default data returned by WP_Post     ID                  =&gt; int,     post_author         =&gt; string,     post_name           =&gt; string,     post_type           =&gt; string,     post_title          =&gt; string,     post_date           =&gt; string,     post_date_gmt       =&gt; string,     post_content        =&gt; string,     post_excerpt        =&gt; string,     post_status         =&gt; string,     comment_status      =&gt; string,     ping_status         =&gt; string,     post_password       =&gt; string,     post_parent         =&gt; int,     post_modified       =&gt; string,     post_modified_gmt   =&gt; string,     comment_count       =&gt; string,     menu_order          =&gt; string,      // Additional data I want to add     extra_data_1        =&gt; array,     more_data_key       =&gt; string,     another_added       =&gt; string ]   For example when the functions  or  are run they will return the WP_Post object along with my additional data.  I've tried finding the appropriate  but this has been unsuccessful.  I am hoping I can do something like:  // This is concept code add_action('pre_wp_post_return', function($data) {     $data-&gt;extra_data_1     = get_post_meta($data-&gt;ID, 'extra_data');     $data-&gt;more_data_key    = get_post_meta($data-&gt;ID, 'more_data', true);     $data-&gt;another_added    = get_post_meta($data-&gt;ID, 'another_data', true);      return $data; });   My reasoning is I am having to build a custom API for WP that uses a range of different core functions which return WP_Post objects. Being able to add my additional data in one place would prevent me from duplicating code.  I hope this is clear enough. Any help would be great! WPF TextBox and Scroll behavior I have a problem. I need to host grid with controls in ScrollViewer to prevent textbox from being either truncated or collapsed to zero-with at the UI. Also I want the with of textbox to be expanded when user change windows width. I'm setting Window's content to following code  &lt;DockPanel&gt;     &lt;TreeView DockPanel.Dock="Left" Width="150"/&gt;     &lt;ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto"&gt;         &lt;Grid&gt;             &lt;Grid.ColumnDefinitions&gt;                 &lt;ColumnDefinition Width="Auto"/&gt;                 &lt;ColumnDefinition /&gt;             &lt;/Grid.ColumnDefinitions&gt;             &lt;Grid.RowDefinitions&gt;                 &lt;RowDefinition Height="Auto"/&gt;             &lt;/Grid.RowDefinitions&gt;             &lt;TextBlock Text="Name"                         Margin="5"                         VerticalAlignment="Center"/&gt;             &lt;TextBox Grid.Column="1"                      Text="Some Name"                      Margin="5"                      VerticalAlignment="Center"                      MinWidth="200"/&gt;         &lt;/Grid&gt;     &lt;/ScrollViewer&gt; &lt;/DockPanel&gt;   All work fine, but when user types very long text in TextBox it is being expanded and horizontal scroll appears. Is there any easy way to limit TextBox maximum width and allow it to be expanded only when user changes window size. My connection was fine until now, but my wired connection is not working in Ubuntu 12.04.  I have installed Ubuntu 12.04 along side Windows 7 partition and the connection works on Windows but not on Ubuntu 12.04. I have no problem with wireless connection as well.  The problem is specific to the wired connection on Ubuntu 12.04. I have included a few details below.  ifconfig  eth0      Link encap:Ethernet  HWaddr 00:1e:ec:8d:f0:03             inet6 addr: fe80::21e:ecff:fe8d:f003/64 Scope:Link           UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1           RX packets:1 errors:0 dropped:0 overruns:0 frame:0           TX packets:376 errors:0 dropped:0 overruns:0 carrier:0           collisions:0 txqueuelen:1000            RX bytes:316 (316.0 B)  TX bytes:33769 (33.7 KB)           Interrupt:19   eth2      Link encap:Ethernet  HWaddr 00:21:00:4e:ac:58             inet6 addr: fe80::221:ff:fe4e:ac58/64 Scope:Link           UP BROADCAST MULTICAST  MTU:1500  Metric:1           RX packets:1660 errors:0 dropped:0 overruns:0 frame:28           TX packets:1846 errors:61 dropped:0 overruns:0 carrier:0           collisions:0 txqueuelen:1000            RX bytes:1372676 (1.3 MB)  TX bytes:254576 (254.5 KB)           Interrupt:18   lo        Link encap:Local Loopback             inet addr:127.0.0.1  Mask:255.0.0.0           inet6 addr: ::1/128 Scope:Host           UP LOOPBACK RUNNING  MTU:16436  Metric:1           RX packets:1862 errors:0 dropped:0 overruns:0 frame:0           TX packets:1862 errors:0 dropped:0 overruns:0 carrier:0           collisions:0 txqueuelen:0            RX bytes:155767 (155.7 KB)  TX bytes:155767 (155.7 KB)     sudo lshw -C network    *-network                       description: Wireless interface        product: BCM4312 802.11b/g LP-PHY        vendor: Broadcom Corporation        physical id: 0        bus info: pci@0000:03:00.0        logical name: eth2        version: 01        serial: 00:21:00:4e:ac:58        width: 64 bits        clock: 33MHz        capabilities: pm msi pciexpress bus_master cap_list ethernet physical wireless        configuration: broadcast=yes driver=wl0 driverversion=5.100.82.38 ip=10.0.0.3 latency=0 multicast=yes wireless=IEEE 802.11bg        resources: irq:18 memory:99700000-99703fff    *-network        description: Ethernet interface        product: RTL8101E/RTL8102E PCI Express Fast Ethernet controller        vendor: Realtek Semiconductor Co., Ltd.        physical id: 0        bus info: pci@0000:04:00.0        logical name: eth0        version: 02        serial: 00:1e:ec:8d:f0:03        size: 100Mbit/s        capacity: 100Mbit/s        width: 64 bits        clock: 33MHz        capabilities: pm msi pciexpress msix vpd bus_master cap_list rom ethernet physical tp mii 10bt 10bt-fd 100bt 100bt-fd autonegotiation        configuration: autonegotiation=on broadcast=yes driver=r8169 driverversion=2.3LK-NAPI duplex=full firmware=N/A latency=0 link=yes multicast=yes port=MII speed=100Mbit/s        resources: irq:19 ioport:3000(size=256) memory:93410000-93410fff memory:93400000-9340ffff memory:93420000-9343ffff How do I transfer a file to my server using PuTTY? Regex to get string between curly braces Unfortunately, despite having tried to learn regex at least one time a year for as many years as I can remember, I always forget as I use them so infrequently. This year my new year's resolution is to not try and learn regex again - So this year to save me from tears I'll give it to Stack Overflow. (Last Christmas remix).  I want to pass in a string in this format {getThis}, and be returned the string getThis. Could anyone be of assistance in helping to stick to my new year's resolution?    Related questions on Stack Overflow: I found it in an old dictionary and I'm not sure what it means. It looks like the number &quot;3&quot;, but the top of the three has been flattened(and slightly curved). I've only seen this in three or four words. [] Do we need a global test before post hoc tests? I often hear that post hoc tests after an ANOVA can only be used if the ANOVA itself was significant.    However, post hoc tests adjust $p$-values to keep the global type I error rate at 5%, don't they?  So why do we need the global test first?  If we don't need a global test is the terminology "post hoc" correct? Or are there multiple kinds of post hoc tests, some assuming a significant global test result and others without that assumption? A smooth vector field on $S^2$ vanishing at a single point I need to find a vector field as described in the title.  I was given a couple hints, and this is what I have so far. Let $\varphi:S^2\setminus\{N\}\to\mathbb{R}^2$ be stereographic projection ($N$ is the north pole). Let $Y$ be a smooth, non-zero vector field on $\mathbb{R}^2$ that dies off to $0$ "at infinity." Since $\varphi$ is a diffeomorphism, we can push $Y$ forward along $\varphi^{-1}$ to get a smooth vector field $(\varphi^{-1})_*Y_{\varphi(p)}$ on $S^2$. But this vector field is not zero at the north pole... it's undefined. So can I just define my vector field on $S^2$, call it Z, to be the pushforward of $Y$ (as above) away from $N$ but $0$ at $N$? And if so, do we still have smoothness? delay JQuery effects I want to fade out an element and all its child elements after a delay of a few seconds. but I haven't found a way to specify that an effect should start after a specified time delay.