So this talk is about math. Well, it's about algebra actually and it's a little bit about cats They're providing the visuals So I I thought it'd be rude not to mention the cats. They're they're quite central So I'm Chris Hoffman in real life, and I'm on the internet. So I'm yarn McGonoska at a variety of places And I work for up Toro, and if you're junior developer, you should too we're an e-commerce firm in DC and we're quite fantastic Yeah, so we're gonna be talking about numerical coercion and It's kind of a scary thing, but it's it sounds scary. I mean Corrosion that that's not a good. That's not a good word, but it's it's not it's not that frightening Basically It's how Ruby deals with with unfamiliar math So does anyone know what would happen if we tried to multiply a number by a range or a hash or a fruit bet? so here we're trying to multiply two times the range one one one to three and It says That's Ruby's polite way of asking. Do you are you sure you know what you're doing because I don't that doesn't work But we can derive some meaning from the air We get a type error indicating that there's a fundamental incompatibility between what we want to do and what and what the class is Ruby and what the class is support by default and it also tells us that the thing range can't do is to be coerced Which gives us a hint of where to look so we do some googling and then we we eventually get to this Which is the ruby lang dot org core docs for course On two one two Now the text is kind of useless here. It doesn't really tell you a lot So I'll give you the TLDR when you send the course message to a numeric object With why is the argument? It only takes one argument Ruby expects the course method to return an array of two elements and it expects these elements to be Compatible and we'll explain what compatible means in a minute with some code samples because they are the actual useful portion of this documentation So here the integer receiver One is being asked to course two point five and in that case two point five doesn't course to an integer But one course is to a float so it returns an array of two point five and one point zero Here Of the float one point two is being asked to course three and three does course to a float So we return so it returns the array three point zero one point two Here The integer one is being asked to course the integer two and that works out just fine It doesn't actually need coercion, but it's useful to Show the reversal behavior of This operation the first number in the array is going to be the one the type of the first number in the array Should be the type that you want the entire operation to course to which is why here, sorry We course to floats Some some more examples involving some more of the esoteric Numeric types in ruby here. We're coursing the integer four and it beat with a complex and it becomes the complex number four plus zero i Here we're coursing the rational four and it becomes four over one Here we're coursing We want the rational one half to course four point five and that courses to a float Here we're coursing The they're at the float four point five to a complex and it becomes a complex with a float as the first argument So now we all have a basic understanding of how numerical coercion works We're going to talk about vectors as they are a a great use case for numerical coercion So vectors are a mathematical object that are ludicrously common in all the sciences I actually don't know if you can do physics without vectors like I'm pretty sure it's not possible unless you're Even in one dimension you'd still need them So what they are is that they wrap a magnitude and a direction So we're going to have some examples of scalars and vectors. So things like population area volume battery percent in all our phones how loud I am and and and the pressure that my Voice is pushing against the microphone are all Non-directed numbers population doesn't have a direction Volume doesn't have a correction direction. So these are called scalars Things like velocity things on the right-hand side like velocity or acceleration or momentum. They do have they do have a direction And so they're vectors Vectors are routinely represented graphically as arrows because it's very easy because it makes it very easy to understand That two pieces of information are encoded here the magnitude that this which is the length of the arrow in the direction That's the direction the arrow is pointing in there is a ubiquitous representation of vectors And also leads us to the most common notation for vectors, which is which is not actually treating them as a magnitude and a direction but Treating them in orthogonal components in this case along an x and y axis One of the other mathematical properties of vectors is they can be scaled and that's why we're calling our non-directed numbers scalars because they scale vectors They can be scaled by regular numbers. So basically integers floats rationals and irrationals This scaling only affects the magnitude and does not affect the direction. So it simply makes the vectors longer or shorter In this in this case we're scaling the vector on the left by a factor of three halves to produce the vector on the right So can we do that in Ruby, I mean it sounds pretty simple It sounds like a value object that encapsulates a couple of a couple of coordinates and has some interesting multiplication behavior a Look, it's a value object that has some weird behavior related to multiplication It's almost like I share Sandy's ability to predict the future Let's look at how this works So first we're going to instantiate a vector class that has three that has that has three units on the x-axis and four units along Y-axis I didn't specify that in this class But let's just assume that it's a two-dimensional error like the one I was showing a little earlier And we want to scale it by two Two is a good number So here's what happens We have the We have the two times V and then what happens there is that Ruby says I don't know how to multiply two by a vector Help hopefully or it helpfully rather we have for well hopefully and helpfully actually we've provided a course definition On in our vector class So what happens is that V is asked to course to and I'm just having reduced by multiplication here for to store the The operation of multiplication somewhere Ruby doesn't actually use reduced to do this internally, but it's a nice Ruby land description of it So What happens when we course to is that we return an array of V and then the number and the reason we do that is that Ruby then Ruby then Ruby then basically reduces with multiplication and passes and calls multiplication on V and passes it to and Luckily, we've also defined a multiplication operation that returns a new vector that is twice well in this case twice as big So here's that Here is actually some code that makes the title of the talk actually compute So we have a cloud or object that contains a splatted array of cats Don't worry. No cats were harmed in the making of this talk via splatting It coerces By when we give it a number it takes that number and returns an array of that and the number of oz And the number of oz is a map reduce with addition over each of the cats in the cloud or We have a cat class to supply cats to the cloud or and each of them has Allows humans to Say one awe per cat. So they're relatively surly cats or or cats And then we have a cuteness class which initializes with default quantity of cuteness in this case being one and then courses just as though It's a number So we say cats equals cloud or not new cat a new cat a new we say cute equals cuteness done new and then we Compare two plus cats and four times cute and I will show how that works So we we have it it's going to be true spoilers But here's how it works again with the with the helpful colorful boxes When we do two plus cats cats is then as to course two and it reduces with addition similarly on the right-hand side Cuteness the cuteness object is as to course four and reduces via multiplication the definition for There the definition for course on the cloud or object is to map reduce the oz for each cat Which is clearly shown in the red box in the left in the big red box on the left-hand side We're still we're still reducing with multiplication or addition rather on the left hands on the right-hand side We are Reducing the cuteness object and that one's going to resolve more quickly because it's more simple We still have the two on the left hand side We still have the two we the the one one array is indicating that we have two cats and each one has One awe and it's still and it's reducing by addition Similarly on the left on the right-hand side the quantity of cuteness is has reduced to one or has course to one And it's still reducing by multiplication We're now reducing this is the actual reduction of the number of oz in the cloud or with addition and On the on the right-hand side you can tell it's just become straight-up math again And this is going to end pretty quickly Then one plus one is two and four times one is one or is four times one is four rather And then we get to two plus two and then four equals four and then that's true and because you've all been very good Here's a adorable remote hogging cat Now I'm going to talk about dimensional analysis another another math thing This is not dimensional analysis The proper response to that picture is this because it's a black hole and they're terrifying Dimensional analysis is the simplification in conversion. It is the analysis of the dimensions of measurements.  So let's talk about what let's Give some examples of the measurements So some measurements are basically things you can measure 60 miles an hour 88 feet four inches, which is how tall I am 2.7 gigahertz or 9.8 meters per second squared, which is how fast I fall When I jump at the earth's surface on Mars it would be different So measurement is anything with a unit kind of makes sense And dimensional analysis is the simplification and conversion of measurements It is simplification of a complex unit to a more simple one hence simplification or the conversion between between units So here's an example. We're converting 10 meters over 10 meters per second to Kilometers per hour and we do it in three steps. We first convert meters to minutes That's the top line or we first convert seconds to minutes.  So this this is a conversion process Is that not showing?  There's some math there It's invisible So here we're determining how far our massed object will fall in a vacuum at the earth's surface in the span of point Zero one minutes or a normal people numbers three-quarters of a second. It turns out would fall about six feet I will note one important thing here, even though you can't see the math the negative sign in the answer is Is actually very important and it should not just be discarded. It's a it's it indicates the direction of the vector It's pretty cool in that we don't need to remember or know that gravity goes downward The negative sign just falls out of the math. I think that's really cool It would be much cooler if we had, you know actual SVG's So where's the ruby? Here's the ruby so This is a bit of a shameless plug, but I Wanted to be able to do dimensional analysis in ruby the way it felt like doing it on paper So I wrote a library called unitary That would allow you to do that in here, we're doing We're setting up the speed to be five miles per hour except we're writing it kind of weird We're writing it as a multi as five being multiplied by The symbol mi to denote miles divided by the symbol HR to denote hours and that's really strange I'm dividing and multiplying symbols here. That's that's craziness and I'm doing it again on the next line I get to get to get what what represents six hours But then when we multiply speed times time will actually get 30 miles with with this library the hours will cancel out essentially Which is even stranger symbols don't cancel out. That's crazy talk The second example is is a little is also pretty simple We have a length of two kilometers and then if we square it it were asserting We're comparing it to four times four kilometers squared And then if we cube it we're comparing it to eight kilometers cubed and the math all works out and Here's how we did that or I did that The first part of the code is pretty much we require a bunch of stuff And then we and then we include something into symbol don't ever do this in production It's a hideously bad idea, but it's very very cool So we include some simple unless your rails are active support and then just totally yeah do that Fine So we include some this this module into symbol and as you can see the first big headline method is we have a course method So now when we try to multiply six by a symbol it Ruby at least has some idea of what to try to do And what it does is it returns an array of two quantities or sort which are also objects introduced by this library And the first quantity is going to be Quantity with the so quantities in this library have a size and a dimension and the size is the size the number Sorry five or the number six or two and Then the dimension is going to be derived from the symbol But in this case we have the quantum the first quantity just been having a number It was basically a size and node and no dimension So no unit and then the second quantity having unit size so one and then the and then the dimension So we're because the course requires us to return the array of two elements We're basically splitting the part quantity into two parts and having on one hand the the number on the other hand the unit And then and then once it once it does that we've also defined Multiplication division and exponentiation on symbols to tell it how to combine them This next slide is how quantities combine It's a little complicated and not the best written thing in the world. There's a large case statement But when you combine it with itself You're combining your size and the quantity size and your dimension the quantities dimension when you're combining it with just a Numeric you just multiply by the size by the quantity Allah our vector friends earlier and then when you're multiplying it by another symbol or another dimension then you just add to your to the current dimension Similarly, we have Division is Defined simply as the inverse of multiplication and exponentiation is just defined as repeated Multiplication the other cool thing is that you can't add miles per hour and Mega watts like that that doesn't make sense and similarly the library says it raises an incompatible dimension addition And less the dimensions equal each other This is how dimensions course you can yeah, they they also return an array of two quantities and They when you multiply dimension Multiplies dimension when you give it a symbol it turns it multiplies it by a unit and then when you multiply it by numeric It just multiplies it by a numeric The cool thing is that it will cancel out as you saw the hour stuff So once it's done the multiplication it has a process where it finds any so the exponents are The exponents are represented by a hash where the key is mi or HR and the value is the exponent there So when it's miles per hour That's a hash of mi to 1 HR to negative 1 and only we when we multiply it by the 6 hours The we have then have hours and they reduce the addition So they turn into HR 0 and then there's a there's a pass after the multiplication that takes out all the zeros Because they don't make sense in real life So other coercion uses There are many You can do unit conversion a dimensional analysis You can do currency manipulation and conversion, which is kind of unit conversion and dimensional analysis just with monies You can do math or maths for any Brits in the room And the last one is I'm lying. There are no other uses for conversion for coercion It is entirely for doing cool math in The thing is that Ruby isn't very good at representing math the way we think of it in the real world Or the way we write in on whiteboards. It's abysmal at it We end up with these value objects and code like the stuff I just showed you that looks impenetrable and God, what are you doing here? But wouldn't it be cool If we could do stuff like this if we could compose functions with multiplication or could scale functions with with numbers or could do chemical equations and Just add two NAs and two CLs to get two salts or it could do four dot dollars equals six point five dot euros the cool thing is with the exception of The first two and you would just need a little syntactic sugar to make that work. You can do all these things You can do these you can do more you can do things. I haven't thought of You can do things I would not occur to me to think of I like math I don't like chemistry and yet I came up with the chemistry example if I mean There are way more things to do with numerical coercion than I've shown here The resources for it are relatively slim on the other hand. It is not the subject of the Ruby blogging Industrial establishment and and has relatively few blog posts. I couldn't find any from before 2012 Though I guess it hasn't changed that much. So I could have gone earlier A guy named Seamus Abchear has a conversions library that will pretty much let you do the thing that I wrote on the last Line of the previous slide, which is four dot dollars equals six point five dot euros and His approach was a little different than mine He just did active support style methods for just tacking on the the unit to a numeric My library unitary, which you shouldn't ever use in production again Is available on github as well and the docs are available where they are and Again, I'm Chris Hoffman and so go do course


