The trigger is giving me an error      CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY . Maximum trigger depth exceeded.   Now this trigger is working f9 in after insert event but i want it after update. I can't understand where its going wrong.     trigger updatingsuffix on Account (after update) {     List&lt;Account&gt; acclst=new List&lt;Account&gt;();     Set&lt;Id&gt; accset=new Set&lt;Id&gt;();     if(trigger.IsInsert){         for(Account a:trigger.new){             accset.add(a.Id);         }          for(Account a:[select Id,Name,Gender__c from Account where Id=:accset]){             if(a.Gender__c=='Male'){                 a.Name='Mr. '+a.Name;                 acclst.add(a);             }             else if(a.Gender__c=='Female'){                 acclst.add(a);             }         }         if(acclst!=null){             update acclst;         }     } }
I added a new field on Opportunity table to keep a count of records, as well as track the updates made on that record.  This is needed for an external system we use. Opportinity table already has around 5000 records now. I would like to update the new field that I added with some sequence order initially. Say each record to have a unique sequence number like 1,2,3 etc(can't use the Id field for unique). The field "Identifier__c" was added for this purpose with data type number and unique contraint. For that I created a temporary class and trigger. But it is throwing the error.     Review all error messages below to correct your data. Apex trigger OpportunitySAPIdentifierHandler caused an unexpected exception,   contact your administrator: OpportunitySAPIdentifierHandler: execution   of BeforeUpdate caused by: System.DmlException: Update failed. First   exception on row 0 with id 006E00000038FPSIA2; first error:   CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, OpportunitySAPIdentifierHandler:   execution of BeforeUpdate caused by: System.DmlException: Update   failed. First exception on row 0 with id 006E00000038FPTIA2; first   error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY,   OpportunitySAPIdentifierHandler: execution of BeforeUpdate caused by:   System.DmlException: Update failed. First exception on row 0 with id   006E00000038FPSIA2; first error: SELF_REFERENCE_FROM_TRIGGER, Object   (id = 006E00000038FPS) is currently in trigger   OpportunitySAPIdentifierHandler, therefore it cannot recursively   update itself: [] Class.AutoNumber.OpportunityAutoNumber: line 76,   column 1 Trigger.OpportunitySAPIdentifierHandler: line 4, column 1: []   Class.AutoNumber.OpportunityAutoNumber: line 76, column 1   Trigger.OpportunitySAPIdentifierHandler: line 4, column 1: []:   Class.AutoNumber.OpportunityAutoNumber: line 76, column 1   Below is the trigger and class used.  trigger Opportuniwith sIdentifierHandler on Opportunity (before insert,before update) {          If(Trigger.isInsert || Trigger.isUpdate){             AutoNumber.OpportunityAutoNumber(Trigger.new);         }   }   The class is   public with sharing class AutoNumber {       public static void OpportunityAutoNumber (List&lt;Opportunity&gt; Opp) {          if(Trigger.isUpdate || Trigger.isInsert) {              for(Opportunity p: Opp) {                  List&lt;Opportunity&gt; oppList = new List&lt;Opportunity&gt;();                 oppList = [SELECT Id, createdDate, Identifier__c FROM Opportunity where Identifier__c = null and Id != :p.Id limit 100 FOR update];                 for (Opportunity oppL: oppList) {                      if(oppL.Identifier__c == null) {                          List&lt;Opportunity&gt; OpportunityList = new List&lt;Opportunity&gt;([select Identifier__c from Opportunity where Identifier__c != null order by Identifier__c desc limit 1]);                          if (!OpportunityList.isEmpty()) {                               Decimal maxval = OpportunityList.get(0).Identifier__c;                             oppL.Identifier__c = maxval + 1;                             update oppL;                         }                      }                     // integer currentCounter = Integer.valueOf(opp.Identifier__c);                     // oppr.Identifier__c = currentCounter + 1;                     // update oppr;                 }             }         }        }  }
If $\int_0^x f \ dm$ is zero everywhere then $f$ is zero almost everywhere I have been thinking on and off about a problem for some time now. It is inspired by an exam problem which I solved but I wanted to find an alternative solution. The object was to prove that some sequence of functions converges weakly to zero in $L^2$.   I managed to show (with some help) that the limit $f$ (of a subsequence) satisfies $\int_0^x f \ dm=0$ for all $x&gt;0 $. From this I want to conclude that $f=0$ a.e. I can do this with the fundamental theorem of calculus in its Lebesgue version but there ought to be a more elementary proof.  Can someone here help me out? Where did object dimensions go in 2.8? Anyone seen this panel? Essential for precise modeling. Difference of the floor of a product and the product of floors Is there any way the following can be simplified?  $$\lfloor f(x)\cdot g(x) \rfloor - \lfloor f(x) \rfloor  \cdot \lfloor g(x) \rfloor$$ How do I remove Steam? Anyone know of a way to remove Steam from Ubuntu 12.04? Looked around the net but could not find an straight forward solution.    Thanks. 'pagesize' attribute ignored in hot network list Steps to reproduce:   Open  in Guest/Incognito mode or with cookies disabled. This will have 30 questions per page by default. Click the  link and as expected, you'll see questions 1-50 with page size of 50. Go the the  and see the bug: you're in the second page of 30 items per page, i.e. you'll see questions 31-60 instead 51-100 as expected.     It is very annoying. Please fix it.  My user-agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:70.0) Gecko/20100101 Firefox/70.0  There are no plugins installed affecting the site. It happens both when logged in or not.  The mechanism used to work before, but some weeks/months ago it stopped, enough to bother me to post here :)  Here are all modified "privacy" settings from about:support page:  privacy.clearOnShutdown.offlineApps true privacy.clearOnShutdown.openWindows true privacy.clearOnShutdown.siteSettings    true privacy.cpd.offlineApps true privacy.cpd.openWindows true privacy.cpd.passwords   true privacy.cpd.siteSettings    true privacy.donottrackheader.enabled    true privacy.history.custom  true privacy.item.cookies    true privacy.sanitize.migrateClearSavedPwdsOnExit    true privacy.sanitize.migrateFx3Prefs    true privacy.sanitize.pending    [{"id":"shutdown","itemsToClear":["cache","cookies","offlineApps","history","formdata","downloads","sessions","siteSetti privacy.sanitize.sanitizeInProgress ["cache","cookies","offlineApps","history","formdata","downloads","sessions","siteSettings","openWindows"] privacy.sanitize.sanitizeOnShutdown true privacy.sanitize.timeSpan   0 privacy.trackingprotection.enabled  true privacy.trackingprotection.introCount   20 Fatal error occurred, no output PDF file produced in php file We are using following code in .php script for generate .pdf file.  $result1 = exec("R CMD Sweave /var/www/html/r/r_latex_sweave.Rnw");  $result2 = exec("pdflatex /var/www/html/r/r_latex_sweave.tex");   but, we are getting this errors when we are executing .Rnw and .tex files.  ! I can't write on file `r_latex_sweave.log'. Please type another transcript file name:  ! Emergency stop !  ==> Fatal error occurred, no output PDF file produced!  Note: We have .tex and .Rnw folder in /var/www/html folder? Why is     $$\lim_{n \to \infty} \frac{2^n}{n!}=0\text{ ?}$$   Can we generalize it to any exponent $x \in \Bbb R$? This is to say, is     $$\lim_{n \to \infty} \frac{x^n}{n!}=0\text{ ?}$$     This is being repurposed in an effort to cut down on duplicates, see here: Coping with  duplicate questions.  and here: . I have two machines with RJ11 ports and I had a RJ11 Modular Telephone Cable lying around.I wondered if it was possible to create a network between the two machines with those RJ11 Modular Telephone Cable (back to back via RJ11 ports) much like a network we create between two computers with a single RJ45 Modular connector cable.  Is this setup possible at all ? If it is , what will be the maximum transfer speed i can achieve between these two computers ? In the simple harmonic oscillator model, we talk about the angular frequency and I understand that this tells something about the instantaneous angular velocity of the object. For example, a simple pendulum. But what does this mean when we apply this concept to an object attached to a spring that behaves as a simple harmonic oscillator? There is no instantaneous circular motion for the object, so how can we relate the angular frequency to a system like this? When and why will a compiler initialise memory to 0xCD, 0xDD, etc. on malloc/free/new/delete? I know that the compiler will sometimes initialize memory with certain patterns such as 0xCD and 0xDD.  What I want to know is when and why this happens.  When  Is this specific to the compiler used?  Do malloc/new and free/delete work in the same way with regard to this?  Is it platform specific?  Will it occur on other operating systems, such as Linux or VxWorks?  Why  My understanding is this only occurs in Win32 debug configuration, and it is used to detect memory overruns and to help the compiler catch exceptions.  Can you give any practical examples as to how this initialization is useful?  I remember reading something (maybe in Code Complete 2) saying that it is good to initialize memory to a known pattern when allocating it, and certain patterns will trigger interrupts in Win32 which will result in exceptions showing in the debugger.  How portable is this? Customise date-time format in Windows Is it possible to customize data (or date-time) format in Windows (I am using Windows&nbsp;XP)?  The current format which is followed by the OS [to show date-modified, etc.] is MM/DD/YYYY or M/D/YYYY, whereas I have been comfortable with DD/MM/YYYY or D/M/YYYY format. I am finding it hard to refer Date-modified [which I use often] of files and folders. For x < 5 what is the greatest value of x It can't be $5$. And it can't be $4.\overline{9}$ because that equals $5$. It looks like there is no solution... but surely there must be? I am trying to customize the legend for this graph. First of all, I would like the legend width to be equal to the x-axis width. At the moment, I am setting the width of the legend via      /tikz/every even column/.append style={column sep=1.0cm}   and I could manually adjust this value so that length equals the x-axis width, but I guess that there is a more elegant way to set the width of the legend.  Second, I don't really like the little color rectangles in the legend. I only want one rectangle in front of every entry and not two. This rectangle does not need to have a border and should be vertically centred with the text. The alignment seems to be okay for the rectangle closer to the text, but not for one the far left.   Update: Thanks to Christian Feuersänger's comment, there is possibility to change the rectangles via   legend image code/.code={%     \draw[#1, draw=none] (0cm,-0.1cm) rectangle (0.6cm,0.1cm);   or what Gonzalo Medina proposed  legend image code/.code={%     \draw[#1, draw=none, /tikz/.cd, bar width=3pt, yshift=-0.2em, bar shift=0pt] %     plot coordinates {(2*\pgfplotbarwidth,0.6em)};   Third, I would like to the legend entries to start next to the text "Legend:".  I don't really know if with these requirements it still makes sense to use legend or if it would be better to add everything manually via after end axis/.code and \ref{label}.  Graph    MWE  \documentclass{article} \usepackage{pgfplots} \pgfplotsset{compat=newest}  \begin{document} \begin{tikzpicture}     \begin{axis}[                 ybar,                 height=6cm,                 title={Some plot},                 width=12cm,                 axis on top,                 y axis line style={opacity=0},                 axis x line*=bottom,                 tick align=inside,                 tick style={draw=none},                 xtick=data,                 ymajorgrids,                 major grid style={draw=white},                 xtick={1,2,3,4},                 legend style={                     at={(0.0,-0.15)},                     anchor=north west,                     legend columns=-1,                     /tikz/every even column/.append style={column sep=1.0cm}                         },             ]                    \addlegendimage{empty legend}             \addlegendentry{\textbf{Legend:}}                                \addplot coordinates {                 (1, 0.2064)                 (2, 0.3961)                 (3, 0.5961)                 (4, 0.7961)}; \addlegendentry[text width=45pt, text depth=]{legend a}             \addplot coordinates {                 (1, 0.3064)                 (2, 0.4961)                 (3, 0.6961)                 (4, 0.8961)}; \addlegendentry[text width=65pt, text depth=]{lengend b}     \end{axis}  \end{tikzpicture} \end{document} Intermediate ring between a field and an algebraic extension. Colorimetry is not the same Best practices for making a WordPress site "movable"? I'm planning to buy a domain and install a WordPress site on it at a web-hosting company.  But first I'll need to iron-out some bugs...  I got a working LAMP-stack at my home-computer, so I'm thinking about first installing my site locally - off the Internet.  I'll be mostly tweaking and making "test-posts" to check that everything works, but I'll probably also make some posts I'd like to keep when I move the site and take it online.  When I'm done chasing bugs; I guess I'll just package the public_html|www directory-tree and upload it to the web-hosting company, and also export the database from my home-computer to the web-hosting.    What I'm wondering if there are some "best practices", some do-s and don't-s, some major pits to take note of?    For example, how can ensure the smooth transition of domain-name in posts and links as such, from localhost to whatever-i-end-up-buying.com (I know from previous attempt of running WordPress at my home computer, that this didn't always work quite well...). If $$\tan(\frac{\pi}{4}+\frac{\theta}{2})=\tan^3(\frac{\pi}{4}+\frac{\alpha}{2})$$, then prove that $$\sin \theta=\frac{3 \sin \alpha+\sin^3 \alpha}{1+3\sin^2 \alpha}$$  I tried using the fact that  $\frac{\cos A}{1-\sin A}=\tan(\frac{\pi}{4}+\frac{A}{2})$ but now not able to eliminate $\cos \alpha$ and $\cos \theta$. How should I proceed? I have an object at a fixed position in 3D space. I would like the camera to circle around it while facing it. I want to path of the camera to be circular in 2D, meaning that it does not move up or down.  I need this to be pretty accurate. I don't want to manually set a keyframe every frame for position and rotation. I would like to do this maybe with an expression, not with manual keyframing. I am not sure how to go about this but I think it is going to involve Python as well as some trigonometry. Injecting beans into a class outside the Spring managed context I'm an end-user of one of my company's products. It is not very suitable for integration into Spring, however I am able to get a handle on the context and retrieve the required bean by name.  However, I would still like to know if it was possible to inject a bean into this class, even though the class is not managed by Spring itself.  Clarification: The same application which is managing the lifecycle of some class MyClass, is also managing the lifecycle of the Spring context. Spring does not have any knowledge of the instance of MyClass, and I would like to some how provide the instance to the context, but cannot create the instance in the context itself. Fiction novel or movie about sentient dinosaurs