I'm less than a year into C++ development (focused on other languages prior to this) and I'm looking at a guy's code who's been doing this for two decades. I've never seen this syntax before and hopefully someone can be of some help.   bool b; // There exists a Boolean variable. int i;  // There exists an integer variable.  sscanf(value, "%d", &amp;i); // The int is assigned from a scan. b = (i != 0); // I have never seen this syntax before.   I get that the boolean is being assigned from the int that was just scanned, but I don't get the (* != 0) aspects of what's going on. Could someone explain why this person who knows the language much better than I is doing syntax like this?
This question attempts to collect the few pearls among the dozens of bad C++ books that are published every year. Unlike many other programming languages, which are often picked up on the go from tutorials found on the Internet, few are able to quickly pick up C++ without studying a well-written C++ book. It is way too big and complex for doing this. In fact, it is so big and complex, that there are very many very bad C++ books out there. And we are not talking about bad style, but things like sporting glaringly obvious factual errors and promoting abysmally bad programming styles. Please edit the accepted answer to provide quality books and an approximate skill level — preferably after discussing your addition in . (The regulars might mercilessly undo your work if they disagree with a recommendation.) Add a short blurb/description about each book that you have personally read/benefited from. Feel free to debate quality, headings, etc. Books that meet the criteria will be added to the list.  Books that have reviews by the Association of C and C++ Users (ACCU) have links to the review. *Note: FAQs and other resources can be found in the  and under .
QGtkStyle was unable to detect the current GTK+ theme When I start any Qt app, I get this message in the terminal, and the Qt app doesn't use the same theme as my Gtk apps:  QGtkStyle was unable to detect the current GTK+ theme.   How do I make QGtkStyle detect my current GTK+ theme?  It seems that LXDE is using a settings daemon, and there is no gtkrc-2.0 file in my home folder. "By" vs "Per". Which one should I use on expressions like "P&L/Geography" or "VaR/Asset"? In the finance field, it is quite common to express some measures in relation to some grouping criteria. Some groupings can be temporal (year, month, etc.) and others like greography, asset class (e.g. a financial product), strategy (used in trading), and others.   Which one is the most appropriate preposition to apply in this kind of expression ?    "VaR per asset" or "VaR by asset" "P&amp;L per strategy" or "P&amp;L by strategy".   Is there any well defined rule behind the most appropriate use ? How do I tell what version and edition of Windows is on the filesystem? Prove that $T(n) = T(n/3) + T2n/3) + 5n$ is $O(n log n)$ When constructing the matrices for the two CNOT based on the target and control qubit, I can use reasoning:  "If $q_0$==$|0\rangle$, everything simply passes through", resulting in an Identity matrix style $\begin{bmatrix}1&amp;0\\0&amp;1\end{bmatrix}$ in the top left. "If $q_0==|1\rangle$, we need to let $q_0$ pass and swap $q_1$, resulting in a Pauli X $\begin{bmatrix}0&amp;1\\1&amp;0\end{bmatrix}$ in the bottom right.  $CNOT \equiv \begin{bmatrix}1&amp;0&amp;0&amp;0\\0&amp;1&amp;0&amp;0\\0&amp;0&amp;0&amp;1\\0&amp;0&amp;1&amp;0\end{bmatrix}$  "If $q_1$==$|0\rangle$, everything simply passes through", results in leaving $|00\rangle$ and $|10\rangle$ unaffected. "If $q_1==|1\rangle$, we need to let $q_1$ pass and swap $q_0$, mapping $|01\rangle$ to $|11\rangle$ and  $|11\rangle$ to $|01\rangle$  $CNOT \equiv \begin{bmatrix}1&amp;0&amp;0&amp;0\\0&amp;0&amp;0&amp;1\\0&amp;0&amp;1&amp;0\\0&amp;1&amp;0&amp;0\end{bmatrix}$  This all seems to check out, but here comes my question: I would like to know if there is a more mathematical way to express this, just as there would be when combining for instance two hadamard gates: $H \otimes H \equiv \frac{1}{\sqrt{2}}\begin{bmatrix}1&amp;1\\1&amp;-1\\ \end{bmatrix} \otimes \frac{1}{\sqrt{2}}\begin{bmatrix}1&amp;1\\1&amp;-1\\ \end{bmatrix} = \frac{1}{2}\begin{bmatrix}1&amp;1&amp;1&amp;1\\1&amp;-1&amp;1&amp;-1\\1&amp;1&amp;-1&amp;-1\\1&amp;-1&amp;-1&amp;1 \end{bmatrix}$  And a bonus question:  How I can, using notation like "CNOT", show which qubit is the control bit and which qubit the target bit? Is the harmonic oscillator potential unique in having equally spaced discrete energy levels? How To Represent 0.1 In Floating Point Arithmetic And Decimal "had they known" or "if they had known" Can this:     These same officials, however, would have been appalled had they known what was going on behind this façade of self-help.   be rephrased as     These same officials, however, would have been appalled if they had known what was going on behind this façade of self-help.   ? Science fiction short story: beam transporting people into the distant future How to diagnose a search engine ranking drop? Why is Dictionary preferred over Hashtable in C#? In most programming languages, dictionaries are preferred over hashtables. What are the reasons behind that? 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 ); Regular expression: match start or whitespace How can gravity affect light? I'm looking for an idiom or saying that I could use when people are focusing too much on small details and not seeing the big picture.  A couple that come to mind are "being penny-wise and pound foolish" and "rearranging deck chairs on the Titanic". However, the former doesn't fit what I'm thinking of because the present activity might not be wise. The latter implies too much about impending doom.  For example, let's say some company is spending all their time refining a small detail in their product, while ignoring a major opportunity shift in the industry. What phrase could I use there? Does the 90 days VWP rule expire if you travel from the US to Canada? I'm on a New Zealand passport.  From most US Embassy webpages:     The Visa Waiver Program (VWP) enables nationals of certain countries,   including Australia, New Zealand, and the U.K., to travel to the   United States for tourism or business for stays of 90 days or less   without obtaining a visa, if certain requirements are met. Under the   VWP, time spent in Canada, Mexico, and adjacent islands counts towards   the maximum of 90 days stay allowed under the program.   I'll be there on a 1-year working holiday visa starting when I arrive in Vancouver. I'm spending 3 days in Hawaii en route to Vancouver. This seems to imply that 90 days after landing in Hawaii, my time will be up and I won't be able to get back into the US, as my living in Canada will not reset the clock. What if after this time I want to say, pop across the border to Seattle? How can I restart the 90 days, without having to resort to say, flying to Japan and back just to reset it? How to send data to a serial port and see any answer? On Linux, I want to send a command string (i.e. some data) to a serial port (containing control characters), and listen to the response (which also usually might contain control characters).   How can I do this as simplest as possible on Linux? An example is appreciated! Mounting filesystem with special user id set Is verifying ISOs downloaded from the official website worthwhile? I downloaded the ISO from , selecting the default "Ubuntu Desktop" option.  The website links the page  which gives instructions how to verify ubuntu.  This seems pretty tedious, and I am wondering how realistic it is that there is a problem with ISO downloaded from the official website. I note that the process of verification itself requires me to download software that is new to me, thus introducing another attack vector on me even as I am closing another one.  For what it's worth, I am planning to use Live USB only and not to fully install Ubuntu. Does that make a difference? Sorry for the title, its hard to put the problem into proper words.  Basically, in Firefox or Chrome, I try to navigate to stackoverflow.com.  The request fails and the URL I see in the navigation bar is:  http://d2e24t2jgcnor2.webhostoid.com/Secure/Error?URL=http%3A%2F%2Fstackoverflow.com%2F&amp;ResponseCode=504&amp;user_id=5b5033d3-3543-4b7c-9844-055afde93841&amp;uc=20140915&amp;subid=20140915&amp;source=browsersafeguard-rockettab-spigot&amp;version=1.0.5370.12627&amp;implementation_id=browsersafeguard-rockettab-spigot%20&amp;block_host=False&amp;reg=False&amp;redirectms=True   This looks shady and my internet seems slower lately. I have a few questions:   Why is my request going through this strange URL? Do the query parameters reveal my identity? How can I stop this?   I use my cell phone’s 3G network and tether it to my laptop.