Welcome to AG MOOC courses. This week, we are going to talk about the implications of water availability and its deficit on the agriculture. In this lecture, what we are going to say is, what is the crop water requirement? What is the requirement from a particular region or a particular area for crop as well as for an agriculture purpose or for the drinking water purpose? So how much is the minimum requirement and which is needed to go for a sustainable agriculture. So how do we calculate and how do you synergize with the area based activities? Now water availability is one thing which normally we try to assess it depending upon the area for the of the watershed or basin then what is the rainfall amount which is happening in over there. See, the rainfall amount is the not actual amount and what is the mean? The rainfall is one thing which varies in space as well as in time. Those space in time that variations need to be ascertained before we start doing that. Second thing is how much it can be stored? See the runoff moves follows the drainage and it may go to the final and either it could be in the sea or it could be in the lake areas. So now in this tank storages there could be tanks or a ponds which has been created just for the storage of water purposes at where and when we are needed. For that purpose what is needed is the tank periphery area as well as the depth is needed. So now if we want to estimate what is the water availability in a village that means you need to know the how much is the tank storage capacity in the tank and the number of tanks in the area. This will tell you about if you get a X amount of rainfall how much the village themselves villagers themselves can store it and then use it at a later date when there is a requirement. If it is going to be only reverse then when it is a runoff it is you cannot able to hold on to that system. So that is what is being discussed in this class. Now when you want to say about what is the demand from the demand? So there are different kinds of demands which is happening. One thing is the water demand for the human demand that is for the drinking water purposes there are certain standards about 100 liters, 130 liters of water which is needed by person for day. Whereas livestock, the livestock is also depending upon the type of life either it is in the bird side or whether it is a big-bodied animal or a small-bodied animal depending upon their water requirements like a human being that has been decided already that has been evaluated. Now the second thing is third thing is about the crop water requirement. The crop water requirement depending upon the crop if it is going to be a crop like paddy it needs water standing water about 6 centimeters and above the surface. So that is needed completely totally it has to be a standing water. That means then that is a crop water intensive crop without water it may not be able to yield the better way and what is the area which is done it if there is going in a region if it is going to be a crop intensive crop the water intensive crop that means the water requirement is on a higher side if it is going to be a dry area where the irrigation is required at every 15 days then the water requirement will be less. In addition to this there is another requirement water requirement is the environmental water requirement. The environmental water requirement is for the plants and other small creatures or like a fish and other things which are available only along a particular river course or in the tank area which they are the ones which we have to protect and we have to allow conducive environment to grow. For that the minimum water supply is water availability should be done as well the last and the least is only about the industrial requirements. So these are all the different water requirement from a different sectors which we have to allocate accordingly or appropriately so that crop the area gets developed along with agriculture in practice. So what we are talking we are not talking about the urban areas we are talking about the region where in you have the villagers which grow more crops as well as a smaller area when you plan a base in 11 allocations we may have to consider all this human livestock crop environment and industrial requirement and these allocations are very it has got a serious implications if it is deviated on the development of the region or the livelihood of the people. So how the human demands are put so human demands it is the population which you try to take it from the census data and the required rate is around 55 liters depending upon the place whereas in the livestock demand number of cattle's the number of buffalo's into 85 liters that is what is given there then number of sheeps then you have this 10 liters number of goats 10 liters per day and number of birds 40 liters for 100 birds. So this is the standard water requirement from the different livestock's which is taken care in demand assessment whereas the crop water requirement it is the paddy ground net ragi vegetable use of water requirement depending upon the agro climatic conditions the crop water requirement is already established. So the water balance which we are talking about is how much is the water availability how much is the demand we considering all those things then what is the water balance will be is the case and depending upon the rainfall amount if it is going to be 300 millimetre how much will be the deficit if it is going to be 900 millimetre how much is the deficit or balance additional thing which will be able to do that. So this we can calculate it for the individual villages or individual river basins then the necessary management deficit improving methods could be made use of. So this section what we are trying to do is what we need to know on a space that means geographical locations which are the areas are chronically they have water shortages because the water usage is water demand and usage is are very heavy so what would be the minimum maximum deficit will be able to have and which are the regions which are got lesser demand and the surplus or a balance water is available so that the equity sharing of water resources can be made. So now what we have seen in this entire in this part of the lecture is how do we calculate the different water demands from a different segments and how do we allocate it and so that we will be able to see which are the areas where there is going to be a water shortage at a given rainfall conditions because of the requirements or because of the unavailability or non-availability and which are the areas where there is not much of differences are there in the demand and supply. So this is one among the reasons so this will help us in sharing the water between amongst the villages where excess is there where the deficit there this is possible in this type of studies. Thank you very much.


