Welcome everyone. Let's start. We might need some more time so we may try to visit as much as possible. This is generally very good for the workshop and the conversation. We just got this activity so I will try this visit. So giving you the brief. So this should be the outline for the session. So I will go through the environment which I am using for the demonstration. Then we will again go back to the concepts of Trinity and Biredi. I am sure this is a lot to do but this has already been practiced on the server side most often. Then we will take one domain problem that would be from the real world. It would be the actual problem which we will start coding. Then we will try to come up with the high level stories. And we will start one story by story in the demonstration. And then there will be some slots for the sessions. So the main goal is not to achieve the domain problem which we are considering. The main goal is to understand how we can write clean and testable code in JavaScript using the Trinity and Biredi concepts. So I will come back to the development environment once we go through these couple of slides quickly. So the concepts, all those it is a refactoring philosophy that mostly uses continuity. So when you start new feature or improvements, you write a test first. Make sure it is spinning. That is where we know it is spinning for the right reason. Connect it right to production code to pass that test. And see if there are any improvements. The aspects that this practice has, it will always force your design to keep it simple. And you avoid any wastage that you will be coding upfront. That is the active principle. And it is very important. Whenever you do unit testing, there might not be surrounding modules present. So you need to take it at that time. The benefits, design becomes more clearer, clearer. You always get the testable code. And the focus is only on what is important. So this will keep you focused on what you need to implement. And it will not distract with the other features, whatever coming down the line. Let us jump to the Biredi. By the way, Biredi is already established. Well, it is just an extension. But inside the unit was more depth-centric. Where the Biredi is more driven by the business or business value. So it's like, okay, the problem with unit testing was from where to start. What's the starting point? And Biredi answers that. So it's like, okay, let's take one behavior, one feature at a time. Code that first. And once that feature is coded, then that will drive your unit. Some of the aspects, while giving the name for the particular test, it will make the sentence. And that sentence should be making sense to the stakeholder business, guys. So we are thinking from the customer user perspective. Benefits, again, it could be clear understanding about the software behavior. So that will answer your question like, why should I create that particular code? But that's the behavior we want to support. And that's the need of that particular code. It will help you to give the starting points. And it encourages more collaboration between the stakeholders, BAS, US, clusters, all. So all are on the same page. Let's support this further exercise. We'll be using domain problem, which is Hitmap. Which is commonly used in the financial sectors. But it's just the concept of representing the data. So it's not limited to the financial can use anywhere. To quickly give you the demonstration or the explain the concept of Hitmap. If I show this representation taken from one of the real websites, can you guess what are the top four gainers from this representation? So it's not important who are the four gainers, the process that you need. So actually you've got each functional asset wise, instrument wise. And you compare who has the highest percent change. The thing is, whenever we want to represent some of the things very exciting way, if we make use of some visual aspect, it will have much better subjects. Try to solve same question from this representation. Where the green says it's positive, where it's negative. And there are shades. So the darker the shade, the more the changes. So if I ask you the same question, what are the four gainers from this representation? You're probably able to answer in a maybe taking half time. So that's the Hitmap. So it is a pictorical representation of data. And the change or the value we want to depict is depicted in the shade of the color. And that's what we want to achieve in this exercise. And this is a real-time application or real-time example where the data will push from the server. So whenever in the exchange there is a change in the price for the particular instrument, that will be pushed to the client. And the Hitmap will be updated in real-time. There are some animations to show the particular instrument's price it changed. So it's a bouncing effect. Let's see if we are able to crack all the three stories, we'll be able to see the bouncing effect as well. This is another version of Hitmap which is taken from my real project. So let's quickly identify stories which will run throughout the exercise. In any cases, what could be the stories if we understood the requirements clearly. The third rule for the stories, it has to be marketable. When I say it has to be marketable, it means once a developer done with the story, once development, it has to be a showcaseable. It means it should have some value that customer can see in that. So it has to be always a customer focused. So it has to be marketable. Okay, let's... I have broken down the requirement of the stories. So first story is, as a trader, and this is we are developing for, let's say retail, where retail users like us where we'll go visit the site and see the Hitmap. So as a trader, when I load the Hitmap application, then I want to see the instruments. So that I'll see, I'll get the picture of the market. I'll see all the instruments together, the benefit. Okay, so yeah, that's a nice way to start. Just getting all the instrument details, snapshot and showing on the screen. Second story is, as a trader, I want to see price change updating in real time. So on that, next story we'll add the... We'll start to listen, update messages from the server and we update the change on the Hitmap. And the third story is, as a trader, I should be able to see instrument performance visually. So whatever change we are getting, we'll convert that into the color code and we'll apply that color code to the instrument type. And that's the third story and the benefit is so that the trader will get better overview of the market very quickly. Okay, so this is the story one in more detail. So this scenario is, when a trader starts the application, you will see the instrument with details, instrument symbol, name and price percentage. So now let's jump to the eclipse. We start the... I'm afraid I may not be able to increase the font for the script explorer. So let's go back to the slide which was the environment which we skipped. So I'm using the eclipse ID for JavaScript web developers. I have pre-installed the JT plugin. It's available in Marketplace. It's run JT and plugin. For this exercise, the focus is on front-end development. So we'll be not focusing more on backend side so that I got the ready backend stuff which is called streamer.jar which I have started on 8081. The backend is the implementation of web socket. So that I'll receive the push update methods from the server. Okay, let's go back to the eclipse. Now for convenience, I moved all the necessary folders in web app so that I can easily map my application context to web app. As you notice, the source folder is empty and that's what we want to populate using the test. So I got the couple of infrastructure ready. Inside the test, you will see acceptance integration unit. So acceptance test will contain all the behavior related test, acceptance test. Now there are various approaches of acceptance test. The approach that I'll be using here is that we'll skip the UI layer and the backend layer purposefully. And I'm able to do that because there are lots of exciting frameworks. One of them is knockout. So knockout say if you cooperate your model properly, don't worry about UI. It wouldn't be reflected accordingly. But we can't rely on wiring so that's why we need to write the integration test as well. And of course unit test which would be evolving the technical design mode in more detail. So inside the acceptance test, I got sample test written. This is the very simple test written in Jasmine. So describe the first line is the test suite, the name of the test suite. So it's a let's say Jasmine. Each test starts with a keyword with function. And the first parameter is the description or the name, the sentence of your test. It doesn't give you the mechanism of given, when, then, log. But for starting it's very helpful. But as you mature with or understand it more clearly, you'll see that's unnecessary. So this is some variable I have set. Then this is the matcher or verification. Expect your code to be a lot simpler. How to run it? So I already got the infrastructure in my Eclipse. So inside libraries, I got the Jasmine code. The easiest way to get Jasmine integrated in your workspace is clone the Jasmine project from GitHub. And just paste the dependencies here. It also gives you a runner. So I have just copy paste the runner as it is. It has created two sections. In the specs section, we'll be adding the target test. And in the source code, we'll be adding the production code files. To run it, it's very easy. Just open this into the web browser. And it would say once spread is ready. So that's the environment. That's the Jasmine infrastructure we've got. We'll be using that. So let's, without wasting too much time, let's jump to the first test. So under Hitmap, I'm creating a new file. Let's say HitmapSpec. I'll copy the sample file. Save some time. I have also got some of the cheat code present. So that for the production code, we might do some copy paste to save some time. So let's rename the test. Let's say HitmapSpecs. I don't know what would be here. So the first story says it displays instruments on application load. So that's my first scenario in actual. So it displays all the instruments with basic details when application loads. So whenever we say TDD or PDD, it's not, or when we follow the agile practices, it's not that we don't need design upgrade. We just said that we don't need design in detail upgrade. It's very good idea to get the high level design with the Y4 solids. See if we can come up with the high level design for story. So this would be the very simple architecture for my first story one. So we've got the application here, which will be talking to the streamer engine, which is already exist. We know the contracts, which will supply some data. We need to populate models somewhere in the application. So that whenever I do an awkward binding with that model, my newer would be reflected accordingly. So that's setting fair enough. That's the good starting point. So from this description, I know the when, right? So when application loads, we want to do something. So we got the trigger part. So I said when application loads, do something. For simplicity, I'm just making these sections. Now, I'm getting any hint apart from this. Any ideas? So we got one given, which is we need to construct the application. So, okay, I have created the, that's fair enough. Now, here are response from server, right? So that would be my verification. Now with whenever you do a unit testing or behavior testing, it's very important to control the output, to get to control the response. Now it's very tricky to get your all the test running when the application or the backend is not returning the concrete or the predefined response. If it's changing continuously, it's very tough to pass the test. So what I need is, I need some response that in real-time streamer engine or the backend would be returning. So I got some of the cheat codes with me that has the message already defined. Maybe at this stage, we can say, okay, it's not here with the first architecture. It's just the application, I don't know how the stuff will work. Okay, it's nice idea to hit the whiteboard again and do a bit more detailed discussion there. So let's go into the more detail. This is how there would be some evolution to the earlier design. So we know the contacts with the streamer engine will be sending slash instrument request to the streamer engine and that would be returning as a snapshot message. So when I say snapshot, it's the static data at that point. So whatever change at that point, and then there will be update message, that's the update, change data. Okay, so it's like an immediate snapshot message. So why do I need a channel? We need a way where we can short-circuit the integration layer. So then whatever this response we want, we have more control over that. So that's why channel is a very nice idea because that's give you flexibility to connect to the multiple packets based on the new. Okay, then we already got the application. Now we want to populate some model. So it's written in all the instruments. So it's kind of collections. So I need some container and that's where we got the instrument container. So the instrument, so we'll populate the instrument container and there will be some binding and that will take care of the UI. Okay, so this is giving much better clarity now. If we need a message, okay, we need that application. I need, I also need some instrument container model. Okay, so I create those variables with click. If you have any question at any time, please shout. We might use some of the time from the question and suggestion. It's very tough for in 30 minutes to cover such type of demonstration, but let's try. Because here we might not be using real because we want the stuff work. Okay, now I think we got the given part verification. Generally, we do a verification first. So what I'm expecting here is, I'm expecting my instrument container which is holding collection of instruments should populate equal to the snapshot message I got. So I'll say, I just traverse down this object. I'll get the, so this message is written in array and I'll say 0th element. So whatever coming from the packet, my model should be equal to that particular object. And similarly for second instrument as well. This is how my first acceptance looks like. So once, when application is loaded, you have the instrument container and the channel defined. Then I want my model to be populated with the business, with the instruments that's coming from the server. Okay, if I run this test, I'm going to complain about the, okay, we need to create those classes. Now I'll quickly switch over to another workspace where I'll show how this will trigger or how this will focus to, or how this could be a starting point to write the unit test. Now this will, this will ask us to, okay, define the application function class. Then write the load function. Now we will not be writing anything in load unless we write the test first. Okay, now I may not be able to code everything. Let me quickly switch back to the workspace where I have this domain is solved in story-wide and we quickly go over how it would have been evolved. Maybe I can switch the workspace. Okay, so go through the story one. So let's say if we have this similar acceptance test which we just got here, we increase the font size to larger. Yeah, so display all the instruments on application load. Okay, we got that. Then when application loads, then we created the application which containing instrument container and WebSocket channel. So here we are using WebSocket channel for test and these are the my associated. Now I should be seeing this test failing in the other workspace. Now this will evolve me to write the application class. So before writing load, I would have written the unit test. So the first unit of the particular load is request instrument snapshot on load. So whenever there is a load, then I'm expecting a same request over the WebSocket channel. And how do you mock in Jasmine? This is how you mock. So there are two ways. One is you create your object. The class is already defined, function is already defined. Then spy on any method, any function that you are interested within that object. And then you can verify assert in the verification section where particular interaction has been made or not. The other way is you can say Jasmine not create spy. And you can, this is just the name to refer inside the failure statements. So this is how on the fly you can create a spy object. And you can say, okay, then you can create a function and you can spy that particular function as well. So I would have done load. Then once the application is loaded, then we want, now it's a asking. So one thing, so the application loads job is just to make a request, snapshot request. It would be asking, so we need some listener there. So it says, it registers listener on the channel as well. So whenever there is a response, it will give the callback to the listener. And then another responsibility of this application would be whenever there is an on snapshot callback, whenever message comes from the packet, then add each invoke this interaction. So ask instrument container to add those instruments. Anil, we have to do a Qo session right now. Yes, two minutes. Okay, so this is how the test looks like for the application and then the my code evolves. So the idea is not to jump to the production code immediately. Whatever you requirement is from the technical perspective or the business perspective put that into the code first and then add production code. The benefit is you will find very clean code maintainable and if you say, I'll write production code, I'll write unit test later on. But believe me, it's very tough to write unit test after that because then no collaboration objects are separated properly. Doing the state-based testing is painful because your test grows lots of lines. And by doing this once it gives you, it's involved in design. So it's very flexible based on the requirement we can in the design. So let's see running the test. Now you can run all the test for this particular story. And Jasmine got all the support so you can easily integrate in Eclipse. You don't need to switch between two windows. It's one ID. And also it calls the Maven plugin so that you can put into the your build as well. I'm sorry, we can't see the application running on the browser. It was optimistic to cover all the stories because it takes quite a long time. I generally prefer this kind of in the workshop. So let's quickly go over the remaining PPDs if those make any sense. So story two would have evolved further design. Then story three would be another entity's collaboration. And this would have been driven all by test, unit test. So questions I need to wrap up, sorry. So when you spy on it just intercepts those methods also, right? Yeah, only those functions. So it's not a mocking library. It actually intercepts run-type messages. Yeah. And there are quite more metro in that sense because we suppose we want to spy on particular function but we also want actual execution. So you can spy on say, okay, spy on particular method and follow through. So it will execute the actual code as well where in the below we can verify whether the particular interaction has been made and if there is something test requires to be apart from the actual execution, we can achieve that as well. It's very unlikely but it has that support. What do you mean by that? What is the clean way to tear down? It has a before each and after each method. Jasmine got the support like set up and tear down. So we can see the before each here. Similarly there is a tear down after each block which is executed after each test. Jasmine got some function as well to clear any spy on objects. So that it clears everything for the next test. Here your server side application is what, Java or how the server side written it? It's a Java where it is embedded. So here Jasmine will be able to help you test most of your client side JavaScript except for the last leg of your JavaScript which actually makes the communication calls it would be hard to test that. Is that correct? Or will it be able to test against the actual HTTP request that go over the wire? So we can do the actual testing. So we can actually put the real channel. So if we go back through the this slide so this could be an actual channel and Jasmine is actually injecting the actual channel. That's very well possible in scenario where we know what that engine is written in. If that is written in finite set of instruments really fine. That's fine, we can adopt that output. But if it's a real engine and we don't know which instruments it will return those might be a flexibility in the sense like change or some of the data may not be same, which each time then I prefer it's a good idea client side because it's more faster to run and easy to maintain than they are looking at the package side. But yeah both are available. Any more questions? How to write that S? S is for asynchronous request. I mean what I'm placing most of the time because I use the Jasmine or Q unit. The second block as you could before false. In that case, how can we halt? But yeah in whatever applications I have worked whenever there is a sync we separate out into the two things two blocks. And we it was the unit test which was the doing the first part. So when you make a request though it's a we have to use the callback. Yeah, so callback. So you test the callback separate out and then you just test the mechanism of whether you are properly wiring your callback or not. So that's the one way which we have used. And apart from web sockets which other protocols you can spy on? We can spy on any function. There is no I mean if I want to create a channel to simulate a REST API behavior. Okay. And now I want to use that channel. Jasmine will be able to support. Yeah, I mean independent of any technology so this is just a channel to see the actual application running that's for the reason using the web sockets. But you can use any technology so you can use node.js whatever it doesn't matter for Jasmine. It's just the one integration there. Okay. Thank you guys.


