Hello, hi everyone. I am Sanjay Gupta. I welcome you on Sanjay Gupta Tech School. So today is day 52 of the Salesforce Learning Bootcamp. And in this session, I will be discussing about Apex test best practices. And prior to discussion of best practices, I will be explaining you what is at the rate test setup and how we implement data factory class for testing Apex classes. So these two are new concepts like yesterday we saw how we can implement data in our test class in different methods. So through test setup and through data factory, you can create data once and you can reuse it as many times as you want. Right. So these topics we will be discussing in today's session. So before moving to the session, I just want to welcome everybody. So hello and welcome. So I can see Nana, Sojit Akshay. So hi, hello. Good evening. And welcome to the show. And today I will be completing this test class topic. And I hope you are enjoying all the sessions, right? So today also we'll be having some discussion basis on whatever I will be demonstrating. So whatever questions you have, you can just type in the chat and I will be answering your questions. So I'm just waiting for a couple of more minutes so that more folks can join. And then I will be starting the session. So meanwhile, like I'm jumping onto the chat, let's see who are greeting me. So yep.  So hello, hi. Welcome to the tech school and jumping to the next slide. So if you are watching this session for the first time, so you should know about your instructor. So just go through with this slide. It will tell you everything about me. And if you're watching this day 52, so you can just start with day one and all the admin and development related stuff you can go through, right? So you need to focus on all these virtual learning best practices. If you want to really learn Salesforce admin and development stuff, right? So do regular practice, don't miss any session, practice all the exercises, those are available. And like in this practice sheet, I just added a playlist link. So to practice apex trigger and test classes. So this playlist link is available. So you can just go through with all the videos where I am just explaining how trigger is implemented and how you can implement test class for that particular trigger, right? So you can just go through with this playlist and you will you will be having all the insights, right? And consistency is the key. So please do regular practice. Don't think whether you are having any offer or not if you're a fresher, or if you are experienced professional, then also you need to do consistent practice. Because if you do consistent practice, then in interview, you will be explaining concepts differently, right? Because if you are practicing things practically, it means you know how it is actually working, right? So moving forward, so in today's session also I will be explaining the topic will be doing the demo and I will be answering your questions. And if you want to become part of a self help group where people are helping each other. So that group is created for all the beginners, those who are Salesforce enthusiast and they are learning Salesforce.  If you have not, if you are already part of that, so you can utilize that group. And this is the upcoming days bootcamp timeline. So like today, Apex test class will be completed. And Jana is asking about like, do we have one more session? So tomorrow's session I will let you know. I need to prepare some content. So if that is ready, then I will be delivering that tomorrow. Otherwise next session will be on Monday. So I will update you in the telegram group about that, right? And next week, we'll be discussing about as-in-pronunciation Apex. Then on your demand, I just included visual force. So basics of visual force, we'll be discussing in the session. And then two weeks, we will be discussing about integration, right? So this is the upcoming plan in front of you. And just follow Sanjay Gupta Tech School on YouTube, LinkedIn, Instagram, telegram, so that you can receive timely updates. All the important links like session tracker, exercise sheet, all these important links are available in the video's description. So follow Sanjay Gupta Tech School if you want to like attend different, different bootcamps for the free. And as I promised you like sales force admin and development bootcamp is going on and cybersecurity bootcamp is also going on. And let me tell you one thing like from next month, I will be starting one of the Salesforce Cloud Bootcamp. So name of that cloud I am not revealing right now that I will be sharing in the first week of next month. But from next month, you will be having one more bootcamp that will be related to particular cloud, right? So we have learned so far lots of admin and development thing. So I just thought like let's introduce one cloud specific session so that you can understand that terminology as well like how basically in particular cloud things works, right? So I'm planning about that. Let's see what topic I pick other than Salesforce admin and development, right? But it will be specific to particular cloud. So right now, whatever we are discussing admin and development, it is common for all the clouds. But there are some tools which are specific to particular cloud so that I will be starting. And when that bootcamp related to that particular topic will be starting. So in that case, what I will do like three sessions I will keep for this bootcamp and three sessions I will be having for that particular topic. Okay, so that you can understand things parallely. Okay, so let's jump to understand what is at the rate test setup and apex test class. So first I will be discussing it theoretically and then I will be explaining how we can implement at the rate test setup in the apex test class, right? So let me just see if I missed any question in the beginning phase. Okay, so Praveen is asking about like how we can fill the exam form and schedule exam. Okay, so web assessor. So Praveen at the end of the session when I complete everything. So just remind me, I will be explaining you in the session itself. Okay, so if you want to learn collection, so you can go through the session tracker and the beginning videos like if I say the numbering will be from 32, 33, 34, 35 session number 32 to 34, you will find three sessions based on list set and map. So those are related to collection you can go through with that. So Pooja is asking, do we need to learn visual force as I heard that it is now not in use? Yeah, so we rarely use visual force, but to give you some idea because lots of folks were asking, can you have basic sessions on visual force? So that's why I added one week for that. Yes, that I will be doing in night. So maybe nine to 10 slot I will pick for that purpose so that a working professionals can join because that will be targeting both freshers and working professionals, right? So now moving forward. So to understand at the rate test setup, we just need to go through with all these points first.  So just go through them one by one so that you can understand actually what at the rate test setup is. So basically at the rate test setup is an annotation, right? So in last session in yesterday's session, what we did in each method in each method, we implemented code to create some data, right? So with the help of at the rate set at the rate test setup, what you can do, you can create your data commonly in one method. And then you can just query that created data in different test methods. So first point says use test setup methods that are annotated with at the rate test setup. So there will be only one method which will be annotated with at the rate test setup. So you can use or you can create that method so that you can create test record once and then access them in every test method in the test class, right? So you need to create that method once and whatever data you will be creating into that method, that data you can access anywhere in the test class in different different methods, right? Then next point says test setup methods can be time saving when you need to create reference or prerequisite data for all test methods. So in your test class, if you have lots of data that you need to create in different different methods and you are creating repetitive repetitive data. So if I take you to the org, if I take you to the org, so here you can see in this create opportunity test we created account records. In this method, populate rating insert here also we created these account records and in update also we created these account records. So in each test method, we are trying to create some data, right? So instead of creating them again and again, what we can do we can just implement a setup method that will be annotated using at the rate setup at the rate test setup. And once you need to create the data and that commonly created data you can query into different test methods, right? So last point says if a test class contains a test setup method, the testing framework executes the test setup method first before any test method in the class, right? So these are some points that you need to remember while writing this annotation at the rate test setup, okay? Now if I move forward so two more points are listed here like records that are created in a test setup method are available to all test methods in the test class and are rolled back at the end of the test class execution, right? So whatever data you are creating in the test setup method, the method which is annotated with at the rate test setup, so the data that you create in that method can be called through any other test method and once execution is done, the data or the like whatever process you have done everything will be rolled back, right? So I will be explaining it practically so that you can understand it more clearly. So next point says if a test method changes those records, right? So those record means the records which you have created in the test setup method. So such as record field update or record deletions, those changes are rolled back after each test method finishes execution. The next executing test method gets access to the original unmodified state of those records, right? So these are all the points you will understand when I will be explaining you how we can implement at the rate test setup, right?  So I'm going to create a class and I have a document of Salesforce where some lines of code are available. So I'm going to use this example to demo you how we can use at the rate test setup. So I'm just creating a class named as common test setup, right? So here you can see this class is created. Now what I'm going to do, initial code I'm just copying and I'm pasting and then I will be explaining you, right? And this document is available freely. It is a Salesforce document which is available freely for the reference purpose. So we are understanding through that reference document. So here you can see this is a class common test setup. It is declared as private. Here also we need to use at the rate test at the rate is test is test annotation. Now if we go here so you can see this is another map this is a this is the first method and in this method, we are using at the rate test setup annotation, right? And the name of method is setup method, right? And here data is created. So what we are doing we are creating a list of account and then iterating a loop that will be iterating two times and account records will be created and those account records will be added into the list. And then we are inserting accounts, right? So this way you can create a method where you can commonly create the data. Now I'm going to show you how you can create your test method. So this I'm just copying and then I will be explaining it line by line. Okay, so now in our code you can see first of all we have this part which is a method and it is annotated as at the rate test setup. So this method will be executed first so that data will be created whatever data will be created that data you can query into test method. So here you can see we have a test method. Here we have a test method which is annotated at with the help of at the rate is test annotation and the name of method is test method one method name can be anything right so whatever data we have created here that we can query. So you can see here we provided name as test account and we appended I so I will be zero and then one. So the first account name will be test account zero that is written over here. So what here we are trying to do we are trying to query account ID where name equals to this and limit one so that account record information will be available into this acct then what we are trying to do we are trying to modify phone number of that account record and we are applying update acct so that particular account will be updated right so you can see in this method we have not created the data data is actually created in the above setup method and that we are querying here. Okay so this way the data which you are creating in the setup method so this data you can query in any test method that is implemented here. So next you can see for deletion purpose again we are querying the data and this time we are querying the account where account name is test acct one so that account record information will be available into acct to t2 and then we are deleting it right so this way if you want to perform some operations you can do so this is the first test method that we have implemented and this test method is basically getting or querying the data which is created here. Okay so now if I go here and copy this method as well so this is another method now you will get more clear understanding so if I scroll from the beginning so first of all we have created this setup method which is creating the data then if I scroll down so we have first test method where we have not created data we are just querying the data and we are performing some operations then we have another method this method is test method 2 and here you can see again we are querying the data twice now this time what we are doing we are just checking whether the changes we made in test method one they are rolled back or not right so we are querying test account zero and we are checking the phone number whether it is null or not and here we are querying test account one and we are checking whether this account record is available or not because in above method we updated the phone number from blank to some value and we deleted the second account record so here we are checking whether we will be getting the fresh data that we created above here or we are getting the updated data through any other method so the answer will be when test method one apply any changes into the records so those changes will be rolled back once that test method one execution is completed when you are executing test method two so test method two will be getting the original data that you created in the setup method right so here you can read these comments so it says the changes made by test method one are rolled back and are not visible to this test method get the first account by using a SOQL query and verify that test account created by test setup method is unaltered so it will be equals to null here we updated it with this value but it will be null because in test method two whenever you are querying that account record so its original value will be queried so test method two and test method one both are accessing that data separately which we created with the help of setup method right so this way what you can do you can just create the data commonly and then that data you can query here and you can perform certain operations so I hope this way you understood the adverite test setup feature like how we can create a common method where we can create some data and in different different test methods we can access that data right so with this explanation now if you have any question so you can go ahead and you can ask your queries so that I can answer so Anusha is asking when LWC classes will start so Anusha next month is packed for as in chrono sapix visual force and integration so I think in June lightning web component sessions will be starting so as as I told you like in every session I am explaining everything in detail so that's why things are taking time so in June lightning web component sessions will be starting but prior to that I will be covering the prerequisite that is html css and javascript so vamshi is asking will setup method be private or public if private how we can use it in another method so vamshi if your method is private so private method we can access within the class private method we cannot access outside the class but in within class we can access okay praveen is asking what is exact meaning of rolled back yeah so it is not a silly question it is important because you need to understand the rollback process so rollback means like in this test method one we queried the account record then we updated it through update dml right so once this method is finished so rolled back means that account record will get back to its original state original state was like phone is blank here we didn't provide any value to phone field it is blank but here we are updating but after completion of this method after execution when execution of this method gets completed so phone will become blank automatically so it means it is rolled back rolled back means once the process is completed so record will reach to its original position original values from where execution started so that is basically rolled back so in simple words you can say no change will be there in the record process will get completed but record will be unchanged so that is basically known as rolled back okay praveen is asking start test and stop test so i think those i already explained here so basically so listen it carefully we are now talking about this test dot start test and test dot stop test so basically these two statements control your governor limits so in your test class if you have more than one test methods and for each test method you want separate set of governor limits for operations so all the dml operations you can you can write in between these two statements and in one method you can use this pair once but in different different methods you can use it repeatedly right so right now in this class we have three methods so in each method we have used this pair one time so for each method a separate set of governor limits will be available so naina best practices we will be discussing today so once i finish all the demonstration and explanation then i will be explaining all the best practices so rajiv we can use a certain method one right we can use so if you want to use a certain method one so you can compare two values you can but for demo purpose i just use this example but in each method you can use a certain basis on the requirement so what you can do in this method like when we applied update account so here you can write system dot assert and you can see whether record is updated or not so update dml so you can assume like some trigger is working in background and that trigger is updating account record so you can just apply assert and what you can do so here you can just copy and this way you can write you can write and you can compare it with this this way so this way you can apply it and before that here you need to query the data updated data so first query the updated account record and then you can apply system dot assert equals like this right so this is simple example so what you need to do whatever i demonstrated you yesterday so here you can try and implement this adulate test setup so you can shift this account creation in the adulate test setup and record will be inserted automatically so in case of insert operations you just need to apply these two statements you need to query and apply assert and for update operation you will be querying the data and performing these operations update dml and then you will have so i will also explain this once i explain all your queries so i will be modifying this with the help of this adulate test setup so praveen i already explained this if in a class any method or variable is private so those can be accessible within the class so here you can see these are this is private class so in private class if your method or variable is private so that you can access within the class only in any different class you won't be able to access but in the same class you can here search now you can write normal soql also in between start test and stop test but generally we write dml because through dml your trigger flows and other processes initiates so they make all different different processes and they can have different soqls and dml so generally we write dml in between these soql we already know like it will be executing once only so we just don't prefer soql in between them but dml for sure we write so annusha assert i already explained in yesterday's session so just go through the yesterday's session there you will find here i explained how to write assert so i already explained it in detail so you can just go through yesterday's recording because if i explain every session in other sessions so it will be very lengthy so just i already told you like attend all the sessions go through all the sessions then only you will be able to understand yes Ashok this see all data we will be discussing it is planned for today's session so one by one i will be going to explain everything so someone is asking how to reduce runtime for a particular method so you should be implement you should implement optimized method so number of like loop should be less process should be simple then only you can reduce runtime so Vishal LWC and all the prerequisite will be starting from June 1st week okay now i am moving to modify this class so here what i am going to do i will be creating a setup method so static void setup and here what i'm going to do i'm going to copy and paste it right and i just need to insert the data okay now what i can do i can just comment all these lines these are not required so here you can see i'm just modifying yesterday's test class so this is our setup method where i just created the data account records and i'm inserting then this is first test method here everything is coming because data is already inserted so you just need to apply this soql and you can apply the assert statement then here also you can comment till here and this assert you can apply now here also uh you can comment it add to this you need to query the data so here what you can do you can query the data which we created above so if you write this so all the data that you created above will be queried and will be available into this acclist and then you can iterate that acclist and you can apply update so this way you can see from each method i just commented the data creation and data is created above commonly so you can see how we reduced the length of the test class by creating common data using this annotation right so i hope this way you understood how we can implement setup method so that repetition repetitive code can be reduced so this i already showed you how to reduce runtime so if you reduce the length of the code then your code will execute faster right and someone is asking about test dot is running test so this i will explain but let me complete other topics then i will show you an example of this test dot is running test right so moving ahead so this i already explained you like at the rate test set up now the next topic is how we can implement this test utility or data factory class so basically what we did using this at the rate test setup in in a single class if you are creating repetitive data so in the same class you can create this setup method and the data you can just use in different test methods right so this is the use of this setup method but it is limited to this class only now there may be requirements in future like the data which you are creating that can be required by different different test classes there may be possibilities the data which you are creating that can be required in different test classes so what you can do you need to create a separate class you need to create a separate class where you will be creating the data and that class method you will be calling into the test class right so that is basically known as test utility or data factory class okay so now first of all i am going to implement that for you and then i will show you how we can call those methods here okay so i am just creating a new class so name of that class can be data factory it can be test utility it depends on you so i am naming it as data factory and in this class i am going to implement a method so here we will be implementing method as public because this method we need to call into another class so that's why i'm creating it as public its return type is list of account so it will be returning account list and the name of method is create account record then it will be receiving some parameters like name then integer count like how many records you want to create and boolean is insert like you want to insert the data immediately or not right now here what i need to do i'm just creating list of account now i'm going to implement a loop which will start from one and it will go till count so whatever value of count is here we have a count variable so we are using this count variable here for condition checking so for example if count value is 10 so this loop will be iterating 10 times so 10 records will be created automatically so here we need to write account acc equals to new account then acc dot name equals to name plus i and then acc list dot add acc so this way i'm trying to create a count records and we need to set active as well so acc dot active equals to true now if is insert so here we are providing a privilege like if you are passing like we need to insert the data immediately so here you can write this if condition and you can write insert acc list so if this is insert boolean variable is true then your data will be inserted automatically if it is false so insert won't work and we are just returning a count list right so this way you can create a common method in the data factory class right now what you need to do you need to call this method in your actual test class right you need to call this method in your actual test class so here it is showing some error okay it should be yes not true right so i'm moving here and i'm just deleting this test setup method and here i'm going to call it so here i'm creating list of account acc list equals to new list of account and then acc list equals to data factory dot and from here we need to call this method so i'm just copying it and pasting it here now here i'm just passing the name as test number of record let's say 10 and i'm passing true so what is happening here i'm just calling this create a count record method so here create a count record method is available which is expecting three parameter name count and is insert so for name i'm passing test count as 10 and is insert as true right so here we will receive test here we will receive 10 here we will receive true so the records will be created and true is insert is true so data will be inserted once data is inserted so that account list will be returned and it will be available here so this way you can create a separate class where you can have some data and you can call it like this same you can copy and you can paste it here also as simple as that so we created the data once we created a method where data is creating once and we are calling it again and again now you might be thinking what will happen if i pause if i pass false here what will happen if i pass false here right so if i pass false so this if condition won't be working it is false so insert won't work so what will happen the data which we created here it will be returned as it is but it is not inserted it is not inserted so it will be available here in acc list now for example the common data which we have created so here we just assigned values to these two fields this is common for all but for this specific method we want to set some more field values so what you can do you can iterate it again and you can set the value so let's say industry equals to energy so you just modified it and then you can write insert acc list so this way what is happening this is a common method which will be called through different methods so name and actor will be set for each method but for this method we have separate requirement like we need to set values for some different fields as well so what we did we just passed false from here and the returned values we just iterated and we update we set some values and then we applied insert operation so this way through this third parameter you can just control whether to insert the data here only or to return the list and insert the data here in this test class right so I know it is little bit different for you so just try and implement this scenario in your system because just watching this session and if you don't do practice you won't be able to understand things so just implement and here like you can find crisp videos on all these topics so after watching this session if you want to have a scenario so you can go through iterate test setup annotation for bulk apex test and test utility class for bulk data creation right so these are some scenarios that you can implement at your own now I'm just going to take some questions uh yes Archana if you are updating list of records so you can apply assert for only one random record so that you can validate whether that complete list is like updating or not so Ashok which one which third method you want me to revise so Shiv Shankar we are using name plus i so that i will be changing from 1 2 3 4 5 so name will be updated automatically so here what is happening from here we are passing name as test this test will go to this name so here what we are setting we are writing name plus i so test plus one so test one test two test three test four this way data will be created Archana know we we never combine data factory and test setup method so if you do so what you need to do in test setup if you are calling data factory methods so in test methods you need to apply soql so again there will be lots of headache if you apply soql so instead of calling data factory method in test setup and then uh then write soql so it will be better to call data factory methods directly in the test method yeah so Ashok difference between test setup and test utility so in test setup we are creating common data but that common data you can access in that class only whereas in test utility or data factory in test utility or data factory this is a separate class and if you want to call it so for example i i just want to call it in this class also so you will be able to do so so if you want to create some data here so you can call that data factory method in any other class as well so the difference is test setup method common data is available for only one class one test class but test utility or data factory data is available for multiple classes okay so Jana is asking why we are passing this third parameter so Jana if we pass true from here if we pass true from here it means we don't want to modify this data we we need only name and active field set and we want data to be inserted here only and that inserted data will be returned sometimes what will happen instead of name and active you want some more fields to be like some more fields like in the industry type they should also have some values so but you don't want to modify this code here because it is common for all the methods all the test classes so what you need to do you can pass false from here if you pass false from here so your data won't be inserted here only but it will be returned as is whatever loop you have implemented whatever data you created here it is not inserted but it will be returning and once you receive it here so you can apply one loop and you can add some more fields values and then you can apply insert statement right so we are not updating that common method instead we are calling it at different locations and wherever we need some more fields value to be set so there we can just like pass false and then whatever data is returned through that we can iterate a loop and we can set values and we can apply insert operation I hope this makes sense now yes Chandan that that data is created in test class only so Srivalli is asking data factory class methods are not required to be annotated yeah so if you don't annotate it with at the rate test so let me just check yeah so we don't need to annotate it with at the rate is test because why so because we are calling it from a method which is already annotated with at the rate is test so if you are calling it from here so like it is already part of that process yes Ashok all the records will also be rolled back here in test utility as well and it is not at the rate test utility test utility or data factory is just name of the class so Praveen if you don't mention is insert value so your code won't work if I don't pass any value so it will throw an error because I'm just passing two parameters and here it is expecting three parameter so anyhow you need to pass the value you cannot leave it blank so either true or false you need to pass so next is is it ideal to use dml statement and before update context like create tasks no if you are using before update then don't use dml I think that doesn't make any sense so Jana I already explained this lots of time rolled back means you will be on the like step so for example if you have created a record if you are updating that record and something is breaking so everything is rolled back it means you will come from where you started right so that is basically known as rolled back so you will come back from where you started nothing will be applied because your process is failed in epics it is known but in test class if process is completed then also like data changes will be rolled back okay so this way I hope you understood how we can create test utility and data factory class and one more thing I want to show you like here in this test in this data factory right now I just created one method but if you want to create more data let's say you want to create so here in this method we are creating account sorry now here you want to create contact so you can write create contact record and you can change it like for contact right so this way you can change it for contact so I'm not changing it completely but I think now you can visualize in one test class we can have more than one methods to create different different s object records right so just practice it yourself so that you understand now moving forward we have one more annotation which is known as Adlerate test visible it is quite simple so Adlerate test visible I'm going to show within example so I'm not going to implement it because it is very simple so the idea is yeah so just read this line use the test visible annotation to allow test method to access private or protected members of another class outside the test class right so we discussed like private we can access within the class but now if you want to access private method or private variables outside the class so that is also possible so here you can see classes public but this variable record number and this update record method is declared as private so before that we are using Adlerate test visible right so if you do so so in another class so here it is test visible example here it is test visible example test so in this class if you are using test visible before any method so make sure this is not a test class remember this is not a test class this is a general class if you want to access the data which is available here variable and methods into your test class so here you need to write Adlerate test visible now when you will be implementing your test class using Adlerate is test so here you can call it so this record number this record number is a variable which is available in this test visible example class and here we are calling test visible example dot update record so both are declared above both are declared above so you can see from this class these two entities we are accessing here so remember in any Apex class if you have private entities and those private entities like variables and methods you want to call in your test class so you can use Adlerate test visible so it is kind of an interview question so you just need to be aware with this okay let me see if there are any questions so Ashok we never declare anything so here you can see I never I didn't mention any annotation so data factory is just terminology right you need to call to create the data so name can be anything it is not mandatory to use data factory or test utility it is just generic term you can use any name and through that also you can create okay so moving forward next is run as so someone asked like how to use run as in Apex tests so yesterday I think someone asked so I just have one example for that as well so basically run as we use so that if you want to run particular block of code in context of particular user so right now whatever test classes we are implementing those test classes are running in system admin like administrator context or system context but if you want to run your code any particular line of code bunch of code as another user so what you can do first of all you need to create a user so to create user here we are creating username unique username then we are creating we are querying the profile then we are creating the user record right now once user is created then this way you can write system dot run as what you can do you can write system dot run as and I am passing you here so this code this highlighted code will be running in context to this you user and you user profile name is standard user so this code will be running in standard user context so this way if you want to run a particular code in context to particular user or particular profile so this way you can create that user record with the help of profile and this way you can run that code right so let me take questions now yes Chandan after the session I will be explaining you how you can like register yourself for associate exam okay and Praveen is asking if the class is private then we use as visible as possible no if class is private then it is of no use class should be public okay moving next next we have is test see all data equals to true in apex test right so it is also important and in interview generally this is asked like what is see all data equals to true we use it with at the rate is test annotation so if I explain this to you so here I have one more example so all these links I will be providing in the like exercise sheet so that you can go through so here you can see in the first line we are using at the rate test at the rate is test see all data equals to true so what does it mean so just go through with these statement annotate your test class or test method with at with is test see all data equals to true to open up data access to records in your organization so basically if you want to access the org data then you can use it but as per best practice it is not suggested so you can just use you can just read these statements by annotating your class with at the rate is test see all data true allow test methods to access all records the best practice however is to run apex test with data solo using is test see all data equals to false right so but if you want to access your org data you can use it okay but why we don't use it but because in some of the cases like in your org if you have not if you don't have any data so in that case your test class won't be working so it is all always suggested like to create the data because in some of the cases like for particular objects there may be possibilities you have you have no records in that case record creation is better okay so i will be adding all these links in the session tracker here in today's session so that you can go through whatever i explained now quickly i'm going to explain all the best practices and then i will show you how you can register yourself for web assessor right or maybe like if there will be less time because at 9 p.m we have one more session so maybe after this session i can come live again and if you have any doubt while registering so i can just guide you right so let's see how much time this best practices will take and accordingly i will help you out right so this is very important like apex best practices trigger best practices test class best best practices all these best practices are important to understand right so these are simple statements that you need to go through one by one right so just just read all these statements and i think everybody knows i already explained these while explaining different examples related to apex test so you need to start test class with at the rate is test annotation then start test method with at the rate so class also and test method also with at the rate is test annotation then all the methods of test class must be static and void static because they will be called automatically and they won't be returning anything then you need to name your test class as your original class plus test or if you are using trigger names so trigger name plus test so always append test word at the end of your class so that if you are working as a developer and your test class any other developer is using so they should know through that name like it is a test class then prepare bulk test data which needs to be used for test run so i already told you whenever you write any test class so you just need to implement that test class with bulk data so whatever example i shown you i also created data in bulk so if you create data in bulk so it means like your you are just testing all the processes for single records and bulk records if those processes are working fine for bulk records so it means you have implemented them properly right so moving forward we have more best practices statement so at least 75 percent code coverage should be there because if you don't have that much code coverage so your code won't be deployed to production then calls to system.debug are not counted as part of epics code coverage so in your epics class if you have system.debug so that won't be part of your code coverage then if code used conditional logic so this i think i showed you on monday in monday session i showed you if your code has if else branching so you need to execute each branch so you can have different different methods so that all the process will be covered then make calls to methods using both valid and invalid inputs so this also you need to take care so just just try to implement at least two or three methods so that you can provide some valid or invalid data and in both the ways your epics code should work properly then use the run as method to test application in different user context so this i already showed you like to use this run as method you just need to create the user if you create the user then only you will be able to use this method and write comments stating not only what is supposed to be tested but the assumption tested made about the data and the expected outcome so in your test class there should be lots of comments available because whatever you are assuming other developer doesn't know if you don't write comments so write proper comments so that if you implement something so other developer will be understanding what you want to like explain what you assume your assumption should be available in form of comments right then i think this is last slide for today's session so always write test methods will bulkify data so you can use at the rate test setup method or you can use utility or data vectory class so that you can reuse whatever bulk data you are creating and you can use test dot start test and test dot stop test to make sure that the actual testing of your code happens with the fresh set of governor limits so these methods help you to reset your governor limits just before your actual code of testing gets executed right so for each test method you can use this pair and use assert statement to test whether the actual code is executing correctly and giving the results as expected so this is very much required if you don't write assert you won't be able to validate whether your apex code is working fine or not and always try to test both positive and negative scenarios right so these all are best practices that i have for you and now if you have any question you can ask and i think the problem related to associate exam or like web assessor how to use it properly so i will be scheduling one session just after the cyber security bootcamp so i will come live again for 15-20 minutes and then we'll be separately discussing about that there right so let me jump here and see if you have any question okay so chandan like registering is not the problem okay you are able to register but while giving exam they are not able to log in to launch the exam so i think launch button is available 10 minutes prior so you just need to set proper date and time and then you just need to wait for the launch button so next question is these test classes creates unit test to perform yes so if you run all your test classes together so that is basically known as regression testing so you can do end-to-end test through those test classes like if all the test classes are together working or not so ashok at the rate test setup is different see all data is different so archana as in chronus apex we will be discussing next week so next week when i will be discussing future batch cueable schedulable so i will be explaining apex code as well as its test class so praveen is asking a good question if we have trigger and trigger handler so you just need to test the methods which are available in trigger handler trigger will be covered automatically so basically if you are using see all data equals to true then at the rate test setup annotation is not required because you don't need to create data you are just fetching the org data so both are separate at the rate test setup we use when we need to create the data in the test class and this is test see all data equals to true we use when we need to get the data which is available in the org so praveen run as like i will be sharing the links in the exercise sheet so you can just go and have it from there so let me see if i have links handy yes so i am just pasting them so here in this i am just pasting some links yeah so i am just attaching it here so here i just provided all the links which i demoed you can go through yeah so i will format it later on but links are available so you can just go through test visible annotation you can go through runners and you can go through his test okay so you will be able to understand so ashok we don't need to write see all data equals to false because it is by default okay guys so i think i'm done with the session if you have any more questions so quickly ask because i need to take a break and then at 9 p.m we have one more boot camp so if you have any genuine question you can ask otherwise you can also have a break if you want to attend upcoming session and thank you for attending this session so i'm just standing i can i can see there is no question i think today's session was fruitful lots of questions were there and i hope you understood everything whatever i demonstrated so just do practice and through practice you will be able to understand it more clearly thank you so much guys see you after 20 minutes and another boot camp thank you bye everyone


