better tangenttoarc

better tangenttoarc

--- sketchsolve/src/solve.cpp
+++ sketchsolve/src/solve.cpp
@@ -685,42 +685,17 @@
                 if(cons[i].type==tangentToArc)
                 {

-                        double dx,dy,Rpx,Rpy,RpxN,RpyN,hyp,error1,error2,rad;
-/*                        dx = L1_P2_x - L1_P1_x;
-                        dy = L1_P2_y - L1_P1_y;
-
-                        //hyp=sqrt(dx*dx+dy*dy);
-
-                        double u = (A1_Center_x - L1_P1_x) * (L1_P2_x - L1_P1_x) + (A1_Center_y - L1_P1_y) * (L1_P2_y - L1_P1_y);
-                        u/=dx*dx+dy*dy;
-
-                        double x = L1_P1_x + u *(L1_P2_x - L1_P1_x);
-                        double y = L1_P1_y + u *(L1_P2_y - L1_P1_y);
-
-                        double dcsx = A1_Center_x - A1_Start_x;
-                        double dcsy = A1_Center_y - A1_Start_y;
-                        double dcex = A1_Center_x - A1_End_x;
-                        double dcey = A1_Center_y - A1_End_y;
-                //        rad=(dcsx*dcsx + dcsy * dcsy);
-                //      rad+=(dcex*dcex + dcey * dcey)/4;
-
-                        double dcx = A1_Center_x-x;
-                        double dcy = A1_Center_y-y;
-                        temp = (dcx * dcx + dcy * dcy) - A1_radius * A1_radius;
-                        error += temp*temp*100;
-
-*/
-//#if defined(NEWARC)
+                        double dx,dy;
                         dx = L1_P2_x - L1_P1_x;
                         dy = L1_P2_y - L1_P1_y;

                         double Xint,Yint,radsq;
-                        radsq = (A1_Center_x-A1_Start_x)*(A1_Center_x-A1_Start_x)+(A1_Center_y-A1_Start_y)*(A1_Center_y-A1_Start_y);
+                        radsq = A1_radius * A1_radius;
                         t=-(L1_P1_x*dx-A1_Center_x*dx+L1_P1_y*dy-A1_Center_y*dy)/(dx*dx+dy*dy);
                         Xint=L1_P1_x+dx*t;
                         Yint=L1_P1_y+dy*t;
-                        temp= (A1_Center_x - Xint)*(A1_Center_x - Xint)+(A1_Center_y - Yint)*(A1_Center_y - Yint) - radsq;
+                        temp= sqrt((A1_Center_x - Xint)*(A1_Center_x - Xint)+(A1_Center_y - Yint)*(A1_Center_y - Yint)) - sqrt(radsq);
                         error += temp*temp;
                 }


Reduce considerably the cubemap sizes on sky, to better match GLES3, fixes #21551

--- drivers/gles2/rasterizer_storage_gles2.cpp
+++ drivers/gles2/rasterizer_storage_gles2.cpp
@@ -965,7 +965,7 @@
 	// attachements for it, so we can fill them by issuing draw calls.
 	GLuint tmp_fb;

-	int size = p_radiance_size;
+	int size = p_radiance_size / 4; //divide by four because its a cubemap (this is an approximation because GLES3 uses a dual paraboloid)

 	int lod = 0;


Fix get_data layer argument when texture is TEXTURE_TYPE_2D_ARRAY

--- drivers/gles3/rasterizer_storage_gles3.cpp
+++ drivers/gles3/rasterizer_storage_gles3.cpp
@@ -1144,8 +1144,12 @@
 			shaders.copy.set_conditional(CopyShaderGLES3::USE_TEXTURE2DARRAY, texture->type == VS::TEXTURE_TYPE_2D_ARRAY);
 			shaders.copy.bind();

-			// calculate the normalized z coordinate for the layer
-			float layer = (float)p_layer / (float)texture->alloc_depth;
+			float layer;
+			if (texture->type == VS::TEXTURE_TYPE_2D_ARRAY)
+				layer = (float)p_layer;
+			else
+				// calculate the normalized z coordinate for the layer
+				layer = (float)p_layer / (float)texture->alloc_depth;

 			shaders.copy.set_uniform(CopyShaderGLES3::LAYER, layer);


Minor improve to assertion (#3295)

Minor improve to assertion (#3295)

--- nnvm/src/core/graph.cc
+++ nnvm/src/core/graph.cc
@@ -107,7 +107,7 @@
       for (const auto& nptr : n->control_deps) {
         if (!nptr->is_variable() && is_ghost.get(nptr->op(), false)) continue;
         auto it = node2index_.find(nptr.get());
-        CHECK(it != node2index_.end() && it->first == nptr.get());
+        CHECK(it != node2index_.end()) << "control dep not found in graph";
         control_deps_.push_back(it->second);
       }
       control_rptr.push_back(control_deps_.size());


Update send/receive button text when unit context changes

--- src/qt/bitcoingui.cpp
+++ src/qt/bitcoingui.cpp
@@ -381,6 +381,13 @@
         // nubit: set current base unit
         BitcoinUnits::baseUnit = walletModel->getUnit();

+		//update the send and receive button text to display the proper unit (NuShares/NuBits)
+		receiveCoinsAction->setText(tr("&Receive %1").arg(BitcoinUnits::baseName()));
+		receiveCoinsAction->setToolTip(tr("Show the list of addresses for receiving %1").arg(BitcoinUnits::baseName()));
+
+		sendCoinsAction->setText(tr("&Send %1").arg(BitcoinUnits::baseName()));
+		sendCoinsAction->setToolTip(tr("Send coins to a %1 address").arg(BitcoinUnits::baseName()));
+
         // Report errors from wallet thread
         connect(walletModel, SIGNAL(error(QString,QString,bool)), this, SLOT(error(QString,QString,bool)));


Fix GUI bug when there is 0 network weight.

--- src/qt/bitcoingui.cpp
+++ src/qt/bitcoingui.cpp
@@ -1242,20 +1242,25 @@
         uint64_t nNetworkWeight = GetPoSKernelPS();

         uint64_t chanceToStake;
-        uint64_t diff;
-
-        chanceToStake = (nWeight * 10000) / nNetworkWeight;
-
-        for (uint64_t i=0; i<30; i++ )
+        if (nNetworkWeight > 0)
         {
-             diff = 10000 - chanceToStake;
-             chanceToStake += (nWeight * diff) / nNetworkWeight;
+            uint64_t diff;
+
+            chanceToStake = (nWeight * 10000) / nNetworkWeight;
+
+            for (uint64_t i=0; i<30; i++ )
+            {
+                diff = 10000 - chanceToStake;
+                chanceToStake += (nWeight * diff) / nNetworkWeight;
+            }
+
+            chanceToStake = chanceToStake / 100;
+
+            if (chanceToStake > 100)
+                chanceToStake = 100;
+        } else {
+            chanceToStake = 100;
         }
-
-        chanceToStake = chanceToStake / 100;
-
-        if (chanceToStake > 100)
-            chanceToStake = 100;

         labelStakingIcon->setPixmap(QIcon(":/icons/staking_on").pixmap(STATUSBAR_ICONSIZE,STATUSBAR_ICONSIZE));
         labelStakingIcon->setToolTip(tr("Staking.
Your weight is: %1
Network weight is: %2
Chance to stake within an hour: %3\%").arg(nWeight).arg(nNetworkWeight).arg(chanceToStake));


Missed moving the entry with the current offset

--- src/PE/Parser.cpp
+++ src/PE/Parser.cpp
@@ -172,7 +172,7 @@

     const uint32_t numberof_entries = (relocation_headers->BlockSize - sizeof(pe_base_relocation_block)) / sizeof(uint16_t);
     const uint16_t* entries = reinterpret_cast<const uint16_t*>(
-        this->stream_->read(offset + sizeof(pe_base_relocation_block), relocation_headers->BlockSize - sizeof(pe_base_relocation_block)));
+        this->stream_->read(current_offset + sizeof(pe_base_relocation_block), relocation_headers->BlockSize - sizeof(pe_base_relocation_block)));
     for (size_t i = 0; i < numberof_entries; ++i) {
       relocation.entries_.emplace_back(entries[i]);
     }


else statt return in BefehlVerarbeiten-Funktion
Wenn der Befehlsparameter leer ist, wird auch nur der Befehl der nicht gefunden wurde ausgegeben (kein Leerzeichen)

git-svn-id: 8d3f453d47e2d101802c47149790c6969eab0d00@201 ab522a7c-5096-11dc-afc5-cb66f0b61238

--- src/zentrale.cpp
+++ src/zentrale.cpp
@@ -329,14 +329,14 @@
                 zgr_fenster[i]->Destroy();
             }
         }
-        return;
+
     }

     else if(befehl_name.Upper() == _T("JOIN") && befehl_parameter != _T(""))
     {
         irc->send_join(befehl_parameter.mb_str());
         // Auf eigenen JOIN Warten und dann neues Fenster aufmachen
-        return;
+
     }

     else if(befehl_name.Upper() == _T("PART") || befehl_name.Upper() == _T("LEAVE"))
@@ -349,7 +349,7 @@
         {
             irc->send_part(befehl_parameter.mb_str());
         }
-        return;
+
     }

     else if(befehl_name.Upper() == _T("NICK") && befehl_parameter != _T(""))
@@ -357,7 +357,7 @@
             irc->send_nick(befehl_parameter.mb_str()); // Nickname senden
             irc->WantedNick = befehl_parameter;
             // gewollten Nickname speichern, damit die nickinuse-Funktion richtig reagieren kann.
-            return;
+
     }

     else if(befehl_name.Upper() == _T("INVITE") && befehl_parameter != _T(""))
@@ -371,7 +371,7 @@
         }

         wxGetApp().irc->send_invite(nickname.mb_str(), raum.mb_str());
-        return;
+
     }

     else if(befehl_name.Upper() == _T("ME") && befehl_parameter != _T(""))
@@ -380,7 +380,7 @@
         wxString me_text = _T("\001ACTION ") + befehl_parameter + _T("\001");
         irc->send_privmsg(fenstername[fensternummer].mb_str(), me_text.mb_str());
         zgr_fenster[fensternummer]->NachrichtAnhaengen(_T("ACTION"), irc->CurrentNick, befehl_parameter);
-        return;
+
     }

     else if(befehl_name.Upper() == _T("TOPIC"))
@@ -393,7 +393,7 @@
         {
             irc->send_topic(fenstername[fensternummer].mb_str(),befehl_parameter.mb_str());
         }
-        return;
+
     }

     else if((befehl_name.Upper() == _T("QUERY") || befehl_name.Upper() == _T("MSG")) && befehl_parameter != _T(""))
@@ -403,7 +403,7 @@

         irc->send_privmsg(empfaenger.mb_str(),nachricht.mb_str());
         zgr_fenster[fensternummer]->NachrichtAnhaengen(_T("S_P_PRIVMSG"),irc->CurrentNick, empfaenger, nachricht);
-        return;
+
     }

     else if(befehl_name.Upper() == _T("AWAY"))
@@ -417,7 +417,7 @@
             irc->send_away(befehl_parameter.mb_str());
             zgr_fenster[fensternummer]->NachrichtAnhaengen(_T("AWAY"),befehl_parameter);
         }
-        return;
+
     }

     else if(befehl_name.Upper() == _T("CTCP") && befehl_parameter != _T(""))
@@ -428,25 +428,36 @@
         irc->send_privmsg(empfaenger.mb_str(), (_T("\001") + nachricht + _T("\001")).mb_str());

         zgr_fenster[fensternummer]->NachrichtAnhaengen(_T("CTCP"),irc->CurrentNick, empfaenger, nachricht);
-        return;
+
     }

     else if(befehl_name.Upper() == _T("WHOIS") && befehl_parameter != _T(""))
     {
         irc->send_whois(befehl_parameter.mb_str());
-        return;
+
     }

     // sonstige Befehle
     else if(befehl_name.Upper() == _T("CLEAR"))
     {
         zgr_fenster[fensternummer]->AusgabefeldLeeren();
-        return;
+
     }

-    // Bis hierher kommt das Programm nur wenn keine Uebereinstummung gefunden wurde (wenn eine gefunden wurde kommt ja return).
+    // Wenn der Befehl nicht gefunden wurde oder zu wenig parameter uebergeben wurden
+    else
+    {
+        if(befehl_parameter == _T(""))
+        {
+            zgr_fenster[fensternummer]->Fehler(4,befehl_name);
+        }
+        else
+        {
+            zgr_fenster[fensternummer]->Fehler(4,befehl_name + _T(" ") + befehl_parameter);
+        }
+    }

-    zgr_fenster[fensternummer]->Fehler(4,befehl_name + _T(" ") + befehl_parameter);
+
 }

 void Zentrale::NachrichtSenden(int fensternummer, wxString nachricht)


change discord api url to discord.com

change discord api url to discord.com

--- sleepy_discord/client.cpp
+++ sleepy_discord/client.cpp
@@ -83,7 +83,7 @@
 		{	//the { is used so that onResponse is called after session is removed to make debugging performance issues easier
 			//request starts here
 			Session session;
-			session.setUrl("https://discordapp.com/api/v6/" + path.url());
+			session.setUrl("https://discord.com/api/v6/" + path.url());
 			std::vector<HeaderPair> header = {
 				{ "Authorization", bot ? "Bot " + getToken() : getToken() },
 				{ "User-Agent", userAgent },


--accuracy for other graphing modes

--accuracy for other graphing modes

--- src/runtime/petabricksruntime.cpp
+++ src/runtime/petabricksruntime.cpp
@@ -475,8 +475,14 @@
   for(int n=GRAPH_MIN; n<=GRAPH_MAX; n=_incN(n)){
     setSize(n);
     double avg = runTrial(GRAPH_MAX_SEC, ACCTRAIN);
-    if(avg<std::numeric_limits<double>::max())
-      printf("%d %.6f\n", _randSize, avg);
+    if(avg<std::numeric_limits<double>::max()){
+      if(theAccuracies.empty()){
+        printf("%d %.6f\n", n, avg);
+      }else{
+        printf("%d %.6f %.6f\n", n, avg, _mean(theAccuracies));
+        theAccuracies.clear();
+      }
+    }
     fflush(stdout);
     if(avg > GRAPH_MAX_SEC) break;
   }
@@ -503,8 +509,14 @@
   for(int n=GRAPH_MIN; n<=GRAPH_MAX; n=_incN(n)){
     tunable->setValue(n);
     double avg = runTrial(GRAPH_MAX_SEC, ACCTRAIN);
-    if(avg<std::numeric_limits<double>::max())
-      printf("%d %.6lf\n", n, avg);
+    if(avg<std::numeric_limits<double>::max()){
+      if(theAccuracies.empty()){
+        printf("%d %.6f\n", n, avg);
+      }else{
+        printf("%d %.6f %.6f\n", n, avg, _mean(theAccuracies));
+        theAccuracies.clear();
+      }
+    }
     fflush(stdout);
     if(avg > GRAPH_MAX_SEC) break;
   }


Added conditional detachment from parent in BaseAction::Cleanup

--- src/PimAction.cpp
+++ src/PimAction.cpp
@@ -101,7 +101,9 @@

 			queue->ActivateNext();
 		} else {
-			GetParent()->RemoveChild(this);
+			if (GetParent()) {
+				GetParent()->RemoveChild(this);
+			}
 		}
 	}