This is the Management Report for the year 1989, fiscal year 1989, and this is something that Joe, of course, has been instrumental in working on Jerry Rizzo, the Associate Director for Management and also Chief Financial Officer. This is a little out of the masses, at least for 89. Remember when we started 6, 7 years ago, and this whole program was initiated, all financial accounting systems are going in this year, all the personnel and federal systems, all the productivity programs, the whole thing is going to be implemented in place as you are leaving the government. This whole Reform 88 project, when we call it Reform 88, there is a good reason for it, and that is that Ronald Reagan leaves that what he's going to do is put in a better government. Well, it's all that. And then we are going to come in with the report to you in August on what guidance that you're going to give in the future, on the government in the future. And so we'll have it for you in August. You'll have three or four months to take a look at it and then decide the Reagan legacy and how you may apply in the year 2000. Mr. President, as we've talked before, this is the kind of legacy that's very difficult for a successor to mess up. I mean, if you've got the right kind of management in place and you have a culture there that is committed to productivity improvements and not being wasteful of the taxpayers' money, it takes a long time to change that culture. By the way, Mr. President, remember the IGs that you put together? They just finished up this last report to you. $110 billion saved. Saved already? No, no, it's already done. By the time that you leave, it will be about $125 billion. That's a natural idea. Well, listen, thank you very much. Thank you all. That is the end part of OMB, and we're very proud of pushing that very hard. This ought to be something that our candidates ought to know about in the coming election, too. He started it. And you give us support when you need it. Thank you, Mr. President. All right, well, thank you. See you now. I'm glad to see you. I appreciate you having us in here today. Mr. President, great pleasure meeting you, sir. Good to see you. Thank you. Mr. Sherman and Greg. How do you do, sir? Hello there. See you. Mr. John Poston. Mr. President, great to meet you. Mr. George Hixon. Mr. President, how are you? Mr. William Spencer. Hello, Mr. President. My cellmate, Rustin, sends his best. Mr. Richard Carlsberg. Greetings from the great chair. Well. Mr. Richard Barth. How do you do, sir? Mr. Howard Pollock. Hi, Mr. President. First Republican Congressman for Alaska. Well, I'm just great to see you. Good to see you. Mr. Lowell, there. Mr. President. Good to see you. I understand that 100 years you're on today. Yes, sir. I'm just trying to deal with these men that made me look this way. I guess I'd better give you some advice. Don't play with me. Can't make up a better place. Did that look straight? Yeah. We need to close in more. Yeah, the picture. Yeah, you bet. Let's just think about how old all these people looked in that way. Thank you, sir. Let me express my thanks, not only myself, but for everybody in this country, for all that you do to preserve the great duty to make this. We appreciate you taking it. I know this isn't the only thing you've got to do today. But I do appreciate you taking the time to do it. We've got two or three things we want to leave with you on this particular occasion. It's kidding. I'm a surgeon and one of those things go off. I always think I'm being paid. I don't mind. I'd like to give you this. This is our centennial print. And Bob Kuhn, one of our members, did this for us. And this is a pretty special one, I think. And of course, the five of the representatives. I guess you probably know that the reason Rosewood started this whole organization a hundred years ago was because that group recognized the commercial killing of Big Game and the near loss of Yellowstone Park is what got him going. He would have developed the whole National Park System, the National Wildlife Refuge System, and all that. And this is a history of it. And this is the American Truth Day of Wildlife. It's really a history of the club. That's great. Now this, I know you've got a lot of time in Washington. You probably don't know that. I'm a doctor. I was surgeon in Houston and I do a lot of medical television. This has to do with the Bowman Crockett Centennial Project. Much to the efforts of that man right next to you, we bought a 6,000 acre ranch just south of Glacier National Park. We're running into cattle ranch, but we're also funding a chair of Wildlife Research at the University of Montana. And we're endowing that research because what our goal is, you know, man's here. So if we've got to help and man's got needs, but so do I, we're going to try and deal with those delicate issues that just can't, others won't be able to. But the trouble with this is it's got a lot of mail.  Yeah, we'd appreciate your confirmation, too. I really don't have anything much to do today except to thought maybe my life's in souvenirs. These are key rings with the great seal. I appreciate that, sir. Thank you very much. Should have a, and particularly as a fitting one, there should be a souvenir for this particular group in this particular place. Because not only did Teddy do that, but played a hand in this very office. There's never served in this office. It didn't exist, but this is kind of a copy of a room that's up in the residential part of the White House there that used to be in the old days in the President's office. Because the White House was both executive office building and residence until one day, Mrs. Teddy Roosevelt said to her husband, if I'm going to raise six kids in this place, you're going to get your people out of here. So it's the best wing in this office all along. He never got to serve in this room. Mr. President, one other thing that we could not produce for you today, though it is, you know, it's, if you were my patient, you wouldn't like this.   But as a commemorative issue of this whole Centennial celebration, we've had a Mr. Schreiber, Robert Schreiber, who's one of the top wildlife artists. Well, he's canned to Jackson, and you've got two of Harry Jackson's. Well, I know he knows about Harry. Well, only Harry is a good buddy of mine, too. I'm not going to get you sorry to me. I won't tell you where he called me at Cody, but he woke me up early in the morning. And we have had this statue of Roosevelt Commission bronze, and there will be a hundred.  And put it in the Roosevelt room. And put it back in Buckskins and his old floppy hat. Well, we've got a rant down there in the Santa Inez Mountains that was quite a chunk of nature. We're keeping it that way. Some people are not so happy about that. I remember when we first were there with Secret Service, and up on a hill looking down where they cover a lot of territory, they set another post and a little camp chair up there where the man on duty would come and sit there, keep everybody's one in mind, and that one day he came down and his eyes were rather hard. He didn't know whether what he'd seen was correct or not. He'd been sitting up there in the chair in a mountain line and strolling by. I think you're sad. I'm glad you're strolling by. That's a very good option. He didn't ask for identification. Thank you. We appreciate so much, Mr. President. We're really proud of you. Thank you. I want to have you back on the rancheroes riding one of these days. I know I'll look at both of that. Thank you, sir. Thanks for your time. You know, Park Myers, he's the old President of the Rancheroes. He invited me to go this year. I belong to the spin-off in Texas. Good to see you. Thank you again for your time. President Ambassador, Mrs. Mastiel? Yes, hi. Let's put this in you again. I'm not sure it do. Hello. Nice to see you. Are you stored health? No. You look well. I sure do. Except I'm having a little sniffle thing here. Oh, well, that's the air. Well, listen, I think, it doesn't seem like a suitable size pin for 50 years of service, but that's what the government does anyway. This is 50 years of bureaucracy, Mr. President. Thank you. I prefer to think of office service. Well, thank you very much. Can't do anything about time. I want to event you. Thank you very much for doing the rest of your day. Now you do it. Say you're going to kill him. I sure will. Here's a little present for you. Don't drop it, it's glass. So I carry it. When he gets walking and so forth. Your support and encouragement. Thank you for these precious gifts and thank you for the opportunity, the respect and the honor to meet with you on this occasion. You're pretty busy. Not going to take any of your time. Thank you so long and thank you again. Give our best to Nancy. I sure will. Bless you.