Last week we had a light introduction to random numbers that is some of the concepts we introduced so just recap on that. First random numbers are very important for many aspects of security. We want to generate keys. Secret keys, we'd like them to be random so they are very hard to guess instead of some structured key. We'll often use random numbers to do authentication and to exchange. The algorithms make use of random numbers again. They should be such that the attacker cannot guess it. And a way to make a number that someone cannot guess is choose a random number long enough and all the attacker can do is really do a brute force attempt. So if we have a large enough random number, it's hard to guess for the attacker. But the point is that generating random numbers is hard for computers. So we talk about true random numbers or something that generates true random numbers where we need some source which is not commonly available in our computers that can measure something from the environment like electrical disturbances or some noise or some characteristics from the environment. When those characteristics exhibit randomness, we use that information and then convert it into binary. So we need special hardware to do that. So since that's not so common for most computing devices, what we do is we use pseudo random number generators. That is, they generate what appear to be random numbers but they're not truly random. There is some pattern in those random numbers generated. But if we use good enough algorithms and we start with a good enough source, then we can use pseudo random number generators for security purposes. So we'll look at a couple of example PRNGs in some simple algorithms and then we'll mention a few others but not in much depth. The pseudo random number generators usually have an initialization value which we call the seed. So it's an input to the algorithm that starts things off. So the random seed is commonly used. You may have seen that if you are programming and you want to call the random function. In a number of implementations of that random function, if you call it, depending on the software, if you call it multiple times, it can produce the same sequence of numbers. If you want to produce a different sequence, you use a different seed, a different input. So we'll see an example of that shortly. Our pseudo random number generators, we think they generate a sequence of bits. So they keep generating bits as output and we'd like that sequence of bits to appear random. We had a very simple example of what sequence of bits appear random. We said we want to get an equal number of zeros and ones in that sequence and in any sub-sequences as well. So we had some examples that in the first sequence, we think it's not appearing random because there are many more ones than zeros. In the second one of the 12 digits of the 12 bits, we've got equal number of zeros and ones, but in sub-sequences we don't. If we look at half of them or a quarter of them, we don't have this property. In this third example, we have 12 bits, equal number of zeros and ones, but again, many people would not say that that is random. We think that if we knew, say, the first six bits here, we may be able to predict that the next two bits will be zero, one and so on. So it's not just about having equal number of zeros and ones. There are other properties we expect from our random sequence. Using such short examples does not capture all those properties that we desire. We need longer sequences, which we'll see in a moment. So we're not going to talk about pseudo-random functions, but a true random number generator takes a source of true randomness, something from the environment, measures that, usually some special hardware to measure that, and converts into binary, and the output is a sequence of bits. And we can use that for our applications, for whatever, security mechanisms. A pseudo-random number generator is just an algorithm that we can implement in software or hardware. That takes a seed as an input to get things started, and follows some algorithm, produces some bits as output, and reiterates, keeps going, taking another input and keeps going, with the idea of producing, again, a stream of bits, a sequence of bits which appear random. In practice, true random number generators, although they are good, they produce a true random bit stream. A, they need special hardware normally, or they need some special way to measure the true randomness, the source. And B, the number of bits that they produce over a period of time is usually much smaller than a pseudo-random number generator can produce. So when our application needs many random bits, maybe we need to generate a very long key, or we need to generate many long keys, a true random number generator may not be able to do that within a reasonable amount of time. So we'd lead to pseudo-random number generators. The problem with PRNGs is that the sequence is not truly random, but we need it good enough for our applications. There are different tests of a sequence and trying to determine, is this exhibiting the randomness, or the characteristics of a random sequence? So this just mentions some of those tests, but there are others. One test for uniformity, that is that we have an equal number of zeros and ones. Look at frequency of zeros and ones, runs, that is, sub-sequences. One test is, can you compress that sequence? If you have a sequence of bits and you try to compress it using zip, what do you think you'll get? A larger output or smaller output or the same length output? When you zip something, usually you'd like it smaller, correct? But if you zip a random sequence, you shouldn't, you should get the same size output because the way that zip or compression generally works is that it looks for patterns in the input and replaces those patterns with smaller sequences of bits. So compression usually shrinks things, but if you try to compress a random file, you'll find that it will not shrink things. So if that happens, then that indicates that the source exhibits randomness, just a practical test. And there are other tests which we will not talk about. Let's go straight to an example of a simple pseudo random number generator. There are many, we'll just deal with a simple example to get started. Linear congruential generator, LCG is the easier one to say. The algorithm is this equation here. We can think it generates a sequence of digits, well, not of digits, of numbers, of integers. The algorithm is we have some parameters, A, C and M. We'll see some examples of values. And we have the current value in the sequence. So our random number generators generate a sequence of numbers. And what we want is that sequence to appear random. So this simple number generator takes the current value, which is denoted as Xn, multiplies by some constant A, plus some other constant C and mod by M. And you get the next value in the sequence. And then you do that again and again. And the result will be some sequence of numbers. And we want that sequence to appear random. To illustrate that, we'll go through some examples with different values of A, C and M, just to see how this works. So this is what we'll call just LCG. That's the name of the algorithm. And it's, just repeat, the next value in the sequence, Xn plus 1, is obtained by multiplying the previous value, Xn by A, add some constant C and mod by M. That's the algorithm. Let's choose some values. Let's say A, so example 1, let's choose A to be just some simple values so we can calculate A to be 1, C is 1, M is 100. What we do is we take some initial value of X, what we'll call X0, and then apply the operation to produce the next value of X, X1, do it again for X2. And those values of X that we get out should be our sequence. And we don't like that sequence to be random. So let's try it with those values. We need an initial value of X. And we say the seed is the initial value of X. I'll denote it as X0. And let's say I choose a seed and my favorite, number 23. How do we choose a seed normally? What we should do is we should choose a random seed. How do we choose a random seed for input to our random number generator? Use a true random number generator. So what may be done in practice is to take, to generate a seed to be used as input to a pseudo random number generator. If we want that seed to be random, we use a true random number generator to generate that value, the seed. And then use the pseudo random number generator to generate more values. With the idea that the true random number generator can generate a few values easily, our pseudo random number generator can generate many values as long as we start with a good seed, a random seed. But I chose 23 just for this example. What's the next value of X? That is, what's X1? Well, we go the long way. Take Xn, so X1 will be Xn plus 1. We take A times Xn, the current value, 23 plus 1, C mod by 100. What do we get? 23 plus 1 is 24, mod 100 is 24. That's our first number in the sequence. What's X2? What's X2 in this case? 25, just the previous value, times 1 plus 1. What's X3? 25 times 1 plus 1, mod 100, 26, X4, 27. Do you see some pattern happening here? So we could denote X, our sequence in this case, the set of values, X0, we can write is 23, 24. And you'd keep going to where? Where will it stop? With mod 100, it will get to 99. The next value would be 0, 1, then get to where? It won't get to infinity. Can we see something? It will get back to 23 eventually. That is, 1, 2, 3 will get up to 23, and then we're just back to the start because if we take 23 as input again, we're going to get 24. So we say the sequence of unique values ends here. Actually, I should write 22, and then the sequence ends in that it just repeats from then on. It'll go 22 to 23, 24, 99, 0, 1, up to 23 again, and you think it just comes back to the start all the time. So this sequence, is it a good random sequence? Does it look random to you? No, this is an example of a bad output from a pseudo-random number generator. So I think it's easy to see in this case that if you see the first three values are 23, 24, 25, then maybe you can easily predict the next value will be 26. There's some dependence on the values, and it's easy to see that relationship. So this is an example of a pseudo-random number generator generating a bad output, not all appropriate. Another characteristic, so this is a bad one. How many numbers in this set here? 100. So we can say that this set has a period of 100. That is, there are 100 values, and then it just repeats. It comes back to 23 and so on. So that's a characteristic of our sequences that we generate. We can measure how many values do we get before we come back to the start. And always, when we get back to the start, it will just repeat again, because the algorithm takes exactly the same inputs. In this example, we have a seed of a period of 100, but the sequence is definitely not a good one. Let's try some different values of our constants and see a couple of other possible sequences. Example two, let's set A to 7, C to 0, M to 32. Try the first few values, what do you get? And I'll give you a different seed in this case, X0, set it to 1. Same algorithm, different constants in this algorithm, but let's start with a seed of 1. See what sequence you produce, look at the length of that sequence or the period, and see if you'd observe any pattern in the numbers in the sequence. Does it look random or not? What's X1? Again, we take the value of A times our current value of X, which is 1 plus C, in this case I've chosen C to be 0, so that will have no effect, mod 32, which is just 7. What's X2? 7 times 1 plus 0 is 7. Next value, I hear people getting the next value, so try X2 now, just to see how this algorithm and see some characteristics of this algorithm. X2, 17, just for people who don't see that. A times the previous value, 7 plus 0, mod 32. 49 mod 32. X3 will be 17 times 7, mod 32. Calculator is 23, I've done it before. X4, someone will help me with this one.  What's the remainder when we divide by 32? 7 times 23 is 161, 161 mod 32. 5 times 32 is 160. Remainter is 1. We actually get back to the start with X4. In fact, we'll denote X, the sequence, 1, 7, 17, 23. What's our period? 4, there are 4 unique values before we just repeat, we get back to 1. Then it'll be 1, 7, 17, 23, 1, 7, 17, 23. So we say the period of this sequence is 4. The numbers, do they appear random? Well, at least more so than our previous sequence. Maybe we can say that, 1, 7, 17, 23. We cannot see any simple pattern there. If I gave you the numbers, if you didn't know this, I gave you the numbers 1, 7, and 17. Would you be able to predict the next value was 23 if you didn't have this algorithm? Well, that would be harder to predict. So this one maybe appears more random, but one disadvantage is the period is much shorter. We'll try one more, and then we'll talk about the desired characteristics. And we'll not go through the details. I'll give the answer. If you try 5, keep things simple. C is 0, and it's M still 32. Same seed. If we start with a seed of 1, what's the next value? 5. What's the next value? 5 times 5, mod 32 would be 25. The next value? 25 times 5 mod 32. Basically, it's the previous value times 5, mod 32. Turns out to be 29. 29 times 5 mod 32, and I've done it before, 17, 21, 9, 13. And then the next number comes back to 1. What's our period? 8. There are 8 values in this sequence. What about the numbers? Does it appear more random than the first one? Definitely. And in fact, it's hard to see some pattern in this case. So here we're getting closer. We want an algorithm such that when it generates numbers, it generates a sequence. When we look at that sequence, that it exhibits randomness. And this one is getting closer to what we desire. We need to do some actual tests to see that. So one thing we could do is maybe convert each number to 5-bit values, and look at the number of zeros and ones, look at the runs, and so on, and do some tests to measure the randomness. But it's appearing more random than our other sequences. So in general, we want an algorithm that produces a sequence like this, which appears random. And one other characteristic we want is that it goes for a long time before it repeats. That is a long period. If it repeats very often, then of course, if we have to generate many, many numbers, we'll get a lot of structure in that output. But if the period is longer than if we say need to generate 10 numbers, with a period of four, we'd repeat two and a half times, at least two times. With a period of eight, we repeat just the first two numbers in that sequence. A longer period is better for our pseudo-random number generator. Yes, it could be. But I think it must be the first value. Yes, it could be. So generally, we want a long sequence that appears random. And these are just simple cases where we use small numbers. So back to our general algorithm, LCG, how do we get a long sequence? Look at our constants, a, c, and m. If we want a long sequence, what value should we set? And how should we set it? Mod. m should be larger. The larger the m, the larger the potential sequence. If m is 32, the maximum length is just 32, the maximum period. If we mod by 32, the answers can only be between 0 and 31. So the maximum possible period is m. Therefore, to have as maximum possible period as possible, make m as large as possible. So that's one design characteristic. In this algorithm, you make m as large as possible. How big can you make it on your computer? Well, it depends on how you represent your numbers. So say on a 32-bit system, you'd make it the largest number, 2 to the power of 32. Then you can potentially generate a sequence which contains all those numbers on your system. But there's some other characteristics. And people have done analysis of these algorithms, a, and the parameters a, c, and m. And they come up with recommended values that do generate long sequences that appear random. On the slide, it gives a few examples, or I think just one example.  Large, so it gives us a large potential period. And why should it be prime? If you mod by an even number, like 4, for example, then you always can get back to the start much quicker. We will see in the next topic on number theory some characteristics of prime numbers. And they become important not just here, but in other aspects of security. So a large prime number, for example, is 2 to the power of 31 minus 1. And c, if you set it to 0 to make your life easier, ignore c, then people have come up with some recommended values of a. One of them is 7 to the power of 5. How do they come up with it? I don't know, but they've done analysis and see that with this algorithm there are some good values. And if you use them, you'll get a long sequence which appears random. If you change the seed, you'll get a different sequence. Let's try that last one last example. Same parameters as example 3, but change the seed, the first value. Random number generator to choose the seed. Maybe an easy one so we can calculate, let's say 3. What's the next value? 3 times 5, 15, mod 32, 15. 15 times 5. 15 times 5. 75, 11 is it? 15 times 5 is 75, mod 32. 11 times 5, 55, mod 32, and keep going. And I don't know the values. The point is, and I'll have some period that I don't know, the point is here a different seed will give us a different sequence and still hopefully a sequence that appears random and has a long period. It may not produce the same period sequence. It doesn't have to. But we want a random number generator that when we change the seed, we'll get a different sequence with a long period. And the suggested values for LCG do that. So when you call the RAND function in your program, you write, you call RAND, and all that does is uses a pseudo random number generator, usually with a, depends on the software, some predefined seed, and it grabs the next value from the sequence. You call RAND again in your code, and it gets the next value, and then the next value, and so on. If you change the seed for that random number generator, and most software or most programming languages and applications will allow you to change the seed, then it will grab numbers from a different sequence. Therefore, it's important to, if you want to produce different random numbers to try different seeds. This is one of the easier pseudo random number generators to implement, but it's not so good compared to some others in generating random sequences. A, in terms of length, and B, it's possible or quite easy for the attacker to, given one number in the sequence, for example, if they knew the value 21, to work out the next value. So that should not be possible for the attacker. They shouldn't be able to be given one value in the sequence and be able to predict the next value. This predictability is not a characteristic of randomness, so it should be hard for them to do that. It turns out it's not so hard with LCG. If they know the parameters in one number, then they can easily find the other numbers. There are other pseudo random number generators. There's a couple of slides on the blum-blum-shub generator by three people, blum-blum-and-shub. It is better. We will not go through it. It uses, again, some mod arithmetic, starts with some prime numbers and uses some exponentials and mod, and it produces a sequence of bits on output. And there are many others. So LCG is just one simple example we could go through. There are many others. They need to produce good random numbers, long periods or large periods, and be simple to implement. The other way we can generate random numbers is using our block ciphers like DES and AES, because the idea of encryption is to produce a ciphertext which appears random. So we can use existing block ciphers, and, for example, in the different modes of operation, counter and OFB are common examples. We take some initial value, a key. We encrypt that initial value. We get the first set of bits as output. We increment that initial value. This is counter mode and keep encrypting, and we just get a sequence of bits as output. The encryption key and that initial value combine we call the seed. If we change the seed, we get a different sequence as output. So these are other ways to generate sequence numbers. Just use an existing cipher. What's the problem of doing this? Compare this, say, using DES. Remember simplified DES, the algorithm, and compare it to LCG. Which one's easier for you to understand? LCG is easier and easier to implement. So block ciphers are often slow when they do encryption. Therefore, if we want to use them for pseudo-random number generators, they may not perform as well as other dedicated algorithms. But they work well in terms of producing random sequences. They're just inconvenient or slow. There are, again, different ways to do that. You can use different modes of operation to do it. There are some special algorithms or special approaches. This is just one example. But, again, we will not go through these other algorithms. This one uses DES, encrypt, decrypt and encrypt, using different keys, using some date and time and some initial value. But we're not going to cover that. So there are special algorithms for generating pseudo-random numbers. Or we can just use existing ciphers to do so. Five minutes to go. Let's just finish this on stream ciphers. We just need to say what they are. Let's go through the RC4 example. And that will lead us to our next topic. Stream ciphers are easy now that we know about random number generators. Stream cipher, remember, we take our plaintext and encrypt either a bit or bytes at a time. And the general model of a stream cipher is that we take some key. So this is at the sender. We use that key to generate pseudo-random numbers. So this block here is some function or some algorithm that generates pseudo-random numbers like LCG, like one of the block ciphers or anything else that generates a random sequence. Then to encrypt, we exhore the random sequence or k bits from the random sequence with our plaintext. K bits of our plaintext. And we get ciphertext. To decrypt, we take the ciphertext. The receiver has the same key. They have the same random number generator. Therefore, with the same key and the same algorithm you'll get the same sequence out. If you start with the same seed, you always get the exact same sequence. So we take the k bits output and exhore with the ciphertext and this property of exhore. Ex or k and the plaintext gives us m. Ex or the ciphertext with the same k will return us the plaintext. So that's the general design of stream ciphers. They just use different algorithms to generate that sequence. The output coming here is called a key stream. Questions on stream ciphers for our next quiz. Keep up to date so we can have impromptu quizzes at any time. Any questions on stream ciphers? What's the one-time pad? Remember the one-time pad. Ex or's, the binary implementation of the one-time pad we said was the exclusive or the plaintext with the random sequence. We're almost doing the same here. Plaintext, exhore with a random sequence. The only difference between this and the one-time pad is that in the one-time pad we said that that sequence must be as long as the plaintext. Well, that can be possible if we have a short plaintext, but let's say we have a continuous stream of plaintext. Then at some point this sequence here is going to repeat. Why? Because our pseudo-random number generator has a period. It will eventually get back to the start value. So that's the difference between a one-time pad and a stream cipher is that in this case, lowercase k here will eventually come back to the first value that came out. And therefore we'll be exhoring plaintext with the same value as we did in the past. So we will get repetitions in the output ciphertext. But that's the idea. Exore a random set of bits, lowercase k in this diagram with our plaintext m. Assuming we can generate random numbers well and quickly this can be very fast. Again, exhore is very fast to implement. We usually do it a byte at a time. So k would be 8 bits, the lowercase k. So for stream ciphers the sequence, that key stream should have a large period so we don't repeat very often. The sequence should approximate a true random number generator so it should be a good pseudo random number generator. And of course the key that we use should not be guessable. It should not be subject to brute force attacks. Otherwise the attacker can do the decryption easily. Usually they are simpler to implement and faster than block ciphers. If you reuse keys with stream ciphers too often you'll get the same sequence output and that's bad. So you usually want to change keys quite often with stream ciphers. With block ciphers you can reuse a key much longer. RC4 is an example of a stream cipher. But there are many others. That's one of the common ones you may see. It was used in Wi-Fi, old Wi-Fi encryption and other systems. It's still around today but has some weaknesses. We will not go through RC4. There's a few slides on it. You may look in your own time if you want but we will not cover it in this course. Next lecture on Friday we'll look at a new topic about some basics of number theory. In preparation for public key cryptography everything up until now has been shared or secret key cryptography. The next form will be public key cryptography and to understand that we need some basic mathematics to do that. Next topic is number theory. We'll continue then.


