where you are in the world. This is a presentation on extending the MySQL shell with JavaScript. This is a presentation for OpenJSworld 2021. My name is Dave Stokes. I have the honor of being a MySQL community manager for Oracle Corporation. I've been on the MySQL community team for just over a decade. Before that one of my jobs was the head of the certification department and I'm going to show you how to extend the new shell that we have with JavaScript. But first, since I work for Oracle, I have to post a safe harbor statement. Everything I'm talking about today is in the free open source version of MySQL. We're talking about the MySQL server, the MySQL shell, the connectors, router, all other pieces of software. There isn't an enterprise version of all those products that you have to buy a subscription to use and to get the license for. And I am speaking about the free version, the community version, because that's my job. Now during Q&A or some other time I might go off in a tangent on stuff that has not been released yet, new products. And unfortunately, I don't have perfect knowledge of those products. So take anything I say or may say about future products with a grain of salt. I might be thinking of the color blue and you're thinking royal blue and it is a big blue cheese. Anyway, about me, live in Texas. I work for Oracle Corporation. I have a blog at elephantdolphinit.blogspot.com. Email david.stokes.oracle.com and on Twitter I'm at Stoker. The slides for this event will be up at slideshare.net slash Dave Stokes. Looking for open JS 2021 MySQL shell and that should bring it down for you. Let me turn off the webcam to save some screen space. MySQL SH, which is our new shell. If you've used our old shell in the past, it was very much an old style command line interface. The new shell is a brand new product that came out three years ago with the launch of MySQL 8 and has a lot of very interesting features. The main use for it is to process code written in either JavaScript, Python, and SQL. And you'll see that does all those very well. Now, any of the executed code is processed in any of these languages. So you can write something in Python, have it run in an SQL or JavaScript and run in Python or however. It's all basically based on the current language that you're currently active with. Well, how do you tell that? Well, here's where I fired up MySQL SH and you'll see the prompt there in yellow, the JS for JavaScript. That's why I'm here at OpenJavaJS 2021. Now, if you want to work directly with Python, you type in slash py. And if you're an old database person like myself and want to use structured query language slash SQL. By the way, something to point out, rather than our monochromatic shell where you now have colors and the command line prompt is all customizable. In this case here, I typed in a backslash s to get the status and you'll see that I'm in SQL mode. And if you look a little bit deeper, you'll notice that we are using SSL. We're using TLS AES 256 encryption by default. When you set up your MySQL server, that is enabled for you. We wanted to have MySQL 80B secure out of the box. Now, if you want to turn that off because your environment where everything is air-gapped from the outside world or you have some other way of securing stuff, you can turn it off by default. We turn it on. By the way, if you notice at the bottom of the screen, second line up, we can compress your data as it goes back and forth between the server and your client here in the MySQL shell. Also, I like to point out with MySQL 8, the default character set for the server and the client is UTF-8M before. A big part of that is because of the JSON support that we have, JSON by default is all UTF-M before. Also, it lets you use emojis wherever you want. So let's carry on. Now, with the new shell, there are two types of sessions that you can have. We have the classic session, which is what you probably are used to from MySQL 5.7 all back to the 3.2.1 days, which listens on Port 3306. Also, four years ago or three years ago when MySQL 8 came out, we had the X protocol, which we call the XDEV API, which speaks both structured query language and no SQL. By default, it listens on Port 33060. And this is a nice little diagram that shows kind of our worldview. We're at the top level. You have applications talking through connectors. Or you can use scripts running through the MySQL shell. And they can talk to standard protocol or the X protocol. And on the server, you can have relational tables and you can have no SQL JSON document stores. And you can use them interchangeably. So in the no SQL side, I can actually reach relational tables. And the relational table side, I can actually go out and get information from JSON document collections. Now, you can use the functions that are available in JavaScript and Python mode to create multiple sessions with multiple objects during all sorts of different stuff.  You can have them interact with each other. Or you have different things going at different times. So you have one running report in one and some quick and dirty stuff running another. All from one instance of the MySQL shell.  And the underlined here in red, we have backslash C and then the account and the hostname. And this example here, the password has been cached and saved. And it creates a session to root at localhost. And in this case, it's going to run on the new X protocol. And it's ready to go. And you see down here that we're on the bottom line here, that MySQL is running on the localhost. This thing on port 33060, SSL is enabled and we're in JavaScript mode. Well, if you want to run multiple sessions, what you can do is what you see here.  You set up a variable. Variable session one equals MySQL dot get classic session. That's the port 3306. Give the parameters to log in. And suddenly we have session one. If I want to set up multiple sessions, I can have bar session two, bar session X, and address them by the session dot one object. By the way, if you want encryption, as I said earlier, it's turned on by default. Let's say you're in an environment where you don't have it turned on by default. You can still enable it. All you have to do is when you create your session, specify the MySQL X protocol, and give all the parameters host root password, and then the pass to the various files for encryption. Compression is very much the same way. You can say that it's required, what algorithms you want to use, and the level of compression. By the way, as mentioned earlier, the first time you log in using the MySQL shell, it will ask you for that account if you want to save the password. It gives you the options of yes, no, never, and the default is no. This is stored in a hash, not human readable, and it becomes very handy for those of you who don't like typing passwords. Also used in MySQL shell from the command line. So if you have a JavaScript program that you want to feed into MySQL shell that has all the authentication parameters set in there, all you have to do is type in MySQL shell and use the less than sign from your JavaScript file, and away it goes. Now, by default, your files that you're going to write for the server, if you want to share them with other folks, are going to be stored under user, share, MySQL SH, modules, and you can have JavaScript and Python modules. In this example here, a quick little one called Dave.js has two little quick functions. You can also change your path so if you have something off your root directory, you can specify that there too. By the way, if you want to use the XDEV API for using MySQL, it's a NoSQL JSON document store. This is an example written in JavaScript. We create a variable called MySession, which says we're going to connect with the X protocol with the username, password, and machine name. And then from there, we're going to go out and get the schema. Now in the MySQL world, we use schema and database interchangeably. That's just the way we're doing it and that's how we're going to do it. So we're saying for our session, we're going to go out and get the world underscore X database or schema. And in that database, there's a document collection of JSON documents called country info.  Then we're going to execute that. And from there, we do a fetch one to read all the records. Now, if you notice this is going out and pulling back data, not using SQL. Very JavaScript-like, very modern design-like. You're not finding SQL syntax. So if you love databases but hate SQL syntax, this is another option for you. By the way, when you run the script and you get the proper information, it goes out. I believe it returns 237 different documents with the various information. Now the Rolex schema and the World schema are two schemas that we have out on the MySQL.com website that we use for documentation and illustrative purposes, such as documentation examples. And that's free to download if you want to play with it. Also, if you're in JavaScript mode and you decide that you just have to run an SQL query, but I want to change modes, I have to do is say, okay, for this session, the current session I'm on, I want to run an SQL commune, very cleverly called run SQL function, and then just plug in your structured query language. And in this example, we're going out to the MySQL schema and getting the user table and getting a list of users and the machines they're allowed from. Very, very handy. So you don't like this normal output. You can get, as an option, from the horizontal output, either JSON or vertical. I have to do the shell.options.set result format JSON. And then when you run the same command, this time it's limited to, you get the same information in a JSON format. Now, if you want to make all your output forever and ever JSON, you change the set to a set capital P persist. And that would save that out there for you. By the way, as I mentioned, you don't have to use structured query language. This is an example where, say, we don't know what our data is going to look like, we want to use a database, but we don't have time to set up the structures, the relationships, all the tables, the indexes and all that. What we can do is create a schema. In this case, it's called demo. And then within that schema, create a document collection. In this case, we're going to cleverly call it OpenJS. I'm going to plug the show you're talking about. And then we say DB. And DB is an object that points to the current schema. OpenJS, the name of the collection we just created, add. And then we put in a valid JSON document. Yes, it has to be valid JSON or the server will reject it. There's some checking there to make sure you're doing the right thing. And once the data is there, we can do DB, OpenJS.Find. This tells us all the records. I want to skip over the underscore ID for this talk. It has some important information there. But it's primarily to be a primary key in the database. As you know, our primary storage engine is something called NODB, which would love for you to have primary keys on everything. It sorts everything into a B tree. And this is the way we do it. But you can ignore it for now. By the way, if you want to specify your own value for underscore ID, you can do that too. Now, I think I showed this a little bit earlier. You can have your own script. So if you have a library that you like or a script that you've written that does certain things for you with your data, very easy to include it. And in this case, we're logged in and create a variable called dave that requires the dave.js file. And if I just type dave period and then hit tab, it'll show me my options are hello and my SQL, as you can see, hello and my SQL. And if I type dave.hello, it prints out hello there, like you'd expect. And the same thing for dave.mysql. So it's very easy that if you have libraries for statistics, analytics, machine learning or whatever, very easy to include them with your MySQL shell. Now, the neat thing is the shell is extensible. You can define what you want to do besides the base function under the shell and write it yourself in either JavaScript or Python. And if you want to show these other people, you can. You don't have to. And this is a very precise way of tuning the shell to exactly what you need. Now, you can persist these reports and objects in what we call a plugin that are loaded automatically when your shell starts. Now, to register a report, it's very simple. You write your code in either JavaScript or Python. And the reporting facility handles built-in reports very easily that's used in the same API for both languages. There's color a little differently. I'll put that a little bit later. Now, reports can specify a list of report specific options. So like you want a minus V for verbose or something similar that you can define all those you want and have that work. And you can also have reports that don't need any qualifiers on the command line. And you can also put in a help statement in there. The new Moscow shell, one of these great features besides command completion is the help facility. It really lets you drill down. And if you forget syntax on something, you can hit tab and it will prompt you for the closest available options. Now registering shell reports is very easy. You'll notice the difference is that when you register a report for JavaScript, it's register uppercase R report. Now in Python, it's all lowercase with a underscore between them. So if you write something in Python that you want to call from JavaScript, you'll probably follow the same rules. So here's an example in Python. We're defining a function called session. And this session, we go out to the SIS schema, which is our schema that has metadata about your server. And we're going out there and from a table, instead of a JSON document collection, we're going out and getting these columns and doing some processing with them. And then we return a report. Now we have this function here, shell register report, we say, okay, we're going to have a report called sessions. It's going to output a list. And this is the pointer to the function up here. And this is to help information out here with the brief and the details. And when you run that, it's rather exciting. You can use backslash watch sessions, which is the name of our function here. In this case, we're running it every two seconds. So if you want to watch something run, some command that you have, it's very handy to do that. Now there are some built in functions already within my SQL shell. There's watch query. This is an interval of a half section, second, where we're going to show global status like COM wildcard. Other thing you do is show threads, which will go out there and check what's going on in your system. And this is the example slightly different. This is for particular ID. This is in the Python mode, not any difference right there. Now, the MySQL shell comes with a lot of utilities built in. And believe it or not, you can actually extend these if you want to. The first one you'll probably run into, if you're running MySQL 5.7, is usual check for server upgrade. This will go out there and take a look at your 5.7 instance and see if there's anything that you need to change before you upgrade to version 8. Very, very handy, highly recommended. If you're doing things like forcing the use of the old temporary storage engine, we have a new temporary engine that's much, much faster. If you're using something that wasn't a re-reserved word but is now reserved word, it's there. I'll warn you about problems with character sets and collations because in MySQL 8 by default, everything is UTF-8 and before you might be using something else, there's always other little checks out there that will run for you. Very, very handy. Another nice utility we have out there allows you to import JSON documents, is import JSON. And in this case, you tell it where the file is and then the schema you want to put it in and what document collection you want to drop in that information and it will pull in all that data for you.  Also, there's a very nice import table function called import table, creatively enough. And once again, you tell it where the file is, the schema you want to put that stuff in there, the table that you're putting in there. Now, this is not important in JSON, it's actually importing a table. The dialect, there are actually several dialects of comma-separated variables. DOS is one. You can skip over the first row if that's all headers and actually draw you a progress chart, so progress. So if you want to run something and keep an eye on it, it's a load, it's a huge file, you can actually use that little bar that draws across your screen. We also have some other interesting utilities. First I want to mention is the parallel table import utility. This works in parallel, I believe up to eight threads. On this example, once again, we give the name of the file, the schema or database we're putting in there, the name of the table, the dialect and show progress. And what's fun to use that with is the export table utility. So this will export in parallel and then you can read it in in parallel.  Now, even better than those, and these are less than six months old, I believe, are the next couple of utilities I'm going to show you here. Dump instance, which takes the entire server that you have there and will write it out there. Now, in this example, we're just doing a dry run for time, as you can see how it works. And if you're on the Oracle cloud, there's some IDs, information, stuff that it will do for you that's very handy. Now, here's an example where we're going to use the dump tables utility. And in this case, we're going out to the schema called HR. And in that, we're going to take the tables employees and salary, and we're going to throw that in an object called AMP. Now, if you don't want if you want to do better than tables, there's dump schemas, where you can actually name the various schemas that you're going to put out there. So you have instance for everything schemas for specific databases. In this example, we're going to have one called world. And if you're using the MySQL cloud again, there's buckets that you can set up and compatibility modes that you put out there. And also, once you do a dump from either dump instance or done schema, you can use load dump. And what you do is you tell it where the data has been dumped to loads it back in there very, very fast. If you've been doing your backups with MySQL dump, you might want to take a look at this. So where do you go if you want to learn more about extending the MySQL shell? Well, the first thing I recommend is the MySQL shell manual itself. This is grown from a fairly simple booklet to a commanding tome all of its own. It has a lot of great examples and explains things in great detail, very easily, well written, easy to read. Now, if you're looking for a quick how to who I write a plugin, the second thing from develop paper.com, I thought was very well. Now, if you're looking for example plugins, my counterpart from Mia Le Fred has a whole bunch of wonderful examples out there. They're mostly in Python, but they'll give you the idea of what's going on there. And if you go out to slideshow.net, this is his presentation. And from there, he'll have a link to his GitHub account. And from there, you can actually download, I think it's like a dozen or dozen and a half, wonderful examples of how to do various things of various complexity from fairly simple to very, very, very complex with the MySQL shell. And Fred believes that the best tool for DVA to admin a server is the MySQL shell. I haven't gone into some of the tools on that for setting up clusters and cloning servers and all that, but it has a lot of other uses. And with that, let me earn my pay by saying if you want to test drive the MySQL database service, which we call MDS for free, you can get $300 in credits.  This is the full enterprise version of MySQL, by the way. Very, very good deal there. I encourage you to try that. Also, please follow us on social media. We're at MySQL.com. On Twitter, we're MySQL, Facebook, we're MySQL. LinkedIn.com, we have over 20,000 people as part of our MySQL group. And of course, MySQL community.slack, you're now part of the MySQL community. Please join us there. And by the way, if you are in a startup, Oracle would like to help you out. They offer, or we offer great discounts, global exposure, marketing help, promotions, and access to Oracle's over 400,000 customers. If you are a startup, I highly recommend going to Oracle.com. And signing up. I am one of the startup ambassadors. You have more questions about that, please contact me. By the way, if you're interested in the JSON data type and MySQL, I've written a book now in second editions called MySQL and JSON, a Practical Programming Guide. The manual is wonderful for the JSON functions and JSON data type. I just wanted to write something more cohesive and easier to follow. Reference manuals are for reference, they're not for learning. And this is a book designed to teach you how to exploit the JSON data type and the surrounding facilities that MySQL gives you with the MySQL server to your advantage as quickly as possible. And with that, it's on to Q&A. Hopefully during this presentation, which is pre-recorded, I've been answering your questions. But if you have been waiting to ask me a question, this is your time. And once again, go out to slideshow.net slash Dave Stokes. You will find the link to these slides, look for OpenJS 2021 MySQL Shell, and you should be allowed to write to it. And please ask me any questions you have. Now if you're shy, there's my email. And if you're semi-shy, there's my Twitter handle. And with that, I would like to thank you for joining me today. And thank you for participating in OpenJS 2021.


