I have recently started off with LINQ and its amazing. I was wondering if LINQ would allow me to apply a function - any function - to all the elements of a collection, without using foreach. Something like python lambda functions.  For example if I have a int list, Can I add a constant to every element using LINQ  If i have a DB table, can i set a field for all records using LINQ.  I am using C#
I'd like to do the equivalent of the following in LINQ, but I can't figure out how:  IEnumerable&lt;Item&gt; items = GetItems(); items.ForEach(i =&gt; i.DoStuff());   What is the real syntax?
This was working perfectly on 17.10 but after upgrading to 18.04 yesterday, when the lid is closed the screen turns off but doesn't suspend properly.  I travel around a lot and immediately noticed the heat (and battery draining) when taking it out of the travel case.  I've tried uncommenting these lines in /etc/systemd/logind.conf  HandleLidSwitch=suspend HandleLidSwitchDocked=suspend   and restarted but didn't make any difference. How can I improve my color selection skill? I'm a web developer, started to become a web designer. However, I think my understanding of colors is not practical yet. There are tools out there that can give you color harmonies, and more stuff, like , but they don't give you the start point. I mean, how should I know that for this web site, I'd better use green and for that website, choose red. How should I know that?  I think color selection is more like an art, instead of being a science, and I'm like "you should become an color artist, in order to become a web designer".  How can I improve my color selection skill? tl;dr  Due to the special nature of Meta and the high rate of "lost souls", should we try out the Ask a Question Wizard here on Meta Stack Exchange too?  General idea  In case anyone doesn't know yet, . It guides new users towards writing better questions.  I think that such a question wizard would be useful on Meta Stack Exchange too, for three main reasons:   . There are four types of questions on Meta, each represented by the different required tags: , ,  and . Especially bug reports can often be split into a certain structure (what's wrong, how to reproduce, why I think it's wrong, examples). The same holds true for feature requests. Such a structure is ideal for a question wizard. Quite a few users  and . While the Meta community is well prepared to deal with these posts quickly, they lead to an less-than-ideal first impression by the new users and they distract the community from more important issues. Site-specific questions are often off-topic. This  since nowhere is it hinted at in the help pages (and there are a lot of old, not-yet-closed SO-specific questions from a prior era of this site) and can lead to unnecessary drama. If we add an honeypot into the wizard to catch this case (and ideally redirect them to the proper meta site), we could prevent this.   As Sonic said, there's an  new users need to read and confirm. However this doesn't really prove effective right now and we might need to try stronger tools (e.g. question wizard).  Therefore I think that we should test the Ask Question Wizard here on Meta too.  Implementation details (help welcome)  I think the wizard should have six main entry points:   I want to discuss a specific post or action from any Stack Exchange site. (-> honeypot, redirects to the appropriate per-site meta) I have a question regarding the use of Stack Exchange sites (-> support mode) I think I found a bug while using the Stack Exchange sites  (-> bug mode) I have an idea for improving the Stack Exchange sites  (-> feature request mode) I have a discussion I want to start about Stack Exchange communities or their rules  (-> discussion mode) I have some other (e.g. programming) question  (-> honeypot, redirects to )   Coming from these choices, the user would either be redirected to a landing page explaining, why this is not the right community and offering some alternative choices or they would follow the guided assistant.  For 1. the user might be asked on which site the post/action is. Maybe the system could show the three sites where the user was recently active/has the highest reputation on.  support mode would ask the user for these details:   what do you want to achieve? what have you tried? what is your current problem?   bug mode would ask the user for these details:   bug description how to reproduce the problem why do you think that this is wrong? (possibly) examples   feature request mode would ask the user for these details:   what is your goal? how do you think could this be achieved? why will the community benefit from this change? (possibly) details   discussion mode would ask the user for these details:   which rule do you want to propose/clarify (optionally) examples/why is this rule required?   Note: the above implementation details probably require some revision. Feel free to edit/suggest improvements for both wording and details. how to play wav file in python? How to limit Docker total resources? I'm trying to limit the total resources accessible from docker (for example only 90% of the RAM and 1500% of the CPU). I cannot use CPU and RAM limit when I'm launching my containers, that's why I need to limit the total resources available for docker containers.  I have around 20 containers which can consume the maximum CPU and memory but not at the same time, so I cannot set the CPU and RAM limit, that's why I need to limit the total resource used by docker  First of all I've created a slice: I tried the instruction above, but impossible to limit both the RAM and the CPU usage  # /etc/systemd/system/docker_limit.slice [Unit] Description=Slice that limits docker resources Before=slices.target  [Slice] CPUAccounting=true CPUQuota=700% #Memory Management MemoryAccounting=true MemoryHigh=20G MemoryMax=25G MemoryMaxSwap=10G   And my daemon.json  {   "insecure-registries" : [ "url1", "url2"],   "cgroup-parent": "docker_limit.slice" }   But when I try from a container:  stress --vm-bytes $(awk '/MemAvailable/{printf "%d\n", $2 * 0.9;}' &lt; /proc/meminfo)k --vm-keep -m 1   I can see from docker stats it's using 111Go of Ram (full capacity of my server)  stress --cpu 16   I can see from docker stats it's using near 1600 % (full capacity of my server)  I think I've missed something but I don't know what Prove that any finite group $G$ of even order contains an element of order $2.$ Does "singular" have a common meaning across matrices, decomposition, vectors and values? How can I split a polygon by network line in QGIS? I have a road network as line layer and a land cover as polygon layer, I want to find number of subpolygon for each polygon that divided by line layer in QGIS?  I used union function in Geoprocessing Tools in Vector menu of QGIS and then polygonize function to convert union result to polygon but in table of new polygon there is NULL data. I run below command on ubuntu 16.4 :  sudo add-apt-repository ppa:noobslab/apps  of below question:    and get below error:  Traceback (most recent call last):   File "/usr/bin/add-apt-repository", line 11, in &lt;module&gt;     from softwareproperties.SoftwareProperties import SoftwareProperties, shortcut_handler   File "/usr/lib/python3/dist-packages/softwareproperties/SoftwareProperties.py", line 27, in &lt;module&gt;     import apt_pkg ModuleNotFoundError: No module named 'apt_pkg' Error in sys.excepthook: Traceback (most recent call last):   File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 63, in apport_excepthook     from apport.fileutils import likely_packaged, get_recent_crashes   File "/usr/lib/python3/dist-packages/apport/__init__.py", line 5, in &lt;module&gt;     from apport.report import Report   File "/usr/lib/python3/dist-packages/apport/report.py", line 30, in &lt;module&gt;     import apport.fileutils   File "/usr/lib/python3/dist-packages/apport/fileutils.py", line 23, in &lt;module&gt;     from apport.packaging_impl import impl as packaging   File "/usr/lib/python3/dist-packages/apport/packaging_impl.py", line 23, in &lt;module&gt;     import apt   File "/usr/lib/python3/dist-packages/apt/__init__.py", line 23, in &lt;module&gt;     import apt_pkg ModuleNotFoundError: No module named 'apt_pkg'  Original exception was: Traceback (most recent call last):   File "/usr/bin/add-apt-repository", line 11, in &lt;module&gt;     from softwareproperties.SoftwareProperties import SoftwareProperties, shortcut_handler   File "/usr/lib/python3/dist-packages/softwareproperties/SoftwareProperties.py", line 27, in &lt;module&gt;     import apt_pkg ModuleNotFoundError: No module named 'apt_pkg'   Thanks for help Is "do something by date X" inclusive? Possible Duplicate:          For example, if John says:      Return it to me by March 24th.    Does it mean that I need to return it to him before 23:59 p.m. March 24th, or before 23:59&nbsp;p.m. March&nbsp;23rd? The Android app crashes when trying to upload a picture from my phone Sum of binomial coefficients with index divisible by 4 I am trying to obtain a closed form expression for  $\sum {n \choose 4k}$  I am trying to use the binomial expansion of $(1 + i)^n$ and $(1 - i)^n$. $$(1 + i)^n + (1 - i)^n = 2\left(\sum {n \choose 4k} -\sum {n \choose 4k + 2}\right)$$ Stuck at this now. I can't come up with a way to simplify the second term on RHS. Any help would be appreciated. This is Baby Rudin exercise 7 of Chapter 3. Prove that the convergence of $\sum{a_n}$ implies the convergence of $\sum{\sqrt {a_k} \over k}$ if $a_n \ge 0$.  Proof:  I will attempt to show that the cauchy criterion is met so $${\sum_{k=n}^m {\sqrt {a_k} \over k}} \le \epsilon $$ for all $n,m \le N_1$. Im disregarding the absolute value since its all positive terms.   Since $\sum{a_n}$ converges, we know that the $\lim \limits_{n \to \infty} a_n =0$ So there exists some $N_2$ such that for all $n \ge N_2$, $$   a_n \lt \ {{(m-n)}^2k^2(\epsilon)^2} $$ I am again disregarding the absolute values because its always positive Let N=max{$N_1,N_2$} then for all $n,m \ge N$ $$\sum_{k=n}^m {\sqrt {a_k} \over k} \le \sum_{k=n}^m {\sqrt {{(m-n)}^2k^2(\epsilon)^2} \over k} \le \sum_{k=n}^m{(m-n)(\epsilon)} = \epsilon $$  Maybe this is just crazy, should I just use Cauchy-Schwarz inequality and forget about this or could I possibly make this method work? I want to upgrade my Ubuntu 13.04 to Ubuntu 13.10. I'm unable to do via GUI.   [ The reason why I'm unable to do so:  Via software updater, I proceed ahead and click upgrade (for upgrading my OS). I authenticate by providing my password. Then it proceeds and downloads upgrade tool. That time only (while downloading the tool) error message comes "system program problem detected". It then doesn't proceed ahead and I click to report the problem ]  So, I tried via command line but here also I couldn't succeed upgrading my OS.  For the same I ran   $ sudo apt-get update   Then I ran  $ sudo apt-get dist-upgrade   And then:  ravbholua@ravbholua-Aspire-5315:~$ sudo do-release-upgrade Checking for a new Ubuntu release Get:1 Upgrade tool signature [198 B]                                                                                                  Get:2 Upgrade tool [1,135 kB]                                                                                                         Fetched 1,135 kB in 6s (32.9 kB/s)                                                                                                    authenticate 'saucy.tar.gz' against 'saucy.tar.gz.gpg'  gpg exited 2 Debug information:    gpg: Signature made Friday 01 November 2013 10:34:27 AM IST using DSA key ID 437D05B5 gpg: Can't check signature: public key not found  Authentication failed Authenticating the upgrade failed. There may be a problem with the network or with the server.  ravbholua@ravbholua-Aspire-5315:~$    Please suggest how to go ahead and upgrade my OS. Do web browsers use different outgoing ports for different tabs? What kind of power management circuit do I need to embedded a rechargeable battery in my electronics project? I am doing a project where my electronics runs on 5V which I wanted to power from a 7.2v lipo regulated down to that voltage. I'd really like to include the opportunity to charge the lipo without removing it from the project. What kind of circuit/components do I need to do it properly?  Say, would putting a battery charging ic at the battery's terminals in parallel to my system be enough to achieve what I need? Define Pressure at A point. Why is it a Scalar? How do I resize/change resolution of pictures easily? $a^m=b^m$ and $a^n=b^n$ imply $a=b$ Let $D$ be an integral domain and let $a^m=b^m$ and $a^n=b^n$ where $m$ and $n$ are relatively prime integers, $a,b \in D$.   How do I show $a=b$? only display df lines that have more fs usage than 80% root@SERVER ~$ df Filesystem  512-blocks  Free    %Used   Iused   %Iused  Mounted on /dev/YXCV   655360      365632  45% 6322    13% / /dev/ASDF   3801088     670648  83% 41759   32% /usr /dev/ASR    1048576     500496  53% 5555    9%  /var   How can I pipe the df command's output to only display lines that have more usage than 80%?  e.g.: it would only display:  /dev/ASDF   3801088     670648  83% 41759   32% /usr