All right, ladies and gentlemen, let's recap what's been taking place over the course of the last couple of days. The President of the United States has threatened to use the United States military to quell protests. He's going to pit the U.S. military against U.S. citizens. Let me remind you, the U.S. military is actually supposed to protect United States citizens, but now they're being used potentially, if Trump actually follows through with this, to stifle freedom of speech, to stop protests. in America. Possibly use violence against U.S. citizens. So now, more than ever, we need an opposition party, but where are they? Not really anywhere to be found. Unless you look to Twitter, then they're putting out really flowery tweets. If you look the Democratic Party leadership, they are writing strongly-worded letters to Donald Trump, but we don't have a real opposition party. We don't actually have a check on Donald Trump's authority as he consolidates the power of the executive branch. Do you remember when President Obama was in office? He also expanded the power of the executive, but Republicans were on him like that. It doesn't matter what he did. He was signing executive orders, and they were on him every single time, crying dictator and whatnot. But where are Democrats when we really need them to be a check on Trump's power and tyranny, quite frankly? I mean, they're basically MIA, and if they're there, they're very ineffectual. Let's look at some of the tweets put out. Pete Buttigieg tweeted this, Black lives depend on whether America can be what we want to believe it is, what we believe it to be, what it could be. Systemic racism is so woven into the fabric of this country, facing it will take action, honesty, listening, and deep, deep change. And for many of us, humility. Now I say this because this is an individual who's supposed to be a rising star in the Democratic Party. He almost became President. I mean, he was one of the front-runners, and he's saying Black lives depend on whether America can be what we want to believe it is, what does that even mean? What does that even mean? That means nothing.  Let's go to leadership here. Chuck Schumer tweeted out, at this challenging time our nation needs real leadership. President Trump's continued fanning of the flames of discord, bigotry, and violence is cowardly, weak, and dangerous. Here's my statement with Speaker Pelosi. And it reads, across our country, Americans are protesting for an end to the pattern of racial injustice and brutality we saw most recently in the murder of George Floyd. Yet, at a time when our country cries out for unification, this president is ripping it apart, tear-gassing peaceful protesters without provocation, just so that the president could pose for photos outside a church, dishonors every value that faith teaches us. We call upon the president, law enforcement, and all entrusted with responsibility to respect the dignity and the rights of Americans. Together, we must insist on the truth that America must do much more to live up to its promise, the promise of liberty and justice for all, which so many have sacrificed.  I mean, you're literally using platitudes. You're lawmakers. You are the two leaders of the Democratic Party in Congress.  Write some legislation. Don't tweet. Make laws.  What are you doing? What are you doing? We call on everyone to live up to the values of America. It's insufferable. It's insufferable. This is exhausting. Now, at first, Joe Biden decided to respond by saying, as president, I promise to have this conversation between black Americans and leaders and yada yada yada. I'm paraphrasing, but like what he said was basically to continue the conversation. We're past the point of conversation, Joe. We're past that point. Now we want action and we don't want to wait until November or January. Action right now.  Call on Chuck Schumer and Nancy Pelosi to draft very specific legislation that you will sign into law if you get elected. Beat Trump over the head with that.  Why can't you do that? Why can't you just be competent? Well, because he doesn't know how to be competent. Now, this video is floating around on the Internet where he talks about how a potential solution would be to retrain police officers so that way rather than shooting people in the chest, they just shoot people in the legs. I wish I was making this up, but this is what he said. Joe, how about we just train them to not shoot people at all? Is there any possibility where we have a police force that doesn't constantly violate the civil rights and civil liberties of Americans and murder them with immunity? Why does it have to be some form of brutality? And part of the reason why I'm assuming they don't shoot people in the legs more frequently, even though that would be less likely to be lethal is because then you end up missing if you try to aim for their legs and you could shoot someone else. Why don't we just not shoot people? Can we do that? I mean, what are we doing? Now, to his credit, I will say that he did promise to do fundamental change and systemic racism, or take on systemic racism is what he's saying within the first 100 days. That's great, but we need very, very specific policy proposals, like these vague generalities, these platitudes that we're seeing from leaders within the Democratic Party, that ineffectualness, that lack of leadership there, that fecklessness that we're seeing is exactly why Donald Trump is able to be so authoritarian because you let him get away with it. He's not worried at all about being held accountable. He's not worried that this is setting up some sort of battle between him and the Democratic Party. He does anything he wants, and he doesn't care. So at a time when he's literally threatening to deploy the United States military to possibly violently confront U.S. protesters, U.S. citizens, this is when we need an opposition party more so than ever. But what we've seen thus far, it's laughable. This is why the country is in the state that it's in. And I saw a meme on Twitter that I have to share. Basically, the Republican Party is Derek Chauvin, and the Democratic Party is the cop that was just watching Derek Chauvin murder George Floyd. That's what we're seeing here. They're watching. They're watching idly by as we lose civil rights and civil liberties, as this continues to happen, and it's because they don't necessarily feel as outraged as we all feel. You see some members of Congress show up with the photo op and, you know, Representative Beatty, she actually was pepper sprayed. So she was there. But I mean, you see Chris Coons opt for a photo op, Kamala Harris, who put a lot of black and brown people in jail when she was California's attorney general, show up for a photo op. I'm just sick of it. Like all of these words are meaningless. We're past the point where we have beautiful words that make us feel better. Now we want action. That's what everyone is saying. Action, action, action. So stop talking and start making it happen. Action. And I get that you don't have the Senate, you don't have the White House yet, but you still have one whole branch of the United States government, the House of Representatives. So start taking action.