Nothing like getting multiple videos out of one piece of content. A bit of parkour out there. Welcome back to another video, welcome back to part number 3 of 3 of Rugby Player Reacts, the biggest hits of the 2021-22 NFL season. Look, I'm not going to lie. I started off pretty strong actually.  I reckon I live streamed a reaction to the majority of the pre-season games and I don't know what happens guys. I don't know why this happens. I don't know how it's happened year after year, but I make it to the regular season and I don't know my personal life changes. Things change. My geographical location changes and look it just doesn't happen. It just doesn't happen. My in-depth coverage of a particular regular season of the NFL it just doesn't happen or it hasn't happened yet. So I'm hoping. I'm hoping the next season we can do it. But for this season all we've got left is a few playoff games. We've got the Super Bowl left in a short couple of weeks. Well, three weeks actually. But there is one thing I can always do and that's watch highlights of whatever team, game, year or season and create content that way. So that's what we're doing guys, that's what we're doing. I apologize for anyone who did expect me to be here for live streams of games throughout the entire season. I'm sorry, it didn't happen. But I'm here now for part three of three of the biggest hits of the 2021-22 season. So guys, I stand here 31 years of age, 6'1", 215 pounds. I've played rugby my entire life but I've taken a real interest in the world of NFL for the last three or four years. Let's continue that.  That's real rude. Not only...  But not only that, you come back to the ground and you get absolutely cleaned up from the other side. I mean, what? What? That's just not fair. You didn't even get a finger on the ball. You didn't even get close to getting a finger on the ball.    I'm pretty sure that's what he does, we won't say it. Tell you what I do enjoy, 60 frames per second action rather than your 480, 720 type that we saw in the last clip. This is nice, this is good quality, I like it. What have we got here? That was savage alright. I'm not going to call it a tattoo, I'll call it a nice rap, rapping tackle there. Yeah, it's just a decent tackle, I'm not going to say it's the biggest hit, I do have 20 minutes of footage to get through. I mean, I've got to give credit to the, well, looks like a fair few others have given him credit too. He's got 1.26 million subscribers, ding productions. Do I subscribe? Ah, why not? But yeah, credit to Ding Productions for putting together 20 minutes straight of the biggest hits of the 2021-22 series. I'm sitting here thinking, as a content creator, does he collect the clips throughout the year to then create a video like this at the end of the year? Or does he, I've got to assume guys, I've got to assume that he collects the clips throughout the year uploading them one by one as highlights, then knowing that at the end of the year he's going to collect them all to create an epic video just like this.  Nothing like getting multiple videos out of one piece of content. Bit of parkour out there.  Godwin. Oh, I tell you what, if you didn't break your leg, can you get any closer to breaking someone's leg, literally going shoulder first like a kamikaze pilot, right into the side of someone's knee? That should not be allowed, that's disgusting. But that's NFL football for you. What, that doesn't look like the packers. That looks like Oregon. I don't think I've ever seen a retro dark green packers uniform like that. Can anyone let me know down in the comment section below? What is this? Was it retro round? I don't know. But it was a big hit. Beeson pass breakup, I mean, didn't really have to use much of his body just his arm, let's have a look. Bang!  If we're talking boxing. Look at this. I'm gonna say both guys go up for it.  In fact, it was, yeah, less than a split. In fact, he had no time to brace for the contact and that's probably why the ball goes flying. Yeah, nice. We actually saw Darnell Savage on the opposite side of a hit just previous. That was Savage. This is Savage. Let's continue. Oh, no. Oh, no. You got to get in. You got to get in, Jones. Ooh! Tell you what, guys, we've seen some heavier hits than that and Jones couldn't walk straight. I mean, I'll tell you what, for someone who's gone in for a big hit, if the camera's not on them, straight after the hit, they could be rolling around. They could be... Well, they could be in orbit, to be honest. They could be in space and yet thrown back out there to take on the opposition once again. Wow. Mike Glennon is the backup quarterback. I'll tell you what, we've seen hits far worse than that. Yes, we have. And if a hit like that, I'll tell you what, a hit like that can have someone out in their feet like Daniel Jones just was. Imagine the effects of some of these hits we've seen thus far. I mean, it's... It doesn't be a thinking about... For the Giants. Bilal Nichols. Carl Adams. Oh my gosh. Would you expect anything less? It's coming over. Woo! Yeah, that's not going to do you very well. I mean, you need two feet on the ground to be able to move any which way. I know Tom Brady loves a bit of a bounce in the pocket, but not that high. Not that high. You've got to hold on to that ball. And look, I don't know if the wide receivers talk about your four or five points of contact, but the running back certainly does. And what are we going to see here? We're going to see Edward Zillier running out into the flat, turning backwards, getting the pass from Mahomes. He's four yards out. We've got two Green Bay Packers running across with the sole job, the sole intention of stopping this man from scoring a touchdown. What happens? Well, I only needed one man and one hit, and what a hit it was. Look at this. See ya. That is 1v1 if you ever did see it in the world of American football. Man versus man. Packer versus chief. And, well, you know the old saying, too many chiefs in the kitchen. Actually, how does it go? Surprise is how we didn't come off there. In fact, is that? No, he got a hip injury out of college, didn't he? That's a rib injury. And that don't feel nice at all. Tell ya what, that'll make you feel good. Second-string quarterback, lowering his shoulder against, well, it might be the Detroit Lions, but it is an NFL caliber defensive back. And the defender comes off second best. That's a result. Yeah, he really came off second. Young Hoku! Don't mind a bit of Young Hoku. Love the guy when he played for the purple uniformed Atlanta Legends a couple of years back. He stayed in Atlanta, he's in Atlanta, boy. What's gonna happen here?  And when you think about one of the biggest hits of the NFL season happening. He did it! He did it. No wonder he was part of the Atlanta Legends back in the day. He's an absolute legend. He's got a hit. He's got a decent hit. Probably not as impressive as Mitch Wyschnowski's hit against the Denver Broncos last year. But look, I mean, old backer kicker to the hills. And I've certainly back a kicker who's willing to put his body on the line and take a tackle. So let's have a look at that again. Well, look at he...  Young Ho Ku, what a legend. That is a worry. That is a real worry. Whew, he's out in his feet and he's still... Well, he held the ball. I mean, that's something. Just a big hit. I don't think it was a head collision as such, but it was just a really, really big, shocking hit. Certainly staggered him, that's for sure. Man, see that every day. What an incredible throw. What an incredible touch by the great man Aaron Rogers. I mean, he knows where he needs to get the ball. He's got pressure in his face and he can still, you know, get that little, that side sort of angled pass. I mean, it's no Philip Rivers. But very effective. I mean, we've all seen that one. Right? This was a meme for about two weeks straight, because I do believe that around this time, Aaron Rogers was in the news for, well, more than the NFL, in fact, certain beliefs around certain injections being given. But we won't go there. What we do have is a meme and a half. Look at that. Look at it. What can you do when your tackles aren't doing their job? Not much. Nope. It's Thornhill. Matthew was in the vicinity, but not quite. All right. What are we going to do here? Kirk Cousins. He's going to fake it. He's going to fake the pass out to the flat to Jefferson and give it to Delvin Cook, running through the middle. Or he could well do the opposite. Let's see. Nope. He fires to Justin Jefferson. He's going to get lit up. He's going to get lit up. We're talking overtime here, guys. 28 all deep in Carolina's territory. Let's see what happens. That's a big stop. That's a big stop by Carolina. Get out of here, Boswell. Why was that not continued as a play? That's crushed. Yeah, you ain't going nowhere. Look at the size difference. 97 for the Steelers. How big is that fella? Is that Villenaueva? Nope. It's good old Cameron Hayward. He's been on the top 100 list for the best part of the last seven or eight years. Yeah. Not surprised. That's literally like a left. Well, for Mac Jones it would be like throwing the ball, then copying a big right hook. Follow by a big left hook. What do you do? I mean, what do you do at that moment? You just take it like a champ and hope you don't meet them in a dark alleyway later on that night. Maybe. Bang, bang. Oh, no. That's not nice. It's not nice at all. Completely illegal in the game of rugby, but anything goes in the NFL. Now that calls for a fair catch. Fever did see it.  Pringle must have gone from the chiefs to the Broncos. There he is. Cross and receive it, grabs it. Gets it first down. That's the thing, man. You might have four points of contact. You might even have eight points of contact. I don't know how you hold the ball. Is it possible? Could be. But at the end of the day, look, you can do well to hold the ball still after getting hit from one side.  Like, seriously, the way people come in, it's not just tackling. There are some people out there that play just like Mike Tyson. They go, is it Chase Clay? No, it's not Chase Clay for all it's. I can remember correctly. Is it Eric Kendricks, who is the Mike Tyson of the NFL at the moment? Look, I couldn't be sure. That's the name that comes to mind. You're going to have to correct me if I'm wrong. And we've only got 25 seconds left of the video. So let's go. That's the end of the video. That is part number three of three of Rugby Player React, the biggest hit to the 2021-22 NFL season.  I don't know. I don't know. I don't know. I don't know. I don't know. I don't know. I don't know about Rugby Player React's video. I don't know either way. I appreciate you without you guys. This channel would be absolutely nothing. And I wouldn't be having the fun that I am having at the moment. Jesus, we're in Christ June. It's not Alice Springs. There's no flies around here. Either way guys, thanks for watching and I'll see you in the next video. Peace.


