Hi, this is Christian. So in this video tutorial, I'm going to walk you through how to complete this exercise Okay, so it asks us to create a class called student and the constructor is going to accept the name of the student and A list of all the test scores Okay So these are the methods that you are required to create in addition to anything you want to do But these are the minimums, right? So we have a getter. We have two getters here three getters and one setter right and here is a sample Data for example, if I have the student may enter is this this is a list of my test scores and You can stitch it is to object this way by passing the name of the student and the list of test scores Okay And then if you want to add additional scores Then you would call the add a quiz function and then pass the score to that function Internally, it's going to add this data to the existing list Okay So when you do that your test scores will grow and you're going to get a different average every time Right first. I want to just copy this and put it to the IDE. So we have some References right so first things first I'm going to maximize the screen here Create a class called students. So so class call student Okay, we're going to can create a constructor called under under in it under under for himself and Asks out to use the name and a list of scores. So I'll just call it scores Okay, notice the couple s. I mean the the plural here means it's a school list You can call scores. Sometimes you can call this school list It's whatever you do is until after you but you put plural so you know that is a list of scores, okay? And then we're going to initialize these right away. So self that name is equal to this name and Then self that scores is equal to the scores now It also say that you are a modern welcome to add in the other notes a default score value And so that you can leave it like this That is a default value the default value you can leave it out now like this if it has no name Okay, why you do that? Well, because maybe when you create a new student object like this Right You don't want to pass anything to that student class Okay, if you don't include this default values, you would see that if I do it this way It's gonna crash. Okay, you see that right here. It says I need two Arguments because I have two here right, so that's why if you include the That default values then now if I run it it should be Okay, right. No problem because these are the default value All right, so that's that and again this already instantiation, okay All righty, so we're pretty much done here for this part, but let's complete the class so we need to create a A getter or a setter or get it first get a name self We just basically return the self that name Let's say for that one We need to get a total score Okay, so we turn something a total score. Maybe we have to create a Variable called total score. So let's go up here and we can create one Okay, put zero for now and Then we need to also return a get average score Okay, so here return again Itself that AVG score maybe something like that So I'm just doing something like this first and then you can always go back and refactor. Okay, so AVG score Maybe we're here also set to zero initially. All right, and then we have to have an ad quiz method That takes one score value. So this is the setter. I put notes here These are all what's called getters Okay Get a methods. This is the setter method Four methods So we have one call ad score and We have just the new score notice again. It's a singular that means that we expect that to be just a single value in here, right, so We're going to Update the list of scores. What do we have here? We're gonna append it to that score, right? So self that scores that append the new score So we're not returning anything. So therefore that's why we call it setter. We're just setting that All right, and then now the question is how do we calculate the total score and the average score? Okay, so how do we do that? So before we Return this thing we have to calculate total score, right? So we will say a total score That means you have to get the sum of all the data into the scores list Now in Python, there is a sum function that you can pass in a list of numbers like this If you do that, you get the sum of those numbers. So we'll use that to get the total score Okay, the built-in function. Of course, you can also do your own Loop to do that as well to get the score. I mean, assuming if Python doesn't have the sum function, how do you do it? Okay, so I'll use this method self that Total score is equal to the sum of all these scores in the scores list Okay, that is pretty much it will actually self That's gorgeous. Okay. So that is the total score And then the only thing is that if I do this I had to you know, Recalculate every time when I call this function Right, so may not be the best option, but for now we'll just see that it's kind of it is working first Okay, the average score will be the same thing. I need to calculate the average How do you get the average score? Yeah, pretty simple, right? It's the average is basically the sum of all the numbers divided by the Quantity of the numbers. So if you know the sum of all this one two three Divide that by what the size of that so the length of the One two three right will give you the average All right, so we'll do that what it do a Self that average score is equal to the self made the sum of the self that scores list Divide that by the length of the self that scores Okay, that will give you the average and then we assign the average to the self average and then also we return that right back Again, it's not the most efficient Why is because every time we get a total call you have to recalculate every time and Usually, you know, you might want to do a different a different approach And I'll show you in a minute So let's say that we get that done and we're gonna create a student object So let's clear our console over here and let's run this thing Okay, so we got a student object if you type in student that get name Okay, we have no name assigned so that's okay because it was initially set to none But let's get the scores student That scores is it a scores list It's also empty because we never include any right, so it's working. We know for sure Let's add some score to this list. See if this add score actually works, right? So student as or Gonna pass in let's say a 100 score for that one and We can verify that make sure the score is actually there so we can see that it is working Let's add another one. Okay, but add a 90 add another one and 95 So now we have three scores in this list. Great. It only has some numbers to play with. Let's get the total in the average Total score Okay, you can see that zero because why we have never calculated yet So in order to get the total score we have to call the function, right? So the student that get total score and we call that function It's going to process that at the same time return the value back so now the student that score is now set updated and It should be 285 if you call that variable directly like this so we just confirmed that the function did work and We did update the total score. What will the average same idea a student that AVG score Is going to be zero But now let's go ahead and update that function call that function cost student that Get average score and It returns the average as well as updated the average score and there you go Okay, so now it's working and then what we need to do is Update this a little bit.  The only thing that you need to calculate is if you have a new set of scores If you updated your scores and the number changes then it only then should you update the scores Otherwise you should not update it. So how do you make this better? Well, you realize that when I add the score I add a new one to the score I append it to the scores list. So when that happens that you need to get the average Calculate the average and calculate the total, right? So instead of getting the average getting total, you will create additional function to do that So here would be what we call these helper functions Or helper methods. Okay, they're not called the getter or setter In a way, it's like a setter but it's calculating. So you put here you can say update You know scores or something like that. Okay And what I'm doing is you can say update average update total it doesn't matter But I'll just do one so it would do both. Okay. So in here, what do we do? We're going to do Basically copy this Okay, well, I should move that put it in here And then move this Put it in here And then you can see that now my get it and setter follows the rule of Get it and setter. I'm just returning the actual data back by update the score Okay, so when I add a new score I add that to the list right after that. I'm going to call the self that update score To update the scores. Okay. So every time we add a new score to The object it will calculate right away Okay So let's see that it this works. Okay, I'm going to go and save Run it again. So notice that it did update everything already because initially my list is zero Right, so I have no data if I do student dot You know, I get um Or just type in scores it's zero. Let's update this to include some default values. I'm just going to put here 10 Let's put 100 and then 95 and then 90. Okay three default values and let's run this again Okay, now I have some data student Scores so here is my list Now my total should still be zero zero.  So how do you update it? Well, you have to manually invoke that student dot update score first right Once you've done that then you're going to see that now the student score is now updated As well as the average Okay Get average score Okay, so good So the idea is once you invoke or create this student object Whether you have any data or not You know, you should invoke this function right away So that means inside the initial function or the constructor After I set all these values I want to go ahead and invoke the self dot update score Okay So this will only run one time. All right, just the initial time when you create the object Why do you call it woman because I might pass in some data? I might not pass anything. So you want to call it right away? And you always check to see if there is anything or not. So for example before I call it, what if it's empty like this? I don't want to keep calling every time right when we credit you can also check you say if the Lend of the score we can say if score If that is true Then go ahead and update Now notice I did not have to check the size of the length because if you check using the if statements here Scores if it's zero or empty or none or false then this will be set to You know the false value if it's not Other than that then it'll be true. So in this case, it will be false All right. So if it's not empty Then go ahead and update this if that If it's confusing you can do this if the Lend of the list Okay is greater than zero All right If it's greater than zero Go ahead and call the function. So if I do that now you see that it didn't call. How do we know it's called? print something right print Just some stars. So, you know that it's it's calling the function by the way So you see if I save it I instantiate the object Nothing gets printed Okay, nothing's printed now watch when I put one number in here I run it You see you print the stars because the length is greater than that Go ahead and update the scores right now right now my student That scores is now updated and all the things are updated my average, you know, it's already there There will be one and so forth So that's what you want to do You call it one time when you initialize it if the score is not empty, okay And then you call it one time when you add new scores to that list What if I ask you to delete some of these scores, right? If you delete it you have to update the score every time But when you do a gather you don't have to do that. I'm just returning the data Okay, so that is How you would solve this problem and so Initially it'll be blank. You can also pass in some lists here. So I put here my name is christian and then my data would be 100 100 and then 90 And I got an 80 score on the last one. Okay.  There you go So that is one of the ways how you can solve this problem. Thank you