structs.cc

structs.cc

--- src/structs/structs.cc
+++ src/structs/structs.cc
@@ -25,6 +25,18 @@
     set_vec(w, 1.0, 2.0);
     cout << "Original 2 vector after modification:" << endl;
     print_vec(w);
+
+    cout << "-----Operator+ Vec3 test-----" << endl;
+    cout << "Original 3 vector:" << endl;
+    print_vec(vprime);
+    cout << "The sum of two vprimes is:" << endl;
+    print_vec(vprime + vprime);
+
+    cout << "-----Operator+ Vec2 test-----" << endl;
+    cout << "Original 2 vector:" << endl;
+    print_vec(w);
+    cout << "The sum of two vprimes is:" << endl;
+    print_vec(w + w);

     return 0;
 }
@@ -57,3 +69,19 @@
 }

 //TODO : Implement overloaded + operators
+Vec3 operator+(const Vec3& a, const Vec3& b)
+{
+    Vec3 sum3;
+    sum3.x = a.x + b.x;
+    sum3.y = a.y + b.y;
+    sum3.z = a.z + b.z;
+    return sum3;
+}
+
+Vec2 operator+(const Vec2& c, const Vec2& d)
+{
+    Vec2 sum2;
+    sum2.x = c.x + d.x;
+    sum2.y = c.y + d.y;
+    return sum2;
+}


Add wallet menu

Add wallet menu

--- src/qt/tekcoingui.cpp
+++ src/qt/tekcoingui.cpp
@@ -305,11 +305,12 @@
     file->addAction(quitAction);

     QMenu *settings = appMenuBar->addMenu(tr("&Settings"));
-    settings->addAction(encryptWalletAction);
-	settings->addAction(unlockWalletAction); //presstab
-    settings->addAction(changePassphraseAction);
-    settings->addSeparator();
     settings->addAction(optionsAction);
+
+	QMenu *wallet = appMenuBar->addMenu(tr("&Wallet"));
+    wallet->addAction(encryptWalletAction);
+	wallet->addAction(unlockWalletAction); //presstab
+    wallet->addAction(changePassphraseAction);

     QMenu *help = appMenuBar->addMenu(tr("&Help"));
     help->addAction(openRPCConsoleAction);


compression - new direct connection handling & surrounding logic

--- rnnlmlib.cpp
+++ rnnlmlib.cpp
@@ -22,6 +22,7 @@
         int j,i;
         } n;
 } d2i;
+#define NUMCENTS (1<<ncluster)

 #define EXP_A (1048576/M_LN2)
 #define EXP_C 60801
@@ -365,9 +366,9 @@
 	exit(1);
     }

-    syn_d=(direct_t *)calloc((long long)direct_size, sizeof(direct_t));
-
-    if (syn_d==NULL) {
+    if (filetype != COMPRESSED) syn_d=(direct_t *)calloc((long long)direct_size, sizeof(direct_t));
+
+    if ((syn_d==NULL)&&(filetype!=COMPRESSED)) {
 	fprintf(stderr,"Memory allocation for direct connections failed (requested %lld bytes)\n", (long long)direct_size * (long long)sizeof(direct_t));
 	exit(1);
     }
@@ -432,7 +433,7 @@
     }

     long long aa;
-    for (aa=0; aa<direct_size; aa++) syn_d[aa]=0;
+    if (syn_d) for (aa=0; aa<direct_size; aa++) syn_d[aa]=0;

     if (bptt>0) {
 	bptt_history=(int *)calloc((bptt+bptt_block+10), sizeof(int));
@@ -1315,7 +1316,10 @@

 	for (a=vocab_size; a<layer2_size; a++) {
 	    for (b=0; b<direct_order; b++) if (hash[b]) {
-		neu2[a].ac+=syn_d[hash[b]];		//apply current parameter and move to the next one
+                if (filetype==COMPRESSED)
+                  neu2[a].ac+=centroid[READ_SYNCD(hash[b])]; // use compressed direct connections
+                else
+                  neu2[a].ac+=syn_d[hash[b]];           //apply current parameter and move to the next one
 		hash[b]++;
 	    } else break;
 	}
@@ -1367,7 +1371,10 @@
 	    a=class_words[vocab[word].class_index][c];

 	    for (b=0; b<direct_order; b++) if (hash[b]) {
-		neu2[a].ac+=syn_d[hash[b]];
+                if (filetype==COMPRESSED)
+                  neu2[a].ac+=centroid[READ_SYNCD(hash[b])];
+                else
+                  neu2[a].ac+=syn_d[hash[b]];
 		hash[b]++;
 		hash[b]=hash[b]%direct_size;
 	    } else break;
@@ -1834,6 +1841,61 @@
     }
 }

+
+double CRnnLM::testNetKMean()
+{
+    int a, word, last_word, wordcn;
+    FILE *fi=fopen(test_file, "rb");
+    double logp, log_combine, log_other,prob_other;
+
+    last_word=0;                                        //last word = end of sentence
+    logp=0;
+    log_other=0;
+    log_combine=0;
+    prob_other=0;
+    wordcn=0;
+
+    copyHiddenLayerToInput();
+
+    if (bptt>0) for (a=0; a<bptt+bptt_block; a++) bptt_history[a]=0;
+    for (a=0; a<MAX_NGRAM_ORDER; a++) history[a]=0;
+    netReset();
+
+    while (1) {
+
+        word=readWordIndex(fi);         //read next word
+        computeNet(last_word, word);            //compute probability distribution
+        if (feof(fi)) break;            //end of file: report LOGP, PPL
+
+        if ((word!=-1) || (prob_other>0)) {
+            if (word==-1) {
+                logp+=-8;               //some ad hoc penalty - when mixing different vocabularies, single model score is not real PPL
+                log_combine+=log10(0 * lambda + prob_other*(1-lambda));
+            } else {
+                logp+=log10(neu2[vocab[word].class_index+vocab_size].ac * neu2[word].ac);
+                log_combine+=log10(neu2[vocab[word].class_index+vocab_size].ac * neu2[word].ac*lambda + prob_other*(1-lambda));
+            }
+            log_other+=log10(prob_other);
+            wordcn++;
+        }
+
+        copyHiddenLayerToInput();
+
+        if (last_word!=-1) neu0[last_word].ac=0;  //delete previous activation
+
+        last_word=word;
+
+        for (a=MAX_NGRAM_ORDER-1; a>0; a--) history[a]=history[a-1];
+        history[0]=last_word;
+
+        if (independent && (word==0)) netReset();
+    }
+    fclose(fi);
+
+    return exp10(-logp/(real)wordcn);
+}
+
+
 void CRnnLM::testNet()
 {
     int a, b, word, last_word, wordcn;
@@ -1959,6 +2021,136 @@

     fclose(flog);
 }
+
+/*
+double CRnnLM::testNetKMean()
+{
+    int a, b, word, last_word, wordcn;
+    FILE *fi, *flog, *lmprob=NULL;
+    real prob_other, log_other, log_combine;
+    double d;
+
+//    restoreNet();
+
+    if (use_lmprob) {
+	lmprob=fopen(lmprob_file, "rb");
+    }
+
+    //TEST PHASE
+    //netFlush();
+
+    fi=fopen(test_file, "rb");
+    //sprintf(str, "%s.%s.output.txt", rnnlm_file, test_file);
+    //flog=fopen(str, "wb");
+    flog=stdout;
+
+    if (debug_mode>1)	{
+	if (use_lmprob) {
+    	    fprintf(flog, "Index   P(NET)          P(LM)           Word\n");
+    	    fprintf(flog, "--------------------------------------------------\n");
+	} else {
+    	    fprintf(flog, "Index   P(NET)          Word\n");
+    	    fprintf(flog, "----------------------------------\n");
+	}
+    }
+
+    last_word=0;					//last word = end of sentence
+    logp=0;
+    log_other=0;
+    log_combine=0;
+    prob_other=0;
+    wordcn=0;
+    copyHiddenLayerToInput();
+
+    if (bptt>0) for (a=0; a<bptt+bptt_block; a++) bptt_history[a]=0;
+    for (a=0; a<MAX_NGRAM_ORDER; a++) history[a]=0;
+    netReset();
+
+    while (1) {
+
+        word=readWordIndex(fi);		//read next word
+        computeNet(last_word, word);		//compute probability distribution
+        if (feof(fi)) break;		//end of file: report LOGP, PPL
+
+        if (use_lmprob) {
+            fscanf(lmprob, "%lf", &d);
+    	    prob_other=d;
+
+            goToDelimiter('\n', lmprob);
+        }
+
+        if ((word!=-1) || (prob_other>0)) {
+    	    if (word==-1) {
+    		logp+=-8;		//some ad hoc penalty - when mixing different vocabularies, single model score is not real PPL
+        	log_combine+=log10(0 * lambda + prob_other*(1-lambda));
+    	    } else {
+    		logp+=log10(neu2[vocab[word].class_index+vocab_size].ac * neu2[word].ac);
+        	log_combine+=log10(neu2[vocab[word].class_index+vocab_size].ac * neu2[word].ac*lambda + prob_other*(1-lambda));
+    	    }
+    	    log_other+=log10(prob_other);
+            wordcn++;
+        }
+
+	if (debug_mode>1) {
+    	    if (use_lmprob) {
+        	if (word!=-1) fprintf(flog, "%d\t%.10f\t%.10f\t%s", word, neu2[vocab[word].class_index+vocab_size].ac *neu2[word].ac, prob_other, vocab[word].word);
+        	else fprintf(flog, "-1\t0\t\t0\t\tOOV");
+    	    } else {
+        	if (word!=-1) fprintf(flog, "%d\t%.10f\t%s", word, neu2[vocab[word].class_index+vocab_size].ac *neu2[word].ac, vocab[word].word);
+        	else fprintf(flog, "-1\t0\t\tOOV");
+    	    }
+
+    	    fprintf(flog, "\n");
+    	}
+
+        if (dynamic>0) {
+            if (bptt>0) {
+                for (a=bptt+bptt_block-1; a>0; a--) bptt_history[a]=bptt_history[a-1];
+                bptt_history[0]=last_word;
+
+                for (a=bptt+bptt_block-1; a>0; a--) for (b=0; b<layer1_size; b++) {
+                    bptt_hidden[a*layer1_size+b].ac=bptt_hidden[(a-1)*layer1_size+b].ac;
+                    bptt_hidden[a*layer1_size+b].er=bptt_hidden[(a-1)*layer1_size+b].er;
+        	}
+            }
+            //
+            alpha=dynamic;
+    	    learnNet(last_word, word);    //dynamic update
+    	}
+        copyHiddenLayerToInput();
+
+        if (last_word!=-1) neu0[last_word].ac=0;  //delete previous activation
+
+        last_word=word;
+
+        for (a=MAX_NGRAM_ORDER-1; a>0; a--) history[a]=history[a-1];
+        history[0]=last_word;
+
+	if (independent && (word==0)) netReset();
+    }
+    fclose(fi);
+    if (use_lmprob) fclose(lmprob);
+
+    //write to log file
+    if (debug_mode>0) {
+	fprintf(flog, "\ntest log probability: %f\n", logp);
+	if (use_lmprob) {
+    	    fprintf(flog, "test log probability given by other lm: %f\n", log_other);
+    	    fprintf(flog, "test log probability %f*rnn + %f*other_lm: %f\n", lambda, 1-lambda, log_combine);
+	}
+
+	fprintf(flog, "\nPPL net: %f\n", exp10(-logp/(real)wordcn));
+	if (use_lmprob) {
+    	    fprintf(flog, "PPL other: %f\n", exp10(-log_other/(real)wordcn));
+    	    fprintf(flog, "PPL combine: %f\n", exp10(-log_combine/(real)wordcn));
+	}
+    }
+
+    fclose(flog);
+    return exp10(-logp/(real)wordcn);
+}
+*/
+

 void CRnnLM::testNbest()
 {


createProperty accepts Python values, not nix::Value

Can also take list of values

--- src/PySection.cpp
+++ src/PySection.cpp
@@ -36,25 +36,66 @@
 }

 // Property
