I have a function in a controller, and I receive the information for a form. I have this code: public Actionresult functionOne(string a, string b, string c = &quot;foo&quot; )  I tried to convert this to a class like public class bar {     public string a {get;set;}     public string b {get;set;}     public string c {get;set;} }  and receive them as a object  public Actionresult functionOne(bar b)  Also I tried to put the defaultvalue in 'c' but is not working, I tried this: public class bar {     public string a {get;set;}     public string b {get;set;}     [System.ComponentModel.DefaultValue(&quot;foo&quot;)]     public string c {get;set;} }  Nothing happened with that, I receive it as null also I tried public class bar {     public string a {get;set;}     public string b {get;set;}     public string c      {         get         {             return  c;         }         set         {             c=&quot;foo&quot;; //I also tried with value         }     } }  What should I do to write this default value?
How do you give a C# auto-property an initial value?  I either use the constructor, or revert to the old syntax.    Using the Constructor:  class Person  {     public Person()     {         Name = "Initial Name";     }     public string Name { get; set; } }   Using normal property syntax  (with an initial value)  private string name = "Initial Name"; public string Name  {     get      {         return name;     }     set     {         name = value;     } }   Is there a better way?
Calculationg base-resistor between microcontroller and transistor I'm curious, when connecting my 2N2222 transistor's base to a PWM output pin on my Arduino, I know the Arduino can deliver a maximum of 40mA current. The 2N2222 only requires around 5 to 10 mA on it's base to switch the collector and emitter. Now, when calculating the base-resistor under "normal" conditions where I'm merely switching it directly from Vcc, the following applies:   However, when putting in a 500 ohm or 1K resistor in (1K for 5mA) directly it works great. But putting it in between the Arduino and the transistor, the transistor doesn't switch.  I suspect thus, that the resistance is too high of the base-resistor. Therefore, we may very well not need a base-resistor.  But, according to spec, the Arduino can deliver 40mA. So, am I correct in assuming the folling: 1) I should calculate the perceived resistance that the Arduino is giving, if it goes high to 5Volt and only gives 40mA, and then 2) Subtract that from the 500ohm resistor needed to make the transistor operate optimally.  Example:    So, I'm theorising that I have to then put in a 375 ohm resistor in to make the total resistance between the Arduino and the base resistor 500 ohm.  Somehow this doesn't feel right. Keep in mind, I'm not an electronic engineer, so I might have the cat by the tail here :P Script failing with "command not found: ^M" When I try to run the following script in zsh, via the command /bin/zsh ~/.set_color_scheme.sh I get the following error:  command not found: ^M   The script has u+x permissions and it used to work on another machine that also had zsh. Any clues why?   Note: This question is related to  (where I am trying to adapt the script for tcsh)  #!/bin/zsh # Contents of set_color_scheme.sh  export LS_COLORS=$( \ ( grep '\w' | grep -v '^#' | sed 's/#.\+//' | perl -lane 'printf "%s=%s:", shift @F, join ";", @F;' ) &lt;&lt;&lt; "  # HUMAN_FORMATTED_DATA # list one per line  # these are basic filesystem items no 00          # normal fi 00          # file di 01 34       # directory ln 00 36       # link pi 40 33       # pipe so 00 35       # bd 40 33 01 cd 40 33 01 or 01 05 37 41 mi 01 05 37 41 ex 00 91       # executable ow 01 34       # other writables   *.cmd 00 32 *.exe 00 32  # archive, compressed things etc *.gz  00 90 *.bz2 00 90 *.bz  00 90 *.tz  00 90 *.rpm 00 90 *.rar 00 90 *.zip 00 90 *.iso 00 90   *.cpio 00 31    # perl &amp; CODE *.c      33 *.h      33 *.sh     33 *.t      33 *.pm     33 *.pl     33 *.cgi    33 *.pod    33 *.PL     33 *.js     33 *.php    33 #*.xs  # strikethrough *.off 00 9 *.bak 00 9 *.old 00 9   # documents misc, html webstuff # really TEXT *.htm    94 *.html   94 *.txt    94 *.text   94 *.css    94   # MOVIE *.avi    96 *.wmv    96 *.mpeg   96 *.mpg    96 *.mov    96 *.AVI    96 *.WMV    96 *.mkv    96  # images &amp; pdf *.jpg    96 *.jpeg   96 *.png    96 *.xcf    96 *.JPG    96 *.gif    96 *.svg    96 *.eps 00 96 *.pdf 00 96 *.PDF 00 96 *.ps  00 96  *.ai  00 91 # adobe ill *.doc 00 91 # msword   # data, such as .db, .csv *.csv    95 *.dsv    95 *.db     95 *.sql    95 *.meta   95 # CONFS *.xml    95 *.yaml   95 *.yml    95 *.conf   95 # [a-z0-9]*rc ") Can I have 8 GB RAM on 32-bit Win 7? Possible Duplicate:             According to , Win 7 only supports 4 GB of RAM. I, however have been reading some forums and some say they are using 8 GB RAM with good performance. I am wondering if I can use 8 GB before I purchase. Are \( and \) preferable to dollar signs for math mode? Along the lines of , what reasons are there (if any) to favor \( ... \) over $ ... $? memoryless property of exponential distributions with random variables It is true that $P(X&gt;t+s|X&gt;t)=P(X&gt;s)$ for certain values $t$ and $s$.  However, how can I show that this still holds if:   $T$ is a continuous random variable. That is $P(X&gt;T+s|X&gt;T)=P(X&gt;s)$ Both $T$ and $S$ are continuous RVs: $P(X&gt;T+S|X&gt;T)=P(X&gt;S)$   All the random variables are independent. I'm quite confused about the following regular expressions I found in a shell script:  ${0##*/} ${0%/*}   How do they work? Why don't the colonists wear spacesuits in Alien: Covenant? In the beginning of the Alien: Covenant movie, a group of colonists from the main ship make a landing on an unknown planet, which they found out accidentally after ship has been bombarded by an unknown wave from a star collapse and what bothers me, is that they don't wear any spacesuits, any protective gear, any air filter systems, just nothing.  Is that really the way future space expeditions gonna explore new possible planets presumed as possible habitable homes for humanity?  Every 5th grader knows, from the biology school lessons, that water, air, and even earth itself contains and gives life to a thousands of viruses, bacteria, and microorganisms.  You can breathe in bacteria, or virus, and be dead in a seconds.  Do film makers really suppose we will take it as realistic depiction of extraterrestrial expedition?   Reality check just screams out loud.  What do you think can be their motivation for such a decision? Should I vote to close a duplicate question, even though it's much newer, and has more up to date answers? I have seen this many times, a question is being asked because a previous, duplicate question was asked and answered a few years ago and has no longer relevant answers.  The  is to edit the old question, or add new answers to it, but it is not always happening.  I was wondering, should I still mark it as duplicate and vote to close it? Or just leave it as is? What books would you recommend to start learning about software testing I'm trying to learn more about software testing, so I want to know which books you would recommend on this topic Disabling sound output devices (e.g. Internal Speakers) in OS X Since my Cinema Display is both connected through mDP and USB, I can (stupidly enough) both choose “LED Cinema Display” or “Display Audio”.  Also, I never use the internal speakers since they sound extremely tinny.    How do I remove/delete/disable unwanted audio devices? It must be possible somehow! Make gnome-terminal show the command running as title I want the name of command running , e.g unzip to be visible through the title bar of gnome-terminal , but it seems to be impossible , if the application running doesn't set a title explicitly , even though I choose 'Replace initial title' option in the profile dialog. Java: Load class from string Why can't the end code of an environment contain an argument? Environments are allowed to have arguments, but reference to those arguments can only appear in the opening code of the environment, and not the closing code.  What is the reason for this, and are there preferred ways around it?  e.g.  \newenvironment{foo}[1]% {some code #1} % allowed {some code #1} % not allowed Why are my villagers attempting to breed (they have the red hearts) but then stop breeding suddenly and gray "angry" particles pop up? I set up a villager breeder and set down 4 beds with 2 villagers in the middle and a carrot farmer supplying them with carrots. The first time both of those villagers bred the breeder worked perfectly fine. After that, however, the gray angry particles popped up every time they would try to breed (they would engage in breeding at a normal pace, just could not actually produce a baby). I even killed the one villager they produced in case it took a bed and even then, the two villagers would not breed anymore. Is there something I have done wrong? This seems odd considering they were only able to breed once and even by eliminating their offspring the villagers could not breed again. Edit: version is 1.16.4 "Typos" are acknowledged as "technical" errors, ones that obviously aren't caused by the writer's poor spelling. Although less frequent than in typing, they can also occur in handwritten texts, as a result of absent-mindedness or just an accidental stroke of the pen.   Since the text wasn't actually typed, it sounds funny to call them "typos". Is there a more fitting word, one that reflects the "accidental" nature of the error? Mannequin Duplication glitch How to type the Indian Rupee Symbol? I want to type the Indian Rupee Symbol. So I went to System Settings >> Keyboard Layout and clicked on the Options button. Under the Adding Currency signs to keys sections, I checked the Rupee on 4 option.    Later when I opened the Layout Chart of the Keyboard there was Rupee sign in the 4 key but I do not know how to type the symbol. What combination of the keys will type the Rupee symbol on the screen? I always use align in my documents, and avoid equation. Is there anything wrong with that? My reasoning behind this: align > equation, so why not use it? I am not very familiar with databases and the theories behind how they work.  Is it any slower from a performance standpoint (inserting/updating/querying) to use Strings for Primary Keys than integers? Why WordPress choose data serialization over json_encode? In my little age with WordPress, I've seen WordPress itself and its friendly plugins are using PHP serialize() in storing data into db in many cases. But in a recent search I found a serious community support for the json_encode() over the serialize().     And I personally tested an associative array with both of 'em, that shows:  serialize() stores 342 chars json_encode() stores 285 chars  Why I'm asking this? I'm on a project while I'm going to store repeating meta fields to a post. Where:  Data would be basically in English, but sometimes can be Bengali Data would be associative array, 3 level deep (I hope I understood levels correctly):   array(     1 =&gt; array(         'key'=&gt;'value',         'key2'=&gt;'value'     ),     2 =&gt; array(         'key'=&gt;'value',         'key2'=&gt;'value'     ) )  I've checked the postmeta table's meta_value field it's a longtext,  a length of 4,294,967,295 chars (4GB). So I need a robust solution into storing things.