天阔阔雪漫漫共谁同航 这沙滚滚水皱皱笑着浪荡

Salesforce 2 -- Admin Beginner

|

Notes from: https://trailhead.salesforce.com/trails All content from: https://trailhead.salesforce.com/trails

3. TRY TRAIL: Admin Beginner

1. Salesforce Platform Basics
  1. CRM : a place to store your customer data, processes to nurture and convert prospective customers, and ways to collaborate and engage
  2. Salesforce is CRM, it also includes the platform, where customers and partners can use our suite of technologies to build amazing, connected apps.
  3. Terminology
    1. Record: an item you are tracking in your database – a row on the spreadsheet.
    2. Field: a place where you store a value, like a name or address – a column on the spreadsheet.
    3. Object: a table in the database – a tab on the spreadsheet
    4. Org: short for “Organization”, the place where all your data, configuration, and customization lives – your instance of Salesforce. you and your user log in to access it.
    5. Force.com: The suite of configuration tools and programming languages, and APIs native to Salesforce, including Apex and Visualforce
    6. App: A set of fields, objects, permissions, and functionality to support a business process. Not a thing you download onto your phone.
      1. example: if you’re having an event and you want people to sign in, you could create an Event app in Salesforce. The process/entity becomes an object (‘Event’), and those columns become fields (‘Attendee Name’, ‘Title’, ‘Company’, ‘Email’) on the object.
      2. benefits:
        • Get real-time access to data as it’s entered, via mobile or desktop.
        • Create reports and dashboards to analyze attendees.
        • Send follow up emails to attendees after the event.
        • Relate attendees to marketing campaigns and sales information including order and purchase information.
        • Engage with attendees in a community.
        • Create automated processes to engage with the attendees over time.
        • Take advantage of instant scalability, instant mobile access, secure data storage and backups.
        • And much, much more
  4. An example using platform:
    1. scenario:
    2. solution: create a custom field for preferred phone number, and add a new section on the page layout [1] just for phone numbers and your new custom field.
  5. define declarative and programmatic development:
    1. Declarative refers to point-and-click functionality in Salesforce. It means that you can configure and customize Salesforce without writing code.
    2. Programmatic refers to code-driven functionality in Salesforce. It means that you can customize Salesforce using programmatic tools like Apex, Visualforce, and Lightning, and standard web technologies like JavaScript, CSS, and more.
  6. the golden rule is to always try to build with clicks before going to code, as it is more sustainable and maintainable moving forward.
  7. tips for identifying good processes to bring onto the platform
    1. reliance on spreadsheets
    2. Collaboration via email
    3. Documents shared on local file directories
    4. Time-intensive, manual steps
    5. Impact to a few departments maximum (just as you’re getting started; keeping your number of stakeholders to a minimum will help you make progress)
  8. Architecture
    1. Trusted Multitenant Cloud:
      1. protecting your data
      2. Using standard functionality in Salesforce, you get a fine degree of security control over everything from user and client authentication, through administrative permissions to the data access and sharing model.
      3. advantage of a multitenant cloud: all of our customers, from small businesses to enterprise companies, are on the same code-base and all get the benefits of the same features, functionality, and automatic upgrades 3 times a year. (Salesforce’s upgrades are automatic and seamless)
      4. The cloud also means we can deliver Software as a Service (SaaS), which is important because it means you don’t have to install a program to use Salesforce. You just need an internet connection to log in.
    2. Scalable metadata platform: the structure of your Salesforce org
      1. imagine all of that data has just been exported. The structure is still there, but the data itself is gone. What you’d have left, that underlying structure, that is the metadata. It’s all of your standard and custom functionality, and all of your configuration and code.
      2. Salesforce’s SaaS model means we make the metadata immediately available for development, configuration
    3. fast app dev and customization: There is no installation of hardware and software, and there are standard options for defining security and user access, creating reports, and making the app social and mobile.
    4. largest enterprise ecosystem
    5. complete CRM
    6. API (Application Programming Interface):
      1. it’s essentially a contract between two pieces of software, allowing them to connect to each other and exchange information (without knowing any of the inner details of how they work.)
      2. he API name is a unique identifier that the platform uses to determine what data or metadata you are trying to access.
  9. Setup:
    1. Setup consists of a tab bar, a navigational sidebar, and a main window.
    2. Setup Search uses type-ahead functionality to help you jump quickly to the item you want. advanced search
    3. If you’re not at your desk and you need to get your admin duties on, you can take Setup on the go with the SalesforceA mobile app.
      1. Username
      2. Super secret password
      3. ?? Correct instance: You can connect to a sandbox environment for testing purposes, or a custom domain if configured for your org
    4. trust.salesforce : The Recent System Status section shows information from trust.salesforce.com about your instance’s system performance over the last 24 hours.
  10. develop your AppExchange strategy: all from- https://trailhead.salesforce.com/trails/force_com_admin_beginner/modules/starting_force_com/units/starting_developer_console
    1. Identify the departments using Salesforce (either now or in the future). These are your primary stakeholders for AppExchange app installations.
    2. Research AppExchange apps for the business cases provided by your stakeholders. Interview your stakeholders thoroughly to gather the requirements needed to select and evaluate the apps.
      1. What business problem are you trying to solve?
      2. What are your main pain points at present?
      3. How many users?
      4. What is your budget?
      5. What is your timeline?
    3. Download apps into a sandbox or Developer Edition org for preview and testing. An important step is to ensure that the app you’re installing doesn’t interfere with any customizations you’ve done or other apps you’ve already installed.
      1. Sandboxes are copies of your organization in a separate environment. They are used for development and testing: https://help.salesforce.com/articleView?id=create_test_instance.htm&language=en_US&type=0 4 types: developer sandbox, dev pro sandbox(lager tata sets), partial copy sandbox(includes a sample of your production org’s data as defined by a sandbox template), full sandbox(support performance testing, load testing, and staging, a replica of your production org, including all data, But the length of the refresh interval makes it difficult to use Full sandboxes for development.) We recommend that you apply a sandbox template so that your sandbox contains only the records that you need for testing or other tasks.
    4. Evaluate your choices. Consider budget, app functionality, and any feature gaps. Consider inviting your stakeholders into the sandbox or Developer Edition org to preview the app functionality, or invite your stakeholders to a demo of the app.
    5. Execute and document. Prepare your users for the change in user experience (if any), including providing training or documentation as needed
  11. Install from AppExchange:
    1. In general, an AppExchange best practice is to install first in a sandbox or Developer Edition org. A few considerations:
      1. Some of the packages come bundled with custom fields, objects, Apex classes, and more.
      2. All of these customizations have names, which may conflict with existing names in your org.
    2. give permissions to admins only, all users, or specific profiles
    3. The AppExchange is a complete marketplace offering cloud-computing applications and consulting services