Yes, development team doing some needs stuff. Cool. Well, thank you, everybody. Great to be here with you. I know it's a shame that so many people were not here, but at least we're here and thankful for that. My name is Bruce Momjin. I live in the United States. I am one of the Postgres core team members, and I work for Enterprise DB. As part of my work for the database about nine months ago, I decided to do some research to understand cryptography from the mathematics all the way up to the implementation. And you're looking at one of four presentations that came out of that research. The slides that you're looking at today are actually at this website right here. If you just put my name as crudely as you can in the search bar, it will come and it will find my website. There are four security presentations under the Presentations tab. And there are also 20 or 30 other presentations related to Postgres, including recordings of those presentations. So again, I hope you enjoyed it. We have about a half an hour, and I am excited to be giving this for the first time, brand new presentation, and very exciting. So what are we going to talk about today? It looks like a lot of information for 30 minutes, but we're going to do our best. I do have some presentations on my website to talk about cryptographic fundamentals, cryptographic communication, cryptographic hardware installation, and configuration. And this is the final talk, which basically talks about applying cryptographic hardware to actual problem domains that you have. The previous presentations, again, cover things like TLS, AES, public key cryptography, RSA, Diffie-Hillman, elliptical curve, elliptic curve, and also the complexities of configuring things like a UB key. If you're familiar with that device, I actually happen to have one with me, which you probably won't see because it's so small that you will probably have trouble. But it effectively is stuck in my USB thing here. Yes, it is this huge device. And I have unplugged my thing. And I will re-plug it in. As soon as the blue light comes on, there we go. There we go. It should come back. Yes, there we go. There we go. Thank you. So this is actually a UB key right there, that little. If I can hold it, yes. That is it. It fills the slot, is about all you can say about it. But effectively, it is a way of cryptographically storing secret keys that can only be accessed through the hardware. So unfortunately, I don't have time to talk about that because 30 minutes is not going to allow me to do that. But the point is, and again, feel free to look at my website to get the details. But the point is that normally when you're doing something cryptographic, you have to store the secret on the same computer that you're using. And obviously, if anyone gets access to that computer, they can copy that key off and do all sorts of things with it. The creative thing about the UB key in all of the hardware specific devices is that the key is only inside the device. It never leaves it. It can't be copied out of the device. I think that's the key point. So that unless somebody steals the physical key, there's no way of copying it in a way that's undetectable. And I think that's the real win. But what I'd like to talk about today is effectively how to use hardware cryptography for specific applications. We're going to talk about open SSH. Then we're going to talk about PGP, depending on how you want to say it. And then we'll talk about Postgres as a conclusion. So again, as I said, the UB key, which we're not going to cover unfortunately today, is actually a hardware device that sits in your USB socket. And there's a whole bunch of configuration that you can use to basically set up that UB key. For those of you who aren't aware, open SSH is effectively a remote shell command. It allows you to SSH or create a shell from one machine to another machine. The reason it's different than a normal shell is that it is secure because TLS is used, and therefore it's impossible for somebody to see the communication as it's going back and forth. Normally when you're using SSH, you have to have a private key stored in the file system of your device. So the key is actually you can do an LS. You can see the key. It says something.key if you've ever seen that. One great thing about using hardware cryptography is that effectively you can have the system not get the key from the file system, which is obviously susceptible to things like backups and people copying it and so forth. But you can actually get the key off of the USB hardware device, in this case the UB key. And therefore it's not possible for somebody to steal it without being detected. And of course it will not show up on a backup and so forth. So what I'm doing up here is I'm effectively trying to connect to my machine, and I'm getting permission denied. So what I can do with the UB key, and again all the configuration unfortunately is in the previous presentation that we never can get to, is that I'm using a utility called PKCS-15, which is actually a tool that you would run on Linux. This happens to be in a Ubuntu machine. And it's basically saying I want to run that tool to access my cryptographic hardware. I want to read key number one. And I want to output the public key that's stored in the UB key, the little device. So I can't take the private key off of here, but I can take the public key off of here. If those are familiar with public key cryptography, the public key literally is public. It's nothing secret about it. It's the private key that's the one you don't want other people to see. In fact, you can't see the private key. Once I put a private key into a UB key, I can't even see the private key. So I'm saying give me the public key from the UB key, and it actually looks like this, although there's a lot of dots here. So it actually would go really long, but I want to get on one slide. So that's what it looks like. So effectively what I do is I take that public key and I copy it into the SSH authorized keys file. And then I remove the public key because I don't need it anymore. And then when I want to use SSH to connect, I effectively have to tell it how to connect where to get the key from, the private key. And I now connect to that as that user. And I actually get a prompt, not for the password, not for the private key password. No type of going to type that out. But effectively any time I go to access the UB key, a second security measure is that I have to type a password of some type, typically five digits or four digits or six digits, to be able to access this device, access the little UB key. And in fact, once I do that and I type in the thing, I actually get an ID of prompt. And if I ask who I am, I've now SSHed in as Postgres when I wasn't using Postgres up here because I was somebody else. So my point is from this slide that you're basically going in and you're configuring, putting the public key out and registering it with that user, then you're using it to log in. PKCS11 is actually the protocol that we're using here. Here's a little more sophisticated example where I'm actually configuring SSH. I actually have a little script here that I've got a host name and a provider and I'm actually setting that up in the SSH config file. And now if I do that, I don't need to prompt for this OpenSC anymore. I've now registered OpenSC in SSH config and therefore I can just type SSH, the name of the person I want to become or the host I want to go to. I get prompted for the pin and boom, I am actually there. And of course, there is a URL there if you're interested. Another, actually, hold on, let me just fix that because that's annoying me now. Let me try to get rid of that little thing there at the top there. Oh, it went away. Okay, figure that one out. Okay, great. So that's another one. There is something called SSH agent. I'm not sure how many of you are familiar with that, but it allows you to avoid continually typing the pin in for the UB key. So it basically loads the key into memory, not on disk, loads the key into memory and then you don't have to keep typing the key. This is how you configure it. Again, I expect if you want to use that, you would probably download these slides and try it. And again, I run SS agent and I type the pin once and then now I can SSH and I'm not even getting prompted anymore for the pin. Or I could use this protocol here. Either one, I would work. And again, we have some URLs to kind of help you along. This is actually a script. I don't expect you to read it, but it's actually a script that I wrote that allows me to run the SSH demon in the background effectively at boot. I can run this and if SSH it hasn't been configured, it configures it and then it keeps it running so therefore I don't have to kind of keep typing it in all the time. So this is just a script if you're interested, feel free to cut and paste it and edit it. But effectively what it's doing is it's adding the key and then it's adding the agent PID and it's making sure that your SSH agent is running. And again, this is sort of another URL for you. And again, this is how you install it, SSH agent D. In this case, I made root own it and I just put it into user bin. Okay, old bin. Okay, again, if you're using SSH agent D, you would run it like this and now when you kind of log in it actually tells you some information about it and it works really well. Here's some examples. Again, SSH into somebody and you're becoming that. Okay, I would love to take questions but I have a feeling I don't have time. So if we have time at the end, I'll definitely be doing that. Number two, openPGP, you're probably familiar with that. It's sort of the command line tool that most people use for cryptographically signing things like emails and documents. This can also use the UBK in some really interesting ways. Again, originally designed for email but also now used for signing and encryption. It does file encryption, get signing, even Postgres stuff, actually uses this. Sorry. Again, a little history of openPGP and where it came from, GPG, if you're familiar with that name. Exploration of certificates and things. There's a lot of details here but I'm gonna have to kind of zoom through it but effectively this is how you install it. You're installing GNU PG, which is GPG long name and you also have to install something called SC Demon which is basically the smart card demon for Linux which allows openPGP or GNU PG-2 to access cryptographic hardware. That's what the SC stands for, secure smart card, I'm sorry, smart card demon. Once you do that, you can actually run GPG-2 and ask for the card status and effectively there it is, it's actually showing us the literal UBK information that it's pulling out of the little card that I keep seeming to reach for in my thing but it's so small that you probably can't see it still. But in fact it tells me it's a UBK, it tells me the version, it tells me some login data about the person, different key attributes and it even talks to me about the signature key, the encryption key or the authentication key. There's actually, UBK has several slots inside of it, it's not just one key, you can put a whole bunch of keys in there and in fact it's saying right now that those are empty. So this is telling me that my card, my UBK right now doesn't really have anything installed. Again, feel free to look at that URL if you wish. There is a GPG agent D that I wrote again to make use of this thing really easy, feel free to copy it. But here's an example of how you would use it, you'd start GPG agent and then you would actually, you can actually type GPG connect agent and you can actually reset the card. I know this is kind of gobbledygook but this is how you do it on a UBK to reset the card. Then you have to configure the pin for the UBK. Effectively here I'm generating a random number, that's six digits. I'm just shooting six digits out here, cutting the first six, making that my pin and then effectively I go in and I set my pin into that file and now I can basically run and I can change my pin and I set my pin to be that number. This is another password you have to use for the administration password, that's one's eight digits. So effectively once you've reset the card, this is what the card looks like right here, blank. Again, I told you there's a whole bunch of slots you can create in the UBK but right now they're all blank and of course GNU PG also doesn't have anything in it. So the first thing we have to do is we create a master primary key in GNU PG and then we create a signing key and encryption key and our authentication key all in here and then we have to populate the keys in here to match these. So effectively what we do is we generate all the keys on the operating system and then we effectively slice off the private key, the secret key, the private key and we copy them over into the UB key. Okay, remember I said that one of the beauties of the cryptographic hardware is that effectively your private key is not stored in the file system, okay? So the way you do cryptographic hardware with GPG is you effectively generate the keys on the file system and then you copy those files, the private part, into the UB key where no one can see them and then you erase that part, okay? And here's an example, GNU PG2 I say generate a key and this is a lot of, there's gonna be a lot of screens here but just bear with me.  Again, a URL here for help. Then I can add another key, go in and add a passphrase. I want an RSA key in this case. I want now an encryption key to be added that's signed and we're gonna quit there, okay? No expiration in this case. So effectively this is a cheat sheet of how to understand the GPG2 labels. A is authenticate, C is certificate of creation. E is encrypt and S is signed. Remember I said there's four different keys that GPG typically uses. These are the labels you'll see. So now I'm looking at my key. I have one public key and in this case two public subkeys right here and if I toggle to look at the private part I have one secret key and I have two secret subkeys, okay? I do apologize, it is a lot of material to go in. I mean we're on slide 33 of 94, okay? So I'm doing my best here folks but you gotta take the cards you dealt. So again, if we look at the, at GPG itself we have three keys, we add to the card key and now this is gonna copy all of my private keys over into the system. So I'm not gonna copy the encryption key over. In this case now I have three. Now I've copied it over. But you notice that this one actually says it's in the card. See how all of these are public and they just look like one line, right? Two of these are public or private and they're still in on disk. And this one actually's already been transferred to the card, okay? I'm gonna do the same thing again. See again we have one transferred to the card. I'm gonna basically say copy all the private ones over and now if I look at my private key all of these are now in the card itself then I'm gonna delete the secret keys because remember I transferred them to the UB key so I'm gonna get rid of them now. I'm gonna just get rid of the private keys on disk so that they're only on the UB key and then pull them in. I know again more information there. So if I now look at my setup here I've got the three public keys. We're gonna now remove the encrypted subkeys to the card kind of run through key to card and now I'm gonna shove that over. See signature key has nothing, encryption key has nothing, authentication key. Now the card's telling me it has one, okay? Again, encrypt the key. Now I've got two of them over here card number right here, okay? And now I'm gonna do this one and I'm gonna do key to card again and now I've got three of them, bing, bing, bing. All three of them now are on the UB key, okay? And I'm gonna save, right? So now when I look at my UB key, we're back to the UB key, okay? We're not looking on disk, we're looking at the UB key. Now I have a signature, remember this was empty before? Do you remember the previous screen? These were all said none. Now in the UB key I've got a signature key, encryption key, authentication key and the dates, okay? So if I now look at my UB key, you can see they're all kind of marked. They all have card numbers on it. This is an important indicator. It says that there's a pointer here that inside GPG we don't have the key. We have a pointer to the card slot and that's what that's telling me, okay? And that's pretty typical. So now that we've sort of set everything up, let's actually use that key to actually do something. So what I'm gonna do is I'm gonna take the word test and I'm going to encrypt it with GBG2 with some armor. I'm gonna send it to, I'm gonna use that as my key ID and then I'm gonna decrypt it. So I'm gonna take the key, I'm gonna take a word, I'm gonna encrypt it with that key and then right away I'm gonna decrypt it. So the test goes in and bingo, test comes out, right? And the interesting part is that we've actually used the UB key to decrypt this. The public key was always on disk because we don't care about the public key, anyone can see it. So we don't have to transfer the public key over but the private key certainly used the UB key. Here's another example. If I do test and I do a check, I sign it with GPG2, I can actually say signatures made and it's talking about when I signed it. So that's a signing of that message, just a little different usage here, okay? You can actually use the open GPG and open SSH together. So remember I showed you before how to configure open SSH with a UB key. Well, you don't have to use the UB key directly, you can use open SSH. Open SSH can use GPG, which uses the UB key. So you're now putting a new layer in the setup here. So here's an example, let's pretend I can't log in. Now I can actually use, I can take my SSH out, I can throw it into a file and now I can cat it over to seven minutes. Okay, I can cat it into authorized keys and now I've become that person. This is a kind of software stack for cryptographic hardware. Here's the UB key over here in green, okay? We have four slots, one, two, three, four certificates here, public key, private keys over here and then there's an open GPG section inside the UB key and also auth slots and again, all the software that's used to access that is there, okay? So just a little comparison, if you've ever heard of PIV, PIV is the government standard for encryption. This is just a slide that talks about some of the advantages of when you would use open SSH, when you'd use GPG, when you'd use PIV. Again, I'm not gonna go into this because we don't have time. Let's finish off by talking about Postgres, which I actually know quite a bit about. We basically normally have a challenge in Postgres of how to store private information, how to store information without anyone seeing it. One of the tricks to do that is to place a private key on the client side and just as I use GPG to encrypt and decrypt, I can do all my encryption and decryption here. I can also do some decryption and encryption over on the Postgres side. Another idea is to just do, to encrypt it on this side and then just decrypt it on that side, have some kind of symmetric key. That's pretty simple. Here's an example where we actually create a table for each user and each user gets a symmetric encryption key, okay? And effectively what we do here is we, at the client side, we use open SSH and we create a symmetric key. Then we echo the symmetric key and store it into a variable. So here's my symmetric key, here's my encrypted symmetric key and then we create a signed hash of that. Again, a whole lot of open SSH going on in here sort of to encrypt that. What's interesting is that when you send a query to Postgres, we can have the client send its encryption key over to Postgres. Postgres can encrypt it and then store the encrypted data on the Postgres side. The problem here, of course, is you're sending this encryption over the network and Postgres is seeing that symmetric key, which is kind of yucky. You can actually retrieve your own symmetric key by doing a select and then you can decrypt the data on the client side doing the same thing. Similar here, you can get the symmetric key. This is actually what the symmetric key looks like in my particular example. However, that's kind of interesting, but notice if I take the UB key out of the server, or out of, yes, if I take the UB key out of the server, all of a sudden I can't actually do my encryption anymore because effectively it can't get to the key, the private key anymore, to figure out how to decrypt that. So it's kind of a multi-layered approach.  That's usually the way most encryption happens. You don't actually use public key encryption or private key, public key encryption for data encryption. You normally use public key encryption to encrypt a symmetric key. That's the way TLS works. That's pretty much the way everything, most of them work. So effectively what this solution is doing is doing that. Here's another example, a little more complicated where you're creating a secret message and you're encrypting it with the UB key in this case and then you're basically sending it into Postgres and it looks like that. Now you can retrieve it and encrypt it. Again, it's pretty complicated. I'm not sure how many people are actually interested in this level of detail for Postgres, so I'm trying to go fast. But again, Postgres has cryptographic support in the server. It also has the ability to store cryptographic keys in Postgres as well. This is a little more sophisticated case where we actually use the server and we store the secret key in the file system, but we encrypt the secret key in the file system with the UB key. So we're storing the key on the file system, but the key isn't stored decrypted. The secret key gets another level encryption using the UB key. So every time Postgres starts, it decrypts that particular key and then uses it to encrypt and decrypt data. Again, very sophisticated. This is some examples of that. Here's an example of the actual key being used. Here's an example of exactly how you would kind of access it. You can get even more sophisticated. You can have per user keys. Again, this is really, this is very complicated. This is actually a server-side function that's written in the Perl language, which allows you to kind of do that. So I'm just kind of kind of zoomed through here. The point is that you have actually transparent encryption in Postgres by using this. And again, this is way more than you want to hear, but keep in mind that there are performance issues here too. Again, I'm going to try and take one question or two, but feel free to look at this. This talks about database encryption. Probably not something people are interested in so much. Let's see, so, okay. So let's take one question, two questions. I think I have two minutes to take some questions for people. Is it possible to make a backup of the private key when it comes to the UB key? So the question is, is it possible to make a backup of the private key? What we normally, before we put on the UB key, what we normally tell people to do, and you're absolutely right, is you would, when you create the key before, you're almost always creating, you can create the private key on the UB key, okay? But if you create the private key on the UB key, you can't make a backup of it, because you'll never see it. So what we normally tell people to do is create the key in open SSL, SSH, so create the key in the file system on Linux, make a copy of that key to a USB stick that you can take away, then copy it to the UB key and delete it. So you probably want to generate the keys on your Linux machine, make a copy of it that you can take offline, copy that also to the UB key, and then delete it from your file system. That's normally the way to do it. The normal way, actually, I would tell people to do it, is to literally put a USB stick in, create the UB key on the USB stick, not in your file system, right? Not in your Linux file system, but create the key on the USB file system, right? Copy that to the UB key, and then pull the USB stick out. So the key never hits your platters. Another question. Yes, sir? Why do you focus on UB key and, for example, I'm on TDM? I'm sorry? Why do you focus on the UB key in particular? Why do you then use like TDM that isn't bad at all? No, sir, a lot of the time. So why did I use UB key instead of TDM? I found a lot of open source support for the UB key, and the ability to extract it from the device, because if you take the key out, that machine has no, you know, so I honestly, it never came up in my research. I never actually saw it as an option for Linux when I was doing research. It's possible I'll take a look. One more question, maybe? We're good. Okay. Thank you very much. Thank you.


