Well not exactly, maybe we'll get more to that a bit later cause technically the set's not done but we're here to talk about some news because yeah some big news has happened in the last couple of days, we'll talk a little bit about the Kotaku situation later, that's right there's a situation with Kotaku, but first let's dive deep into what's going to happen here with the future of Nintendo Switch, the system right here, yeah there's a new one coming, probably not for a year or two but it's coming, it's probably an extra generation and we have some real information this time and not just your run of the mill rumor, so that's really cool, before we get into that I remind you we are actually giving away a Nintendo Switch OLED, a PlayStation 5 or an Xbox Series X, head to that link down in the pinned comment or in the description, alright so look, this is the Switch OLED, this bad boy came out last year and there were so many rumors surrounding this platform really starting with Takahashi Matsuzuki that got the ball rolling all the way back in 2019 talking about Nintendo's next system having 4K, having other feature sets like DLSS and obviously eventually leading to what we got here, 7 inch OLED panel, the kickstand but we never actually got that 4K DLSS, he claimed that there were like 10 or 11 different studios making games for this more powerful platform and that he expected it to get announced last year and come out and it never did, instead we got the Nintendo Switch OLED but there's nothing wrong with the Switch OLED on the surface, it's basically a revision of the original Switch, well people had wondered was he lying, is there some truth to this, Nintendo has said they're working on new hardware but they're not going to talk about anything, well here's what happened, Nvidia over the weekend got hacked and got hacked bad, they've already publicly come out and commented on admitting it happened and admitting that they're being held for ransom, the people who did this are actually seeking a huge chunk of money from Nvidia or they swear they will release the Kraken and make it so all of their GPUs can now become mining cards, for those who don't understand that we're not going to dive too deep into it, they have locked down their 3,000 series of cards to not really be efficient at mining so gamers can get their hands on it during the shortages and they're basically saying hey we hacked you, we have all the information, we can unlock it, pay us money or we're going to do just that, so very interesting but what came out of this for us and why we're talking about it here is because in these documents the few that they have put out there publicly to show hey look we actually did hack you and here's our proof and again Nvidia already admitted this happened is some information on the next generation Nintendo platform, I'm calling it next gen not switch pro because it is way too powerful to be just a switch pro, switch pro is always supposed to be a minor upgrade, this is significant and we have exact details because on the code base of this is some files called NSN2, now that's very interesting because the original switch was called NSN on the back end that's what their chipset was called, I'm not really sure if it means Nintendo Switch Network or whatever the heck the code name means but that is what it has been called this entire time getting back to when we first discovered it in 2017 after the switch came out, so NSN2 obviously is a completely different set something for Nintendo and what's interesting is when you dig into the files here holy crap one based on ampere you know what else is based on ampere the 3,000 series of GPUs that's right that's the current you know 3060, 3070, 3080, 3080 TI, 3090 that's the series that this is being built off of it will have DLSS 2.2 at least that's what the current version was in these files and yeah this whatever platform it is that Nintendo and Nvidia are working on will also obviously have 4k capabilities now I'm not gonna say 4k screen but likely 4k upscaling for output on a TV and yeah this is just really interesting ray tracing by the way was brought up that wasn't even part of rumors last year ray tracing is actually in these files as well so using ampere technology obviously ray tracing would be part of that so this is way way more interesting than I ever expected this to be and obviously significantly more powerful than I expected it to be now it's going to obviously be cut back power limited it's not gonna be as powerful as like a 30 you know 60 in a you know a laptop like this or whatever but what it will do is allow us to play PlayStation 5 games on the go or at home on a TV comfortably because they're using AMD technology and all they get to use is the AMD FSR super resolution which is great by the way there's nothing wrong with that Nintendo's actually using that technology right now but it's not as good as DLSS which is actually a hardware based way to increase performance and resolution yeah it's honestly Nintendo's in the right for in terms of how to do it best by working with Nvidia in this case now we obviously don't know the information the CPU there's no CPU information in here Nvidia doesn't make the CPU they get it from ARM and kind of implement it in and this is obviously a chip that doesn't exist anywhere there's not like a laptop equivalent or a desktop equivalent that we can go like okay this is what that will be because there's no clock speeds listed here there's no teflops or anything else that we can sort of guesstimate at what this is going to be we just know it's ampere architecture DLSS 2.2 which is the latest version and it was worked on literally a week ago in fact we actually discovered through the files that these files began all the way back in 2019 suggesting that that is around the time Nintendo started to develop their next generation system again not gonna call us a pro when you're going from this which is Maxwell you know a couple generations old to ampere that's a massive leap in technology one that only happens with brand new systems so this has got the world buzzing Nintendo's not happy reportedly anyways that this stuff got out because Nintendo doesn't like exact information like this getting out so what happens now well pretty much nothing Nvidia is gonna deal with this hack and they're gonna probably not pay the ransom and deal with the consequences from there try to figure out who did this and sue the hell out of them but that's neither here nor there what really matters is what's going to happen for the future of switch and that's the very very interesting question that I don't have an answer for and I don't know if you guys have an answer for it either it's very hard to think when this system could come out is it 2023 is Nintendo going all in right now you get those DLC updates for my credit deluxe through next year could they be they're gonna be ending because they're launching a new system next year are they launching this new system in 2024 and the thing is if they wait till 2024 there's already going to be a new Nvidia architecture like ampere is exciting to hear about today but will ampere be exciting in two years because you know the chip this is using was 2015 and released in 2017 so you might go man it's crazy they're using ampere but it's not going till 2024 that's right in line with this this was current technology in 2015 and then it came out two years later so if it's current technology today and it comes out two years from now it's the same pattern it also makes it more affordable and thus it actually makes sense but what's cool about that is PlayStation 5 and Xbox Series X are still gonna be relevant in two years in the middle of their life cycles kind of see what Nintendo is doing they're releasing these sort of in the middle of the competition's life cycles oh now we got you and we can sell into your next cycle kind of interesting Nintendo strategy here and I really really like it plus obviously I presume they're not going to go away from the handheld portable concept hence why they're still going with NVIDIA in the first place so I really like what Nintendo is doing I think this makes sense I think this is smart and it's nice to at least have some concrete details here coming from a legit leak rather than just baseless speculation or having to trust reporters like Takahashi Machizuki which I'm not saying I don't trust you but I am saying it is a bit hard to just yeah this is right and then obviously us youtubers get yelled at when it ends up not being right but then was it right this whole time but you just miss Keke they did when it was coming out because I'm sure there's depth gets out there right there has to be at this point was coming out in two years now this last story I got you're glad to the notes a little bit here because I got a question for you guys is this the end of Kotaku now we have Kotaku content on our channel we actually covered ported over a video that they refused to put anyone on their website back in the day for we use showing that kept the first video footage of the Wii U system so we long time ago took that and put that on our YouTube channel because I didn't think it was fair that people were forced to go to Kotaku to watch it in their ad riddle mess of a website that was it was almost impossible to get through I actually couldn't watch the Wii U video on there it was that broken even with ablocker so like I had to like dig into the code base and find the direct link and when I realized how hard it was for me to watch it was that hard for others as well so I said you know what Kotaku come after me I don't care took their video put it up on YouTube didn't even make a penny off it was no ads or anything but what's interesting is over the years Kotaku's developed a reputation it's really gone was going downhill before the former editor-in-chief Stefan de Tilo left and Jason Shryer left and it's only gone more downhill since they really politicized a lot of their content which people some people enjoy that I suppose there obviously is a crowd for it but a lot of gamers get annoyed when politics and personal agendas are just injected into gaming news however something's happening with Kotaku and I just want to briefly talk about this because I personally think this might be the end so a massive work strike is going on right now called GMG Union where a majority of the staff at Kotaku and other associated websites all under the same umbrella company like Lifehacker and Gizmoda are fighting for better wages and benefits as always and of course the reputation of many of these sites has actually nosedived over the years which makes you wonder what remains of their established audiences might start finding news elsewhere and not return and that's really where I kind of see this going is look I'm not saying don't fight for better I'm not saying don't stand up for your rights and better wages and better work treatment and fine right you guys do what you got to do I don't know what your wages and current benefits are now probably better than mine so I'm not gonna sit here and talk about it too much in that regard that's your personal finances personal you know treatment at your workplace but I will say you got to be a bit careful because already people weren't trusting those outlets and then there's already not a ton of these paid journalism gigs out there and guess what if people discover they can get their news other places and get it better and more informative and they might find out they enjoy that more whether it's from youtubers or other you know news channels and video game channels and tech channels you might come to find out that when the strike is over if it ever gets over there's no audience to come back to and that's why I think this potentially is the end of Kotaku and I don't think that is getting the leader anytime soon and there's obviously still some inherent value there you can just go click on any recent article there see I'm not saying go visit them but you can go there and click on some articles see they have much comments so they have an audience but the thing is how long will that audience stick around they've stuck around through a lot of other big S but if all their favorite writers are gone what then and I think that's what we're left with today and I think that's why you got to be careful sometimes knowing the position and power you have when you strike again not you know I'm not saying they shouldn't maybe they're treated like shit maybe maybe that's why they don't keep good staffers like stepping the Tilo Jason Shriver around because they don't pay competitively because the benefits suck but also gaming journalism jobs are kind of dwindling down as YouTube kind of becomes a place to go and not everyone's made to be on camera not everyone can handle the pressure not everyone can handle the stress that comes along with this and the constant being in front of people directly I can tell you someone who used to be a writer used to be a journalist it was hard reading some of the comments it's even worse when the comments can sometimes not even be about the things you say to be about how you look it could be about the way you carry yourself or the way you pronounce things but you don't have to worry about when you're typing oh I know how to spell words I know how to use them properly but then when you say them you might enunciate them weird you might have a strange accent you might not be attractive so people don't like to look at you it's it's a really weird space thankfully my audience has been pretty understanding but we've been at this a long time you look at some of my early videos God dang I had no camera presence I know what the hell I was doing I would probably be like this just staring at the wall oh hey hey guys how's it going this is probably the best side of me that you would ever see like oh man Nintendo Prime look at this all right folks I am the thinner of a chance for them to drop or the yes or what you're doing let me know what you think about this kind of basic set but I really like this there's a couple things still to happen but don't worry we'll have a full studio tour here I think by the end of the week if not next week there's still some things we're waiting on to finalize it but it's looking good it's looking clean we're gonna be back to pretty much a normal work schedule here that means that Nintendo Prime podcast should be popping off tonight barring any unforeseen difficulties I don't have the audio working on that set yet we got some of the fun angle with that but I want to thank you guys so much for tuning in you guys have been absolutely amazing I couldn't ask for a better audience thank you so much for the patience to get back on camera hopefully everything sounds great here and I'll catch you guys in the next video