Hi everyone, Joe for JasperJasperCaseRakes.com with our last filler. We only ended up doing two. We had planned for like four or five, but four I think, but we only did two. So thanks everyone for getting into the fillers, for buying full spots, so on and so forth. First we got to do the break, then we'll do the giveaway part. Big thanks to this group for making it happen. We got those teams right there. Let's roll it and randomize names and teams two and a five, seven at times. Two, three, four, five, six, and seventh and final time. Two and a five, seven times for the teams. One, two, three, and seventh and final time. Here's the first half of the list right here and the second half of the list right over there. No trade windows, it's just print and rip. Trey Lance, rookie card, Travis Etienne Jr. and Stefan Diggs. See what Travis Etienne can do. Drie sat out the first year with injury, Carl with the Jags, and then Trey Lance. Apparently he was playing with a broken finger all last season. So in whatever starts he made that his mechanics were all off, because he was overcome saying for that, but apparently that's all healthy now. So let's see what happens there. Jason with the Trey Lance. All right, now let's flip back over here. Let's gather everyone's names again, one through 32, new dice, new list, and top five after three and a three, six the hard way. One, two, three, four, five, and six. So a lot of sad faces here, especially from six, especially the six spot down to 32. But with those odds, Carl has to be in the top five somewhere, right? There he is, Carl, Carl, Kevin, Carl and Carl. Four Carl's and a Kevin. There you go, Kevin, you snuck in there. I'm Joe for jashbyscasebreaks.com. Great break coming up in the next video, impeccable. We'll see you for that, jashbyscasebreaks.com. Bye-bye.


