Sitemap

Thursday, September 13, 2018

Salesforce: Links at my click!

External IDs
http://www.salesforcefinessed.com/2017/10/why-should-you-care-about-external-ids.html

aura:method
https://quirkyapex.com/2018/03/18/lightning-component-methods/

Data Loader with Command Line
https://kloudrac.com/blog/data-loader-with-command-line/

Platform Events
http://www.mstsolutions.com/blog/content/platform-events
https://andyinthecloud.com/2017/11/12/platform-events-and-lightning-components/
https://trailhead.salesforce.com/projects/workshop-platform-events

Apex Code Coverage hack
https://pavelslepenkovdotinfo.wordpress.com/2013/07/27/apex-code-coverage-hack/

Elements of a Salesforce Workflow Rule
https://cloudcraze.com/the-elements-of-a-salesforce-workflow-rule-workflow-deep-dive-pt-i/
https://cloudcraze.com/real-world-examples-of-salesforce-workflow-rules-workflow-deep-dive-pt-ii/

Truthy and Falsy Values in JavaScript
http://adripofjavascript.com/blog/drips/truthy-and-falsy-values-in-javascript.html

CSS Selectors
https://learn.shayhowe.com/advanced-html-css/complex-selectors/

Javascript: Pagination
https://gist.github.com/kottenator/9d936eb3e4e3c3e02598

Events: Bubbling and capturing
https://javascript.info/bubbling-and-capturing

Triggers and order of execution
https://albasfdc.wordpress.com/2016/12/19/triggers-and-order-of-execution/

Salesforce Apex: Maps
http://www.iterativelogic.com/working-with-apex-code-maps/

Apex: Sorting Wrapper list based on multiple conditions
https://salesforce.stackexchange.com/questions/192818/sort-wrapper-list-in-apex-based-on-levels
http://blog.deadlypenguin.com/blog/2015/10/10/comparable-sorting-objects-in-salesforce/

lightning:container
https://developer.salesforce.com/blogs/2018/04/lightning-container-component-building-components-with-react-angular-and-other-libraries.html

Lightning Service Components
https://developer.salesforce.com/blogs/2018/08/implement-and-use-lightning-service-components.html

Communication: Lightning Components and Visualforce Pages
https://developer.salesforce.com/blogs/developer-relations/2017/01/lightning-visualforce-communication.html



SOQL Builder: apex-commons
http://apex-commons.github.io/query/soql-builder/
https://github.com/apex-commons/SoqlBuilder

Salesforce Security Token and Password Policies
http://webkul.com/blog/salesforce-security-token/
http://www.infallibletechie.com/2012/12/password-policies-are-user-security.html

Which Automation Tool Do I Use?
https://help.salesforce.com/articleView?id=process_which_tool.htm

Modifying Components Outside the Framework Lifecycle
http://www.jitendrazaa.com/blog/salesforce/calling-apex-method-at-regular-interval-from-lightning-component/

How to write SOQL to traverse across two objects and their junction object
http://kingkoo-salesforce.blogspot.in/2012/12/how-to-write-soql-to-traverse-across.html

Best practices for writing code that doesn’t exceed certain governor limits.
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_limits_tips.htm
https://developer.salesforce.com/page/Apex_Code_Best_Practices
https://help.salesforce.com/articleView?id=000232681&language=en_US&type=1

Pop, Push, Shift and Unshift Array Methods in JavaScript
https://alligator.io/js/push-pop-shift-unshift-array-methods/

JS events: target vs currentTarget
https://javascript.info/bubbling-and-capturing

Prototypes in JavaScript
https://hackernoon.com/prototypes-in-javascript-5bba2990e04b

How to Select All Fields with SOQL in Apex
https://douglascayers.com/2015/10/08/salesforce-how-to-select-all-fields-with-soql-in-apex/

Salesforce: Setting Up Your Java Developer Environment
Link: https://resources.docs.salesforce.com/210/latest/en-us/sfdc/pdf/salesforce_developer_environment_tipsheet.pdf