Today we're going to do five poetry questions in five minutes or less. I'm going to show you how to handle these questions where they ask you to respond with specific lines from the poem. All of these questions are formatted in a similar way. They're going to ask you which quotation from the poem most effectively illustrates the claim. And so we need to know what that claim is. Fortunately, the text they give us is really, really short. You'll see here that it gives a brief introduction to the poem. The Raven is a Narrative Poem by Edgar Allen Poe, written in 1845. And then we get the claim. In the poem, Poe alludes to a dead loved one, and the author is teased by a talking raven. All we're looking for is a line from this poem that includes both of these concepts, that he mentions a dead loved one, and that he's being teased by a raven. So let's take a look at our answer choices. We have, first of all, from my books, Receives of Sorrow, Sorrow for the Lost Lenore. That might be the lost person that we're talking about, but I don't see anything about a raven. Quaffo, quaff this kind of penthen. Forget this lost Lenore. Quote the raven, never more. Now that sounds like the right answer. We mentioned the lost Lenore, but we also got the raven in there. So we have both parts of the claim that the question is asking about. B is your best answer. Our second question says, which quotation from Ozymandias most effectively illustrates the claim? And we can just read that second line in the paragraph. Shelley wrote the poem after hearing news from English explorers after their return from Egypt. So we're looking for something from the poem that supports this idea that some explorers had come back and told a story, and that's what he based this poem on. The first one says, I met a traveler from an antique land who said two vest and trunkless legs of stone stand in the desert. That seems like the perfect answer to me. It's literally telling us about travelers, which is the English explorers, right? And it says an antique land in the desert. We could infer that that would be Egypt. So A is our best answer. Okay, we got the road not taken. What's the claim that we're looking for? It says some literary analysts posit that the poem implies that the choices we make do not really matter. A says two roads diverged in a yellow wood, and sorry I could not travel both. And B one traveler long I stood. I don't think this really supports the idea that it doesn't matter because he felt bad that he could not take both roads. So it did matter. B says then took the other as just as fair and perhaps leaving the better claim because it was grassy and wanted wear. He says that it has a better claim like maybe one road was better than the other. So I'm not sure that this supports the idea that the choice doesn't matter. C says, Oh, I kept the first for another day yet knowing how way leads on to way. I doubt it if I should ever come back. I think this might be the right answer because he says first of all that you can keep the road for another day like you could always do the other thing later. And then also saying that way leads on to way. I doubt it if I'd ever come back almost like saying like, well, if you take this one way, it might end up in the other way anyway. So you might never need to come back and deal with this choice again. Like it almost suggests that it doesn't matter because one way will take you to the other way. Eventually, if we want to confirm it, we can look at D which says I took the one less traveled by and that has made all the difference. So that one clearly doesn't support the claim that leaves us with C. That's our best answer, which quotation from the chimney sweeper most effectively illustrates the claim. The claim that we've got here is that William Blake was critical of the industrialization of cities and wanted to highlight the suffering children faced as chimney sweepers. So we're just going to look for a quotation that supports the idea of suffering children.   Seems like he was sad about it, but I don't think that's too bad for the children. Let's look at beat thousands of sweepers Dick, Joe, Ned and Jack were all of them locked up in coffins of black. That sounds pretty bad. That sounds like dead kids coffins and children. That's not a good combo. I'm thinking that B is going to be our best answer here. Our last poem from this set is the poem Harlem. And we're looking for the claim here that says how instant suggests that the oppression of African Americans will eventually have harmful consequences for society at large. It's actually a really, really short poem. So it's pretty easy to go through all of the options here. Let's take a look at our answer choices. The first one says what happens to a dream deferred? Does it dry up like a raisin in the sun?  Maybe that's our answer. Does it stink like rotten meat? Well, okay. Yeah, it would smell bad, but I don't know about problems for society there. Maybe it just sags like a heavy load. Or does it explode? I think that last one sort of gives us a clear answer, right? Like explosion would imply that there will be violence or there will be problems if this dream continues to be deferred, which is essentially the idea that the American dream is being deferred for African American people who are not given the same rights and opportunities as everyone else. D would be your best answer. And I find these much easier than the typical main idea questions where we have to interpret the whole poem. In these cases, we just have to look for lines that match with the key concepts in the claim. So as soon as you see a question like this, just go straight to the paragraph, figure out what the claim is, and then look for an answer that best matches that, and you'll be on your way to a better score.


What is going on guys? It's your boy DPJ here today with another Destiny video and today we have the casual gamers review of the motherfucking grasp of Malak now.  I mean there's a lot of reviews on the internet about this but a lot of the reviews are coming from people who are amazing at PvP so they're posting footage of them absolutely wrecking certain weapons where when you try it you go out in PvP, use that weapon that's beastly for them and you don't do too good. That is the point of this casual game review because I am a casual gamer at best. I mean I ain't great at PvP whatsoever. So I'm going to take this weapon into a PvP gamer live for you guys.  Not going to post the best bits. None of that. I'm just going to play with it live and you guys will see how I do. Now the grasp of Malak is a weapon that drops from the Omnigul strike pretty rare. A lot of people grind for hours for this thing. It dropped after about 3 hours grind and that was quite a while back. I mean I was told that the roll I've got on mine is pretty decent as well. I've got Headseeker, I've got Glass half full and I've got injection mode for a little bit better stability. I mean you can probably get better stability roll than what I've got but I think I've got a pretty decent roll in terms of doing damage. So we're just going to play a game live for you guys.   Now I will give you guys a little bit of in-depth steps. I've got a written down on the screen because I've done my own research.   So this weapon will shoot 9 bullets per second. It will do 16 damage to the body and 23 to the head. Now this is all standard you've got to remember. This is all completely standard. So 16 to the body and 23 to the head. It will empty its entire clip in 3.36 seconds. Reload team. Reload time of 2.15 seconds. Reload in ADS ready time 2.24 seconds. Now damage per second to the body 144 damage per second to the head is 207. So this thing if you accurate and hit all them headshots and got a decent roll on it, stability, damage, whatever, whatever. You can drop somebody easily under a second so it's got quite a quick time to kill. Not sure exactly what that is. Actually that's something I actually meant to ask people on Twitter because I ain't saying. What is the health? How much health has people got in PvP? Is it like 200, 200, 5, 210? It will literally help me work out time to kill exacts. So I know with a little bit of an armor stat it probably increases a little bit but what is the standard health people have got in PvP? If you know let me know down below in that comment section. Like I said it will help me work out the exact time to kill for my next weapon review video. Its aim assist is 82, it's got an equip speed of 45 and a recoil direction of 59. That in last three stats I took off Destiny's Tracker. I'm not really certain of how to exactly measure the recoil direction and the aim assist. But there you go if you wanted to know them. That's what we got. I'm just trying to gain control and we're winning. I'm happy we're winning.   If I do bad you guys are going to see me do bad with this weapon. If I do good you guys are going to see me do good with this weapon. Like I said if you are an amazing player at PvP you can watch me use this.   Nah nah nah nah nah nah nah. You can't take me in my gameplay serious. Cause I'm not the best at PvP like I said. I'm not the worst I'm not the worst I'm just not the best. I don't even know I'm holding back. That's the point.  I'm dead. I'm dead.  It's just a tree. Oh someone's back at his spawn.  I can't get up.