Now, AutoLite and its 60,000 dealers and service stations present... Suspense. Tonight, transcribed, AutoLite brings you Miss Joan Crawford in... The Ten Years. A suspense play produced and directed by Anton M. Leader. Friends, are you saving up for that vacation? Well, here's a way to save while on vacation. Replace those worn-out narrow-gap spark plugs with a set of revolutionary new wide-gap AutoLite resistor spark plugs. Your motor will idle smoother. Yup, and give better performance on leaner gas mixtures. Yes, sir. He actually saved gas. What's more, AutoLite resistor spark plugs with the exclusive AutoLite built-in resistor cut down on radio and television interference. So, folks, see your AutoLite dealer and have him replace old worn-out narrow-gap spark plugs with a set of the sensational new wide-gap AutoLite resistor spark plugs. You can tell the difference in your car. Remember, you're always right with AutoLite. And also, remember to see the outstanding Suspense television show in many parts of the country every Tuesday night brought to you by AutoLite. And now, AutoLite presents Joan Crawford in a tale well-calculated to keep you in suspense. Everyone is so good to me. I like being here, but some of the others don't, I guess. Do you hear? They scream sometimes like that in the night. Maybe they scream because they remember things. But I remember things too. Especially when people come out from town to see me, to bring me things. But there's nothing. Nothing that I want. They can't bring back my sister. My beautiful sister Adele. They came today and with some they brought back memories of Adele when we were children. The night that mother died. The night we made the promise. Try anymore, Adele. I'm afraid, Clara. We're alone. We're not alone. But it's something happened to you. Nothing's going to happen to me. I'm going to take care of you. But that's what mother said. Now she's left us too. But Adele, mother didn't know that she wouldn't have left us if she could have helped.  And that whatever I do, you'll do. And that you'll never leave me. I promise. And we'll be together, always and forever. Always and forever. I promise. For years I kept that promise. Adele and I were as close as anyone could be. We had few friends, but I didn't mind as long as she was happy. But sometimes I was frightened at the way she clung to me after we were grown. I was afraid of what would happen to her in case anything ever happened to me. And then something did happen. I met Douglas Foley. Adele liked him until she realized that I'd fallen in love with him. Then she hated him in a childish, vicious way. He tried to win her over, but it was no good. And then he asked me to marry him. And I said yes. That night, after he'd gone, Adele was waiting for him in my room. Adele, you're so white. You're ill. But you promised me. But Adele, I'm not leaving you. You're going to live with us. No, it won't be the same. You were children, Adele. You promised. But we were married. And we believed that Adele would forgive us in time. But she didn't. She refused to see us and letters went unanswered. Then when we learned that my husband's new job was to take us to Europe, I first thought of Adele. If she would only go with us. But when we drove to her house, she refused even to come to the door. And we were forced to sail without her. My son, Doug, was born in Europe. And I wrote Adele a long letter telling her about him. But the letter was returned unopened. When Doug was just 10, we returned to America. I went directly from the station to Adele's house. She was working in the garden when we drove up. I was shocked at her appearance. Her hair had turned almost white and there was a strange look about her. I sent Doug to the gate to introduce himself. She looked at him in a puzzled manner. Then she saw us sitting in the car. And she turned and walked into the house. The next thing I remember was that day one month after my return home when I was put on trial for murder. For my husband's murder. Mrs. Foley, will you tell us again what happened the night of your husband's murder? My husband was working in the garden all day. When it began to grow dark, I called him in. But he insisted that he had something to finish. I called him several times after that. And then I became irritated and I gave up. I had my dinner alone and I went up to my bedroom. Then you do admit that you quarreled with him the night of the murder? We didn't quarrel. I was irritated, but I said nothing to my husband. I see. Your husband's death was caused by a deep, narrow wound in the vicinity of the heart. It is the opinion of this court that the instrument used might have been an ice pick. Mrs. Foley, have you any other ideas as to what might have inflicted this wound? No. Had your husband any enemies, Mrs. Foley? No. And so I was acquitted that day because of insufficient evidence. I thought Adele would come to see me during those awful days, but she didn't. I saw her in the courtroom, but she never looked my way. I believe it was about two months after the trial that my son and his friend Roy went on an all-day hiking trip to the beach. They were late getting back. It was almost dark when I saw Roy coming up the street. He was alone and he was running. Mrs. Foley! Mrs. Foley! Roy, where's Doug? He's down at the beach with her. With whom? Your sister. My sister? Oh, for heaven's sake, Roy, will you tell me what this is all about? Well, you see, Mrs. Foley, Doug and I went down to the beach. It seemed that Roy and Doug had forgotten to take along their drinking water, and they hadn't missed it until they'd come to a very deserted strip of the beach. We can get some water at that little house over there. Funny place for a house, isn't it? Yeah. Come on. Looks like nobody lives here. All the better. Just drink out that faucet in the yard. You won't have to ask nobody. Come on. Sure run down, ain't it? Maybe the faucet isn't working. The garden's all dead. Sure it's working, see? Someone's just plain lazy, then. Or maybe no one lives here. Sure they do. There's a mailbox. Maybe there's a name on it. Look, Mrs. Del Norris. That's Mom's sister. Yeah? Let's drop in and see her. She wouldn't even know who I was. You could tell her, couldn't you? Say, maybe she'd give us some cake or something. No, she's mad at me and Mom.  Hey, Doug.  Let's have a look around. No, she might come out. Oh, she can't hurt you, can she? Let's peek in the window. No, Roy. Look, Doug, the place is all upset. It's all dirty and everything. Let's look in the rest of the windows. There's no one around. Here's the kitchen.  Say, maybe my aunt's sick. Look, someone's coming to the window. Oh! What do you want? We wanted to see if you were all right. Go away. Don't you recognize me? No. Are you sick? No. I'm your nephew, Douglas Foley.  I'd like to help you. Go away, I said. Mother wouldn't want me to leave you here like this. Who is your mother? I told you. Don't you remember? She's your sister. I have no sister. My sister died when I was 18.  My aunt's sick. I'll climb through this window and I'll see if there's anything I can do. I'll tell you how to this house. Doug, let's both go. She doesn't want you here. She's sick. You go for my mother and hurry. If you come into this house, you'll be high. If you dare. Did you say your name is Douglas Foley? Yes, that's right. Douglas Foley is dead. Forever and ever. No, don't you see? The one who died was my mother. Douglas Foley became between two sisters. And then he died. Now, what I'm trying to tell you, my mother and Roy...  That's it. You'll have to die again. You'll have to die again. He'll have to... Oh, look. You're sick. You need help. I'm sick. Don't you want me to come in? Come in. Douglas Foley? For suspense, auto-light is bringing you Joan Crawford in Radio's Outstanding Theatre of Thrills. Suspense. Are you going Hollywood? Why the darkness? Well, Hap, you see, there were two gals having an argument. So I told them naturally you've got to replace old narrow-gap spark plugs with white-gap auto-light resistor spark plugs. Naturally. Yes, I said to the blonde, those white-gap auto-light resistor spark plugs make your engine idle smoother, give better performance on leaner gas mixtures, actually save gas. Sound? Perfectly sound. Turning to the brunette, I said auto-light resistor spark plugs have the newly developed 10,000-ohm auto-light resistor found in no other automotive-type spark plug. By the way, what were they arguing about? I don't know, but it gave me a wonderful opportunity to tell them those new 10,000-ohm exclusive auto-light resistors increase electrode life 200% and more. And it's these electrodes that carry the spark to your engine. I see, and then what happened? Redhead came along and I forgot to duck. You forgot. Here's suspense. And now, auto-light brings back to a Hollywood soundstage Miss Joan Crawford as Clara in The Ten Years by Mel Denelli. A tale well-calculated to keep you in. Suspense. You see how clearly I remember things? I remember so well the horror of that moment when Doug's little friend finished telling me how he had left Doug there along with my sister Adele. And I even remember what Roy said at the end.  Now I wish I hadn't left him there with her. I know she's your sister and all, but I saw her face when she came to the window. She looked awful, Mrs. Foley. She looked awful crazy. I followed Roy's directions and I went by foot north along the ocean. I must have walked a good mile before I came to the house. The front door was standing open. There was a lamp burning on the table. Adele. She lay on the bed. I couldn't see her very clearly by the candlelight, but I could see that she was fully dressed. Her hair was undone and it spilled down over the pillow. For a moment I thought... I thought she was dead. What do you want? Adele. What do you want? It's me, Clara. Where's Douglas? He's dead. Adele!  I don't mean my husband. I mean my son. Where is he? He was murdered with a long shot. Be still! You don't know what you're saying. Where is my son? I haven't seen him. You have. He was here. I know that. I haven't seen him. Yes, you have. Try and remember. Where is he? I don't know. Yes, you do know. What have you done to him? Was he your son? Yes, Adele. Please. I hated him. I know. Where is he, Adele? He went away. Where? Where did he go? He went to the village for a doctor. Are you telling me the truth? Yes. How long ago did he leave? I don't remember. When do you stop questioning me? Can't you see that I'm sick? I tell you he went for a doctor. Come here, Clara. After ten years. I've come to help you. I don't need your help. Adele, did Doug really go for the doctor? You think I'm loud? I don't know. But if he isn't back soon, I'm going for the police. The police?  No, I know. I'm going to take your things off, Adele. You'll be more comfortable than when the doctor comes. If he comes.  You're sick, Adele. Let me take your things off. No, no! Can't you leave me alone?  How do you know what's good for me after all these years? The heavy pain in my heart. When I'm tightly laced, I can almost bear it. All right. All right, darling. We'll leave it till the doctor comes. Will the doctor help me, Clara? Of course he will. Douglas Foley came between two sisters. Oh, Adele. He worked in the garden. Bending down low. Oh, tired, Clara. I know. Try and rest, Adele.  He was working in the garden. And I was on my way home. I saw him there, Clara. He looked the same after ten years. Because he had your strength to draw from. But I was alone. I had grown old. And he had stayed young. And then she seemed to doze off. Her breathing was so labored. And I thought, perhaps she'll rest more easily if I am dressing. And I went over to the bed. She was wearing a corset. I reached over and I began to unhook it. She started mumbling something in her sleeve. You broke your promise. Always and forever you would say. But she didn't wake up. Always.  But as I went to place it on a chair, I noticed something sticking out of the material. At first I thought it was a broken stay, but it was round. And one end was sharp. I looked closer. It was a steel knitting needle. A long steel one. And there was rust on it. Or was that brown stain rust? A dell had concealed a knitting needle. And there was proof of what I guess I'd always known. That a dell had murdered my husband. I dropped the needle to the floor. And something caught my eye. There was a hand sticking out from beneath the bed. It was white and still. It was a child's hand. I fell to my knees. I dug. Dug.  I dreamed that a dell and I were children again. And that she was laughing. And we were playing an old game of ours where we tied each other up with our bathrobe cord. And then we waited for a knight and armor to rescue us. And then I think it was the odor of kerosene that brought me to. The room was filled with it. Oh, my head was pounding. I couldn't seem to focus my eyes. I tried to raise myself to my feet, but I couldn't seem to move my arms, my legs. Suddenly I realized why. I was tied with a bathrobe cord. I was a child again. A dell and I were playing our games again. My husband and everything that had happened between a dell and me had been nothing but a bad dream of feeling of relief swept over me. Suddenly I heard footsteps. And the door creaked slowly open. And then I knew that what had happened had not been a dream. For a dell stood there in the doorway.  She wore a long dressing gown. She was barefoot. Her long hair streaming about her shoulders.   And the odor of kerosene filled the room. She didn't seem to notice me as she went past me. She threw the liquid from the bucket onto the day. A dell! No, a dell! It paid no attention to me as she left the room again. I struggled. I struggled wildly, but it was no use. Oh, I was tied securely, and then I saw a still figure on the bed. It was Doug.  He was unconscious, and there was a deep gash at the side of his head. Then a dell came back into the room. She had filled that bucket to the brim. And she walked to the bed again. A dell, untie me. Untie you, why? A dell, listen to me. This is your son, Clara. Yes, yes, a dell, untie me. He's untie me, a dell. I never know. He's only ten. He's just a boy. A dell, you're sick. Untie me and we'll go for a doctor. You want me to be well, Clara? Yes. Once again, Clara? Yes, we're friends. I want to help you. But I can't forget the ten years. I must wash those years away. Oh, forget those years. Let me help you. We must wash them away. It's gone. Your son is all of... I don't know what you're doing. Untie me, a dell. No, you see, you're sick. That's what I put into the lamps to make them burn. Remain on the bed. And you've tied me with this cord. And now you must untie me like you used to do when you left me too long and I cried. You're lying. We're not sisters and we haven't been for years. And now I'm going to punish you for lying. Just as Mother used to punish us when we were children. Then she started walking unsteadily toward me, a lighted candle in one hand, the bucket in the other, the liquid slopping over her dressing gown as she walked. Clara! You remember the time Mother washed out my mouth with soap when she caught me in a fib? That's what I'm going to do to you now. Or perhaps it would be better if I burned you. Tell him, Tommy, I promise you that I'll take Dung and we'll go away. You'll never have to see us again. No. And she kept moving toward me, holding the lightest candle close to her breast.  Adele, Adele, you're ill. You don't know what you're doing. Why? With the fully dressing gown, she'd held the candle too close. Her entire dressing gown was a mass of flames that sped swiftly to her hair. She was a blazing torch. And the order of burning filled the reaming out the door and torched the... You mustn't scream like that. I wasn't screaming. That was my sister Adele. Yes, I know. Try not to think about it, Mrs. Foley. You knew my sister was burned to death, didn't you, Mrs. Willard? Oh, she was so very beautiful. Yes, I know. Try and rest. Is there anything I can get you before I go to bed? No, thank you. Well, go to sleep then. I will. Good night. Good night and pleasant dreams. Was that my sister, Mrs. Willard? No, no, Mrs. Foley. It's one of the others. Oh. They scream because they remember things. Yes. Yes, I suppose they do. Good night. Good night. I remember things too. I remember. Promise me you'll never leave me, Claire. And that whatever I do, you'll do. I promise. Always and forever. Always and forever. I promise. Thank you, Joan Crawford, for a magnificent performance. Oh, Miss Crawford. Yes, Mr. Wilcock. AutoLight also wishes to thank you for your cooperation in their look-alike National Magazine campaign. Oh, yes. I've noticed that picture in several publications lately. You had no trouble choosing which of the two was your own picture, I suppose? Not at all. But that's because I know Joan Crawford so well. Just as you'd have no trouble choosing an AutoLight resistor spark plug. You mean because I know AutoLight resistor spark plugs so well? Well, and so do millions of car owners who know wide-gap AutoLight resistor spark plugs are made by AutoLight, which makes more than 400 products for cars, trucks, airplanes, boats. In 28 AutoLight plants from coast to coast. Yes, Suri. And AutoLight also makes complete electrical systems for many makes of America's finest cars. Batteries. Spark plugs. Generators. Starting motors. Coils. Distributors. All engineered to fit together perfectly, work together perfectly, because they're a perfect team. The lifeline of your car. So folks, don't accept electrical parts that are supposed to be as good. Remember, you're always right with AutoLight. Now here again is Miss Crawford. I want to thank Tony Leader and his wonderful cast of actors, especially Lorraine Tuttle, who played my sister, for helping me to make my appearance on Suspense so very pleasant. Like all of you, I am a great Suspense fan, and I'm looking forward to hearing next week's story. It's another gripping study in... Suspense! Miss Crawford may currently be seen in the Warner Brothers production, Flamingo Road. Tonight's Suspense play was written by Mel Dinelli, with music composed by Lucian Morawek and conducted by Lud Bluskin. The entire production was under the direction of Anton M. Leader. In the coming weeks, Suspense will present such stars as Agnes Vorhead, Ralph Edwards, and Joseph Cotton. Make it a point to listen each Thursday to Suspense, Radio's Outstanding, Theatre of Thrills. And next Thursday, same time, hear John Lund in Lunch Kit. You can buy AutoLight Resistor Spark plugs, AutoLight Stayful Batteries, AutoLight Electrical Parts at your neighborhood AutoLight dealers. Switch to AutoLight. Good night. Suspense was transcribed. Over CBS, the Columbia Broadcasting System. Stay tuned for crime photographer on WCBS, AM and FM, New York. Mmm-gut, mmm-gut Campbell's Vegetable Soup is mmm-gut. Fifteen garden vegetables and homey beef stock. Folks say it's almost a meal in itself. That's Campbell's Vegetable Soup. You are tuned to CBS.