-
-Property createProperty(Section& sec, const std::string& name, PyObject* obj) {
-    extract<DataType> ext_type(obj);
-    if (ext_type.check()) {
-        return sec.createProperty(name, ext_type());
+Property createProperty(Section& sec, const std::string& name, list& valuelist) {
+    std::vector<Value> nixvaluelist;
+    for (int idx = 0; idx < len(valuelist); ++idx) {
+        nixvaluelist.push_back(Value(object(valuelist[idx])));
     }
-
-    extract<Value&> ext_val(obj);
-    if (ext_val.check()) {
-        return sec.createProperty(name, ext_val());
+    return sec.createProperty(name, nixvaluelist);
+}
+
+Property createProperty(Section& sec, const std::string& name, PyObject* value) {
+
+    Value nixvalue;
+
+    if (PyBool_Check(value)) {
+        bool conv = extract<bool>(value);
+        nixvalue = Value(conv);
+#if PY_MAJOR_VERSION >= 3
+    } else if (PyLong_Check(value)) {
+#else
+    } else if (PyInt_Check(value)) {
+#endif
+        int64_t conv = extract<int64_t>(value);
+        nixvalue = Value(conv);
+    } else if (PyFloat_Check(value)) {
+        double conv = extract<double>(value);
+        nixvalue = Value(conv);
+#if PY_MAJOR_VERSION >= 3
+    } else if (PyUnicode_Check(value)) {
+#else
+    } else if (PyString_Check(value)) {
+#endif
+        std::string conv = extract<std::string>(value);
+        nixvalue = Value(conv);
+    } else {
+        throw std::runtime_error("Wrong type");
     }

-    extract<std::vector<Value>> ext_vec(obj);
-    if (ext_vec.check()) {
-        return sec.createProperty(name, ext_vec());
-    }
-
-    throw new std::runtime_error("Second parameter must be a Value, list of Value or DataType");
-}
+    return sec.createProperty(name, nixvalue);
+}
+
+Property (*createPropertyValue)(Section&, const std::string&, PyObject*) = createProperty;
+Property (*createPropertyList)(Section&, const std::string&, boost::python::list&) = createProperty;
+
+//Property createProperty(Section& sec, const std::string& name, PyObject* obj) {
+//    extract<DataType> ext_type(obj);
+//    if (ext_type.check()) {
+//        return sec.createProperty(name, ext_type());
+//    }
+//
+//    extract<Value&> ext_val(obj);
+//    if (ext_val.check()) {
+//        return sec.createProperty(name, ext_val());
+//    }
+//
+//    extract<std::vector<Value>> ext_vec(obj);
+//    if (ext_vec.check()) {
+//        return sec.createProperty(name, ext_vec());
+//    }
+//
+//    throw new std::runtime_error("Second parameter must be a Value, list of Value or DataType");
+//}

 boost::optional<Property> getPropertyById(const Section& section, const std::string& id) {
     Property prop = section.getProperty(id);
@@ -140,7 +181,8 @@
         .def("_get_section_by_pos", &getSectionByPos)
         .def("_delete_section_by_id", REMOVER(std::string, nix::Section, deleteSection))
         // Property
-        .def("_create_property", createProperty)
+        .def("_create_property", createPropertyValue)
+        .def("_create_property", createPropertyList)
         .def("has_property_by_name", hasPropertyByName,
              doc::section_has_property_by_name)
         .def("get_property_by_name", getPropertyByName,


*** empty log message ***

*** empty log message ***

--- api/cfg.cpp
+++ api/cfg.cpp
@@ -1872,7 +1872,7 @@
       else if ( strLevel.compare( OLDCFG_VAL_FILTER_EVT_TYPE ) == 0 )
       {
         filter->setEventTypeFunction( strFunction );
-        if ( strFunction == "All" )
+        if ( strFunction == "All" || strFunction == "None" )
           someEventsExist = true;
       }
       else if ( strLevel.compare( OLDCFG_VAL_FILTER_EVT_VALUE ) == 0 )


Detect corrupted chunks and reset the parser

--- src/reader_struct.cpp
+++ src/reader_struct.cpp
@@ -73,10 +73,18 @@
 #ifdef LCF_DEBUG_TRACE
 			printf("0x%02x (size: %d, pos: 0x%x): %s\n", chunk_info.ID, chunk_info.length, stream.Tell(), it->second->name);
 #endif
+			const auto off = stream.Tell();
 			it->second->ReadLcf(obj, stream, chunk_info.length);
-		}
-		else
+			const auto bytes_read = stream.Tell() - off;
+			if (bytes_read != chunk_info.length) {
+				fprintf(stderr, "Warning: Corrupted Chunk 0x%02x (size: %d, pos: 0x%x): %s : Read %d bytes! Reseting...\n",
+						chunk_info.ID, chunk_info.length, off, it->second->name, bytes_read);
+				stream.Seek(off + chunk_info.length);
+			}
+		}
+		else {
 			stream.Skip(chunk_info);
+		}
 	}
 }


add like to the list of case insensitive limited predicates

--- src/realm/unicode.hpp
+++ src/realm/unicode.hpp
@@ -82,7 +82,7 @@
 size_t sequence_length(char lead);

 // Limitations for case insensitive string search
-// Case insensitive search (equal, begins_with, ends_with and contains)
+// Case insensitive search (equal, begins_with, ends_with, like and contains)
 // only works for unicodes 0...0x7f which is the same as the 0...127
 // ASCII character set (letters a-z and A-Z).


`parse_svg_value` - add DPI template parameter (default 90) (#3233)

--- src/svg/svg_parser.cpp
+++ src/svg/svg_parser.cpp
@@ -134,7 +134,7 @@
 }

 // https://www.w3.org/TR/SVG/coords.html#Units