Agriculture has so many issues in India, but the problem which we are addressing is inefficient uses of agriculture resources. And this inefficient use of agriculture resources leads to decreasing income for the farmers as well as the negative effect on the climate and environment. We identified that the problem of this inefficient use of resources is lack of reliable and scientific data with the farmers. So to provide them the data, there could be many options, but the solution which we are building is satellite-based crop monitoring for their farms where they can see their crop growth, the requirement of fertilizers, requirement of water, soil health, weather report, the value proposition for the farmer is the increased income, increased yield and less cost on the agriculture input. And for the environment, the value proposition is reduced greenhouse gases to soil-efficient use of water. We will be having two kinds of revenue streams. One is the advisory which we will give, so subscription as a service, the FAST portal. And also we will be doing agriculture input sale. Agriculture input sale, we have already started. In this financial year, we have done around 25 lakhs of Indian rupees revenue so far in the last 7 months. And we have a mission to reach around 1 lakh farmers in the next 5 years so that they can take right decisions for their farms. I am a misfit and I want to build for the future.


Well, it's that time of the week again. It's time for chitchat across the pond. This is episode number 758 for February 4th, 2020 Oh, hello 2023, and I'm your host Allison Sheridan this week Our guest is Bart Bouchotte's with programming by stealth installment 144 how you doing today Bart? I am doing good Um, I did I it's funny that you tripped on 2023 because since this decade has started I can't type the year because my brain here is 2020 and it's like So I've been typing 202. Oh one two oh two oh two and now two oh two oh three I thought I was the only one. That's exactly what I've been doing Yes, because it's 2020.  Oh sugar just gonna add a one or two or three Exactly. So anyway, there we are. Um So what the listeners won't know or care about because this is evergreen content is that you and I have had a small gap between part one and part two of this Very very related to installments here. So hopefully It sounds sensible when you listen to them back to back five years from now But we are on part two of our journey into shell scripting. I call it a journey. It's more of a brief holiday We're paying a little visit a tourist trip around shell scripting so In the previous installment we learned how to you know the basic anatomy of a shell script shebang line at the top and then Your terminal commands one after the other after the other and your comments with Pound symbols or octal torps or whatever we're calling them We learned that we can make variables We learned all the weirdness about you know accessing our variables with double quoted strings and we learned about single quoted strings and Concatenating strings by just sticking them back to back without even a plus symbol between them What else we learned last time that I think that's sort of the bulk of it But and I'm going to interrupt you right here as a setup for what you're going to say next After we worked on that I was working on making uh mermaid diagrams And I thought you know what I would really like to automate the way mermaid diagrams get created I would like to have a uh shell script that creates my mermaid diagrams for me And I thought okay, this is going to be great and I had went to do it and I said I don't know how to send variables into my uh my shell script Yeah, so what are we going to learn about and I ended up needing to know about something called exit code So what are we going to learn about today Barton? We are going to learn about those very two things because obviously if you just put a bunch of commands in a file It will do exactly the same thing every time Now mostly you wanted to do the same basic thing every time, but not Exactly the same thing every time. So you need some way of telling it. I want you to Do this thing with this thing And so we need a way of sending input and output now There's actually a grand total If you include all the inputs and all the outputs is actually grand total of six different inputs and outputs if you count them all Um, so the obvious one is you can pass it arguments, which you're going to talk about today You can also um, you can ask the user to type something in so you can basically prompt the user and say Please give me a blah blah blah. So we're going to learn about that today as well And the other thing you can do in terminal land is you can pipe things into a command, right? We we have done this many times where we some command pipe some other command Well, you can pipe things into your scripts Which also means that what have we got in terms of output? Well, you can pipe things out of your script through standard output There's also the standard error stream where your error messages go. So that's two outputs And then there is this weird thing called the exit code Which on the one hand is completely hidden and on the other hand is absolutely critical Because that exit code allows us to Take different actions depending on whether or not our terminal commands succeeded or failed or even how it failed because One of the things a creator of a terminal command can do is define the meaning of different exit codes You can say that in my command if I return with an exit code of 404 that means Something doesn't exist or in my command if I return an exit code of 101 It means you type the password wrong, right? You as a creator of the terminal command or shell script get to decide what the error codes mean and you put it in your documentation Anyway, we'll get to that later. So what I was looking for was something that would tell me is it going to fail And that got into some trickier stuff. I think I think that's called temporal mechanics Uh Yeah, well, I wanted it to check to see if the command was even there that it was trying to call Which is something we will learn next week. There is actually a way of doing that Okay, there is a very useful command called test But test makes no sense until we know what we're going to learn today because test is What is it someone once said, you know Unix is simple, but you need You need to be on lsd to notice the simplicity or something like the test command is It is sensible But only in the world of shell scripting So we need to get a little bit We're going to get our feet a bit more wet in that world and then we will come on to the joy of the test command Which is amazingly powerful So anyway, today we're going to look at three of the six possible ways of doing input and output And the reason we're not doing all six today is because in order to actually effectively use the pipe stuff We need to learn about conditional statements and loops And we can't really learn a recognition statement and loops this week. We need to do basic i o first So we're going to do half the i o within our loops and conditions And then we get to finish off with the piping stuff, which in some sense this ties it all together Because once you're into the piping stage your your shell script then becomes a first class citizen on the terminal Because the whole joy of the terminal is running this, you know, running your inputs through a sequence of commands Well, you can then start to chain your scripts together into sequences to do powerful things So that's that's why we're finishing there Okay, right So with all of that out of the way, there is a zip file for this installment But to be honest, I don't think a single one of the two files in that zip file is more than five lines long So you can probably just copy and paste but for sheer convenience. I've added the two files into the zip file anyway So I don't know one of them is 82 bytes part. I'm not sure It's about a character a byte although some of them contain smileys. That's two bytes for one smiley. So Anyway, um We will start with command line arguments because that is the most obvious way to push information in and out of a shell script So if you put A terminal command takes its arguments by having name of terminal command space argument space argument space argument If you want to pass arguments to your terminal command, you do exactly the same thing Um, but then the question becomes okay. That's how I send it to my terminal Or so to my script when I am in my script, how do I access them? Well, the answer is there is a variable called dollar one, which is the first argument There is one called a dollar two, which is the second argument and it continues add infinitum I think it goes up to 256, but it continues for some time And in case you're wondering why these computer scientists sensibly started from one for a change There is a dollar zero dollar zero is the actual command you use to call the script So our first example pbs 144 a dash args.sh Has the simple line echo open a double quote I am and then inside single quotes dollar zero comma my first arg is and then inside single quotes dollar one comma and my second arg is inside single quotes dollar two So if we run that script with dot slash pbs 144 a dash args that sh space pancakes space waffles That means that pancakes is our first argument and waffles is your second argument It prints out. I am inside single quotes dot pbs 144 a dash args that sh comma my first arg is pancakes and my second is waffles Perfectly sensible. I think I've seen this dollar zero dollar one dollar two nonsense in apple script. I think it does it the same way That is entirely plausible. I I know very little apple script. I know that if you do Regular expression matching in java script you get dollar one dollar two as well. I think Okay, I know and yeah, there are other languages that use them. It's a it's a it's a common thing Which yeah, so dollar one and dollar two etc are our arguments very straight So we don't have to save the arguments to a variable name. They have a variable name dollar one dollar two dollar three Exactly. They're just there for us to use which is fantastic The other thing we can do is we can ask the user for something right So and in fact if you once we learn if statements you can start making your terminal commands really friendly And you can say I'll go look for an argument and if I don't find an argument instead of throwing an error I can just ask the user for the thing. I want it So you could say if there is no dollar one then prompt the user to tell me their name or whatever as you can get very creative But the command we're interested in for getting input from the user is the read Command which is used for more than just reading input from the user But it's it's default behavior is to read from standard in And most of the time standard in is connected to your keyboard That's not true when you're dealing with pipes, but that's a problem. That's something we'll talk about You know the installment after next So for us today standard in is the keyboard. So the read commands default behavior is to read from the keyboard Uh, it needs one argument Which is the name of the variable it should read into in other words If you ask me for something from the keyboard, where do I put it? And you give it the name of the variable the confusing thing to terminal newbies is that Remember that the dollar sign is kind of saying fetch me the variable So the name of the variable doesn't have a dollar the dollar is how you access the variable So the first argument to go to read is not a dollar my variable name. It's just my variable name And that's something was Which is also true when you create a dollar. No, so it's just variable name, but when you call it, it's dollar variable name When you sign it, okay Correct and it's the same when you do with the equal sign right when you assign a variable you say, you know waffles equals pancakes And then the variable dollar waffles has the value pancakes because the dollar actually means fetch the value of Right. Okay. Okay. I think you told us that last time, but I think you should probably tell it to us every time I need to tell myself it every time one of the most common errors I get in with my work hat on when my shell script doesn't work is that it says there's there's no variable dollar dollar Whatever because I've put a dollar sign in when I name the variable Which then means it's actually when I try to access it. I should put two dollars in it Yeah, I do it all the time. I get around all the time. Which is why I keep repeating myself So we could use a read variable in conjunction with the echo command we learned last time and so we could say echo What's your name question mark and then we could say read space name Right and that would read the name into the variable name So That's two commands to do what's kind of one job I want to get the person to enter a name So to save you having to use two commands the read command has an argument called minus p or a flag called minus p That lets you specify a prompt So you can say read space minus p. What's your name? space name and that will Print to the user. What's your name and take the answer they give and stick it in the variable name So the advantage of that was just doing it all on one line instead of two lines It's all on one line. It also displays On the same line. So it's a little bit less cumbersome output because it's not a line of text and then a blank cursor sitting on an empty line It's That what you want and immediately the cursor is next to the question Oh, okay.  Yeah, it's up to you Some people then I notice that you also put you put a space after you said, what's your name? You put space quote that way when they write their name, it'll be After it'll have a space in between Correct, which I discovered after running the script once again. Well, that doesn't look good So then I did it again Um, so we have our second example Which is just a little three line script says read minus p. What's your name into name read minus p What's your favorite fruit into fruit and then it echoes out inside double quotes high dollar name comma have some dollar fruit And then we close the dollar we close the double quote because the variable we called it fruit But I want to make it plural So then I immediately stick on to the end of it another string with single quotes with the s followed by space Followed by smiley and then I close my single quote. So that's two strings concatenated by just shoving them next to each other So when I run that command and I enter a bar to an apple you get a high bar to have some apples And it means my face So that's a good reference one for us to remember how to do that concatenation you asked us or taught us last time Precisely why I did it And it's something that comes up quite a lot actually playing around with those different strings and stuff So that's two out of our three methods of input for today. So What if my favorite fruit was bananas To have some bananas is Ah, yes, uh pluralization is surprisingly difficult in error messages With my workout on I tend to put s's in brackets a lot Oh, because I might be plural might not be might be plural might not matter moving on there is an amount of yeah There has been an amount of error I hope they're singular Anyway, it is a lot of error reporting end up doing Um Okay, so the last thing I want to talk about which is probably our biggest topic for today is exit codes So every time any terminal command finishes running the last thing it does as it hands back to the shell So a shell runs commands on your behalf The last thing a command does as it finishes is hand back to the shell an exit code Or if the command falls over in a giant big heap the shell will make up an exit code of I think one For I don't know what happened there, but it that guy just went away. I asked him to go do something and he vanished You know error code um, and so That exit code is a way for the command to signal What it did programmatically and so they're just a range of numbers from zero to 255 Because you can't have 256 anyway from zero to 255 And the person who wrote the command gets to decide what it means so a lot of A lot of times when you look at the man pages for a terminal command There'll be a section near the bottom called exit values or exit status or return codes or one of the very euphemisms for exit codes And it will just list the numbers and what they mean So I just basically picked internal command at random because I happened to have done a backup recently I would just went man or sink to see what was in there And lo and behold at the bottom of or sink is a very long list of error codes So error code zero means success error code one is syntax or usage error error two is protocol incompatibility error three selecting input or output files error four Requested action not supported an attempt was made to manipulate 64 bit files on a platform. They cannot support them And it goes on Actually, it's strange. I've got to go back and look. I had an rsync error that it needed to say Uh, your friend's house where you put your uh, your other Synology that you're backing up to using rsync had a power outage and I didn't come back up That's what it is to be Probably some sort of connection error error in socket. I owe. I'm going to guess probably error 10. Yeah, I'm gonna have to go find out hmm so anyway, they all have them and The one thing that's in common always Is that very counter-intuitively? zero means success Hmm and in almost all of computer science zero means false or not Or no, right? It's like not good And one means true or happy or one, you know, one is true Whereas here one is just the first of another 254 error states Right everything that isn't zero is bad Zero means nothing went wrong. Everything else means something went wrong And I have the choice of expressing that somethingness with these 254 possible numbers so in my brain I remember this counter-intuitive fact by never mentally calling them exit codes. I call them error codes in my head Oh on purpose zero error Zero error is how I remember that at zero is good Okay, now very careful when I type things and when I write documentation and when I you know when I'm communicating One of the nerds I'm very careful to translate it back to the proper usage of the word But in my head they're error codes And then I remember zero is good zero error. No problemo. All happy. Okay. Yeah. Yeah, that makes sense So these exit codes are always returned to the shell But we don't see them right when you run the ls command to have a look at a directory It returned an exit code of zero unless you ask it to list you a directory that doesn't exist So in order version you use some other exit code But you don't see that right it doesn't print out the list of files and then a zero Right. It's right invisible But it's not Invisible it's actually in a variable. It's in the specially named variable question mark Which you access with dollar question mark So if you say echo dollar question mark, it will show you The exit code from the previous command. Oh, wow Which is very useful when debugging things So I guess And the exit code of the echo command will be zero. So if you type Some command and then you say echo dollar zero dollar question mark It will give you the error code and if you do echo dollar question mark again It will not give you the error code anymore because the previous command is now the echo command which succeeded So we'll be back to zero So you really do need to check the exit code immediately and you don't get a second chance Because right you run another command. It's now something else So the exit codes Yeah, the exit codes are always there Therefore you can always access them with echo dollar question mark Can you do that inside the script? You can Because you've told it some command to do and you can so you could do that as as error checking maybe within a script Absolutely, you can so you can either just do it in the sense of I don't really care what went wrong if something went wrong do this Or you can use it in even a case statement and the terminal our bash has a case statement So you could actually say Case zero echo. Yay, you know, and then a different case for each of the possible What is case? I don't know what case is Sorry case is the equivalent of switch in javascript So you would say switch a and then you can say case It's like doing an if else but instead of typing if I see to say case one case two case three case four So instead of saying if For the case that the variable i'm switching is a one do this for the case that the variable is a two do this It's like saying if x w equals four do this else if x w equals two do this else if x w equals three do this Right, that's really cumbersome to type out So the switch statements that you say switch x case one some code case two some code Oh Yeah, I'm sure maybe I didn't talk about it in javascript There was a lot of episodes though I was gonna say if I did it would have been a roundabout. I would guess episode 14 or 15 Which is a we while ago 42 years ago Yeah, yeah fair yeah, but luckily we all know that my mind is like a steel trap and nothing has slipped through and in uh all these Right not a wine ball that you're trying to pour it into from a fire hose definitely not I do adore that analogy from your dad um Anyway, yeah the point being you can absolutely use those exit codes in your scripts to make your script react differently Well, the most simplest thing to do is to make it react to an error Just to make it do something sensible when anything went wrong Or you can use it to be very intelligent if you're using a command with well documented exit codes Then you can actually You know Save dollar question mark into a variable and then really do so work with that variable and have a bunch of different You know if statements and whatever It all depends on how important the thing is Like if your script's whole job is to do a certain thing and react in a sensible way Then you may spend 10 20 30 lines of code dealing with the possible exit codes because it's really important Or you may just not care. You may just think I think it worked Or it didn't and then you just write a very simple piece of code I'm I'm stuck on that. I don't understand what it can do other than succeed or fail Okay, so the the command returns an exit code at its discretion so it can use that exit code to tell you why it failed Okay, but you you talked about us writing the exit codes That we can write it. No not yet something. Oh I will be saying that but I haven't said that yet Okay, so you asked can I use these exit codes in my script? So in your in your script you might do something like Or sing I might do our order to know Okay, and our sink is going to spit back these pre-defined exit codes that the command our sink has to it Okay, correct. And so if you're doing an r sink and it's really critical to your script functionality Maybe maybe the functionality is like if or sink doesn't work try ftp Or maybe the functionality is if or sink fails for this reason then email Ron because his power is gone If or sink fails for this reason email steve because he's hugging too much bandwidth I mean I'm sort of making it up as I go along here But you may want to do different things if something like there is more to being broken than just is it broken, right? I think it's one of the when I put my work hat on I think the thing I hate most is when someone comes to me and says It doesn't work And they cease speaking It's like, no, no that is the start of something useful What? You know what should have happened. I'm a few more bars for me Yeah, exactly exactly that is the that is the perfect response because I generally just give a dirty look and sort of the gesture of, you know, continue Yeah, that's Exactly exactly. So anyway, yeah, the exit code is when they tell you Some completely extraneous piece of information that takes them forever to explain that you already know has nothing to do with this I had a woman on the ship who was on the cruise. We were just on who Her phone couldn't get email and she was convinced it was becomes because some website made her do two factor authentication And I could not get her to stop telling me about two factor authentication No, no has nothing to do with this problem She was connected to wi-fi Yeah, that knee bone is not connected to that ear joint, which doesn't even exist Yes, anyway, so you we can make use of these exit codes and zero good anything else bad Just different shit different flavors of bad, but zero good everything else bad so How does that affect our script, right? So our script is a collection of terminal commands If we use our script within Another script or within a terminal command Shouldn't it also have an exit code? Why yes, it should And the exit code of your script will be the exit code of the last command that ran Now at the moment since we haven't learned a bit loops or if statements or anything The last command to run in our script will be the bottom command at the script But as your scripts get more complicated the last command to run could be halfway up your script If you have an if statement or whatever right that that changes where things flow So your script Its exit code is the exit code of the last command to run There is a command whose specific job is to end a script With an exit code So if something goes wrong you can say exit space and then you type a number And so you can then decide that if You know my script is only supposed to run on a wednesday because that's when this business process happens And if someone runs the script on a thursday, I exit with code one And if Someone who's not an admin tries to run the scripts I exit with code two because actually I need to be an admin Because otherwise I know that something will fail Or you know you can start to build up these reasons and you would have them in your documentation So you then say if day of week not equal to wednesday exit one if You know user not in group wheel Exit two All right, you get the idea right so By default your script will end with whatever the exit code was of Whatever you last ran which is hopefully a successful exit code But if you want to end the script the command to end your script is exit And by default you exit one Actually, no by default you exit zero. I think we default your exit success But if you want to exit with a specific exit code then you exit Space the number and you can you can end your script early with a successful exit code by saying exit zero or if your script is supposed to Check if something is true and if it's not true make it true Well, if you check it's true and it is true your script is finished successfully So you can just at the very top of your script say if this thing exists exit zero And that will show us a successful execution Even if you didn't finish the script Okay So it is just basically think of them all as being functions that returns true or false Only instead of false you get to have lots of different shades of false Okay Now this is where Things get interesting We're now laying some really important foundation, which is so important. I want to say it twice So we're doing it today And then we're going to revisit it at the start of next time's discussion Which is all about if statements and loops and stuff because central to both conditional statements and loops are Basically boolean logic right checking for truthiness of some kind right and if statement Evaluates to a question of truthiness a loop continues until something truthy becomes faulty Right, you know the concept of truth and falseness is central to conditions and loops And the terminal does not have traditional booleans The terminal uses exit codes As its way of telling truthiness So an if statement on the terminal Looks at the result of a command To decide what to do and the way it looks at the command is it looks at its exit code So that means that everything Logicky on the terminal is in exit code logic Which means that if you write it down as a traditional truth table, it looks wrong to a computer scientist But if you write it in English, it looks correct So there are two boolean operators that are very important ampersand ampersand means a logical and And pipe pipe means a logical or And so normally in normal computer science world One and one is one or true and true is true In terminal world Zero and zero is zero Because if you say it in English it's fine is success Correct But is what is what is one and one? Well one and one is error and error is error So one in one still is one That is true, but so is two and one and so is 56 and 32 So actually the rest of the truth table becomes really confusing So the next entry will be zero and anything greater than one is one because success and any error is error I'm gonna correct you zero and anything greater than zero is one That is certainly what I tried to say. Yeah, that's so what I said that I was wrong So one and above as long as there's a one basically if there's any kind of a false in there An error in there it turns the the combination becomes an error Yes, okay, exactly. So greater than zero and greater than zero is one And there's also the or operator right, okay. Yeah, there's also the or operator which is Zero or zero is zero because success or success is success And then zero or greater than zero is Zero because success or error is still success Greater than zero or wait stop I want her to head Well, but explain why why is zero and and one zero or Zero or we're on the or table So true or false is true Why so zero Because that's how or works or means either of the one or the other is successful Only if that's what you only if that's what you ask it Okay, but i'm describing the rules for or so the rules for or are by definition True or false is true. That is the definition of of or okay. Okay. I forgot that all right So that means in terminal speak success or success is success success or error is success Error or success is success. The only way to get an error is error or error is error And that is super fun in an audio podcast for people absolutely however This is actually these two tables combined with a technique called lazy evaluation Gives us really Powerful quick to write if statements that don't even involve the word if Now bash can do way more and we're going to learn the way more next week But lazy evaluation is where the so in order to evaluate a true or false statement So you use the and operator There's something on one side of the and and something on the other and the answer of that whole statement Is going to depend on the rules in those two tables The way bash does it and this is common to a lot of programming languages Is if the first Result means that it doesn't matter what the second result is the outcome is already known The second one is not executed And that is guaranteed to you if I know enough after executing the first one I will not execute the second one. I will immediately return the result of the Operator and that's called lazy evaluation and that is a feature not a bug So would an example be um, I'm going to use and And I've already given it a what I've gotten an execute of one for the first thing and then it gets to the and It knows that the answer is going to be false Or error. Yes, precisely precisely and therefore will not do the second But if I gave it a one and an or it's like, well, I don't know I got to execute the second one Correct. Okay, and the inverse of that is also true. So you can use the two operators to achieve two things Only run the second command if the first fails And the opposite thing you often want to do Only run the second command if the first succeeds And they're both really powerful things to want to do Yeah, yeah, so to make it real world Here would be a snippet of a shell script that exits my script with a 404 error If we fail to restart the engine x, which is a web server So the command to restart engine x is system ctl restart engine x dot service, right Take it for me. That's just how it is in linux land. So I say the command a lot of times Yes, you have which is why I picked it. Uh, so system ctl restart engine x dot service or exit 404 So the exit 404 will only happen if system ctl is error Because if system ctl is true is success Give me a second to exhort observe this see if I can Follow what you're saying. So you've got a command or exit 404 If the first one succeeds By definition when it hits the or it's got to go to a sec. Well, no The opposite. Oh the opposite it will it will only Because it's success or anything if it if it succeeds It knows it succeeded it doesn't do the next thing Correct, but if it fails Then it exits 404, then you know it's an error and therefore it should execute the 404 Yeah, or I mean it doesn't have to be like the the thing after the or could be any other statement, right? So maybe it's you know logger to send something to syslog or Whatever you want to do in response to the error But you know exit 404 seems like a sensible thing to do because then if your script fails with an error 404 You know because you wrote it ah 404 engine x is cranky if it x is with 303 Maybe something else is cranky, you know, maybe my sequel is cranky or something, right? It's up to you to decide What your exit codes mean, but you can use that to then be more intelligent about things Or you could just use an echo statement and you could just say or echo It makes sense having followed that that truth table with you, but reading it looks funny command or exit 404 But is it so funny though if you say it out loud start engine x or be cranky It actually does kind of work in pseudo code, right? Yeah. Yeah And then the opposite thing what you also want to do very often Is do something and only do the second thing if the first one succeeded And the the use case for that is test the engine x config Then restart engine x because engine x can be running with a broken config because it only checks its config on start So it's very common to have a web server hosting, you know 50 websites for a large university And then you go make a small change because someone wants to change a redirect, you know forward slash twitter to go somewhere else or whatever Well, if you made a typo and you just type system ctl restart engine x you've just taken 50 websites off the air That is that makes people cranky at you So what you really want to do is a config test followed by the restart and so engine x minus t will do a config test So if you say engine x minus t ampersand ampersand system ctl restart engine x Well, then the restart only happens if engine x minus t succeeds Right, right, right, right, right. So it has to get the exit code of zero Because it knows when to hit the ampersand that if if it's got a one, it's not going to do the second thing. Oh, wow Correct. That's a good practical example Yes, and you use an awful lot because it's so much easier to just type ampersand ampersand or pipe pipe than it is to do a whole if statement So you will see a lot of this kind of you know, do something or be cranky or do something and follow through And that's basically the hat. That's how you do it in terminal land But of course you could do more with if else an elif which is the terminal's version of elsaif But as we learn in the next installment the terminal is very verbose about its if statements because It's not a statement. It's actually a whole bunch of commands So it takes one two it takes at least three commands to do an if statement on the terminal Up and it could be many more whereas this is just a one liner So this is why shell script geeks love these little ampersands and ores because they're so much easier than if But if it's fine as we learn about next time it does work and it's very powerful, but it's a bit verbose. It's a lot of typing Um, so yeah, anyway, that's where we're going. So At this stage, we know how to write a script. We know how to put some variables in it We know how to take input from the user in the most basic way So as arguments just asking the user we know how to return exit codes We even know how to use those exit codes for some basic logic Which means we're now ready to move on to what I think is the Is the is the raison d'etre for this entire little mini series The ability to control the flow of things inside the shell script in other words if something is true do something else and obviously keep doing this For this many times or until this thing happens or until this thing doesn't happen But basically the the ability to to branch and to loop And that that is what gives shell scripts great power And so that will be the entire focus of the next installment is that you know branching and looping And that will set us up perfectly to finish our exploration by looking at the plumbing as I call it in other words piping stuff into your script And making sure that your script plays nicely with people taking its output as a pipe into themselves So basically can I see it in the middle of a pipe? if you want to read ahead on uh doing the terminal plumbing bart did cover this in installment 15 of uh the taming the terminal series And there's a link in the show notes of course to that Yes, so that will explain the plumbing, but of course what we we're going to learn is how to play nice How do we be a good elbow joint? It's I guess How do you make stretch my analogy? Yes, exactly All right, how to be a part of the plumbing instead of just using it to connect together other people's commands All right, my script should be able to sit into That structure and play nice with with all the other terminal commands and scripts and things And so that's that is the final piece and then Then we have all of the tools we need to automate because there's a whole reason we care about this Is to automate our build process in our code Because now that we're starting to use lots of different tools to make complicated code that needs to be Built into a final version and stuff there's actually quite a few commands to go from source code to working product And I'm a lazy sod I'm also a typo prone sod so I need to script this stuff for my own sanity and for my own consistency and so that's why that's why we're doing this and so That's why this is only a short dip into shell scripting instead of you know We could spend months actually no us being us we could spend years Shell scripting but we're not going to so that's that is where we stand like learning this and This is the kind of thing had you taught me this four years ago I would have said I don't have anything to automate And it's been interesting watching the number of things that I've started to think hey I could do that faster I could do that without ever typing it the first time And now I'm in the mode where when I start to work on something I'm like That I'm going to do that twice. Let me automate that before I even start Again because yeah, or because the error code is always one when I'm doing it by hand Right and it's a good way to think about things right if I can express what I want to do as a piece of code Then I have to think about it logically for a start So I'm more likely to get it right but also I now have it versionable So the process has become something in version control And that's actually very powerful because you're in a captured process. So particularly on a shared team Capturing process is actually very powerful Yeah, yeah Well, this is fun And I'm glad for my first show back after a vacation that you would you went easy on us here Well, I went to believe it or not, right? This show was really fun to record and it wasn't very long But this is the most difficult one I've written in as long as I can remember really because Finding a path through what I want to do that doesn't involve me saying now ignore this line. We'll learn about it next week Okay, so hard to find your way around, huh? Okay I had to tiptoe my way around and it just was not coming together And I you almost got a panic tech message from me about eight hours ago, but then just the time everything fell into place So we did make it the anyway. Yes. I'm let's stop rambling on Let's keep it a short show and remember folks very important until next time happy computing If you learn as much from barn each week as I do I'd like you to go over to let's dash talk dot ie And press one of the buttons over there to help support him He does 98 of the work here I'm just the stooge that listens to him and asks the dumb questions If you go over to let's dash talk dot ie you can support him on patreon You can donate via paypal or you can use one of his referral links I really hope you'll go over and help him out in the meantime You can contact me at pod feet or check out all of the shows we do over there over at pod feet dot com Thanks for listening and stay subscribed