Hello everyone once again I welcome you all to MSP lecture series on trans-traumatic chemistry. This lecture is 32nd in the series in the last few lectures we are discussing about the classification of ligands by donor atoms. And let us continue discussing on various ligands and because ligands are integral part of coordination chemistry if you understand the nature of coordination modes the nature of the donor atom and how they can bind and what are the binding modes it comes very handy later when we want to use them in some applications especially in material science or in homogeneous catalysis or even in drug discovery or in biological studies. So from that point of view understanding systematically the nature of the ligands and their binding properties is very very important with this let me continue from where I had stopped in my previous lecture I had initiated discussion on synthesis of isocyanide complexes and the reactivity of bound isocyanide complexes with few examples I showed you one can make coupling products from Sino complexes isocyanide complexes at least in order to see coupling reactions happening we have to have minimum of two isocyanides on a metal center and in case if we have more probably apart from one or two others will remain as terminal isocyanides and depending upon what stoichiometry we are using two or more set of isocyanide ligands can participate in coupling reactions. So after completing the discussion on coupling reactions let us look into electrophilic attack. So usually electrophilic attack can give alkalidine complexes. Let us start with one simple general example to make you familiar with this kind of electrophilic reactions that happens with bound isocyanide ligands. Just for understanding I have taken only one CNR it does not mean that it is a monoligated metal complex or something let us assume we have several other ligands on metal this intermediate species will be in equilibrium with. So this is the end product you can see this is alkalidine moiety here. Let us take a specific example now to understand this reaction perhaps you know what is DPP, 1, 2 bis-diphenyl phosphinoethane bridging isocyanides have very high nucleophilicity and are readily attacked. For example if you take a complex where isocyanide is acting as a bridging ligand let us consider this example here treat this one with methyl iodide. So with these examples let us move on to nucleophilic reactions. So nucleophilic attacks either at carbon or at nitrogen that can give alkalidine complexes unlike electrophilic reactions where we got alkalidine complexes when nucleophilic attack occurs at either carbon or at nitrogen that leads to the formation of alkalidine complexes. Let us look into a few examples in this case. So this moiety is referred to as alkalidine that means if you have metal to this is alkalidine and if you have metal to carbon triple bond this is called alkalidine complex it is like acetylene alkyne and alkene type. Let us look into one more example here when you treat this one with ethanol this is another interesting example for the formation of alkalidine complex. So unless otherwise no specification is given when CP is written assume it is cyclopentadiene ligand having hapticity of eta 5. So in general one should remember in nothing is mentioned about this one and if something is shown this indicates it is eta 5 C5H5. So iron is in plus 2 state then this is treated with sodium borohydrate. I have given three different type of examples to show how nucleophilic reaction occurs at either carbon or at nitrogen that leads to the formation of alkalidine complexes. With this I stopped discussion on ligands having carbon as donor atom. Of course as I mentioned carbon monoxide is the most common ligand with respect to carbon donor atoms and since you are all familiar with carbon monoxide I did not discuss in an elaborated manner about those compounds. Nevertheless we come across now while discussing lot of other reactions CO compounds or metal complexes having CO. Now let me move on to nitrogen donor ligands. Nitrogen donor ligands are plenty one can see the list here it is never ending. The simplest but hard ligand with very weak sigma donor and very weak pi acceptor abilities dinitrogen in neutral ligand it can be a two electron donor or it can be four electron donor and then ammonia the most common classical ligand we come across and then all primary amines both alkyl and aryl and also secondary amines and also tertiary amines and of course from NH3 if you eliminate one hatch it leads to the formation of NH2 minus this can also act as a ligand or if you remove two hydrogen then we get amide and then if we remove all the hydrogen atoms then we get nitride all these are very good ligands and numerous examples are known in each case and when we comes to cyclic heterocycles pyridine ligands are very prominent we have plenty of pyridine ligands and also N macro cycles and also skip bases and apart from this we also have EDTA ethylene diamine tetra acetic acid where we have two nitrogen atoms along with four carob oxalate oxygens and TMEDA another very useful ligand tetramethyl ethylene diamine and ethylene diamine itself is an excellent bident ethylene that forms very stable 5 membered rings and also apart from ethylene diamine we also have diamine triamine tetramine and also polyamines to make you familiar with nitrogen donor ligands I have listed some important nitrogen heterocycles here you can see sort of this can be a bidentate ligand this can also bidentate ligand this triazole can be tridentate ligand and pyrrole can access an anionic ligand besides acting as anionic ligand it can also act as a neutral ligand for electron donor when it is N minus and imidazole we have and we have something like this immuno system we have and when it comes to bipyridines we have 2-2 dash bipyridine very useful for collating into a metal center and this is very useful for bridging especially this ligand is widely used in making metal organic frameworks and then in photophysical studies 1-10 phenanthaline is very important and terpyridine and also 1-8 naphthyridine purine adenine and also we have hexapyridine torrent apart from those we also have of course this one is ethylene derived phosphine here nitrogen can also acts as a ligand many times when nitrogen is very close to phosphorus because of the establishment of multiple bond between phosphorus and nitrogen and most of the acation nitrogen lone pair is not available for bonding in this case although nitrogen is trivalent what happens phosphorus is taking electrons from nitrogen lone pair to its sigma star so that we call it as negative hyper conjugation in case of metal complexes we call it as back bonding because of these things whenever a nitrogen is next to phosphorus it loses its donor abilities because its lone pair participates in binding with phosphorus in some books they say it is d pi p pi interaction it is not d pi p pi interaction it is p pi sigma star interaction that is called negative hyper conjugation and of course ethylene diamine tetraacetic acid I told you once this will always exist in the stable form having here is a triannic form and that is the reason if you look into the pKa third and fourth pKa values are very high because it is on NH and it is not so easily it can be deprotonated and acac is there and that is of course this is an oxygen donor ligand and then we have porphyrin the simplest porphyrin I will show you at the end how to prepare this one and another one is thalocyanin. Thalocyanin is prepared from this disino benzene and one should remember that this can be prepared only in the presence of a metal so that this grows in surrounding the metal that means it is an encapsulating ligand and then it usually does not exist independently without metal ion and of course about these things I already mentioned in my one of my previous lectures so now let us look into few ligands one at a time. Let us first look into dinitrogen again dinitrogen chemistry is very very important because we have plenty of that one in the atmosphere one can make lot of useful nitrogen compounds as simple as ammonia people always look for very mild conditions to make ammonia unlike papers process that requires high temperature and high pressure for that one the better option is looking for ideal metal complexes so the first dinitrogen complex was made by Alan and Sinov in 1965 they used this method of treating rhodium trichlorate hydrate with hydrogen to get this pentamine dinitrogen ruthenium dichotinic complex of course we have several methods I shall tell you later first let us look into the possible coordination modes of dinitrogen so nitrogen if you see here this has two lone pairs are there here so these lone pairs can go to metal so it can act as a terminal ligand or it can also act as a bridging ligand where both the lone pairs on nitrogens are utilized and of course this is same as that one and of course you can also have two different metals homo bimetallic system or hetero bimetallic system you can have or this lone pair can go to two metals so you can have a trimetallic system or we can cleave one of the bond in this fashion you can also form some sort of immunotype compound here where we have this bent structure or one can also see this kind of binding or one can also see this kind of binding also once if we break two bonds between nitrogen and autumn the end on end on is when we have one so eta one type is the most common mode in most of the metal complexes we see this one and whereas other lone pair remains intact this is the most common one this is called end on and this also called as eta one mode this is the most common one and just if you look into free nitrogen in free nitrogen the distance between n or nn bond length is 1.097 and strength units whereas in case of nitrogen compound it is increases and it can range anywhere between 1.10 to 1.16 most common bridging mode is linear this is the one so that means you can assume that the triple bond is still intact that indicates that the bridging nitrogen is linear it is almost close to 180 degrees in that case what happens nn distance will be around 1.1 to 1.36 handstand units so now let us look into the synthesis of nitrogen complex if I want to make for a specific application how to make dinitrogen complexes in the laboratory first one is a reduction method of course reaction has to be carried out under positive pressure of nitrogen because we are inserting nitrogen so this is one of the method of course here DEP is bisethyl phosphinoethane very similar to DPP so 1 2 bisethyl phosphinoethane and this is a chelating ligand so 2 chelating ligands are in this fashion and it is a square pyramidal molecule so one is using you know this reducing agent you can do substitution reaction that means replacing one neutral ligand with another one for example if we take treat this complex with N2 in methanol it can just simply substitute hydrogen molecule to form dinitrogen complex as I mentioned DEP is nothing but bis you can see 1 2 bisethyl phosphinoethane and similarly this is also 1 2 bis dimethyl so these two are widely used methods in the preparation of dinitrogen complexes of course if you want to look into more always you can go to advanced yarn chemistry by FAA cotton and others you can see lot of examples and also you can see some literature that one can use and also there are reviews are there about dinitrogen complexes one can get more details so before I proceed to look into reactivity of coordinated nitrogen let me show you some similarity between various other ligands for example when we see ligands such as isocyanide carbon monoxide dinitrogen or nitrocyl ligand we can perform at least two type of reactions if not three so they are nucleophilic substitution reactions are nucleophilic or electrophilic reactions that means how the electrophilic reactions and nucleophilic reactions can be started okay in this let us look into some similarities so m and 2 can be conveniently written in this fashion so that means this one we can show in a format like this due to the movement of electrons so something like this so now the moment I write like this delocalization of electrons you should be able to know if the where nucleophilic attack happens and where electrophilic attack happens one should remember about this one so later when you are using electrophilic sub electrophilic attack or performing nucleophilic attack you should be able to tell where this nucleophile or electrophile are going to attack the bound ligands this is very similar to what we come across in case of carbon monoxide carbon monoxide if I take like this to start with has a positive charge and it has negative charge that means electron reach and because now carbon monoxide is donated a pair of electrons to sigma bonding as a result what happens there will be net positive charge and then depending upon how much back bonding occurs next stage is something like this almost we have ketonic and bond strength is weakening as far as CO is concerned and then the extreme case what happens one can see something like this this one so more and more electrons are donated from metal to pi star and as a result what happens metal to carbon bond in strength increases and CO becomes weaker and now if you consider this one something like this we can see here something like this so now we can see how nucleophilic attack happens where electrophilic attack happens and same strategy one can use to understand the reactivity of bound cyanide as well isocyanide as well now you can see the similarities between some of these ligands so since similarities we are seeing that is a reason we can see a variety of reactions that happens and bound one so in some cases coupling can happen readily but invariably you can come across nucleophilic as well as electrophilic reactions that is look into more such reactions with bound nitrogen that is very very important from from synthetic point of view until then have an excellent time reading chemistry especially a coordination chemistry and especially getting more information from textbooks about the ligands and their behavior when they are brought very close to the metal center.


