I have a piece of code that should be updating a single item in a list but instead updates the entire list.   Here is the code  a = [   [(0, 0), (3, 4)] ] board = [[0] * 5] * 5  for solution in a:     for _x, _y in solution:         board[_x][_y] = 1  print(board)   Expected output:  1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0   Actual output:  1 0 0 0 1  1 0 0 0 1  1 0 0 0 1  1 0 0 0 1  1 0 0 0 1
I needed to create a list of lists in Python, so I typed the following: my_list = [[1] * 4] * 3  The list looked like this: [[1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1]]    Then I changed one of the innermost values: my_list[0][0] = 5  Now my list looks like this: [[5, 1, 1, 1], [5, 1, 1, 1], [5, 1, 1, 1]]    which is not what I wanted or expected. Can someone please explain what's going on, and how to get around it?
How do I bake/add material colors onto my UVmap? I looked everywhere from tutorials to documents and either they only talk about texturing or they are doing the tutorial in 'blender render' when I need it in 'cycles render'.   I have a cube that is toon shaded red. And as you can see it is unwrapped to show the map.    Now I would like to add the color that's on the cube onto the map.   As you can see at the bottom of the image that I created a new image called 'untitled'. Now the next step of baking the colors onto the map is where I become lost. Regardless of which 'Bake Type' that I used, I keep getting error messages like: No valid selected objects.  Everything looks selected to me. No, I am not new to Blender but I am new to color baking. Thank you for any help provided; I used a simple cube first before using other models I already created. As the question title suggests, how do I see that every left ideal of a square matrix ring over a field is principal? Is there a Windows standard way to do things such as "start fan", "decrease speed" or the like, from C/C++?  I have a suspicion it might be ACPI, but I am a frail mortal and cannot read that kind of documentation.  Edit: e.g. Windows 7 lets you select in your power plan options such as "passive cooling" (only when things get hot?) vs. "active cooling" (keep the CPU proactively cool?). It seems the OS does have a way to control the fan generically. Which "mean" to use and when? So we have arithmetic mean (AM), geometric mean (GM) and harmonic mean (HM). Their mathematical formulation is also well known along with their associated stereotypical examples (e.g., Harmonic mean and it's application to 'speed' related problems).  However, a question that has always intrigued me is "how do I decide which mean is the most appropriate to use in a given context?" There must be at least some rule of thumb to help understand the applicability and yet the most common answer I've come across is: "It depends" (but on what?).  This may seem to be a rather trivial question but even high-school texts failed to explain this -- they only provide mathematical definitions!  I prefer an English explanation over a mathematical one -- simple test would be "would your mom/child understand it?" $\lim\limits_{n\to \infty} \int_0^1 |f(x)-a_nx-b_n| dx=0$ implies $(a_n)_n,(b_n)_n$ are convergent Let $f:[0,1] \to \mathbb R$ be a continuous function and the sequences $(a_n)_n,(b_n)_n$ s.t. $$\lim_{n\to \infty}  \int_0^1 |f(x)-a_nx-b_n| dx=0.$$ Prove that $(a_n)_n,(b_n)_n$ are convergent.   I know that $$\left|\int_0^1f(x)dx\right| \le \int_0^1|f(x)|dx.$$ Can somebody help me, please? In unix server grep -r option is not working. OS is HP-UX.  If grep -r is not working any alternative way to do recursive search without -r option? How to find application's path from command line? For example, I have git installed on my system. But I don't remember where I installed it, so which command is fit to find this out? I have eight independent variables and one dependent.  I have run a correlation matrix, and 5 of them have a low correlation with the DV.  I have then run a stepwise multiple regression to see whether any/all of the IVs can predict the DV.  The regression showed that only two IVs can predict the DV (can only account for about 20% of the variance though), and SPSS removed the rest from the model.  My supervisor reckons that I have not run the regression correctly, as due to the strength of the correlations, I should have found more predictors in the regression model. But the correlations were tiny, so my question is: if IVs and the DV hardly correlate, can IVs still be good predictors of the DV? Edit - Original Title: Is there an alternative way to achieve border-collapse:collapse in CSS (in order to have a collapsed, rounded corner table)?  Since it turns out that simply getting the table's borders to collapse does not solve the root problem, I have updated the title to better reflect the discussion.  I am trying to make a table with rounded corners using the CSS3 border-radius property. The table styles I'm using look something like this:  table {     -moz-border-radius:10px;     -webkit-border-radius:10px;     border-radius:10px }   Here's the problem. I also want to set the border-collapse:collapse property, and when that is set border-radius no longer works. Is there a CSS-based way I can get the same effect as border-collapse:collapse without actually using it?  Edits:  I've made a simple page to demonstrate the problem  (Firefox/Safari only).  It seems that a large part of the problem is that setting the table to have rounded corners does not affect the corners of the corner td elements. If the table was all one color, this wouldn't be a problem since I could just make the top and bottom td corners rounded for the first and last row respectively. However, I am using different background colors for the table to differentiate the headings and for striping, so the inner td elements would show their rounded corners as well.  Summary of proposed solutions:  Surrounding the table with another element with round corners doesn't work because the table's square corners "bleed through."  Specifying border width to 0 doesn't collapse the table.  Bottom td corners still square after setting cellspacing to zero.  Using JavaScript instead- works by avoiding the problem.  Possible solutions:  The tables are generated in PHP, so I could just apply a different class to each of the outer th/tds and style each corner separately. I'd rather not do this, since it's not very elegant and a bit of a pain to apply to multiple tables, so please keep suggestions coming.  Possible solution 2 is to use JavaScript (jQuery, specifically) to style the corners. This solution also works, but still not quite what I'm looking for (I know I'm picky). I have two reservations:    this is a very lightweight site, and I'd like to keep JavaScript to the barest minimum  part of the appeal that using border-radius has for me is graceful degradation and progressive enhancement. By using border-radius for all rounded corners, I hope to have a consistently rounded site in CSS3-capable browsers and a consistently square site in others (I'm looking at you, IE).   I know that trying to do this with CSS3 today may seem needless, but I have my reasons. I would also like to point out that this problem is a result of the w3c specification, not poor CSS3 support, so any solution will still be relevant and useful when CSS3 has more widespread support. Reputation does not update after community wiki is removed from a post, and does not match the value displayed in the reputation audit If votes were cast on a post while it was community wiki, and a moderator removes wiki from that post, the votes should count towards reputation again. However, while this is visible in a reputation audit, , and the reputation score needs to be recalculated to reflect the change.  Can someone fix this? Removing clock from the lock-screen I'm using Ubuntu 18.04.  I want to remove the digital clock from the lock screen because I just want to see a good wallpaper there, unobstructed.   How do I go about this? Why do I not see evidence of discrete energy in the spectrum? The electromagnet spectrum looks to be continuous, yet energy is discrete. Shouldn't one see evidence of the electron's "quantum leap"? What's going on?     Moderator, please size my photo. Thank you. Allowing all/different file type uploads Confused AUC ROC score I am working on binary classification problem, I try to evaluate the performance of some classification algorithms (LR,Decission Tree , Random forest ...). I am using  a cross validation technique (to avoid over-fitting) with AUC ROC as scoring function to compare the performance of the algorithms, but I am getting a weird results with Random forest and AdbBoost, I have a perfect AUC_ROC score (i.e. =1) despite the fact that the recall(TPR) and FPR of this algorithms are different from 1 and 0 respectively .  def FPR(y_true, y_pred):     tn, fp, fn, tp = confusion_matrix(y_true, y_pred).ravel()     result = fp / (fp+tn)     return result def FNR(y_true, y_pred):     tn, fp, fn, tp = confusion_matrix(y_true, y_pred).ravel()     result = fn / (tp+fn)     return result FPR_scorer = make_scorer(FPR) FNR_scorer = make_scorer(FNR)     def get_CrossValResults2(model,cv_rst,bestIndx):     best=pd.DataFrame.from_dict(cv_rst).iloc[bestIndx]     roc=&quot;{:.12f}&quot;.format(best['mean_test_roc_auc'])     acc =&quot;{:.0%}&quot;.format(best['mean_test_accuracy'])     prec =&quot;{:.0%}&quot;.format(best['mean_test_precision'])     rec =&quot;{:.0%}&quot;.format( best['mean_test_recall'])     f1 =&quot;{:.0%}&quot;.format(best['mean_test_f1'])     r2=&quot;{:.2f}&quot;.format(best['mean_test_r2'])     g_mean=&quot;{:.2f}&quot;.format(best['mean_test_gmean'])     pr_auc=&quot;{:.8f}&quot;.format(best['mean_test_pr'])     fnr=&quot;{:.0%}&quot;.format(best['mean_test_fnr'])     fpr=&quot;{:.0%}&quot;.format(best['mean_test_fpr'])     rst = pd.DataFrame([[ model, acc,prec,rec,fpr,fnr,f1,roc,pr_auc,g_mean,r2]],columns = ['Model', 'Accuracy', 'Precision', 'Recall','FPR','FNR', 'F1-Score','ROC_auc','PR_auc','gmean','r2'])     return rst        cross_val_rst = pd.DataFrame(columns = ['Model', 'Accuracy', 'Precision', 'Recall','FPR','FNR', 'F1-Score','ROC_auc','PR_auc','gmean','r2'])              scoring = {'accuracy':'accuracy','recall':'recall','precision':'precision','fpr':FPR_scorer,'fnr':FNR_scorer,'f1':'f1' ,'roc_auc':'roc_auc','pr':'average_precision','gmean':Gmean_scorer,'r2':'r2'}     param_grid = {'n_estimators': [200],               'max_depth': [80,90],               'min_samples_leaf': [2,3, 4],             'min_samples_split': [2,5,12],             'criterion': [ 'gini'],              'class_weight' : [class_weights], 'n_jobs' : [-1]}  clf = GridSearchCV(RandomForestClassifier(class_weight=class_weights), param_grid, cv=kfold,scoring=scoring,refit=refit)#Fit the model bestmodel = clf.fit(X,Y)       cross_val_rst = cross_val_rst.append(get_CrossValResults2(model='Random Forrest',bestIndx=bestmodel.best_index_,cv_rst=bestmodel.cv_results_),ignore_index=True) 101 positive integers placed on a circle A Pigeonhole Principle problem:     101 positive integers are placed on a circle whose sum is 300. Prove   that it is possible to choose from these numbers some consecutive   numbers whose sum is equal to 200.   (I don't know if the word 'consecutive' is appropriate in this case ,I mean that these numbers follow each other on that circle) How to fix AppArmor `could not open` error when installing php+mysql? I have a small question regarding using sudo with output redirect &gt;. To enable IP forwrding, someone can use the command:  echo 1 &gt; /proc/sys/net/ipv4/ip_forward   Executing this command will give permission denied as it requires root privileges. However, executing the same command with sudo gives also permission denied error! It seems that output redirect &gt; does not inherit the permissions of the preceding command echo. Is this right?  As a workaround I do:  echo 1 | sudo tee /proc/sys/net/ipv4/ip_forward   Is this the best way to do it? Am I missing something?  Please, note that this is an example and it applies to all commands that use output redirect. Let us say I have added a PPA that has X package that I want but it also has Y package that I do not want to use or receive updates from. How can I, from the same PPA, receive updates for a specific package but deny updates from the same PPA for other packages.  A step by step example would be good since this has happened to me in several PPAs that have a particular package I want but also add a whole bunch of others that I do not yet want to update. If the universe is expanding, what is it expanding into? javascript not working, working on fiddle but not on my webserver