What's going on everybody? Welcome back to another video. Today we're going to be talking about SaaS. A couple of weeks ago I was invited out to SaaS Explorer, which is their big SaaS conference out in Las Vegas. Now on my channel, I have recommended in the past for people to learn SaaS for statistics. That's really all I've ever personally used it for, but I had a feeling it did more than that. So when they mentioned that this conference was going to have a big focus on AI and analytics, I really wanted to attend because I wanted to see how these large companies were going to be integrating AI into their software. Now, although AI and generative AI was the main focus of this conference, they still had all these booths in this giant room with everything that SaaS actually did. I honestly didn't know that SaaS did all of those things. I really just thought it was for statistics and that is in the name of SaaS, but they do a lot of other things like data engineering, computer vision, augmented analytics, data governance, and a ton of other things as well. And so I was just kind of nerding out at every booth. I was asking a ton of questions and really digging into how each of their systems work. And they honestly looked really cool. And to now looking back, I feel kind of bad because I've only ever talked about it for statistical analysis, and I didn't really know or understand that I did all of these other things. But one of the things that interested me the most and something that I specifically came out there to learn more about was AI and generative AI within SaaS. There's really only two different things that I wanted to talk about in terms of AI and generative AI within SaaS. I just thought was really, really cool. The first was how they can create this synthetic data that you can use to test for specific use cases. It's basically fake data that you can create for all these what if scenarios, what if this happens and you can test the data on it to see what would happen in that scenario. That alone is a really great use of AI. And they gave an example with kidney disease and kidney transplants in healthcare. And I'm extremely familiar with that area. And so I thought the use case that they gave was really unique and something that I thought would be really useful because I've actually worked with that data before. I could absolutely see myself using something like that using this fake synthetic data in order to test all these hypothesis or all these scenarios. The second thing that I thought was really cool is that they're implementing LLMs throughout their entire product. So at every single level of their product, you're going to be able to just chat with your data and ask questions and kind of get some of the low level tasks done quickly. That's something that a ton of other really big tech companies are trying to do and SaaS is actually doing it. So it's just really neat to see how they're executing it and how it actually works. All that to say, I feel like I need to dig into SaaS just a little bit more to really understand it and see everything that it can do. Huge shout out to SaaS for bringing me out to the conference. I had a wonderful time and I got to spend time with some really awesome creators in the data space. If you liked this video, be sure to like and subscribe and I will see you in the next video.