2. Data Modeling
  1. There are two types of objects.
    1. Standard Objects—These are objects included with Salesforce, by default, for example the objects used to store data in standard tabs such as accounts, contacts, or opportunities.
    2. Custom Objects—These are new objects you create to store information unique to your organization. Custom objects extend the functionality that standard objects provide. For example, if you’re building an app to track product inventory, you can create custom objects called Merchandise and Invoices, as shown in the figure below.
  2. Objects can have relationship fields that define how records in one object relate to records in another object. These fields play the same role as primary and foreign keys in a database
  3. All attributes of an object are described with metadata, making it easy to create and modify records either through a visual interface or programmatically.
  4. Fields
    1. Identity Field:
      • called ID
      • manages the identity data in every record
      • as a result you can view every record (across all objects) by simply using a URL of the above form
      • eg: https://yourInstance.salesforce.com/0015000000Gv7qJ
    2. System Fields
      • All objects have a number of read-only system fields automatically associated with them. eg: CreatedDate, LastModifiedById
    3. Name Fields:
      • required field that has a special place in the life of the object
      • It’s not required to be a unique identifier, but it is supposed to be the primary way users distinguish one record from another
      • A name can be one of two types: a text string or an auto-number field.
        • auto-number field, you must specify the format for the field and the starting number. Auto number fields increment by one each time a record is created.
    4. Custom Fields: . All fields in an object must be defined as a particular data type. more here: https://www.adminhero.com/a-primer-on-salesforce-fields-and-relationships/
    5. Relationship Fields: stores the ID of the parent record in a relationship
      1. Lookup: Lookup relationships can be used to create one-to-one and one-to-many relationships.
      2. Master-Detail:
        • Master-detail relationships can be used whenever there is a tight binding between two objects.
        • They can also be used to create many-many relationships.
        • The master object in a master-detail relationship can also contain rollup summary fields : store values aggregated from the child records in the relationship
    6. Other Features of Objects
      1. formulas (rich expression ) - set up validation rules,create workflow rule criteria
      2. validation
      3. triggers, written in the Apex language
      4. Labels—Every object and record has a label and can include a description, for help, which is automatically included in the user interface.
      5. Notes and attachments
      6. Track Field History
  5. When create a new object and customize fields
    1. unique naming
    2. thoughtful architecture: the cleanest and most efficient way to capture data
    3. Default field values: Don’t assign default values to fields that are both required and unique, as this can cause uniqueness errors.
    4. Careful renaming
    5. Global data updates:
    6. help for users: help text of field and help page for an object
  6. When create object relationships:
    1. With relationships, you can display data about other related object records on a particular record’s detail page.
    2. A relationship field stores the ID of the parent record in a relationship, as well as optionally providing user interface representations in both the parent and child records.
    3. lookup – an example:
      • a lookup relationship field on a job application object, reference position records.
      • this will be reflected both with a new Position field on the job application record and with a new Job Applications related list on the position record
      • You can also put multiple lookup relationship fields on a single object, which means that the Job Application object can also point to a Candidate object.
    4. master-detail: (created on obj-child/detail, related to obj-parent/master)the master record controls certain behaviors of the detail and subdetail record.
      • the ownership and sharing of detail records are determined by the master record, and when you delete the master record, all of its detail records are automatically deleted along with it. Master-detail relationship fields are always required on detail records.
      • For example, say your recruiting app has a Review custom object that contains an interviewer’s feedback on a job application. If you delete a job application record, you will probably want all of its review records deleted as well. In this case, you would create a master-detail relationship on the Review custom object with the Job Application object as the master object.
      • rollup summary fields. These fields store values aggregated from the child records in the relationship
    5. differences:…
    6. convert: You can convert a master-detail relationship to a lookup relationship as long as no roll-up summary fields exist on the master object. You can convert a lookup relationship to a master-detail relationship, but only if the lookup field in all records contains a value.
    7. User is a standard object that comes with all organizations on the platform. It contains information about everyone who uses the app in your organization.
    8. You can also create a hierarchical relationship between objects. A hierarchical lookup relationship is available only for the user object.
      • For example, create a custom hierarchical relationship field to store each user’s direct manager.
    9. many-to-many
      • For example, suppose your recruiting app has a custom object called Website that stores information about various employment websites. You want to track which open positions are posted to those sites. Use a many-to-many relationship because:
        • One position could be posted on many employment websites.
        • One employment website could list many positions.
      • Instead of creating a relationship field on the Position object that directly links to the Website object, we can link them using a junction object. A junction object is a custom object with two master-detail relationships, and is the key to making a many-to-many relationship.
  7. Schema Builder
    1. Click Auto-Layout to sort the layout of the objects in your schema. When you click Auto-Layout, you can’t undo it.
    2. Objects created outside of Schema Builder, such as through an app or the API, don’t automatically display on the canvas. Select the checkbox for the object created outside Schema Builder to display it on the canvas.
    3. Any field you add through Schema Builder isn’t automatically added to the page layout. You will need to edit the page layout to specify where the field should be displayed.
