Best practice to initialize IoC contained instance
Use of var keyword in C#
Remove entire row in a file if first column is repeated I have a file containing two columns and 10 million rows. The first column contains many repeated values, but there is a distinct value in column 2. I want to remove the repeated rows and want to keep only one using awk. Note: the file is sorted with values in column 1. For example:    1.123 -4.0 2.234 -3.5 2.234 -3.1 2.234 -2.0 4.432 0.0 5.123 +0.2 8.654 +0.5 8.654 +0.8 8.654 +0.9 . . . .   Expected output  1.123 -4.0 2.234 -3.5 4.432 0.0 5.123 +0.2 8.654 +0.5 . . . . What's the easiest way to run GUI apps on Windows Subsystem for Linux as of 2018? I'm having some difficulty understanding how to interpret variable importance output from the Random Forest package. Mean decrease in accuracy is usually described as "the decrease in model accuracy from permuting the values in each feature".   Is this a statement about the feature as a whole or about specific values within the feature? In either case, is the Mean Decrease in Accuracy the number or proportion of observations that are incorrectly classified by removing the feature (or values from the feature) in question from the model?   Say we have the following model:  require(randomForest) data(iris) set.seed(1) dat &lt;- iris dat$Species &lt;- factor(ifelse(dat$Species=='virginica','virginica','other')) model.rf &lt;- randomForest(Species~., dat, ntree=25, importance=TRUE, nodesize=5) model.rf varImpPlot(model.rf)     Call:  randomForest(formula = Species ~ ., data = dat, ntree = 25,  proximity = TRUE, importance = TRUE, nodesize = 5)  Type of random forest: classification Number of trees: 25 No. of variables tried at each split: 2          OOB estimate of  error rate: 3.33% Confusion matrix:           other virginica class.error other        97         3        0.03 virginica     2        48        0.04     In this model, the OOB rate is rather low (around 5%). Yet, the Mean Decrease in Accuracy for the predictor (Petal.Length) with the highest value in this measure is only around 8.   Does this mean that removing Petal.Length from the model would only result in an additional misclassification of 8 or so observations on average?   How could the Mean Decrease in Accuracy for Petal.Length be so low, given that it's the highest in this measure, and thus the other variables have even lower values on this measure? Where is the Task Manager? List of lists changes reflected across sublists unexpectedly 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? Help me understand Support Vector Machines I understand the basics of what a Support Vector Machines' aim is in terms of classifying an input set into several different classes, but what I don't understand is some of the nitty-gritty details. For starters, I'm a bit confused by the use of Slack Variables. What is their purpose?  I'm doing a classification problem where I've captured pressure readings from sensors I've placed on the insole of a shoe. A subject will sit, stand, and walk for a couple of minutes while pressure data is recorded. I want to train a classifier to be able to determine whether a person is sitting, standing or walking and be able to do that for any future test data. What classifier type do I need to try? What is the best way for me to train a classifier from the data I've captured? I have 1000 entries for sitting, standing and walking (3x1000=3000 total), and they all have the following feature vector form. (pressurefromsensor1, pressurefromsensor2, pressurefromsensor3, pressurefromsensor4) Plotting complex numbers Drawing visibility polygons in Unity (for vision cones with occlusion) I'm currently trying to create an effect like the one displayed below in Unity:    However, it seems that I can't do this with any of Unity's built-in light objects, and I simply cannot find anything online that talks about this. Is there a way to achieve this in Unity? 2D or 3D solutions are fine, as I'm sure that they're both very similar to each other, Using ArcGIS 10.0, is it possible to reorder the fields in a file geodatabase, and have the order persisted to the database?  We considered exporting to XML, and writing a parser to change the field order, then re-creating a new database from the XML. This seems like a laborious process.  Another idea is to import the existing field definitionss into Excel, re-order them, export to CSV, then write a Python script to create these fields in a new Geodatabase. Does a script like this exist, before we write it from scratch?  Unfortunately the ArcGIS Diagrammer doesn't seem to support field re-ordering.  Are there any scripts or hacks we could use to simplify this process? How to know number of cores of a system in Linux? I wanted to find out how many cores my system has, so I searched the same question in Google. I got some commands such as the lscpu command. When I tried this command, it gave me the following result:  $ lscpu Architecture:          x86_64 CPU op-mode(s):        32-bit, 64-bit Byte Order:            Little Endian CPU(s):                4 On-line CPU(s) list:   0-3 Thread(s) per core:    1 Core(s) per socket:    4 Socket(s):             1 NUMA node(s):          1 Vendor ID:             GenuineIntel CPU family:            6 Model:                 23 Stepping:              10 CPU MHz:               1998.000 BogoMIPS:              5302.48 Virtualization:        VT-x L1d cache:             32K L1i cache:             32K L2 cache:              2048K NUMA node0 CPU(s):     0-3   In particular, this output shows:   CPU(s): 4 Core(s) per socket: 4 CPU family: 6   Which of those indicates cores of a Linux system?  Is there any other command to tell the number of cores, or am I assuming it is completely wrong? How do you give a C# auto-property an initial value?  I either use the constructor, or revert to the old syntax.    Using the Constructor:  class Person  {     public Person()     {         Name = "Initial Name";     }     public string Name { get; set; } }   Using normal property syntax  (with an initial value)  private string name = "Initial Name"; public string Name  {     get      {         return name;     }     set     {         name = value;     } }   Is there a better way? This  shows the dual cone of $K = \{(x,t) \mid \| \boldsymbol{x} \|_1 \le t \}$ is $K^{*} = \{(x,t) \mid  \| \boldsymbol{x} \|_{\infty} \le t\}$. Is it right? How is it proved? How can I change the registered name in Windows 7 to my own? When should static_cast, dynamic_cast, const_cast and reinterpret_cast be used? What are the proper uses of:   static_cast dynamic_cast const_cast reinterpret_cast C-style cast (type)value Function-style cast type(value)   How does one decide which to use in which specific cases? In the context of boiling water for pasta or other purposes, all over the Internet the advise is oft-repeated that salt should not be added to the water when it is cold in order to prevent damage to the pot such as pitting over long term use.  The reasoning is that the salt stays on the bottom of the pot for longer without dissolving, and has a chance to interact with the surface metal.  Is there any objective evidence--preferably scientifically based--that this phenomenon actually occurs in practical kitchen-type conditions, or is this another piece of common wisdom that is often shared but not backed by evidence, much like  common wisdom that it is necessary to use very large volumes of water to cook pasta? as of 4/2015 OS X Kindle App: Where are the books located? After I updated my Kindle for Mac app 2 mos. ago I can no longer find the azw book files on my Mac to convert them so I can read them on my KOBO ereader. I use to find them in a My Kindle Content file but that has disappeared. I have Ult. DRM &amp; Calibre but they won't work without the azw files, and I can't find them on my mac anymore. Can anyone help me? The answers on this site about this are years old &amp; do not apply to my problem. Can two PS4s log in to the same PSN account? Both myself and my boyfriend have PS4s.  Can I just get a single PSN account and sign both consoles into the same account, or do I need to get two separate accounts? Trouble creating 3TB ext4 partition due to msdos-partition-table-imposed error Following discussion , what constitutes a weapon damage die?  Is it any damage die dealt by the weapon? For example, consider a  longsword.     While the sword is ablaze, it deals an extra 2d6 fire damage to any target it hits.   What are the weapon damage dice? Just the 1d8 from the longsword? Or do the 2d6 Fire damage also count? Splitting ethernet cable I have one ethernet cable that runs into my TV cabinet. It comes from a router in my closet. The router splits the main feed into the home into six runs that run through out the house. I now have several components in my TV cabinet that work best if they are connected to a hard line and not WiFi. Can I split the one cable in my TV cabinet into three or four lines to run to these other components, i.e.: playstation, Receiver,TV antenna box etc. If so, what items do I need to purchase? Thanks for your help.