I have a list of objects of a class with a string &quot;name&quot;. I need to create a new string array of all &quot;name&quot; values of the objects in the list. Is that possible using linq? Can I also filter our some of the objects in the list by a different string variable of the class? As in getting an array of the values of 'name' where 'category'=&quot;something&quot;. public class druhPrace     {         public string category;         public string name;         public double workPrice;          public druhPrace(string category, string name, double workPrice)         {                      //...         }     } }
I'm trying to use Linq to return a list of ids given a list of objects where the id is a property. I'd like to be able to do this without looping through each object and pulling out the unique ids that I find.  I have a list of objects of type MyClass and one of the properties of this class is an ID.  public class MyClass {   public int ID { get; set; } }   What I want to do is write a Linq query to return me a list of those Ids  How do I do that given an IList&lt;MyClass&gt; such that it returns an IEnumerable&lt;int&gt; of the ids?  I'm sure it must be possible to do it in one or two lines using Linq rather than looping through each item in the MyClass list and adding the unique values into a list.  Any help in creating an elegant solution would be much appreciated!
Polling the keyboard (detect a keypress) in python How can I poll the keyboard from a console python app?  Specifically, I would like to do something akin to this in the midst of a lot of other I/O activities (socket selects, serial port access, etc.):     while 1:       # doing amazing pythonic embedded stuff       # ...        # periodically do a non-blocking check to see if       # we are being told to do something else       x = keyboard.read(1000, timeout = 0)        if len(x):           # ok, some key got pressed           # do something   What is the correct pythonic way to do this on Windows?  Also, portability to Linux wouldn't be bad, though it's not required. How can I get my external IP address in a shell script? I need to find my external IP address from a shell script. At the moment I use this function:   myip () {      lwp-request -o text checkip.dyndns.org | awk '{ print $NF }' }   But it depends on perl-libwww, perl-html-format, perl-html-tree installed. What other ways can I get my external IP? What do you call someone who pretends to be your friend but is actually your enemy?  A friend suggested spy for me, but that does not nearly describe the word I need for an English project. The character is very good at manipulating how people see him. He's a good liar. And pretends to be your friend but actually is your enemy. How do I "replay" the "Caveats" section from a homebrew recipe multiplication equivalent of the summation symbol I was curious (even though this is a very amateur question)... what would the multiplication equivalent of sigma (the summation symbol) be? $$\sum$$ I want to do a series of multiplication of terms.... instead of addition... How can I compute the following limit, and is there a general method to resolve problems of this type?  $$\lim_{x\to\infty}x\left[\left(1+\frac{1}{x}\right)^x-e\right]$$ What are the odd of a single coin toss after many consecutive ones? I have little knowledge of probability and have recently been thinking of a math problem I am sure you guys could answer  If for example I tossed a coin ten times and got all heads, would the odds of the next coin toss beeing heads be 50 50 or s very low as the odds of getting 11 in a row is tiny?   Thanks I´m posting this because I have some active questions in SO and I´m leaving for the weekend and wont have internet until monday or tuesday.  SO is a very active site and I hate no to answer/thank/comment people who are kind enough to answer my questions.  I think an "away" indicator like an out of office reply would be a really nice feature to add for "politeness" sake. How do you prevent web pages from appearing in the Google search index? Will wolves attack Ocelots? Will wolves attack and kill ocelots in Minecraft? I know they kill sheep. I just don't want my cats being eaten. Breaking single polygon into multiple polygons? I created voronoi polygons after which I dissolved them on the basis of one attribute. Now there are cases where in for one single attribute "abc" I have3 polygons at different places with same object id. I would like to break these into 3 polygons as they are at different locations.  Is there any tool in ArcGIS Desktop or QGIS which can help me in doing that? Is it safe to disable System Integrity Protection? While using OS X El Capitan 10.11.x, is it safe to disable System Integrity Protection? There are all these additional apps that modify folders and the dock that I want to install but you have to disable rootless first.  Good idea or bad idea? Django templates offer the builtin tag cycle for alternating between several values at different points in a template (or for loop in a template) but this tag does not reset when it is accessed in a scope outside of the cycles definition.  I.e., if you have two or more lists in your template, the rows of all of which you'd like to use some css definitions odd and even, the first row of a list will pick up where the last left off, not with a fresh iteration from the choices (odd and even)  E.g., in the following code, if the first blog has an odd number of entries, then the first entry in a second blog will start as even, when I want it to start at odd.  {% for blog in blogs %}   {% for entry in blog.entries %}     &lt;div class="{% cycle 'odd' 'even' %}" id="{{entry.id}}"&gt;       {{entry.text}}     &lt;/div&gt;   {% endfor %} {% endfor %}   I've tried obviating this by patching with the resetcycle tag offered here:    to no avail.  (The code didn't work for me.)  I've also tried moving my inner loop into a custom tag, but this also did not work, perhaps because the compile/render cycle moves the loop back into the outer loop?  (Regardless of why, it didn't work for me.)  How can I accomplish this simple task!?  I'd prefer not to create a data structure in my view with this information pre-compiled; that seems unnecessary.  Thanks in advance. Proving that $AB-BA=cI$ for nontrivial $c \in \mathbb{C}$ I have a homework question I can`t solve:  Let $X$ be a normed linear space, $A,B \in B(X)$. Show that there exists no nontrivial $c \in \mathbb{C} $ such that $AB-BA=cI$.  Thanks alot already guys! I seem to have a professor who gives impossible homework problems.  The hint he gave: $A^{n}B-BA^{n}=ncA^{n-1}$, $n \in \mathbb{N}$ I can't seem to edit and save config files in the root system (eg: /etc/dhcp/dhcpd.config); it just says "permission denied" or the save option is blocked in the text editor.  I'm pretty sure I'm a root user, but how do I make sure? If I am a root user, how do I fix this? Simple way to see a list of installed iOS apps with their storage space size? how to pass a value to a variable that in a other variable I am getting a "bad substitution" error while running this code. I want to print the values in h_1, h_2, h_3with a for loop.  #/!/bin/bash h_1=12 h_2=13 h_3=14 for ((i=1; i&lt;=2; i++))  do   echo "${h_$i}" done How to insert an item into an array at a specific index (JavaScript)? I am looking for a JavaScript array insert method, in the style of:  arr.insert(index, item)   Preferably in jQuery, but any JavaScript implementation will do at this point. Max Serial Cable Length? What is the maximum length of serial cable I can use, to connection work properly? Is length of serial cable in connection with baud rate? I am using about 5 meter cable at speed 38400 bauds and RS232 communication, is it too long? No CUDA and GPU option I have Blender 2.73a with AMD Radeon 3100 Graphics. I saw  on how to make cycles render faster. It says when I go to User Preferences> System> Compute Device, It has no CUDA option, which means there is no GPU option. How can I fix this?