I have a very basic question. In Java, it is possible to point attributes and variables to Enums, such as:  public enum DayTime{     Morning("Morning"),     Afternoon("Afternoon"),     Night("Night");      private string description;      Daytime(string description){         this.description = description;     }      public string getDescription(){         return description;     } }   Is it possible to apply the same concept to C#? I am trying to get modular descriptions to products, whereas their name, contents and characteristics would be shown in a string of text, and Enums looked like the best alternative to modify this text according to which characteristic is selected.
I've been programming in Java for a while and just got thrown onto a project that's written entirely in C#.  I'm trying to come up to speed in C#, and noticed enums used in several places in my new project, but at first glance, C#'s enums seem to be more simplistic than the Java 1.5+ implementation.  Can anyone enumerate the differences between C# and Java enums, and how to overcome the differences?  (I don't want to start a language flame war, I just want to know how to do some things in C# that I used to do in Java).  For example, could someone post a C# counterpart to Sun's famous Planet enum example?  public enum Planet {   MERCURY (3.303e+23, 2.4397e6),   VENUS   (4.869e+24, 6.0518e6),   EARTH   (5.976e+24, 6.37814e6),   MARS    (6.421e+23, 3.3972e6),   JUPITER (1.9e+27,   7.1492e7),   SATURN  (5.688e+26, 6.0268e7),   URANUS  (8.686e+25, 2.5559e7),   NEPTUNE (1.024e+26, 2.4746e7),   PLUTO   (1.27e+22,  1.137e6);    private final double mass;   // in kilograms   private final double radius; // in meters   Planet(double mass, double radius) {       this.mass = mass;       this.radius = radius;   }   public double mass()   { return mass; }   public double radius() { return radius; }    // universal gravitational constant  (m3 kg-1 s-2)   public static final double G = 6.67300E-11;    public double surfaceGravity() {       return G * mass / (radius * radius);   }   public double surfaceWeight(double otherMass) {       return otherMass * surfaceGravity();   } }  // Example usage (slight modification of Sun's example): public static void main(String[] args) {     Planet pEarth = Planet.EARTH;     double earthRadius = pEarth.radius(); // Just threw it in to show usage      // Argument passed in is earth Weight.  Calculate weight on each planet:     double earthWeight = Double.parseDouble(args[0]);     double mass = earthWeight/pEarth.surfaceGravity();     for (Planet p : Planet.values())        System.out.printf("Your weight on %s is %f%n",                          p, p.surfaceWeight(mass)); }  // Example output: $ java Planet 175 Your weight on MERCURY is 66.107583 Your weight on VENUS is 158.374842 [etc ...]
Is it possible to shutdown remote Computers without inputing the password? I used the following bash to shutdown remote computers,but for each computer,I must input the password for it.Is it possible to input the password Automatically?   #!/bin/bash  ssh -t root@192.168.1.11 "sudo poweroff" ssh -t root@192.168.1.12 "sudo poweroff" ssh -t root@192.168.1.13 "sudo poweroff" ssh -t root@192.168.1.14 "sudo poweroff" ssh -t root@192.168.1.15 "sudo poweroff" ssh -t root@192.168.1.16 "sudo poweroff" ssh -t root@192.168.1.17 "sudo poweroff" ssh -t root@192.168.1.18 "sudo poweroff" ssh -t root@192.168.1.19 "sudo poweroff" ssh -t root@192.168.1.20 "sudo poweroff" ssh -t root@192.168.1.21 "sudo poweroff" ssh -t root@192.168.1.22 "sudo poweroff" ssh -t root@192.168.1.23 "sudo poweroff" ssh -t root@192.168.1.24 "sudo poweroff" ssh -t root@192.168.1.25 "sudo poweroff" ssh -t root@192.168.1.26 "sudo poweroff" I read it in English in the United States, somewhere in the 1990s. I got it off of the big bookshelf in our family room, which means it could be a good bit older; some of the books were my Dad's. At the beginning, a young boy (maybe an early teen?) leaves his house, where he lives with his parent or parents, and takes a test to become a spaceship pilot for the military. Part of the test judges reaction speed, and he fails the test. He later learns (I think when he's approached by an agent of the government) that he "failed" because he has some sort of enhanced fortune that meant that he was actually giving the results before they could be displayed on the screen. At the time, I remember thinking that the book felt a bit like a Star Wars rip-off.  Years later, I read that one of the Star Wars books (probably now Legends) had Luke similarly failing the Imperial Academy test because he gave his answers too quickly, and it amused me that I was uncertain as to which had come first.  I don't remember anything concrete about the cover, although I have a general impression that it was white. Definitely futuristic. My impression was that the boy was wearing a white uniform for the testing and that the government agent who spoke to him had a grey beard, but I might be mixing bits of Star Wars in there. Why does the checkbox stay checked when reloading the page? Pressure at base of 3 different dam designs The question asks, For which design will the water pressure at the base of the dam wall be the greatest?  The answer is all are equal.    This doesn't make sense to me.  Using the formula: P (pressure) = p (atmospheric pressure) + rho (density) * g (gravity) * y (depth below water surface)    What is confusing me is the y value, the depth below the surface. Yes both red points are the same depth below the water surface. But doesn't the red point in dam III only "see" a smaller column of water above it and so shouldn't it have less pressure on it than the red point in dam II?    Also, I know the formula would give the points at the base of dam I and dam II equal. But why doesn't the extra water in dam II (shaded in black) cause it to have a higher pressure at the base? What is $\sum_{n=1}^{\infty} \frac{n}{2^{\sqrt{n}}}$? How can I make hibernate my desktop in UEFI with Secure boot on.  I used command "sudo pm-hibernate" to make hibernate my desktop but my machine did nothing (my desktop is booted up on UEFI with Secure boot on). But, if I boot my desktop on UEFI with Secure boot off, Hibernation is normal.  Sorry for my English, thanks, Show that every group of prime order is cyclic In  it says that flagged comments can be handled automatically if flagged repeatedly (3 + (score / 3) flags = deletion). Which is great; mods are busy people.  In , the venerable Bill the Lizard says that if all comments on a post are obsolete, you can flag the post (or one of the comments) with a custom flag saying that they're all obsolete, and the mod can remove them with one fell swoop. Problem is, that requires a mod.  What should I do when some of the obsolete comments are mine? I can't flag my own comments, and I don't like raising custom flags if I can avoid it.  You're wondering why I don't just delete them. There are two scenarios where I don't, at least not immediately:   Someone has commented with incorrect information. In that situation, I reply to the comment telling them how they've got it wrong. (Sometimes, of course, they quite correctly reply telling me how I got it wrong, which is neither here nor there&nbsp;&mdash; we still end up with obsolete comments. :-) ) Frequently, they reply saying "you're right" but (near universally) leave the comment lying around. I can (and do) then comment again saying "Let's clean these up" and flag their comments as obsolete. But I can't flag mine. Nor do I want to remove mine while the incorrect comment is still there; it leaves a confusing situation for anyone coming to the post later. Someone has commented with correct information. In that situation, if appropriate (e.g., the post author isn't busily editing at the same time and I know enough to do it properly), I'll edit the comment into the post and reply with "You're right, edited that in." and flag their comment as obsolete. These are rarely removed by the commenter. And again I can't flag mine.   The first scenario is the more problematic, since I can go back 10-20 minutes later and remove my "edited that in" comment and there's no harm if their comment is still there.  I currently bookmark and check back periodically, but that's labor-intensive and I'd like a better way.  Ideally, I'd want to tie my comment to one I've flagged so that it's deleted automatically if the other one is (by flagging, or by the commenter). That's a fair bit of development, though, I'm guessing.  What should I do? Go with a custom flag saying "The conversation between X and me is now obsolete," even though that means dumping it on a mod? Does the concept of infinity have any practical applications? I know what you're thinking: "of course it has, for example, it can be used to tell you how many times you can go around a circle". But that isn't really true, now is it? You'd be dead or the world would go under long before an infinite amount of loops had been reached.  Are there any practical applications for the concept of infinity? Is it a useful concept in maths at all?  I know that Donald E. Knuth has argued that for all practical purposes, a very, very large number has the same effect as infinity, in his book "Things a Computer Scientist Rarely Talks About" (can't remember the exact quote, nor find it online, unfortunately).  Examples are appreciated. Did spacetime start with the Big bang? Did spacetime start with the Big Bang?  I mean, was there any presence of this spacetime we are experiencing now before big bang? And could there be a presence/existence of any other space-time before the big bang? Salesforce DX daily limits As a package developer scratch orgs look like a great solution for automated CI testing and Salesforce has even done some great demos using Github and TravisCI to show automatically testing code using the DX CLI. However, in reviewing the details of DX, it looks like the limit is currently set to 50 orgs a day. If we want to test pull requests against 5 different org configurations, this limits us to 10 test runs a day. On a moderately sized team, this is going to be a tough limit to deal with. Has anyone had any success in working around this limit (or heard of any planned limit increases in the future). My initial thoughts are:   Get Salesforce to increase the limit (does not seem likely since this is a very young feature) Reuse scratch orgs for a period of time (this would require a good way to clean them and some savvy CI build code) Run fewer tests (not going to go over well the first time a bug for a specific org configuration slips through) I've tried several things already,  std::stringstream m; m.empty(); m.clear();   both of which don't work. OpenCV argc and argv confusion How to shop for a lens filter? What should I consider when shopping for a lens filter?    I see filters that range from $15 to $115 and more.  What are the differences between the $15 and the $115 filter?    I'm asking in the generic sense but if you need specifics, I'm looking to buy a UV filter and a polarizing filter for a Panasonic GF1 w/ 20mm pancake lens.  EDIT: I've read some of the other posts and some refer to multi-coating but doesn't explain what is this and why it matters.  What I've gathered from reading related posts is that price is generally the only indication of quality in the case of choosing a filter.  Is this right? Mount a VirtualBox drive image (vdi)? Is it possible to mount a VirtualBox drive image (.vdi) so the contents can be viewed in Nautilus etc.?  I have a windows 2000 .vdi which won't boot ("inaccessible boot device") after upgrading from VirtualBox 2.x to 3.1.6. I believe the IDE drive details have changed and that all I need to do is access the internal drive image and edit the Windows boot.ini to point to the new location. Would time speed up near a large body of negative mass relative to observers in micro gravity? Time tends to slow down near objects with large amounts of positive mass relative to observers in micro gravity.  Considering that negative mass is the opposite of normal mass and would time tend to speed up near a body of negative mass relative to observers in micro gravity? How can I shorten my command line (bash) prompt? When the phrase is used as an object, why so many native speakers are saying "you and I" instead of "you and me"? I'm not a native speaker but I thought "you and me" is correct. Not sure if this falls into the same category, but "Just between you and me" sounds more natural than "Just between you and I". It was suggested that I should get myself a polarizer filter to get over my reflection problem. (  )  I found out that a Nikon 52mm Circular Polarizing Filter CPL   while I can get another filter for less than half the price — . (Please note that I know nothing about these filters and googled them just for the example.)  What is the difference between polarizer filters?  I need to remove the glare and nothing else — would either of the two do the magic for me? What filter do you recommend for me? Why can't ARIMA model large lags and/or long range dependence? ARIMA cannot model large lags (obtained from autocorrelation plot) and long range dependency (hurst exponent $H &gt; 0.5$). Why is it so?