I want create some console application. This application will work by parameters from input args[] array.   Like this: &gt; app.exe -arg1 -arg2 -arg3:str3 -arg4:str4 -arg5 etc.  Where -arg1, -arg2, -arg5 the parameters for initialization variables in my app. The -arg3:str3 and -arg4:str4 the parameters with any string.  For example, if I sent the -arg1 then in my app I need initialization the var1 by any string. Like this:  foreach (string s in args) {     if(s.contains("-arg1")) someString1 = "someVal1";     if(s.contains("-arg2")) someString2 = "someVal2";     if(s.contains("-arg5")) someString5 = "someVal5";     if(s.contains("-arg3")) someString3 = s.split(':')[1];     if(s.contains("-arg4")) someString4 = s.split(':')[1]; }   I think that my solution is bad, because I need to test every argument in a loop and if I want to pass more new parameters I have to add new conditions.  Tell me please, maybe there are specific approaches to solving my problem? Or maybe there is some design pattern for such tasks?  EDIT: I can't use any libraries
When building console applications that take parameters, you can use the arguments passed to Main(string[] args).   In the past I've simply indexed/looped that array and done a few regular expressions to extract the values. However, when the commands get more complicated, the parsing can get pretty ugly.    So I'm interested in:   Libraries that you use Patterns that you use   Assume the commands always adhere to common standards such as .
Why do we use $x - y$ rather than $x + y$ in the definition of the convolution? Is it just convention? (If we are thinking of convolutions as weighted averages, for instance against "good kernels," it should make no difference.)  Why $(f * g) (x) = \int f(y) g(x - y) dy$ rather than $(f * g) (x) = \int f(y) g(x + y) dy$?  Edit: I'm finding it really hard to choose a best answer. There are at least three very good ones here. Irreducible polynomial is always separable in char 0 field Is it possible for a system to have negative potential energy? The Cartesian product of a family $(A_i\mid i\in I)$ is defined as $$\prod\limits_{i\in I}A_i=\{f:I\to\bigcup A_i\mid f(i)\in A_i\}$$ Let $I_n=\{i \in \mathbb N \mid i \le n\}$ for $n\in \Bbb N$ and $A_i$ be countable for all $i\in I_n$. Then $\prod\limits_{i\in I_n}A_i$ is countable.   My attempt: Lemma 1: $(\prod\limits_{i\in I_n}A_i) \times A_{n+1}$ and $\prod\limits_{i\in I_{n+1}}A_i$ are equinumerous for all $n \in \mathbb N$. (I presented a proof ) Lemma 2: If $A$ and $B$ are countable, then $A \times B$ is countable. (I presented a proof ) I will prove the theorem by induction on $n$. The theorem is trivially true for $n=0$. Assume that the theorem is true for $n=k$, then $\prod\limits_{i\in I_k}A_i$ is countable. Since $\prod\limits_{i\in I_k}A_i$ is countable (by inductive hypothesis) and $A_{k+1}$ is countable, then by Lemma 2 $(\prod\limits_{i\in I_n}A_i) \times A_{n+1}$ is countable. Furthermore, by Lemma 1 $(\prod\limits_{i\in I_k}A_i) \times A_{k+1}$ and $\prod\limits_{i\in I_{k+1}}A_i$ are equinumerous, then $\prod\limits_{i\in I_{k+1}}A_i$ is countable too. Thus the theorem is true for $n=k+1$. This completes the proof.   Does this proof look fine or contain gaps? Do you have suggestions? Many thanks for your dedicated help! Pointwise convergence of $h_n(x) = x^{1+\frac{1}{2n-1}}$ Okay, maybe I'm missing something obvious but consider $h_n(x) = x^{ 1+ \frac{1}{2n-1}}$ on the set $[-1,1]$. Now consider a fixed $x \in [-1,1]$, we have:  $$\lim_{n\rightarrow \infty} h_n(x) = x \lim_{n \rightarrow \infty} x^\frac{1}{2n-1} = x$$  But my book says it's $|x|$? Why? Movie with a town where it is always night and the protagonist has amnesia I can't remember the name of this fairly recent movie. The protagonist wakes up in a bath tub without memories. He breaks up with his wife, gets in touch with a "doctor" who claims to be able to help him, and is accused of serial killing prostitutes. The sun never seems to go up. The main plot device:       The town is in perpetual darkness. It is the experiment of a hive-mind race, that tries to understand why humans are individual. To achieve this, they move humans' memories around. They can shape the world with thought, and when the protagonist learns this power, he challenges them, destroying them. It is revealed that the Earth is long since gone, and he lives on in this false world.   I've looked for titles like City of Night and City of Darkness, but can't find it. SingleEmailMessage sending isn't working when called from Unit Test I have the following code:      public class OrderRequestCreationEmails {     public static void sendMail()     {          Messaging.reserveSingleEmailCapacity(2);         Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();         String[] toAddresses = new String[] {'dgriff@varonis.com'};           mail.setToAddresses(toAddresses);          mail.setReplyTo('dgriff@varonis.com');          mail.setSenderDisplayName('Mail Test');          mail.setSubject('Success! Mail Sent');          mail.setBccSender(false);         mail.setPlainTextBody('BODY');          Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });     } }   I tried to call this function from a test as such: (I know its not an actual test, its just to see if I receive a mail).  @isTest private class CreationEmailsTest {     @isTest private static void sendMailTest() {         OrderRequestCreationEmails.sendMail();     } }   And I haven't received the mail, no idea why?  It's an example I took from the salesforce developer guide. couldn't find any answers online...  FYI - deliverability in the sandbox is turned on, and test deliverability works How can I attach a file to a question? I want to attach a code file to my question, but I am not able to find a link to do it. Is attaching files possible at all? Book recommendations What does ` (backquote/backtick) mean in commands? How do I get Mediatek MT7630E 802.11bgn Wi-Fi Adapter working? It worked with the pre-installed Ubuntu, but after re-installing Ubuntu dual-boot with Windows 8.1, the WiFi is not working.  Is there a driver for this adapter that will work on Ubuntu 12.04? EL expressions not evaluated in JSP I have a video clip of a car driving by from left to right. My goal is to add a decal (mask) to the car door.  Right now I am painstakingly moving the mask via X and Y. By just typing some commands, how can Ubuntu be uninstalled? I don't want to install Windows or anything, leaving my PC without an OS.  Would this command work?  sudo rm -rf / How do I sort a dictionary by value? A couple years ago, it was easy to root any device: Install KingRoot, KingoRoot, or a similar app, hit the large ROOT button, and let it do the rest. After 5 minutes or so, a green "Root Succeeded!" prompt will pop up, and we can choose to keep the root app, or uninstall it and install a clean root manager app like SuperSU/Superuser.  How do they work? Why aren't they working anymore? And if they work, should I use them or not? While using the top bar to navigate across communities, I noticed that the reputation displayed on meta sites on that list does not match the one of their corresponding main sites:    I have noticed on past situations that reputation gained takes a bit to "update" on the display on Meta sites (that is, if you gain rep on SO, for example, it will take some time for you to see your updated rep on MSO).  However, I have never noticed this behavior here, on the Sites List of the top bar. Furthermore, the "delay" here seems to be more severe, as the "outdated" rep showed is of several days ago (for example, I turned 3k on SO almost exactly a week ago, but the rep shown on MSO is still &lt;3k).  Any idea what could be causing this behavior?    Update: 2 months later this persists: my main site rep updates correctly but their corresponding meta rep remains the same as in the image above.     Update: As per Catija's  I removed the site (MSO) and put it back in, but it didn't update the rep.   However, after removing one site (TWP Meta), waiting at least a day, and then adding it back I see that although the reputations still don't match, the number displayed did changed a bit (previously 29,924 but now 33,112): Intermediate ring between a field and an algebraic extension. This is an exercise in some textbooks.     Let $E$ be an algebraic extension of $F$. Suppose $R$ is ring that contains $F$ and is contained in $E$. Prove that $R$ is a field.   The trouble is really with the inverse of $r$, where $r\in R$. How to prove that $r^{-1}\in R$, in apparent lack of a characterization of $R$.  It occurred to me to use the smallest field containing $R$ ($R$ is easily shown to be an integral domain), that's the field of quotients, and proving that it's $R$ itself, but I don't really know how to proceed.  A not-too-weak, not-too-strong hint will be much appreciated.   Beware $ $ Readers seeking only hints should  beware that there is now a complete answer. Winter 18  does not get values from a parent record Why isn’t the definite article used in "The commission commanded that work [...] should cease"?