So, ladies and gentlemen, right after the analysis area or analysis part, we are now reached to the X efficiency in a supply chain part. You have done the analysis, you have found out the market, you have taken out the cost factor analysis. You have taken out the middle way on the cost minimization or maximization.  You are going on the selected ideology or you are going on the overall ideology. Then your next important part will come after the understanding of the market. Where does the supply chain comes from? So, very much important is supply chain. Let this mind be aware that I have taken any virtual reality. As long as my supply chain will not be better, which is completely practical, which is completely tangible, this cannot be an idea. And if I am giving services, then there is also supply chain. How many towers are there? How many satellites are there? How far do I reach out? How much is my total overall market? That is again the technical parts. We do not already take services, but in the manufacturing part, for example, now you must have seen that there are book deliveries for some time. You are given a third level break, but the reach out of books has increased. People have started reading, obviously there are digital books, but if you are getting delivery online at home, then online buying has increased a lot. You must have seen that there was a time of pandemic, and suddenly your online delivery has increased, online market, online space has increased, retail has increased, but again the supply chain is mass. What are the main components in X-Efficiency in relation to supply chain? I am starting to talk about the importance of entrepreneurs, and I understand that supply chains do not pay attention. The biggest success supply chain of Taobao was if, for example, whenever I went to any market, if I scanned any shoe and saw a variant like that, I would get 100 kinds of 100 products in 100 prices in front of Taobao. I mean the shoe that I see there, the physical size of 450 and 400 Yuan, I get it in 12, 17, 18 and 22. How is this happening? It was out of stock, it was lying somewhere, I got one pair of these, one pair of these, I bought Taobao and sold it in 17 rupees. So, you must have seen that the variants have increased, the area has also increased, the stock has increased significantly from Beshmah provinces. So what is this? This is the miracle of supply chain and to understand the supply chain. Number one, make or buy. First we have to take a decision whether it is a retail or you are in online retailing or wherever you are. So you do not have to pay for butter services in recent months. You must have seen that the market has completely gone out. Not with the name but with your supply chain. In manufacturing, if I have got the managerial issues, then it is not as efficient as that. Similarly, the distribution and distributive market was also weakened. So where did the money come from? In the name of Endure. In the name of Endure, when it started coming, when it came in the name of Endure, they said should we make or buy? And what do we have to do? Do we have to order or sell? Now see, make or buy, producing or outsourcing a product, that is one choice of supply chain. Now they saw that China is making 200-300 per product per unit and I will make it in Pakistan. I am not saying that I want to buy leather in 1800-1800. I want to buy cow leather, I want to buy other leather, I want to buy grey leather, I want to buy grain leather. I want to save from IKEA, I want to buy local tending leather. So now I want to buy decimals on this.  Why not to get the supply chain, supply from there? So they came here and sold it. So this is what happened in Pakistan, they did the same thing, they started selling products from China. And what happened? Neither the tires are being made from here, nor the other things are being made. So all the supplies started coming from this place.  Whether you remember that it is very important for you to be efficient in both things. As long as I am a good product, I will not make it in the local market of my own choice. I will never try to make it so that I can produce and take satisfaction from only outsourcing. I want to give an example of this. In recent time, a jeep came in a big variant. The rest of the variants came from Japan. In the same range, the high end range, when it was imported, the import of the engine was back. So it is almost 10 years from now. The new import price has increased by 5 crores, 4 crores, 3 crores along with the duty. So the increase in the price was increasing. When the sampling started to be local, then the cost efficiency, price efficient, the interior is excellent, the optimal price is also excellent. Overall, it has increased according to the market. But when compared to the market, then the difference between the earth and the sky has started to come. So I am in the favor of the sampling, production of the maximum things. The local way of doing it, you should be very much local in every way so that your efficiency is better. If you outsource from outside, then the rest of your demographics, psychographic, and even your physical matters are not there. I mean, if I buy Nike shoes directly, and they are made on American standards, then my pair is the pair of the South East Asia. And if I look at the pair, then my curves are different, the pair of the GORE is bigger and bigger. So that shoe will definitely not go on my shoes. So this was a very big problem. But in the local market, there is no such standard. But what did they do? They started making your local variants. Then the price got justified. If you are taking a runner or a trainer of 25,000, then you should justify your physical design. Let's look at the sourcing strategy. How will the company make the sourcing strategy? The sourcing strategy is to give the long-term direction of sourcing and to help the company to achieve overall goal, especially by reducing costs, a very important factor. We have to reduce the cost. We will make the reduced cost. Your unit is reducing there because your raw material is cheaper. Like I gave you an example of shoes. But if you have shoes, then you will not get a Chinese shoe. You will also get a $150 Pakistani shoe. You will also get a $200 Pakistani shoe. You will also get a $2,200 Pakistani shoe. If you want to make something even though you are dead, then you will have to go to any sort of a hand-made shoe. Then you will have to pay about $4500 to $4,000. If you go to any other machine, then you will get $1700 to $1800 to $2,000. I am talking about a shoe. I will sell it for $13,000 or $15,000 or $18,000. Due to the difference in price, my market size will change. Now let's look at the supply strategy after reducing costs. One is an efficient supply strategy is dependent upon the supplier operations in a monopolistic or competitive environment.  You can see it in the tissue industry, in the diaper industry. You can see it in the disposable, in the glass, in the plastic. You will get this. When you start coming from China from the local market, then the competition has increased in the market. Now let's look at the contract of the livers. Contracting of the livers is also very much important in supply chain. Many contracts are very important. They are very important in the timeline. So time, cost, scope. Time, cost, scope is as important as it is everything in the organization. So supply chain is completely dependent on the factors. Time, cost, and scope. Which is, so the labor contract to supply and purchasing contract have to be the ability to have a significant impact on organization output, hence determining efficiency or effectiveness or efficiency or inefficiency within an organization. So that is much, much important in every way where the incompetency or competency is there. So competent thing must be equally translated into efficiency. So ex-efficiency, we see in the supply chain. So to modulate it, the best model is that cost, time, scope, cost, time, scope. We see standards on these things so that our supply chain is on the ex-efficiency standard. Thank you very much.