Welcome. Today we're on board the Masters 227 Bay Boat. This boat is designed for those looking to fish skinny water, but still retain that bigger boat comfort. For measurements, this boat is 22 foot, 4 inches long, 8 foot 4 beam, 71 gallons of fuel, 12 inch draft, and 15 degrees of dead rice at the transom. So let's start at the bow. The bow of the Masters 227 is designed for versatility. For one, it's an obstruction-free casting platform, but it also serves as a lounge area. We do offer cushions for the entire bow as well as backrests. For safety, two grab handles on either side. Tons of storage built-in, starting with this center box right here. It also has access for your freshwater fill over on the left. The centerpiece of this entire bow is this large insulated fish box. It actually goes all the way forward to the anchor locker. Forward of that, we have the oversized anchor locker, and it does have the pre-wire for a trolling motor. Moving back to these lockable rod storage boxes, they're actually hinged on the back, allowing you to load and unload this box even when the boat is on a trailer. Very nice feature. So now let's take a look at the console. Console front, we have this 12-gallon insulated live-well, which of course can double as a cooler as well. And moving over to the port side, we have access to the enclosed head. Let's take a look. The first thing you'll notice about the Master's 227 head is the size. For starters, it is large enough to get in and out easily. It also gives you fantastic access to the back of your electronics, and it's a great place for storage. The door is lockable, making it very secure. For the family on the long days on the water, it could be equipped with a porta-potty, a great option to have. So now let's take a look at the electronics. Let's talk about electronics on the Master's 227. This boat is equipped with the Sportlink Electronics Integration System. This is our factory-installed standard set of electronics that comes with every sportsman boat. For the Master's 227, we include a Garmin 942. It is a 9-inch touchscreen GPS, and it is paired up to the Airmar B60 through-haul transducer. Now, we have a couple of extra options here for electronics today, including the Garmin VHF radio and the JL Audio Sound System. We also have the trim tabs and trim tabs control. The acrylic dash here helps with glare when you're out on the water, and it is nicely molded with 12-volt switches. There's also a 12-volt receptacle and USB charging ports. Sportsman steering wheel, hydraulic steering, which is standard on this boat. Yamaha Benico, two cup holders, storage below, and this boat is equipped with our Platinum package. This includes a couple of extra options starting with this hardtop. Let's take a look. The hardtop on the Master's 227 will give you plenty of shade on those sunny days, and it includes a ton of small features, starting with two Kingfish rod holders, four rod holders around the back, and then you have additional speakers as well as lights. Additional storage up here, and if you decide to add outriggers, the plates are already installed. Finally, it is color matched to the hull side. In this case, black. Let's take a look at the Leaning Post. For Leaning Post on the Master's 227, it is as comfortable as it is versatile, starting with these individually adjustable boasters. This allows the driver to be standing up while passenger is comfortably sitting down. Two grab rails on both sides, and plenty of storage for a cooler underneath. We do offer the Yeti slide out cooler, as well as an under Leaning Post tackle storage. Four rod holders across the back, and speaking of rod holders, let's check out the undergunnel rod racks. For the undergunnel rod racks on the Master's 227, you can store four rods, two on either side. Also, you'll notice traditionally these rod racks are mounted at a fixed position. What we've gone ahead and done is designed a way to fold them away, allowing you to get them completely out of the way when not in use. We've also added these nice reel pads right behind to protect your reels and the fiberglass behind it. For those sitting out back, we have a conveniently located cup holder and rod holder. And if the boat is equipped with fresh water, the fresh water hookup is right underneath the gun. So now let's take a look at the rear deck. The rear deck section of the Master's 227 is packed with features, starting with our total access hatch. To open it, simply lift up and pull forward. This gives you plenty of storage in there, as well as best-in-class access to your bilge for any maintenance or service needed. To close it up, simply lift up and put it back in place. Closing the lid over the top reveals a totally flush rear deck. For live wheels, we've got two of them, 20 gallons on the port side, and then the same 20 gallons on the starboard side, but this one features the pro-air bubbler system. Both of these boxes can double as dry storage and coolers. For power, the boat we're on today has the Yamaha 200, but we do offer from 150 horsepower all the way up to 250 horsepower in mechanical, digital, and the VMAX SHO engines. If you decide to go with the jack plate as well, we do include a filler board for the back, which extends the platform a little further. So now let's take a look at the hull. The Master's 227 hull features our planing hull with pocket and is optimized for shallow water and low draft. This boat also has a swim platform with a three-step boarding ladder, and because it's equipped with the Platinum package, it does include the sea blades under water lights as well as trim tabs. This boat, as with every other sportsman boat, is NMMA certified and built to ABYC standards, representing the highest safety standard in the boating industry. With a perfect blend of family and fishing features, the Master's 227 is a perfect boat for families looking to spend more time on the water. From the shallow draft to the enclosed head to the bow seating options, it is designed to meet your needs. If you have any questions, visit our website, sportsmanboatsmfg.com, or contact your local dealer. Thanks for watching.


