Momentum of light in medium
Photon energy - momentum in matter
Captured variable in a loop in C# I met an interesting issue about C#. I have code like below.  List&lt;Func&lt;int&gt;&gt; actions = new List&lt;Func&lt;int&gt;&gt;();  int variable = 0; while (variable &lt; 5) {     actions.Add(() =&gt; variable * 2);     ++ variable; }  foreach (var act in actions) {     Console.WriteLine(act.Invoke()); }   I expect it to output 0, 2, 4, 6, 8. However, it actually outputs five 10s.  It seems that it is due to all actions referring to one captured variable. As a result, when they get invoked, they all have same output.  Is there a way to work round this limit to have each action instance have its own captured variable? How do I pack textures for sending off to a render farm Whenever i try to send a project off to a render farm such as sheepit, it says it needs the textures packing with the file in order to render correctly.  How would I do this? How do I select an object in the 3D viewport? I am trying to select the cube that in the middle of the scene. How can I select it? All I see is a crosshair appearing everywhere I click. Is this a bug? Create WiFi hotspot with web access point I want to setup a WiFi network with access through a web interface. Essentially people would be asked to enter a username/password and their session would be valid for X minutes after which they'd be logged out.  I am capable of quite a few programming/scripting languages, but browsing through router settings I don't see how to/where hosted/etc. the web interface/session handling comes in.  Please push me the right direction. 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) How do I reset GNOME to the defaults? I was playing around with some settings, and now I need to reset GNOME to it's defaults - how do I do that? What's the nice 'trick' to showing that the following expression is irrational?  $2^{1/3} + 2^{2/3}$ Use a LookUp field in a Calculated Column To be truly standards-compliant, must all functions in C (except for main) have a prototype, even if they are only used after their definition in the same translation unit? Why do we use ./filename to execute a file in linux?  Why not just enter it like other commands gcc, ls etc... I host am ExpressionEngine based website on a single Amazon EC2 instance in the US East (Virginia) region. I use Ubuntu.    The website allows members to post their content, and displays it for other members and for users who are not logged in.   Goal: I need to begin serving the same website across the globe, equally fast to Hong Kong, New York, and Los Angeles.   I considered two solutions:  1.Setting up three separate EC2 instances for three regions: Virginia, Oregon, and Singapore. Use Amazon Rot53 Geo Location to direct traffic to instances based on the browser's IP address.   Pro: the website will load fast for the region.   Contra: these will be essentially three separate websites. Unless I am mistaken?   Setting up one instance in a region equally remote from all three locations: (Ireliand), and boost the server to the highest performance available.    Pro: It will be the same website for all regions.   Contra: it will cost a lot to make it fast enough.   My challenges:   a) I do not know a way to sync server settings, database, and content between multiple Ubuntu instances in real time. If a knowledgeable person could explain to me how to do that, I would be most grateful.   b) I am not thoroughly familiar with all Amazon AWS resources. Does AWS has a built-in method that would allow me to achieve my goal of serving a single PHP / MySQL based membership website across the globe equally fast in all three chosen locations? Split Data Based on Year in a Visual force Page PDF natbib: combining chicago style and sorting by appearance Simple homework question about normally distributed variables The question states:      Consider a set of random variables $X_i$, where $i=1,...n$. Each $X_i$ is   normally distributed with mean $0$ and variance $1$, i.e. $X_i$ are $\mathcal N(0,1)$.   What is the mean and the variance of the random variable $Y$, where   $Y=X_1+...+X_n$.   How do I do this? How to show $\sum_{k=0}^{n}\binom{n+k}{k}\frac{1}{2^k}=2^{n}$ In Java, you can qualify local variables and method parameters with the final keyword.  public static void foo(final int x) {   final String qwerty = "bar";  }   Doing so results in not being able to reassign x and qwerty in the body of the method.  This practice nudges your code in the direction of immutability which is generally considered a plus. But, it also tends to clutter up code with "final" showing up everywhere. What is your opinion of the final keyword for local variables and method parameters in Java? How are second order nonlinear ordinary differential equations solved? Seeing that Defense Against the Dark Arts is a crucial subject, both in Harry's life as well as a part of the school-going wizard's curriculum, it must be in the hands of a good professor.   Is it known who Minerva McGonagall appointed as DADA prof. once she was made Headmistress. Was it someone we know or was it just a random powerful wizard. Is there any information about this available? Probability of lim sup, lim inf for sequence of random variables. Maybe this is extremely simple, but i havent found a specific answer for this online.  For a sequence of independent continuous random variables $X_n$ ,$n=1,2,3,...$ , all with the same probability density function $f(x)&gt;0$ for all real $x$, and a specific real number $b$, what do the following events mean in simple terms and what is the probability of each?  a)$\lim_n\sup\{X_n \gt b\}$ b)$\lim_n\inf\{X_n \gt b\}$ c)$\lim_n\sup\{X_n \le b\}$ d)$\lim_n\inf\{X_n \le b\}$ nth fibonacci number in sublinear time