-template <typename T>
+template <typename T, int DPI = 90>
 double parse_svg_value(T & error_messages, const char* str, bool & percent)
 {
     using namespace boost::spirit::qi;
@@ -146,12 +146,11 @@
     double val = 0.0;
     symbols<char, double> units;
     units.add
-        ("px", 1.0)
-        ("pt", 1.25)
-        ("pc", 15.0)
-        ("mm", 3.543307)
-        ("cm", 35.43307)
-        ("in", 90.0)
+        ("pt", DPI/72.0)
+        ("pc", DPI/6.0)
+        ("mm", DPI/25.4)
+        ("cm", DPI/2.54)
+        ("in", (double)DPI)
         ;
     if (!phrase_parse(str, str + std::strlen(str),
                       double_[ref(val) = _1, ref(percent) = false]


some sample code for mapping logical object extent onto physical objects

git-svn-id: 17d41c460f3ddabe6271dd210d2e0bf85f349cae@2209 29311d96-e01e-0410-9327-a35deaab8ce9

--- branches/ebofs/osd/RAID4PG.cc
+++ branches/ebofs/osd/RAID4PG.cc
@@ -39,6 +39,34 @@
 void RAID4PG::do_op(MOSDOp *op)
 {

+  // a write will do something like
+  object_t oid = op->get_oid();   // logical object
+  pg_t pg = op->get_pg();
+  ObjectLayout layout = op->get_layout();
+  bufferlist data = op->get_data();
+  off_t off = op->get_offset();
+  off_t left = op->get_length();
+
+  // map data onto pobjects
+  int n = pg.size() - 1;  // n+1 raid4
+  int rank = (off % layout.stripe_unit) % n;
+  off_t off_in_bl = 0;
+  while (left > 0) {
+    pobject_t po(0, rank, oid);
+    off_t off_in_po = off % layout.stripe_unit;
+    off_t stripe_unit_end = off - off_in_po + layout.stripe_unit;
+    off_t len_in_po = MAX(left, stripe_unit_end-off);
+    bufferlist data_in_po;
+    data_in_po.substr_of(data, off_in_bl, len_in_po);
+
+    // next!
+    off_in_bl += len_in_po;
+    rank++;
+    if (rank == n) rank = 0;
+  }
+
+
+

 }


fuzz: Rework FillNode

fuzz: Rework FillNode

--- src/test/fuzz/util.cpp
+++ src/test/fuzz/util.cpp
@@ -3,6 +3,8 @@
 // file COPYING or http://www.opensource.org/licenses/mit-license.php.

 #include <consensus/amount.h>
+#include <net_processing.h>
+#include <netmessagemaker.h>
 #include <pubkey.h>
 #include <test/fuzz/util.h>
 #include <test/util/script.h>
@@ -203,22 +205,54 @@
 void FillNode(FuzzedDataProvider& fuzzed_data_provider, ConnmanTestMsg& connman, PeerManager& peerman, CNode& node) noexcept
 {
     const bool successfully_connected{fuzzed_data_provider.ConsumeBool()};
-    node.fSuccessfullyConnected = successfully_connected;
     const ServiceFlags remote_services = ConsumeWeakEnum(fuzzed_data_provider, ALL_SERVICE_FLAGS);
     const NetPermissionFlags permission_flags = ConsumeWeakEnum(fuzzed_data_provider, ALL_NET_PERMISSION_FLAGS);
     const int32_t version = fuzzed_data_provider.ConsumeIntegralInRange<int32_t>(MIN_PEER_PROTO_VERSION, std::numeric_limits<int32_t>::max());
     const bool filter_txs = fuzzed_data_provider.ConsumeBool();

+    const CNetMsgMaker mm{0};
+
+    CSerializedNetMsg msg_version{
+        mm.Make(NetMsgType::VERSION,
+                version,                                        //
+                Using<CustomUintFormatter<8>>(remote_services), //
+                int64_t{},                                      // dummy time
+                int64_t{},                                      // ignored service bits
+                CService{},                                     // dummy
+                int64_t{},                                      // ignored service bits
+                CService{},                                     // ignored
+                uint64_t{1},                                    // dummy nonce
+                std::string{},                                  // dummy subver
+                int32_t{},                                      // dummy starting_height
+                filter_txs),
+    };
+
+    (void)connman.ReceiveMsgFrom(node, msg_version);
     node.fPauseSend = false;
-    node.nServices = remote_services;
+    connman.ProcessMessagesOnce(node);
+    {
+        LOCK(node.cs_sendProcessing);
+        peerman.SendMessages(&node);
+    }
+    if (node.fDisconnect) return;
+    assert(node.nVersion == version);
+    assert(node.GetCommonVersion() == std::min(version, PROTOCOL_VERSION));
+    assert(node.nServices == remote_services);
+    if (node.m_tx_relay != nullptr) {
+        LOCK(node.m_tx_relay->cs_filter);
+        assert(node.m_tx_relay->fRelayTxes == filter_txs);
+    }
     node.m_permissionFlags = permission_flags;
     if (successfully_connected) {
-        node.nVersion = version;
-        node.SetCommonVersion(std::min(version, PROTOCOL_VERSION));
-    }
-    if (node.m_tx_relay != nullptr) {
-        LOCK(node.m_tx_relay->cs_filter);
-        node.m_tx_relay->fRelayTxes = filter_txs;
+        CSerializedNetMsg msg_verack{mm.Make(NetMsgType::VERACK)};
+        (void)connman.ReceiveMsgFrom(node, msg_verack);
+        node.fPauseSend = false;
+        connman.ProcessMessagesOnce(node);
+        {
+            LOCK(node.cs_sendProcessing);
+            peerman.SendMessages(&node);
+        }
+        assert(node.fSuccessfullyConnected == true);
     }
 }


Fixing some bugs.

Fixing some bugs.

--- src/SNRTuning.cpp
+++ src/SNRTuning.cpp
@@ -351,14 +351,14 @@

 void initializeDeviceMemoryD(cl::Context & clContext, cl::CommandQueue * clQueue, std::vector< dataType > * tranposedData, cl::Buffer * tranposedData_d, std::vector< dataType > * maxS, cl::Buffer * maxS_d, std::vector< dataType > * meanS, cl::Buffer * meanS_d, std::vector< dataType > * rmsS, cl::Buffer * rmsS_d) {
   try {
-    transposedData_d = cl::Buffer(clContext, CL_MEM_READ_WRITE, transposedData->size() * sizeof(dataType), 0, 0);
-    maxS_d = cl::Buffer(clContext, CL_MEM_READ_WRITE, maxS->size() * sizeof(dataType), 0, 0);
-    meanS_d = cl::Buffer(clContext, CL_MEM_READ_WRITE, meanS->size() * sizeof(dataType), 0, 0);
-    rmsS_d = cl::Buffer(clContext, CL_MEM_READ_WRITE, rmsS->size() * sizeof(dataType), 0, 0);
-    clQueue->enqueueWriteBuffer(transposedData_d, CL_FALSE, 0, transposedData->size() * sizeof(dataType), reinterpret_cast< void * >(transposedData->data()));
-    clQueue->enqueueWriteBuffer(maxS_d, CL_FALSE, 0, maxS->size() * sizeof(dataType), reinterpret_cast< void * >(maxS->data()));
-    clQueue->enqueueWriteBuffer(meanS_d, CL_FALSE, 0, meanS->size() * sizeof(dataType), reinterpret_cast< void * >(meanS->data()));
-    clQueue->enqueueWriteBuffer(rmsS_d, CL_FALSE, 0, rmsS->size() * sizeof(dataType), reinterpret_cast< void * >(rmsS->data()));
+    *transposedData_d = cl::Buffer(clContext, CL_MEM_READ_WRITE, transposedData->size() * sizeof(dataType), 0, 0);
+    *maxS_d = cl::Buffer(clContext, CL_MEM_READ_WRITE, maxS->size() * sizeof(dataType), 0, 0);
+    *meanS_d = cl::Buffer(clContext, CL_MEM_READ_WRITE, meanS->size() * sizeof(dataType), 0, 0);
+    *rmsS_d = cl::Buffer(clContext, CL_MEM_READ_WRITE, rmsS->size() * sizeof(dataType), 0, 0);
+    clQueue->enqueueWriteBuffer(*transposedData_d, CL_FALSE, 0, transposedData->size() * sizeof(dataType), reinterpret_cast< void * >(transposedData->data()));
+    clQueue->enqueueWriteBuffer(*maxS_d, CL_FALSE, 0, maxS->size() * sizeof(dataType), reinterpret_cast< void * >(maxS->data()));
+    clQueue->enqueueWriteBuffer(*meanS_d, CL_FALSE, 0, meanS->size() * sizeof(dataType), reinterpret_cast< void * >(meanS->data()));
+    clQueue->enqueueWriteBuffer(*rmsS_d, CL_FALSE, 0, rmsS->size() * sizeof(dataType), reinterpret_cast< void * >(rmsS->data()));
     clQueue->finish();
   } catch ( cl::Error & err ) {
     std::cerr << "OpenCL error: " << isa::utils::toString< cl_int >(err.err()) << "." << std::endl;
@@ -368,10 +368,10 @@

 void initializeDeviceMemoryF(cl::Context & clContext, cl::CommandQueue * clQueue, std::vector< dataType > * foldedData, cl::Buffer * foldedData_d, std::vector< dataType > * snrs, cl::Buffer * snrs_d) {
   try {
-    foldedData_d = cl::Buffer(clContext, CL_MEM_READ_WRITE, foldedData->size() * sizeof(dataType), 0, 0);
-    snrs_d = cl::Buffer(clContext, CL_MEM_WRITE_ONLY, snrs->size() * sizeof(dataType), 0, 0);
-    clQueue->enqueueWriteBuffer(foldedData_d, CL_FALSE, 0, foldedData->size() * sizeof(dataType), reinterpret_cast< void * >(foldedData->data()));
-    clQueue->enqueueWriteBuffer(snrs_d, CL_FALSE, 0, snrs->size() * sizeof(dataType), reinterpret_cast< void * >(snrs->data()));
+    *foldedData_d = cl::Buffer(clContext, CL_MEM_READ_WRITE, foldedData->size() * sizeof(dataType), 0, 0);
+    *snrs_d = cl::Buffer(clContext, CL_MEM_WRITE_ONLY, snrs->size() * sizeof(dataType), 0, 0);
+    clQueue->enqueueWriteBuffer(*foldedData_d, CL_FALSE, 0, foldedData->size() * sizeof(dataType), reinterpret_cast< void * >(foldedData->data()));
+    clQueue->enqueueWriteBuffer(*snrs_d, CL_FALSE, 0, snrs->size() * sizeof(dataType), reinterpret_cast< void * >(snrs->data()));
     clQueue->finish();
   } catch ( cl::Error & err ) {
     std::cerr << "OpenCL error: " << isa::utils::toString< cl_int >(err.err()) << "." << std::endl;


Added a fix to allow an non-word character that would normally stop autocompletion to restart autocompletion if in the autocompletion start characters.

--- src/SciTEBase.cxx
+++ src/SciTEBase.cxx
@@ -2584,6 +2584,9 @@
 					braceCount--;
 				} else if (!wordCharacters.contains(ch)) {
 					SendEditor(SCI_AUTOCCANCEL);
+					if (autoCompleteStartCharacters.contains(ch)) {
+						StartAutoComplete();
+					}
 				} else if (autoCCausedByOnlyOne) {
 					StartAutoCompleteWord(true);
 				}


Removed unused code.

Removed unused code.

--- src/SciTEBase.cxx
+++ src/SciTEBase.cxx
@@ -2133,7 +2133,6 @@
 		if (dataLength > 0) {
 			break;	/* Found */
 		}
-		abbrevPos++;
 		abbrev++;	// One more letter to the right
 		abbrevLength--;
 	}


fix array_test.cc to pass

fix array_test.cc to pass

--- xchainer/array_test.cc
+++ xchainer/array_test.cc
@@ -31,18 +31,20 @@
 protected:
     void SetUp() override {
         std::string device_name = ::testing::get<0>(GetParam());
-        std::unique_ptr<Backend> backend;
         if (device_name == "cpu") {
-            backend = std::make_unique<NativeBackend>();
+            backend_ = std::make_unique<NativeBackend>();
 #ifdef XCHAINER_ENABLE_CUDA
         } else if (device_name == "cuda") {
-            backend = std::make_unique<cuda::CudaBackend>();
+            backend_ = std::make_unique<cuda::CudaBackend>();
 #endif  // XCHAINER_ENABLE_CUDA
         }
-        device_scope_ = std::make_unique<DeviceScope>(device_name, backend.get());
-    }
-
-    void TearDown() override { device_scope_.reset(); }
+        device_scope_ = std::make_unique<DeviceScope>(device_name, backend_.get());
+    }
+
+    void TearDown() override {
+        device_scope_.reset();
+        backend_.reset();
+    }

 public:
     template <typename T>
@@ -342,6 +344,7 @@
     }

 private:
+    std::unique_ptr<Backend> backend_;
     std::unique_ptr<DeviceScope> device_scope_;
 };


hacking

hacking

--- webcam.cpp
+++ webcam.cpp
@@ -80,13 +80,13 @@

   add(black, Scalar(2), black);
   Mat fgd, bgd;
-  grabCut(image, black, Rect(1,1), bgd, fgd, 5, GC_INIT_WITH_MASK);
+  grabCut(image, black, Rect(1,1,1,1), bgd, fgd, 5, GC_INIT_WITH_MASK);
   imshow("bgd1", bgd);
   imshow("fgd1", fgd);
-  grabCut(image, black, Rect(1,1), bgd, fgd, 15, GC_INIT_WITH_MASK);
+  grabCut(image, black, Rect(1,1,1,1), bgd, fgd, 15, GC_INIT_WITH_MASK);
   imshow("bgd2", bgd);
   imshow("fgd2", fgd);
-  grabCut(image, black, Rect(1,1), bgd, fgd, 25, GC_INIT_WITH_MASK);
+  grabCut(image, black, Rect(1,1,1,1), bgd, fgd, 25, GC_INIT_WITH_MASK);
   imshow("bgd3", bgd);
   imshow("fgd3", fgd);


hacking

hacking

--- webcam.cpp
+++ webcam.cpp
@@ -77,7 +77,7 @@

   Moments lol = moments(mask, 1);
   circle(image, Point(lol.m10/lol.m00,lol.m01/lol.m00),20,Scalar(128),30);
-  imshow("threshold", image);
+  imshow("leimage", image);
   keepGoing = (waitKey(25)<0);

  }


A workaround for textfield crash in views_examples.

BUG=chromium-os:14810, chromium:81320
TEST=run views_examples.

Review URL: http://codereview.chromium.org/6911020

git-svn-id: de016e52bd170d2d4f2344f9bf92d50478b649e0@83827 0039d316-1c4b-4281-b951-d872f2087c98

--- views/controls/textfield/native_textfield_views.cc
+++ views/controls/textfield/native_textfield_views.cc
@@ -918,13 +918,15 @@
 }

 void NativeTextfieldViews::OnTextInputTypeChanged() {
-  DCHECK(textfield_->GetInputMethod());
-  textfield_->GetInputMethod()->OnTextInputTypeChanged(textfield_);
+  // TODO(suzhe): changed from DCHECK. See http://crbug.com/81320.
+  if (textfield_->GetInputMethod())
+    textfield_->GetInputMethod()->OnTextInputTypeChanged(textfield_);
 }

 void NativeTextfieldViews::OnCaretBoundsChanged() {
-  DCHECK(textfield_->GetInputMethod());
-  textfield_->GetInputMethod()->OnCaretBoundsChanged(textfield_);
+  // TODO(suzhe): changed from DCHECK. See http://crbug.com/81320.
+  if (textfield_->GetInputMethod())
+    textfield_->GetInputMethod()->OnCaretBoundsChanged(textfield_);
 }

 void NativeTextfieldViews::OnBeforeUserAction() {


simplify

simplify

--- src/tests/mpm_full.cpp
+++ src/tests/mpm_full.cpp
@@ -207,14 +207,13 @@
       Expr J;
       Matrix F;
       if (material == MPMMaterial::fluid) {
-        J = particle_J[p] * (1.0_f + dt * (C(0, 0) + C(1, 1) + C(2, 2)));
-        particle_J[p] = J;
+        particle_J[p] *= 1.0_f + dt * (C(0, 0) + C(1, 1) + C(2, 2));
       } else {
         F = Var(Matrix::identity(dim) + dt * C) * particle_F[p];
       }

-      auto base_coord = floor(Expr(inv_dx) * x - Expr(0.5_f));
-      auto fx = x * Expr(inv_dx) - base_coord;
+      auto base_coord = floor(inv_dx * x - 0.5_f);
+      auto fx = x * inv_dx - base_coord;

       Vector w[] = {Var(0.5_f * sqr(1.5_f - fx)), Var(0.75_f - sqr(fx - 1.0_f)),
                     Var(0.5_f * sqr(fx - 0.5_f))};
@@ -231,11 +230,9 @@
         auto sig = Var(std::get<1>(svd));
         auto oldJ = Var(sig(0) * sig(1) * sig(2));
         if (material == MPMMaterial::snow) {
-          for (int i = 0; i < dim; i++) {
-            sig(i) = clamp(sig(i), 1 - 2.5e-2f, 1 + 7.5e-3f);
-          }
+          for (int d = 0; d < dim; d++)
+            sig(d) = clamp(sig(d), 1 - 2.5e-2f, 1 + 7.5e-3f);
           auto newJ = sig(0) * sig(1) * sig(2);
-          // plastic J
           auto Jp = Var(clamp(particle_J[p] * oldJ / newJ, 0.6_f, 20.0_f));
           J = newJ;
           F = std::get<0>(svd) * diag_matrix(sig) *
@@ -290,16 +287,12 @@
       for (int a = 0; a < 3; a++) {
         for (int b = 0; b < 3; b++) {
           for (int c = 0; c < 3; c++) {
-            auto dpos = Vector(dim);
-            dpos(0) = dx * ((a * 1.0_f) - fx(0));
-            dpos(1) = dx * ((b * 1.0_f) - fx(1));
-            dpos(2) = dx * ((c * 1.0_f) - fx(2));
+            auto dpos = dx * (Vector({a, b, c}).cast_elements<float32>() - fx);
             auto weight = w[a](0) * w[b](1) * w[c](2);
-            auto node = (base_coord_i + Expr(a), base_coord_j + Expr(b),
-                         base_coord_k + Expr(c));
+            auto node = (base_coord_i + a, base_coord_j + b, base_coord_k + c);
             Atomic(grid_v[node]) +=
-                weight * (Expr(particle_mass) * v + affine * dpos);
-            Atomic(grid_m[node]) += weight * Expr(particle_mass);
+                weight * (particle_mass * v + affine * dpos);
+            Atomic(grid_m[node]) += weight * particle_mass;
           }
         }
       }
@@ -377,7 +370,7 @@
       auto p = Var(l[i, j, k, p_ptr]);
       Assert(p >= 0);
       Assert(p < n_particles);
-      auto x = particle_x[p];
+      auto x = Var(particle_x[p]);
       auto v = Var(Vector(dim));
       auto C = Var(Matrix(dim, dim));

@@ -415,10 +408,7 @@
       for (int p = 0; p < 3; p++) {
         for (int q = 0; q < 3; q++) {
           for (int r = 0; r < 3; r++) {
-            auto dpos = Vector(dim);
-            dpos(0) = Expr(p * 1.0_f) - fx(0);
-            dpos(1) = Expr(q * 1.0_f) - fx(1);
-            dpos(2) = Expr(r * 1.0_f) - fx(2);
+            auto dpos = Vector({p, q, r}).cast_elements<float32>() - fx;
             auto weight = w[p](0) * w[q](1) * w[r](2);
             auto wv =
                 weight *


Fix caret bounds to use min of available height and font height.

BUG=none
TEST=none

Review URL: http://codereview.chromium.org/6733058

git-svn-id: de016e52bd170d2d4f2344f9bf92d50478b649e0@79469 0039d316-1c4b-4281-b951-d872f2087c98

--- views/controls/textfield/native_textfield_views.cc
+++ views/controls/textfield/native_textfield_views.cc
@@ -452,8 +452,11 @@
   // TODO(oshima): bidi
   const gfx::Font& font = GetFont();
   int full_width = font.GetStringWidth(model_->GetVisibleText());
+  int cursor_height = std::min(height() - insets.height(), font.GetHeight());
+
   cursor_bounds_ = model_->GetCursorBounds(font);
-  cursor_bounds_.set_y(cursor_bounds_.y() + insets.top());
+  cursor_bounds_.set_y((height() - cursor_height) / 2);
+  cursor_bounds_.set_height(cursor_height);

   int x_right = text_offset_ + cursor_bounds_.right();
   int x_left = text_offset_ + cursor_bounds_.x();


removed junk stuff from boost python wrapper

--- soccer/python/robocup.cpp
+++ soccer/python/robocup.cpp
@@ -1,39 +1,6 @@

 #include <boost/python.hpp>
 using namespace boost::python;
-
-
-class Point {
-public:
-	Point(float x = 0, float y = 0) {
-		_x = x;
-		_y = y;
-	}
-
-	float x() const {
-		return _x;
-	}
-	void set_x(float x) {
-		_x = x;
-	}
-
-	float y() const {
-		return _y;
-	}
-	void set_y(float y) {
-		_y = y;
-	}
-
-private:
-	float _x, _y;
-};
-
-
-class Robot {
-public:
-	Point pos, vel;
-	float angle, angle_vel;
-};

 BOOST_PYTHON_MODULE(robocup)
@@ -50,5 +17,3 @@
 		.def_readwrite("angle_vel", &Robot::angle_vel)
 	;
 }
-
-


One more Camellia TLS test fix

One more Camellia TLS test fix

--- src/tests/unit_tls.cpp
+++ src/tests/unit_tls.cpp
@@ -1121,15 +1121,22 @@

 #if defined(BOTAN_HAS_CAMELLIA)
          test_modern_versions(results, *client_ses, *server_ses, *creds, "RSA", "Camellia-128", "SHA-256");
-         test_modern_versions(results, *client_ses, *server_ses, *creds, "RSA", "Camellia-256", "SHA-384");
+         test_modern_versions(results, *client_ses, *server_ses, *creds, "RSA", "Camellia-256", "SHA-384 SHA-256");
          test_modern_versions(results, *client_ses, *server_ses, *creds, "ECDH", "Camellia-128/GCM", "AEAD");
          test_modern_versions(results, *client_ses, *server_ses, *creds, "ECDH", "Camellia-256/GCM", "AEAD");
 #endif

 #if defined(BOTAN_HAS_CECPQ1)
+
+#if defined(BOTAN_HAS_AES) && defined(BOTAN_HAS_AEAD_GCM)
          test_modern_versions(results, *client_ses, *server_ses, *creds, "CECPQ1", "AES-256/GCM", "AEAD");
+#endif
+
+#if defined(BOTAN_HAS_AEAD_CHACHA20_POLY1305)
          test_modern_versions(results, *client_ses, *server_ses, *creds, "CECPQ1", "ChaCha20Poly1305", "AEAD",
                               { { "signature_methods", "RSA" }});
+#endif
+
 #endif

          test_modern_versions(results, *client_ses, *server_ses, *creds, "ECDH", "AES-128/GCM", "AEAD",


Fix const cast needed.

Fix const cast needed.

--- src/reql/protocol.hpp
+++ src/reql/protocol.hpp
@@ -97,7 +97,7 @@

     auto wire_query = stream.str();
     auto size = wire_query.size();
-    auto data = wire_query.data();
+    auto data = const_cast<char *>(wire_query.data());

     make_token(data, token);
     make_size(data + 8, static_cast<std::uint32_t>(size - 12));


fix inlude in resolve_links.cpp

fix inlude in resolve_links.cpp

git-svn-id: 4f0141143c3c635d33f1b9f02fcb2b6c73e45c89@10977 a83610d8-ad2a-0410-a6ab-fc0612d85776

--- src/resolve_links.cpp
+++ src/resolve_links.cpp
@@ -30,7 +30,7 @@

 */

-#include "resolve_links.hpp"
+#include "libtorrent/resolve_links.hpp"

 #include "libtorrent/torrent_info.hpp"
 #include <boost/shared_ptr.hpp>


INTEGRATION: CWS soldep2 (1.2.2); FILE MERGED 2006/11/21 16:27:53 obo 1.2.2.1: #143484# dialog for workspace has to support minors

--- soldep/source/connctr.cxx
+++ soldep/source/connctr.cxx
@@ -4,9 +4,9 @@
  *
  *  $RCSfile: connctr.cxx,v $
  *
- *  $Revision: 1.2 $
- *
- *  last change: $Author: obo $ $Date: 2006-04-20 15:15:01 $
+ *  $Revision: 1.3 $
+ *
+ *  last change: $Author: ihi $ $Date: 2006-12-21 12:22:21 $
  *
  *  The Contents of this file are made available subject to
  *  the terms of GNU Lesser General Public License Version 2.1.
@@ -32,11 +32,12 @@
  *    MA  02111-1307  USA
  *
  ************************************************************************/
-
+#ifdef _MSC_VER
+#pragma warning(disable:4100)
+#endif
 #include "connctr.hxx"
 #include "objwin.hxx"
 #include "depwin.hxx"
-//#include "depapp.hxx"
 #include "math.h"

 BOOL Connector::msbHideMode = FALSE;
@@ -274,10 +275,10 @@
     dx = mStart.X() - mEnd.X();
     dy = mStart.Y() - mEnd.Y();

-    return sqrt( dx * dx + dy * dy );
+    return (ULONG) sqrt( dx * dx + dy * dy );
 }

 BOOL Connector::IsStart( ObjectWin* pWin )
 {
     return pWin == mpStartWin;
-}
+}


small bug fixed

small bug fixed

--- src/Tokenizer.cpp
+++ src/Tokenizer.cpp
@@ -262,8 +262,8 @@
 				state = &CTokenizer::indentifierState;
 				text.assign( 1, c );
 			} else {
-				errorProcessor.AddError( CError( CLineSegment( offset ),
-					line, "unknown character " + c, ES_CriticalError ) );
+				errorProcessor.AddError( CError( CLineSegment( offset ), line,
+					"unknown character " + string( 1, c ), ES_CriticalError ) );
 			}
 			break;
 	}


Add commented-out code for detecting binary vs ternary suspensions and agents. This still needs a way to detect the prevailing meter in each voice before it can but uncommented.

--- src/tool-dissonant.cpp
+++ src/tool-dissonant.cpp
@@ -36,6 +36,7 @@
 	define("s|suppress=b",        "suppress dissonant notes");
 	define("d|diatonic=b",        "print diatonic grid");
 	define("D|no-dissonant=b",    "don't do dissonance anaysis");
+	// define("t|ternary=b",		  "distinguish between binary and ternary suspensions and agents");
 	define("m|midi-pitch=b",      "print midi-pitch grid");
 	define("b|base-40=b",         "print base-40 grid");
 	define("l|metric-levels=b",   "use metric levels in analysis");
@@ -62,6 +63,10 @@
 	} else {
 		fillLabels();
 	}