3. Data – Salesforce Classic.
  1. two tools, data loader & data import wizard(less file)
  2. mapping
4. UI
  1. If a tab style is already in use, a number enclosed in brackets [] appears next to the tab style name. Hover your mouse over the style name to view the tabs that use the style. Click Hide styles which are used on other tabs to filter this list.
  2. Salesforce’s formula editor, and you use it to define the properties of the button or link.
  3. You can override the behavior of standard buttons on record detail pages. You can also override the tab home page that displays when a user clicks a standard, custom, or external object tab.
  4. Button overrides are global
5. Mobile salesforce1
  1. You can’t set different menu configurations for different types of users.
  2. if a user is assigned to a profile that has the Groups tab set to Tab Hidden, the user won’t see the Groups menu item in Salesforce1, even though an administrator has included it in the menu.
  3. Salesforce1 Navigation:The first item in the Selected list becomes your users’ Salesforce1 landing page.
  4. Tabs: The navigation menu in a community isn’t controlled via the Navigation Menu settings page. Instead, the tabs that are specified in Tabs & Pages in the community’s administration settings determine the contents of the community’s navigation menu.
  5. using compact layouts to put important fields into object record headers. Create a new compact layout and give it a label. Add up to 10 fields.
  6. object record pages have page layouts that can be customized, actions have action layouts that can be customized

?? mobile后两个纯粹瞎写a

6. Chatter Basics
  1. Feed tracking in Salesforce highlights changes to records by automatically announcing them in the record’s feed.
7. Reports & Dashboards
  1. A report is a list of records that meet the criteria you define. Every report is stored in a folder. You control who has access to the contents of the folder based on roles, permissions, public groups, and license types
  2. A dashboard is a visual display of key metrics and trends for records in your org. The relationship between a dashboard component and report is 1:1; for each dashboard component, there is a single underlying report.
    1. to view the dashboard components, you need access to the underlying reports as well.
    2. Like reports, dashboards are stored in folders,
    3. Each dashboard has a running user, whose security settings determine which data to display in a dashboard.
  3. A report type is like a template which makes reporting easier.
    1. The report type determines which fields and records are available for use when creating a report. This is based on the relationships between a primary object and its related objects. For example, with the ‘Contacts and Accounts’ report type, ‘Contacts’ is the primary object and ‘Accounts’ is the related object.
    2. Reports display only records that meet the criteria defined in the report type. Out of the box, Salesforce provides a set of predefined standard report types. Don’t see all the fields you want? You might need to create a custom report type.
  4. report type: Each report type has a primary object and one or more related objects.
    1. For standard report types, you will typically see this represented in the report type name. For example, with the ‘Contacts & Accounts’ report type, ‘Contacts’ is the primary object and ‘Accounts’ is the related object.
    2. or custom report types, from Setup, enter Report Types in the Quick Find box, then select Report Types to see the primary and related objects.
  5. Depending on how the report type is set up, the results can include one of the following.
    1. Primary object with related object—Records returned are only those where the primary object has at least one related object record.
    2. Primary object with or without related object—Records returned are those where the primary object may or may not have a related object
  6. When set the criteria, you may need to create a new custom report type, or adjust an existing custom report type to add or hide fields.
  7. Salesforce dashboards allow you to present multiple reports side-by-side using dashboard components on a single dashboard page layout. Dashboard components come in a variety of chart types, and you can customize how data is grouped, summarized, and displayed for each component.
  8. Filters can’t be added to dashboards that contain Visualforce components.
  9. It’s not possible to filter on bucket fields. However, it is possible to use a report filtered on a bucket field on the dashboard page.
  10. You can’t filter data on a joined report in dashboard view or add a filter to a dashboard that only has joined reports.
  11. With dynamic dashboards, each user sees the data they have access to without needing to create separate dashboards for each user.
  12. An example of dynamic dashboard:
    1. settings: Say that your opportunity team consists of one vice president, four sales managers, and 40 sales reps—ten reps per manager. You’ve been asked to create dashboards that display the following metrics, restricted by role and hierarchy. Sales reps should only see their own data; managers should only see data for the reps they manage; and the VP should see data across the entire team
  13. Folder Sharing in Salesforce allows you to restrict access to reports and dashboards by users, roles, roles and their subordinates, and public and private groups.
  14. wt?? folder sharing
    • If a folder existed before analytics folder sharing was enabled, its properties and sharing settings are rolled back to their previous state.
    • If a folder was created while enhanced analytics folder sharing was in effect, it is hidden from the folder list and all its sharing settings are removed. Administrative user permissions are still in effect.