Hello and welcome to the session. In this session we will discuss a question which says that find the length of the part intercepted by the circle x square plus y square is equal to 25 on the line 2x minus y plus 5 is equal to 0. Now before starting the solution of this question we should know some results. Now the standard form of the equation of circle h whole square plus y minus k whole square is equal to r square where the variance of center k and variance of the circle is r. y plus b y plus c is equal to 0 and the point p x1 y1 the distance of point p from the given line that is this line is given by mod of a x1 plus b y1 plus c whole upon square root of a square plus b square. Now these results will work out as a key idea for solving out this question. And now we will start with the solution. Now the equation of the circle is given to us So given the equation of the circle is x square plus y square is equal to 25 and let us name this as 1. Now this is the standard form of the equation of circle in which the coordinates of center are hk. Now comparing this equation with the standard form of the equation of circle here coordinates of center c of the circle which is given by equation number 1 r00. Now also in this equation r represents the variance of the circle. Now form 1 we have this y square is equal to 25 which implies x square plus y square is equal to 5 square. Therefore radius which is given by equation number 1 is the equation of the line is given to us also given the equation of minus y plus 5 is equal to 0. Now this is the circle with center c00 and this is the line minus y plus 5 is equal to 0 which is intersecting this circle. Now let us take these points where the line is intersecting the circle as a is perpendicular y plus 5 is equal to 0 from the 0 0 which is cd where we use this formula. cd will be equal to mod of a x1 plus by 1 plus c whole upon square root of a square plus b square where this line represents a x plus by plus c is equal to 0 is equal to mod of 2 into 0 minus 0 plus 5 square root of a square which is 2 square plus b square which is minus 1 square which is equal to mod of 5 over square root of 4 plus 1 which further gives cd is equal to root 5 units. Now in a right angle triangle c square is equal to ad square plus cd square this is the radius which is equal to 5 cd is equal to root 5 all these values here this implies 5 square is equal to ad square plus root 5 ad square is equal to 25 is equal to 22 square root of 20 which is equal to 2 root 5 this implies ad is equal to 2 root 5 units equal to ad from the center of the circle ad is equal to db also ad can be written as ad plus db further this implies ad is equal to ad plus db is equal to ad so here db can be replaced by ad which further implies ad is equal to 2 into ad now we have ad is equal to 2 root 5 units value here ad is equal to 3 into 3 root 5 which is equal to 4 root 5 units wide length ad is equal to 4 root 5 units enough for a given question and that's all I have enjoyed the session