Okay, again, this video is part of a series. Be sure to check out the link in the description of this video or at the end of this video. For the full playlist, I do recommend watching the previous videos before watching this one, but you can do whatever you want. So we've been working on transmitting information through airwaves, through radio waves, through using audio communications. Again, the scenario here is you are working for emergency rescues, either firefighter or EMS or something along those lines. And your normal forms of communication, the internet, are down. This happened to me. I am a firefighter. This happened a couple of months ago when Hurricane Irma came through through the storm. We lost internet, which normally we have computers in the truck that tell us where we're going. You know, it gives us the dispatch information. Again, our regular radio system went down, which uses the towers around town, but we still had some radios communicated directly to each other. And the way they set it up is there was someone dispatching. They'd call one state, you know, call over the radio and the closest station could hear them and then they would transmit over to somebody else. And that's great, doing it verbally, but it'd be great if we also had that digital, that computer interface so that, you know, we don't have, if we're writing stuff down, we can also confirm on the screen that we're seeing the same thing if we wrote down the address wrong or the computer showing wrong information. There's two forms of those communications, plus you can back reference what you've been dispatched to in case you didn't hear something on the radio. You missed something. You can look on the computer and confirm that address over the radio. So that's what we're doing. Last video, we did it with the shell interface. This time we're going to do a GUI interface. I'm going to still do a shell interface for the dispatch, but as far as the client, the truck's out in the field, they will have this relatively nice GUI interface right here, which is written in HTML with a little tiny bit of JavaScript. To get this code, go to github.com forward slash malix 1000. There should be a link to that in the description of the video. Go to my repositories and then search for radio and you'll want the one that says radio transmissions. All the scripts from this entire series should be in here, mini modem, morse code. Last time we did server one, now we're going to do server two. So that's the code here. You can see we just have a couple of little scripts here and you'll want to download that either clone it using git or download the zip file and unzip it. I'll be using Debian Linux for both my clients and server here. And the client will have to have busybox installer system, which is very simple to get. You can use your package manager if it's not already installed, but busybox is very simple to get, you know, just sudo apt install busybox, okay? Busybox is a small binary application that actually has a bunch of core programs in it. There's a list of the programs right here that they have built in and of course you can trim it down to have just a few of those and it's something that runs on pretty much everything. It probably is already on your TV, your router, your modem and your phone unless they're using toybox, which is a similar application with different licensing, but go ahead and have that installed. Once you've downloaded the code from GitHub, you're going to want to move into the server to folder, which I am here. So here we're going to have the top screen, bomb screen, there's both the same computer but we're going to pretend for right now that they're two different computers and in a later video we will demonstrate it communicating between two different computers over radio waves using different types of radios. List out here, you can see that we have our CAD file, which if you watch the previous video is our file in, file out and we'll see that in our dispatch code. And actually that's real quick, let's just look at our, oops, our dispatch code and you can hear, you can see our CAD file, we're creating it here and we're dumping our transmission message, which is received here. Nothing has changed from our client to, I'm sorry, from our last project to this one, besides the fact that I removed the new line character, these equal signs from the, from what's being transmitted since we're using JavaScript that's pulling things apart and displaying it, we don't need that line to be displayed. So that's, I think that's the only difference is that I removed all these equal signs from being transmitted. That's it. So let's go ahead and quit out of that. So we already looked at that code, let's see everything in action. First thing we need to do, first of all I'm going to, well I'm going to try to start server which I actually think I started before I started recording the video and it will tell me, yeah it says the address, which means it's already running or you have another server running on that port. But I will go ahead and kill all busybox and now I can try running that script and this time we'll say, starting server, server started and it will give me an address here, I can right click that and say open, it's a local host. So there we go, you don't need internet access for this, you don't even need a network for this because you're just looping back to your current computer through a virtual network device. But that's it. Let's go ahead and look at that code real quick, our start server, let me do it in Vim so it looks a little nicer. It says bash script, it says starting server and then we're going to start busybox's web server, the HTTPD on port 8080, the reason I chose 8080 because 80 might already be used by another web server plus you don't need special permissions to run something on 8080 on most machines. The end and the ampersand here is saying if this command is successful then we're going to echo server started on this port. The pipe pipe, two pipes like that means if this command was unsuccessful it says server failed to start, so that way you know whether the server started or failed to start and the fact that the port was already being used is already being put out by busybox there. That's it, it's basically a one-liner besides the message saying starting this, this is really the code right here, the rest of this is just output for the user letting you know it was successful or not. So our server is running in the background now, let's go ahead and look at what our programs we have in here, we have our HTML interface and we have our client, let's go ahead and look at our client, let me make this full screen here Vim client and all we're doing is basically the same thing as last time, we're saying you know our server, we're listening for transactions and this time instead of using T and displaying it to the shell we're just dumping everything in the file and really we could do both, we could have it go to the shell output and then also to the web interface but I chose not to do that when I wrote this mainly because I wrote this before I wrote the shell interface but really the code from the from last project would work the same because it's being dumped to the file and the HTML is just checking that file and then of course we have, well we already looked at our dispatch code so let's look at our HTML code here actually let's let's run this first let's do this so that we can see so down here I'm gonna start up my dispatch and then up here I'll start up my client whoops there we go so down here we have our dispatch it's waiting for me to give it information on units I'll say engine 24 and when you download this code I probably have some sample data in there I removed everything but one so you can see this is what each call is going to look like so this is an example one what engines are being dispatch displayed here your street name your address is the biggest thing because that's the most important get going there figure out why you're going there later but who's going where you're going why you're going and when you were told to go so that is basically the same information you saw before only instead of in the shell it's in a nice little GUI but now it's waiting for more information to come in so I can say engine 24 medic 24 I can say that you're going to 555 19th Avenue Northwest and I can say that this is a signal 7 and I'll go ahead and enter so you saw it actually unlike our shell which displayed everything after it all came through our HLL here tries to display as it comes through it's checking every I forget how many seconds I said it to we're gonna look at the code here in a minute every second I think it was it looked like that so every second it looks at our dat file our data that file for whatever is in there and right now I have new calls going to the bottom of the list so you get a lot calls you might have to scroll down again this there you might want the newest calls at the top or if you're going to put them at the bottom have it automatically scroll to the bottom when new information comes in which could be annoying if you're trying to look at something higher up and new calls coming in it's going to start popping you down to the bottom anyway that's something that if you were to use this you would figure out you know what works best for your system let's go ahead and send another message so I'll say engine 47 ladder 47 engine 40 squad 40 say 1414 Oak Street and we'll say fire in attic so again here we should start there we go it came through eventually you can see that it's displayed right there next on the list so let's go ahead and real quick we're going to look at two things here I'm going to kill both these programs our servers still running right now just so you know so we don't need to restart server although if we were to try to restart server it would tell us that it's already being used let's real quick look at our dat data dot that file was just a plain text file which looks like this and basically our JavaScript when we look at here in a second is going to every so often look at this file and break down line by line and then separate it by these pipe symbols so unlike last one if you were to put a new pipe symbol in there it was if dispatch was to put a pipe symbol in their dispatch again it would just mess up the formatting a little bit but it's not going to to make it unreadable anything in fact we'll give that a try but real quick let's look at our index file we've got basic HTML header stuff here and I just realized something that should be changed for sure and I should change that anyway we give a title here here I am calling some coders calling jQuery and bootstrap from the internet I shouldn't be doing that this whole scenarios the internet's down I need to download that and put it in a sub folder of the server that's all I need to do so I just need to change that code it'll work exactly same except for trying to grab that stuff from the internet it's going to grab it from your local machine so I do need to change that but that's that's simple enough I'm not going to do that on the video here because I'll waste your time here we got some CSS all I'm doing here that 10 that's just putting this little space in between each box without that these boxes are going to be you know touching each other and I thought that looked bad so I put 10 pixels in between each of those boxes down here is our body so basically we're making a body with then we got a div tag that's the container and then we got our rows which has the ID of cards coming up here we got here we got code saying wait till the page is done loading and then run the fun function get data and then we're gonna say here every 1000 here means one second every second run this function and what does that function do it's our only real function here well function standalone it's not inside this function we're saying get so we're gonna get information from this file it's saying look at the dat file return everything in there as a variable called dat and then take that and make it an array based on new lines so each call is on a new line then we're gonna say look at our cards div tag which was down in our body here and here I'm saying just clear it out make it blank there's actually I'm pretty sure there's a clear command but I usually just do HTML and give it a blank blank information there but basically we're clearing it real quick and this may call if you have hundreds of calls coming in that could cause problems because you'll see the screen flash as it's probably reloading them but in reality I if I was to use this code in real life I would set this so that it only returns the last 20 or 50 calls I probably wouldn't do more than 50 unless the user requested it but for example here we're gonna clear the whole screen and reload it real quick simple enough here so here we're gonna say in our array of data which is each call is a new item we're gonna say for each of those we're going to put it as a variable called D and then we're gonna take D and make that an array based on the pipe character so if you remember our each line was a new call and then each call had a block of information divided up by pipes the everything before the first pipe is going to be the trucks everything after the first pipe is going to be address everything after the second pipe is going to be our notes and then our timestamp is going to be the you know fourth column or everything after the third pipe then we're going to check here is the address undefined because when it's doing this the last line of the file is always going to be blank so you get basically a call that just said undefined and I'm just doing this so that that doesn't get displayed I'm sure there's more than one way to do this so basically no matter how many calls you have this code here is going to be looking at each line and the last line is always going to be empty and we just don't want to display that so as long as that's not empty as long as there's an address being transmitted it can even be blank just as long as it's not undefined if as long as it's not undefined we're going to put this HTML code into our page into our cards div tag we're going to you know sets column width to 12 we're also going to give it a class of output that's what gives us that's just basically for that 10 pixel separator that I put in the CSS there but could be used for other things in the future if you wanted to filter this list you can filter all the outputs based on something we're going to have a class of card and then we're going to give it a header which is the trucks and then the title for it is going to be the address and then the text for the card is going to be notes and time and then we're going to close all that up and then I actually put some line breaks in here just for spacing and that is our entire code really simple so basically again we're just going to get the information from this file split it up line by line then we're going to clear our page really quick shouldn't even see it unless again your output is a lot then for each line we're going to split up each item in the line and give it a you know sign it to a variable and then display it on the page that's our entire code and that's what will give us if we here start up our dispatch again and up here start up our client code and down here I can say let's engine 23 medic 23 444 Palm Street South and here we can say fall from roof someone was up on their roof door and storm it got blown off I guess since we're talking hurricane scenario go ahead and transmit that come back here to our output here and we should get the output on the page here go ahead and troubleshoot this by open up network oh there we go I don't know our it seems like if we leave the page for a while our timer tends to take a while to get restarted but it does eventually come through and worst case scenario you can always hit f5 to refresh the page but they should be coming in and that's basically it again you know in real real-world scenario if you want to use this you'd probably limit the number of calls are displayed and maybe filter it by trucks so so I can say hey I'm engine 24 by default only show calls that contain engine 24 and again I'm using the get command checking every second in real life you could set up a socket server and grab this information real-time but it doesn't really need to be real-time every couple of seconds is fast enough you know so again this part of series trick be sure to check out the full oh you know real quick let's hear engine 22 let me do a pipe symbol here and say medic 22 and then give it an address of 123 apple drive notes this is a test and this in this case it will mess up our formatting a little bit and actually our nights notes might be cut off so let's go ahead and do this so here you can see at our last call here down at the bottom our our truck first truck is there our second truck is where the address should be our address is here our notes are here and then our date is not there so this is a little more important that the dispatcher in this case knows not to put a pipe symbol in there because if they put a bunch of pipes it's gonna cut off a bunch of information of course you could add to the dispatch code to remove any pipes that the user types and that's the best case scenario don't put it up to the user to to not put pipes in there mode I usually use pipes for this because besides programmers and developers normal people don't use the pipe symbol they don't even know what it's called or where it is on the keyboard but just in case the dispatch code could add in to check each variable and remove any pipe symbols that are in them so again this is just example code proof concept to get you going it's up on github gpl license gpl 3 so be sure to check it out I thank you for watching visit films by chris.com that's chris the K there should be a link in the description of this video there you can go to the support section support me through patreon.com forward slash metal x1000 that links in the description of this video as well or through PayPal I do thank you for watching if you enjoy this be sure to like share subscribe and comment I appreciate you watching as always I hope that you have a great day


