Mimicing constants using static readonly vs static getter I am working with a third party control that is using "strange values" to distinguish between a list of choices.  They use two different properties to uniquely identify each choice.    Example: "Field" + "RW" = "CheckedOutBy" "System" + "N" = "Name" "Field + "N" = "Notifier"   There are a total of 37 different choices in all (each with a different combination of the two values to make up the 37 unique choices).  I have created a struct that stores the two values, with the idea that I will create a new instance of the struct for each choice.  public struct ColumnCode : IEquatable&lt;ColumnCode&gt; {     public static readonly ColumnCode Empty = new ColumnCode();      private readonly ColumnType _columnType;     private readonly string _code;      internal ColumnCode(ColumnType columnType, string code)     {         _columnType = columnType;         _code = code;     }      public override string ToString() { ... }     public bool Equals(ColumnCode other) { ... }     public override int GetHashCode() { ... } }   Ideally I would like to create a "constant" for each of the choices, but since constants are not an option I want to try and mimic a constant.  The two approaches I have come up with are to either use a static readonly field or a static property with only a getter.  public static class FieldOption  {     public static ColumnCode CheckedOutBy { get; } = new ColumnCode(ColumnType.Field, "XW");     public static ColumnCode Name { get; } = new ColumnCode(ColumnType.System, "N");     public static ColumnCode Notifier { get; } = new ColumnCode(ColumnType.Field, "N"); }   or   public static class FieldOption  {     public static readonly ColumnCode CheckedOutBy = new ColumnCode(ColumnType.Field, "XW");     public static readonly ColumnCode Name= new ColumnCode(ColumnType.System, "N");     public static readonly ColumnCode Notifier = new ColumnCode(ColumnType.Field, "N"); }   In either case I can now refer to the choices in my C# code using FieldOption.CheckedOutBy, FieldOption.Name or FieldOption.Notifier, etc but I am not sure if one approach is better than the other.    Is one of these choices better than the other to mimic a const, or is there a better approach that I am not considering.  I have read a large amount of information on the internet and am still not coming up with a good answer.  Some of it seems to be conflicting.  Much of the information states to favor properties over fields but then in this article () Microsoft says "DO use public static readonly fields for predefined object instances" so I feel static readonly fields is the correct choice.  I am also not sure how reflection falls into play here.  I want to make sure that the values for the FieldOptions cannot be changed, even through reflection.  Any help on this would be greatly appreciated.
What is the difference between a field and a property? In C#, what makes a field different from a property, and when should a field be used instead of a property?
Can I increase the speed of combat? XCOM Enemy Unknown is a beautiful game, but you can only see every 5 second animation so many times before it becomes repetitive and self-indulgent. Is there a way to make the animations go faster or speed combat up in some other way, so that I can spend more time strategically exterminating aliens and less time watching my operatives shoot their guns? How to suppress scientific notation when printing float values? Here's my code:  x = 1.0 y = 100000.0     print x/y   My quotient displays as 1.00000e-05.  Is there any way to suppress scientific notation and make it display as 0.00001? I'm going to use the result as a string. Clearly if $\lambda$ is an eigenvalue of $A$ then $p(\lambda)$ is an eigenvalue of $p(A)$ where $p$ is a polynomial. And there are cases where $A$ may have eigenvalues other than these.   Is there a general rule for finding all eigenvalues of $p(A)$? Does it depend on the field from which the elements of $A$ are taken? Are their any partial solutions to this problem? Where was Alastor Moody during Harry Potter and the Half Blood Prince? Example of quasi-compact, non-quasi seperated scheme where qcqs fails? Axiom of Choice: Where does my argument for proving the axiom of choice fail? Help me understand why this is an axiom, and not a theorem. In terms of purely set theory, the axiom of choice says that for any set $A$, its power set (with empty set removed) has a choice function, i.e. there exists a function $f\colon \mathcal{P}^*(A)\rightarrow A$ such that for any subset $S$ of $A$, $f(S)\in S.$ Is this correct?  My question then is about proving this fact, so that we do not need to put it as an axiom. Now as per the research done on this single object- Axiom of Choice, I believe here that there should be some falsity in my argument. I do not find the mistake.  For any $S\in \mathcal{P}^*(A)$, since $S\neq \emptyset$, $\exists s\in S$. Define $f(S)=s$. Then $f$ is a choice function.  This was showing me that the axiom of choice is proved, but then why it had been put as an axiom? For example, in  book, the author asserts that      It is a metatheorem of mathematical logic that it is impossible to specify the function that assigns to each non-empty subset of $\mathbb{R}$, an element of itself.     There are several notes and books on axiom of choice, but here I am trying to understand through doing some argument for some problem, where problem actually arises. What is the best way to increase my reputation and privileges? I'm not sure if this is a stupid question, but here goes anyway... I have only recently started learning PHP and Javascript and I'm reasonably proficient. One of the reasons I'm so proficient is because I LOVE Stack Overflow and find most of the solutions to my dilemmas here.   But I've found that I never get the chance to ask a question because it has normally been asked many times before and when I go through the unanswered questions to try and help someone else, they are generally WAY over my head.  So I'm not sure how to get more privileges. I can't even vote up answers that I like or that helped me. I can't comment to thank someone for their solution. It is most tragic and demoralising... How do I change the situation? Centos mysql version is 5.5 however PHPmyadmin still says version 5.1 When i run the following in my console:  [root@****~]# mysql -u root -p -e 'SELECT VERSION();' Enter password: +-----------+ | VERSION() | +-----------+ | 5.5.39    | +-----------+   Which should be the correct version.  However when i enter my PHPMYADMIN on my server it has the following specs:  Server: Localhost via UNIX socket Program: MySQL Programversion: 5.1.73 - Source distribution   So which version is the correct one and how do i make sure that the database is running on 5.5?  Note  I have already restarted sql several times without any changes Show for prime numbers of the form $p=4n+1$,  $x=(2n)!$ solves the congruence $x^2\equiv-1 \pmod p$. $p$ is therefore not a gaussian prime. How can I use QGIS to create a metro style map How to tell Google that I have changed my website URLs? Dynamic trigger creation from managed package I have a requirement to create triggers dynamically after a managed package is installed. I have read that the tooling API can be used to create triggers dynamically however it cannot be used in production. Is it possible to create triggers from a managed package in an org? I want to be able to create the trigger based on some user inputs. For any prime $p > 3$, why is $p^2-1$ always divisible by 24? Let $p&gt;3$ be a prime. Prove that $24 \mid p^2-1$.   I know this is very basic and old hat to many, but I love this question and I am interested in seeing whether there are any proofs beyond the two I already know. Random weighted choice Consider the class below that represents a Broker:  public class Broker {     public string Name = string.Empty;     public int Weight = 0;      public Broker(string n, int w)     {         this.Name = n;         this.Weight = w;     } }   I'd like to randomly select a Broker from an array, taking into account their weights.  What do you think of the code below?  class Program     {         private static Random _rnd = new Random();          public static Broker GetBroker(List&lt;Broker&gt; brokers, int totalWeight)         {             // totalWeight is the sum of all brokers' weight              int randomNumber = _rnd.Next(0, totalWeight);              Broker selectedBroker = null;             foreach (Broker broker in brokers)             {                 if (randomNumber &lt;= broker.Weight)                 {                     selectedBroker = broker;                     break;                 }                  randomNumber = randomNumber - broker.Weight;             }              return selectedBroker;         }           static void Main(string[] args)         {             List&lt;Broker&gt; brokers = new List&lt;Broker&gt;();             brokers.Add(new Broker("A", 10));             brokers.Add(new Broker("B", 20));             brokers.Add(new Broker("C", 20));             brokers.Add(new Broker("D", 10));              // total the weigth             int totalWeight = 0;             foreach (Broker broker in brokers)             {                 totalWeight += broker.Weight;             }              while (true)             {                 Dictionary&lt;string, int&gt; result = new Dictionary&lt;string, int&gt;();                  Broker selectedBroker = null;                  for (int i = 0; i &lt; 1000; i++)                 {                     selectedBroker = GetBroker(brokers, totalWeight);                     if (selectedBroker != null)                     {                         if (result.ContainsKey(selectedBroker.Name))                         {                             result[selectedBroker.Name] = result[selectedBroker.Name] + 1;                         }                         else                         {                             result.Add(selectedBroker.Name, 1);                         }                     }                 }                   Console.WriteLine("A\t\t" + result["A"]);                 Console.WriteLine("B\t\t" + result["B"]);                 Console.WriteLine("C\t\t" + result["C"]);                 Console.WriteLine("D\t\t" + result["D"]);                  result.Clear();                 Console.WriteLine();                 Console.ReadLine();             }         }     }   I'm not so confident. When I run this, Broker A always gets more hits than Broker D, and they have the same weight.  Is there a more accurate algorithm?  Thanks! What is the Ubuntu equivalent of this interface?    I am looking for a user-friendly method that the owner of a computer can use to log off other users without having to restart.  The case I'm concerned about is of the beginner-level user who needs administrative control over the computer because they are the owner, but probably isn't concerned with most of the tasks we would usually associate with system administration. Mark a comment as the answer to a question I found an argument online that the two fields are not isomorphic but I can't make sense of the argument. You find it .  These are the things I'm confused about when it comes to the argument.     It says that the field $\mathbb Q[x]/(x^2+1)$ contains a root of the polynomial $x^2+1$. I suppose this is the congruence class $[x]$? But this is not the same as the zero element of the field $\mathbb Q[x]/(x^2+1)$, right?   It says that every isomorfism takes $0$ to $0$. I interpret this as the zero-element in $\mathbb Q[x]/(x^2+1)$ (which I interpret to be $[0]$) is taken to the zero-element in $\mathbb Q[x]/(x^2+2)$ denoted $[0]_2$. But in the argument it says that this means that if $\mathbb Q[x]/(x^2+1)$ has a root of the polynomial, then also $\mathbb Q[x]/(x^2+2)$ must have a root of this same polynomial. Why is that?     Greatful for any help! Since I've a database systems examination in less than 3 hours (from now), I have been browsing Stack Exchange network for questions with normalisation and related tags. Most of the questions are now closed as  or others from the list.  Since, these questions are closed, no users are allowed to post answers to them (unless they are reopened). Why am I, then, allowed the option to protect such questions? Doesn't that beat the entire purpose behind "protecting" a question? Counting the number of propagating degrees of freedom in Lorenz Gauge Electrodynamics How do I definitively show that there are only two propagating degrees of freedom in the Lorenz Gauge $\partial_\mu A^\mu=0$ in classical electrodynamics.  I need an clear argument that   involves the equations of motion for just the potentials $A^0$ and $\mathbf{A}$, and not the electric and magnetic fields.   includes sources $\rho$ and $\mathbf{J}$ in the equations of motion.  This is to justify the assertion that there are degrees of freedom that decouple from the rest of system. does not critically rely on quantum field theoretic arguments (although any supplementary remarks are welcome).     To illustrate the level of clarity I expect, I provide an argument in the Coulomb gauge $\nabla\cdot \mathbf{A} = 0$:  Of the four field degrees of freedom, the gauge condition $\nabla\cdot \mathbf{A} = 0$ removes one degree of freedom (the longitudinally polarized EM waves).  To show that among the remaining three degrees of freedom only two are propagating, consider the field equations of motion in the Coulomb gauge:  \begin{align} \nabla^2 A^0 &amp;= -\rho/\epsilon_0,\\ \big[\frac{1}{c^2}\frac{\partial^2}{\partial t^2}-\nabla^2\big]\mathbf{A}&amp;= \mu_0 \mathbf{J}-\nabla \frac{1}{c^2}\frac{\partial}{\partial t}A^0. \end{align}  The first equation is NOT a wave equation for $A^0$, and thus does not propagate.  The final equation IS a wave equation, and describes the propagation of two degrees of freedom (Gauss' law in first eq. can be solved, and then inserted into the second equation to show that $\mathbf{A}$ only couples to the Solenoidal part of the current). Update Garmin Nüvi 255 maps