I'm writing a test class where i have to create a user first and after run test as that user. My code is:  @isTest static void test() {         //create a USer to run the test         Account a = new Account(Name='Test Account Name');         insert a;         Contact cont = new Contact(LastName = 'Contact Last Name', AccountId = a.id);         insert cont;         //UserRole ruolo=[select id from UserRole where Name='CEO'];         User user = new User();         user.ProfileID = [Select Id From Profile Where Name='System Administrator'].id;         user.UserRoleid=[select Id from UserRole where Name='CEO'].Id;         user.EmailEncodingKey = 'ISO-8859-1';         user.LanguageLocaleKey = 'en_US';         user.TimeZoneSidKey = 'America/New_York';         user.LocaleSidKey = 'en_US';         user.FirstName = 'username';         user.LastName = 'lastname';         user.Username = 'test@appirio.com';            user.CommunityNickname = 'testUser123';         user.Alias = 't1';         user.Email = 'no@email.com';         user.IsActive = true;         user.ContactId = cont.Id;         insert user;         System.RunAs(user) {                         Test.StartTest();             myfunction();             Test.StopTest();         }     }            @future         static void  myfunction(){                //ADDRESS             .......             }   but the System gives the error "Mixed DML Operation", i don't know how to handle it. Please help me
In my test class i have the creation of a dummy custom setting and a dummy lead:  Group g1 = new Group(Name='group name', type='Queue');              insert g1;             QueuesObject q1 = new QueueSObject(QueueID = g1.id, SobjectType = 'Lead');              insert q1;       SetOwner__c mycs = SetOwner__c.getValues('standardset');               if(mycs == null) {                               mycs = new SetOwner__c(Name= 'CustomValues');                  mycs.OwnerId__c ='00520000000z3PrAAI';                  mycs.RecordtypeID__c='012L00000004QsrIAE';                  insert mycs;      Lead lead = createNewLead(u2.id);                           insert lead;   ERROR:  MIXED_DML_OPERATION, DML operation on setup object is not permitted after you have updated a non-setup object (or vice versa): SetOwner__c, original object: QueueSobject: []   I get this error because i am trying to perform DML on setup and non-setup objects in the same transaction.  Any solution for this problem?
Where is the right place to register/enqueue scripts & styles I am using WordPress 3.1.4 by now. I am confused with where (which hook) do I use:   to register and/or enqueue  scripts and styles  on front- and back-ends?   Questions:   Which are right hooks to use? All front end register/enqueue scripts/styles in init? Why is there no admin_print_styles-{xxx}? What is the derivative of this? I have a function of the following form:  $J = \|W^TW-I\|_F^2$   Where, $W$ is a matrix and $F$ is the Frobenius Norm.  How can I find the derivative of $\frac{\partial J}{\partial W}$ ? Only actions taken are displayed on question while checking the history of Low Quality Posts review On Ask Ubuntu, when I try to view my Low Quality Posts review history and click on the action taken on questions, I can only see the actions taken and no preview of the question.   :    The question still exists on the site:   It seems question review history page is missing this HTML class:  &lt;div class="reviewable-post reviewable-post-post_id"&gt;   On the other hand, everything is working fine for answers. I have a following problem: when I plug-in my USB flash drive, it isn't shown in Windows Explorer or recognized by system at all. In device properties, it is shown as:     USB MEMORY BAR     There's no partitions on the drive, so I can't format it:    DISKPART:     Virtual Disk Service error:   There is no media in the device.   HP USB format tool:     There is no media in the specified device.   Any help will be greatly appreciated! Thank You! Eclipse doesn't start on Ubuntu 18.04 If you go to review a suggested edit and close the Reject dialogue box, the button at the top-right will continue to say "Rejecting...". You will not be able to continue with the review process.  I have refreshed the page, and tried clearing my cache. If I refresh the page, I can continue reviewing the edit.  I'm using Chrome Version 31.0.1650.57 m. What is the best way to explain how to choose between "its" and "it's"? How does friction stop a car? I'm unable to understand how friction causes motion in cars and also is responsible for stopping them. When it starts the impending motion of tyres is in the backward direction that's why friction is in the forward direction and the car starts moving. But when the car engine turns off, the car stops after some time, but the condition of tyres are the same as in the previous case and friction must be in the forward direction. What is the correct formula for gravitational time dilation for a satellite in a circular orbit? In the Wikipedia article on  I see two formulae for the gravitational time dilation. One contains $\sqrt{1 - r_0/r}$ but the other $\sqrt{1 - 1.5 r_0/r}$. What formula should I use to calculate the time dilation due to gravity inside a satellite? The speed induced time dilation is of course just special relativity.  With the first of these two formulas I can perfectly reproduce the graphs on time dilation as a function of $r$,  I find that the two contributions to time dilation cancel at 1.5 Earth radii, all numbers are OK... But why not the second formula? What is the current state of apple device (iPhone, iPod, etc.) support? Evaluate:  $$\lim_{x\to{0}}\bigg(\frac{2}{x^3}.(\arcsin{x}-\arctan{x})\bigg)^{2/x^2}$$  I can just expand $\arcsin{x}$ and $\arctan{x}$ using their taylor expansions, but is there any other method? Terminal flashes on empty backspace with Yosemite Since using Yosemite, I've had the annoying problem of my current Terminal window flashing when backspacing on an empty line. I know on previous versions of OS X this flashing was not default, and could be toggled in accessibility settings, but I cannot find the same setting and I'm dying to get this turned off. Any known ways to get rid of it? Refresh thumbnails in nautilus How does one refresh thumbnails in nautilus? In my videos folder I have some MKVs and only half of them have the movie border and a excerpt from the movie and the others (also MKVs encoded in the same way) just have the ordinary film icon.  (F5 doesnt do it.) I have 24 reputation points, but SO chat is still giving me the message "you must have 20 reputation...." Why can't I join the chat? I get a message:     Sorry, you are only allowed to ask 50 questions in a 30 day period   Why is there a question limit? 50/month is just not enough :) What are good initial weights in a neural network? How to transform negative values to logarithms? I would like to know how to transform negative values to Log(), since I have heteroskedastic data. I read that it works with the formula Log(x+1) but this doesn't work with my database and I continue getting NaNs as result. E.g. I get this Warning message (I didn't put my complete database because I think with one of my negative values is enough to show an example):   &gt; log(-1.27+1) [1] NaN Warning message: In log(-1.27 + 1) : NaNs produced &gt;    Thanks in advance  UPDATE:  Here is an histogram of my data. I'm working with palaeontological time series of chemical measurements, E.g the difference between variables like Ca and Zn is too big, then I need some type of data standardization, that is why I'm testing the log() function.   This is my How to prove the divisibility rule for $3\, $ [casting out threes] The divisibility rule for $3$ is well-known: if you add up the digits of $n$ and the sum is divisible by $3$, then $n$ is divisible by three.  This is quite helpful for determining if really large numbers are multiples of three, because we can recursively apply this rule:  $$1212582439 \rightarrow 37 \rightarrow 10\rightarrow 1 \implies 3\not\mid 1212582439$$ $$124524 \rightarrow 18 \rightarrow 9 \implies 3\mid 124524$$  This works for as many numbers as I've tried.  However, I'm not sure how this may be proven.  Thus, my question is:     Given a positive integer $n$ and that $3\mid\text{(the sum of the digits of $n$)}$, how may we prove that $3\mid n$? Creating vimrc breaks vim I'm currently logged into a server via ssh with ssh -Y and running a tmux session. If I start vim and run :colorscheme elflord the color scheme is changed. (Although the colors are not exactly what I would expect although they are I think 256 color. If I create a ~/.vimrc file and put a single line colorscheme elflord  in it then when I run vim it shows no color (just white text) and I cannot change the color with the :colorscheme command. How can I prove $\sqrt{2} ^{\sqrt{2}}$ is irrational?