Hi, I'm King Banyan from the School of Public Affairs at St. Claude State University. The school prepares students to be stewards of the public interests. Some prepare to work in the public sector as law enforcement officers, planners and economic developers, land surveyors who help define boundaries, teachers or public administrators. Others will go to the private sector, but they too contribute to civic life through volunteerism and community engagement. Our students serve over 40,000 hours each year in internships, many with public and non-profit institutions. They and our faculty both provide informed analysis of public policy to their workplaces, our communities and around the world.


Kata 2022 final draw. Procedure, ports, teams qualified. Rankings explained. As the biggest milestone ahead of football flagship event, first approaches the procedure for the final draw for the FIFA World Cup, Kata 2022, are now available. Fans and teams will find out their path to possible growth on April 1 from 19 hours Doha time at the Doha Exhibition or Conference Convention Center at which time 29 out of the 32.6 pounds will be known. The procedure approved by Organizing Committee for the FIFA competitions outlined that 28 already qualified teams will be allocated according to the sporting principles. To ports 1 to 4, based on the FIFA, Coca Cola means world rankings, released on 31 March following the conclusion of the international match window. As hosts, Kata will take position A1 from port 1, where they will be joined by the 7 highest ranking qualified teams from the FIFA or Coca Cola means world rankings. The countries occupying position 815 in the ranking of the qualified teams will be allocated to port 2, while the 16th to 23rd best ranked qualifiers will be placed in port 3. Finally, port 4 will include the qualified teams in position 24 to 28 plus three press holders representing the two winners of the Intercontinental Playoffs and the Mi Remaining UEFA Playoff Winner. The Intercontinental Playoffs will be contested on 13th to 14th June in Kata, with the Asian Football Confederation presenting the Kanbol representative and the Kunkafa taking on the offer representative per drop, aildun 26 November 2021. The final team to qualify through the UEFA Playoffs will also be determined in May to June international of window. As per the decision taken by the Bureau of the FIFA Organising Committee on 8th March, the draw will start with port 1 and will end with port 4. Each port will be completely emptied before moving on to subsequent one. As per the standard draw procedure, a ball from team port will be drawn followed by a ball from one of the group ports thus determining the position in which the team will play. Teams from the same confederation will be kept apart. Each of the eight groups with the exception of the UEFA will be which is represented by 13 teams. Five out of the eight groups will therefore have two European teams. The group stages of the FIFA World Cup Kata 2022 will last 12 days and feature four matches per day, providing all teams with the optimum rest between their matches and offering an exciting scale for fans with the possibility of attaining up to two matches per day. At the beginning of the tournament, Kata Compact Nature with no air travel needed to move between the venues will allow organisers for the first time to optimize specific matches details for benefit and comfort for supporters and teams and the media. With that in mind, while the final draw will determine the growth fixtures, the final match schedule will be confirmed after games have been assigned to stadium and kickoff time for each match day. In other words, based on the fixture in question, there is a scope to provide a more beneficial kickoff time for audiences at home and in need for fans in Kata. With regards to the stadium allocation, the addition of flexibility will not affect any technical aspects since all stadiums are located within a compact radius and pleasant weather is the norm in November and December in Kata, regardless of the venue kickoff time. Thank you so much for coming back to this channel and thank you so much. If it's your first time come across this channel, consider subscribing. By the way, don't forget to hit that notification bell. It will be the only way that will be updated when I upload a new video. It's mixed from the next question. See you again in the next video.