Question list

  1. data model, create object relationships, resulting API name: trail_c, all custom fields API name: fields1_c…(why? I have not set it):https://trailhead.salesforce.com/trails/force_com_admin_beginner/modules/data_modeling/units/creating_custom_objects_fields
  2. relationship between position and job application. a new Position field ((means the lookup relationship field)) on the job application record : https://trailhead.salesforce.com/trails/force_com_admin_beginner/modules/data_modeling/units/object_relationships
  3. profile permission: permission is field of profile obj? or field of the obj we want to access?

Start from Java 5 -- JSP(haven't finished)

|

Class notes

Java Server Pages(JSP)

  1. server side , java platform
    1. CGI
    2. Perl
    3. Servlets
    4. JSP: ont top of servlet, every JSP has servlet, technically
    5. other platforms: PHP, ASP.net
  2. Servlet: primary implementation in java platform to show html
  3. Web containers / web servers:
    1. Tomcat
    2. jetty
    3. apache
    4. JavaWebServer
  4. Application servers: - Enterprise Architecture
    1. JBoss
    2. WebLogic
    3. WebSphere
    4. Glassfish
    5. Oracle Java EE Server
  5. technical difference between 3, 4, 4, scalable, all can use 3, also can use 4. Some 3 can not handle, use 4
  6. all applications we run was desktop applications.
  7. a web proj:
    1. webContent
      • *.html
      • *.jsp
      • style folder
        • *.css
      • script folder
        • *.js
      • images
        • *.png…
      • WEB-INF
        • web.xml
          • *.JAR
        • classes folder
          • *.class files of entire source files
        • *.tld
    2. src
      • all java source packages and files (*.java)
        • Business layer files
        • Controller classes
        • service / DAO layer
        • Servlets, are also called controller
        • POJO / Model Objects / ORM (object oriented mapping)
      • *.xml
      • *.properties
      • *.json
    3. pom.xml
  8. Steps:
    1. download tomcat –> right click in eclipse –> other –> create server –> apache tomcate
    2. new web dynamic web prj –> set target runtime == tomcat –> do not finish directly, click next, next and check the box with generate web.xml
    3. check doPost or doGet depends on your demand in somewhere
    4. create index.html in WebContent folder: index.html it the file we gonna show/run. (this is set in web.xml, we can commit the files we do not need)
    5. never check box: always use this server
  9. Two ways :
    1. jsp: html with java embedded
      1. declaration tag, global variable, eg:
         <head> 
             <%! 
                 Connection con; 
             %> 
         </head>
        
        1. !
        2. only once
        3. must in <head></head>
      2. normal ??<% ... %>
      3. expression <%= aVariable %>
    2. servlet, java html embedded, it has drawbacks, when we need complex html, so use jsp.
  10. login.jsp, we need:
    1. create profile
    2. session: destroy is not for session, is for jsp life cycle
    3. connection only once, so we do not implement this part of java in normal .., for initialization propose, we implement in jsp init
    4. jsp life cycle (3) ?? : jsp init, jsp execute, cleanup
    5. connect db, so need convert to maven
  11. we need : shift business logic in jsp to java class
  12. response.sendDirect(“index.html”). automatically redirect and send.
  13. session.removeAttribution(“name??”)..if(session,attr()==null) ?? logout, we have a new session with a new sessionId, When we do not use cookie.
  14. 4 scopes: request(default scope), page, session, application. request died, java object died, so if we remove scope = “session”, the counter is always 1
  15. if user login from different browser ==> we need a flag to mark if this user has logged in(or the new session replace the old session??)
  16. useBean, setProperty associated with request, replace request.getParameter

  17. directive
    • page
      • import (when want to import in jsp, we need directive page)
    • include
    • taglib
  18. action page
    • use Bean
    • setProperty
    • getProperty
    • forward
    • include
  19. taglibs
  20. implicit object
    • request
    • response
    • session
    • out
    • pageContent

Notes stopped here and I skipped Oracle part.

Question list

  1. Difference between handling checked exceptions and handling unchecked exceptions
  2. An Inner class defined within a method can access everything from outside the method but only final type of variables or objects from within the method in which it is defined.(wt??)
  3. no private static?
  4. only want 3 objs of a class

Start from Java 4 -- Collections, Hibernate

|

Collections

  1. from util package, an interface
  2. Array vs. ArrayList: The issue with arrays is that they are of fixed length so if it is full we cannot add any more elements to it, likewise if there are number of elements gets removed from it the memory consumption would be the same as it doesn’t shrink. On the other ArrayList can dynamically grow and shrink as per the need
  3. including:
    • List
    • Set: doesn’t in order, no duplicates
    • Map
    • Queue: FIFO
  4. CRUD: create, retrieve, update, delete
  5. Collection(class):
    • sort();
    • max();
    • min();
  6. Iterator: thread safe vs. Enumeration: thread not sage
    1. Iterator: hasNext(); Next();
       Iterator iter = arrlist.iterator();
       while (iter.hasNext()) {
           System.out.println(iter.next());
       }
       //LinkedList iterator:
       ListIterator listIt = linkedl.listIterator();
       //Iterating the list in forward direction use the same function as above
       // Iterating the list in backward direction
       while(listIt.hasPrevious()){
          System.out.println(listIt.previous());
       } 
       // loops
       for(ClassName cn : list){...}
       list.forEach(System.out::println);
      
    2. Enumeration: hasMoreElements(); nextElement()
       Enumeration<String> e = Collections.enumeration(arrayList);
       while(e.hasMoreElements())
       System.out.println(e.nextElement());
      
  7. Initialize ArrayList:
    1. Anonymous Inner class method: ArrayList<String> cities = new ArrayList<String>();
    2. Collections.ncopis(): ArrayList<Integer> intlist = new ArrayList<Integer>(Collections.nCopies(10, 5));, we get [5, 5, 5, 5, 5, 5, 5, 5, 5, 5]
  8. Loop HashMap: for (Map.Entry me : hmap.entrySet()) {If we want to use HashSet, we need to override both hashcode() and equal(). These two method are both from java....object class.
  9. hashmap:
    1. sort by key :Map<Integer, String> map = new TreeMap<Integer, String>(hmap); whatever the key is, when you put them to treemap (shift all entries to treemap), your key is automatically sorted.
    2. sort by value : actually is collection, the same as collection, Integer & String can invoke Collections.sort directly; obj – compareTo
  10. duplicate:
    1. add duplicates to set, get false
    2. hashmap: value equal, fine; key-value all equal, only one entry exists
  11. Sort in descending orderCollections.sort(arraylist, Collections.reverseOrder());
  12. If the elements in Collection’s subclass(Set, List…) are objects, we should override compareTo in class first, then sort.
    class someClass{
        public int compareTo(Object compareobj) {
                /* For Ascending order*/
                return this.prop - compareobj.prop;
                /* 
                    For Descending order
                    return compareobj.prop - this.prop;
                */
        }
    }
    public static void main(String args[]){
        ArrayList<someClass> arraylist = new ArrayList<someClass>();
        ...//add some someClass obj
        Collections.sort(arraylist);
    }
    
  13. s1 = 'a'; s2 = 'h'; s1.compareTo(s2) <=0
  14. multiple properties:
    Collections.sort(arraylist, className.compareOneOfProp);
    class className{
    ...
        public static Comparator<className> compareOneOfProp = (o1,o2) -> {return o1.OneOfProp - o2.OneOfProp;
        public static Comparator<className> compareOfAnotherProp = (o1,o2) -> {return o1.AnotherProp - o2.AnotherProp;
    
  15. swapCollections.swap(al, 1, 4);
  16. Array to ArrayList conversion: Collections.addAll(emptyArrayList, theArray); or ArrayList<String> citylist= new ArrayList<String>(Arrays.asList(citynames));
  17. vector. Contructor:
    1. new Vector(); //capacity:10-20-30
    2. new Vector(int i); //capacity: 10-20-40…(double)
    3. new Vector(int i, int i); //capacity: 10-20-40…(double)
  18. Date & Calendar
    Calender cal = Calendar.getInstance();
    cal.set(2017,0,1);
    //month start from 0
    
  19. StringTokenizer: like split
  20. Random: class, function called next.int()

Enum

  1. An enum is a special type of data type which is basically a collection (set) of constants.
  2. While defining Enums, the constants should be declared first, prior to any fields or methods.
  3. When there are fields and methods declared inside Enum, the list of enum constants must end with a semicolon(;).

JDBC

  1. Connection
  2. Statement: have some a drawback: st.executeUpdate("insert into authors (name, age, zipcode) values(" + newName + "', " + newAge + ", '" + newZip + "')"); this can be too complex.
  3. How to improve: PreparedStatement:
    1. PreparedStatement ps = con.prepareStatement(“…values(?,?,?)”);use Statement, it will be very difficult. so we use preparedStatement, who extends Statement interface
    2. ps.setString(1, aString);…
    3. int x = ps.executeUpdate();//insert an entry, x=1??
  4. what VM argument? min max memory,for heap,start execute, all objects on heap
  5. oracle: procedure…store block, we can reuse, a lot long business logic, demand of supply,
  6. 3 procedure: just execute, have argument, can return
  7. operations in terminal(windows)
    1. connect system/password–>connected
    2. create or replace procedure helloproc(x IN number, y IN number, z IN number) as begin (actually have no idea what this procedure is)
       z:=x+y;
       end;
       /
       exec helloproc(10,20);
      
       //receive return value
       set SERVEROUTPUT ON
       declare x1 number;
       begin
       helloproc(100,200,x1);
       dbms_output.put_line(x1);
       end;
       /
       backslash, recall/re-execute previous ...
      
  8. maven can only .. open source, so oracle can not use maven. nmp install, get oracle, register local server custom everything
  9. pom.xml add dependency: oracle
  10. JDBC drawback: queries, because queries is only for one database. If I change a database, I need to change …
  11. implement cashing, JDBC api, not able to do that
  12. class level – mapping to a table

Hibernate ( still have one note to read)

  1. Java persistent API include:
    1. JPA
    2. JTA
    3. Hibernate
    4. iBATis
    5. MyBATis
  2. model class + test class
  3. 2 executable file: hibernate.cfg.xml and .hbm.xml
    1. create hibernate.cfg.xml, copy from document,
      1. change mapping resource to someclassname.hbm.xml(depends on our project)
      2. and change password
      3. set url
      4. example:(more details about url are in Q&A part)
         <?xml version="1.0" encoding="utf-8"?>
         <!DOCTYPE hibernate-configuration PUBLIC
         "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
         "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
         <hibernate-configuration>
             <session-factory>
                 <property name="hibernate.bytecode.use_reflection_optimizer">false</property>
                 <property name="hibernate.hbm2ddl.auto">update</property>
                 <property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
                 <property name="hibernate.connection.password">yourpwd</property>
                 <property name="hibernate.connection.url">jdbc:mysql://localhost:3306/tables?autoReconnect=true&amp;useSSL=false</property>
                 <property name="hibernate.connection.username">root</property>
                 <property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
                 <property name="show_sql">true</property>
                 //important mapping for author
                 <mapping resource="Author.hbm.xml"></mapping>
             </session-factory>
         </hibernate-configuration>
        
    2. then create someclassname.hbm.xml: change field according to your program: the xml files: class author belong to author123 table
       <hibernate-mapping>
       //the class--yourclassname belongs to table--yourTableName with primary key:id
           <class name="com.demo.model.yourclassname" table="yourTableName">
               <id name="id">
                   <generator class="increment" />
               </id>
               <property name="name" length="60" />
               <property name="age" />
               <property name="zipcode" />    
           </class>
       </hibernate-mapping>
      
  4. convert to maven(if it is not)
  5. add dependencies of hibernate and mysql to pom.xml
  6. in the test class, configuration, import form …hibernate…
  7. must t.commit(); or it only saved in JVM.
  8. steps in terminal in sql:
    1. use tables
    2. (optional)source /Users/yourpath/yourTableName.sql;
    3. select * from yourTableName;
    4. others: desc table books
  9. Q & A
    1. ssl :
      1. jdbc: jdbc:mysql://localhost:3306/tables?autoReconnect=true&useSSL=false;
      2. hibernate: jdbc:mysql://localhost:3306/tables?autoReconnect=true&useSSL=false(;)
  10. Another way to connect database, we do not need any xml configuration file (like someclassname.hbm.xml )for book class, but need annotation: @Entity, @Table(name = “book123”)( class books belongs to table book123, like the xml configuration above)… before class declaration, and in class, we need id(primary key ) and generator setting to AUTO, all from javax.persistance not from hibernate.
  11. steps in book test class:
    1. configuration cfg = new AnnotationConfiguration();
    2. Session ss
    3. Transition tra
    4. ss.add
    5. tra.commit()
    6. add mapping class = “com.demo.model.Book” in hibernate.cfg.xml

Problem occurred when setting java

  1. When you want to check what jdks you have, keep in mind that all jdks you have are located in this directory : cd /Library/Java/JavaVirtualMachines/
  2. what you need to add in ~/.bash_profile
    JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_31.jdk/Contents/Home  
    PATH=$JAVA_HOME/bin:$PATH  
    CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar 
    
  3. After modify the ~/.bash_profile, you need source it : source ~/.bash_profile , so that this file can come into effect.

Salesforce 1 -- Try It First

|

Intro of this series on Salesforce

Notes from: https://trailhead.salesforce.com/trails All content from: https://trailhead.salesforce.com/trails

Start

  1. what salesforce is?
    1. CRM
    2. marketing –> sale cloud + service cloud
    3. account-opportunity -case -contacts–>lead when a lead convert to opporituny, it also become an account
    4. ?? md L account case/accout contacts
    5. ?? lkp look up contact-lead, we delete contact, lead still there, we delete lead, contacts still there

Trail

Trail Plan

  1. Quick start: Create the Trailblazer App – salesforce classic
  2. Quick start: Create a New Process on the Account Object – lightening process builder
  3. admin beginner
  4. crm essentials
  5. admin intermediate
1. Quick start: Create the Trailblazer App – salesforce classic
  1. Intro: build an app, which helps you on your personal journey to your local park — by keeping track of the places you want to go and the things you want to see. When you complete this quick start, you’ll have a working app with its own menu, a tab, and a custom object that tracks the names of places you want to visit.
  2. When we want to build an app on the salesforce platform, there is a bunch of built-in functionality, such as:
    1. Database to organize information
    2. Security for protecting data and defining access across your organization
    3. Business logic to carry out particular tasks under certain conditions
    4. User interface to expose data and functionality
    5. Highly customizable mobile app
    6. Native social environment that allows you to interact with people or data
    7. Analytics and dashboards for viewing your data in meaningful ways
    8. Multiple APIs to integrate with external systems
    9. Ability to install or create third-party apps
  3. When you create an app, you automatically create a data object. In Salesforce, we call that data object a custom object.(sheet/table)
  4. Custom object:
    1. A custom object comes with standard fields and screens that allow you to list, view, and edit information about the object
    2. you can also add your own fields to track or list just about anything you can think of.
  5. When you create an app with App Cloud, you automatically create a mobile version of the app.
  6. For mobile app, Quick Actions are things you want to do immediately from your mobile device. These actions live in a special place called the Publisher. You can customize the Publisher so that your most important actions are there at your fingertips.
  7. Salesforce has two different user interfaces: Lightning Experience and Salesforce Classic
  8. Standard fields(after create new waypoint, we can see):
    1. Feed — The Chatter feed is where you see things you’re interested in, like people, records, and groups. You can customize the feed to see exactly what you want to follow.
    2. Details — The ‘tab’-Waypoint custom object has four fields, the Name (I created) and three fields generated by the system (Created By, Owner, Last Modified By). As you build out your app, you can add more fields to refine the things you want to track.
    3. Activities — Activities are tasks and events associated with this record. Tasks are to-do items, and events are meetings. We don’t go into Activities in this quick start, but keep it in mind, because it’s a handy and powerful feature that you’ll love.
  9. Steps:
    1. Add APP
    2. Fill in the form( Plural Lable: pl of Lable)
    3. Create –> go to My App
    4. Create items of a tab
    5. Change the heart symbol: Setup –> Create –> Tabs –> Edit
    6. For mobile:
      1. create quick action: create –> global actions –> global actions –> new action –> target object: your tab name( waypoint )
      2. add that Quick Action to the Publisher: Create –> Global Actions –> Publisher Layouts –> drag(Remove action by dragging it up to the Global Layout area, add action by dragging it from the Global Layout and dropping it into the Global Publisher below.)
      3. /one/one.app
2. Quick start: Create a New Process on the Account Object – lightening process builder
  1. Intro: Lightning Process Builder is a workflow tool that helps automate business processes without writing a single line of code. This quick start creates a new process that updates Contact records whenever the Account billing address changes
  2. Process Builder allows you to choose not just fields on Accounts, but fields that are related to Accounts.
  3. you could add multiple actions for one criteria.
  4. Steps:
    1. Search builder and select process builder –> click new –>type name –> when start: a record changes –> save –> +add project
    2. Process Criteria:
    3. Process Action:

you know

  1. resist the temptation to think …
  2. the golden rule is to always do …
  3. give you more granular control of customization
  4. or vice versa
  5. If you see a spinning wheel, your .. is still being processed
  6. Speed up the onboarding process with a
  7. Time off tracking
  8. Assign work to queues and use Chatter to collaborate on requests, and track everything in
  9. at an aggregate level.
  10. versatile
  11. a user’s Salesforce account may have been compromised
  12. find root cause
  13. Important for both security tracking purposes and adoption
  14. Sandboxes are a vital tool for administrators and developers and a worthwhile investment;
  15. view all future jobs, including Apex jobs, dashboard refreshes, and reporting snapshots.
  16. These are your primary stakeholders for 。。。
  17. What are your main pain points at present?
  18. What is your budget/timeline?
  19. Before you can make your own app or service publicly available to potential customers,
  20. paint yourself in to corner with that strategy
  21. Remember before you roll out a new app get your users ready. To do that you will want to message out the change that is coming to the relevant users and when it will be coming.
  22. Each table comprises a number of columns
  23. square bracket
  24. rollup summary
  25. start a group for a customer visit
  26. to align everyone.
  27. engage them in helping drive Chatter success.
  28. For Chatter to soar you need great content and a sense of community. You need a Community Manager curating quality content and driving user engagement
  29. track data related to all of your interactions.
  30. brush up on their needs and buying history,
  31. are like a forgotten boat adrift at sea
  32. deals usually progress from tentative to firm before they’re finalized
  33. the likelihood that he will buy from you probably increases
  34. stop by your booth at a conference
  35. you mosey on over to your laptop, crack open a refreshing beverage, generate a few Salesforce reports, and enjoy the shower of praise
  36. She appreciates your keen insight,
  37. each department uses its own source of truth for that contact info
  38. an intricate system
  39. You try your best to find two departments that use the same process for creating records, but you’d have more luck finding a vegetarian at a pig roast.
  40. it’s no wonder your reports are riddled with duplicates, incomplete records, and stale data.
  41. Knowing how your company uses data to support its objectives is great. But it’s about as useful as a VHS tape in a Roku if you can’t get the data into an accessible and useful format
  42. Every department was tasked with using Salesforce as the source of truth for data
  43. Yes, that’s really it!
  44. This ensures you can balance security and convenience, minimizing the risk of stolen or misused data while making sure all users can easily access the data they need.
  45. limiting when and from where users can log in
  46. escalated = increased

Start from Java 3 -- Singleton, Exception, Serialization

|

Singleton

  1. How to implement singleton: make constructor private
  2. Eager initialize: before invoke, it has initialized already. The class is loading, the variable is initialized.
    public class EagerInitialized {
         /*
             1. private constructor to avoid client applications to use constructor
             2. initialize an object using keyword: static to ensure only one object exist.
             3. we need a public method to make an EagerInitialized obj visible to others
         */
         private EagerInitialized(){
    
         }
            
         private static EagerInitialized instance = new EagerInitialized();
    
         public static EagerInitialized getInstance(){
             return instance;
         }
    
         public static void main(String a[]) {
             EagerInitialized obj = EagerInitialized.getInstance();
             //...
         }
    }
    
  3. Lazy initialize: declare first but not initialize
    public class LazyInitialized {
         /*
         1. private constructor to avoid client applications to use constructor
         2. initialize an object using keyword: static to ensure only one object exist.
         3. we need to check if the instance existed before we create a new one
         */
         private LazyInitialized(){
    
         }
            
         private static final LazyInitialized instance;
    
         public static LazyInitialized getInstance(){
             if(instance == null) 
                 instance = new LazyInitializedSingleton();
             return instance;
         }
    
         public static void main(String a[]) {
             LazyInitialized obj = LazyInitialized.getInstance();
                 //...
         }
    }
    
  4. Double check:
  5. Bill PUGH: create singleton using inner class.

Exception Handling

  1. When a runtime error occurs, the JVM “throws” an exception, prints an error message, and quit
  2. try catch:
    1. The code inside “try” braces will execute
    2. If the try code executes normally, we skip over the catch clauses.
    3. If the try code throws an exception, JAVA doesn’t finish the try code and it jumps directly to the catch clause, which matches the exception.
    4. when the catch clause finished executing, java jumps to the next line immediately after all catch clauses.
    5. Execute code in finally clause, if there is any finally clause exist.
    6. an example:
       FileInputStream f = new FileInputStream("fileName");
       try{
           statementX;
           return 1;
       } catch (IOException e) {
           e.printStackTrace();
           return 2;
       } finally {
           f.close;
       }
      
    7. Rules:
      1. A try block must have either catch or finally block
      2. A try block can have multiple catch blocks.
      3. In a try block, if both super class Exception & an actual Exception are declared, as the super class Exception catches all the Exceptions indirectly, the actual Exception must not be declared after the super class Declaration(or we get an error : exception has been caught). ** So, always the Super class Exception must be the last catch block declaration. **
      4. A try block can be defined inside another try/catch/finally block, called as Nested try block.
  3. Error vs. Exception
    1. An Error “indicates serious problems that a reasonable application should not try to catch.”
    2. An Exception “indicates conditions that a reasonable application might want to catch.” In a program, when some statements are not being executed, it gives a runtime error which is called as Exception
    3. For All kinds of Exceptions the super class is java.lang.Exception.
  4. Checked/unchecked Exception
    1. Checked exceptions are the exceptions that are checked at compile time; Unchecked exceptions are the exceptions that are not checked at compiled time.
    2. If some code within a method throws a checked exception, then the method must either handle the exception or it must specify the exception using throws keyword.
    3. Error along with RuntimeException & their subclasses are unchecked exceptions. All other Exception classes are checked exceptions.(in another words, in Java exceptions under Error and RuntimeException classes are unchecked exceptions, everything else under throwable is checked.)
    4. Examples:
      1. Unchecked Exceptions
        • IOException: FileNotFoundException, EOFException…
        • SQLException: ConnectionException…
      2. Checked Exceptions
        • NullPointerException
        • ArithmeticException
        • NumberFormatException
        • ConnectionException
        • ClassNotFoundException
        • IllegalArgumentException
    5. More about check exception and uncheck exception: http://netjs.blogspot.com/2015/05/difference-between-checked-unchecked-exception-java.html
  5. Customize exception
    1. The user defined exceptions should be created by extending java.lang.Exception class;
    2. must have at least an Error Message to prompt to the user;
    3. must be thrown manually by using a Keyword “throw”.
    4. must be declared with a throws clause.
    5. The method which is declared with the throws declaration must be called within a try catch block or that block must also be declared with the “throws” keyword.
    6. Example:
       class InvalidArgException extends Exception {
               double arg;
               InvalidArgException(double arg) {
                       this.arg = arg;
               }
               public String toString() {
                       return "InvalidArgException of argument: " + arg;
               }
       }
      
       class Test {    
               public void testExp(double arg) throws InvalidArgException {
                       if(arg < 10 && art > 0) 
                           System.out.println("Great!!");
                       else 
                           throw new InvalidArgException(arg);
               }
               public static void main(String a[]) {
                       Test t = new Test();
                       try{
                           t.testExp(Double.parseDouble(a[0]));
                       } catch(InvalidArgException iae) {
                           iae.printStackTrace();
                           System.out.println(iae);
                       }
               }
       }
      

Serialization

  1. Objects are temporary, files are permanent. When we want to write object to file, we serialize the object first.
  2. Example:
    1. we have a class A, which implements Serializable, if not implements this mock interface, our writing can not succeed.
       class A implements Serializable{
           private int id;
           private String name;
           A(){
      
           }
       }
      
    2. service class to write and read(serialize and deserialize the obj)
       class B{
           FileOutputStream fos;
           ObjectOutputStream os;
           A ca;
      
           FileInputStream fis;
           ObjectInputStream ois;
              
           public static void main(String a[]) {
                      
               //Chain of stream:
               //serialize
               try{
                   fos = new FileOutputStream("aFile.txt");
                   os = new ObjectOutputStream(fos);
                   ca = new A(11, "JB");
                   os.writeObject(ca);
                   System.out.println("Saved!");
               } catch(Exception e) {
                   e.printStackTrace();
               }
      
               //deserialize
               A obj = null;
               try{
                   fis = new FileInputStream("aFile.txt");
                   ois = new ObjectInputStream(fis);
                   obj = (A) ois.readObject();
                   System.out.println("obj: " + obj);	
               } catch(Exception e) {
                   e.printStackTrace();
               }
               return obj;
           }
       }
      
  3. mock interface: they do not have any functions.
  4. keyword: transient: private transient int id;, so the instance variable id will not be serialized nor deserialized, only variable can use this keyword, and all static variable can not be transient.
  5. ca instanceof Serializable true