OK, so v zelo vseče. U spesu deličke, bilim? Zelo vseče. Vselo za spesu deličke in vseče zato njega u spesu deličke. Zelo R, G v spesu deličke. Zelo vseče. Kratič. In, ok, značujemo norma. Zato je to suprimum vsega, da je vsega funkcija f in lpe, ki ne bo 0. Značujemo vsega resulta. Vsega izgleda. Ok, kako lpe je vsega 1 in infinity, Zame si če endinga zaščelo, da je gazlost v ljube. Kaj je ineštavno vsega eneštavna eneštavna eneštave. Ko jel bi zgeljeno, da proroduje, je ovo, nespečno, dataj je kaj je vsegerzavno.If we do longer be in this way you can define f of f as the integral over e of the product between the two. Moreover we also prove that we can say something about the normal big f. Ok. So, beside this, we prove also lemna. So, we consider e a measurable set with finite measure. And we assume that there is a constant m positive, ...sat that we have that the absolute values of f of the integral over e o f times g is less or equal than m times the lp norm of f. And this must be true for any f bounded and measurable. Then we show that we can infer that g is an hq. And also we can control the hq norm of g by means of m. Ok. So, what remains to prove? And this would be the last theorem of the course. And then we will see some exercise in the preparation of the test. The so-called Ritz representation theorem. So, this is known under the name of Ritz representation theorem. Ok. Which test is the following? So, you have let f be a bounded linear functional on lp. And you can somehow represent this big f by means of a function g in lq. Ok. Then there is a unique function we will call g in lq. Where as usual with p and q are conjugate exponents. Ok. Such that f of f. We can represent big f in this way as the integral over e of f. Which is the test function times this function g. And we have also that there is a relation also between the norm of this big f and the norm of g. So, the norm of f of capital f as functional is equal to the norm of g as element in lq. Ok. Ok. So, for simplicity I will prove this when e is an interval. So, in the case when e for instance is not an interval but it is bounded. You can think that e has a set contained in an interval e. If e is unbounded you can split it into intervals. Ok. Ok. Just keep in mind that theorem holds for measurable set e. Ok. So, now we will see the proof under this hypothesis. Ok. So, we consider a sub-interval of e of the type. For instance, I don't know, we can think of it as 0,1. Just to fix the idea. So, we consider a sub-interval 0s where s is less or equal to 1. And we denote with as usual key of s the characteristic function of this interval. Ok. So, basically we want to proceed by step. Ok. We first, we try to test this capital f on this very elementary function key of s. Then we improve, we refine our argument. Ok. Let's define f of s by definition f of s. Ok. Ok. So, phi is a function between 0,1 and r. And now we claim that this phi is an AC. Ok. Phi is an AC. Ok. As usual, when you want to prove that the function is AC, you find a collection, a finite collection of non-overlapping intervals. So, for instance, we can denote this finite collection in this way. Take s i s i prime. We use this notation with the prime usually. So, be any finite collection of non-overlapping intervals, which have length of 0,1, which has length less than delta. Ok. Now we define a function f by means of this combining this notion and the intervals that we have just introduced. So, we define f as the sum over e of the characteristic function of s i prime minus the characteristic function of k s i time the sine of phi phi s i prime minus phi. Ok. So, we have that. Ok. So, let's compute f of f. Use this function f as this function. You have that f you use. We want to simplify this expression. So, we have that. This is by definition. Ok. f is linear. So, we can. Ok. So, basically what you can do all that. So, this by definition is phi. So, at the end you end up with this. So, we have that finally. Ok. So, now we recall our choice of this finite collection on over mapping integral. And then we have that the Lp norm as to the p is less than delta. And so, we have that. We have that sum is equal to f of f, which is less or equal than the norm of f as a functional times of p, which is less than delta 1 over p. So, basically we have that total variation of phi is less than this. So, if we take phi is in AC and taking 1 is to be less than epsilon, taking delta equal 2. Ok. So, we know that phi is in AC, we can use a previous theorem. Ok. Ok. So, by a previous result. Ok. We know that we can represent this phi in a special way. We know that there is an integrable function g. Ok. So, we have that in particular f of k of s, which is precisely phi of s, can be expressed as the integral between 0 and s of g t, where g is an integral function. So, here you can express this time characteristic function. Ok. From this we can immediately somehow generalize this. So, we know that any step function is a linear combination of characteristic functions. So, we can extend this relation to somehow more general functions. So, we know that every is a, ok, is a suitable linear combination of the type c i k o s i. And so, we have that psi is equal to the integral between 0 and 1. This is true for any, this is for any step function. Ok. Now, we want to generalize a little bit more and take abounded measurable function. Ok. So, let be abounded. Ok. If you remember, we showed that we can maybe, when we dealt with the measure theory, we showed that we can approximate this kind of function with step function. Ok. So, we saw that there is a sequence such that psi n converts to f almost everywhere in 0,1. And then we can, ok, we can use either the bounded convergence theorem or the Lebesgue convergence theorem, but it is the same. We know that since we have that f n, sorry, f minus psi n p is uniformly bounded and tends to 0 almost everywhere in e, then we can apply the bounded convergence theorem. Ok. And we can infer that they converge in lp. Ok. We have that f minus psi n tends to 0 in lp norm. Ok. Moreover, we can say more. So, we have that the functional f is bounded. Ok. We can estimate this difference. Ok. If you want, we can just proceed by step. So, we use the linearity. Ok. And then we use the definition of supremum. And we know that this goes to 0. Call it, so call this star. And moreover, we also know g times the constant c, because psi n are uniformly bounded by the same bound of f for f. Then, ok. So, by the normality convergence theorem, we have that f g is equal to the limit. So, by, you combine star and we have that, we finally have that f of f. And this is true for any bounded measurable function f. So, we need not to extend for any function f in p. Ok. We can also, from this we can also deduce a bit more. We can deduce that since f is less or equal than my previous result, the one that I stated at the beginning of the lesson, we have that this plays the role of m, if you want. We have that g is in the queue. And moreover, we can estimate the norm of g by the norm of f. Ok. So, what remains to show? So, it remains to show that f of f is equal to, for any f. Ok. Here we can, we have that f in p, can be approximated. So, we have f in p, then the random epsilon positive. There is a bounded function, bounded measurable function. Ok. Call it psi again, such that is less than epsilon. Ok. So, we know that the relation is true for this particular psi, because it is bounded. So, we know that f evaluated on psi is indeed equal to psi. And now we want to estimate this difference f of f minus this. Ok. We want to prove that this is arbitrarily small. Ok.  This is less than equal than f. We can bound this by the norm of f as function minus epsilon. Ok. This is by the other inequality. For instance, we can collect here the same quantity. We have this. Finally, what we prove is that epsilon is arbitrary. So, we prove that indeed f of f is equal to, for any f in p. And equality, this follows from a previous lem, ok, by the previous proposition. Ok. The fact that g is unique, you can do it by yourself. You assume that there are two different, and you will get a contradiction. Ok. Ok. Show you exercise, which was one of the ones in the homeworks. Ok. So, you had to prove that you have a sequence fn, which converts to a function s in measure. And you know that there is an integrable function g, such that you have any fn is bounded by g. And then you had to prove that they converge in L1, basically. Ok. So, there are many ways, actually. So, now I propose one, but two of you, so Delia and... Propose other approach, which were correct, as well. Ok. Yeah, so Delia and Andris, they propose other approach, which were correct. Ok. So, somehow here Delia were to split this domain e, which, in principle, could be unbounded, in a bounded domain, and in an unbounded part, and to deal separately in those two parts. So, you fix some epsilon. Ok.  You use a cutoff within this interval here. And you see that this converts to fn minus f, almost everywhere, as k tends to plus infinity. And then here, this point, you can use the Lebesgue convergence theorem, or the monotone convergence theorem. So, by the monotone convergence theorem. Ok. Here n is kept fixed. Ok. What is moving is this k. So, by definition of limit, we know that there exists some n such that outside this interval we have that fn minus f was less than, for instance, epsilon over 3, just 2. Eh? This is n. No. What do you expect here? What? n. And, ok, it's related with k. I call it n, but it's related with the index k. Here n is kept fixed. Ok. Ok. Now we look at the complement of this domain. And we have that. We recall that by the absolute continuity of the integral. Ok. We have that for any delta. Ok. For each n given some epsilon positive resist delta, such that for any set, which is small, set A, such that the measure of A is less than delta, we have that this integral is small as well. Ok. We can put over 3, just because then we will gather many times together. Ok. So, we call it this. Ok. So, we may assume with no loss of generality, that delta is less than epsilon over this number. And we have that. Since fn converts to f in measure, there exist sum and prime, such that the measure of the set where fn minus f is larger or equal than delta is less than delta. And this is true for any n larger delta. Ok. So, we define as A, so the set, which will play this role, as the set of fn, this set here, ok, where fn, fnvex minus fvex is larger or equal than delta. Ok. And then we combine all these three parts somehow. So, we have that. So, we want to estimate this, ok. So, we split it in three parts. Part that we encounter at the beginning, so this unbounded domain, plus intersected minus n and n, so, which is bounded set, plus the complement of. And then we have this part was less or equal than epsilon over 3 by what we call star, plus this part, ok, we are here. So, this is less than epsilon over 3 because of this, plus we have this is less than, this is AC intersected minus n, n, and this is can be bound by delta because we are outside this set. And so, you put all these things together, so, you have that epsilon over 3, plus epsilon over 3, plus delta. We assume that delta is less than epsilon over times 2. So, this comes. This is. Ah, ok. Ok, so this is by the absolute convergence of the integral, this second term here we are within A, and A is a bounded domain, is a domain which has small measure, and these are integral function. And here we are, ok, here we are outside A, but at least we know that the function here, this difference is small, ok. And then we are done. If you start from a bounded domain, probably you don't need the first part, you just need these two, ok. This is the second. You don't need to do the first step, ok. Ok, now I'd like to show you an example of a function, which is quite of a sequence, which converts in measure, but not almost everywhere. Ok, probably you already know this. Ok, for instance, we can work in this closed interval, 0, 1. And we consider, somehow we split n, integer n, with a compose n has power of 2, plus some rest. R is in between 2k. Ok, we have that. If we define this sequence of function here, it follows the characteristic function of R2 to the minus k, R plus 1 over x. Somehow you can look at it as, this is 0, 1. Has a train, which passes through 0, 1 infinitely many time, and each time you reduce the size of the development, ok. The size of the train. And so what happens is that for any x, 0, 1, there are infinitely many n, such that fn of x is equal to 1, and also infinitely many n, such that fn of x is equal to 0. So there is no, there is no point wise limit, ok. Ok, but what about the convergence in measure? Ok, this is one fact, but we have that, the fn converts in measure to 0. Ok, so we want to estimate the set that is epsilon. Ok, for instance, you can, in this case you can fix epsilon between 0 and 1. But please. Hmm? There is infinity, infinitely many values, but what if this, the whole set of infinity many values of 1. Ok, you can, you can find in them, ok. Yeah, fn of x converges to 0. In measure, ok. There is no point wise convergence, no point wise limit, ok. fn of x converges to 1. Equal to 1. Equal to 1. Equal to 1. There are infinitely many n for that fn of x is equal to 1. And 1x? Yeah, fix x and you move n. R is in between 0 and 2k, ok. So each time you decompose n in this way. Ok, you fix n and you decompose n in this way and you define fn of x in this, ok.  Like something that goes to pass through 0, 1 and go to 1 and then come back and then come back. And each time it reduces the size of the internet. So this is just to have the idea that you can formalize. But this is the way, ok. It passes to 0, 1 infinitely many times and this means that each time it reduces the size of this interval. So you cannot have point-wise convergence. But since it reduces this size, you have point-wise convergence in measure, ok. So this is what I'm going to formalize. So you have that fn minus 0. Ok, this is equal to R2 minus k. Ok, this is this and plus 1 to minus k. Ok, sorry. Ah, yes, it's larger than the time. We want to prove that it converges in measure, ok. So we want to prove that this set has a small measure. So now we have that measure of this set. It is equal, it is less equal than R2 minus k. And this, as k goes to less infinity because as m goes to infinity as k goes to less infinity. So we have that. So we have that, ok. And I want to show you another another exercise. May I erase this part? So here you have a sequence of function fn. Ok. We are within a set of finite measures, ok. We have a sequence of function fn in lp. Ok, such that we have that fn converge to f, some function f, almost everywhere in e. And we know that f also belongs to lp. Ok, we also enforce this extra hypothesis. Assume that there is a constant m positive such that this sequence of function is uniformly bounded in lp norm. This is for any n. Ok, then what we want to prove is that for any g in lq. So again we have this relation between the two. We have that a g, yeah. Ok, so this is what we would like to prove. Ok, so first of all maybe we should first answer to this question. So do you think that under this hypothesis fn converge to f in lp? In vlp norm, or not? Because in that case would be very easy, no? So is it true that under this hypothesis or not? Of course the answer is no, because otherwise would be too easy. And you can, for instance you can also fix this by an example. So take p equal to 2 and we can define e equal to 0, 1 and define fn of x as a square root of n times the characteristic function of the interval 0, 1 over n. Ok. And take f equal to 0. So we have that indeed. fn of x, fn converge to f which is equal to 0 almost everywhere in 0, 1 because you fix some x and if n is arbitrary large it step over the part where it is equal to square root of n. So this is true. Then. So what about the norm of fn is this bounded? The l2 norm, this would be sorry this is 0, 1 and ok, actually we are within this set n, 1 over 2 and this is equal to 1, right? Ok, but we don't have convergence ok, because of this now because we have that this is 0, 1 this is just to be minus 0 so this is what, this is just ok, of 1 over 2 this is just 1 over n and to the power 2 here this is n and this is equal to 1 so it doesn't go it is always equal to 1 so it cannot go to 0 ok, so we have to prove this using other arguments Is it true and you don't prove it? No, we don't prove it we prove it that this is not true by a counter example I mean, what we want to prove is that is this, ok? If under this hypothesis we have this if this would be true, this would be trivial, but this is not true because we showed it by a counter example that this is not true ok, so somehow the convergence in LP is much stronger than this ok, so we want to prove this we have to use to combine somehow the other inequality and the absolute continuity of the integral ok, so I recall you that so, bye now we have that for any epsilon positive there is this some delta positive such that for any so for any set a contained in e a small measure such that the measure of A is less than delta then the integral in particular we have that the absolute values of G raised to the power q is an integrable function so we can apply the absolute continuity of the integral to this function is less than epsilon ok, just for convenience let me take one over q here ok, now comes the theorem that maybe we we forgot the theorem of Egorov-Severini ok, we have that for any delta positive there is a subset such that measure of A is less than delta we have that fn converts to f uniformly outside this set of small measure ok, so now we can we can estimate this difference ok, so take this difference then G minus fG is less than ok, now we use this the composition here A and E minus A ok, now ok, here we use the yield inequality on both integrals ok, so how can we bound this part? so what we know is that by hypothesis we know that we know this, right? so how can we infer a similar bound for f which theorem can we use which covariance theorem which somehow so what we know is that this the fatulema ok, fatu is enough so fn converts to f almost everywhere are positive this is less or equal so you just need a bound this is less or equal then the means so by fatulema and this is uniformly bounded by this so we can continue here and say that this is so equal then 2 times M times epsilon because we saw that by the absolute continuity of the integral this is less than epsilon plus ok, so we have fn minus f in L infinity g you can bound this by the 2 norm of g on the whirl hill that's not important times the measure of a but here ok, we are within a set of finite measures so this is ok, this is bounded this is bounded because g is in the queue and this is small why? why this is small? ok ok ok ok ok, put p here ok ok, because we are interested ok here you have fn minus f in L infinity here ok, here you can bound this by 2 times so you have fn minus f in Lp is less equal than the sum of the 2 Lp norm ok, maybe it's too small is it ok? over? over A, yeah yeah ok, but if you want here what is important here you can also bound again this by the integral over E here it's enough a rough bound A is important for g ok, to make this small, this you can also bound in a kind of rough way ok, but this by Igor of Severini we know that this is small because we know that outside this set of small measures we have uniform convergence, ok so this is if you take an sufficiently large, this is would be 2m times epsilon plus epsilon ok, so you have this is fixed the measure of V minus A times 1 over B, this is finite because it's finite, it's a finite measure so if you choose epsilon sufficiently small you can make this quantity, this sum as small as you want ok, so maybe you can do just another exercise so very about absolute continuity just to conclude ok, so we have E and interval and we consider a function which is defined over I with values in R B monoton ok, assume increasing ok, but you can just to fix the idea but it's the same if u is the crazy, ok and let I is equal to V or rather maybe contained in I just to be sure ok, then we have this equivalence, then u is in A C of A B if and only if we have that the integral of the absolute values of the of the first derivative of u prime is equal to mu P minus u A ok, so since we assume that is monoton increasing we can get rid of these absolute values ok, of course interesting part is that to prove that if it is true then u is in A C because the other way it comes directly from fundamental theorem of calculus for A C function, ok so this side so if you start if u is in A C then it's straight, ok we know that the function in A C can be expressed as the indefinity integral of the integral prime ok, this is 3 ok, so let's prove the other side ok, here the idea is somehow something that we already know so we want to write u as the sum of two function in A C ok, to do this we define this function wx as the integral between A and x of u prime t in dt ok so we know that by the Lebesgue theorem that u prime is integrable so w is in A C ok, now we want to to use something more about this function so take for instance y larger than x and we want to evaluate wy minus wx this is what by definition this is the integral between x and y of u prime dt in dt and ok, now we can about u we just know that it is a monoton increasing but we can use the Lebesgue theorem and tell us that this is less or equal than u y minus ux and so we have that what we get is that ux minus wx this is a particular function is less than uy minus wy so it's increasing but the same time we have that if we evaluate on the end point a and b so at some point we have to use this of course so just evaluate this function at the end points this is by hypothesis this is equal to ub minus ua so at the end what we get is that wb minus ub is equal to wa minus ua so it's increasing but it's at the same point has the same value so it must be constant ok, so we are done of course a constant function we may see function is that ux and u has wx plus ux minus wx this is in ac because it was just defined as the definite integral of the integral function and this is in ac actually this is more than ac in this constant but in particular it is in ac so the full function is easy so we are done ok, so we can stop here