+
+	// if (not getBoolean("ternary")) {
+	// 	collapseSus();
+	// }

 	HumdrumFile infile(indata);
 	bool status = run(infile);
@@ -82,6 +87,10 @@
 		fillLabels();
 	}

+	// if (not getBoolean("ternary")) {
+	// 	collapseSus();
+	// }
+
 	int status = run(infile);
 	if (hasAnyText()) {
 		getAllText(out);
@@ -99,6 +108,10 @@
 	} else {
 		fillLabels();
 	}
+
+	// if (not getBoolean("ternary")) {
+	// 	collapseSus();
+	// }

 	NoteGrid grid(infile);

@@ -412,6 +425,11 @@
 	char marking = '\0';
 	int ovoiceindex = -1;
 	string unexp_label; // default dissonance label if none of the diss types apply
+	// int refMeterNum; // the numerator of the reference voice's notated time signature
+	// int refMeterDen; // the denominator of the reference voice's notated time signature
+	// int othMeterNum; // the numerator of the other voice's notated time signature
+	// int othMeterDen; // the denominator of the other voice's notated time signature
+	// bool ternAgent = false;  // true if the ref voice would be a valid agent of a ternary susp. But if true, the diss is not necessarily a susp.

 	for (int i=1; i<(int)attacks.size() - 1; i++) {
 		sliceindex = attacks[i]->getSliceIndex();
@@ -565,6 +583,17 @@
 		lev  = attacks[i]->getMetricLevel();
 		levn = attacks[i+1]->getMetricLevel();

+		// Assign time signature ints here:
+		// refMeterNum = ?
+		// refMeterDen = ?
+		// othMeterNum = ?
+		// othMeterDen = ?
+		// if ((refMeterNum % 3 == 0) && // the durational value of the meter's denominator groups in threes
+		// 	((refMeterNum == othMeterNum) && (refMeterDen == othMeterDen)) && // the ref and other voices have the same timesig
+		// 	((dur == 1.5*refMeterDen) || (dur == 2*refMeterDen))) { // the ref note lasts 1.5 or 2 times as long as the meter's denominator
+		// 	ternAgent = true;
+		// }
+
 		// Non-suspension test cases ////////////////////////////////////////////

 		// valid_acc_exit determines if the other (accompaniment) voice conforms to the
@@ -691,6 +720,40 @@
 			results[vindex][lineindex] = m_labels[THIRD_QUARTER]; // dissonant third quarter
 		}

+/////////////////////////////
+//// Code to apply binary or ternary suspension and agent labels
+		// else if (valid_sus_acc && (ointn == -1)) {
+		// 	if (ternAgent) {
+		// 		results[vindex][lineindex] = m_labels[AGENT_TERN]; // ternary agent
+		// 		results[ovoiceindex][lineindex] = m_labels[SUS_TERN]; // ternary suspension
+		// 	} else {
+		// 		results[vindex][lineindex] = m_labels[AGENT_BIN]; // binary agent
+		// 		results[ovoiceindex][lineindex] = m_labels[SUS_BIN]; // binary suspension
+		// 	}
+		// }
+
+		// else if (valid_ornam_sus_acc && ((ointn == 0) && (ointnn == -1))) {
+		// 	if (ternAgent) {
+		// 		results[vindex][lineindex] = m_labels[AGENT_TERN]; // ternary agent
+		// 		results[ovoiceindex][lineindex] = m_labels[SUS_TERN]; // ternary suspension
+		// 	} else {
+		// 		results[vindex][lineindex] = m_labels[AGENT_BIN]; // binary agent
+		// 		results[ovoiceindex][lineindex] = m_labels[SUS_BIN]; // binary suspension
+		// 	}
+		// 	results[ovoiceindex][olineindexn] = m_labels[SUSPENSION_REP]; // repeated-note of suspension
+		// }
+
+		// else if (valid_ornam_sus_acc && ((ointn == -2) && (ointnn == 1))) {
+		// 	if (ternAgent) {
+		// 		results[vindex][lineindex] = m_labels[AGENT_TERN]; // ternary agent
+		// 		results[ovoiceindex][lineindex] = m_labels[SUS_TERN]; // ternary suspension
+		// 	} else {
+		// 		results[vindex][lineindex] = m_labels[AGENT_BIN]; // binary agent
+		// 		results[ovoiceindex][lineindex] = m_labels[SUS_BIN]; // binary suspension
+		// 	}
+		// 	results[ovoiceindex][olineindexn] = m_labels[SUSPENSION_ORNAM]; // suspension ornament
+		// }
+/////////////////////////////

 		else if (valid_sus_acc && (ointn == -1)) {
 			results[vindex][lineindex] = m_labels[SUSPENSION_AGENT]; // the accompaniment voice of the suspension
@@ -953,7 +1016,11 @@
 	m_labels[ANT_DOWN            ] = "a"; // descending anticipation
 	m_labels[THIRD_QUARTER       ] = "q"; // dissonant third quarter
 	m_labels[SUSPENSION          ] = "s"; // suspension
+	// m_labels[SUS_BIN			 ] = "s2"; // binary suspension
+	// m_labels[SUS_TERN		 ] = "s3"; // ternary suspension
 	m_labels[SUSPENSION_AGENT    ] = "G"; // suspension agent
+	// m_labels[AGENT_BIN		 ] = "G2"; // binary agent
+	// m_labels[AGENT_TERN		 ] = "G3"; // ternary agent
 	m_labels[SUSPENSION_ORNAM    ] = "o"; // suspension ornament
 	m_labels[SUSPENSION_REP      ] = "r"; // suspension repeated note
 	m_labels[FAKE_SUSPENSION_UP  ] = "F"; // fake suspension approached by step up
@@ -993,7 +1060,11 @@
 	m_labels[ANT_DOWN            ] = "A"; // descending anticipation
 	m_labels[THIRD_QUARTER       ] = "Q"; // dissonant third quarter
 	m_labels[SUSPENSION          ] = "S"; // suspension
+	// m_labels[SUS_BIN			 ] = "S2"; // binary suspension
+	// m_labels[SUS_TERN		 ] = "S3"; // ternary suspension
 	m_labels[SUSPENSION_AGENT    ] = "G"; // suspension agent
+	// m_labels[AGENT_BIN		 ] = "G2"; // binary agent
+	// m_labels[AGENT_TERN		 ] = "G3"; // ternary agent
 	m_labels[SUSPENSION_ORNAM    ] = "O"; // suspension ornament
 	m_labels[SUSPENSION_REP      ] = "R"; // suspension repeated note
 	m_labels[FAKE_SUSPENSION_UP  ] = "F"; // fake suspension approached by step up
@@ -1005,7 +1076,11 @@
 	m_labels[UNLABELED_Z4        ] = "Z"; // unknown dissonance, 4th interval
 }

-
+// void Tool_dissonant::collapseSus(void) { // call if you don't want to distinguish between binary/ternary suspensions and agents.
+// 	for (l=17; l<21; l++;) { // NB: l starts at the index position of the first suspension label and stops at that number+4.
+// 		m_labels[at index position l] = the_first_character_of m_labels[at index position l]
+// 	}
+// }

 // END_MERGE


Fix linking error (again, but for Unix this time)

--- src/ToolsUnix.cpp
+++ src/ToolsUnix.cpp
@@ -35,7 +35,7 @@
     kill(pid, SIGKILL);
 }

-bool MoveReplayFile(char* lpExistingFileName, char* lpNewFileName)
+bool MoveReplayFile(const char* lpExistingFileName, const  char* lpNewFileName)
 {
 	// todo
 	throw "MoveFile is not implemented for linux yet.";


changed colors of LineInput in dark mode

--- src/toolkit/Widget.cpp
+++ src/toolkit/Widget.cpp
@@ -91,8 +91,8 @@
 		labelFontColor.setColor(216, 216, 214, 255);
 		buttonBackgroundColor.setColor(91, 91, 98, 255);
 		buttonFontColor.setColor(223, 223, 220, 255);
-		inputFontColor.setColor(43, 43, 40, 255);
-		inputBackgroundColor.setColor(216, 216, 214, 255);
+		inputFontColor.setColor(240, 240, 235, 255);
+		inputBackgroundColor.setColor(50, 50, 47, 255);
 		sliderHighlightColor.setColor(61, 174, 233, 255);
 		buttonSymbolColor.setColor(255, 250, 250, 255);
 	}


* 2.3.0 dbc updates

* 2.3.0 dbc updates

git-svn-id: 0a6e3066f5d503b24e8e377b6d170815393887e2@2313 8ad44209-8f18-4ceb-bdfa-99d0be514da2

--- src/shared/Database/DBCStores.cpp
+++ src/shared/Database/DBCStores.cpp
@@ -58,7 +58,7 @@
 const char * GemPropertyEntryFormat = "uuuuu";
 const char * skilllineentrYFormat = "uuuxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
 const char * spellentrYFormat = "uuuuuuuuuuuuuuuuuuuuuuuuuuuuuiuuuuuuuuuufuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuffffffiiiiiiuuuuuuuuuuuuuuufffuuuuuuuuuuuufffuuuuuxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxuuuuuuuuuuifffuuuuuu";
-const char * itemextendedcostFormat = "uuuuuuuuuuuuu";
+const char * itemextendedcostFormat = "uuuuuuuuuuuuux";
 const char * talententryFormat = "uuuuuuuuuxxxxuxxuxxxx";
 const char * spellcasttimeFormat = "uuxx";
 const char * spellradiusFormat = "ufxf";


use log1p for improved stability

use log1p for improved stability