Downloadable Salesforce User Guides
Set Up and Maintain Your Salesforce Organization
https://resources.docs.salesforce.com/212/latest/en-us/sfdc/pdf/setup.pdf

Sales Cloud Basics
https://resources.docs.salesforce.com/214/latest/en-us/sfdc/pdf/sales_core.pdf

Enhance Salesforce with Point and Click Tools
https://resources.docs.salesforce.com/214/latest/en-us/sfdc/pdf/extend_click.pdf

Enhance Salesforce with Code
https://resources.docs.salesforce.com/214/latest/en-us/sfdc/pdf/extend_code.pdf

List of important StackExchange links

How can I efficiently generate a Set<Id> from a List<SObject>
https://salesforce.stackexchange.com/questions/8910/how-can-i-efficiently-generate-a-setid-from-a-listsobject-structure

Why are foreach loops slower in Apex than standard for loop?
https://salesforce.stackexchange.com/questions/227272/why-are-foreach-loops-slower-in-apex-than-standard-for-loop


Monday, April 2, 2018

Machine learning crash course from Google

https://ai.google/education#?modal_active=none
https://developers.google.com/machine-learning/crash-course/

Wednesday, May 24, 2017

AEM: SegmentNotFoundException Segment not found

A SegmentNotFoundException in the error log means a segment is not present any more although we are still trying to access it.

To resolve this, please follow the below steps:

Download oak-run jar file from here http://repo1.maven.org/maven2/org/apache/jackrabbit/oak-run/
* AEM6.0 - If using Oak 1.0.12 or later then use Oak 1.1.8 - oak-run-1.1.8.jar. If the Oak version is 1.0.11 or earlier then use oak-run 1.1.6.
Note: We are using a 1.1.x branch version of oak-run because 1.0.x branch doesn't have the "check" command implemented.

1) Stop AEM

2) Run this command:
java -jar oak-run-*.jar check -d1 --bin=-1 -p crx-quickstart/repository/segmentstore/
It which will search backwards through the revisions until it finds a consistent one, Example:
14:00:30.783 [main] INFO o.a.j.o.p.s.f.t.ConsistencyChecker - Found latest good revision afdb922d-ba53-4a1b-aa1b-1cb044b535cf:234880

3)Revert the repository to this revision by editing ./crx-quickstart/repository/segmentstore/journal.log. Delete all lines after the line containing the latest good revision.
If you would like to find out what date and time you are reverting the repository to then run this command in the segmentstore folder (replace afdb922d-ba53-4a1b-aa1b-1cb044b535cf with the latest good revision in your journal.log):
find . -type f -name "data*.tar" -exec sh -c "tar -tvf {} |grep afdb922d-ba53-4a1b-aa1b-1cb044b535cf" \; -print
The output would show you an approximate date and time of that revision.

4)Remove all ./crx-quickstart/repository/segmentstore/*.bak files.

5)If using AEM6.0 then download the oak-run version matching what is installed in AEM for the remaining steps. Download it from here http://repo1.maven.org/maven2/org/apache/jackrabbit/oak-run/

6)Run checkpoint clean-up to remove orphaned checkpoints:
java -jar oak-run-*.jar checkpoints ./crx-quickstart/repository/segmentstore rm-unreferenced

7)Finally compact the repository:
java -jar oak-run-*.jar compact ./crx-quickstart/repository/segmentstore/


After the Above steps are completed, your system should now boot up properly.

Tuesday, January 24, 2017

Utility for taking backup of AEM contents

This utility is in the form of a unix shell script. The script will take the backup of AEM contents present in production author instance, create a zip file of it, download it and keep it in a particular location as defined in the script. Once the process is completed, an email will be sent to users to let them know the status of the job, whether the process was a success or resulted in an error. To automate this entire process, a cronjob can be set up which needs to be scheduled.

The technical document and the script are attached in a zip file. Check the downloads section for the zip file.

Friday, August 5, 2016

UCM: GET_SEARCH_RESULTS iterating resultset

package com.company;

import oracle.stellent.ridc.IdcClient;
import oracle.stellent.ridc.IdcClientException;
import oracle.stellent.ridc.IdcClientManager;
import oracle.stellent.ridc.IdcContext;
import oracle.stellent.ridc.model.DataBinder;
import oracle.stellent.ridc.model.DataObject;
import oracle.stellent.ridc.model.DataResultSet;
import oracle.stellent.ridc.protocol.ServiceResponse;

import java.util.List;

/**
 * Created by Sonal_Chaudhary on 8/4/2016.
 */
