{"id":4125,"date":"2014-03-30T07:58:36","date_gmt":"2014-03-30T07:58:36","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/problem-about-auto-collection-of-common-programming-errors\/"},"modified":"2014-03-30T07:58:36","modified_gmt":"2014-03-30T07:58:36","slug":"problem-about-auto-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/problem-about-auto-collection-of-common-programming-errors\/","title":{"rendered":"problem about auto-Collection of common programming errors"},"content":{"rendered":"<ul>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/c9f7f259ce4977682123d233d2d030fe?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nJohnHelp<br \/>\nfancybox size auto<br \/>\nFancyBox V2 &#8211; I&#8217;m stuck when I click the first fancybox link the box loads an incorrect size but when I exist and click the fancy box again it loads right size??It previously autosized correctly as I have multiple fancybox on website but when I open this fancybox to carry through purchase it autosizes incorrectly on first click then correctly on second clickHow do I fix this??(Obviously I have replaced my real PayPal information with madeup information)Code is below:Main Page:-&lt;!DOCTYPE html&amp;<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/678c7ee0f57988f895fe47057eef817c?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nRichard<br \/>\ngit branch message auto<br \/>\nIn general, when I merge a branch from the master branch git automatically generates a commit message like this :Merge branch &#8216;master&#8217; into name-of-my-branchbut last time it generates a commit message like :Merge branch &#8216;master&#8217; of git.domain.com:repo-nameWhat caused this unexpected merge commit message?<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/2c22b4430a4a5cdc313ed0694dccbbfa?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nEmily L.<br \/>\nc++11 standards auto uniform-initialization<br \/>\nConsider this short program compiled with GCC 4.7.2 g++ -std=c++11 test.cc#include &lt;memory&gt; #include &lt;queue&gt;struct type{type(int a) : v(a) {}int v; };typedef std::shared_ptr&lt;type&gt; type_ptr;int main(){int value = 3;std::queue&lt;type_ptr&gt; queue;auto ptr{std::make_shared&lt;type&gt;(value)};queue.push(ptr); }The compiler outputs the following errors:src\/test.cc: In function &#8216;int main()&#8217;: src\/test.cc:15:17: error: no matching function for call to &#8216;std::queue&lt;std::shared_ptr&amp;<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/376b5c51229d1bf892f6ecca1695aae3?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nkfmfe04<br \/>\nc++ reference c++11 copy-constructor auto<br \/>\nI have some complex template code where the copy-constructor of OPC is being called even though I am only creating a reference to OPC (the actual instance is OP_S, which as a child class of OPC, should not result in a copy-construction call).I am using gcc 4.6.1The code is below.#include &lt;stdio.h&gt;class OPC {public:OPC() { }OPC( const OPC&amp; f ) {fprintf( stderr, &#8220;CC called!!!\\n&#8221; );} };template&lt;class T&gt; class SL : public T { };template&lt;class T&gt; class S : public SL&lt;T&gt; { }<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/082b8ee2b0aebb430b8d4d98e6a5c32f?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nFredOverflow<br \/>\nc++ c++11 map foreach auto<br \/>\nI am trying to loop over the entries of a map, and I get unexpected copies. Here is the program:#include &lt;iostream&gt; #include &lt;map&gt; #include &lt;string&gt;struct X {X(){std::cout &lt;&lt; &#8220;default constructor\\n&#8221;;}X(const X&amp;){std::cout &lt;&lt; &#8220;copy constructor\\n&#8221;;} };int main() {std::map&lt;int, X&gt; numbers = {{1, X()}, {2, X()}, {3, X()}};std::cout &lt;&lt; &#8220;STARTING LOOP\\n&#8221;;for (const std::pair&lt;int, X&gt;&amp; p : numbers){}std::cout &lt;&lt; &#8220;ENDING LOOP\\n&#8221;; }And here is<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/acebaaf02be9bbc7319c51af806f9ec2?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nNawaz<br \/>\nc++ lambda c++11 type-inference auto<br \/>\nPossible Duplicate:Recursive lambda functions in c++0x Why can&#8217;t I call a lambda recursively if I write it as:auto a = [&amp;] { static int i = 0; i++;std::cout &lt;&lt; i &lt;&lt; std::endl; if (i&lt;10) a(); \/\/recursive call };It gives compilation error (ideone):prog.cpp:8:18: error: &#8216;((const main()::&lt;lambda()&gt;*)this)-&gt;main()::&lt;lambda()&gt;::a&#8217; cannot be used as a functionprog.cpp: In function &#8216;int main()&#8217;: prog.cpp:9:9: error: variable &#8216;auto a&#8217; with &#8216;auto&#8217; type used in its own in<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/c435948a5669095206a886b92fa3a49a?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\njack lee<br \/>\n.net trace auto<br \/>\nI want to do Performance Monitoring in my project,and i didn&#8217;t want to add trace code in every function.I want to do like(auto trace):public class ManagerBase{public void Trace(){ \/\/trace beginDoSth();\/\/trace end\/\/i want get stacktrace in Manager.DoSth and every method&#8217;s execution time}protected virtual void DoSth(){}}public class Manager : ManagerBase{protected override void DoSth(){Function1();Function2();Function3();}private void Function1() { }private void Function2() { }private void Functio<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/0158efb8eb3c964d6e4336401fde06f8?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nuser2604718<br \/>\nmysql table optimization index auto<br \/>\nI noticed that MySQL automatically performs &#8216;OPTIMIZE TABLE&#8217; on all of the tables. I am not sure why this is happening or how I could prevent it. The operation takes forever because I have a very large table and it locks it, preventing any other operations. If I cancel the optimize process, the table crashes and I have to repair it. This started happening after I wanted to add a FULLTEXT index on that table (but canceled the operation and then repaired the table).I have a standard install of MyS<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/bf487b94c02124fc2526d1dd9e72d413?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nTrevor Hickey<br \/>\nc++ for-loop c++11 segmentation-fault auto<br \/>\n\/\/fills my vector with pointers. \/\/(some are pointing places, others are set to nullptr vector&lt;Tree_NodeT*&gt; xml_trees {Build_Tree_List(program_options-&gt;Get_Files())};\/\/time to print them for (auto tree = xml_trees.begin(); tree != xml_trees.end(); ++tree){if (*tree){(*tree)-&gt;Print(std::cout,4);} } \/\/this worked! No Segfaults!\/\/time to print them again for (auto tree : xml_trees){if (tree){tree-&gt;Print(std::cout,4);} } \/\/Crash! Segfault.Why is the second loop segfaulting, while th<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/26498cfb0fc77c297ec54fb6255c43f0?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nLuben<br \/>\nflash google-chrome restart auto<br \/>\nI am running a huge flash app on a pc. The pc is always on and after about a week chrome crashes(memory leak &#8211; program is too huge to re-code). Is there a way to auto restart it at a specified time everyday?Regards Luben<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/66980d1eac668f75552936922491cd82?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nSamaursa<br \/>\nc++ auto msvc10<br \/>\nI am using Visual Studio 2010 with SP1. The following code crashes the compiler:template &lt;typename T&gt; class MyClass { public:typedef int my_int;const my_int foo();};template &lt;typename T&gt; const auto MyClass&lt;T&gt;::foo() -&gt; my_int \/\/ auto MyClass&lt;T&gt;::foo() -&gt; const my_int \/\/ THIS WORKS! {return my_int(1); }int main() {MyClass&lt;int&gt; m;m.foo(); }Note the commented line that fixes the issue. Am I using auto properly here (i.e. const qualifier on auto)? Is the workaroun<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/49aaba480eb0629ee5a6ba72af5e89ff?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nRichardTowers<br \/>\njquery auto<br \/>\nI&#8217;m trying to create a kind of pc builder however when using drop down lists, it isn&#8217;t updating the price;$(document).ready(function() { var total = 0; \/\/Base pricefunction calcTotal() { $(&#8220;select&#8221;).each(function() { \/\/This happens for each checked input field var cost = $(this).val(); \/\/I beleive the problems are here and&#8230;total += parseInt(cost); \/\/total = total + cost }); } \/\/This happens when the page loads calcTotal(); $(&#8220;form&#8221;).before(&#8216;&lt;p class=&#8221;total&#8221;<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/baf3830e86206495867d74ec08aa73ef?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nuser2581289<br \/>\njavascript replace auto<br \/>\nhow auto Replace Scr if url with .jpg,.png &amp; .js for Ex in my home page have some image link &lt;img src=&#8221;http:\/\/www.lx5.in\/img\/img.png&#8221;\/&gt; its auto convert to &lt;img src=&#8221;http:\/\/www.lx5.in.cdn.com\/img\/img.png&#8221;\/&gt; is it possible use any .js script ? Thanks<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/cdf29eedd4ab8fba38d377cdee48d392?s=128&amp;d=identicon&amp;r=PG\" \/><br \/>\nstaaar<br \/>\nauto<br \/>\nHere I used VS2012 to test explicitly instantiating template function as follows:template &lt;class T&gt; auto function_name(T a) -&gt; decltype(a) {return a; }template int function_name&lt;int&gt;(int);int main() {return 0; }the compliling result is as follows:main.cppe:\\programs\\export\\app\\main.cpp(26): error C2785: &#8220;&#8216;unknown-type&#8217; function_name(T)&#8221;?&#8221;int function_name(int)&#8221;have different return typese:\\programs\\export\\app\\main.cpp(21) : see declaration of &#8220;function_name&#8221;e:\\programs\\export\\app\\<\/li>\n<\/ul>\n<p>Web site is in building<\/p>\n","protected":false},"excerpt":{"rendered":"<p>JohnHelp fancybox size auto FancyBox V2 &#8211; I&#8217;m stuck when I click the first fancybox link the box loads an incorrect size but when I exist and click the fancy box again it loads right size??It previously autosized correctly as I have multiple fancybox on website but when I open this fancybox to carry through [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-4125","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/4125","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=4125"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/4125\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=4125"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=4125"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=4125"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}