Are we not more than an odd mixture of stardust in words? It is from dust we were formed and it is to dust we shall return. The in-between is full of words, some spoken, some thought, and many forgotten. There must be something more. Perhaps the purpose of this life is to become flesh, to become fully human. This is the real riddle of this thing we call incarnation, the absurd mystery revealed in the life of the Nazarene. Incarnation, this flesh becoming, is more than a theological concept spoken of with grand words and in lofty tones. It is a messy work, a beautiful, murky, lived reality of blood, water, and bodily fluids. This is where we find life. The question is, do I have the courage to become flesh? And in so doing acknowledge the value of the life that is in front of me, my own wonderful mess, as well as the magnificence of the one standing, sitting, kneeling, lying with me. Through the incarnation we have been freed, freed to be present in our skin and with one another, freed to be so much more than a collection of dust and words, freed to become flesh.


Selamat pagi, semua. Hari ini, pekerjaan selanjutnya akan berbicara tentang keperluan-bicara untuk pengalaman Salka di Baiten. Dan pekerjaan selanjutnya akan digunakan oleh Mr. Chan, Ms. Yeh, dan Mr. Lam. Mereka semua JC student. Jadi, untuk pekerjaan selanjutnya, kamu akan perlu mempunyai PIDEN 3 dan mempunyai pemeriksaan. Kami bekerja dengan PIDEN 3.6, tetapi, dengan keperluan-bicaraan selanjutnya, kamu akan membuat pemeriksaan. Ini adalah sebuah pemeriksaan yang tidak terkenal oleh pemeriksaan dengan PIDEN 2.6. Jadi, sebelum kita memperkenalkan pemeriksaan, kami akan membuat pemeriksaan dengan PIDEN 3.6. Pemeriksaan adalah pemeriksaan menggunakan IPC untuk pembinaan pakaian platform, dan membuat pemeriksaan untuk pemeriksaan keperluan-bicaraan. Ia adalah pemeriksaan yang paling keperluan untuk pemeriksaan. Dan menurut pemeriksaan yang banyak yang boleh dilakukan untuk pemeriksaan. Ada banyak pemeriksaan yang membuat pemeriksaan menggunakan pemeriksaan sepenuhnya. Selain pemeriksaan yang tidak terkenal, seperti PIDEN 4 dan PIDEN 5, tetapi membuat pemeriksaan seperti PIDEN 4 dan PIDEN 5, dan PIDEN 5, seperti PIDEN 6 dan PIDEN 10. Ada banyak pemeriksaan yang dapat diluncurkan oleh pemeriksaan dengan pemeriksaan. Selain pemeriksaan, tetapi membuat pemeriksaan untuk pemeriksaan. Ada banyak pemeriksaan seperti PIDEN 6 dan PIDEN 10. Ini adalah pemeriksaan basikal dari pemeriksaan yang dapat diluncurkan di pakaian PIDEN 12. Sebelum hari ini, kita akan mencari pemeriksaan pemeriksaan. Jadi pemeriksaan pemeriksaan yang berlaku dengan pakaian PIDEN 12 menggunakan pemeriksaan yang sama untuk mengawasi pemeriksaan dan pemeriksaan untuk menggunakan pemeriksaan. Pemeriksaan adalah menggunakan pemeriksaan. Memberi untuk pemeriksaan yang baik, seperti pemeriksaan bergelak, berkeluaran, dan pemeriksaan yang tidak berlaku tidak teruk. Di merada di pemeriksaan, setiap pemeriksaan tersebut перевarkan pemeriksaan, kemudian akan dimanusingkan oleh pemeriksaan yang dapat dipaduk dengan pemeriksaan dengan pemeriksaan yang berlaku. Selepas memadukan pemeriksaan, pemeriksaan yang diberikan dengan pemeriksaan, Pada IP Address, saya menerima mana yang menjadikan penggunaan penyelesaian yang berlainan. Pertentangan berada dari 0-65,535. Tetapi jika hanya 1,000 penyelesaian yang berlainan, itu menjadikan penggunaan penyelesaian yang berlainan dan tidak berlainan. Pada IP Address, sebenarnya ada dua penyelesaian yang berlainan hari ini. IPv4 dan IPv6. IPv4 menggunakan penggunaan yang tidak akan berlainan. Berlainan untuk menggunakan penggunaan penyelesaian yang berlainan hari ini. Pada IPv6 menggunakan penggunaan 128. Pada IPv6, adalah pilihan yang terbaik untuk menggunakan penggunaan penyelesaian. IPv4 menggunakan penggunaan yang lebih berlainan sekarang. Pada 10 negara, kami berpengalaman mengenai penggunaan IP yang berlainan hari ini. Jadi, jika kita berlainan, yang baik adalah keyakan bagi bahawa.. bagi bayi specially bayi dengan strict pun muncul dalam expressing peninginannya seperti yang fungplain jawapan son Gren meuk advocates.. Segak menjadikan perluntu IPv4 akan berlainan penderitaan zeggen suatu kawasan agar toleransi dan cerita dan semula. Ok. Kita sekarang membantu untuk menggunakan penggunaan penggunaan penggunaan yang lebih berlainan hari ini. IA-Socket Next We will allow the client-Socket to connect to the server-Socket using its IA-JSF protocol Next, we will set the connection on the server program Using server-Socket We will return the connected-Socket to the address So we will store them in the variable-Cop-Connected Connected-Socket and address So now the program will be connected to the IA-Socket connection Next, we will try to send a message from the server to the client and do this using the send-off function If you're usually in front of a screen you can close the message To receive the message we will use the receive function in this client program Next However, we need to store the message in the variable-Cop-Message Next, we will display the message using the screen function Now we will run the program As you can see we receive a message from Hollywood in the client program showing that the connection is established between the server and the client Remember to close the sockets So far, I have returned the connected-Socket to the IA-JSF protocol So, IA-JSF protocol is connected to the IA-JSF and the IA-JSF protocol is connected to the IA-JSF protocol So, we will run the program using the send-off function Next, we will run the server So, we will run the program that we have in the connection and the IA-JSF protocol The IA-JSF protocol is connected to the IA-JSF protocol Now, we will run the connection sockets to the protocol sockets to the IA-JSF protocol and the client for 24-5 So, we will run the sockets to the IA-JSF protocol for IA-JSF protocol all from IA-JSF and then we will find an connection once connected and it will run the send-off socket the socket for our jack you can take the time to send a jack for the socket jack you want to know how to so how to you you you will ask for the data you you want to tell the client so you put the network and you want to send the data to the client so first you have to call the check the send-off function and the check-off function call the data so you have to input it to the client so it's called just input just let go to A for client because once you send it or you want the client to reply so you just wait for client to reply so you you need some data check-off jack you call the monitor you see and inside you put one here to follow that it might not affect the check-off jack easy so once in time that you can print out the data so you can transfer it to the dog format to put the data into the script so you remember that all messengers send a call to the client so you want to call to the client so they can decode the message to the client so now you have to send one to the client to the client so first I want to do this input then check and check okay one to dog format and you connect to one to the client so you can send the call to the dog format and one to the dog format and follow to the screen to the dog format and follow to so you have to make sure to send input to the dog so the data is first to check okay dog input dog input dog input dog input dog format dog format to send so you must send data to the dog format so you have to send a call to the client send the data to the dog format dog send to the dog and call so now let's run the call so first run the call of the client so now let's run the call so that the client the client call can send you to the client so you can send and you can type type and then on the client type you can send and you send type and so you can you can send type or you can and you can send it back so you can send it back to the client but what happens next thing you want to call to this person call away what do you call it? you can only call the text by call to the client but that is not the way to send a line so how do you call this person call away so what you want to do let's text the client you can call send me a call to the client so how do you call the client so the client has to send you to the client but also what you're going to do send it to the client so so so so so so so so so so so so and then so jika anda telah mengunggini tutorial, kemudian anda akan mengambil keputusan tawar yang bagi mempunyai Wieja dos, tapi anda superb surat atas jika anda ingin mengambil keputusan tawar, anda tahu yang melepaskan ia betul untuk mengambil keputusan tawar jadi anda dapat mengambil keputusan tawar sehingga anda boleh datang ke bahagian Okay, but soon, the sound is a way, right? So, I almost encode, but in your buildable, the sound is a way to be able to receive multiple texts from multiple files. And so, we don't actually want the sound to stop, to stop everything encode sound when I'm at the tree. So, all you want to do here is to add a file to your code, and then you put all these in the file to load. So, what happens is that, file to the listener and accept any collection of files. And that once the time you type it has enough to click, then the text will start to load, but the file will keep releasing for any collection of files. So that it can keep running, and the file will need to run one time. So, let's see in action, you want the file.tli file first, and you want the file.tli file. And you just can't handle it. I will add. But, if that's in the file, you type it to click. Or, the file type will click but the file type will click. So, if you want the file encode again, you can really connect to the file.tli, and then you can say hi and then, you will hear hear say hi. So, what I do here is that the server code will need to run fast. It is not available for all the client, multiple types, connected, but after it will click, or not send to the project. So, it will say to me, how do you guys have program that you need from that project? Hello. Before I, you want to take picture? Oh, by the way, and I also uploaded the code to Github. I will share my Github link like that, y'all can see, all the workshop materials is there. And because the audio for here is very shaky, so I want to set any questions or I will re-explain the code a bit because, ya, the audio is very shaky. So, do y'all have any questions about it? If not, I will go through the code again. Server.py file, you want to call socket.socket, and then you bind it to a server which is like localhost address and port number 12345. You have a bar tru loop, so you run forever. Then, after that, you will first listen for active socket and if there's socket, if the client wants to connect to you, then you will set the socket and then you will get back a chat socket which is the socket to communicate with the client. Then, you will have a quit equal to false. So, while the client does not want to quit, you'll keep running, then you'll just have the data input and you'll just communicate with the server and client. Until one, then it's like a quit. Ya, let's basically move on to the better shift data. Ya, it's possible how we block the problem like running with the client. Ya, it's possible. Ya, this is false because this server and client automatically on Python, we can only connect from on one, like from one. Okay, so basically, if you want to try running this code on two computers, you can, but the thing is because firewall has disabled like connecting directly from port to port, so in real world you can't actually, it's not actually feasible to connect to another computer using this socket. This is just a demonstration of one computer. So like if you want, but this is like demonstration of what real world sockets are. Basically, you have a client and server, then you connect with each other on a secure port. Ya, so basically now there will be game showcase on battleship. How can you socket to play again on battleship between two player? Ya, you all want to take out your laptop to follow along on just what? Okay. Thank you for the talk. Ya, thank you. Can you take show to me? Thank you. Better ship. The server generate a 3x3 grid and determine a random location for the ship to be in. The client will then have three attempts to guess when the ship is in. We have prepared templates for the server and client program. You can download them at the link shown below. These are the templates. You can pause the video to attempt the challenge. Alright, now I will go through the solution. The three functions here serve different purposes and can be used multiple times in the main program. In the grid creates the game grid while display functions display the grid to the client. GetUser input prompts the client for input and receives input from client for both row and column. I made that is kind of relevant to socket. Kind of not. You all can go and experiment. Okay, back to the video. In getUser input, there are four missing lines. Alright. So first, we have to send instructions to the client or user to input their row guess. Then we will have to receive their input in a variable like so. Then, we will repeat the process to get column input. Next, we have to create a server socket. First, we have to create a socket using the dot socket function. Secondly, we will bind it to a local host and upon number of our choice. Then, we will allow the socket to listen for incoming connections using dot listen. Lastly, we will have to send a request to the client or user to input to the client. So, we will have to create the client socket and connect it to a server socket as such. Back in the server program, these two lines of code is used to generate a random row and column whether ship will exist. So, we will send a request column whether ship will exist. We will use a while loop and that loop will loop as long as the number of times gas does not reach 3. It will also loop as long as client has not made a correct gas indicated by the Boolean called 1. Inside the while loop, these two variables It is good to take note that we increment times gas by 1 every time the client makes a gas. After every gas we will be updating and displaying the grid using this code. Lastly, we have to let the user know if he wins or lose. To do this, we will use the send or function under the condition which client want a client lost. Now, let me explain the client program code. Using an infinite while loop, the client socket continuously receive data from the server. It receives the code using the dot receive command as such. Once data is received, it prints the decoded data. If enter is detected in the data received, this means that it is prompting the client for input. Task we have to send the user input back to the server. If you won or you lost, it will break. It is a good practice to close the socket as we use. This concludes the online workshop. We hope you have learnt something. Thank you. Since there is still time, let me go through a game.py that I wrote for this workshop. Ya. So basically this game.py let me open it IDE. It looks something like this. Basically, one it is like an RPG game. So this is the map. The C is your character. Dots are nothing spaces. E is the enemy. And T is the treasure which you have to go to. So you can input up, down, left or right to go. And if you input the wrong thing, you will say false move and ask you to try again. So let me just put down. Let me just move down. Ya. Okay. So what happens when you meet your enemy, right? So I'm just going to meet your enemy right here. You print out this and you have two of shirts. You either attack or you run away from this enemy. So let's try attack first. Once you press attack, you print out this stat and then so basically from here you can see that the enemy has 15 health. You have 20 health. You attack it for 7 damage. It has 8 health left. 5.5 damage. So you have 14.5 health left. So since it has 8 health left, let's just attack again. And now it has 1 health left. But I have 11 health remaining. Let's just attack one more time and yes, we defeated the enemy. So as we defeat the enemy, the map will get updated and there will be less enemies. So what happens is every 7 turns there will even more enemies updated. Right. I'm just going to go through my game here. Okay, so what happens if you try to run away from the enemy? There's a 50% chance you'll get it. Hey, I ran away. That's good. So let me just keep moving to the treasure. Oh no, there are even more enemies. Scary. So As you can see, the game is not very polished because you can just run past all the enemies and you can just reach the treasure. Ta-ta, I win. Right. But okay, so you might be wondering how does this relate to socket programming? Yes, this is my answer. So basically, right, what happens is you know this kind of game, the majority of your game code will not stop on your client's side because that might be too heavy on your computer and you want the people to have you don't want so much code on your client's computer. So basically most of this code can be placed on a server and then the client just need to interact with the server. The server, this is called back-end logic. The server will do back-end logic and return something to the client. So what if let's say you don't want to have so much code on the client's side. So let me show you what it might look like. This will be what potentially looks like for a client code for this kind of game. This will still work in conjunction with a server code. But look here, up from 200 plus lines it's cut down to 59 lines of code. It's taken up by this enemy sprite which is really cool. I like it a lot. Ya and you can see here it actually cut down a lot and this is how some games they basically let you download your client. They let you download some client code but it's not very large even though the game is very expensive and has lots of functions. That's because most of the back-end logic is actually placed inside the server game.py so let me just go to the server game.py you see world you see so much code again it's even more code it's around 300 lines of code that I wrote myself yay so what so basically what did I change from the original code so first I copy basted all the code here by added import socket so basically for all the code that I needed input let's see basically all the code that needed input let's say you had input up down left or right inside the move function e right this it's all this is all changed because I added where is it hang on let me try find okay so yeah you can see here instead of just asking for input calling the python input function where do you want to go left up down left right instead I send this over to the client where you'll receive it the client game yeah so basically I added a special thing here called input at the front of the string and then every time there is input inside the string then it will ask the client to input the data so it can send send it over to the server basically the server only and for the stuff that the server prints out it will just send it over to the client the client will print out the everything so let's try running this game first when the client connects to the server the server will generate a map and then data will print here and you can see there is reinforcement things will look at this later so basically you want to go right it goes right right basically these functions just as a normal game except that the client code is so much smaller so you can actually you don't have to write so much code and the client won't have to spend so much time downloading it so as you can see write write i'm always write nah jk ya see it is always the same then you can attack attack oh no i might die oh no i have 8.5 help remaining enemy has 7 help okay so ya this here is a problem of me not adding slash n it's okay i'll do that later i'll attack oh no i have i have 4 help left but the enemy also have 4 help so you're low yes i defeated the enemy oh ya i'll show you what happens if you actually get defeated by the enemy that's the only way you can fail this game okay so basically here i talk basically here i talk that if you have a game code and you have server and client code but it will be very boring for the server side to just watch the client play game so what i added is reinforcements so basically every 7 every 7 turns the server can choose whether they want to send reinforcements basically add more enemies or they can don't do that this will essentially like add animal strategy for the server side even though it's a B it's still an animal strategy like for example if you see that the character it's like oh you want to save your reinforcements perhaps then you can type n and then you you can don't send in your reinforcements and the character can choose where to go if you decide to send in reinforcements then the character will suddenly swarm with enemies and ya it might be unexpected for them so since my characters on one health let's just die anyways wait no i one-shotted the enemy cool okay so so basically every time you get to send reinforcements maybe this time i want to kill this character already so boring then i send ya why then immediately the map gets updated and suddenly so much more enemies for me to suicide okay so then you just die again oh nevermind the enemy hit me for 0.5 damage the enemy is so weak ya by the way the enemy generation is all random and oh my character is so OP defeated another enemy i feel like i can just start a gaming stream right now let's just die i have 1.5 health left oh then my look here the enemy hit me for 0 damage why am i so lucky at the wrong time okay eh i defeated the enemy let's try again oh shit i defeated another okay nevermind okay so you can send reinforcements again i want to do so so i can kill myself ya so basically this game lacks quite a lot of functions like items like XP stuff you will find normally in RPG but this is just a proof of concept that a large chunk of code can actually be lesson so you can actually have the client oh i finally die see game over so basically the client code does not have to download as much code on their site to be able to play the game for 2 so basically let's look at the code again the only reason why sprite is here is cause you cannot send this over so get because the socket does not allow you to encode this so there will be some stuff that you cannot send over sockets or there will be some stuff where if you put in the socket if you put on the back end then it will be too slow like some game sleep reaction time so a lot of stuff of this stuff still have to be on client side but generally the logic behind the game cannot be condensed and so ya socket basically made the code for the client to download since we have more time let me just go through what I've been doing for this game so kind of a map map class here so when initialise when I initialise initialise the map class where which I do here MP equals to map so when I initialise it will call random integer anywhere from 1 to 18 that is because the first and the last ones of the list will always have to be the walls as you can see here as you can see here the first and the last lines will always be these walls and you can't go into it so for this I use random generation and many such that I use a 2D array basically so and I use nested for loop so for 20 times I will create each line of this and I make sure that only on the 13th line and then j equals to any random number then there will be a treasure so the treasure will always be on the 13th line but the number will be random then else right I will just have a random from 1 to 10 like basically there is 10% possibility that an enemy will be on that space and then else if it's not a treasure spot or if it's not an enemy spot you just append a dot then this will run for 18 times and then you will finally append back of the wall and then this will the self dot map will append this list so basically self dot map is a list of 20 lists 2D matrix of this entire map I hope that's not a bit that's a bit too complicated because this is deviating from socket and going into object oriented programming but sometimes this python ya this python concepts match together to create something so you will have to understand this so I just have there I have some basic functions like get map and change map like if I want to change this particular location from enemy like say the enemy is defeated so now you will become dot and then here's the show function I basically use some if loops in one statement because to make it neater right of course this is same as me just writing ya this is same as me just writing if half X bigger than 0 so basically this code is the same as this code except that I write it all in one line because for large scale projects like this I want people to understand the code but not like have it too long so this is equal to this and I just realized that was a contradiction because I should also add comments and documentation which I didn't have time to add in but if I did then it will be it will be easier to understand ya I think documentation in your code is really important because if not you won't people won't understand what you are writing and you have to explain to them which waste a lot of time so for this show function I basically just have a nested for loop and then if and then I check back with the self.map function and then after that I will just print it like this and then showmap is the same thing but showmap is the same thing but it's just a smaller map because if you input the whole map every time it is unnecessary and it takes a longer time so I just have it around the character 5 spaces 5 spaces around the character it will show the map then this the enemy encounter one basically if there is enemy encounter it will return true else it will return false same thing for treasure encounter and then this the add enemy so basically it will run the enemy generation code again to add reinforcements ya so getting to the enemy one where you initialize there will be random variable difficulty and the difficulty will set the health and the attack which can so what happens is if there's every time look at this code every time there is enemy right then you call the add enemy no no no this code no it's in the move function yes so if mp.enemy encounter equals to true it will bring fighting enemy then it will create a random integer of 1 to 4 then it will bring all the enemy strides it will bring all the attack all the attack and stuff then after that it will call the enemy.attack so oh my god i need water so basically these codes are just like like like the most important function here is the move function because that's where everything happens all the checks happen so if you are wondering how they code games here you go this is how you code games basically every movement you make firstly this is just to make sure that you are inputting up down left or right else you will just put no thank you we want a right input so for here every time you a game runs you will check if you first get a treasure if not you check if you first have enemies if really you don't have then you just move you so basically games are like that doing real life every time you do something they will conduct a check to make sure any environment or variables have been moved if they have then they will accurately show it in game so for the treasure encounter run you just print you found the treasure and then return false this is to signal the code to stop running the loop i feel we are holding a mic and there is no one to talk to speak louder in that case i will get some water test test 1 okay hi so i use mic from now on okay where was i okay so for enemy generation when there is enemy encountered which means the mp.enemy encounter returns true then you will print fighting enemy to the socket this is just a way of printing things then you will generate a random enemy so while this is while true is that means like while the enemy is still alive then you will print the sprite and you send the sprite over then after that you will print the options you have and then you can input either 1 or 2 then you will receive a message from the client now and then basically if it's not 1 or not 2 you will ask you to go again if it is if it this is a while loop so you keep running this until the client sends out 1 or 2 so if if it does send out 1 or 2 then you will print out the status you will print out your health and then after that if it's 1 then you will attack and you see here my attack generation is basically using a base attack then there is a plus minus from negative 3 to 3 so basically your attack range will be anywhere from negative 3 to 3 then you will hit the enemy for this amount of damage they will print how much you attack for then after that your enemy if enemy the health is greater than 0 then it's smaller than 0 then you will print enemy defeated and you will stop running the code because a dead enemy can't attack you so you run the same thing if A is equal to 2 if then you have 50% chance of running away this is just my random generation code I have 1 here and then I call random.ranin 1 or 2 so there is a 50% chance it will be 1 50% chance there will be 2 so if it's the 50% chance there is 1 then you will print run away successfully and you will stop running else it will print fail to run away so why why didn't I add the enemy attack code yet because the thing is if you fail to run away the enemy will get a free hit on you and then if you didn't defeat the enemy the enemy will also get a hit on you so since those 2 outcomes are the same you don't need to write the enemy attack code twice you just need to write it after the if which is here so because they both share the same outcome so if they don't break then they will have to get damage by the enemy so for the damage I call enemy.damage function if you go up here the.damage function is just the same thing self attack and then plus minus 3 then your damage yourself self.health minus equals damage and if it's smaller than 0 small of equals to 0 you'll print you have been killed and then this time.slip here is to ensure that the people have time to actually read what you send before they repeating the while loop and because when you repeat the while loop you will print the sprite as you see here this not a sprite so you take out the whole screen so you can like read this code again so I will print let it sleep for like 2 seconds so you can actually read the code before it moves on and then once basically once it has been difficult this loop will break and then so you will change change map this is the position of your character so basically if your character is on this position and then you meet your enemy then you defeat the enemy or run away from the enemy then the enemy will be changed from an E to a dot so the enemy won't appear again then you can continue on your merry way to call the move function again so then this code are pretty typical of socket programming you will call socket dot socket you bind it and then you listen for 80 connections and so like this I just you print out like the menu like yeah then to that you have a while true loop that keeps running until the person dies basically this is the reinforcement code and then this is the charge code this is basically like you can choose whether to send reinforcements or don't send reinforcements and then for here it's just the same movement code they ask you to send in up down left right then after that you will call into the function dot move and then if if not if it return if this boolean function returns false it means that the character has died from our earlier part of the code so you print out game over and then it will break the function else it will keep running this code for those that just join in we are looking at this game code using socket programming so basically I'm demonstrating that even such a huge chunk of bad end code can be simply start using socket if no this is the shell just close the shell so basically the original code looks something like this so this is the game code and it looks very long it looks very tedious and then if you are bringing it up on industry level standards it will be even longer and it will be probably a few gigabytes if not terabyte of code to work with so but if you are if you want game to work you want your client to download the least amount of bytes possible for your code to run so basically utilizing socket I cut down or the number of code the client has from around 300 lines to just 50 lines so they only need to download 50 lines of code but of course you have to connect to the server where the server will have about 300 lines of code but it doesn't matter because the server is on your side and so by doing this you cut down on the basic requirements that the client need to have to run a game so for the game side it's not that there won't be any code there will be some code that can't be sent over through socket like for example in my example this sprite and on me sprite it can't be sent over through socket because it can't be encoded and then there's also some stuff that let's say like your game is asked for reflexes so if you send it from server to client and your internet speed is especially slow it might not be so good for like those kind of games so there are some games that still has to be written in the front end but mostly games operate by putting majority of their code in the back end so the client doesn't need to do so much with it so basically for back end code it looks similar to all the code you just receive the data but I have this part here so basically if the server wants you to input something you put input inside the data that you receive so if the input while input not in data so that means it will keep receiving data until input not in data so if the data send by the server is sprite that means the server wants us to print the sprite so we'll print a sprite if the data equals to game over then we will know that the game is over then we'll close the client socket if not we'll print the data so basically this will print data continuously until we receive something from the server that has input in it once we do we will quit out of the we will quit out of this loop since input is not in data so we will stop running the loop then we will ask the client to input the data and then after that you can send the data back over to the server then after that you will repeat this voucher loop again so basically it will keep receiving input from the server so for those that come in you all haven't seen how the game runs so let me just show you you run the server code first then you run the client code the server will generate a map a random map and then you will send to the client then the client can input for reference this is the map these are the walls the dots are nothing E is the enemy and C is your character and you want to go to T a randomly generated treasure point so like you can win the game so you can input left you can go left but you can't because left beside it is like a gate it's like the wall so you can input right and then you update the map and your C will move right you can move right again but you have to spell right correctly it's harder to type with one hand as you realise then you can go down and down and this is the enemy attack sequence form bigger ok no I'm not making it make sense but I will make the form bigger other zero oh no but my game maybe too big never mind so basically you have two options when you come into a character you can attack or run and these are code that I just explained just now so I won't go too deep but basically we can attack and see you will deal a random damage based on random generated damage that's not so random because we still want we still want to have like a base attack ok so basically every time enemy gets defeated the enemy on the map will disappear ok so as I was writing this code I thought oh maybe the people on the server side is not having fun what if this is what you want this to be a two player game like the battleship game so like what if this side is very boring so I added this reinforcements so as you go about defeating enemies on your server side there will be lesser and lesser enemies look at this map there's only one enemy beside me and I can just easily avoid it so like where's the challenge in this game now so like for here right then you will so every time you there will be a countdown timer on the server side that the client does not know of then every time reaches zero you can choose to send reinforcements so let me demonstrate by typing yes then suddenly your map just added so much more enemies so this adds a strategic element to the game on the server side also because the server side can choose whether they want to send it or maybe they can hold it off so they can send like two or three reinforcements at the same time just overwhelm the character this can yeah this adds like an element of strategy and like two and the server won't be actually be bought because without this code the server is just watching the client play and not playing themselves obviously in industry standard the server doesn't have to do anything it's not up to the client but since this is just on my local address I wanted to have some fun so I just added this honestly this code is still lacking a lot of things and it can be barely be considered a game but this is just a proof of concept that you can actually diminish all the code from server like if you have so much base code for the game you can just not you don't have to let the client download everything so now I'll just win the game because I explain around everything there is then hang on I need to type okay so I I've been killed by the enemy so now I ended the game and yes I think that it from my game showcase there is nothing else any questions yeah yeah basically yeah this is direct connection to the computer which is why the five wall actually blocks any like outside connections on the port but this is a simulation of internet sockets are there any more questions all this code can be found on my github page let me shamelessly part my big github page here so basically you can go to this website you can find all the socket programming workshop materials including all the code that we have just mentioned so maybe like if you are interested in learning socket programming you can copy paste some code here as like your base to start you off doing socket programming yeah are there any other questions if not I think yes basically every computer if you want to connect to the internet it has sockets let me show you let me go to my command prompt I can go to net stat wait no what is the exact command so basically if you go it will show all the ports and then you can see it's connected to like youtube all the firefox stuff basically if you want to connect to the internet you will have to connect it using ports let me just dash n okay so basically these are all the ports here you can see <IP_ADDRESS> this is localhost these are all the localhost ports that I have running and then these are all the external ports which means all the website that I'm connected to and then so you see this is yeah basically yeah if you want to connect and transmit data you have to do it using sockets yeah and then you can see here all the port numbers which are the thing behind the address these port numbers are unique that's because no two sockets can connect to the same port at the same time so your computer has a lot of ports 65,000 to be sure so that you can connect to a lot of things yeah so if there are no further questions I think we can end this talk right okay thank you very much for your kind attention and see you soon at 4CR yeah


