I'm trying to convert a string to a SolidColorBrush in C#. The code I'm using is:  arrColors[arrColors.Length - 1] =                           (SolidColorBrush)new BrushConverter().ConvertFromString(sLine);   where sLine is a string read from a text file. For example, sLine might be "Black".  This code gives me a FormatException.
I have a configuration file where a developer can specify a text color by passing in a string:   &lt;text value="Hello, World" color="Red"/&gt;   Rather than have a gigantic switch statement look for all of the possible colors, it'd be nice to just use the properties in the class System.Drawing.Brushes instead so internally I can say something like:   Brush color = Brushes.Black;   // Default   // later on...  this.color = (Brush)Enum.Parse(typeof(Brush), prasedValue("color"));   Except that the values in Brush/Brushes aren't enums.  So Enum.Parse gives me no joy.  Suggestions?
How to implement glob in C# Can I use Facebook's fb:friend-selector in an iframe? Why is $1^{\infty}$ considered to be an indeterminate form Unexpected Results From Clicking The Unanswered Button Compute the Riemann integral  $$\int_0^{\frac\pi2}\frac{\mathrm d \theta}{\sqrt{\sin \theta}}$$  It seems very difficult, I don't know how to go ahead.  Thank you very much for your help! "Where will you go" vs. "Where you will go" Which sentence is correct between these?      Where will you go?     Where you will go? Are there any good tools besides SeleniumRC that can fetch webpages including content post-painted by JavaScript? One major shortcoming of curl is that more and more wepages are having their main piece of content painted by a JavaScript AJAX response that occurs after the initial HTTP response. curl never picks up on this post-painted content.   So to fetch these types of webpages from the command line, I've been reduced to writing scripts in Ruby that drive the SeleniumRC to fire up a Firefox instance and then return the source HTML after these AJAX calls have completed.  It would be much better to have a leaner command line solution for this type of problem.  Does anyone know of any? Are there non-legal consequences for wizards that meddle with time? How can I use a variable in the replacement side of the Perl substitution operator? I would like to do the following: $find = &quot;start (.*) end&quot;; $replace = &quot;foo \1 bar&quot;;  $var = &quot;start middle end&quot;; $var =~ s/$find/$replace/;  I would expect $var to contain &quot;foo middle bar&quot;, but it does not work. Neither does: $replace = 'foo \1 bar';  Somehow I am missing something regarding the escaping. What is the physical meaning of commutators in quantum mechanics? This is a question I've been asked several times by students and I tend to have a hard time phrasing it in terms they can understand. This is a natural question to ask and it is not usually well covered in textbooks, so I would like to know of various perspectives and explanations that I can use when teaching.  The question comes up naturally in what is usually students' second course in quantum physics / quantum mechanics. At that stage one is fairly comfortable with the concept of wavefunctions and with the Schrödinger equation, and has had some limited exposure to operators. One common case, for example, is to explain that some operators commute and that this means the corresponding observables are 'compatible' and that there exists a mutual eigenbasis; the commutation relation is usually expressed as $[A,B]=0$ but no more is said about that object.  This naturally leaves students wondering     what is, exactly, the physical significance of the object $[A,B]$ itself?   and this is not an easy question. I would like answers to address this directly, ideally at a variety of levels of abstraction and required background. Note also that I'm much more interested in the object $[A,B]$ itself than what the consequences and interpretations are when it is zero, as those are far easier and explored in much more depth in most resources.    One reason this is a hard question (and that commutators are such confusing objects for students) is that they serve a variety of purposes, with only thin connecting threads between them (at least as seen from the bottom-up perspective).   Commutation relations are usually expressed in the form $[A,B]=0$ even though, a priori, there appears to be little motivation for the introduction of such terminology. A lot of stock is placed behind the canonical commutation relation $[x,p]=i \hbar$, though it is not always clear what it means.  (In my view, the fundamental principle that this encodes is essentially de Broglie's relation $\lambda=h/p$; this is made rigorous by the  but that's quite a bit to expect a student to grasp at a first go.) From this there is a natural extension to the Heisenberg Uncertainty Principle, which in its general form includes a commutator (and an anticommutator, to make things worse). Canonically-conjugate pairs of observables are often introduced, and this is often aided by observations on commutators. (On the other hand, the energy-time and angle-angular momentum conjugacy relations cannot be expressed in terms of commutators, making things even fuzzier.) Commutators are used very frequently, for example, when studying the angular momentum algebra of quantum mechanics. It is clear they play a big role in encoding symmetries in quantum mechanics but it is hardly made clear how and why, and particularly why the combination $AB-BA$ should be important for symmetry considerations.  This becomes even more important in more rigorous treatments of quantum mechanics, where the specifics of the Hilbert space become less important and the algebra of observable operators takes centre stage. The commutator is the central operation of that algebra, but again it's not very clear why that combination should be special. An analogy is occasionally made to the Poisson brackets of hamiltonian mechanics, but this hardly helps - Poisson brackets are equally mysterious. This also ties the commutator in with time evolution, both on the classical side and via the Heisenberg equation of motion.   I can't think of any more at the moment but they are a huge number of opposing directions which can make everything very confusing, and there is rarely a uniting thread. So: what are commutators, exactly, and why are they so important? How do I execute the following shell command using the Python  module?  echo "input data" | awk -f script.awk | sort &gt; outfile.txt   The input data will come from a string, so I don't actually need echo.  I've got this far, can anyone explain how I get it to pipe through sort too?  p_awk = subprocess.Popen(["awk","-f","script.awk"],                           stdin=subprocess.PIPE,                           stdout=file("outfile.txt", "w")) p_awk.communicate( "input data" )   UPDATE:  Note that while the accepted answer below doesn't actually answer the question as asked, I believe S.Lott is right and it's better to avoid having to solve that problem in the first place! No splitter widget in new separate window I am new to Blender and I am trying to find my way through its interface. I want to have several windows (I mean OS windows, not Blender windows). So I create a separate window by dragging splitter widget while holding Shift.  The problem is there are no splitter widgets in the newly created OS window. So I can't have multiple blender windows in it. The new window does not have a Layout type drop down menu either. So how do I add new Blender windows in a new OS window? (Sorry if I'm using the wrong terms, but hopefully its clear what I am trying to achieve). Java Interface Usage Guidelines -- Are getters and setters in an interface bad? Is Iron Man stronger than the Hulk? In Avengers: Endgame, when Hulk initially uses the new Infinity Gauntlet, it takes a tremendous effort from him (in addition to almost burning his entire arm), in order to snap his fingers and restore the world as we knew it. Yet at the end of the movie, when Iron Man uses the Gauntlet, it seems very easy for him to snap his fingers.  How was Tony able to wield the stones with such ease when Hulk was clearly struggling with it? $x^p-c$ has no root in a field $F$ if and only if $x^p-c$ is irreducible? Hungerford's book of algebra has exercise $6$ chapter $3$ section $6$ [Probably impossible with the tools at hand.]:     Let $p \in \mathbb{Z}$ be a prime; let $F$ be a field  and let $c \in  F$. Then $x^p - c$ is irreducible in $F[x]$ if and only if $x^p - c$   has no root  in $F$. [Hint: consider two cases: char$(F) = p$ and   char$(F)$ different of $p$.]   I have attempted this a lot. Anyone has an answer? Counting files in leaves of directory tree Possible Duplicate:          For example the following are the same  # /usr/bin/php updateDatabase.php  # php updateDatabase.php   But how would I infer the location of the php command to be in /usr/bin? Engines that play Mangala? Horn and spindle tori Is adjoint of singular matrix singular? What would be its rank?