What's up everybody, Jason here for Jasper's casebricks.com. We just sold out 2023, Panini Illusions Football, four boxer, Pikachu number four guys. I believe these are the last four boxes is what I had here in my cabinet here. So here we go guys. So there's everybody that's in and then here are the four boxes remaining. So not sure what was pulled in the first three but let's have some fun here with these last four. So we have Pikachu number five on the website now guys. So halfway there pretty much at 17 left. We can always do an R and a filler like we did for this one here. So if we need to always do that. We got a ton of numbered cards guys. Three autographs, two memorabilia cards on average guys. So five total hits for a box. It's a very, very fun route. And throughout a whole case, 16 boxes will be a ton of numbered cards for a lot of teams. All right, here we go guys. So I was on the little Derek Carter 199. Anthony Richardson insert. Then how about this little Anthony Richardson Pay Manning dual patches. That's to 25 for the Colts. Christopher got that from a team filler. Hand on hooker to 299. With the Detroit Lions. CJ Straub base. Christian Watson to 399. Rookie idols, Jackson Smith, the Jigba and Michael Irving. So Seattle that's going to go to Angel. Cowboys going to Tristan. So that's going to be a randomizer. Harrison Butcher to 25. And then we have a king of cards. Bijan Robinson to 399. Hollow heroes Rookie. Jackson Smith and the Jigba. Which I believe is like a shorter print card. Next one here. And we got a DTR, Dorian Thompson Robinson to 49. Little patch auto. We got a Kirk Cousins to 499 for the Vikings. And then we have a Jalen Hyde instant impact relic for the Giants. Brett Kiesel to 299 for the Steelers. Michael Galucci. King of cards, Jalen Hertz. Will Lovis. Zach Charbonnet. We got a Jackson Smith and the Jigba to 199. Dalton Kincaid. How about a little trade tuck here? Rookie endorsements to 334. Radice. Angel. All right we got Jalen Hyde to 499. Rookie idols, Ken Anderson and Jay Caner. Since Andy Bang was at Scott. Saints, that's K-Shun. So that'll be a randomizer as well. Jordan Addison. We got Pepper Johnson to 199. Patch autograph immortalized for the Genan. Giants. That's going to Jeremy Port. We got Kyler Murray to 299. Cedric Tillman to 299. We got Aden O'Connell. Got some points. We got Operation Detonation. Travis Kelsey. Kirk Cousins relic for the Vikings. Captain Kirk. Vikings Douglas. Clean tune to 399. And 400 points to all sides to be randomized to everybody at the end. Jamar Chase. That's number to 175. We got Stenson Baneda to 25. B.J. Moore. Then we got Rishi Rice. B. John Robinson. Jaden Reed. Bryce Young to 499. That's pretty nice. Then Michael Mayer there to 399. And a Green to 10 Chase Brown. Bangles when a Scott Q. All right, two boxes down. Two more to go. Joe Mixon to 175. Then we got Rookie Idols. Zay Flowers and Odell Beckham Jr. So that's actually going to go both to the Ravens. Sportport. Mustique there to 399. Cedric Tillman for the Browns. Bijan. Captain Kirk. So 299. Rodgers. Then Rookie Idols. Barry Sanders and Jamir Gibbs to 199. Both going to the Lions going to Kev. Ian Pards. Allison Boone. Rishi Rice. Anthony Richardson to 499. That's a nice color there. Colts going to Christopher. Then we got a Shining Stars. That looks freaking sweet. Must be numbered. Nice, three out of 50. It's really sweet. Pat is going to Tris. Then we got a Jackson Smith in the Jigba 24 to 25. Nice, beautiful patch autograph. Seahawks going to Angel. Illusionists. And a CJ Stroud to 499 as well. Damn. Here's some really, really good number players. Then we got a Cincinnati Bangles. Ken Anderson, Joey B. Bangles. That is going to Scott. We got a Devon HM, man. What a box. This would have been a crazy good personal box. Patch autograph to 199. That's Minnesota. Sorry, Miami Dolphins Mark. Desmond Ritter to 399. Then we got a CJ Stroud to 299. We got a Najee Harris to 30. There you go. And a Jordan and Matt. What a box. Jordan and Addison autograph as well. So this box here literally had a Jordan Addison autograph, Devon HM patch autograph, and a Jackson Smith and the Jigba patch autograph. Jesus. What a box. And it had a CJ Stroud numbered card. It had two CJ Stroud numbered cards. Bryce Young and Anthony Richardson. What a personal box that would have been. That was a crazy box. Like document this box. It's crazy. All right. Here we go. Last box. All right, we got Jaden Reed. Little patch there to 199. Tajie Spears to 299. Then we got Jalen Waddle to 299. Little Bryce Young, Shining Stars. We got a Drake London patch for the Minnesota bike. Sorry, Minnesota bike. It's the Atlanta Falcons. Going to Angel. Harrison Bucker to 25. Mystique Tankdale to 299. And we got a Josh Downs rookie autograph to 334. Indianapolis Colts, that's going to Christopher. Will Lovis. Quinton Johnston. What if she were one right there? Jalen Hyatt patch to 199. And then we got a James Cook to 100. Superlatives. It's a very nice one. Bill's going to Tristan. And we got a Ramon Drew Stevenson to 399. Shining Stars, Cooper Cup, that's numbered. Number to 50. And then we got Luke Schoonmaker to 334 for the Cowboys going to Tristan. And then last couple hits here, Jameer Gibbs, Daniel Jones. There you go, guys. That was the break, Ola. So a couple of randomizers to do. On top of all the hits, but I'll quickly do a little recap of what we got. So Schoonmaker, we got James Cook, Odle. There's a Jalen Hyatt, Josh Downs, Drake London, Jaden Reed, Duel's there for the Ravens, Hershey Rice, her cousins, Pepper Johnson, Trey Tucker autograph, Brett Kiesel, another Jalen Hyatt, DTR, Manning Richardson to 25. We got a couple of duels and some points, but that'll be randomized there. Of course, a lot of numbered cards, a lot of color. Same thing here, a lot of those. And then Chase Brown to 10, Bryce Young to 4.99, Hollow Heroes, Jackson Smith to the Jigba. And I just wanted to keep this all together and document it, but this was all one box, guys. The third box of this right here, got that. Got the Jackson Smith to the Jigba, got that. Got the Devon HN, got a Jordan Addison, Richardson numbered, Bryce Young numbered, CJ Stroud numbered, and CJ Stroud numbered.  So there you go, guys, thank you guys so much. And again, I'm gonna switch scenes now, do a couple of randomizers, the four hundred points will be for everybody, and then we'll do the two duels that we got there for those two teams there. So appreciate it, let's go. The list and the list. The first one will be Seahawks, Cowboys. Next one will be Saints and Bengals. And the last one will be one of these teams here. Same guy show for all of them, guys. Three times, we're in a two. One, two, three. Three times, three times, three times. Cowboys win that one. All right, three times down on the next one. One, two, three. Saints win that one. Oh, and the last one will be for the points. Three times, one, two, three. Rams, get the points. That's Tristan. All right, I appreciate it, guys. Thank you guys so much. Again, if you wanna try some more losers on the website, I'll probably pack filler at the same way I did here later tonight, so if you wanna grab some teams right now, that's a perfect time to grab them. Grab anything you like, of course. Baseball is back, repack is still there at five with a couple fillers, pretty close. And if you guys wanna do some immaculate about that, that's a mystery, great stuff. Appreciate you guys, thank you.


What's up guys, my name is Michael and welcome to my YouTube channel today. We're going to go over print in reverse so basically given a link list of Data we're gonna with a Data of one two three. We're just gonna print three two one. Okay, so I'm gonna do this recursively and I'm not gonna use any data structure because uh, yeah I think that's what they want us to do so here. I'm gonna explain how to do it recursively. So what we're gonna do is um, We're just gonna keep going next Over and over again until we get to the end. Okay, so if I'm a reverse print this I'm just gonna keep going next over and over again till I get to the end Then um, once I'm at the end, I'm just gonna return and go back and every time I go backwards I'm just gonna print out the statement whenever I go backwards. So here's basically the gist of the code So, uh, yeah, maybe I'll just rewrite this Actually, I just think I'll just explain so yeah Here's what we're gonna do. We're gonna if our current list is Null then we return that means we reach the end of the list What I'm doing is I'm gonna keep on going to the next recursively call this function until I reach the end Right. So when I reach the end, that's when our list is null. So then I return otherwise, I'm gonna Just recursively call this function over and over again, and I'm gonna pass it next Right, so I'm just gonna keep going and keep going and going so I reach the end Right, and if it's not if it's null point of that return.  All right. The stack is basically like the The level of memory. So after my recursive call, I'm going to print out the data The The list of did the link list data, right every time I go backwards So then the after your recursive call stack goes backwards over and over again. We're basically printing backwards So, yeah It's pretty much the gist of the code If I want to show you guys how this basically works I'll show you guys right now real quick. But then I actually have to go soon. But um So, let's say let's say we have one two and then three So this is a link list, right? So there's one two and three and this goes in all So what I'm doing is I'm going to keep going to the next on Recursively calling this. So is this a null? It's not right. So I'm gonna recursively call this passing the next So whenever you go to the next you're actually pushing of the stack frame So the stack frame now has like two Right, then is this null? It's not so I'm gonna go next recursively called to the stack frame So I'm gonna push three. All right now. I'm a null. Is this null? Yes, it is. Did I return? When I return my stack frame is gonna go back to this three and what I'm gonna do here is I'm going to print the data Yeah print the list nodes data Here Afterwards so and this is gonna print three and then after your return calls stack from goes goes back this stack gets Off the stack and then now we're at two now. We're gonna print try to print two. So once you print two This color goes out and I actually forgot to put one on the stack But yeah, then after this one goes out and this call the stack from goes back We're gonna print one and this goes empty. So we basically printed three two one So yeah, that's the juice of this code. I hope you guys enjoyed this video right com subscribe. That was like it So yeah, this is printed reverse and yeah, I got to go now. Peace