Okay, so this presentation goes more in depth about how to work with these containers and what kind of functionality mainly Docker has. So again, we have seen this slide before, two important concepts. So you can compare an image to a recipe, and you can compare a container to an actual dish while the image actually contains all the instructions in order to have this container running. There's a little bit more to it. For example, that an image almost always has multiple layers. So it has multiple layers on top of each other. So we have now seen the Ubuntu image. As you can imagine that if you do an additional installation and make an image out of that, you have an extra layer on top of that Ubuntu image, meaning the installation of figlets in this case. And if you make an image again out of that, you have multiple layers. And of course, you can imagine that you really can really have a lot of different layers for a container. Funny thing is, and we quickly touched upon that already, is that where the analogy between a recipe and a dish stops is that you actually can make out of a container, you can make an image. So we quickly touched upon it during this quiz question we just saw. And that's actually possible. And if you have a recipe and a dish from a dish, it's very difficult to make directly a recipe, right? But you can make an image out of a container. So this is how that would look in terms of a visual representation. So we have these different layers. So for example, we again have the Ubuntu base image. Can be any other base image, but let's say we have a Ubuntu base image. On top of that, we do an installation of Python. And that will be an additional layer for our example in the exercise that will be the installation of Ficklet, for example. And again, on top of that, you, for example, install Python. And then there is a layer added actually on top of that. And that's actually the writable layer. And that represents the container. So if you want to create an image, there are basically two ways to do that. First and foremost, and that's the most used, and that's the best practice, is to use a Dockerfell. We will learn much more about that in this lecture and later on in the afternoon during the exercises. But you can also, as I said, in the slide about the analogy, that you can make a image from a container. So what you then do is you use Docker commit. And what Docker commit does, it actually makes your container from writable to read only. So it kind of fixes the container as a layer on top of your other image and makes an image out of that. So in principle, what we could do is we have our Ubuntu image. We do an installation manually inside the container. Then we go outside the container and we run docker commit. And then we actually kind of freeze that container layer and make that read only and make an image out of that. And then we can store our Ubuntu image with a layer on top of that with the figlet installation and store that as an actual image. And we will do that in the exercises later on. So we will use Docker commit. However, it's not recommended to use that too often. Related to that, I have a question for you. So I will stop share and reshare. Here we go. So mention a few times. Using Docker commit is not very reproducible. Why do you think that is the case? Most of you have answered. So we'll stop. If you haven't answered yet, it's completely anonymous. No wrong answers. Or there is a wrong answer, but nobody will know. Okay. Here we go. So most of you answered all of the above. That is actually the correct answer. So I think the first one, you might have hesitated about the first one the most. In order to recreate the container, you will need the entire image. Yes, that's the case. And that's actually almost always the case that in order to recreate the exact container as somebody had it running inside their computer, you will almost always need the image. But what we have also learned and what we will learn more about is that you can describe an image through the Dockerfile. And if you only share the Dockerfile that describes the image, you can actually build the image from the Dockerfile. So that's what I meant with in order to recreate the container, you will need the entire image. But you can also share the Dockerfile, which can be sometimes a better idea of actually usually it's a good idea to both share the Dockerfile and the image. Well, and most obvious one is that with Docker commit, you do not by default describe the exact build step.  Why is that? That's just because by default it's not written down what exact steps you have done, at least not in a standardized way. In addition, and that's related to that it's difficult to trace back software version, for example, for if you so it's not necessary that if you do all these installations that you specify the software versions. That's actually also the case for Dockerfiles. You can write Dockerfiles without specifying versions, of course, and therefore it still can be relatively not so reproducible, but it's easier to add the software versions to the Dockerfile. So therefore, all of the above are correct. Okay, then we go back to the presentation. Okay, then about Dockerfiles. If you work with containers, if you develop containers, you will see those a lot. And what they are, they are just a set of instructions on how to add layers to an image. And also it has some instruction on how to modify settings of a specific image, but most and foremost, the most important reason to write the Dockerfile is to give a set of instructions on how to add layers to an image. So how does that look? Well, this is an example of a Dockerfile. And basically it just builds those layers on top of each other. So it says from Ubuntu. So that's usually one of the first lines in a Dockerfile from means this is my base image. So I'm going to build upon this image. And that can be or that has to be a image that is present in Docker Hub. Of course, we have been talking about version already for a bit. Usually what you would like to do is to specify also the version you will need over here by attack. And we'll learn about that more later on. Let's say we don't do that. And we have our first layer, which is the Ubuntu base image. Then we do some installations using Appget. In this case, we install both Python and PIP. That will be the second layer. And then the third layer will be run PIP install Python, where we actually install Python using PIP. That will be the third layer. Once you have the Dockerfile ready with Docker built, you actually are building the image. That image will appear inside Docker. You can see it by using the Docker interface or using the command line interface. And you will find out, find that that image was actually built. And you can use that to actually make a container out of it, for example, or, for example, share it through Docker Hub. So this Docker engine, Thomas has a question, I think, or not. Oh, your hand is still there, I think. Yes. Okay, so to manage all these images and containers, we use the Docker engine. And the Docker engine is a demon process, meaning that it basically always runs in the background. So it both manages the images and the containers. Nice thing about this demon process is that, for example, these layers, they are very efficiently handled. So if you are in the process of building a container, for example, what you can do is, for example, build the first part of your image, add some lines to your Dockerfile, and build it again. So what caching them does is it will not try to build the entire image from all these lines in the Dockerfile, but only will try to, so we'll use the layers that have already been built, and then use the line that, so the loose layer that is added to the Dockerfile, and only will build that part. So that makes development of these containers very efficient, and it can only also reuse different layers. So if you have two images on your computer that share layers, for example, you have Ubuntu image and an image that is based on Ubuntu image, it will not store both full images on your computer, but it will only store the layers, and it will know which layers are in common between different images, and also between different containers. So that's very nice. However, one thing that is maybe not so nice, it depends on how you look at it, is that you cannot interact with containers and images through VALs. So they are not available for you as a VAL, so there is no VAL containing the actual full image that's there. So the interaction with these containers and images only happens to the command line interface or with the use interface, but usually with command line interface that is there brought to you by the Docker engine. So some examples of this command line interface that we'll use a lot if you are working with Docker is one we have already seen. No, this one we haven't seen yet. In order to give a list of images, you can type Docker image LS and it gives all the images that are available locally on your computer. You can of course always add images just by downloading them from Docker Hub. And this one we have seen before, Docker container LS, which will give you all the containers that are currently there on your computer, and it will also give you information about which image the container was based on. So let's say you have built your great image with, for example, the figlet installation. I think, well, this is a great image. I want to share it with the world or at least upload it to some repository. So usually what people do is working with Docker and you don't really care about whether other people can download your image. You use Docker Hub. It's very easy to interact with the Docker command line and Docker Hub because what you do is you just type Docker push and then the image name basically and then they'll push it to your repository on Docker Hub. That goes also quite efficiently because what Docker also does is checks which layers are already there on Docker Hub and it will recycle these layers in order to build your image. So it will handle storage very efficiently. Of course, there are also alternatives to Docker Hub, a very frequently used alternative is koai.io, which is owned by Red Hat. We have also for singularity images, we have singularity hub and we have both the GitLab and GitHub container repositories and many, many more. Ruben, did you have a question? Yes. I have a question regarding Docker Hub. Is it also working as a version control system or is it just a repository where you just upload the image and you don't track version control? It's not there for version control. So usually you do version control at the level of the Dockerfile. So for example, very common, what's very common is to have your Dockerfile, for example, on version control by Git and you have it on GitHub or GitLab. And from that Dockerfile, you build an image and that one you upload to Docker Hub doesn't mean that you cannot have multiple versions of the same image. Actually, it's very common to have multiple versions of the same image and we do that with tags and we will learn mainly about tags in the exercises. But one thing that's important to know is that you have one very important tag and the tag is latest. And latest, you can kind of compare with the master branch in Git, which is basically the latest image that is there. So usually, what people do is they want to download the latest image because it's the latest version. And then different versions, they can have different tags. So you can have version 1.1, version 1.2, 1.3 and that's specified in the tag. If you directly push to Docker Hub without specifying the tag, it will just override the latest and it's quite similar as you would do with Git. If you don't have a branch and you just directly push to your repository, it will kind of override the master branch or the main branch in GitHub. That's kind of how it works. But you will play around with it a little bit or quite a bit actually in the exercises. An alternative to not using repositories would be the command Docker save. And Docker save stores your image as a file. So in that way, you can really share your image with others as a file. But then you lose the functionality of all these layers. So it then will fully take the entire image stored as a file if you then have a different version of your image and you want to store it as a file. Again, it will store all the layers again in that file. So in terms of disk space, that is not a very efficient way to store your images. But if you don't want to rely, for example, on Docker Hub or any other repository that could be a way to save and share an image. Another way to share an image would be through the Docker file. Of course, that's not actually sharing the image. It's sharing the description of the image. But with a Docker file, two things are very nice about it. You know exactly what is done in order to build the image. So you have a pretty good idea if you want to change the image that you can also change the Docker file and then rebuild that image, for example. Another nice advantage of it is, of course, that's very small. You just have a flat file there. So a disadvantage of only sharing Docker file is, of course, if things change and if versions are not properly specified inside your Docker file, rebuilding an image with the same Docker file can give a different image two months later, for example, just because software versions changed in the meantime. So usually if you share an image, so let's say the conclusion of this story, usually if you share an image, you share both the image and the Docker file together with it. Okay, I have a question for you. So my question is, what's the best way to share an image in the context of reproducibility? Is that as an image on Docker Hub, as a tariff file or as a Docker file, a good repo? And over here, there's not a correct answer. It's mainly to ask you what do you think is the best way to share it in terms of reproducibility. Most of you have voted, so we'll stop. Okay, so most of you thought as an image on Docker Hub. Not a lot of thought as a tariff file and, well, second most of you thought as a Docker file and get a repo. So we need all three of them as we just discussed and have their advantages and disadvantages. So if you share your image as an image on Docker Hub, that will be the exact copy of, so if somebody's downloading that image, it will be the exact copy of the image as you have intended it to be. However, the person that is using that image locally doesn't really know anything about the history or how it's built or what kind of software was used in order to build the image, what kind of installations were used. And that is not super reproducible, right? So, of course, you can reuse the image. So being reproducible and exactly doing exactly the same thing. But it's not very interoperable, meaning that you cannot really disentangle the image and use the thing that has been built by somebody else in such a way that it actually can be applied to your specific problem. So then it's quite difficult to actually apply it to something slightly different. As a tariff file, well, it would be quite similar to sharing it to Docker Hub with the disadvantages of having to save the entire image and having to ship quite large files. As a Docker file in the Git repo, well, the advantage there is that you exactly know how a container was built, but rebuilding it might not result in exactly the same image a few months later. So that's why the best way to share an image would be both as an image and the Docker file back to the presentation. Okay, so this was about building images, managing containers a little bit. Now I would like to discuss features that are quite specific to Docker and are frequently used and that you will probably also use frequently and you will apply in the exercises later on. One of them is mounting directories. That is, of course, a very nice feature because what you can do then is have files stored on your computer, for example, input files, FOSQ files, whatever, and use those inside your container, do a calculation with that inside your container and then write them back to a directory on your computer again. You can do that with Docker. Managing identities is quite important one kind of security-wise because depending a little bit on your operating system, we have seen that we were root in, we can be root inside a container. If you then write a file to a directory on your computer, it depends on the operating system if that file is written also as root or as another user and it's quite important to understand that because at some point, depending on how you mount directories and what you want to do with the output files, that can become problematic if files are written as root outside the container. Third, I will quickly talk about mapping ports because if you are, for example, hosting a browser interface inside a container, you have to specify which port that is and map that port to a port on your computer in order to actually see that browser interface. About mounting, basically there are two frequently used ways of mounting volumes or directories that I think the most frequently used one is the bind mount that basically or basically that makes a directory that is managed by your own operating system available inside the container. So that's really a local directory available inside your container so you can easily use files on your computer by the container. The second one is a volume mount that is also that is quite different because the volume mount is entirely managed by the container or by Docker and is entirely isolated from your file system, from the host file system, meaning that you cannot really copy paste files to that but if you have, for example, multiple containers running, they can all mount to that volume and that's entirely managed by Docker so in a way it's quite safe but also it's quite easy to have containers communicating together, for example, through that shared volume but for you, especially for beginner users, the bind mount is the one you will be using most frequently and that's also the type of mounting we will use in the exercises. Then a few words about identity. So let's say you have a directory that is on your host computer and you have mounted that inside the container. Falco has a question. Can you hear me now? Yes. Okay. With regards to the basically sharing between or like interactivity between different containers, why would a volume necessarily be better for that than a mounted directory? Can you not share mounted directories? You can. Definitely. But the mounted directory is so the mounted directory is fully managed by the host computer, meaning that, for example, if you're mounting a Windows directory to a Ubuntu container, there are some limitations there. Well, if you are mounting a Docker volume to a container, then it's fully managed by Docker and therefore also by the container. Therefore, if you always require, for example, a shared directory between containers, then you want to ship that group of containers as an application. Then you don't want to rely on how the directory or the file system is managed by the host operating system, but you want to really manage it by Docker in order to be more reproducible, for example, because some things might then work on your Ubuntu host operating system, but that might not work on your Windows operating system. So it's just another level of isolation and therefore reproducibility. Makes sense. Thank you. So an example, let's say we have mounted a host directory, so part of the file system, of our host computer inside a container. And in a container, we are root and if we would be on a Linux system, if we write a file to that particular directory, that file will also be owned by root. You can also change the user inside the container. So you can actually use the same user ID and group ID as you are at that moment when you're running the container. If you are that identity inside the container, the files will also be owned by that identity outside the container. And being root inside the container can have a lot of advantages, of course, because you can do all the installations and everything, but if you're running the container for a particular purpose, you usually don't want all the files that is outputted owned by root, because it can give, for example, security issues, but it can also limit the things you can actually do with these files if you are back to your original user identity again. This is different in other systems, both in Windows and Mac OS. You can be root inside the container, but everything you write in a directory that is mounted from the local host will always be owned by the identity that is actually running the container. So it doesn't give too big issues there. However, a lot of people run containers on Linux, so you have to take this into account. And in order to take that into account, you have to specify that the minus U option.  If you are developing a container, then you want to be root, but if you're actually using the container, actually writing files to your local directories, then you want to be exactly the same user inside the container as outside the container. And this code snippet kind of, so this line will help you to actually take that over. Then the third mapping ports. So containers are nowadays also very frequently used to host browser content like JupyterLab, RStudio Server. So all of these you can have inside the container. And that's very powerful, of course, because then you can do all kinds of installations inside your container. Well, for example, for R, a lot of people who are using R might know that all these dependencies with R can be quite, can give you quite a bit of headaches sometimes, especially if it needs compiling, for example. They install all these packages that you require for a particular thing, particular project inside a container. And then you have, you're using an RStudio Server container and then actually interact with the container through that browser interface, through RStudio or JupyterLab, for example. One thing, and that's great, one thing you should then do is to actually map ports. So that browser interface is hosted inside the container and is there at a certain port, then you have to tell Docker, okay, emit this browser content or this content to a particular port inside my computer. So how you do that is with the minus P option. So it looks like this. So it is the first port that you specify at minus P option is the port you are mapping it to. So outside the container, so for at the host. And the second one is the port that you're mapping the port from, so inside the container. We will see an example of that in the exercises where you actually run JupyterLab inside a container and map some ports. Okay. Now we have some more advanced exercises. So what we have seen in the previous exercise, we have exited the container and you could see the container is still there. And in the first part of the next exercise, you will learn how to reattach to that container. So being able to go inside that container again, well, you have stopped it. So actually start it up and then just do it again. You will create an image with Docker commit. So that's the example we've seen where you actually freeze your container to an image. And you will use a container in a non-interactive front. So what we have done in previous exercise, we have used these options, I and T in order to have an interactive session inside a container. So you could use command line and play around in the container. You can also use your container kind of as an executable, meaning a non-interactive front where it does only the thing you want it to do and then just exits. Removing a container because if you run a lot of different containers from different images, you can imagine that list of containers becomes very, very long. Pushing to Docker Hub. So if you have created an image, how to add it to Docker Hub, mounting a directory. So a local directory, not a volume. We will not be doing that in this course, but mounting a local directory. So you have your local files available for your container. Managing permissions. So that's the one I just talked about. So who are you inside a container? Who are you outside a container and some exercise to kind of understand how that would work? And oh yeah, and the last exercise will be about mapping, mapping ports.