Good afternoon, everybody. I'm Tommy O'Brien, coming to you live from TFNN, one PM Eastern Time update. We got three hours left to go on the trading day and we got markets down, S&P, about 50 points off of the high this morning, reached 41.89, we're trading 41.41 right now. That's down three quarters percent. NASDAQ 100, you're down more than 1% and you are almost 200 points off of the highs we had earlier today. Markets catch a bid on some bank earnings, on some retail sales numbers. Nonetheless, you give it up in pretty quick fashion and it's not stopping just yet, folks. Dow right now off 8.10%. We were up to 34,275. Say goodbye to 34,000, 33,911. Russell off 24 points right now and we are almost 36 points off of the highs in the Russell. Russell off 24 points. That's 1.3% right now. Crude sitting there $83.82.79. You jump over to the gold contract. I want to talk about some action, man. We got some action in yields, incurrencies, commodities, gold off $42 trading at 2012. If you're ever looking to subscribe to my dad's gold report, folks, he comes up with new issues every Monday. He said some great calls in there. Gold is rocking in both directions, man. And what have we done? We've just given back the gains since Monday. $42, we talk about it, man. Friday is in the gold market. Down $42 to 2012 right now for the price of gold. You jump over to the dollar index, dollar index. There's a bid for you. Now, we just looked at, right? Gold contract back to where we were on Monday. Dollar index only at 101.72, man. We were at 102.80 on Monday. Just mammoth moves all over the place. Dollar index continuing to gain strength at 101.72. How's it all tied together? We jump over to the 10-year. How about, excuse me, that was the 30-year, the 10-year. How about still works? Almost 21 ticks to the downside. And we came in to some positive territory, man. 6 a.m. this morning, 1.15.23. We're almost a full point. Almost a full point from where we were right now. On the 10-year, at 6 a.m. this morning, folks, most traders are up looking at the market at about 6 in the morning. Okay, so you're talking about them over the 10-year now. 3.53% the yield in the 10-year. And what's the two-year doing? Taking a look. Let's check on the two-year right now. We get the two-year yield. Is up 14 basis points to 4.12%. Interesting as we commit to bank earnings. Larry is out today. He's been filling it a lot. I'm going to be covering from Mr. Penzavento this hour. We may have some action as well. Looking forward to filling in for our man Larry. We got a lot to talk about, folks. Stay tuned. I'll be coming back for the hour.