Welcome to my villains layer. Do you need a password? Around two billion passwords are stolen per year. Okay. I'm not really a villain. I'm Sarah Clark, and I'm here to help you understand the risks behind password-based authentication, how to mitigate those risks, and a couple of useful alternatives. There are three things we'd like for authentication. That it's secure, it's easy for the user, and easy for the developer. Unfortunately, this is easier said than done. Passwords are the easiest choice, but they also have problems. Weak passwords are ones that are easily guessed, often using automated tools. These include the perennial favorites, password, and 123456, but also short passwords or ones found in the dictionary. Even combinations of two or three common words are easily cracked and don't think that using numbers for letters will save you. Cracking tools know you're going to try that. Strong passwords are harder to crack, but people often forget them or use them for multiple sites. Password recovery is often an opportunity for attackers to get in the middle, and reused passwords could be cracked on one site and used in many places. Of course, if an attacker can steal your password outright, they could have an easy path into the system. In a one-year study, 81% of hacking-related breaches used weak or stolen passwords. So, how can we mitigate these problems? There are best practices, such as serving a login page, never storing or logging plain text passwords, encrypting passwords in transit, and so on. But even if you do all that, and maybe even more, you are still not done. Security is hard to get right, and compromising your site only takes a reused password and for another site to make a mistake. Doesn't matter whose fault it is. If a user's account is compromised on your site, they lose trust in your service. Many sites impose policies for passwords. These might sound like a good idea, but they often fail to get the job done. Take strong passwords. Many people substitute numbers for letters or put punctuation at the end or between words. These patterns are so predictable that password cracking tools routinely check them. Perhaps you can require your users to never reuse their password, but unless they work for you, this probably isn't going to work. We've all been bothered by sites that expire their passwords frequently. Recent research has demonstrated this actually makes sites less secure. Why? Complex passwords are hard to remember, so they're more likely to be reused, and they might be written down. And new passwords often look like the old ones with a trivial change. Ironically, using a single login service for many sites can improve security. Services such as signing with Google or signing with Facebook let users remember a single password. Central services can also track whether a login is coming from an unknown device or new location, and verify the user's identity in other ways. The other major option is multi-factor authentication. Two-factor authentication is the most common and typically involves something you know, such as a password, and something you have. A password is an example of single-factor authentication. Jane supplies her name and password to Google. It's only one factor, namely something she knows. Note that Google isn't storing the plain text password but using a hashed version. This is standard practice. Jane could switch to two-factor authentication using a one-time password. Google Authenticator is a great example of an app that generates a series of one-time passwords. That way, even if someone learned Jane's password, they wouldn't be able to log in without her password generator in hand. So how do you choose between a federated login and multi-factor authentication? A federated login using OAuth 2 is good for cases where you have a secure provider, you and your users both trust. Multi-factor authentication is especially useful when password reuse or phishing could be problems. It puts one of the key pieces out of the hands of potential attackers. This leaves us with two potential solutions, Identity Federation, and the more powerful Web Authentication API. Stay tuned and I'll show you how Identity Federation works. If you want to know about the Web Authentication API, see the Google videos from Google I-O 2018. Thanks for watching and I'll see you soon.