from Austin, Texas. It's theCUBE, covering OpenStack Summit 2016, brought to you by the OpenStack Foundation and headline sponsors Red Hat and Cisco. Now here are your hosts, Brian Grace Lee and John Walz. And welcome back inside the Austin Convention Center here as we continue our coverage here on theCUBE of the OpenStack Summit 2016. We are live here on day three. And IBM is a solid contributor, key contributor to the OpenStack community on the platform sponsorship level. And it's a pleasure to welcome Jason McGee from IBM who is an IBM fellow and also the CTO and Vice President of IBM Cloud Platform. And television star too, he might say. Jason, thank you for being with us. We certainly appreciate that. We'll get into the TV spot in a little bit. First, tell us about just your week, your focus here and what you've been able to get done and kind of how you feel about the way this community has really expanded. Almost exploded, you might say, in the past five, six. Yeah, so we love this week.  It's key to our strategy around cloud. We're building our entire cloud platform on top of OpenStack. So this is an important week for us. We have a big team that are key contributors and technical leads on major projects within OpenStack. This is an important week. Have them come, meet the community, figure out what the next steps are for OpenStack and the technical work we're going to go do. This is also a big client event. So we spent a lot of time with clients and with other partners and kind of talking about the evolution of OpenStack. I think the growth has been tremendous. I mean, obviously over the last few years, an event like this has not only grown in physical size, but really changed in makeup from kind of the early days of the foundation where it was mostly the people participating in the project, getting together to meet and talk about where to go to an event that is now, I think, a great blend between users and contributors and vendors who are really coming together to understand how to bring Cloud forward. So I think it's been a great week so far and some really great conversations. So how's that changed the nature of your work then? Or the nature of maybe the work of the community at large then because there has been this evolution of maybe the structure of the organization and then of the meetings, what's happened here in terms of different releases and different projects and all of a sudden, you see this maturation kind of occurring, right? People are growing up a little bit. So how's that changed things at IBM, you think? Well, I think there's a couple of interesting dimensions there. I mean, one is I see a real maturity happening in OpenStack and I think you see that in the event this week. You know, a lot of stories about clients in production, large-scale deployments, operational focus. I think within the working groups, there's been much more focus on how do you actually operate this platform and how do you build the right kind of operational tools, which is a sign of people really using it, right? So we're beyond the what does it do and into the how do I run this efficiently and operate it? That's important for us in IBM. You know, we're running OpenStack at very large scale, both for our public cloud and for dedicated and on-premise environments. So I like that focus. I think that maturity is good. The other thing which I think is quite apparent this week is the role of OpenStack is starting to get kind of better understood within the broader landscape of cloud. You know, I did a talk yesterday as part of our IBM day, where I talked about kind of the overall cloud stack that we're building, right? From infrastructure through platform services with containers and into domain services like Watson and video. And I think in the industry overall, you'll see a more mature conversation about the role that infrastructure with OpenStack plays and how it relates to Kubernetes and Docker and container technologies. And I think that's good. You know, it feels like we're getting into a better place where we're not all just trying to solve all the same problems. And then we kind of understand how these different communities can play off with each other. Yeah, IBM's obviously been involved with Open Source for a very long time. It's kind of new and cool for some of the other vendors in the industry to go, hey, we now do Open Source. We're contributing. How important do you find when you talk to your customers that they go, you not only understand the technology, but you understand the process. We can lean on you to help us.  But yeah, it's a great point. I mean, in fact, we have those conversations all the time with our clients about, you know, not only what are we doing in Open Source, but how do we help them participate? You know, one of the roles I think IBM has played a lot in recent years is helping different open source communities move towards the proper governance models. You know, we helped create the OpenStack Foundation. We helped create the Cod Foundry Foundation. We're doing some of the same things with CNCF and NOCI and the container space. You know, it's how do we take that experience that we've had with how to do governance and contribution around Open Source and help the communities move forward. For clients, you know, we've done things like, we released this thing called the Bluemix Garage Method, which was a way that we actually documented kind of how we do development internally in IBM, how we transformed ourselves, and we documented that so clients could kind of take advantage of those same techniques and tools and kind of learn how to contribute. So we think that's pretty important role that we can play with our clients for sure. And the Bluemix Garage is great. I mean, there's probably about a half dozen or 10 now. It's a really open place.  There's a bunch of experts there to help you actually write code. And we were at IBM Interconnect a few, about a month and a half ago, whenever it was. One of the things that I heard over and over again was how much people really liked the mix of, you know, sort of local service, bring the whole Bluemix Cloud local and then having it, you know, in the Cloud and the public Cloud as well. How much do you guys find that people are starting to realize this idea of, there's undifferentiated sort of heavy lifting that people like IBM can help them with and they can focus on applications versus before having to think about, I got to figure all this stuff out. I got to run it. Are you seeing that more and more from your clients going, I got to focus on the application. I got to focus on the business side of things? Yeah, absolutely. Especially if you talk to the right people within those organizations. But I do think, you know, this idea that mixed environments or hybrid state is really the reality that people are going to face. It's not some temporary or transitory state that they need the flexibility to run some things in multi-tenant public and some things on-prem. And that running, you know, running a Cloud, running OpenStack, running Cloud Foundry or containers, like running a platform, it's a fundamentally more complex operation than running a Linux server or an app server. And you really think about it like kind of the blast radius for failure is much bigger. You know, if you do that wrong and you have a thousand apps running on your platform and you screw something up, you take a thousand apps down, right? And so I think, you know, we've run into a lot of clients who kind of started their journey in on-premise Cloud space trying to do it themselves and build it themselves. And they quickly realized that that's an expensive and complicated operation. And so they want to vendor like an IBM to be able to help come in and kind of run that for them. That's why if you look at our local strategy, all of our kind of local Cloud offerings are essentially managed. We use this technology called Relay to let us kind of reach in and connect to and manage that environment. So it's still delivered as a service, you know what I mean? Cloud is a service that you deliver. It's not software. And so even in an on-prem case, you need that kind of capability. Yeah, to the point that you raised that when things do go wrong, right? When something happens and maybe that creates a concern for potential clients, or prospective clients, or existing clients, who are looking at making a similar move and they're like, I don't know what happened here. You have some proof in the pudding. You talk about interoperability and some case studies and some examples.  Yeah, I mean, some of it I think is just about transparency. I mean, part of the value of the whole community process is that all of the experiences, all of the testing, all of those case studies are things that you can share publicly. And so a lot of it is conversations with clients about, here's what other people have done. Here's the tests we've run. This week we made this request to the other vendors within the Opus Act community to really get serious about doing interop testing, right? And to me, one of the big values of open source and these communities is freedom of action and freedom of movement for clients, that they're not locked into a vendor. They are selecting a technology that's owned by a community and they have the freedom to move things around. And that value doesn't really play out unless there is actual true interoperability that everyone's implementations work the same. And the best way to make that happen is actually prove it. To get together, to do that testing in a publicly and transparently share the results. And I think OpenStack's made a lot of strides recently with projects like RefStack to try to start to define within this incredibly flexible world that is OpenStack where you can plug in all kinds of drivers in different configurations. What's the configuration that we can all rely on and have consistent behavior? I think we have to go beyond that now and kind of do proof, right? Get together and prove it by actually testing and sharing those results. And who are the new clients? I've heard a lot about retailing this week and financing, whatever. Are you seeing expansion into those areas or maybe some other areas, some verticals that you hadn't been into before that is starting to draw some interest with regard to open source and OpenStack?  So on the whole, it doesn't tend to play into one industry or another. But of course, rates of adoption are different. You know, we're certainly seeing adoption across all industries that we play in in retail and financial services and manufacturing across the board. I have seen a shift, you know, for example, in financial services in the last maybe 12 months, I think there's been a big shift in mentality towards a greater acceptance of public cloud and multi-tenant or shared public cloud environments where maybe a year ago, I'd walk into that client, they'd be like, we're never going to run outside our firewall. Today, they recognize they're going to do that and therefore the value of something like OpenStack where I can have the same infrastructure and the same API inside, by data center and out is a big value for them because they're going to have a mix, right now. So you've seen shifts like that. You mentioned interoperability. You were talking about it from the perspective of, you know, get Mirantis and HPE and IBM to, you know, the vendors to work together. Right. Every customer we talk to goes, yes, I recognize it's a hybrid world. I'd like to be able to move around.    You've got technology like Cloud Foundry, we're going to make you portable. How do you help customers understand what that portability interoperability thing means from their perspective, which is, you know, I'd like flexibility. I don't really care about the bits. I want flexibility. Yeah, no, it's a great point that I think if you look, you know, more deeply at the full Cloud Stack, there are different technologies within those layers and some are better. You know, containers I think are a better model for packaging applications in a portable way. But what you quickly find is you take that, that kind of packaged application and below it, it connects to the network. It collects into storage and those things have to be made portable as well. And I think in kind of the compute space, you have virtual machines that you could get through Nova and OpenStack, you have containers, you have a bunch of options. But when it comes to networking and it comes to storage, you know, OpenStack is really the most mature definition of how to expose those capabilities in a way that's flexible across different environments. And so what we've done is, and what my focus recently a lot has been is, how do we actually get these communities to come together? I was at the Linux Collaboration Summit last month in Tahoe and I did a discussion there specifically on this. Like, we have all these great projects. They all overlap on some levels. That's fine, except for when you really start to think about how do I pull this whole thing together and get a consistent experience across the whole stack. So what we've tried to do for clients is define the whole stack for them. You know, here's all the components, bring them together and then be able to be prescriptive about, okay, if you need to build a portable app, use containers, use networking in this way, give them some guidance on how to optimize for that portability. So this week's all about OpenStack. OpenStack's great, but at the end of the day it's sort of low-level plumbing, right? It's like you said, it exposes disks and networks and stuff. On the flip side, the other end spectrum is Watson, right? You were in a, we were talking earlier, you were in a commercial around the masters about Watson. Give us a great example of somebody using Watson to do stuff that you just go, wow, that blew my mind.  I mean, the thing I actually think is most interesting is there's the big use cases, but what's really interesting to me about Watson is how easy it is for an average developer to get access to just incredibly powerful capabilities. I mean, I think about, as I was kind of growing up as an engineer, if I wanted to do video image processing or natural language processing, that was a deep scientific space that would have been very hard for me to get my hands on. And now you can come into a platform like Bluemix and you can get Watson APIs. And in two minutes, you can build an incredible app. I did a presentation back at Interconnect for this thing called Hack Summit. There's a virtual conference online. And I mean, my team built an app that did like live sentiment analysis, tone analysis on the whole Twitter stream for the conference, right? And it took like a couple of days to hack together this fairly complex natural language processing app off of Watson APIs. So I think, to me, the real interesting story about Watson is just we've made it so accessible that the ideas that people come up with are pretty endless. And that part's fun, right? It's down here in the trenches in OpenStack, make sure it works, make sure it's highly available, and then let the creativity go crazy with the developers. That's a cool contrast. I think in OpenStack, you can't lose sight of that. I mean, at the end of the day, all of these things are about providing a platform to run apps, and the apps are the driver, right? And this is how do we support the creation of those applications. Well, tell us about the spot though. I mean, for those at home who perhaps are watching in their office and maybe they weren't watching the masters remember Jordan Spieth's big meltdown on Sunday and not the spot, tell us about the creation of that and your role in that and the fun you had with it. Yeah, IBM does some pretty amazing things on the advertising side, and as a sponsor of the masters we put together a whole series of spots around Watson and cloud, and I just happened to get the opportunity to participate in one of those, and I always think those things take forever, and in this case it was like the masters was done Friday and Wednesday. I mean, New York recording voiceover for this spot, talking about what we're doing around data and cloud, and they somehow hack that together pretty quickly and get it online. So did you ever see yourself? Have you ever thought about that I would appear in a spot promoting? You know, it's funny, I talk to my friends that work about that a lot, like when I was an engineer back in college and taking classes on algorithms and data structures, but I really needed it was like psychology and public speaking and acting. Those would have been much more useful skills for me then. Well, I think you put it all together in a pretty nice way. Jason, thanks for being with us. Congratulations on the spot, but more importantly, congratulations to your work in the open source community. Obviously, IBM's in there full speed ahead. Yeah, thank you. All right, you bet. Jason McGee from IBM. We'll be back with more from the Austin Convention Center with our coverage of OpenStack Summit 2016 right here on theCUBE.