After enabling Locker service, javascript function from static resource is coming as undefined.    JS file:  function myFunc(){    return '1'; }   Lightning component:      &lt;aura:component controller="AccController" implements="force:appHostable" access="global"&gt;         &lt;ltng:require scripts="{!$Resource.AccLexJS}"           afterScriptsLoaded="{!c.controllerFunction}" /&gt;       &lt;/aura:component&gt;   Lightning Controller:  ({     controllerFunction : function(component, event, helper) {          var action = component.get("c.getInitialVals");          action.setCallback(this, function(data) {            var JSreturnVal = myFunc();         });         $A.enqueueAction(action);     }  })   This results in following error:  This page has an error. You might just need to refresh it. Error in $A.getCallback() [myFunc is not defined]. I am defining or calling the method wrong?  If I copy paste the JS function in controllerFunction itself then it works with LockerService enabled.
I'd like to put some shared Javascript to Resource file to reuse it between several components. This Javascript is general purpose set of utility functions. However, functions from my resource file are not available from the Components. Static resource (named TestScript):  function helloWorld() {      return 42; }   Component:  &lt;ltng:require scripts="{!$Resource.TestScript}" &lt;ui:button label="Do job" press="{!c.doJob}"/&gt;   Controller:  doJob: function(cmp, event, helper) {      var i = helloWorld();      // failed with Uncaught ReferenceError: helloWorld is not defined }   I don't like to use  &lt;ltng:require scripts="{!$Resource.***resourceName***}" afterScriptsLoaded="{!c.afterScriptsLoaded}" /&gt;   because my static resource is a set of functions and I'd like just use them as functions later in my controllers. How can I achieve that (if possible)? If not, what's the suggested solution?
What are recommended, general strategies to start block-cipher design and/or analysis? I (and many others for that matter) have always been fascinated by the inner workings of the modern building block of cryptography: block ciphers.  Now, the ressources on the "black art" of design and analysis of these ciphers are sparse; especially for the entry level. Available information like  seems to be somewhat outdated (due to its age).  What's the general consensus of the “best” (read: recommended) strategy to start designing and/or analyzing modern cryptographical block ciphers?    Nota bene: Think of this as a general, wiki-alike question – for learning purposes only. (Besides that, this Q&amp;A would represent a place we can point people to when alike algorithm design questions arise.) What is the difference between == and ===?  How exactly does the loosely == comparison work? How exactly does the strict === comparison work?  What would be some useful examples? I am a Physics undergrad, and just started studying Topology. How do you define neighborhood and open set in Topology.Wikipedia gives a circular definition.   An  is defined as follows.      In topology, a set  is called an open set if it is a neighborhood of every point    While a  is defined as follows:     If $X$ is a topological space and $p$ is a point in $X$, a neighbourhood of $p$ is a subset $V$ of $X$, which includes an open set $U$ containing $p$   which itself contains the term open set.  How do you define it exactly? System.JSONException: Malformed JSON: Expected '{' at the beginning of object I have getting the below JSON on using JSON.serialize  [ {   "lname" : "Singh",   "hcpZipCode" : null,   "hcpState" : null,   "hcpEmail" : "test@test.com",   "hcpCity" : null,   "hcpAddLine1" : null,   "fname" : "Abhey",   "countryCode" : "AUS" } ]   I don't know why this '[' is coming at the begining.I don't need this '[' at the begining due to which I am getting System.JSONException: Malformed JSON: Expected '{' at the beginning of object  code     public PageReference step2() {         string JSONstr='';        List&lt;HCPRequest&gt; conWrapList = new List&lt;HCPRequest&gt;();        HCPRequest tempcontactWrapper = new HCPRequest();        tempcontactWrapper.fname='Abhey';        tempcontactWrapper.lname='Singh';        tempcontactWrapper.countryCode='AUS';        tempcontactWrapper.hcpEmail=contact.Email;         conWrapList.add(tempcontactWrapper);          JSONstr = JSON.serializePretty(conWrapList);         System.debug('\n******'+JSONstr +'\n******');          String clientId = 'xy';         String clientSecret = 'x';          //We can also store our username password in custom setting.         String username='x';//salesforce username          String password='x';//password+securitytoken         // Generating the Access Token         HttpRequest req = new HttpRequest();         req.setMethod('POST');         req.setEndpoint('https://test.salesforce.com/services/oauth2/token');// this is the OAuth endpoint where this request will be hit         req.setBody('grant_type=password&amp;client_id='+clientId+'&amp;client_secret='+clientSecret+'&amp;username='+username+'&amp;password='+password);          Http http = new Http();         HTTPResponse res = http.send(req);         String str = res.getBody();         wrapObj = (Wrapper)Json.deserialize(str,Wrapper.class);         accessToken = wrapObj.access_token;         instanceUrl = wrapObj.instance_url;          HttpRequest req1 = new HttpRequest();         string response='';         req1.setMethod('POST');         //req.setEndpoint(wrapObj.instance_url+'/services/apexrest/Account/getAccountById?name=champaKAli');         string EndPt = 'y';         string email='test@test.com';         req1.setEndpoint(EndPt);         req1.setHeader('Authorization', 'OAuth '+wrapObj.access_token);          req1.setHeader('Content-Type', 'application/json');          //req1.setBody('{"request":{"lname" : "Singh","hcpZipCode" : null,"hcpState" : null,"hcpEmail" : "test@test.com","hcpCity" : null,"hcpAddLine1" : null,"fname" : "Abhey","countryCode" : "AUS"}}');          req1.setBody('{"request":'+JSON.Serialize(conWrapList)+'}');          //req.setBody('{"request": {"countryCode": "AUS","hcpEmail" : ""+email}}');          //req.setTimeout(60000);             //req.setHeader('Content-Length', '0');         Http http1 = new Http();         HTTPResponse res1 = http1.send(req1);          System.debug('***Response***** ' + res1.getBody());         if(res1.getBody()!=null)         {             response=res1.getBody();             HCPResponse saj=(HCPResponse)JSON.deserialize(response,HCPResponse.class);           System.debug('***Response came full***** ' + saj);            System.debug('***Response came***** ' + saj.accList);             for(HCPResponseDetail s :saj.accList)            {            System.debug('***Response email***** ' + s.hcpEmail);            System.debug('***Response add2***** ' + s.hcpAddrLine2);            contact.Address1_Line2__c=s.hcpAddrLine2;            }           //return response;         //string methodcall=methodGet(JSONstr);               return Page.opptyStep2CustomReg;         } I'm looking for a fantasy book I read about 10 years ago. I don't remember a lot of it, but there are a few things I still know:   The setting was in medieval times. There was no traveling dimensions. I can't recall whether there was magic or not. It wasn't on Earth, but on some invented world. I believe it was a trilogy, with a focus on the son of some nobility. The goal for the characters was to collect a certain number of stones or gems (I believe there were 5 of them), all in certain colours. Every stone has a certain power attached to it. I believe it started out with one or two characters, but the group grew and every character had a certain colour stone at the end. What is important about the gems is that they are unique. It's not part of a bigger magic system, but they are artefacts from somewhere.   There are some minor incidents I can recall vividly:   They build up a fellowship with some stereotypical fantasy builds: an old school fighter, a minstrel, a female archer and probably more. At one point, they mention that if one of the guards in a country falls asleep on duty, he will be kept awake by his garrison/brothers in arms for seven days. At some point the minstrel falls asleep, and the old fighter teaches him how to stay awake. They travel through a forest full of leeches and other insects to reach one of the stones. Also, I seem to recall there was a member of an underground evil organisation among the nobility, who tried to poison someone and were able to do that because they built up an immunity to the poison.   Does anyone has a clue what this series might be?   Suggestions by kind people, but not what I'm looking for, are:   The Seventh Tower Deltora Quest Diadem Westria Sword of Heavens series Is it possible to get a list of most recently installed packages? Prove that if $\gcd(ab,c)=1$, then $\gcd(a,c)=1$. Starting eclipse from unity launcher How can I stitch a panorama correctly if I moved the camera along the horizontal axis? Here in Argentina, we have . All the houses and walls on that street have some kind of mosaic stuck to it, and it's very cool. It was made by a local artist .  Because to this piece of urban art is two blocks long, I've decided to make a panorama of it, by moving myself on an horizontal axis while taking photos. I mean, I took one photo, walked one step deeper along the street, took another photo, and so on.  When I tried to stitch it in AutoPano, the following deformed thing came out:   ()  And the other side of the block:   ()  After this, I've learned about parallax error and why you have to avoid moving when making panoramas. I mean, there are a lot of connection errors on both images. Especially in the second one, the part with the corner is quite problematic to stitch because to as I moved, the perspective of the view changed a lot.  So, is there any way to stitch this kind of panorama correctly? Would this only work on plain walls? Story where vampires are created by drop absorbed on neck? I have been trying to identify a book that I read maybe 25-30 years ago (1987-1992), in which there are vampire or vampire-like creatures, but instead of being created in the traditional way (e.g. bite on the neck), something drops a drop of a fluid on the back of their neck, which is then absorbed into the body and transforms them. I have a vague notion that some sort of tree is what creates these drops. The drops may have had a shiny metallic appearance.  I've tried to find this book before and always came up short. I'm starting to think the whole thing was a dream and I never read it at all. But I really feel like it was a book or at least a short story. I know that electric current is the flow of electrons but electrons have a very slow drift speed (about 2mm/s). How is it that electric current reaches its destination at almost the speed of light? My  objective is to classify sensor signals.  The concept of my solution so far is : i) Engineering features from raw signal ii) Selecting relevant features with ReliefF and a clustering approach iii) Apply N.N, Random Forest and SVM  However I am trapped in a dilemma. In ii) and iii), there are hyperparameters like k-Nearest Neigbours for ReliefF or the window length, for which the sensor signal is evaluated, or the number of hidden units in each layer of N.N.  There are 3 Problems I see here : 1) Tuning feature selection parameters will influence the classifier performance 2) Optimizing hyperparameters of classifier will influence the choice of features. 3) Evaluating each possible combination of configuration is intractable.  So my questions are : a) Can I make a simplifying assumption, s.t. tuning feature selection parameters can be decoupled from tuning classifier parameters ? b) Are there any other possible solutions ? "He was telling me that he is going..." vs. "He told me that he is going..." Some people have a diamond after their username (e.g. )    What special privileges do diamond moderators have? How can I become a diamond moderator? Who are the diamond moderators?  How many are there?      For more information, see  in the .     Note: not to confuse with certain Stack Exchange employees, for example  members or "community managers", who often have diamonds as well, but are not ordinary moderators. The spell Armor of Agathys states:      You gain 5 temporary hit points for the duration. If a creature hits you with a melee attack while you have these hit points, the creature takes 5 cold damage.   Now, assume my buddy uses Inspiring Leader to give me 10 temporary hit points — does the effect end? Get text from pressed button How does virtualizing differ from emulation, in terms of structure? Someone told me that a virtualizing program like VirtualBox does not work like an emulator does in the sense that it doesn't emulate registers and uses the actual ones for the virtualized data that are on the CPU. Emulators must emulate the registers since they are mostly to execute software that depends on a foreign environment (e.g. a Genesis emulator needs Motorola 68000's registers and memory addresses, so developer must make these resources available as emulated registers).  My main question is, how is virtualization developed? How do we enable an entire OS to run as a process in a virtual machine, but get it to run independently while still making use of the actual CPU? I only know emulation, not virtualization, so if anyone could help that'd be nice!  PS: I am not asking solely what the difference is, but differences in how they run software. How can I install a .bin file? How to Join Games with Minecraft Pocket Edition 0.7 Efficiently reverse the order of the words (not characters) in an array of characters