My name is Chad Rivera and I'd like you to join me across these next 10 minutes or we go tour your next place of residence Welcome home. And so beautifully built in the Cape Dutch fashion that it actually has history tied to it So much history in fact that the owners went to great lengths to refurbish the home without touching on those Architectural feats that make it something to be admired no matter what generation you find yourself in and a home That needs to be this admired definitely needs a place for your guests to sit as they come through that stunning front door You see to the left of that front door a security system that keeps your whole home guarded and throughout the home you'll also find camera and home automation systems again bringing this home up to the 20th century while still keeping all of its charm With this architectural style right here in this guest area Not only do you see beautiful flooring but also a stunning gas fireplace with a glass opening behind it Looking out to your front gaze and then when we talk lighting We've got scone lighting in the wall and down lighting across not only the ceiling above you But this incredible cantilevered ceiling that runs the length of one of the grandest hallways I think I've ever been in let's walk down this hallway and you can appreciate not only the width But the length of it and just how special the beautiful flooring makes it seem brings a lot of warmth to the room But talking about warmth what brings cosiness and families together more than a room Set out to do just that behind me You can see an inbuilt bookshelf with this stunning mahogany ladder that slides across left and right Allowing you to get to those upper shelves again a continuation of this stunning flooring probably some of the nicest flooring I've ever seen and a lot of that has to do with the texture and the size of the panels above us a bulkhead ceiling Downlighting but this is the place I'd assume that you'd want to sit down with your family relax Enjoy the floor to ceiling windows looking out onto one of the most exquisite gardens We've ever seen we are in West Cliff and you know that no matter which angle of this home You find yourself in and again as I've mentioned books places to sit down and what makes that come to life more than Another gas fireplace this home has six gas fireplaces throughout it and we'll show you each and every one So let's go explore Leaving the family room I'd be remiss to mention that every single room including that family room has speakers built into the ceiling so that regardless of where You are you can create a symphony of sound and bring the ambience if you need into the room that requires it most Much like this room right here this formal and dining room area That is without a doubt made to all each and every one of your guests two of the four walls Yeah, a floor to ceiling gloss. You've got again your beveled rooftop and then these stunning Stunning stainless steel chandeliers hanging above whatever dining room table you can envision here Obviously the owners have moved out taking much of their custom furniture with them But every single person I think looking at this house can envision just how it can be molded and Formed into something that will take your breath away and that garden that I'm looking at right now We'll definitely do that. But as you know, we save gardens for close to last because right now We have got you Pull these stunning sliding frosted glass doors open and take a peek at an incredible breathtaking kitchen gloss white cupboards and Stainless steel handles are a few of the high-end finishes that are drawn this kitchen Both gas burners on melee as well as adduction stove tops We've got an extractor fan kitter art in the stainless steel sitting just above that Both of them fold away and neatly and tidily into pocket Sections and yeah, we are in a kitchen that is without a doubt a chef's dream We've got Caesar stone middle islands with a beautiful prep sink or chef's sink built into it again The ceiling design continues with speakers Yes, so you can listen to music while you're enjoying whipping up your favorite meal stunning Stainless steel handles on every single one of the gloss counters and then melee not only gas But also electric hob with an extractor fan above it Heating table right here oven over there and so much counter space for you to fulfill all your desires But that's not all because as we know homes like this come with extra extra of everything and right here We can see an extra oven heating drawer and microwave We've got space here for a double door fridge and then when it's time to have breakfast You can either enjoy it yet your breakfast look with a family But maybe you want an informal dining room area and that would be right over Yeah, more Caesar stone countertop extends into the informal under counter storage again continues on this side And can you imagine roaring fireplace? The look of winter pouring through again another floor to ceiling glass Sliding door this time all of it etched with aluminum so that you know Every single piece and product in this home is gonna last a lifetime Well, you sit here with your family in this eights heater dining room table Enjoying the life that you've earned and again does show you just how large every single room in this house is But also how they're all made fit for purpose right here in the kitchen You also have access to your home automation system as well as an iPad They're built into the wall for your security concerns all of its taken You've got round the clock security and the door right here leading up to the back of the garden But we are gonna say that for later through the kitchen door and out of the side Coming out the side door you find yourself in a beautiful Expand that encompasses easily one of the most stunning staircases I've ever had the beauty of standing in the middle of but wait until you take a look at those breathtaking views taken from the top Time for us to round off this level the middle level of this three Story home with my favorite area the common area the family area the place you'll be spending the most time with your family and The reason I say this is my favorite is for because of a couple of things one the beautiful Windows flanking both sides of this room letting so much natural light and added to that the beautiful placing of not only your Downlighting but also your accent and lighting in the ceiling really does bring so much warmth to a room like that Add into that warmth is once again another gas fireplace found right over here in the middle Really becoming quite a statement piece of this room But probably my favorite piece of this is the design thought that went into it The room is neither too large nor too long with space in the corner for you to sit down Enjoy your corner couch and play games with the family or move up and not only enjoy the views from the windows Flanking either side of the TV, but to enjoy the TV itself with just enough space there to not feel crowded Nor they're being too much feeling too far apart from your friends and family And now that we've wrapped up this center floor It's time for us to take the scenic route down to the lower level as you can see walking out onto one of the most Beautiful as well as spacious outdoor areas serving as your patio leads us right now To your garden area and what a garden area this is Beautiful tree line all around you as you can see stunning old Really breathtaking trees I have to admit probably one of the most beautiful gardens I've ever seen on my left-hand side You can see there's a center there for your gas briars Well as prep area in front of me a beautiful boomer slash fire pit for you to enjoy with friends and family and then flanking This grand staircase both on the left and the right are stainless steel Fountains that tower above even me at six foot and walking down the staircase you are looking directly at a beautiful blue heated pool that Really does inspire images of Something you'd find outside of the White House now as I've mentioned the pool is heated as well as floors throughout the home This home uses water pump heating and all of that is backed up by a massive generator They can keep this house running regardless of what happens with the power situation now as you can see and take in Just how stunning this garden is it runs the length of the pool the pool Cascading over an edge down to the lower garden and that lower garden is accompanied by a basketball court It's not often you find one of those But something also very uncommon to find is located right here on this downstairs area a wine cellar As well as gymnasium and directly through these doors. We're going to be taking a look at both of them And here we are the lower level of one of the most incredible homes We've ever had the honor to tour behind me is that wine cellar we spoke about Let's take a look at that. Then it's off to the gymnasium Your wine cellar is closed off by a frameless glass door that leads on to a 1500 bottle wine cellar Slate flooring as well as accent lights hitting all the way up to the ceiling Houses a space that is large enough to fit a full-sized tasting table And now it is off to the gymnasium and this is not just any gymnasium because walking towards it You are greeted by a guest bathroom with both entrances from the gymnasium But also from the main area of your downstairs floor This gymnasium and this bathroom are both very very special You have got a full-sized sauna for you to sit in and enjoy the cedar wood while you sweat out all your troubles Framed on two of the four walls with floor to ceiling glass looking out onto that stunning garden But coming back to your guest bathroom This bathroom has a shower as well as your single vanity and toilet and that is not just any shower Flanked with nozzle heads from top to bottom There won't be an inch of you that doesn't leave you sparkling clean And finally off to our detour through the garden I get to utilize one of the most beautiful staircases that I've ever had the pleasure of taking a quick Drawn up to the top and you can see exactly why I love it so much Three stories down below you lit beautifully with the lighting throughout the home But above us we've got an art ceiling with not one But two skylights leading in a lot of natural light but talking about skylights Take a look at your outdoor balcony again another two skylights leading in light to our downstairs patio Now this upstairs floor is very special for numerous reasons But mainly this is where all of the bathrooms are located So let's take a walk down this hallway and take a look at this five bedroom Five and a half bathroom luxury mansion right here in the heart of west cliff As you can see the length of this hallway is incredible with so much covered space on my right hand side And the first bedroom off to the left The first bedroom is absolutely beautifully equipped with this stunning feature wall with Recessed LED lighting like the rest of this house This bedroom is massive with more than enough space for you to get changed relax and lounge about But a full wall window is looking down onto a stunning water feature Coming out of that bedroom you've got access to your first bathroom Then when it comes to bathrooms, you've got an ensuite bathroom Not only a freestanding and stunning bathtub But you've got this single vanity that absolutely dominates the space as almost a night up to the left hand side You've got your shower right there glass and clad and then rainfall shower head right there And then coming out of that bathroom you have your next bedroom as well as your next bathroom Now let's take a look at these epic lofts that are built into both of these bedrooms You've got a spiral staircase leading up right to the top Such a cosy area with a space here for you to push open and get a lot of air and also a lot of light Since that's gonna give in all of that view from your ceiling and how cool and cosy is this Can you imagine how many kids must be loving this view? You can make this a desk an office or even a small lounge suite Throw some fat sacks in the corner there maybe a small couch and let people just enjoy themselves 90 degree hallway is our last bathroom as well as last bedroom And we find ourselves right here in a beautiful area for a pajama lounge Or as you can see it's designed right now a place for you to display family heirlooms ornaments and photographs And then we come down at this short flight of stairs with beautiful windows on my right hand side Find ourselves in not the master bedroom But something so close it most certainly can equate as you can see so much space here for a bed of your choosing Built-in cupboards and a beautiful loft apartment vibe up above Comprising of the ceiling then your very own private balcony Overlooking your carport now that is a four car garage You see off to the left and you can also see the beginnings of a two bedroom One bathroom cottage that is completely separate from the rest of the home But let's take a walk down off these carpets and take a look at what the bottom of this staircase has in store for us Down that set of carpets stairs you find another living area Beautifully laid out with wood flooring and with so much space that an office of this size fits comfortably Right off the carport You'll have direct access to this without having to go through the main house And it also has plenty of windows and a door leading out straight off to the back garden And that comprises That back wing over the home again I need to just draw attention to how incredible This outdoor area is specifically since it runs the length of the home with all the bedrooms having access To their very own balcony albeit, maybe not a private one, but one with an incredible view And now it is time for the creme de la creme the master suite the room You have all been waiting for and i'm standing in it as we speak Obviously no mansion Most certainly one in west cliff would be remiss to have your very own walk in closet All of these beautiful sliding doors keeping the lines so clean and really matching With one of the most killer features of this home is this dutch ceiling You can see the beautiful wood slabs holding up the peak of that ceiling And then the keen eyed viewers above us will notice just above us There are these Skylit windows that you can just move the blinds off if you don't want the light or open them up And then get all of that air and all of that light Over here once again beautiful gas fireplace flanked with two floor to ceiling windows and then The place where you're going to be spending probably the most time where I most certainly would be spending the most time Is this massive king size bed the tv rises out out of the foot pedestal of the bed So if you do want to watch tv in bed, this this is the home to have it You've got a sound system built in to the walls since obviously the ceiling in this room at least is unique So there are your two speakers and then again a sliding door leading out onto that beautiful balcony The balcony thins on this side of the home So that you get a view of that incredible full length pool over there and then again these sliding stained glass pocket doors leading out onto one of the most incredible Bathrooms I've ever seen so let's talk about what you get in this bathroom freestanding bathtub again overlooking a Stunning forest of a garden as well as that pool two separate vanities and a whole wall length of Winter mirrors that also do open up and turn into medicine cabinets Then you've got two pocket. Well, I shouldn't say pocket doors. Let me say you've got two Bond doors over here. So it's slightly different hanging from the ceiling that cover up your shower your shower has your heated towel rack and easily the Largest shower head I've ever seen the shower also has completely frosted windows that you can open up If you'd like to release some of that steam and get in a bit of air And then obviously tucked away in the corner again with frosted glass Float-to-ceiling is your floating glass toilet and that does wrap up What 30 million rand buys you right here in the heart of west cliff This home was proudly brought to us by engel and forkers broad acres and their branches there guys Do not miss an opportunity to get a viewing of this home call their numbers on screen Right now and schedule yourself a viewing for a home That I think every single one of us can enjoy from myself Chad Rivera's and the team at private property as well as the team That helped make this show come alive. Thank you so much. We're going to be seeing you again at 8 p.m. Every Monday and Friday. Well, we showcase some of the most beautiful homes that South Africa has to offer I'd like you to tell us if you've ever seen a home if you've driven past a home if a home has taken your Breath away Tell us in the comments who when and where you'd like us to film next if there's a celebrity home You'd like us to check out. We're here for you. We love you. Thank you so much. We'll see you next time