Python contributor and creator of Wallpapers. Hello everyone. I'm super excited to be here. So today I'm going to talk about Asingayo, one of the most popular library models that comes with Python 3.4. I know yesterday we already had two talks that cover the same team. But now I'm going to focus on the Asingayo library itself. I am not going to talk about tornado, twisted metrics, Jivan. So I'm going to talk how to program asynchronously, how to deal with many IOU requests in the short time with Asingayo library models. I just said that this Asingayo came with Python 3.4. And I know that most people don't use Python 3 in the real world yet. I mean yesterday I talked to some people. When I said, you still get stuck with Python 2, they all laughed at me. But bear with me because Asingayo can be used with Python 2. It's just you have to use differently. You don't use the special syntax yield form. I'm going to show you how to do that with Python 2. But before that I'm going to explain something more important than the technical how-to. It's the fundamental idea behind Asingayo. And I'm going to explain it in a different way than they did yesterday. So let me confuse you that learning Asingayo will be a good investment for you because if you attended the talk yesterday about the transfer pipelines in the Dreamworks, that's a cool software. And you can achieve the same thing with Asingayo. But first let me introduce myself. My name is Fajr Skycock. And I know by the end of this talk you wouldn't remember this name. So just call me Sky, please. Don't be shy, you can approach me. I'm a friendly person. And I live in Jakarta. I have from Jakarta to come here. So I'm very excited to be here. I work in Camp Caroline. The company that is responsible for Liputan Nam is one of the biggest news websites in Indonesia. And in my spare time I'm a regular contributor of Python Core. And I found it as a rewarding experience. But I'm not a core developer yet. So I used to contribute to Django Ruby Core. But time has become expensive for me now. And other than that, I'm a sole developer of Wallpapers. It's my first open source project that's built by Python. And it's used by many people around the world. Basically it enables you to have different wallpapers for different work spaces on Unix desktops. Back then, like many years ago, I used Genome. And I kind of envy of KDE desktop that can have different wallpapers for different work spaces. So I try to enable it on Genome by writing wallpapers. Okay, so let's get down to business. But first, if you want to contact me, you can use the first email if you want to work with me in Jakarta. Don't worry, it's a nice place. And use the second email for anything if you want to discuss the weather with me. Okay, so let's talk about the problem as in IO is designed to solve. The problem here is that IO is slow. Okay, I know everyone knows that. But the thing is, you cannot escape IO. IO is everywhere. As a Python programmer, you would have to deal with IO in one and another way. You may have to download the images from Amazon bucket. You may have to request data from database. You may have to communicate with another Python process. So IO is everywhere. Unless, of course, if you are the kind of programmers who writes an application which is purpose is to find the largest prime number under two billions, then you don't need to care about IO. The thing is, as a Python programmer, you have to deal with many IO requests in a short time. Otherwise, you will not get efficient program. So let's go to the real world applications. So this is like a basic of web crawler. So recently, I watched a YouTube video. I mean, I watched an advertisement on YouTube about a website that can help you find the cheapest price for ticket flights and hotel rooms. And they definitely use the web crawler. So I mean that people build business by writing web crawler. So here we build something similar. We create an application to get the web pages from three news websites, Spiegel, Guardian, and Lemone. And as you can see here, the line that was highlighted with blue color is an IO blocking function. It's going to get the web page and it fitfully does until it gets the web page or it gets killed by a signal or timeout or an exception. And that is the problem. As you can see here, I downloaded the web pages sequentially.  If you are an employee, you're going to get fired by writing this code. But before I'm going to explain to you how to deal with this, how to improve this code. This model is kind of a solving problem. And we would get this graph. So here the arrow represents the linear time. So the color boxes represent the time when we get the real data, when we get the real batch from the server. And so in the blue color boxes represent the time when we get the real data from the Spiegel and the yellows for Guardian and the reds for Lemone. And the gap within the color boxes represent the time when we sit idly, when we wait for the next chunk of data. So as you can see here, the server doesn't send you the web page in one block data. They send you data chunk by chunk. And between those chunks, you will have to wait. And as you can see here, we have a long gap. And those gaps represent the time we waste. I mean in business, time is money. So when you look at that gap, you can see the gap is the money that you lose. So that's why when I said that if you wrote this kind of code, you're going to lose money. So Essingayo can help you to reduce the money that you lose. But before we solve that using Essingayo, I'm going to explain to you how to solve it with trading. The reason why I'm explaining how to solve this problem with trading is because when we compare both approaches, you would understand Essingayo better and faster. And aside, there is a time when Essingayo falls short and trading can trump. If you intended the talk yesterday about the transfer of pipelines in DreamWork, there's a situation when Essingayo cannot help you, such as listing directories, getting the M-time attributes of the files. So here, when we want to solve the problem of dealing with many IO requests in a short time, so the common pattern is you create each stretch for dealing with one IO operations. So here, because we have to download the three web pages from three news websites, I mean we have to download the web pages from three news websites, so we have three IO operations. So we create three separate threads, so one thread for each website. So because this blue color box represents the thread, so we have four threads. The upper box represents the main thread. Now, if we model this kind of solving problem, we work this kind of graph. So here, as each IO operations gets its own dedicated line, so for IO operations of downloading the web page from Spiegel gets its own dedicated line. So when we get blocked while downloading the web page from Spiegel, while we are waiting the next chunk of data from Spiegel, the other IO operations can still run. They don't have to wait for us. So as you can see here, while we get blocked for the first time while downloading the next chunk of data from Spiegel, the other threads can still get the data from Guardian and add another thread for LeMonde. And now here, how we are going to solve this problem with AsyncIO. So in AsyncIO, you only need one thread. So here we have one blue box. That is the only thread you need. So here, these coroutines you see are comparable to the threads that you saw just now. So because we have the three IO operations, so the command pattern is to create three coroutines. Each coroutine is responsible for downloading the web page from one news websites. But we have something different here. There's an event loop. So here, the event loop is like an intelligent machine that runs and executes the coroutines. So in AsyncIO code, you don't execute the coroutines directly just the way you do with trading. But you have to put this coroutine inside the event loop and you start the event loop. So in this case, you can say that event loop is something like the operating system in the trading case. It's the schedule, the task between them and the schedule, the priority between them. But please don't take that energy too far because they are kind of different. So if we model this way of solving the problem, we would get this graph. So here, it's same as naive model. The AsyncIO shared, I mean, all the IO operations share one line. But we have something different here. The color boxes are intertwined to each other. So here, we get the next chunk of data from Spiegel. Then we jump to the IO presence of downloading the web page from Guardian. Then we jump to the Spiegel again. Then we jump to LeMonde, jump to the Spiegel and so on. We do it to fight the IO blocking time. So when we sense that for this IO presence, we will get blocked, which leads to another IO presence. That way, we can reduce the gap. We will still get the gap between the color boxes in AsyncIO code. It's just that we would have the shorter gaps. It means in business, we lose lesser money. So here, if you could only remember one slide from this talk, let this one be. Everything is derived from here. So let's get down to the technical detail. So the common pattern, if you are dealing with many IO requests with trading, so you create as many threats you need and you create a function that inside these functions, you are going to execute the IO blocking functions. Then you feed this function to the threats, then later you start the threats, so on. So the lines that were highlighted with green color is the line where you create the threats, and the lines that were highlighted with blue colors represents the IO blocking functions. Technically speaking, print is an IO function, but for now you can ignore it. For this sleep delay, you can see it as a representative of the IO blocking functions that you need in your daily life as a Python programmer. So it means like OS.system, or in the previous example, URL live request and the sub-process pureband, then later you communicate with these pureband objects. Anything that you're going to get an IO request and blocks, this is it. So you put this IO blocking function inside the function, then you feed to the threats. So for the technical details as an IO code, they are kind of different. So here, instead of creating a function that is going to execute the IO blocking functions, you're going to create a coroutine. Basically it's just a function that you decorate with a coroutine decorator. And inside this coroutine, you execute the IO functions with the special syntax yield from. But these yield forms are only valid if you use the async IO with Python 3.3 and Python 3.4. So it is true that Python 3.4 comes... I mean, async IO comes with Python 3.4 in the standard library. But if you use Python 3.3, you can download the async IO from third-party provider, but they don't call it the async IO anymore, they call it tulip. If you use Python 2.7, because the Python 2.7 doesn't support yield from, they change the way you interact with async IO. Later I'll show you with. You can download the async IO from the third-party provider if you use Python 2.7, but they don't call it async IO, they call it troll use. Okay, let's get back to the technical detail. So you're going to execute these IO functions inside the coroutine with the special syntax yield from. Then later, these coroutines, you convert it to the task, you wrap it to the task. Then later you run the event loop. Remember, I said everything is executed inside the event loop. Here the loop object is the event loop. So now, if you take notice, there's something different here. Here we use async IO slip, but in the previous example, we use time.slip. Some of you may ask why we don't execute time.slip inside the coroutine. Why must we use the async IO.slip? So there's two questions. Why do we need to use yield from and why do we need to use async IO.slip instead of time.slip? So I'm going to explain the later question first. Let's get back to the fundamental idea behind async IO. Remember when I showed you this graph? So in async IO code, everything happens in one thread. So it means if you're going to execute a function that is going to block, so everything is going to get blocked. Every other coroutines will get blocked and the event loop will freeze. So that's why you have to avoid the normal IO blocking function when you write the async IO code. So it means when you are going to execute write async IO code, you cannot use the normal IO blocking function anymore. So it means if you're going to solve the earlier problem, you cannot use the URL loop request, URL open to get the web page from the news websites if you are going to solve the problem with async IO code. Because it will defeat the purpose of async IO. So you need something different here. Now here we have the async IO compatible functions. This function is going to execute the IO computations and it will not block. So here it will communicate with event loop. When it sends, it will get blocked. It will tell the event loop that hey, I'm going to get blocks. Why don't you switch to your attention to some other coroutine? So for all the IO blocking function that you need in your daily life as Python programmer, async IO library modules already provided the replacements. If it doesn't, most likely the third party provider already provided it in the case of AIO HTTP. This AIO HTTP is comparable to the URL request. So the basic idea if you are going to write async IO code with async IO library modules, you execute these IO functions. Whether it's going to get the web page from the server, whether it's get the data from database, whether it's to get the results from the external process inside the coroutine. But you don't use the blocking function anymore. You use the async IO compatible function and you execute it with the spatial syntax yield from. Then you get the result and everything else is the same. So no more blocking function in your async IO code. So when you're going to execute the IO function, ask yourself, is this going to block? If this yes, find the replacement. Most likely they are already replacements. So if you're going to solve the earlier problem with async IO, here's how we do it. First you get the request object with the spatial syntax yield from. This response object is the object which you can inspect the final URL and so on. Then later you get the web page itself by calling it from the response read. This way when you download the web page and you get blocked like a five times, this yield from response read will tell the event loop to switch the tensions for like a five times. So it will not get blocked so it will intertwine with other the coroutines. So now I'm going to answer the first question, why do we need to use yield from? But let me get back to the story of yield without from and the idea behind generator. So in Python land there are two kind of functions. The first one is the function of nothing or all. You're going to get all the results or nothing at all. It's either zero or one. It's either black or white. There's no gray color. Either you get the full result or you're done. That's what we call the normal traditional IO blocking functions. Either you get nothing at all or you get the full web page. But there's another kind of function which is a little bit special. We call it generator. These functions can let you to consume a part of the result. So you don't have to consume all the results. You can consume half of the results and stop it. And you can do other things first maybe like printing hello world 500 times. Then you can resume the remaining part of the results. So here we can see that special function we call it generator that gen. All the results is one and two. But we let the color to consume a part of it. So we consume the color of this generator, consume it by calling next. And we get the part of the results one. And after that we can stop it. Or we can do other things first before we resume the other half of result by calling next again. Now remember when I told you when you write the asyncio code, you use the asyncio compatible functions. Imagine that asyncio compatible functions is divine like this. So you get some data. You get the chunk of data or you get the 10 kilobytes. Then you give this part of the results to the color. Then you get the data more, get the part of the result, you send it back. So the color can do other things between the results or between the full result of this asyncio compatible functions. So who is the color of this asyncio compatible functions? It's our coroutines. Technically speaking, the asyncio compatible function is a coroutine itself. But for now we differentiate them to make it easier for you to understand.  Now we get the part of the results by calling next. But inside this coroutine, we cannot do something useful between the part of the result. I mean, so here there's nothing I can do, there's nothing useful I can do between the part of the result, between the part of the web page. If I want to get the full web page so I can continue to do something useful. So inside the coroutines, we want to get the full result. We don't care the part of the results. But while the coroutine doesn't care the part of the results, the event loop needs it. Why does the event loop need the part of the result? Because the event loop wants to do something useful between the part of the results, between the chunk of data of the web page. Once it does something useful, it's to execute another coroutines. So that's why we get this intertwin's color boxes. This is the fundamental idea behind why we use the yield from and asyncio compatible functions. We don't send the full result, we send the results apart by part. So between this part of the results, we can do something else, like executing another coroutines that send the results apart by part itself. But it doesn't answer why we must use yield from because like now we just use yield. Now to understand why we use yield from instead of yield, you can see here this coroutines, we get this kind of boilerplate. So it's kind of wasteful of space inside our coroutine. So the non-booking functions send the part of the results in our coroutine. We pass it back to the event loop and the event loop may want to execute another coroutines. And that coroutines will consume another asyncio compatible function. That asyncio compatible function will send a part of the result of it. We have too much bureaucracy here. Our coroutines becomes obstacle of efficiency. So instead of becoming a middleman, why don't we let the non-booking function communicate directly to the event loop. So here that's why we use yield from. So I don't care about the part of the results. Why don't you communicate directly to the event loop? Once you get the full results, then tell me. Now so if we will get this graph, it will use the yield from. So no more middleman, the non-booking function can communicate directly to the event loop. Then event loop will do something useful between the part of the result. Now here is the thing. There is a time when asynchronous code cannot be met asynchronous. There is a time when asyncio cannot help you. You may have IO blocking functions that doesn't have the asyncio compatible version of it. In that case, you may execute it in the separate thread. So asyncio modules provides your convenient function to execute this IO blocking function. So it will not freeze the event loop. So here we use the IO blocking function, the URL live request, URL open, and the request object. And later we yield from the object. Then you can do something useful. So now I'm going to show you the final code of the downloader. So here, you can see it right in the back. So in the trading, for each news websites, you're going to create the separate thread. Then later you feed this function to the thread. Inside these functions, you're going to execute the traditional IO blocking function. And it will get blocked, but it's okay because it gets blocked in the thread. And that's not our concern anymore. That's operating system concern. So here we start the thread, then later we wait for them to finish. Now for the asyncio, you get this coroutine. Inside this coroutine, you execute the IO functions. This is kind of special. It will send the results part by part. But we don't care. We just want to get the full results. So that's why we use yield from. We tell the AIO HTTP request to send the part of the results to the event loop. Then once you get the full results, you go down one line. Here we need to get the full result before we can assign it to the body. But the response rate will send the results apart by part. But we don't care inside the coroutines. So we use yield from to tell the response rate. Why don't you communicate with the event loop directly? After we get the full result, then we can do something interesting with body. Something interesting such as printing to the SD out. Then you get the event loop object. This is the intelligent machine that I'm talking about. It's the one that's going to execute the coroutines. But before the coroutines gets executed, we need to convert it to the task. So here we convert it to the task, this coroutine. Once we got the task, we run the event loop to tell this event loop to execute this task. This is something like thread join. You want to wait the task to be finished. Then you close the event loop. So if we... Now, this is the client type of SINGIO code. It's like a web crawler. It's kind of interesting, but I'm going to explain to you how to write the server type of code using SINGIO. But first, why don't we run it? Because I saw a talk yesterday. They execute the code online. So here if we run it... Oh, I don't have the internet connection. Never mind, we just continue to the server. Here. Imagine that you have a process. Here we just printing the Mahatma Gandhi Squad to the SDD out, and we will simulate the IO blocking time with the sleep three seconds. So we are going to write the caching server that will get the result of the Mahatma Gandhi Squad program. So there's nothing special here. Yes, it's going to print Mahatma Gandhi Squad randomly after three seconds to the SDD out. And so for the... If we're going to solve this problem with threading, this is how we do it. So we're going... For here, I'm going to create the UNIX server with the UNIX file socket. So I'm going to create the UNIX servers that you created as a subclass of the threading mix-in and the socket UNIX stream server. Then you tell this class we're going to use this file. And there's a proxy server. In this proxy server, you can imagine it's like a protocol. So this is our IO blocking functions, the traditional IO blocking functions which will get blocked if you execute it. So here, this is the handle. Every client is going to get executed inside here. So this is the IO blocking function. Then you send the result. Now, let's simulate the server. These many clients, it just simulates like simultaneous clients... Simultaneous access to the server. So there's like four clients that's going to access the server. They want to get the Mahatma Gandhi Squad. Okay, so with threading, we can solve this problem. We don't need 12 seconds to get the whole Mahatma Gandhi Squad. We only need like 3 or 4 seconds. That's because the IO blocking functions... This IO blocking function gets executed inside a separate trap. So it's okay to execute the traditional IO blocking function inside a trap. So that's the idea behind solving many IO requests in a short time with threading. So let's take a look at how we handle this with SINGIO. And we will get something like this. First, you get the event loop. Then the event loop has convenient methods of creating many kinds of servers that you're going to need. For example, like a unique server, TCP server, datagram server. So other than the necessary details that the server needs, such as the file that you're going to use as socket, we're going to send like a protocol. This is the protocol. It's defined how you are going to have a connection with a client. So here we have this connection method. It will get executed when there's a new connection from client. And here we have this coroutine. This is the we use the yield from which execute this. SINGIO creates a process exec. Then we use yield from to get the status of the process. And this inside this connection made. Yeah, this is the coroutine. We convert this coroutine to the task. Then it will get executed when there's a client accessing our server. So this is when it gets executed. So now we have something different here, the transport. The transport is the ones that represents the IO computations. It represents our SINGIO server and the client. So with this transport, you can send, you can read. And for certain protocols such as if you are going to communicate with external process, this transport can give you the PID. But for the TCP, of course, it cannot give you the PID because this PID is specific to the process communication protocol. So here if we are going to execute it, now this is our four clients accessing the server. One, two, three. So we will not get blocked. Here the idea is if you are going to write a server using SINGIO, you create the kind of server you want to use such as Unix server or TCP server. Tell them what kind of protocol you want to use. But this is not the only way. You can send normal coroutines with except the two arguments. These two arguments represent the reader and writer. But for this case, we use the full-blown protocol. It has a connection made, the data receive, and the connection loss. But I'm not interested in the data receive and connection loss event. I'm just interested in the connection made event. So here we execute this like communicating to the external process, the process of producing the Mahatma Gandhi's quote. And we convert it to the task. Then you execute it with the server. And to handle the error case in the SINGIO, it's kind of different. In the trading, you can use the normal exception.  But inside the SINGIO, when we get the task, this is like a future. There's nothing interesting here. When we get this task object, you cannot get the results. It will get nothing useful. But this is a future. It's a promise. It will get your results once the task is finished. Then you must use callback. So this way I add a callback. This way you can check whether we get the meaningful results. If not, you can say, sorry, I cannot give you the Gandhi's quote. So this is the way how you handle the error in the SINGIO quote. So that's it. I'm thanking you for listening to me. And I want to thank one of the Python call developers, Sender Kumaran, who helped me pull out this talk. And I hope you get something useful from this talk. Thank you. Thank you, Sky. Questions? Thank you for the interesting talk. I want to check, can we add tasks while the tasks are being executed? We start with three tasks and then can we add one more while the task is running if you have the reference to the object? You mean, can I add the task while executing another task? Yes. So let's start with three tasks and then I add a couple more. Is it possible? So you mean you want to create the task while the event loop is running? Yes. Of course you can. Thank you. Is there a similar limitation with SINGIO that the loop that you started, once it stops, you cannot start it again? Well, you can restart the event loop if you stop it, but you cannot restart the event loop if you close it. So there's a stop method, there's a close method. The close method is a final. In your server example, you're using both yield and return inside a function. I'm sorry again? Yeah. In your previous example that you were using? In your previous example that you were using, you had a getOutput function which had yield from and return. I'm sorry, I didn't get it. Yeah. So I was asking, I mean, where does it return towards? Oh, you mean that it depends on the code itself. So it's kind of the same of the yield case. Just return whatever you want to return. Okay, I don't get it. But let me talk to you after this talk. Okay. One more question. Is there a context manager that monkey patches all the default functions to use the asyncIO functions? No. Okay. Thank you.


