evaluate string expression in C# I have the following string expression which am trying to run ,But am getting error saying string format is not correct   for (i = diffvol; i &lt; result.count; i++) {     B1Volume = Convert.ToDecimal(String.Format("result.Data[0].B{0}Volume", i));     B2Volume = Convert.ToDecimal(String.Format("result.Data[0].B{0}Volume", i)); }
How can I evaluate a C# expression dynamically? I would like to do the equivalent of:  object result = Eval("1 + 3"); string now    = Eval("System.DateTime.Now().ToString()") as string   Following Biri s , I got this snippet (modified to remove obsolete method ICodeCompiler.CreateCompiler():  private object Eval(string sExpression) {     CSharpCodeProvider c = new CSharpCodeProvider();     CompilerParameters cp = new CompilerParameters();      cp.ReferencedAssemblies.Add("system.dll");      cp.CompilerOptions = "/t:library";     cp.GenerateInMemory = true;      StringBuilder sb = new StringBuilder("");     sb.Append("using System;\n");      sb.Append("namespace CSCodeEvaler{ \n");     sb.Append("public class CSCodeEvaler{ \n");     sb.Append("public object EvalCode(){\n");     sb.Append("return " + sExpression + "; \n");     sb.Append("} \n");     sb.Append("} \n");     sb.Append("}\n");      CompilerResults cr = c.CompileAssemblyFromSource(cp, sb.ToString());     if (cr.Errors.Count &gt; 0)     {         throw new InvalidExpressionException(             string.Format("Error ({0}) evaluating: {1}",              cr.Errors[0].ErrorText, sExpression));     }      System.Reflection.Assembly a = cr.CompiledAssembly;     object o = a.CreateInstance("CSCodeEvaler.CSCodeEvaler");      Type t = o.GetType();     MethodInfo mi = t.GetMethod("EvalCode");      object s = mi.Invoke(o, null);     return s;  }
Background: I have the opportunity to pursue a Computer Science graduate degree at a well respected program (around top 20). I spoke with the professors at the university and I feel like I am a good fit with their research program. My ultimate pursuits are to complete a PhD in CS. I've done research as an undergraduate and it has only confirmed my notion that I want to pursue a research track career.  More background: I applied to jobs (in case I was rejected to all the programs I applied for) prior to hearing back from my respective graduate programs. I accepted a position for an industry job (this was to secure I wouldn't be both unemployed &amp; not in school).  Dilemma: Turns out my top graduate school is very interested in me, and I'm very interested in them. I would rather go to graduate school than work in industry forever. The industry job pays very well. I am split between A) working for a maximum of 1 year(It would only be 1 year, seriously I do not care about the money enough to work past a year) and B) going straight to graduate school.   My concerns are as follows, if I choose A):    Could I potentially defer my admissions? If I am not allowed to defer my admissions, would I have a good chance of re-applying and being accepted a year later? Would my potential advisers look down on me for deciding to work a year?   I already made my mind up it would be a 1 year gig if I decide A). I know some people say once you make money, you may not be able to readjust to the graduate salary pay. But I don't think that will apply to because I'm going to live very frugally with or without industry pay. How can I create documents in LaTeX using a calligraphic first letter for chapters? Books often have a special letter (often spanning two lines) at the beginning of chapters. How can I create this in LaTeX? Possible Duplicate:          I've added myself back into the admin's group I think, by following   But I still can't do commands like:  sudo aptitude update   I get the message  oshirowanen is not in the sudoers file.  This incident will be reported.   How do I add myself into the sudoers group now that I am in the admin group? An epimorphism from $S_{4}$ to $S_{3}$ having the kernel isomorphic to Klein four-group Exercise $7$, page 51 from Hungerford's book Algebra.     Show that $N=\{(1),(12)(34), (13)(24),(14)(23)\}$ is a normal subgroup   of $S_{4}$ contained in $A_{4}$ such that $S_{4}/N\cong S_{3}$ and   $A_{4}/N\cong \mathbb{Z}_{3}$.   I solved the question after many calculations. I would like to know if is possible to define an epimorphism $\varphi$ from $S_{4}$ to $S_{3}$ such that $N=\ker(\varphi)$.  Thanks for your kindly help. Removing unnecessary vertices? I have over sampled polygons that I need to simplify, without changing the shape. basically, I want to reduce the number of vertices, by eliminating the ones that are useless and have the polygons represented with the significant vertices only. I used to do that with ET GeoWizards Plug-in, but I don't have a license anymore. My table has 500.000 features, water polygons.   Any ideas? How do we know for certain that space is expanding? How to change the href for a hyperlink using jQuery How can you change the href for a hyperlink using jQuery? in my earlier question you can find at:   i describe my error:     I'm using an Asus Zenbook UX562F with an integrated GTX 1050 Max-Q.   After the installation, I installed Nvidia-390 and updated the kernel   with ukuu to 4.20.17 to fix no sound issue.      After the reboot, everything went well and I did:      apt-get update apt-get upgrade + J      All was done well, so I restarted and on the next boot after selecting   Ubuntu in GRUB it gave me a long black screen (violet screen) where   nothing changes after so much time.      I tried to add nomodeset and noveau.modeset=0 single and together but   didn't help so I don't know what to do.   After investigating deeper by installing packages and try to boot i found out that the package which is causing the error is:  intel-microcode   when i purge and block this package with:  sudo apt-get purge intel-microcode sudo apt-mark hold intel-microcode   before upgrading wuth  sudo apt-get upgrade   my system is able to boot normal.  The problem i see is that as i understand it the package protects my intel cpu  Intel® Core™ i7 8565U 1.8 GHz   is vulnearable to meltdown attacks which get fixed by the package.  What can i do to fix the vulnearbility and also get my system to a bootable state?  Thanks for your help Vimu  Edit: I used the manual update technique mentioned at (in german):    and i used the files from the intel github repo:    with the following code mentioned in the tutorial to update the firmware microcode files  sudo cp intel-ucode/06-8e-09 /lib/firmware/intel-ucode/ echo 1 | sudo tee /sys/devices/system/cpu/microcode/reload   i overwrote the old microcode firmware with the newest available on the intel repo  it leada to a bootable system  will this be the best possible fix without upgrading the intel-microcode package provided by apt? Will yearly moderation statistics be published on all sites this year, and future years? Do you need to submit an itinerary to get a Russian visa? And do you have to stick to it? Forgot which email I used, can't login I forgot what email I used for my other ploxtic id: how do you find out what my email was?   The account is user:2078229. Fantasy Short Story that appeared in an anthology about 1968-1971 I read this short story around 1971.  The basic plot is for a steward to lead the king's son to another city state.  Along the way they have a number of interactions with people/subjects that demonstrate the immaturity of the son.  Last one involves the son beating up the suitor of a innkeeper's daughter.  When confronted by the steward, the son displays his contempt and chauvinistic regard of his future subjects and the steward kills him.  Turns out the trip was a test of his suitability to assume the crown and the steward explains to the king that he was not worthy.  Been looking in all the anthologies can seem unable to find it.  Thanks for your help Index entries duplicated for captions I need a little hint in a proof on convergence of a sequence. The problem I have is: Suppose $(x_n)$ is a monotone decreasing sequence of real numbers such that $\sum x_n$ converges, prove that:  $$\lim_{n \to \infty} nx_n=0$$  My idea is: proving this fact aims to prove that given $\epsilon &gt;0$ there's some natural $n_0 \in \mathbb{N}$ such that if $n &gt;n_0$ we have $|nx_n|&lt;\epsilon$.  Now, I know that $\sum x_n$ converges, so that given $\epsilon'&gt;0$ there's some $k_0 \in \mathbb{N}$ such that if $k &gt; k_0$ we have:  $$\left|\sum_{i=1}^{k}x_i - S\right|&lt;\epsilon'$$  Where $S = \sum x_n$. Now, since $(x_n)$ is monotone decreasing we know that we must have $x_1 &gt; \cdots &gt; x_k$ so that the sum of all $x_i$ should be less or equal to $k x_k$. So I know that I have:  $$\left|\sum_{i=1}^{k}x_i - S\right|\leq\left|\sum_{i=1}^{k}x_i\right|+|S|\leq|kx_k|+|S|$$  I feel that the proof will come from this, however I'm stuck at this point. Can someone give just a little hint on how to proceed from here?  Thanks very much in advance for your help. What is the fastest way to create a list of directories specified in a file? I have a text file, "foo.txt", that specifies a directory in each line:  data/bar/foo data/bar/foo/chum data/bar/chum/foo ...   There could be millions of directories and subdirectories What is the quickest way to create all the directories in bulk, using a terminal command ?  By quickest, I mean quickest to create all the directories. Since there are millions of directories there are many write operations.   I am using ubuntu 12.04.  EDIT: Keep in mind, the list may not fit in memory, since there are MILLIONS of lines, each representing a directory.  EDIT: My file has 4.5 million lines, each representing a directory, composed of alphanumeric characters, the path separator "/" , and possibly "../"  When I ran xargs -d '\n' mkdir -p &lt; foo.txt after a while it kept printing errors until i did ctrl + c:  mkdir: cannot create directory `../myData/data/a/m/e/d': No space left on device  But running df -h gives the following output:  Filesystem      Size  Used Avail Use% Mounted on /dev/xvda        48G   20G   28G  42% / devtmpfs        2.0G  4.0K  2.0G   1% /dev none            401M  164K  401M   1% /run none            5.0M     0  5.0M   0% /run/lock none            2.0G     0  2.0G   0% /run/shm   free -m   total       used       free     shared    buffers     cached Mem:          4002       3743        258          0       2870         13 -/+ buffers/cache:        859       3143 Swap:          255         26        229   EDIT: df -i  Filesystem      Inodes   IUsed  IFree IUse% Mounted on /dev/xvda      2872640 1878464 994176   66% / devtmpfs        512053    1388 510665    1% /dev none            512347     775 511572    1% /run none            512347       1 512346    1% /run/lock none            512347       1 512346    1% /run/shm   df -T  Filesystem     Type     1K-blocks     Used Available Use% Mounted on /dev/xvda      ext4      49315312 11447636  37350680  24% / devtmpfs       devtmpfs   2048212        4   2048208   1% /dev none           tmpfs       409880      164    409716   1% /run none           tmpfs         5120        0      5120   0% /run/lock none           tmpfs      2049388        0   2049388   0% /run/shm   EDIT: I increased the number of inodes, and reduced the depth of my directories, and it seemed to work. It took 2m16seconds this time round. Warning when battery is fully charged I would like to get an alert (with sound) when my laptop battery is fully charged.  How can I do that? I've been messing around with Unity and broke something, how do I "start over"? Does it feel lately like all questions have already been asked and answered and there is nothing more to do? I think everybody with a history of participation can't help but notice the explosive growth of repeated duplicate questions. The work of looking for duplicates and then closing questions has overtaken the work of actually answering questions.  It's become virtually impossible to ask something which hasn't been yet asked. Lately I feel boredom each time I see a new question and start answering it only to realize after the first written sentence that I have answered similar questions five times over or seen them answered some ten times or more. I know where it's going to be going and what answers with what votes it is going to receive before any answer is even written.  It's obviously not the administration's fault, it is simply so. The questions is, what to do about it? Engaging more moderators to close and close duplicates won't work because it's already starting to repel users who get mad at their questions closed and become afraid of asking more or perhaps just go away.  The original idea of Jeff stated the the site is for questions that can be answered. Meaning no open-ended discussions. When I first read this I had a casual thought - well, and what's gonna happen when they all are asked and answered? Will it become a museum, a monument of wisdom and knowledge or what?  I'm not sure what to do about it. Perhaps deprecation/versioning of older questions so that their new versions can sparkle the tiresome evening...  POSTSCRIPTUM.  I recall Star Trek Voyager episode  when another Q asked Captain Janeway for asylum. He was tired of immortality and wanted to die. They opened a hearing and went on to visit the continuum to evaluate the living conditions there which caused the suffering and the wish to escape it in death. A lifeless picture presented itself to the visitors... a house lone in an open space, two people going about their business, nobody talking. When asked why they were silent, the following was said. It's been so long, all has already been said, all stories told, all jokes are made... there is nothing left to do...  Are we there as well?  UPDATE: Just saw this answer in another question:       Also, some of the core questions got asked early on in the life of the site. Great questions still come around from time to time, but many have already been asked.   Doesn't that confirm my point? I accidentally closed it without voting, how can I find it? When I suggest declaring war on the target it says there's already a proposition to do so. "Heard me [infinitive]" vs. "heard me [present participle]" "Heard me [infinitive]" vs. "heard me [present participle]"             At that time, you wouldn't have heard me talk about it.   At that time, you wouldn't have heard me talking about it.         At that time, you wouldn't have heard me condemn it.   At that time, you wouldn't have heard me condemning it.         Which one of the above sentences are incorrect and why?