--- src/include/structures/stable_double.hpp
+++ src/include/structures/stable_double.hpp
@@ -132,11 +132,11 @@

 inline double StableDouble::add_log(const double log_x, const double log_y) const {
-    return log_x > log_y ? log_x + log(1.0 + exp(log_y - log_x)) : log_y + log(1.0 + exp(log_x - log_y));
+    return log_x > log_y ? log_x + log1p(exp(log_y - log_x)) : log_y + log(exp(log_x - log_y));
 }

 inline double StableDouble::subtract_log(const double log_x, const double log_y) const {
-    return log_x + log(1.0 - exp(log_y - log_x));
+    return log_x + log1p(-exp(log_y - log_x));
 }

 inline double StableDouble::to_double() const {


Using unique_ptr in TextPlot.

Using unique_ptr in TextPlot.

--- src/tools/TextPlot.cpp
+++ src/tools/TextPlot.cpp
@@ -16,7 +16,7 @@
  */

 #include "TextPlot.h"
-#include <boost/scoped_array.hpp>
+#include <memory>

 namespace Aquila
 {
@@ -61,7 +61,7 @@
      */
     void TextPlot::plotSpectrum(Aquila::ComplexType spectrum[], std::size_t length)
     {
-        boost::scoped_array<double> absSpectrum(new double[length/2]);
+        std::unique_ptr<double[]> absSpectrum(new double[length/2]);
         for (std::size_t i = 0; i < length/2; ++i)
         {
             absSpectrum[i] = std::abs(spectrum[i]);


Search and set language instance during U8GettextSetLanguage

--- src/U8Gettext.cpp
+++ src/U8Gettext.cpp
@@ -15,9 +15,23 @@

 const char *U8GettextSetLanguage(const char *language)
 {
-  const char * oldLanguage = sU8GettextLanguage;
+  uint16_t i = 0;
+  const char * oldLanguage = "";
+  const U8GettextLanguage * languageInstance = NULL;

-  sU8GettextLanguage = language;
+  if (sLanguageInstance) {
+    oldLanguage = sLanguageInstance->language;
+  }
+
+  languageInstance = gU8GettextLanguages;
+  for(i = 0; i < gU8GettextLanguagesLength; ++i, ++languageInstance) {
+    // Set the language instance by specific language
+    if(0 == strcmp(language, languageInstance->language)) {
+      sLanguageInstance = languageInstance;
+      break;
+    }
+  }
+
   return oldLanguage;
 }


Added support for reading agent API URL in default executor.

This change adds support for populating the agent API URL needed
for making the calls for launching/waiting/killing
child containers. Ideally, we should have used the
`MESOS_AGENT_ENDPOINT` variable but that is a bit hard
to do with our testcase setup that generates the
agent process ID.

Review: https://reviews.apache.org/r/52145/

--- src/launcher/default_executor.cpp
+++ src/launcher/default_executor.cpp
@@ -46,6 +46,9 @@

 using process::Clock;
 using process::Owned;
+using process::UPID;
+
+using process::http::URL;

 using std::cout;
 using std::cerr;
@@ -61,14 +64,16 @@
 public:
   DefaultExecutor(
       const FrameworkID& _frameworkId,
-      const ExecutorID& _executorId)
+      const ExecutorID& _executorId,
+      const ::URL& _agent)
     : ProcessBase(process::ID::generate("default-executor")),
       state(DISCONNECTED),
       launched(false),
       frameworkInfo(None()),
       frameworkId(_frameworkId),
       executorId(_executorId),
-      taskGroup(None()) {}
+      taskGroup(None()),
+      agent(_agent) {}

   virtual ~DefaultExecutor() = default;

@@ -299,6 +304,7 @@
   const ExecutorID executorId;
   Owned<Mesos> mesos;
   Option<TaskGroupInfo> taskGroup;
+  const ::URL agent; // Agent API URL.
   LinkedHashMap<UUID, Call::Update> updates; // Unacknowledged updates.
   LinkedHashMap<TaskID, TaskInfo> tasks; // Unacknowledged tasks.
 };
@@ -311,6 +317,8 @@
 {
   mesos::FrameworkID frameworkId;
   mesos::ExecutorID executorId;
+  string scheme = "http"; // Default scheme.
+  ::URL agent;

   Option<string> value = os::getenv("MESOS_FRAMEWORK_ID");
   if (value.isNone()) {
@@ -326,10 +334,31 @@
   }
   executorId.set_value(value.get());

+  value = os::getenv("SSL_ENABLED");
+  if (value.isSome() && (value.get() == "1" || value.get() == "true")) {
+    scheme = "https";
+  }
+
+  value = os::getenv("MESOS_SLAVE_PID");
+  if (value.isNone()) {
+    EXIT(EXIT_FAILURE)
+      << "Expecting 'MESOS_SLAVE_PID' to be set in the environment";
+  }
+
+  UPID upid(value.get());
+  CHECK(upid) << "Failed to parse MESOS_SLAVE_PID '" << value.get() << "'";
+
+  agent = ::URL(
+      scheme,
+      upid.address.ip,
+      upid.address.port,
+      upid.id + "/api/v1");
+
   Owned<mesos::internal::DefaultExecutor> executor(
       new mesos::internal::DefaultExecutor(
           frameworkId,
-          executorId));
+          executorId,
+          agent));

   process::spawn(executor.get());
   process::wait(executor.get());


Remove register keyword from obj2pbrt.cpp

--- src/tools/obj2pbrt.cpp
+++ src/tools/obj2pbrt.cpp
@@ -688,7 +688,7 @@
 	  const size_t nIndexs = shape.mesh.indices.size();
 	  if (nIndexs % 3 == 0) {
 		  shape.mesh.normals.resize(shape.mesh.positions.size());
-		  for (register size_t iIndices = 0; iIndices < nIndexs; iIndices += 3) {
+		  for (size_t iIndices = 0; iIndices < nIndexs; iIndices += 3) {
 			  float3 v1, v2, v3;
 			  memcpy(&v1, &shape.mesh.positions[shape.mesh.indices[iIndices] * 3], sizeof(float3));
 			  memcpy(&v2, &shape.mesh.positions[shape.mesh.indices[iIndices + 1] * 3], sizeof(float3));


Update corruption_test.cc

Update corruption_test.cc

--- src/leveldb/db/corruption_test.cc
+++ src/leveldb/db/corruption_test.cc
@@ -267,7 +267,7 @@

   Corrupt(kTableFile, -2000, 500);
   Reopen();
-  Check(5000, 1983);
+  Check(5000, 9999);
 }

 TEST(CorruptionTest, MissingDescriptor) {


Added forgotten DGETRS define

Added forgotten DGETRS define

--- src/shogun/mathematics/lapack.cpp
+++ src/shogun/mathematics/lapack.cpp
@@ -32,6 +32,7 @@
 #define DORGQR dorgqr
 #define DSYEVR dsyevr
 #define DPOTRS dpotrs
+#define DGETRS dgetrs
 #else
 #define DSYEV dsyev_
 #define DGESVD dgesvd_


ditto

ditto

--- src/rpcblockchain.cpp
+++ src/rpcblockchain.cpp
@@ -394,7 +394,8 @@
     if (!fVerbose)
     {
         CDataStream ssBlock(SER_NETWORK, PROTOCOL_VERSION);
-        ssBlock << pblockindex->GetBlockHeader();
+		// SYSCOIN pass consensus into getblockheader for auxpow
+        ssBlock << pblockindex->GetBlockHeader(Params().GetConsensus());
         std::string strHex = HexStr(ssBlock.begin(), ssBlock.end());
         return strHex;
     }


Signond: fix cancellation of idle requests

When the request being cancelled was the first one in the queue, the
code assumed that it was also active, meaning that it would wait for a
reply from the plugin. However, in some situations, it may well occur
that the first request in the queue is not active, and in such case it
should be removed immediately without waiting for the plugin's reply
(which would never arrive).

--- src/signond/signonsessioncore.cpp
+++ src/signond/signonsessioncore.cpp
@@ -269,7 +269,10 @@
     TRACE() << "The request is found with index " << requestIndex;

     if (requestIndex < m_listOfRequests.size()) {
-        if (requestIndex == 0) {
+        /* If the request being cancelled is active, we need to keep
+         * in the queue until the plugin has replied. */
+        bool isActive = (requestIndex == 0) && m_requestIsActive;
+        if (isActive) {
             m_canceled = true;
             m_plugin->cancel();

@@ -286,9 +289,9 @@
          * will happen. We will know about that precisely: plugin must reply via
          * resultSlot or via errorSlot.
          * */
-        RequestData rd((requestIndex == 0 ?
-                        m_listOfRequests.head() :
-                        m_listOfRequests.takeAt(requestIndex)));
+        RequestData rd(isActive ?
+                       m_listOfRequests.head() :
+                       m_listOfRequests.takeAt(requestIndex));

         QDBusMessage errReply =
             rd.m_msg.createErrorReply(SIGNOND_SESSION_CANCELED_ERR_NAME,


Debug flags accessible by console.

Debug flags accessible by console.

Removed list debug3 which is a one way turn on fDebug3 only!
Added to execute the following:
execute debug true/false
execute debugnet true/false
execute debug2 true/false
execute debug3 true/false
execute debug4 true/false
execute debug5 true/false
execute debug10 true/false

You can now enable and disable them as you see fit.

--- src/rpcblockchain.cpp
+++ src/rpcblockchain.cpp
@@ -3286,6 +3286,83 @@
             entry.push_back(Pair("Execute Encrypt result3",s1out));
             results.push_back(entry);
     }
+    else if (sItem == "debug")
+    {
+	    if (params.size() == 2 && (params[1].get_str() == "true" || params[1].get_str() == "false"))
+	    {
+		    fDebug = (params[1].get_str() == "true") ? true : false;
+		    entry.push_back(Pair("Debug", fDebug ? "Entering debug mode." : "Exiting debug mode."));
+	    }
+	    else
+		    entry.push_back(Pair("Error","You must specify true or false as an option."));
+	    results.push_back(entry);
+    }
+    else if (sItem == "debugnet")
+    {
+	    if (params.size() == 2 && (params[1].get_str() == "true" || params[1].get_str() == "false"))
+	    {
+		    fDebugNet = (params[1].get_str() == "true") ? true : false;
+		    entry.push_back(Pair("DebugNet", fDebugNet ? "Entering debug mode." : "Exiting debug mode."));
+	    }
+	    else
+		    entry.push_back(Pair("Error","You must specify true or false as an option."));
+	    results.push_back(entry);
+    }
+    else if (sItem == "debug2")
+    {
+	    if (params.size() == 2 && (params[1].get_str() == "true" || params[1].get_str() == "false"))
+	    {
+		    fDebug2 = (params[1].get_str() == "true") ? true : false;
+		    entry.push_back(Pair("Debug2", fDebug2 ? "Entering debug mode." : "Exiting debug mode."));
+	    }
+	    else
+		    entry.push_back(Pair("Error","You must specify true or false as an option."));
+	    results.push_back(entry);
+    }
+    else if (sItem == "debug3")
+    {
+	    if (params.size() == 2 && (params[1].get_str() == "true" || params[1].get_str() == "false"))
+	    {
+		    fDebug3 = (params[1].get_str() == "true") ? true : false;
+		    entry.push_back(Pair("Debug3", fDebug3 ? "Entering debug mode." : "Exiting debug mode."));
+	    }
+	    else
+		    entry.push_back(Pair("Error","You must specify true or false as an option."));
+	    results.push_back(entry);
+    }
+    else if (sItem == "debug4")
+    {
+	    if (params.size() == 2 && (params[1].get_str() == "true" || params[1].get_str() == "false"))
+	    {
+		    fDebug4 = (params[1].get_str() == "true") ? true : false;
+		    entry.push_back(Pair("Debug4", fDebug4 ? "Entering debug mode." : "Exiting debug mode."));
+	    }
+	    else
+		    entry.push_back(Pair("Error","You must specify true or false as an option."));
+	    results.push_back(entry);
+    }
+    else if (sItem == "debug5")
+    {
+	    if (params.size() == 2 && (params[1].get_str() == "true" || params[1].get_str() == "false"))
+	    {
+		    fDebug5 = (params[1].get_str() == "true") ? true : false;
+		    entry.push_back(Pair("Debug5", fDebug5 ? "Entering debug mode." : "Exiting debug mode."));
+	    }
+	    else
+		    entry.push_back(Pair("Error","You must specify true or false as an option."));
+	    results.push_back(entry);
+    }
+    else if (sItem == "debug10")
+    {
+	    if (params.size() == 2 && (params[1].get_str() == "true" || params[1].get_str() == "false"))
+	    {
+		    fDebug10 = (params[1].get_str() == "true") ? true : false;
+		    entry.push_back(Pair("Debug10", fDebug10 ? "Entering debug mode." : "Exiting debug mode."));
+	    }
+	    else
+		    entry.push_back(Pair("Error","You must specify true or false as an option."));
+	    results.push_back(entry);
+    }
     else
     {
             entry.push_back(Pair("Command " + sItem + " not found.",-1));
@@ -4633,13 +4710,6 @@
         results = StakingReport();
         return results;
     }
-    else if (sitem == "debug3")
-    {
-        fDebug3 = true;
-        Object entry;
-        entry.push_back(Pair("Entering Debug Mode 3",1));
-        results.push_back(entry);
-    }
     else if (sitem == "currenttime")
     {


Smaller icons and list mode for improvied usability on small screen devices.

svn path=/trunk/KDE/kdeedu/marble/; revision=1210271

--- src/lib/MarbleThemeSelectView.cpp
+++ src/lib/MarbleThemeSelectView.cpp
@@ -11,16 +11,18 @@
 //

 #include "MarbleThemeSelectView.h"
+
+#include "global.h"
 #include "MarbleDirs.h"
-
 #include "MapWizard.h"
 #include "MarbleDebug.h"
+
+#include <QtCore/QFileInfo>
+#include <QtCore/QFile>
+#include <QtCore/QDir>
 #include <QtGui/QResizeEvent>
 #include <QtGui/QMenu>
 #include <QtGui/QMessageBox>
-#include <QtCore/QFileInfo>
-#include <QtCore/QFile>
-#include <QtCore/QDir>

 using namespace Marble;

@@ -97,7 +99,14 @@
     : QListView( parent ),
       d( new Private( this ) )
 {
-    setViewMode( QListView::IconMode );
+    bool const smallScreen = MarbleGlobal::getInstance()->profiles() & MarbleGlobal::SmallScreen;
+    if ( smallScreen ) {
+        setViewMode( QListView::ListMode );
+        setIconSize( QSize( 64, 64 ) );
+    } else {
+        setViewMode( QListView::IconMode );
+        setIconSize( QSize( 136, 136 ) );
+    }
     setFlow( QListView::LeftToRight );
     setWrapping( true );
     setMovement( QListView::Static );
@@ -105,7 +114,6 @@
     setUniformItemSizes( true );
     setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOff );
     setEditTriggers( QAbstractItemView::NoEditTriggers );
-    setIconSize( QSize( 136,136 ) );
     setSelectionMode( QAbstractItemView::SingleSelection );

     connect( this, SIGNAL( pressed( QModelIndex ) ),


make hash_value work on expired torrent_handles

git-svn-id: 6df6a9299d9fe08e1e18eb0c01ae615f7df02338@7647 a83610d8-ad2a-0410-a6ab-fc0612d85776

--- src/torrent_handle.cpp
+++ src/torrent_handle.cpp
@@ -988,7 +988,9 @@

 	std::size_t hash_value(torrent_handle const& th)
 	{
-		return std::size_t(th.m_torrent.lock().get());
+		// using the locked shared_ptr value as hash doesn't work
+		// for expired weak_ptrs. So, we're left with a hack
+		return std::size_t(*reinterpret_cast<void* const*>(&th.m_torrent));
 	}

 }


rpc: Compute number of confirmations of a block from block height

Currently this uses a CMerkleTx, but that makes no sense as we
have the CBlockIndex available. As noted by @jgarzik.

--- src/rpcblockchain.cpp
+++ src/rpcblockchain.cpp
@@ -54,9 +54,11 @@
 {
     Object result;
     result.push_back(Pair("hash", block.GetHash().GetHex()));
-    CMerkleTx txGen(block.vtx[0]);
-    txGen.SetMerkleBranch(&block);
-    result.push_back(Pair("confirmations", (int)txGen.GetDepthInMainChain()));
+    int confirmations = -1;
+    // Only report confirmations if the block is on the main chain
+    if (chainActive.Contains(blockindex))
+        confirmations = chainActive.Height() - blockindex->nHeight + 1;
+    result.push_back(Pair("confirmations", confirmations));
     result.push_back(Pair("size", (int)::GetSerializeSize(block, SER_NETWORK, PROTOCOL_VERSION)));
     result.push_back(Pair("height", blockindex->nHeight));
     result.push_back(Pair("version", block.nVersion));
@@ -242,7 +244,7 @@
             "\nResult (for verbose = true):\n"
             "{\n"
             "  \"hash\" : \"hash\",     (string) the block hash (same as provided)\n"
-            "  \"confirmations\" : n,   (numeric) The number of confirmations\n"
+            "  \"confirmations\" : n,   (numeric) The number of confirmations, or -1 if the block is not on the main chain\n"
             "  \"size\" : n,            (numeric) The block size\n"
             "  \"height\" : n,          (numeric) The block height or index\n"
             "  \"version\" : n,         (numeric) The block version\n"


fixed build with no deprecated functions

--- src/torrent_handle.cpp
+++ src/torrent_handle.cpp
@@ -296,12 +296,6 @@
 		TORRENT_ASYNC_CALL2(set_max_uploads, max_uploads, true);
 	}

-	void torrent_handle::use_interface(const char* net_interface) const
-	{
-		INVARIANT_CHECK;
-		TORRENT_ASYNC_CALL1(use_interface, std::string(net_interface));
-	}
-
 	int torrent_handle::max_connections() const
 	{
 		INVARIANT_CHECK;
@@ -515,16 +509,6 @@
 		TORRENT_ASYNC_CALL2(set_tracker_login, name, password);
 	}

-#ifndef TORRENT_NO_DEPRECATE
-#if !TORRENT_NO_FPU
-	void torrent_handle::file_progress(std::vector<float>& progress) const
-	{
-		INVARIANT_CHECK;
-		TORRENT_SYNC_CALL1(file_progress, boost::ref(progress));
-	}
-#endif
-#endif
-
 	void torrent_handle::file_progress(std::vector<size_type>& progress, int flags) const
 	{
 		INVARIANT_CHECK;
@@ -614,6 +598,20 @@

 #ifndef TORRENT_NO_DEPRECATE
 // ============ start deprecation ===============
+
+	void torrent_handle::use_interface(const char* net_interface) const
+	{
+		INVARIANT_CHECK;
+		TORRENT_ASYNC_CALL1(use_interface, std::string(net_interface));
+	}
+
+#if !TORRENT_NO_FPU
+	void torrent_handle::file_progress(std::vector<float>& progress) const
+	{
+		INVARIANT_CHECK;
+		TORRENT_SYNC_CALL1(file_progress, boost::ref(progress));
+	}
+#endif

 	int torrent_handle::get_peer_upload_limit(tcp::endpoint ip) const
 	{


Another change from boostcoin

Another change from boostcoin

--- src/rpcblockchain.cpp
+++ src/rpcblockchain.cpp
@@ -46,8 +46,21 @@

 double GetPoWMHashPS()
 {
-    if (pindexBest->nHeight >= LAST_POW_BLOCK)
-        return 0;
+    // code taken from boostcoin
+    if (GetBoolArg("-testnet")){
+        if (pindexBest->nHeight >= PoW1_End_TestNet && pindexBest->nHeight < PoW2_Start_TestNet){
+            return 0;
+        } else if (pindexBest->nHeight > PoW2_End_TestNet){
+            return 0;
+        }
+    }else {
+        if (pindexBest->nHeight >= PoW1_End && pindexBest->nHeight < PoW2_Start){
+            return 0;
+        } else if (pindexBest->nHeight > PoW2_End){
+            return 0;
+        }
+    }
+    // end code taken from boostcoin

     int nPoWInterval = 72;
     int64_t nTargetSpacingWorkMin = 30, nTargetSpacingWork = 30;


log time/customer

log time/customer

--- src/tracker/tracker.cc
+++ src/tracker/tracker.cc
@@ -9,6 +9,7 @@
 #include "tracker/tracker.h"
 #include <fnord/base/exception.h>
 #include <fnord/base/inspect.h>
+#include <fnord/base/wallclock.h>
 #include <fnord/net/http/cookies.h>
 #include "fnord/net/http/httprequest.h"
 #include "fnord/net/http/httpresponse.h"
@@ -140,8 +141,14 @@
     RAISEF(kRuntimeError, "invalid pixel version: $0", pixel_ver);
   }

-  auto pos = feed_->append(logline);
-  fnord::iputs("write to feed @$0 => $1", pos, logline);
+  auto feedline = fnord::StringUtil::format(
+      "$0|$1|$2",
+      customer->key(),
+      fnord::WallClock::unixSeconds(),
+      logline);
+
+  auto pos = feed_->append(feedline);
+  fnord::iputs("write to feed @$0 => $1", pos, feedline);
 }

 } // namespace cm


variable scope optimizations

variable scope optimizations

git-svn-id: c9a369146f666b9deda0c4af3838c8001dc825a8@1827 ce7aba0d-9f81-40a6-a495-cecae84b0515

--- src/trafficmanager.cpp
+++ src/trafficmanager.cpp
@@ -41,10 +41,6 @@
    _time(0), _warmup_time(-1), _drain_time(-1), _empty_network(false),
    _deadlock_counter(1), _sub_network(0)
 {
-  int s;
-  ostringstream tmp_name;
-  string sim_type, priority;
-
   _sources = _net[0]->NumSources( );
   _dests   = _net[0]->NumDests( );

@@ -61,6 +57,7 @@

   // ============ Message priorities ============

+  string priority;
   config.GetStr( "priority", priority );

   _classes = 1;
@@ -73,14 +70,17 @@
   } else if ( priority == "none" ) {
     _pri_type = none;
   } else {
-    Error( "Unknown priority " + priority );
-  }
-
+    cerr << "Unkown priority value: " << priority << "!" << endl;
+    Error( "" );
+  }
+
+  ostringstream tmp_name;
+
   // ============ Injection VC states  ============

   _buf_states = new BufferState ** [_sources];

-  for ( s = 0; s < _sources; ++s ) {
+  for ( int s = 0; s < _sources; ++s ) {
     tmp_name << "terminal_buf_state_" << s;
     _buf_states[s] = new BufferState * [_duplicate_networks];
     for (int a = 0; a < _duplicate_networks; ++a) {
@@ -96,7 +96,7 @@
   _qdrained           = new bool * [_sources];
   _partial_packets    = new list<Flit *> ** [_sources];

-  for ( s = 0; s < _sources; ++s ) {
+  for ( int s = 0; s < _sources; ++s ) {
     _qtime[s]           = new int [_classes];
     _qdrained[s]        = new bool [_classes];
     _partial_packets[s] = new list<Flit *> * [_classes];
@@ -134,7 +134,7 @@
     _active_vc   = new bool * [_sources];
   }

-  for ( s = 0; s < _sources; ++s ) {
+  for ( int s = 0; s < _sources; ++s ) {
     if ( _voqing ) {
       _voq[s]       = new list<Flit *> [_dests];
       _active_vc[s] = new bool [_dests];
@@ -237,6 +237,7 @@
   _routing_function  = GetRoutingFunction( config );
   _injection_process = GetInjectionProcess( config );

+  string sim_type;
   config.GetStr( "sim_type", sim_type );

   if ( sim_type == "latency" ) {
@@ -250,8 +251,8 @@
     _timed_mode = true;
   }
   else {
-    // FIXME: This adds two pointers, not two strings!
-    Error( "Unknown sim_type " + sim_type );
+    cerr << "Unknown sim_type value : " << sim_type << "!" << endl;
+    Error( "" );
   }

   _timed_mode = false;
@@ -390,9 +391,8 @@

 Flit *TrafficManager::_NewFlit( )
 {
-  Flit *f;
   //the constructor should initialize everything
-  f = new Flit();
+  Flit * f = new Flit();
   f->id    = _cur_id;
   _total_in_flight_flits[_cur_id] = f;
   map<int, Flit *>::iterator iter = _flits_to_watch.find(_cur_id);
@@ -413,7 +413,7 @@
   if ( match != _total_in_flight_flits.end( ) ) {
     _total_in_flight_flits.erase( match );
   } else {
-    cout << "Unmatched flit! ID = " << f->id << endl;
+    cerr << "Unmatched flit: " << f->id << "!" << endl;
     Error( "" );
   }

@@ -422,7 +422,7 @@
     if(match != _measured_in_flight_flits.end()) {
       _measured_in_flight_flits.erase(match);
     } else {
-      cout << "Unmatched measured flit! ID = " << f->id << endl;
+      cerr << "Unmatched measured flit: " << f->id << "!" << endl;
       Error( "" );
     }
   }
@@ -439,28 +439,21 @@
   }

   if ( f->head && ( f->dest != dest ) ) {
-    cout << "At output " << dest << endl;
-    cout << *f;
-    Error( "Flit arrived at incorrect output" );
+    cerr << "Flit " << f->id << " arrived at incorrect output " << dest << endl
+	 << *f;
+    Error( "" );
   }

   if ( f->tail ) {
     map<int, Flit *>::iterator iter = _total_in_flight_packets.find(f->pid);
     if ( iter == _total_in_flight_packets.end() ) {
-      cout << "Unmatched packet! ID = " << f->pid << endl;
+      cerr << "Unmatched packet: " << f->pid << "!" << endl;
       Error( "" );
     }
     _total_in_flight_packets.erase(iter);

     //code the source of request, look carefully, its tricky ;)
-    if (f->type == Flit::READ_REQUEST) {
-      Packet_Reply* temp = new Packet_Reply;
-      temp->source = f->src;
-      temp->time = _time;
-      temp->type = f->type;
-      _repliesDetails[f->id] = temp;
-      _repliesPending[dest].push_back(f->id);
-    } else if (f->type == Flit::WRITE_REQUEST) {
+    if (f->type == Flit::READ_REQUEST || f->type == Flit::WRITE_REQUEST) {
       Packet_Reply* temp = new Packet_Reply;
       temp->source = f->src;
       temp->time = _time;
@@ -497,7 +490,7 @@
       if ( f->record ) {
 	map<int, Flit *>::iterator iter = _measured_in_flight_packets.find(f->pid);
 	if ( iter == _measured_in_flight_packets.end() ){
-	  cout << "Unmatched measured packet! ID = " << f->pid << endl;
+	  cerr << "Unmatched measured packet: " << f->pid << "!" << endl;
 	  Error( "" );
 	}
 	_measured_in_flight_packets.erase(iter);
@@ -510,11 +503,11 @@
 int TrafficManager::_IssuePacket( int source, int cl ) const
 {
   int result;
-  int pending_time = INT_MAX; //reset to maxtime+1
   if(_sim_mode == batch){ //batch mode
     if(_use_read_write){ //read write packets
       //check queue for waiting replies.
       //check to make sure it is on time yet
+      int pending_time = INT_MAX; //reset to maxtime+1
       if (!_repliesPending[source].empty()) {
 	result = _repliesPending[source].front();
 	pending_time = _repliesDetails.find(result)->second->time;
@@ -553,6 +546,7 @@
     if(_use_read_write){ //use read and write
       //check queue for waiting replies.
       //check to make sure it is on time yet
+      int pending_time = INT_MAX; //reset to maxtime+1
       if (!_repliesPending[source].empty()) {
 	result = _repliesPending[source].front();
 	pending_time = _repliesDetails.find(result)->second->time;
@@ -583,17 +577,15 @@
 				      int cl, int time )
 {
   assert(stype!=0);
-  Flit *f;
-  bool record;
-  Flit::FlitType packet_type;
-  int size; //input size
-  int packet_destination = -1;

   //refusing to generate packets for nodes greater than limit
   if(source >=_limit){
     return ;
   }

+  Flit::FlitType packet_type = Flit::ANY_TYPE;
+  int size = gConstPacketSize; //input size
+  int packet_destination;
   if(_use_read_write){
     if(stype < 0) {
       if (stype ==-1) {
@@ -603,7 +595,8 @@
 	packet_type = Flit::WRITE_REQUEST;
 	size = _write_request_size;
       } else {
-	Error("Invalid packet type!");
+	cerr << "Invalid packet type: " << packet_type << "!" << endl;
+	Error( "" );
       }
       packet_destination = _traffic_function( source, _limit );
     } else  {
@@ -617,7 +610,8 @@
 	size = _write_reply_size;
 	packet_type = Flit::WRITE_REPLY;
       } else {
-	Error("Invalid packet type!");
+	cerr << "Invalid packet type: " << temp->type << "!" << endl;
+	Error( "" );
       }
       packet_destination = temp->source;
       time = temp->time;
@@ -627,23 +621,22 @@
     }
   } else {
     //use uniform packet size
-    packet_type = Flit::ANY_TYPE;
-    size =  gConstPacketSize;
     packet_destination = _traffic_function( source, _limit );
   }

   if ((packet_destination <0) || (packet_destination >= _net[0]->NumDests())) {
-    cout << "Packet destination " << packet_destination  << " for stype " <<packet_type << endl;
-    Error("Incorrect destination");
-  }
-
+    cerr << "Incorrect packet destination " << packet_destination
+	 << " for stype " << packet_type
+	 << "!" << endl;
+    Error( "" );
+  }
+
+  bool record = false;
   if ( ( _sim_state == running ) ||
        ( ( _sim_state == draining ) && ( time < _drain_time ) ) ) {
     record = true;
-  } else {
-    record = false;
   }

   _sub_network = DivisionAlgorithm(packet_type);
@@ -659,7 +652,7 @@
   }

   for ( int i = 0; i < size; ++i ) {
-    f = _NewFlit( );
+    Flit * f = _NewFlit( );
     f->pid = _cur_pid;
     f->watch |= watch;
     f->subnetwork = _sub_network;
@@ -737,33 +730,27 @@
 }

 void TrafficManager::_BatchInject(){
-  Flit   *f, *nf;
-  Credit *cred;
-  int    psize;
+
   // Receive credits and inject new traffic
   for ( int input = 0; input < _net[0]->NumSources( ); ++input ) {
     for (int i = 0; i < _duplicate_networks; ++i) {
-      cred = _net[i]->ReadCredit( input );
+      Credit * cred = _net[i]->ReadCredit( input );
       if ( cred ) {
         _buf_states[input][i]->ProcessCredit( cred );
         delete cred;
       }
     }

-    bool write_flit    = false;
-    int  highest_class = 0;
-    bool generated;
-
     for ( int c = 0; c < _classes; ++c ) {
       // Potentially generate packets for any (input,class)
       // that is currently empty
       if ( (_duplicate_networks > 1) || _partial_packets[input][c][0].empty() ) {
 	// For multiple networks, always try. Hard to check for empty queue - many subnetworks potentially.
-	generated = false;
+	bool generated = false;

 	if ( !_empty_network ) {
 	  while( !generated && ( _qtime[input][c] <= _time ) ) {
-	    psize = _IssuePacket( input, c );
+	    int psize = _IssuePacket( input, c );

 	    if ( psize ) {
 	      _GeneratePacket( input, psize, c,
@@ -789,15 +776,16 @@
     // Now, check partially issued packets to
     // see if they can be issued
     for (int i = 0; i < _duplicate_networks; ++i) {
-      write_flit = false;
-      highest_class = 0;
-     // Now just find which is the highest_class.
+      int highest_class = 0;
+      // Now just find which is the highest_class.
       for (short c = _classes - 1; c >= 0; --c) {
         if (_class_array[i][c]) {
           highest_class = c;
           break;
         }
       }
+      bool write_flit = false;
+      Flit * f;
       if ( !_partial_packets[input][highest_class][i].empty( ) ) {
         f = _partial_packets[input][highest_class][i].front( );
         if ( f->head && f->vc == -1) { // Find first available VC
@@ -817,7 +805,7 @@

 	  // Pass VC "back"
 	  if ( !_partial_packets[input][highest_class][i].empty( ) && !f->tail ) {
-	    nf = _partial_packets[input][highest_class][i].front( );
+	    Flit * nf = _partial_packets[input][highest_class][i].front( );
 	    nf->vc = f->vc;
 	  }
         }
@@ -834,33 +822,26 @@

 void TrafficManager::_NormalInject(){

-  Flit   *f, *nf;
-  Credit *cred;
-  int    psize;
   // Receive credits and inject new traffic
   for ( int input = 0; input < _net[0]->NumSources( ); ++input ) {
     for (int i = 0; i < _duplicate_networks; ++i) {
-      cred = _net[i]->ReadCredit( input );
+      Credit * cred = _net[i]->ReadCredit( input );
       if ( cred ) {
         _buf_states[input][i]->ProcessCredit( cred );
         delete cred;
       }
     }

-    bool write_flit    = false;
-    int  highest_class = 0;
-    bool generated;
-
     for ( int c = 0; c < _classes; ++c ) {
       // Potentially generate packets for any (input,class)
       // that is currently empty
       if ( (_duplicate_networks > 1) || _partial_packets[input][c][0].empty() ) {
       // For multiple networks, always flip coin because now you have multiple send buffers so you can't choose one only to check.
-	generated = false;
+	bool generated = false;

 	if ( !_empty_network ) {
 	  while( !generated && ( _qtime[input][c] <= _time ) ) {
-	    psize = _IssuePacket( input, c );
+	    int psize = _IssuePacket( input, c );

 	    if ( psize ) { //generate a packet
 	      _GeneratePacket( input, psize, c,
@@ -894,8 +875,7 @@
     // Now, check partially issued packets to
     // see if they can be issued
     for (int i = 0; i < _duplicate_networks; ++i) {
-      write_flit = false;
-      highest_class = 0;
+      int highest_class = 0;
       // Now just find which is the highest_class.
       for (short a = _classes - 1; a >= 0; --a) {
 	if (_class_array[i][a]) {
@@ -903,6 +883,8 @@
 	  break;
 	}
       }
+      bool write_flit = false;
+      Flit * f;
       if ( !_partial_packets[input][highest_class][i].empty( ) ) {
         f = _partial_packets[input][highest_class][i].front( );
         if ( f->head && f->vc == -1) { // Find first available VC
@@ -929,7 +911,7 @@

 	  // Pass VC "back"
 	  if ( !_partial_packets[input][highest_class][i].empty( ) && !f->tail ) {
-	    nf = _partial_packets[input][highest_class][i].front( );
+	    Flit * nf = _partial_packets[input][highest_class][i].front( );
 	    nf->vc = f->vc;
 	  }
         }
@@ -948,9 +930,6 @@
   if(_deadlock_counter++ == 0){
     cout << "WARNING: Possible network deadlock.\n";
   }
-
-  Flit   *f;
-  Credit *cred;

   if(_sim_mode == batch){
     _BatchInject();
@@ -981,7 +960,7 @@
   for (int i = 0; i < _duplicate_networks; ++i) {
     // Eject traffic and send credits
     for ( int output = 0; output < _net[0]->NumDests( ); ++output ) {
-      f = _net[i]->ReadFlit( output );
+      Flit * f = _net[i]->ReadFlit( output );

       if ( f ) {
         if ( f->watch ) {
@@ -996,7 +975,7 @@
 		      << "Injecting credit for VC " << f->vc << "." << endl;
         }

-        cred = new Credit( 1 );
+        Credit * cred = new Credit( 1 );
         cred->vc[0] = f->vc;
         cred->vc_cnt = 1;
 	cred->dest_router = f->from_router;
@@ -1124,19 +1103,6 @@

 bool TrafficManager::_SingleSim( )
 {
-  int  iter;
-  int  total_phases;
-  int  converged;
-  int  empty_steps;
-
-  double cur_latency;
-  double prev_latency;
-
-  double cur_accepted;
-  double prev_accepted;
-
-  bool   clear_last;
-
   _time = 0;
   //remove any pending request from the previous simulations
   for (int i=0;i<_sources;i++) {
@@ -1156,21 +1122,17 @@
     }
   }

-  iter            = 0;
-  converged       = 0;
-  total_phases    = 0;
-
   // warm-up ...
   // reset stats, all packets after warmup_time marked
   // converge
   // draing, wait until all packets finish
   _sim_state    = warming_up;
-  total_phases  = 0;
-  prev_latency  = 0;
-  prev_accepted = 0;
-
+
   _ClearStats( );
-  clear_last    = false;
+
+  bool clear_last = false;
+  int total_phases  = 0;
+  int converged = 0;

   if (_sim_mode == batch && _timed_mode){
     while(_time<_sample_period){
@@ -1178,10 +1140,9 @@
       if ( _time % 10000 == 0 ) {
 	cout << _sim_state << endl;
 	*_stats_out << "%=================================" << endl;
-	cur_latency = _latency_stats[0]->Average( );
-	int dmin;
+	double cur_latency = _latency_stats[0]->Average( );
 	double min, avg;
-	dmin = _ComputeStats( _accepted_flits, &avg, &min );
+	int dmin = _ComputeStats( _accepted_flits, &avg, &min );

 	cout << "Average latency = " << cur_latency << endl;
 	cout << "Accepted packets = " << min << " at node " << dmin << " (avg = " << avg << ")" << endl;
@@ -1199,10 +1160,9 @@
       if ( _time % 1000 == 0 ) {
 	cout << _sim_state << endl;
 	*_stats_out << "%=================================" << endl;
-	cur_latency = _latency_stats[0]->Average( );
-	int dmin;
+	double cur_latency = _latency_stats[0]->Average( );
 	double min, avg;
-	dmin = _ComputeStats( _accepted_flits, &avg, &min );
+	int dmin = _ComputeStats( _accepted_flits, &avg, &min );

 	cout << "Average latency = " << cur_latency << endl;
 	cout << "Accepted packets = " << min << " at node " << dmin << " (avg = " << avg << ")" << endl;
@@ -1213,7 +1173,7 @@
     }
     cout << "batch size of "<<_batch_size  <<  " sent. Time used is " << _time << " cycles" <<endl;
     cout<< "Draining the Network...................\n";
-    empty_steps = 0;
+    int empty_steps = 0;
     while( (_drain_measured_only ? _measured_in_flight_packets.size() : _total_in_flight_packets.size()) > 0 ) {
       _Step( );
       ++empty_steps;
@@ -1229,6 +1189,8 @@
   } else {
     //once warmed up, we require 3 converging runs
     //to end the simulation
+    double prev_latency = 0.0;
+    double prev_accepted = 0.0;
     while( ( total_phases < _max_samples ) &&
 	   ( ( _sim_state != running ) ||
 	     ( converged < 3 ) ) ) {
@@ -1239,15 +1201,15 @@
       }

-      for ( iter = 0; iter < _sample_period; ++iter ) { _Step( ); }
+      for ( int iter = 0; iter < _sample_period; ++iter ) { _Step( ); }

       cout << _sim_state << endl;
       *_stats_out << "%=================================" << endl;
-      cur_latency = _latency_stats[0]->Average( );
+      double cur_latency = _latency_stats[0]->Average( );
       int dmin;
       double min, avg;
       dmin = _ComputeStats( _accepted_flits, &avg, &min );
-      cur_accepted = avg;
+      double cur_accepted = avg;
       cout << "Average latency = " << cur_latency << endl;
       cout << "Accepted packets = " << min << " at node " << dmin << " (avg = " << avg << ")" << endl;
       *_stats_out << "lat(" << total_phases + 1 << ") = " << cur_latency << ";" << endl;
@@ -1335,7 +1297,7 @@
 	cout << "Draining all recorded packets ..." << endl;
 	_sim_state  = draining;
 	_drain_time = _time;
-	empty_steps = 0;
+	int empty_steps = 0;
 	while( _PacketsOutstanding( ) ) {
 	  _Step( );
 	  ++empty_steps;
@@ -1378,7 +1340,7 @@
     // Empty any remaining packets
     cout << "Draining remaining packets ..." << endl;
     _empty_network = true;
-    empty_steps = 0;
+    int empty_steps = 0;
     while( (_drain_measured_only ? _measured_in_flight_packets.size() : _total_in_flight_packets.size()) > 0 ) {
       _Step( );
       ++empty_steps;
@@ -1490,9 +1452,9 @@
 //read the watchlist
 void TrafficManager::_LoadWatchList(){
   ifstream watch_list;
+  watch_list.open(_watch_file.c_str());
+
   string line;
-  watch_list.open(_watch_file.c_str());
-
   if(watch_list.is_open()) {
     while(!watch_list.eof()) {
       getline(watch_list, line);


Debug fix

Debug fix

--- src/alphabeta.cpp
+++ src/alphabeta.cpp
@@ -283,9 +283,9 @@
         }
     }

+    uint8_t flag;
     if(info.tt)
     {
-        uint8_t flag;
         if(best_score <= alpha_original)
         {
             flag = UPPERBOUND;


Reuse a selector that has already been looked up. (Per feedback from @estollnitz.)

Former-commit-id: f0f8eefe46e8334b32da35c6ab1109be57d22413

--- src/runtime/metal.cpp
+++ src/runtime/metal.cpp
@@ -107,7 +107,7 @@
     if ((*method1)(buffer, sel_getUid("respondsToSelector:"), storage_mode_sel)) {
         typedef int (*storage_mode_method)(objc_id obj, objc_sel sel);
         storage_mode_method method = (storage_mode_method)&objc_msgSend;
-        int storage_mode = (*method)(buffer, sel_getUid("storageMode"));
+        int storage_mode = (*method)(buffer, storage_mode_sel);
         return storage_mode == 1; // MTLStorageModeManaged
     }
     return false;


Show the search result list view on maemo when several results are available.

svn path=/trunk/KDE/kdeedu/marble/; revision=1195334

--- src/lib/routing/RoutingWidget.cpp
+++ src/lib/routing/RoutingWidget.cpp
@@ -334,6 +334,11 @@
         d->m_widget->centerOn( GeoDataLatLonBox::fromLineString( placemarks ) );
         //d->m_ui.descriptionLabel->setVisible( false );
     }
+
+    if ( MarbleGlobal::getInstance()->profiles() & MarbleGlobal::SmallScreen ) {
+        d->m_ui.directionsListView->setVisible( placemarks.size() > 1 );
+        d->m_ui.directionsListView->setMinimumHeight( 200 );
+    }
 }

 void RoutingWidget::centerOnInputWidget( RoutingInputWidget *widget )


better logging

better logging

--- src/library/os/linux/os_linux.cpp
+++ src/library/os/linux/os_linux.cpp
@@ -22,10 +22,10 @@

 #ifdef USE_DISK_MODEL
 #define PARSE_ID_FUNC parse_disk_id
-#define ID_FOLDER "/dev/disk/by-id/"
+#define ID_FOLDER "/dev/disk/by-id"
 #else
 #define PARSE_ID_FUNC parseUUID
-#define ID_FOLDER "/dev/disk/by-uuid/"
+#define ID_FOLDER "/dev/disk/by-uuid"
 #endif
 #ifdef USE_DBUS
 #include <dbus-1.0/dbus/dbus.h>
@@ -148,7 +148,7 @@

 	DIR *disk_by_uuid_dir = opendir(ID_FOLDER);
 	if (disk_by_uuid_dir == nullptr) {
-		LOG_DEBUG("Open " ID_FOLDER " fail");
+		LOG_DEBUG("Open " ID_FOLDER " fail: %s", std::strerror(errno));
 	} else {
 		const std::string base_dir(ID_FOLDER "/");
 		while ((dir = readdir(disk_by_uuid_dir)) != nullptr && diskInfos.size() < MAX_UNITS) {
@@ -176,6 +176,8 @@
 						}
 					}
 					if (!found) {
+						LOG_DEBUG("Found disk inode %d device %s, sn %s", sym_stat.st_ino, tmpDiskInfo.device,
+								  dir->d_name);
 						diskInfos.push_back(tmpDiskInfo);
 					}
 				} else {
@@ -207,12 +209,12 @@
 					}
 				}
 			} else {
-				LOG_DEBUG("Stat %s for fail:F %s", cur_disk_label, std::strerror(errno));
+				LOG_DEBUG("Stat %s for fail:F %s", cur_disk_label.c_str(), std::strerror(errno));
 			}
 		}
 		closedir(disk_by_label);
 	} else {
-		LOG_DEBUG("Open %s for reading disk labels fail", label_dir);
+		LOG_DEBUG("Open %s for reading disk labels fail: %s", label_dir.c_str(), std::strerror(errno));
 	}

 	return result;


Modify sensing of Mac OS X.
PR:
Obtained from:
Submitted by:
Reviewed by:
PR:
Obtained from:
Submitted by:
Reviewed by:

git-svn-id: 95233098a850bdf68e142cb551b6b3e756f38fc7@172420 13f79535-47bb-0310-9956-ffa450edef68

--- src/util/AutoSense.hpp
+++ src/util/AutoSense.hpp
@@ -56,6 +56,17 @@

 /*
  * $Log$
+ * Revision 1.16  2000/10/09 18:15:43  jberry
+ * Modify sensing of Mac OS X.
+ * PR:
+ * Obtained from:
+ * Submitted by:
+ * Reviewed by:
+ * PR:
+ * Obtained from:
+ * Submitted by:
+ * Reviewed by:
+ *
  * Revision 1.15  2000/09/21 00:54:18  aruna1
  * OS2 related changes given by Bill Schindler
  *
@@ -175,7 +186,7 @@

 #elif defined(macintosh)
     #define XML_MACOS
-#elif defined(MACOSX)
+#elif defined(__APPLE__) && defined(__MACH__)
     #define XML_MACOSX
 #elif defined(__alpha) && defined(__osf__)
     #define XML_TRU64


zeroconf: fixing typo

zeroconf: fixing typo

Change-Id: I1f8b828dd5a2c1a9a10ef1dbb816854aa9a2f69e
Reviewed-by: Fawzi Mohamed <7388270c57edd0fabd71d8eb0322d66e3c40e57e@nokia.com>

--- src/libs/zeroconf/embeddedLib.cpp
+++ src/libs/zeroconf/embeddedLib.cpp
@@ -92,7 +92,7 @@
             QProcess killall;
             bool killAllFailed = false;
 #ifdef Q_OS_WIN
-            QString cmd = QLating1String("taskill /im ") + dPath.fileName()
+            QString cmd = QLatin1String("taskill /im ") + dPath.fileName()
                     + QLatin1String(" /f /t");
 #else
             QString cmd = QLatin1String("killall ") + dPath.fileName()


fix norm printing

fix norm printing

--- src/libshogunui/GUIClassifier.cpp
+++ src/libshogunui/GUIClassifier.cpp
@@ -748,7 +748,7 @@

 	SG_INFO("Set to weight_epsilon=%f.\n", svm_weight_epsilon);
 	SG_INFO("Set to C_mkl=%f.\n", svm_C_mkl);
-	SG_INFO("Set to mkl_norm=%d.\n", svm_mkl_norm);
+	SG_INFO("Set to mkl_norm=%f.\n", svm_mkl_norm);

 	return true;
 }