So late last night power world dropped a patch a patch notice for Xbox and Xbox alone That's a small patch. It's more like a hot fix But I believe this is planning for the future and I do believe due content will be coming very soon Indeed today. We're getting to all guys. How's it going people? My name is DPJ If you do enjoy this video leaving a like really helps out and if you like what you see and do you want to see Be sure to subscribe Okay, so yes a late last night as I make this video like 12 hours ago in the middle of the night for us UK folks I ain't getting out at bed at half through in the morning. In fact, I was probably awake watching shogun I just missed the notification. But yeah, okay, so this patch notes. It's like I say it's small But it's Xbox only it's patch version 0.1 point 5 point 2 And all this does is as you can see on the screen now fix an issue where save data larger than 16 megabyte Would not save correctly and fixed a multiplayer related bug which caused the game to crash Thank you for the continued support of power world now What I will say is from the feedback I've seen so far on this patch It seems as though many many issues with game crashes Xbox players were actually getting have been fixed now I can't say every single bit of feedback has been positive That's definitely not the case but the majority of it seems as though that the many issues players were having on Xbox were fixed now. I know there was a save data problem as well My friends actually had this for a while, but actually fixed under patch they posted before this one It actually fixed their save death in a lot auto saving where the game wouldn't auto save So you lose all the progress. I mean you can load up your world But then you couldn't progress because it wouldn't save so when you come back on to the game All that progress should done and completely vanished Now it seems for the majority of players that is fixed and it also seems now for the majority of players That the game crash problem a lot of the time it was players going into dungeons or defeating the bosses the game would crash It seems as though this has fixed the majority of issues there So that's a great great thing and what I believe this patch is and why it was for Xbox only because we didn't have these problems on PC I believe they are prepping They are preparing people for that future content. They promised on that road Map now I ain't gonna go into the road map now I've covered it so many times and just put on screen if you want to check it out You can see what's coming and what's new, but I'm right. I'm gonna read through all again. I've done this so many times It's like the only content we have as content creators together are updates right now as well as future Content, but there we have it guys a short but sweet patch for Xbox players Hopefully if you've had an issue Hopefully this fix that do let me know down below if you're still getting any issues on that Xbox I am curious to see how many problems people are having on Xbox have been resolved now and how many are still having those Issues, but yes guys as soon as any new information comes I'm power ward. I'm still playing on a daily by the way I'm still trying to perfect my base after I ruined it I'm still trying to perfect all my pals to get the best draws on each and everyone So I'm still playing the game on a daily. It's just there's not much to cover on it But as soon as new content comes I will have you covered right here on my channel guys But yes again a short but sweet video Let me know your feedback if you plan Xbox on the latest patch and hopefully guys. I will see you on that next one