public class ExtractEmailIDs {
    public static void main(String[] args) {
        int startIndex = 1;
        int pageNumber = 1;
        int totalRows = 20;
        IdcClientManager manager = new IdcClientManager();
        try {
            IdcClient idcClient = manager.createClient("idc://143.127.54.171:4444");
            IdcContext userContext = new IdcContext("sysadmin");

            boolean stillLoop = true;
            while (stillLoop) {
                DataBinder dataBinder = idcClient.createBinder();
                dataBinder.putLocal("IdcService", "GET_SEARCH_RESULTS");
                dataBinder.putLocal("QueryText", "dSecurityGroup <contains> `Partner`  <AND>  xLanguage <contains> `4`  <AND>  xCountries <contains> `1`");
                dataBinder.putLocal("SearchQueryFormat", "Universal");
                dataBinder.putLocal("StartRow", Integer.toString(startIndex));
                dataBinder.putLocal("ResultCount",  Integer.toString(totalRows));
                dataBinder.putLocal("PageNumber",  Integer.toString(pageNumber));
                dataBinder.putLocal("TotalRows",  Integer.toString(totalRows));

                ServiceResponse response = idcClient.sendRequest(userContext, dataBinder);
                DataBinder responseData = response.getResponseAsBinder();
                DataResultSet resultSet = responseData.getResultSet("SearchResults");

                if (resultSet != null && resultSet.getRows() != null) {
                    List<DataObject> dataObjects = resultSet.getRows();
                    if (dataObjects.size() == totalRows) {
                        startIndex += totalRows;
                        pageNumber++;
                    } else {
                        stillLoop = false;
                    }
                    for (DataObject dataObject : dataObjects) {
                        System.out.println(dataObject.get("dID") + "," + dataObject.get("dDocName") + "," + dataObject.get("dExtension"));
                    }
                }
            }
        } catch (IdcClientException ice) {
            ice.printStackTrace();
        }
    }
}

Saturday, July 16, 2016

Java: Arrays

package com.company;

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;

/**
 * Created by Sonal_Chaudhary on 7/16/2016.
 */
public class TestScoreAverage {
    public static void main(String[] args) {
        final int NUMBER_OF_STUDENTS = 3;

        /**
         * The first statement declares a variable called numbers of the array type, with each element of type int. The
         * second statement allocates contiguous memory for holding 10 integers and assigns the memory address of the first
         * element to the variable numbers. The declaration and allocation can be done in the same statement like below:
         * int[] marks = new int[NUMBER_OF_STUDENTS];
         * Array literals provide a shorter and more readable syntax while initializing an array like below:
         * int[] marks = {15, 2, 9, 200, 18};
         */
        int[] marks;
        marks = new int[NUMBER_OF_STUDENTS];

        try {
            BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));


            for (int i = 0; i < NUMBER_OF_STUDENTS; i++) {
                System.out.print("Enter marks for student #" + (i + 1) + ": ");
                String str = reader.readLine();
                marks[i] = Integer.parseInt(str);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }

        //The clone method copies all the elements of the array into a new array
        int[] marksCopy = marks.clone();

        int total = 0;

        /**
         * The for-each construct is very useful if you want to traverse all the elements of the array. Specifically,
         * it allows you to iterate over collections and arrays without using iterators or index variables. The for-each
         * has certain restrictions. It can be used for accessing the array elements but not for modifying them.
         * The 'm' specifies the type of variable and its name.
         * for (int m : marks) {
         *      System.out.println (m);
         * }
         */
        for (int m : marksCopy) {
            total += m;
        }

        System.out.println("Average Marks " + (float) total / NUMBER_OF_STUDENTS);
        System.out.println(Arrays.toString(marksCopy)); //To print the contents of an array
    }
}