Hello, and welcome to this presentation of the STM32 Chromart Accelerator. It covers the features of this adaptive real-time accelerator block, which is widely used for graphic computing in the microcontroller. The Chromart Accelerator offers true hardware acceleration for graphical operations. The Chromart Accelerator is built around a 2D DMA engine for fast data copy with specific functions to support pixel format conversion as well as blending operations between two planes. It also provides specific modes for managing anti-aliased fonts. The Chromart Accelerator will offload the CPU for most of the graphical operations with a 1 pixel per cycle throughput, integrated pixel format conversion, and blending. The Chromart Accelerator is fully integrated in graphical stacks, making its software integration transparent to the user. Note that this Chromart Accelerator is only available for STM32 L496 4A6 devices. The Chromart Accelerator has four operating modes. Register to memory for rectangle filling operations, memory to memory for 2D memory copy operations, memory to memory with pixel format conversion for bitmap drawing with format conversion, and memory to memory with pixel format conversion and blending for bitmap or text drawing with transparency. The user can independently program all the parameters for the source and the destination, the address of the layer, including its size and position, the color format, and the way transparency is managed. Register to memory mode is used to fill a part or whole destination image with a specific color. The color value is set in a register of the output PFC. Memory to memory mode is used to copy a part or whole source image into a part or whole destination image without changing the color format. Memory to memory mode with pixel format conversion is used to do the same type of copy as memory to memory mode but with a pixel format conversion. It can copy any input format to any output format. For example, it can copy an ARGB-565 image into an ARGB-888 image without having to use the CPU. Memory to memory mode with pixel format conversion and blending is used to blend a part or whole source image with a part or whole destination image with a different pixel format. This is widely used to draw bitmap icons having transparency or fonts. For each foreground and background layer, the format can be programmed independently. Direct mode fetches the RGB or ARGB content directly from the memory. Indirect mode uses an intermediate color lookup table to determine the color to be used during the copy or blending operation. All the input color modes are transformed internally into ARGB-8888 format to perform the blending operation. Specific modes can be used to efficiently manage texts and fonts. Only the transparency value is stored in memory for rendering anti-aliased fonts. The color is added during the pixel format conversion process and can be programmed by the user. These modes are very efficient for storing high quality bitmap fonts. The output pixel format converter generates the color for the destination independently from the source. There is no indirect mode in output as this would imply having to calculate a color lookup table or CLUT. Nevertheless, memory to memory operations without pixel format conversion or PFC can copy data independently of their formats. The fully hardware blender blends a foreground image and a background image with transparency. This can be used to draw bitmap images of any shape with a perfect rendering. One pixel is generated per cycle, making this complex operation much more efficient than if it was done by the CPU. The resulting pixel can be coded independently from the source thanks to the output pixel format converter. The output configuration defines the working area for the Cromart operation. The address and the line offset parameters are used to select which sub-area of the output is concerned. The background and foreground layers have their own configuration for address, line offset and color format. This defines which area of the foreground and background layers are targeted by the Cromart operations. The Cromart accelerator has six interrupt sources to signal configuration errors, CLUT transfer complete, CLUT access error, watermark reach during a transfer, transfer complete and transfer error. No DMA trigger is used as the Cromart accelerator embeds its own DMA. The Cromart accelerator is active in run, sleep, low power run and low power sleep modes. In stop zero, stop one or stop two modes, the Cromart accelerator is not available, but the contents of its registers are kept. In standby or shutdown modes, the Cromart accelerator is powered down and must be re-initialized when returning to a higher power state afterwards. The Cromart accelerator is widely used in any graphical application to compute the frame buffer without any CPU load and with a very efficient throughput. It can compose the whole scene with transparency and facilitate the management of animations. Text rendering is also accelerated, making it easy and efficient to manage anti-aliased fonts. You can refer to the trainings related to the RCC and interrupts for additional information.


Welcome to the Dominic Dawes show. I'm Joe Wombo joined now with Dominic Dawes head coach of the men's ice hockey team. And coach in an exciting weekend, you guys pretty much duplicate the way you played the teams at home. We go up to Elmira and beat them 4-3 in overtime. Yeah, no, it was pretty much a mirror image of the game here in terms of us kind of going up a little bit earlier and us kind of giving a few back. And then they score late in the game to tie it. And then we finish it off in the last few seconds of overtime. But it was a good, I thought it was a real good back and forth hockey game. We had tons of chances. They had tons of chances. But I think for us to kind of just mentally stick with it and finish the job there off and overtime was key. And it was a major lift to the guys. They come back and play a really strong game against number five Hobart. Yeah, I mean Saturday, I thought we played well, really well. We competed. I thought we controlled different parts of the game. And at the end of the day, they end up beating us. But I think in terms of a full weekend, that's the best weekend we've put together so far this year in terms of level of play. And it comes in the middle of a really long road trip. You've been away for two weekends. They go away last weekend. Now you're going to be away this weekend as well. What does it do for the guys in terms of letting them know that, yeah, they can do this. They can play this college hockey schedule. I just think the biggest thing is it shows them the level that we need to consistently be at. And I think it shows them that they can put together a weekend like that, put together a full six periods plus, because we played overtime both nights. And if we're going to be successful down the stretch, that's what it's going to have to be. I mean, if you look at every game we've won, and I think I've said this before, is it's all one or two gold games. So you're going to be in a battle every night. It's going to be the little things at the end of the day or the difference. Coming down the stretch, it's all conference hockey from now on. What do these games need to be for you guys to get into that playoff? I mean, they're all huge. Every game is a big game. The ECACI, I mean, if you look at the standings every year, it comes down to the final weekend or the final stretch of games. So for us, it's just kind of concentrating. Every game is a big one and a playoff game at this point. And we actually talked about that this past weekend. And I thought we raised our level of play to kind of a playoff mentality. So we've got Newman and Manhattanville on the road this weekend. It's two big games. I think we're kind of dead smack in the middle of both teams and the standings. But we need two points Friday night. We need two points Saturday night.  And hopefully, it'll pay off this weekend for you, having that just need to win mentality. Yeah, I mean, for us, it's just going to be kind of just focusing on what we focused on all year. Just go out there, battle, compete, work hard. And if we do that, we'll give ourselves a chance to win. I think the biggest thing will be, for us, just kind of staying disciplined and not having those lulls or points in the game in which we're taking kind of undisciplined penalties and giving the other teams some opportunity. Well, Coach, good luck and safe travels up to Newman and Manhattanville this weekend. Thank you. He's Dominic Dawes. I'm Joe Wamba, and this has been the Dominic Dawes Show.