I want to apply a decorator to every method in a class. I don't have source code of the class, so I can't directly apply the decorator. I want to call some function that accepts the class and adds the decorators.  But the problem is testclass.__dict__ is a mappingproxy object and it doesn't support any assignment or modification, directly at least. So the question is how to avoid that restriction and apply decorator?  Here is code of the failed attempt:  class qwer:     def test(self):         print('test')  def decor(func):     def w(*args, **named_args):         print('decor')         func(*args, **named_args)     return w  qwer.__dict__['test'] = decor(qwer.__dict__['test'])   Error:  TypeError: 'mappingproxy' object does not support item assignment
I want to assign a class attribute via a string object - but how?  Example:  class test(object):   pass  a = test() test.value = 5 a.value # -&gt; 5 test.__dict__['value'] # -&gt; 5  # BUT: attr_name = 'next_value'  test.__dict__[attr_name] = 10 # -&gt; 'dictproxy' object does not support item assignment
Let $S = \bigoplus_{n\ge 0} S_n$ be a graded commutative ring. Let $f$ be a homogeneous element of $S$ of degree $&gt; 0$. Let $S_{(f)}$ be the degree $0$ part of the graded ring $S_f$, where $S_f$ is the localization with respect to the multiplicative set $\{1, f, f^2,\dots\}$. Suppose $S$ is finitely generated algebra over $S_0$. Then $S_{(f)}$ is a finitely generated algebra over $S_0$. TikZ Angle Label - Help it "fit" better? I have the following drawn with TikZ    using the code  \documentclass{article} \usepackage{tikz} \usepackage{tkz-euclide} \usetkzobj{all} \begin{document} \begin{tikzpicture} \coordinate (O) at (0,0); \draw (O) circle (3); \coordinate[label = above left:$M$] (M) at (130:3); \coordinate[label = above:$N$] (N) at (80:3); \coordinate[label = below:$A$] (A) at (240:3); \coordinate[label =below right:$B$] (B) at (300:3); \draw (A) -- (M) -- (B); \draw (A) -- (N) -- (B); \tkzMarkAngle[draw = black, fill = white, opacity=1](A,M,B) \tkzLabelAngle[pos = 0.8](A,M,B){$x$} \tkzMarkAngle[pos = 0.2,draw = black, fill = white, opacity=1](A,N,B) \tkzLabelAngle [pos=0.8](A,N,B){$27 ^{\circ}$} \end{tikzpicture} \end{document}   Notice however, tht the 27 degrees does not fit in very nicely. How can I adapt the code to try and move the 27 a bit "lower" so that it fits in better, as well as the angle mark?  Also, how can I get two "double arrows" in the middle of lines AM and BN, to indicate that they are 'parallel'? System.LimitException: Too many query rows: 50001 What I am trying to do is to set a date in my date field and also update the object. I am using the class below to do so which works just fine in my sanbox but in production I am getting this error:      System.LimitException: Too many query rows: 50001   public with sharing class updateObject{     public  List&lt;NRProducts__c&gt;  values;     public PageReference updateObject() {         values=[SELECT Refreshed_Date__c FROM NRProducts__c ];         for (NRProducts__c s :values){            s.Refreshed_Date__c =Date.today();          }          update values;         return null;                       }     }   VF Page:  &lt;apex:page showheader="false" controller="updateObject" sidebar="false"&gt; &lt;apex:form&gt;  &lt;apex:commandButton action="{!updateObject}" value="Update"/&gt; &lt;/apex:form&gt; &lt;/apex:page&gt; How to prove that $\lim\limits_{x\to0}\frac{\sin x}x=1$? How can one prove the statement $$\lim_{x\to 0}\frac{\sin x}x=1$$ without using the Taylor series of $\sin$, $\cos$ and $\tan$? Best would be a geometrical solution.  This is homework. In my math class, we are about to prove that $\sin$ is continuous. We found out, that proving the above statement is enough for proving the continuity of $\sin$, but I can't find out how. Any help is appreciated. What is meant by "object serialization"? Can you please explain it with some examples? I'm sure its a simple question and I suppose it was asked many times, but I just can't figure it out from other answers, sorry.  I use recent versions of PostgreSQL and MySQL. I have 2 tables:  CREATE TABLE authors (     id INT,     name VARCHAR )  CREATE TABLE posts (     id INT,     author_id INT,     text VARCHAR,     date DATE )   I need to select one most recent post for each author. Thanks!  UPDATE  Thanks, both links provide answers to my question with some exception. All the following queries give the same result (which one is the most efficient btw?) The issue is when there is more than one post from the same author with the same date. Then the returned result set contains all such posts. How should I modify these queries to return exactly one post per author?  SELECT p1.* FROM posts p1 LEFT JOIN posts p2 ON p1.author_id = p2.author_id AND p1.date &lt; p2.date WHERE p2.author_id IS NULL ORDER BY p1.author_id;  SELECT p1.*  FROM posts p1 INNER JOIN (   SELECT author_id, MAX(date) AS max_date   FROM posts   GROUP BY author_id) p2   ON p1.author_id = p2.author_id AND p1.date = p2.max_date ORDER BY p1.author_id;  SELECT * FROM posts p1 WHERE date = (SELECT MAX(p2.date)               FROM posts p2               WHERE p1.author_id = p2.author_id) ORDER BY author_id;  SELECT * FROM (     SELECT author_id, MAX(date) date     FROM posts GROUP BY author_id ) p1 INNER JOIN posts p2 USING (author_id, date) ORDER BY author_id; What is butterfly lighting, and when do I use it? I often hear the term 'Butterfly Lighting' used when discussing high-fashion and glamor photography. How do I set up Butterfly Lighting, and when do I use it? What is the distance a creature or player can travel if they have multiple types of movement speeds? I want to draw a TikZ matrix with its border and I would like to define the distance between most external matrix nodes and matrix border. Something like a matrix inner sep. If I change inner sep in matrix options declaration, all nodes inside the matrix also change its inner separation.      I know how to do it with fit library. I just want to know if its possible without it. The probability that an initial quantum state $|\psi_i\rangle$ becomes the final quantum state $|\psi_f\rangle$ is given by  \begin{eqnarray} P(i \rightarrow f) &amp;=&amp; |\langle\psi_f|\psi_i\rangle|^2 \tag{1}\\ &amp;=&amp; \langle\psi_f|\psi_i\rangle^*\langle\psi_f|\psi_i\rangle \\ &amp;=&amp; \langle\psi_i|\psi_f\rangle\langle\psi_f|\psi_i\rangle. \end{eqnarray}  Equation (1) seems to show that the probability for the transition ($i\rightarrow f$) can be interpreted as the system both moving forward in time ($i\rightarrow f$) with amplitude $\langle\psi_f|\psi_i\rangle$ and backward in time ($f\rightarrow i$) with amplitude $\langle\psi_i|\psi_f\rangle$ simultaneously.  Does this reasoning help to explain the Born rule? (Is it like the Transactional Interpretation of QM?)  I guess we must experience the macroscopic direction of time ($i\rightarrow f$) in accord with increasing entropy in an expanding universe whereas microscopically QM works both forwards and backwards in time.  Addition  This is an improved version of the argument including time-evolution operators.  The probability that an initial quantum state $|\psi_i\rangle$ evolves to become the final quantum state $|\psi_f\rangle$ is given by  \begin{eqnarray} P_{i \rightarrow f} &amp;=&amp; |\langle\psi_f|U_{i \rightarrow f}|\psi_i\rangle|^2 \tag{2}\\ &amp;=&amp; \langle\psi_f|U_{i \rightarrow f}|\psi_i\rangle^*\langle\psi_f|U_{i \rightarrow f}|\psi_i\rangle \\ &amp;=&amp; \langle\psi_i|U^\dagger_{i \rightarrow f}|\psi_f\rangle\langle\psi_f|U_{i \rightarrow f}|\psi_i\rangle \\ &amp;=&amp; \langle\psi_i|U_{f \rightarrow i}|\psi_f\rangle\langle\psi_f|U_{i \rightarrow f}|\psi_i\rangle \end{eqnarray} where $U_{i \rightarrow f}$ is the forward-time evolution operator and $U_{f \rightarrow i}=U^\dagger_{i \rightarrow f}$ is the corresponding backward-time evolution operator.  Equation (2) seems to show that the probability $P_{i\rightarrow j}$ can be interpreted as the system first evolving forwards in time and then evolving backwards in time.  Perhaps this is an example of Murray Gell-Mann's  that "Everything not forbidden is compulsory"? At the quantum level, below observable probabilities, there is nothing to stop time flowing both forwards and backwards. I am getting the following error in a Drupal 8 site.     The following module is missing from the file system   It looks as if a custom module was installed and deleted without uninstalling it.   How can I fix this error? Types of books or Types of book? can anybody tell me which one of these is the correct one? I have been searching all over the internet but I have still got no answer.  Types of books Types of book How does the Higgs mechanism work? I'm not a particle physicist, but I did manage to get through the Feynman lectures without getting too lost. Is there a way to explain how the Higgs field works, in a way that people like me might have a hope of understanding? How to make excel automatically fill a value in a cell of a sheet when another corresponding cell of another sheet is filled the same value? How can I get a more traditional drop-down like menu for Unity? Is it safe to give out one's bank account number? I'm managing the utility of the house and I'm sharing with another person. He asks me to provide my bank account number, so that he can transfer his money to my account when paying the utility.    I wonder if it is safe to give out my bank account number?   For example, if I'm correct, many online payments just need the account number to draw money out of it. Is giving out the bank account number safer than handing a check to another person, since there is also the account number printed on the check? Convergence of $\sqrt{n}x_{n}$ where $x_{n+1} = \sin(x_{n})$ How do I remove duplicates from a C# array? I have been working with a string[] array in C# that gets returned from a function call. I could possibly cast to a Generic collection, but I was wondering if there was a better way to do it, possibly by using a temp array.  What is the best way to remove duplicates from a C# array? What off-camera flash solution should I use with an entry-level Nikon? What is the best way to clean the sensor on a interchangeable lens camera (mirrorless or digital SLR)? I've got a couple of spots of dust on the sensor of my Canon 20D. A rocket blower isn't shifting them, and I'm ridiculously scared of some of the more direct methods for cleaning sensors — what methods/systems have you tried, and how successful have they been?