I built an apex class for an invocable method that runs from a flow to generate a link to authenticate a user to a community. The apex class updates a field on the contact record when the contact (a partner portal user) clicks the flow button and is linked then to a website. The class generates a code from the calculation of midnight at the start of the year, with the current time in GMT/UTC format. It's my first time in a while writing a test class so wanted to gather so insights.   global class PassKeyInvocable {   @invocableVariable(required=true)   global List&lt;Contact&gt; contactId;    //Gather the contact record Id from the user record. Just the first and only one. @InvocableMethod(label='The Users Contact Id' description='Get the users contact id')   global static void PassKey(List&lt;Id&gt; contactIds) {  id contactId = contactIds[0];      //calculate the passkey (an unique variable the vendor wants) by comparing the current  date/time with Janurary 1st of the current year in GMT // STATIC VALUES PROVIDED BY THE VENDOR Integer Offset = 43994; Integer Multiplier = 3290;           //Get the current time zone and establish the time zone offset      //Get the first day of the year in GMT DateTime oFirstYear = dateTime.newInstanceGMT(dateTime.now().year(), 1, 1, 0, 0, 0);           // get current GMT Time in UTC date/time DateTime oUTCDate = DateTime.newInstance(                                             System.now().year(),                                             System.now().month(),                                             System.now().day(),                                             System.now().hour(),                                             System.now().minute(),                                             System.now().second());      //get # hours elapsed since the start of the year   Long firstOfTheYear  = oFirstYear.getTime();   Long currentDateTime = oUTCDate.getTime();   Long milliseconds    = currentDateTime - firstOfTheYear;   Long seconds         = milliseconds/1000;   Long minutes         = seconds/60;   Long hours           = minutes/60;    Long Calculate = (Offset + hours) * Multiplier; String Passkey = String.valueOf(calculate);             //Gather contact Id from the user record (Invocable Flow requires a collection) and just          get the first value [0].        //Pass the passkey to the user's contact record, which the flow will append to the          destination url.     List&lt;Contact&gt; contactRecord = [Select Id FROM Contact WHERE Id =:contactId];      contact c = contactRecord[0];          c.Passkey__c = Passkey;     update c;     }              }
This is a canonical question and answer developed by the community to help address common questions. If you've been directed here, or your question has been closed as a duplicate, please look through the resources here and use them to shape more specific questions. To browse all canonical questions and answers, including more unit test resources, navigate to the  tag.  This canonical question is intended to address several classes of common questions by providing a quick summary and links to comprehensive resources:   How do I start writing my first unit test?  How do I unit test this code?  I need help writing this unit test.   Salesforce Stack Exchange looks for detailed, specific questions that the community can help you with, and can't write tests on your behalf. We feel that working with the resources below can help you get started, and we encourage you to make an attempt to write your test and return to SFSE with your specific questions when you encounter challenges you can't resolve.
Strict warning: Only variables should be passed by reference I get the following error:     Strict warning: Only variables should be passed by reference in include() (line 18 of /home/sites/dev/theparce/sites/all/themes/parce/block--block--3.tpl.php).   This is the block code which is causing that error.  if ($user_gallery) {   print render(node_show($user_gallery));  // Line 18   print drupal_render ($user_gallery_edit);  } else {   print drupal_render($user_gallery_new); }   Why do I get that error, even if I get all printed as expected? In my project requirement to access table data from Mapd Database on GeoServer  Mapd(GPU Based database) Database documentation link:   But in GeoServer provided some extension to connect and access particular database  GeoServer Extension link:    How can I connect MapD databse with geoserver is there any plugin. Today I was informed by VFS that my tourist visa for UAE got approved. I'm travelling to UAE on 16th December 2014 and returning on 7th Jan 2015. But when I checked the "valid until" date on the visa it states 30 December 2014.    Does this date mean I should return before December 30th? Should I get it corrected from VFS? Regard this statement $ x \ge 0$. According to my teacher, by negating this statement, it will become $ x &lt; 0$. Why is this so; why does the $\ge$ morph into $&lt;$, and not into $\le$? Recently, I was wondering how division of aleph numbers would work. First, I thought about how finite cardinality division would work. What I came up with was that the result of $A/B$ where $A$ and $B$ are both cardinalities, is the number of times that each element of $B$ had to be mapped to an element of $A$ in order to ensure that all elements of $A$ were mapped to.  Extending this to aleph numbers, specifically, I thought that $\aleph_1/\aleph_0$ would be $\aleph_1$. The reasoning behind this is that there are an infinite ($\aleph_1$) number of real numbers between any two natural numbers. As such, that mapping would need to be applied.  Can anyone validate this idea? Is this how division of aleph numbers actually works, or am I totally off base?  Thanks. Privilege progress indicator interferes with (old) Stack Exchange dropdown I know I'm late with this; this could be the last bug report about the old topbar. But the text on the privilege progress indicator (on your profile page) appears above the dropdown menu coming from the Stack Exchange button, as can be seen in the picture below.     Changing the z-index property of .s-progress-bar._badge .-info, .s-progress-bar._privilege .-info from 2 to 1 solves the problem.    The new menu seems to have a high enough z-index so that this is no longer a problem anymore: Multigroup (CCK3) / FlexiField-like solution for compound fields? I've used  in the past to do multiply occurring series of field groups; now, working on a Drupal 7 project, I'm setting up a "Resume" content type and need a way to set up repetitive entries for education/work experience.   IE: for "Education", I need the ability to dynamically add new rows comprised of a combination of dates and places for each institution studied at.  What is the best way to accomplish CCK3 multigroup/FlexiField-like functionality in Drupal 7?  Thanks! What makes scaling pixel art different than other images? Recently I was coaching a developer who's new to making pixel art games, and realized there's some "conventional wisdom" around scaling pixel art that's not obvious to a newcomer, and might not be well documented. So, here's an attempt to fix that....     I've heard I should only scale pixel art by 200%, 300% etc. not in-between sizes like 120%   Why is that? Shouldn't scaling "just work" the way it does with other images? What if I really need to make my character just a fraction larger or smaller to get the right gameplay or look? How do I fix this?  I'm told it's "bad" to use pixel art at different scales in one game - why?    For example, if I scaled up my character so each sprite texel is 4x4 screen pixels, while my background art is scaled up so each sprite texel is 6x6 screen pixels. Isn't a pixel a pixel at the end of the day? "spent a lot of time to shop" vs. "spent a lot of time shopping" She spends a lot of time to shop. She spends a lot of time shopping.   Are both of these sentences grammatically correct and do they have the same meaning? It is possible to find an efficient algorithm for constructing a provably hard to factor number $N$, together with a witness that shows that it is indeed hard to factor. EDIT, since it was not clear: I also want to be sure that even the person that constructed the number cannot factor it.  Of course, a random large enough integer is going to be hard to factor with high probability, but we might be unlucky.  There are also multi-party protocols for shared generation of RSA moduli (such as ), but I would like a non interactive technique.  Motivation: This was suggested by Poncho's answer to How do you search for backdoors from the previous IT person? We all know it happens. A bitter old IT guy leaves a  into the system and network in order to have fun with the new guys and show the company how bad things are without him.  I've never personally experienced this. The most I've experienced is somebody who broke and stole stuff right before leaving. I'm sure this happens, though.  So, when taking over a network that can't quite be trusted, what steps should be taken to ensure everything is safe and secure? My Ubuntu 14.04 is stuck when trying to login my desktop. The screen goes black and soon after that the login screen comes back.   I followed all steps in  but the issue was not solved. Are there any drawbacks to legacy BIOS as opposed to UEFI? Are there any drawbacks to installing Ubuntu 13.10 (and soon 14.04) in Legacy BIOS instead of UEFI?  I have installed 13.10 64bit in Legacy by mistake and was just wondering if it would hurt anything to simply leave it there as is?  EDIT  Everything seems to be running just fine in Legacy and all my drivers work. How to enable projection transformation in QGIS My QGIS project has two layers, one layer is retrieved by Google layer plugin which fetches the static Google map image whose CRS is +proj=merc +lon_0=0 +lat_ts=0 +x_0=0 +y_0=0 +a=6378137 +b=6378137 +units=m +no_defs and another vector layer is a postgis layer whose CRS is +proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs.  I digitalized some polygon features from Google Layers and added it to the vector layer. However, QGIS seems do not make the automatic CRS transformation. How can I change its projection?   Thanks I have a 13" MBP late 2009, 2.53 GHz, 4 GB RAM, and on OS X 10.8.3. As soon as I boot up the fans start going at the highest rpm and like I mentioned the kernel_task is always at around 90% when no apps are being run. I read somewhere that I should try safe boot and see the effect but there is none. Any ideas as to what is causing it?  Thanks Find equation of a plane that passes through point and contains the intersection line of 2 other planes Find equation of a plane that passes through point P $(-1,4,2)$ that contains the intersection line of the planes  $$\begin{align*} 4x-y+z-2&amp;=0\\ 2x+y-2z-3&amp;=0 \end{align*}$$  Attempt: I found the the direction vector of the intersection line by taking the cross product of vectors normal to the known planes. I got $\langle 1,10,6\rangle$. Now, I need to find a vector normal to the plane I am looking for. To do that I need one more point on that plane. So how do I proceed? easy_install: command not found Proofs using theorems instead of axioms I'm not sure how to prove these basic theorems in propositional calculus. Instead of using the standard axioms, we're supposed to use:   Deduction Theorem (if $\Phi, \alpha \vdash \beta$ then $\Phi \vdash \alpha \to \beta$),  Reductio (if $\Phi, \alpha \vdash \, $, then $\Phi \vdash \lnot \alpha$), Cut Rule (if $\Phi \vdash \alpha$ and $\Psi, \alpha \vdash \beta$ then $\Phi \cup \Psi \vdash \beta$),  Inconsistency Effect (if $\Phi \vdash \, $, then $\Phi \vdash \beta$ for every formula $\beta$), and  the Principle of Indirect Proof (if $\Phi, \lnot \alpha \vdash \, $, then $\Phi \vdash \alpha$),    as all the axioms can be deduced using these theorems.  I don't really know how to start the proofs without using the axioms:  i) prove that $\lnot(\alpha \to \beta) ⊢ \alpha$  ii) prove that $\lnot\alpha \vdash \alpha \to \beta$  Any suggestions on how to start these proofs or any insight at all would be greatly appreciated!  Thanks! Python: access class property from string Prove that a positive polynomial function can be written as the squares of two polynomial functions