on the ground, presented by theCUBE. Here's your host, Jeff Frick. Hi, Jeff Frick here with theCUBE. We are on the ground at the Mission Bay Conference Center in downtown San Francisco at the Blockchain Conference. Blockchain is getting a lot of buzz right now. It's really kind of separating itself from Bitcoin where it was historically kind of the underpinnings of Bitcoin for a lot of new applications and it's good buzz here. We want to come up, kind of get a feel for what's going on and IBM is in the house. So that tells you something good is going on. So John Wolpert, Global Blockchain Offering Director from IBM, welcome. Thank you, thanks for having me. Absolutely, so when we started this show you're actually kicking off your keynote and I know it's such a dynamic situation. You were so taken by the prior keynote, you jumped in. So share some of the thoughts that came up about what is different about Blockchain and what we're doing now in the future versus kind of not a long history, a couple of years of the Bitcoin phenomenon. Well, would we be here without Bitcoin or Ethereum or all these existing fabrics that are out there? No way, super important stuff. It's like a Napster, would we have iTunes without Napster? Would we have Netflix without BitTorrent? No, sometimes something on the fringe gets those of us who are doing mainstream things thinking about a new pattern. And I think if that is the only thing that happens that's hugely important, right? But obviously there's more to it than that. And so we're excited to be part of it. And it feels a lot to me like the days of Java when Java wasn't an IBM thing, but we saw how important it was and we got behind it, we really got behind it. But thousands of people were working on Java at the height of it. And I was one of those guys. So it feels like those days, we're saying, hey, somebody came up with something, things don't have to be all about what we're doing inside the company. So most of the time we're looking at outside the company. And we saw this and said we have to get behind it. Well, IBM's doing a ton of stuff, obviously. We're talking a little bit before about the weather.com purchase or the weather data. Like I just recently finished the Ustream acquisition who we know that's our streaming partner will be at Spark Summit East. I know IBM's got a ton of traction behind Spark. So obviously taking a lot of, putting a lot of bets down some of these new evolving data sets as well as technologies. Yeah, open data, open source, open innovation, open nest. That's really the world we're living in. It's the world that we were discovering in the 90s. And look, IBM, we're like the original open source company, we were there at the beginning of it. We've been there helping the internet. Whenever the internet wants to evolve, we've been there helping in an open way. Not in a proprietary way, in an open way. Java, Linux, XML, blockchain. So you touched on a theme in your keynote that I did catch for you to leave about open innovation compared to open source. How do you compare and contrast those? You said that there are various different concepts. So in the early days, I was running this thing called AlphaWorks back in the 90s, which was for big companies, you have to learn open nests before you learn open source. And so before you have Linux, you have to be able to actually contemplate the idea of working openly from the very beginning with people that don't work for your company. And AlphaWorks was a way for us to do that. We opened up, we actually opened our source code for our research projects. Research, IBM, $6 billion in research a year. We opened up much of that code for anybody to use, anybody to try. And what we got for that was so much more valuable than the code. It was, hey, if you just changed this, we would use it for this. And we didn't even think of that. So it was a powerful, one of the best things I ever worked on was AlphaWorks and IBM. It was a very long run organization which now just pervades the culture. So open nests before open source. Okay, and if you extend that to open innovation, there's a guy, Henry Chesborough from Berkeley who wrote the book, Open Innovation. And in that book, we talk about how there are more smart people outside your company than there are inside your company. Even a company the size of us. And we've learned that lesson. So we said, with blockchain, do we have even a fraction of the people that the required people, does anybody have enough of the smart people required to figure this out and take it to the next level? And we said, no, it's not certainly not us, certainly not anybody else. So we all need to work together and not just by open sourcing our code base, right? That's what typically we talk about with open sources. I have a thing, I'm gonna open source it so people will be more comfortable buying it. People will be more comfortable because they can see the code, right? That's fine, there's nothing wrong with that. But there's another level of this that I think the original open source guys, Eric Raymond and all those cats in the 90s, were thinking about, which is working together to conceive of what you deliver. Right, right, well obviously the pace of innovation with all those people contributing makes open source an amazing kind of innovation as well. Yes, and actually with Bitcoin or with blockchain itself, it's such a highly networked technology that if any one organization came up with it on their own, it would not succeed in the way that if we can all say we all had a piece of the baby, we all were part of it. But it's kind of an interesting contrast though because the whole basis, the BGT is that we don't trust each other in terms of the execution of the transactions leveraging this technology, which seems like the antithesis of really this open source community that's driving the innovation on the technology piece. Just kind of an interesting story. But specifically, for IBM, for blockchain, what do you see kind of obviously, I know you guys are just getting into it, you want to be there, you want to be part of it, but what are some of the things that you guys see in the midterm, short term, that you're excited about and why IBM's making this investment in blockchain? Well again, we think it's exciting because it is, it's an evolution of the internet, right, that we started with an internet that pointed to things, right, you have a bunch of computers pointing to other computers and that was cool. Now we have a maturity of the internet that says, okay, I'm ready, hey internet, I'm here, I'm ready to evolve into something where I can handle the level of security trust or trustlessness, trust that is required to move things of value between legally separate entities. So the idea of trading valuable things over the internet at distance is, and Bitcoin is a perfect original example of that, I have a dollar bill, I give it to you, it's an amazing technology, I don't have it anymore, you have it, unless we counterfeit it, you can't duplicate it, right? Do that with ones and zeros at distance over the internet, that's really hard, right, so Bitcoin solved that problem. Extending that idea to all kinds of internet fabric level problems is what we're doing now. Right, but then now you add this whole regulatory environment, Securities and Exchange Commission, so where Bitcoin kind of played a lot was, we can do it, there's no third party, therefore there's really no accountability outside of the system itself. Fortune 500 is a different story, the global enterprise is a different story. How does regulation and kind of the existing infrastructure for regulation and compliance fit with kind of this new model of a really machine trusted non-intermediary transaction? How's that going to play out? So I'm going to not answer your question, but I'm going to use it to answer a similar question. Okay. So you've been on there before. So you're talking about regulation, and I don't have a good answer on that, we don't have a view on cryptocurrency as opposed to any other kind of digital currency, that's for others to worry about. What we do have a view on is the notion of a world where the rules that we write about things like regulation, taxes, Dodd-Frank. If Dodd-Frank, I think everybody that's in the field today that I've spoken to in finance believes that if we had a blockchain fabric in the internet when Dodd-Frank happened, right, and after 2008, we would have solved the problem, we would have dealt with it on the blockchain. We would have written the rules into immutable code on the blockchain, and we would have been transacting and reporting in a singleton, in a single ledger or a unified way where it would have been very easy for the regulator to audit and know that compliance was happening without putting an army of compliance people into every single bank. Yeah, that's a whole other story about people and people gaming the system versus the compliance versus the technology, and there's a whole lot of funny business going on there. That's right, the blockchain technology is a more elegant pattern to solve that kind of problem. Right, and so from the outside looking in, as we look at IBM specifically and kind of the blockchain movement generally, what should we be looking for over the next three months, six months, nine months, when we come back a year from now to this show as indicators of adoption success, movement to make blockchain more kind of, I don't know, mainstream, that might be too big of a term, but more of a mainstream type of technology in enterprise solutions delivery and really within the IBM portfolio. Well, this is the year I think that blockchain starts becoming real for business and when the Linux Foundation project starts to deliver its code out to the world and we can start all putting pull requests and writing code to it and being part of the community that's helping evolve that, I think at that point we were going to see a massive acceleration because of the extensibility of the way they're building that technology and how we're all working on it together. I think we're going to see it an acceleration when that code drops later this year. So that's, you say nine months to 12 months from now, we're going to be talking about that piece, that fabric that we're going to start writing into the internet. And what application space or solution space, vertical space do you see as the next great opportunity after fintech? I mean, fintech's obviously where there's a lot of action comes directly off the Bitcoin. What's the next one do you think where you're going to see early adopters just drop dead, dumb value proposition within other verticals? Well, clearly we all talk about IoT. We talk about trade, trade finance, trade settlement. All of these things are, of course that's still finance but I like to think of it as you and I are trading cookies and donuts and I have a rule that says if you give me four donuts within 15 days I'll give you four cookies but after that it's only three cookies, right? That's a business rule. That's an agreement, a contract between you and me. How many of those are there out in the world for every kind of thing? And if I can make that agreement permanent, illegible, written in Sharpie on the internet, right? In a way the blockchain is the internet's Sharpie. It's a permanent marker for the internet. And I can say neither of us can change that rule until we both decide. And we can be assured of that. Once I have that, I can do every kind of thing like that as long as I can do it with confidentiality, with privacy, with security, and with identity. And these are the things that we're working on in the Linux Foundation Hyperledger project. Right, awesome. Well, John, thanks for stopping by. John Wolpert from IBM. Hopefully we'll see you in Vegas in a couple of weeks. I'm Jeff Frick with theCUBE. We are here at the Blockchain Conference. Thanks for watching.