Everybody forced here up in 2022 flawless football hobby two box case number seven picked a team style Adam E with the Cardinals Andre Lyons for shot has the Colts Chris P. Chargers Dan M. Vikings Jets Dolphin Seahawks and Saints David M. Titans Edward P Raiders Eric W. Has the Bengals and the Bills Gregory J. Broncos go H. Jags Jason A. Niners and chiefs Jeff B. Panthers Jesse R. Falcons Jordan L. Ravens Justin B. Has the Browns miles H. Packers Nick E. Eagles Nicholas O. Rams Peyton P with Washington Robert R. Bears Robert B. Cowboys Scott R With Giants Sean M. Steelers Zufan has the Pats Van L. Bucks and Victor F. With the Texans Good luck everybody it must be some like because I think we use restream for the things because it'll give you tube and twitch notifications I'll just see if I can figure that out later next break case 8 teams on sale Falcons Panthers Bengals Packers Steelers Those teams man. Come on now Okay, let's keep it rolling here guys in teams on sale the next one. Let's get these breaks filled up Later. You got serial numbers right now Elaine is on fanatics live with flawless Probably played at some point, but I'm on that Starfield grind. I like Tekken personally I like Mortal Kombat, but I'm not good at fighting games anymore. I was younger have more time to play I was Whoa, huh? That's interesting. I like that That's very cool Kind of like all those cards. I don't like all those cards quite a bit. All right dual patch for the Giants is Daniel Jones and Eli Manning the 25 Dude second half Danny dimes last week and holy crap, dude went on 25 dual patch there triple patch. We got Barry Sanders Frank Gordon Adrian Peterson to 25 Let's see that's gonna be probably a random someone if someone has two of three then they'll get it Let's see Detroit is Andre San Francisco is Jason a and Minnesota is Dan M random at the end It can't stop us today. No T. J. Hawkins in NFL shield star swatch signatures one of one Come here, come here Sean Alexander NFL shield autograph one of one Seahawks.  He doesn't stand a chance I'm gonna call HR man Man, oh man I don't I don't know I just I'm pulling shields J's to fixated the pick any of that stuff up right now Bailey's happy out of the five nice it for the Pats at Hawkinson is from 2021 The Hawkinson's from 2021 not that it makes a huge difference of shield auto book and grads lions on the hawk That does make a difference because he would probably actually Don't know what they would I think you might have Vikings autos in this. I don't know Hey guys like the stream nice zappy. We'll make that too. Just George Pickens rookie out of 15. There we go Steelers This is an insane Yeah, and there's more But wait, there's more RIP all right people you mays sauce for 10 on the rookie debut sing We should just mag the pants to yeah, don't stop. Don't stop magging cards Pickens of 15 is worthy Yeah, Rich is over on Maddox live at Lane right now guys. We want to go bug him a bit him and Lane are ripping over That they're trying to keep up They're trying we just jump out of head Yeah, we magged all but the relics I think literally yeah, literally everything but the relics just got magged But it put oven mitts on because you imagine someone breaking an oven mitts for real though Oh my god, that'd be a nightmare. You would have so many you'd have so many PSA sixes like Crump, but she was like chrome cards. Oh, dude. I don't like thinking about this. It's it's funny, but like That's very you guys bought into a break. I was running oven mitts. You'd be like refund. Please please do not please Please stop. Don't please I'd be all over the internet and and fired and like all about 20 minutes We'd finish one case. He'll be there being out an upgrade and uprising Guys the Steelers are still up on the night on the next one.  They're on sale I've seen some breakers sleeve cards and I I'm like, dude.  We don't do that. This is cool triple patch here is Peyton Reggie winning Clark. That's pretty sick 20 for the Colts. That is a diamond guarantee for the next card I'm gonna show you 20 Manning Wayne and Clark They need to get like a six-way patch and it's just like Manning Wayne Clark Edge Harrison and This pair Garcon One-of-one on the legends black diamond Tarell Davis these look great. I wish the mag wasn't so scuffed up It looks awesome.  I was thinking of a Colts throwback six-way rally because you pulled the three way I was like gotta get edge Clark Wayne Harrison Peyton Bob Sanders Wow, what a name that guy was so good for until he got hurt.  That guy was so good Him and Peyton with a neck injuries though Bob Sanders is filthy Just didn't have the longevity. Oh, yeah eight on the jersey number for us Yeah, he was one of the last bigger hitters for sure Lucky whitehead here Garcon Garcon. Okay Marshall when was Marshall Falco cold though, that's that's right. I forget but he was he was I Cannot believe those are the four teams up in the next one. They're my skills just sold Yeah, they were like 250 off to I marked them down on 50 bucks. Thank you. Thomas Jay. Let's get you a teacher with a picket shield or something Why stop at the shields we have now when we could just hit more shields Yeah, that that happens every now and then Dan I think we hit I think I pulled one of those last year where there were like six in like encased cards And they were like really good too. There was like four encased on as it was like Rogers and Manning and like Russell Wilson Like and a couple like a low-numbered gent like it was pretty cool So that those are by design obviously have to cut the foam like it's kind of cool You see those rookie quad patches Alec Pierce to 10 for the Colts Solid break for the Colts It's a glove. I was like that a Saints. I was like, what is that it's a glove or something or like a cleat Rookie quad batch is pickings to five Steelers. Oh Yeah, Austin it. Yes Yes That's accurate. Accurate. Who said accurate. What's not a NFL player? Hatch auto Joe horn. Yo, come me get the cell phone. Let me get the cell phone for the Joe horn Was a celebration gets the flip phone flip phone celebration.  There you go Texans Yeah, every team though like at the price of like PYT has upside which which is awesome. So weird slide Legend Rookie gloves sig to 15 for the Chiefs to sky more nice he achieves Celebration was wow when I happen. I think the NFL didn't know what to do All my teachers back then were like, yeah, fine him for using a cell phone. That's right. Get him The teachers taking cell phones and stuff That's theft. That's theft Gloves sig there in the sky more nights when she's RPA lions J mode. It's one T Noir, yeah, I wish they would do like a noir football But I think they already have so many high-end football products as there is but damn I do a noir might be my favorite like basketball probably at least like hit base like high-end basketball Very nice JMO. We'll get that one magged and another Kenneth Walker to 10 rookie auto. I mean Dude Seahawks are killing it. Yeah, the innards are very good this year There's not like a lot of like at least decent autographs The checklist is a lot better I think they kind of upped a lot of like those middle tier autos are like lower tier like that mid tier at least so Every box feels alright. It feels decent at least Ruby gem is Devontae Smith 10 of 20 for the birds The war just has so many cool designs and It's you get the not not to mention you got a triple patch manning here to 15 cults very nice not to mention you have in the war the The spotlight the sneaker spotlights and then the spotlight signatures where it has like the black and white with the gold ink, dude That's where that's where it's like the best. That's what separates it in my opinion This acetate spotlights and sneaker spotlights signatures. Good Lord Very nice manning cults with two encased relics kind of kind of interesting And then we're gonna end with a well diamond guarantee first Gosh a Desmond Ritter rookie auto seven of eight for Atlanta nice hit Atlanta We've been hitting a lot of Ritter today too By last spot Atlanta every time you would have been doing pretty good right now Very nice. No patch on as a Ritter yet, but that's pretty sick seven of eight All right, we'll do a real quick recap since Why before I do that they get you guys a link here for Falcons Panthers and Packers left in the next one. Yeah, I do. I'll yeah the spotlights are so sick I need to get some I need to get like a Grand Hill Orlando magic or something like that I think the Packers just sold No, that was another someone So three six and fourteen is what we got left guys. Yeah, we are behind just FYI Do you to get some breaks filled up here? Yes real quick. We're in on that one real quick That's a triple patch of Sanders Gore and Peterson Lions Niners and Vikings. Good luck Go eight times whatever team is up top gets it one two three four five six seven and eight Vikings Vikings up top the Warren gilded on the same day, dude Dude, that would that would if that actually comes in fruition. I don't think that'll happen because panini little behinds on most things and things keep getting pushed back, but That would be an unreal dual release day. I Would lose my voice that day Jones and Manning Pierce Pickens the five sky more on the auto Joe horn Kenneth Walker the third everything else be mad. That is ridiculous Yeah, pretty much everything else or in case black diamond to one-of-one legends trail Davis for Denver Gems of Devontae Smith triple patch Manning Wayne and Clark triple patch Manning Damian Pierce on the auto Bailey zappy auto to five for New England followed by a pickens to 15 patch auto RPA here to 20 is James Williams Sauce to 10 for the Jets Ritter to eight for the Falcons Lance and young dual auto rookie Lance here. This is a 2021 card That's pretty nice. That's pretty nice And then yeah two shields back-to-back in the box as well 2021 star swatch Hawkinson and Shields say Shawn Alexander cool