Even after researching it a fair bit, I don't understand why I keep getting the CalloutException. No matter what I do to prevent it, the exception happens when triggering my API class via Process Builder:     An Apex error occurred: System.CalloutException: You have uncommitted   work pending. Please commit or rollback before calling out   The goal is to do the following when an Opportunity's Stage is changed:   Query for info from Opportunity ID Send HttpRequest to API Interpret HttpResponse   Here is the code:  private static Api_Settings__c Settings {get;set;}  @InvocableMethod(label = 'Request API Access'      description = 'Requests access to API a SF Opportunity meets criteria.') public static List&lt;Boolean&gt; CreateAndSendApiAccessRequests(List&lt;ID&gt; opportunityIds) {     Settings = Api_Settings__c.getOrgDefaults();      List&lt;AccessRequest&gt; requests = new List&lt;AccessRequest&gt;();      for (ID id: opportunityIds)     {         System.debug(id);          AccessRequest request = CreateApiAccessRequest(id);         requests.add(request);     }      List&lt;Boolean&gt; results = new List&lt;Boolean&gt;();      for (AccessRequest request: requests)     {         Boolean result = SendApiAccessRequest(request);         results.add(result);          System.debug(result);     }      return results; }  public static AccessRequest CreateApiAccessRequest(ID opportunityId) {     // Get info from the Opportunity ID     Opportunity opp = [         SELECT Name             ,Primary_Contact__r.Name             ,Primary_Contact__r.Email             ,Account.Name             ,Account.BillingAddress         FROM Opportunity         WHERE ID=:opportunityId];      // Create the address info from the Opportunity's Primary Contact     Address address = new Address();     address.line1 = opp.Account.BillingAddress.getStreet();     address.line2 = '';     address.city = opp.Account.BillingAddress.getCity();     address.postalCode = opp.Account.BillingAddress.getPostalCode();     address.stateOrProvinceCode = opp.Account.BillingAddress.getStateCode();     address.countryCode = opp.Account.BillingAddress.getCountryCode();      // Create the access request     AccessRequest request = new AccessRequest();     request.contactName = opp.Primary_Contact__r.Name;     request.contactEmail = opp.Primary_Contact__r.Email;     request.organizationName = opp.Account.Name;     request.address = address;     request.reason = 'Salesforce API Access Request';      return request; }  public static Boolean SendApiAccessRequest(AccessRequest request) {     Boolean result = false;      // Construct the request url     String requestUrl = Settings.ApiBaseurl__c + Settings.ApiEndpoint__c;      // Construct the Basic Auth string     String basicAuthString = BasicAuthService.GetBasicAuthString(Settings.ClientId__c, Settings.ClientSecret__c);      // Create the API access request     HttpRequest httpRequest = new HttpRequest();     httpRequest.setEndpoint(requestUrl);     httpRequest.setMethod('POST');     httpRequest.setHeader('Username', Settings.ApiHeaderUsername__c);     httpRequest.setHeader('Password', Settings.ApiHeaderPassword__c);     httpRequest.setHeader('Content-Type', 'application/json');     httpRequest.setHeader('Authorization', BasicAuthString);     httpRequest.setBody(JSON.serialize(request));      // Send the request     HttpResponse httpResponse = new Http().send(httpRequest);      // Ensure we received the correct status code     if (httpResponse.getStatusCode() == 201)     {         result = true;     }     else     {         result = false;     }      return result; }   I've tried to separate CRUD operations from callouts, but obviously it hasn't worked.  What am I missing here?
I am trying to execute a web service call to our backend system when the opportunity is closed/won. I am attempting to do a  POST to our endpoint. All the api call is really carrying the account name and a few structural detail back (All listed below). My problem is that when the trigger executes I get the following error in the debug logs "System.CalloutException: You have uncommitted work pending. Please commit or rollback before calling out".  The Process Builder Passing in the company name:   APEX Class  public class Play2 { @TestVisible static HttpResponse res;  @InvocableMethod public static void sendNotification(List&lt;String&gt; name) {        HttpRequest req = new HttpRequest();     Http http = new Http();     String payload = JSON.serialize(         new Map&lt;String, String&gt; {             'companyName' =&gt; name.get(0),             'salesforceAccountType' =&gt; 'Company',             'salesforceSynchStatus' =&gt; 'Enabled'         }     );      req.setEndpoint('https://TheEndPoint');     req.setMethod('POST');     req.setHeader('Authorization', 'The Mighty API KEY');     req.setHeader('Content-Type', 'application/json');      req.setBody( payload );     req.setCompressed(true);       try {         System.debug('Point 1');         res = http.send(req);         System.debug('Point 2');     } catch(System.CalloutException e) {         System.debug('Callout error: '+ e);         System.debug(res.toString());     } } }
When posting an HTTPS url like https://stackoverflow.com/..., it does not onebox in chat. For example: Me and my friends want to listen to music together. Two of us have Bluetooth Headphones (Beats Solo2 Wireless, Beats Studio Wireless) and one has a wired headset. Is there any way to use all three of these together? Why can the last block contain a full block of padding in CBC Encryption? I'm trying to understand the SSL Poodle Attack and I'm wondering why the last block of a CBC Record can be full of padding? Wouldn't that mean that the useful data was already a multiple of the key size?  Maybe I'm misunderstanding something else here, as it would seem like you can pad by any number of full blocks of padding. Just don't see why an SSL Library would do that.  Thanks! How to handle a native OS (Ubuntu) file upload window in selenium webdriver with python? This is my first time here but I have already posted this question on SO. I keep getting solutions for Windows + Java and not for Linux or python for that matter.  I am using Selenium and Python to automate a file upload application for the past many hours but nothing helpful!   The HTML DOM structure for this file upload is an input tag with its type attribute value = 'file'. I know I can make use of the send_keys.   The problem is I am not supposed to use send_keys() (as per the question I am trying to solve). The assumption is there are other ways of doing it.  Can anyone suggest me alternative ways to upload the file? I do get solutions for windows but not for Linux(Ubuntu). I know there are applications/tools to automate GUI components like AutoIt but there is nothing for Linux close to AutoIt.  I can say I have done my homework to find a solution. Only after not finding anything useful, I am asking this question, please help! About free quarks and confinement 2D and 3D vectors in Tikz I would like to draw some 2D and 3D vectors in Tikz with certain properties. The following primitive graph sums what I desire:   I just need the first quadrant of the Cartesian coordinate system for my representation.  I need the vector to be connected to the respective values on the distinct dimensions(not a projection, just orthogonal dashed lines).   The code segment below does what I want to achieve in 3D with two exceptions:  The projections on the xy plane and z dimension are given instead of connecting the head of the vector to the corresponding value in each dimension.  Numerical values are missing in dimensions.   Code: \documentclass[tikz]{standalone} \usepackage{tikz-3dplot} \begin{document}  \tdplotsetmaincoords{60}{120} \begin{tikzpicture}     [scale=3,     tdplot_main_coords,     axis/.style={-&gt;,blue,thick},     vector/.style={-stealth,red,very thick},     vector guide/.style={dashed,red,thick}]  %standard tikz coordinate definition using x, y, z coords \coordinate (O) at (0,0,0);  %tikz-3dplot coordinate definition using r, theta, phi coords \tdplotsetcoord{P}{.8}{55}{60}  %draw axes \draw[axis] (0,0,0) -- (1,0,0) node[anchor=north east]{$x$};     \draw[axis] (0,0,0) -- (0,1,0) node[anchor=north west]{$y$};     \draw[axis] (0,0,0) -- (0,0,1) node[anchor=south]{$z$};  %draw a vector from O to P \draw[vector] (O) -- (P);  %draw guide lines to components \draw[vector guide] (O) -- (Pxy); \draw[vector guide] (Pxy) -- (P); \end{tikzpicture} \end{document} Underfull \hbox in bibliography I am getting lots of "Underfull \hbox" warnings that point to the *.bbl file. It looks like these messages appear only when URLs are very long, like in the below example:  @techreport{nistguidesec,   author    = {Wayne Jansen and Timothy Grance},   title     = {Guidelines on Security and Privacy in Public Cloud Computing},   month    = {January},   note     = {Draft Special Publication 800-144. Available at \url{http://csrc.nist.gov/publications/drafts/800-144/Draft-SP-800-144_cloud-computing.pdf}}, }   In the produced PDF text is correctly hyphened and links are correctly split over several lines (I am using hyperref package)  How can I avoid annoying warning messages about "underfull \hbox" pointing to bibliography? How to remove RVM (Ruby Version Manager) from my system What are the limits on how I can cast, change, and retract votes? How to allocate aligned memory only using the standard library? Can I fine-tune my screen brightness? My laptop is Lenovo T400, and my OS is Ubuntu 10.10. I change the brightness of my screen by pressing the FN key and one of the two keys for increasing/decreasing brightness.  The brightness I feel comfortable is between two consecutive levels that are offered. So I wonder if it is possible to fine-tune the screen's brightness? I have the CKeditor plugin installed by itself (i.e. not using WYSIWYG module.) Then, it uses a CKEditor library located in sites/all/libraries/ckeditor. This works fine. I'd like to add more plugins to it; namely, the footnotes plugin. (For the moment, please refrain from "just download a new library from ckeditor.com and replace it"; there were other issues/considerations involved.)  Now, I see this everywhere when I try to look for a solution  config.extraPlugins = 'footnotes';   I tried adding that to admin/config/content/ckeditor/edit// -> Advanced Options -> Custom JavaScript configuration, but it white screens the editor.  I tried adding it to the config.js in sites/all/libraries/ckeditor like below, but it had no effect.  CKEDITOR.editorConfig = function( config ) {   config.extraPlugins = 'footnotes'; };   I can't really add it to a ckeditor.config.js file, dump that file in my theme, and choose "Yes" for "Load ckeditor.config.js from the theme path", since (for content creation/editing) it uses the admin theme which is different from the theme we're developing.  So, I'm at a loss. The only other thing I can think of is to use a hook in the module we have for the site, but I'm not sure if that's write/what hook would be called.  Is it just me, or does it seem like clear documentation on how to manage CKEditor in Drupal is severely lacking? Any help would be appreciated.  UPDATE: After some testing, it looks like the "Custom JavaScript configuration" is supposed to work, but it is possibly broken for CKEditor 4.4+ I read something (can't seem to find it now) that suggested the plugin/widget import was broken on 4.4+, so I changed to 4.3 and the extraPlugins worked. Now, I wasn't able to get footnotes working (which is what kicked this whole thing off), but some other plugins that previously failed during the same steps now work on 4.3. So, there's that. I'm wondering now if it's something with footnotes itself. How can I recursively clear the "Hidden" file flag on Windows Vista? A friend's computer was recently infected with a virus.  I hope the virus has been removed successfully. But, it appears that the virus set the "Hidden" flag on most directories and files on the system.   What's the most convenient way to clear this flag from selected directories and their contents? I want to run a script on all files with two specific extensions on a disk with a hierarchy of multiple nested folders.  My script works fine when I choose a folder further down the line with fewer subfolders but I'd like to run it on an entire archive with over a thousand folders.  The AppleScript takes forever to get all the files and then exits without returning anything and without executing the operations after getting the files.  No timeout message, no error message.  And the Finder becomes unresponsive (and remains stuck after the script exits).   set myFolder to choose folder with prompt "Choose a folder:"     tell application "Finder"         try             set eafFiles to (every file in entire contents of myFolder whose name ends with ".eaf") as alias list         on error             try                 set eafFiles to ((every file in entire contents of myFolder whose name ends with ".eaf") as alias) as list             on error                 set eafFiles to {}             end try         end try         try             set pfsxFiles to (every file in entire contents of myFolder whose name ends with ".pfsx") as alias list         on error             try                 set pfsxFiles to ((every file in entire contents of myFolder whose name ends with ".pfsx") as alias) as list             on error                 set pfsxFiles to {}             end try         end try         set myFiles to eafFiles &amp; pfsxFiles     end tell      repeat with CurrentFile in myFiles         set CurrentFile to CurrentFile as string          do shell script "perl /path/to/perl/script.pl " &amp; quoted form of CurrentFile     end repeat Can one introduce magnetic monopoles without Dirac strings? To introduce magnetic monopoles in Maxwell equations, Dirac uses special strings, that are singularities in space, allowing potentials to be gauge potentials. A consequence of this is the quantization of charge.  Okay, it looks great. But is this the only way to introduce magnetic monopoles? Windows Active Directory naming best practices? This is a  about Active Directory domain naming.   After experimenting with Windows domains and domain controllers in a virtual environment, I've realized that having an active directory domain named identically to a DNS domain is bad idea (Meaning that having example.com as an Active Directory name is no good when we have the example.com domain name registered for use as our website).   , but I'm still not sure about what other rules there are around naming Active Directory domains.  Are there any best practices on what an Active Directory name should or shouldn't be? Why is "cupboard" pronounced with a silent "p"? When does a complex matrix have a square root? What is the neccessary and sufficient condition for a matri$A \in C^{n  \times n}$ so that it has a "square root" , that is there is a matrix $B \in C^{n \times n}$ such that $A=B^2$.  I am not quite sure but I was thinking that it would be that A and B are similar. Let $E=l^p=\left\{x=\left(x_n\right): x_n\in\mathbb{R}, \sum_{1}^{\infty}\left|x_n\right|^p&lt;\infty\right\}$ with $1\le p&lt;\infty$, $\left\|x\right\|_E=\left(\sum_{1}^{\infty}\left|x_n\right|^p\right)^{1/p}.$ Let $\left(\lambda_n\right)$ is a bounded sequence in $\mathbb{R}$ and consider the operator $T$ defined by $$T(x)=\left(\lambda_1x_x,\ldots,\lambda_nx_n,\ldots\right)$$ where $x\in l^p$. Prove that $T$ is a compact operator from $E$ to $E$ iff $\lambda_n\rightarrow 0$.  Can anyone give me some hints to solve this problem? Thank you! Make the network profile editable on the main Stack Exchange page Currently, the Stack Exchange Network Profile links to all the network accounts and acts as a centralized profile page. Seeing that the ability to edit the profile is available from the profile pages of all *.SE sites, I think the ability to edit profiles should be available on that Network Profile page as well.  It will be consistent with the nature of the centralized profile page and will better the user experience.   EDIT: As the current Network profile, is actually the oldest profile on the Network, providing an edit option on the Network profile which links to the oldest profile edit page, would be one way to implement this.