Hey everybody, Lance Goyke here. So we alluded to this fact a little bit at the end of the last video on blood glucose during your workouts. What I wanna talk about today is that if I have a longer workout, maybe more lower intensity, but long, long duration, maybe longer than an hour and a half workout, that's when I might actually need some sort of intra workout nutrition. So kind of a hot topic, the whole peri workout, pre-workout, post-workout, intra-workout. What can I do to keep my energy levels high? What can I do to do the most work during my exercise? And what can I do to maximize my muscle gain or minimize my muscle loss if it's more of a cardiovascular workout? So biggest thing is that our muscle glycogen generally runs out if we have continuous activity for about an hour and a half. And it'll start to pull more of, your muscles will start to pull more of the energy, more of the glucose from the bloodstream. And at that point, you know, things we start to get worried because the brain likes to be in a really tight range of blood glucose. And you might start to get symptoms of hypoglycemia. You might start to feel a little foggy, a little slower, your performance might decrease. And that's just cause I can't get as much energy into the muscle and into the brain. So I might want to, at that point, take one of those, you know, those runner goo things or those backpacker goo things. So they're really easy to digest. They don't upset your stomach so much. And they also supply you with carbohydrate that is readily available to be digested and put directly into the bloodstream. So as I ingest food, it goes into my gastrointestinal tract and then the GI tract secretes, and you know, all of the GI tract secretes some sort of enzymes that help start to digest stuff. And that makes it small enough so that I can absorb it. And when it's absorbed, it's absorbed directly into the bloodstream. So it's in the whole of the, just your anatomy here. It's in the whole of the GI tract, surrounding and within the lining, the tube lining of the GI tract is your bloodstream. And those things, the food that you've eaten in the whole just starts to go out here and then it just sets itself into the bloodstream. And from there, it's dispersed throughout the body really, really quickly cause we exchange a lot of blood every minute. So biggest things are, one, we need to remember that if my workout is really, really long, I probably need to start supplementing with some sort of exercise. Like if you're gonna do a Spartan race, I would recommend having some sort of intra-workout carbohydrate. I'd make sure you have some sort of electrolytes as well. Same goes for a marathon or maybe even a half marathon depending on how fast you run. And then the other major point is to make sure that it's easily digestible.  I don't need all that fat. I don't need to digest all that fat. That's more of a slow kind of digesting process. That's something that is great to have most of the time but during a workout, probably doesn't have much of a relevance. So anything that is kind of maybe a little bit more sugary, quicker to absorb. So those runner goos are a great example. You can even just have like fruit juice, maybe not the most healthy thing but if you're running that much, it's probably not gonna affect you too much. Or if you're moving around that much, it's probably not gonna affect you too much. That's the whole principle behind Gatorade, that and the electrolytes. People were having really, really long football practices and after you work out for so much time, your performance is gonna start to decrease. So you need to keep that energy high and you need to keep those electrolytes high. That fights off the cramping and it keeps you making more and more energy so that your muscles can use it and so that you can keep performing.


Hi everyone, my name is Elder Sozo and I'm here today to talk about a little about something related to innovation. As you may know this cost action as an innovation committee and therefore this presentation tends to give you a brief overview about the mission of this innovation committee and what this innovation committee can offer to you in terms of supporting your ideas, your innovations let's say. So this presentation is organized as follows. So I will just brief reference to what is innovation in terms of concept and also what is also an innovation committee. Okay, after that I will also talk about the innovation committee of this cost action, how it is structured and what is let's say the focus and main responsibilities that we are thinking to implement during this cost action. And finally I will try to show an application. This is just a simple trial to show to you how this could work during this cost action. Okay, let's start with the concepts. Okay, so in terms of concept I think that according to the European Commission it says that innovation is something that has value to markets, governments and society by the creation of new or significantly improved products, process, marketing and organization. So at this stage I will say that innovation is not restricted to products, it's more than that. Let's give an example for example. Let's think about the new sensor, let's say a fiber optic sensor high tech that is able to reduce uncertainty. But we could think larger, let's say that the sensor allied to an algorithm supported let's say by the value of information theory could lead to some output that could improve asset management. So here we have a process since the sensor, the data and the extraction of useful information. And in fact if you have a very good idea perhaps this can have potential for a new business model. So you can explore this idea in terms of marketing. And finally perhaps if you think about the bridge owner for example that is responsible to do the visual inspection of his bridges, perhaps he's interested to enlarge his departments in terms of including also the structure of monitoring individual inspections to support asset management. So I think this is something in terms of a process that is highly dynamic that it starts with ideas, can be an idea, an invention, an opportunity that if you have a good idea you will definitely start seeking something that is related to a product, a service or a business model. And if you get to that stage perhaps you go to the market level, so perhaps you will start to commercialize your product. And if you are well succeeded perhaps after a certain time you will start monitoring the behavior of your new business model. And perhaps you have new opportunities and perhaps you have a cycle here from. So I will say that innovation is something that is endless and it's highly dynamic. What I put here is something that in my understanding is the key words about innovation, this concept. We have innovation, we have entrepreneurship and we have dissemination. And what about the innovation committee? So we are talking about innovation. Let's try now also to try to define a little bit what is an innovation committee. I went to study about this when I started this and I think the key message and I think this is very important is that the innovation committee should be a neighbor of good ideas. So innovation committee is not responsible to have ideas. The innovation committee is responsible to promote ideas of everyone. Also to create value, so supporting building collaborations, support intellectual property. And also to foster a culture of innovation. So this is also something that we need to push a little bit to in our research, in our interaction with the industry we should foster this culture of innovation. I think also in this construction is also important to highlight importance of the guidance and recommendations. So this innovation committee in this construction will have an important mission in these recommendations. And also how to do this? Well, perhaps we could promote competitions for teams seeking for the best ideas that could be flourishing in this construction. And also activities like innovation days or seminars. And I also think and based on the presentations that were presented today, I think it's also important to get the feedback from industry. So based on my experience with a bridge owner, it's very, very important to call them to this discussion in order to get their confidence in ACGEM technologies. You understand a little bit how they see ACGEM. And finally, I would say that once this cost action, hence, we should disseminate the knowledge that was in meantime acquired. But more important than that is that could last over time and behind the timeframe of this cost action. Well, what about what is defined in the memorandum of understanding of this cost action? I think it is that the innovation committee advises the steering committee in conjunction with the advisory board in regard to the dissemination of innovations related to the new technologies, mythologies and applications, towers, let's say, resource efficiency, productivity, robustness, reliability. And therefore, advising the dissemination of activities focusing on structures and infrastructure systems by optimizing ACGEM systems. Well, taking this definition and taking what I presented before, it's my understanding that we have here three main pillars that could be innovation, entrepreneurship and dissemination. So that cycle that I presented. And for each one, we should try to promote some activities focusing on each pillar. Besides that, this should have some interaction because this is embedded in a cycle. And perhaps we should also be aware that this innovation committee should be responsible for driving the entire process by providing guidance and help, reviewing its performance by periodic monitoring and developing the capacity to innovate at it last over time. I think that this structure, it's a nice way to present something that the innovation committee should try to promote near review and try to support the innovation culture. So the question now is how we could do this during this cost action? I tried to present you an example, very simple. So this is very draft. So what I present here is a table that I developed. So based in the memory of understanding, I put here for each working group what are the aims and also what are the proposed approaches for each aim. So let's, for example, pick one of them. So for working group one, it says that one of the aims is to formulate the value of information problems on real world applications. And the approach that is suggested is deriving a generic classification and representation of the different decision situations. So my question here is what the innovation committee could suggest to help this mission. So perhaps if you repeat again that table, I will try to put there the focus, which will be one of those pilars, and what should be recommendations under that pile. So perhaps in this case could be under the pile of innovation. And perhaps we could promote some brainstorm sessions during the working group one meetings by bringing together a wide range of experts in order to define that categorization of the real case applications. So this is a simple example of what we could think about it. But this could now be enlarged to all working groups and with the direct collaboration of the working group leaders. So I have to present a video just, I would like to show that about innovation. So this is a very pedagogic example that I did during my PhD. And this is about a live load tool that is able to present live loads, traffic load detections with some video streams. So what I want to show just to explain here is that we have here a video. This is the Mozilla Bridge in Portugal. We have here two spans. And in the mid span, we have a strain gauge here and another one here that is being acquired with a high frequency. So it is able to detect the passage of the vehicles. Okay. We have here a stream live. Here we have is a time history. And in the middle here is some information that we could extract from this time series of the strain gauges, like the loading, the velocity, the travel direction just to explain. So I will present this. Let's show. Okay. Sorry, this is in Portuguese some labels. So what you see here is a first vehicle crossing. And we see that the loads are detected in the peaks of the streams. And there is another law of another vehicle crossing the first span. It was detected in the second span. It was detected in the second sensor. So it's just to show an example of we could try to present to a bridge owner what kind of information could extract from ACHM. Now I would like to interact with you. And perhaps like I suggested as an example of the brainstorming for that example working group one, I'd like to hear your feedback for possible recommendation activities under which pilot in terms of innovation, entrepreneurship and dissemination. I have here some recommendations, but I'd like to hear from you because this is to support your ideas or innovation. What you would expect from terms of the innovation during this cost action. Please don't be shy. So I will try to explain a little bit. How you see this innovation committee help you to support your ideas or seek information for you to develop some let's say a proposal or intellectual property or the collaboration that we have here in potential. How you see as activities that could be implemented in this cost action. It's always the impact. So the impact could tell the clients what can they expect in their domain. But what does it mean if they have one or two? Okay. So in terms of impact of what is the contribution of ACHM for a bridge owner perspective for example. For the maintenance group for example. Do I have to inspect every second year or can I understand the situation? I will try to show some examples that I was thinking to discuss. For example, I think, for example, by bringing some case studies like the previous presentation that you did, I think it's very inspiring. The cases that you present because at least we see that the real world working and you see the feedback from the industry. And I think presentations like yours are very inspiring to get some ideas or what to do what the data that we are in terms of availability. I think also, for example, the suggestion of brainstorm sessions with specific target. I think it's also very useful. For example, for each working group, if we are talking about, let's say something related to how to use. For example, my experience, for example, is that what we do with such amount of data. Nowadays we are collecting data and data and data. What we should do with that data? Should we look to it and analyze it? Should we are collecting too much data? Is data good? Is not too much data is not good? What we should do that with that? Okay. In terms of also, I think we should promote some competitions in this cost action. I think it's, for example, the contribution from all. We should try to seek, for example, in terms of the best paper or best short scientific mission or best oral presentation and try to highlight the things that people bring to you to share with us. Okay. Another activity that I will suggest, for example, is bring some sessions. As I said, innovation days by bringing, for example, some successful case studies that in some way we contributed for innovation, patent seminars, if there are some interest, and others. Another, under the other pilot entrepreneurship, some recommendations that we could explore. It's, for example, bringing here a panel of entrepreneurs to share and give lectures about their experience or entrepreneur fair by involving them, investors, innovators to present their work, chasing markets, create value, and projects. This was already mentioned here. I think we also should try to see how to link these ideas with the potential for the real world. I think the industry here is very important because my opinion is that, I'm talking about Bridgenos, for example, they are the ones that pay the systems. If we don't show to them that systems are useful, I think ACGM is not sustainable, for example. And finally, under the final pilot, the dissemination, I think we could try to share the knowledge by using different channels. We have a website, but for example, we could try to enlarge these two other platforms, Wikipedia, TED, LinkedIn, television. I think these channels that are available should be used and should be stimulated to be used. I think thinking about after the end of the cost action, we should also monitor the knowledge that is being shared in this cost action. Try to see the citations, downloads of journals, of conference papers, number of views, for example, downloads from the presentation that could be shared in this workshop by video stream. Let's see if people go there to see if they download something. I think this is the way to assess the impact of this cost. And finally, but I think this is over time, try to see if during these four years that we are here sharing experience, try to see if this has a meaningful contribution to change some social and economic paradigms. Let's say, let's say in the universe, if this is changing some subjects or updating some subjects, if we have new problems in the market. And even, for example, I think this is very important for the early stage career researchers, if these also create jobs for them. I think this is also very important that it's something that will have an impact not only for the four years, but perhaps in a long term run. So this is some ideas for which I would like to have, I will be very happy to have some feedback from all of us, from the working group leaders, because I believe that two or more brands things better than one. So I think it's very, very important. So my intention here is to share with you some activities for different powers, innovation, entrepreneurship and dissemination, and targeting the innovation culture to be shared in this construction. Thank you for your attention.


Sensor added successfully. Sensor added successfully. Be sure to subscribe to our YouTube page and click the Show More tab underneath the video where you can view valuable links pertaining to this product, similar how-to videos, and our low-cost, no-contract alarm monitoring services.


Hey, this is Brett, and today we are checking out how to find your door code for your 2020 Ford Escape. They just redesigned this baby for this year, and of course now you have to find your door code in a different spot because everything's changed inside the car, but it's still pretty easy to get to. So we're gonna check that out right now. If you lost your door code, don't know what the factory one is. This is an easy way to find it, and it's not too bad. So you have to go underneath here. Now this is, if you've watched any of my other videos, this is kind of the same spot where the other ones are. It's just a little different. This panel right here where the fuses are actually lifts up a little bit, and you can see back here, and this cord that is kind of blue, purple, and white. The door code is located right behind there. So if you just move that cord a little bit and put your flashlight in there, you can see this white sticker. That's where the door code is written on. So pretty easy to get to. Pretty easy to find. All you need is a flashlight and a little patience to get behind that wire right there. So thanks for checking out the video. Remember to like, subscribe, and share on this video, and go check out. If you need more door code locations, we got a whole video playlist on our YouTube channel, which is youtube.com slash summit auto, and go check us out there. Thanks for checking out the video.


Welcome learners. This is the third video lecture on branding. Outline of the presentation. After going through this video lecture you will be able to define the role and functions of packaging and then you will be able to explain the role and functions of labeling. So here we will be focusing on two things. One is your packaging and another one is labeling. First we will discuss about the packaging. So the physical products must be packaged and labeled. Packaging has made the users of the products quite convenient. Consider its importance. Many marketers have called packaging as the fifth P along with the product price, promotion and place. So most of the marketers however treat packaging and labeling as an element of product strategy. And warranties and guarantees can also be an important part of the product strategy which are often appeared on the package. Packaging may be defined as all the activities of designing and producing the container for a product. So just imagine a product without package. We don't like trash the product then the product can also be damaged because if there is no package. So packaging protects the product. It gives a good appearance because of all these aspects like packaging is considered as fifth P of the marketing mix. So packages might include three levels of material. First primary level of packaging is for immediate holding of the product. Just for example the tube holding the toothpaste. And then the secondary package. Secondary packaging is the paper board container holding the tube and a flashing brand related information. So just consider the first thing is your tube of the Colgate or any kind of toothpaste. Then second is the paper board container where all the details information were given. And what is the third level of your packaging that is the shipping or transportation packaging. Like where distributors are distributed in a large quantities to the retailers and wholesalers. So packaging as a marketing tool are discussed as like I am going to discuss it. First thing is self service. In today's retailing format an increasing number of products are sold on a self service basis. Like we go to the supermarket and from that we purchase whatever product we would like to purchase. So in an average supermarket which stocks more than 15,000 items the typical shopper passes by some 300 items per minute. So given that 50% to 70% of all purchases are made in the store the effective package must perform many of the sales tasks. Like attract attention, describe the product features, create consumers confidence and make up a favorable overall impression. Then consumer affluence. Rising consumer affluence means consumers are willing to pay a little more for their convenience, appearance, dependability and prestige of better package. Just imagine some package which are easy to carry. So consumers prefer those packages like for 5 liters oil or like any bigger get things if you want to purchase. If that package itself is easy to carry then consumers will prefer that particular package or that particular brand. So consumers prefer buying branded on packaged products. Then your company and brand image packages contribute to the instant recognition of the company or brand. Because the logo, sign, symbol everything is like visible in the package. In the store packages of a brand can create a visible effect. Then innovation opportunities. Like innovative packaging can bring large benefits to consumers and profit to the producers. Companies are incorporating unique materials and features such as resellable spot and openings. Then you may observe how milk is packaged to maintain its freshness. Then different types of bottles like with the product. So it makes the product more attractive and like for some products for kids. So their packaging will be different to attract the kids. So it also gives some innovation opportunities. Then from the perspective of both the firms and consumers, packaging must achieve the number of objectives. Like protecting the product during the transportation, then identify the product, then convey descriptive and persuasive information about the product, then assist at home storage, then aid product consumption. So to achieve the marketing objectives for the brand and satisfy the desires of the consumers, marketers must consider the aesthetic and functional components of packaging correctly. Aesthetic considerations relate to package, size and shape, material, use of color, text, graphics, etc. So more the package will be attractive, the more consumers will be trying for that particular brand. Then although developing effective packaging may cost considerable amount of money and take several months to complete, companies must pay attention to the growing environmental and safety concerns about the packaging. In India, there are increasing concerns on the environmental degradation caused by excessive use of plastic in packaging. Some state governments have taken the decision to ban the use of certain type of plastic shopping bags. Some companies are showing increasing sensitivity to these issues and are using more environment-friendly alternatives and packaging materials like jute. Then along with the companies, the intermediaries and the consumers also have responsibilities towards environmental-friendly packaging. So while using certain type of packaging, we should consider about the environmental sustainability. So far we have discussed about packaging, now we will go to discuss about the labeling. First, we should know what is label? Like in any kind of product, you will see certain labels will be there where all the information required about the product or services will be clearly defined. A label provides written information about the product. Labeling helps the buyer to understand the nature of the product, its distinctive features, its composition, its performance, etc. Labeling may include different dimensions. There are grade labels as descriptive labels. In grade labeling, product classifications are based on quality. Like products may be classified into A, B, C or 1, 2, 3 categories based on quality. But among branded products, mostly descriptive labeling is used where they will furnish the detailed information about the product attributes, qualities and uses related information. Suppose, for example, date of manufacturer, date of expiry, then what are the contents there in that particular product? Is there any child-sensitive products? Ingredients were there in the product. So all these details will be given in the labeling. Now we will discuss about the functions of labeling. A label provides written information about the product as I have already said. Labeling helps the buyer to understand the nature of the product, its distinctive features, its composition, its performance, etc. Labeling may include different dimensions. There are grade labels and descriptive labels. In grade labeling, as I have already said, it can be labeled as A, B, C or 1, 2, 3, etc. The packaging sets mandatory labeling requirements and allows regulatory agencies to ensure implementation of packaging regulations in the specific industries. These are very important in case of food products and medicines. Here the date of manufacturing, date of expiry, etc. should be clearly mentioned. So in this video lecture, we have basically discussed about two things. One is packaging and the other one is labeling. The physical products must be packaged and labeled. So packaging is the primary task of packaging is to protect the product. And labeling provides the detailed information about the product. So packaging is very important in marketing and labeling provides us the detailed information about the products, its manufacturing and expiry date, etc. And packaging is one of the most useful tool to attract customers. A trademark, as I have already discussed, it gives a legal protection to the product. So that's all about this video lecture. And I have given some references for you to further reading. Thank you.


So, thank you for staying because you're all stuck here anyways. This is Extending Spark ML. Super happy new pipeline stage time, yay. I'm Holden. My preferred pronouns are she or her.  And I'm a principal software engineer at IBM Spark Technology Center. If anyone's looking to relocate to America for some reason still, come talk to me. And I've been doing this at a bunch of other companies for a while. You can follow me on Twitter, and it's mostly just tweets being really sad about America right now. So, if you're too happy, follow me on Twitter and I'll fix that for you, and then we'll talk about software. It'll be worthwhile. We're going to talk about what Spark ML pipelines look like, and then we're going to jump into extending them really quickly. And the topic said it was going beyond word count, but we've got 10 minutes, so it's sort of beyond word count. So yeah, Spark ML pipelines are pretty much the Spark developers looking at scikit-learn and going, ooh, shiny, steal. Unfortunately, they're big data developers, and so they got kind of halfway through stealing, and they didn't bother stealing all of the algorithms, but they stole the APIs. So if you're familiar with scikit-learn, Spark ML pipelines are going to be really familiar to you. And they're exposed in Scala and Python, and you can use it to do distributed machine learning. But the algorithm selection isn't like 100%, right? You might have some really crazy problem that you're trying to solve, and you need an algorithm that isn't already in Spark. And the good news is you can implement it yourself. And the stages in these pipelines are either estimators or transformers. Transformers are the little blue boxes, and those are just things which don't need to be trained on data. And so they're really simple to implement. You can just write in a normal Spark job and add a little bit of sugar and make a transformer. But if you want to build something fancy, like a machine learning algorithm or something which needs to be trained on data, you'll have to build an estimator. And we'll look at how to do that really quickly. Yeah, these two are swapped, whatever. We'll just cover up this part of the slides. No one sees this part. But we have to provide a transform schema and a copy function. And these are the two sort of non-standard Spark bits that we have to add if we want to turn our Spark job into an ML pipeline component. And then we can add some configuration as well. And then if you add the configuration with the Spark way, you can do parameter grid searches and automatically tune your models. And because I'm really bad at statistics, I frequently use parameter grid search because fuck, I don't know how to pick my L1 regularization parameter. The computer did that for me. So here is our hard-coded word count stage. As a licensed big data instructor, I have to put word count everywhere. You may wonder why it's in every single talk ever, and this is why. But we've got a copy function in our constructor. It's not super important, you can pretty much just steal this and change the name from hard-coded word count to hard-coded magic algorithm. And for copy, you just call default copy unless you need to do something really weird. In my sample set of two, calling default copy works 100% of the time. If it doesn't work for you, please don't tell me. I'll have to change the talk, and that would just be sad. And so now this is the part which is different than our normal Spark code. Because these machine learning pipelines can take a really long time to run, and because data frames aren't compile time type checked, we want to do at least some type checking before we start our eight hour or 24 hour machine learning job, and then come back halfway through and be like, oh, it failed because I got the name wrong of this one random thing. And so transform schema is the thing which gives us the ability to verify that our inputs are sort of what we're expecting. And tell the downstream people what our outputs are going to be like. And if this code looks kind of weird to you, it's okay. It's just the data frame code, and it's really simple. There's a lot of introductions to it, and that's where these types come from. The string type is not the Scala string type. It's the Spark string type which is mildly different in ways that are exciting, and not for a ten minute talk. And then we can just add our result here. And then we can do our work. And so this is really simple, right? We're just counting the words that are being put in. I'm not even doing the proper word count, but it's really simple. And you could do something actually complex. I find that doing this with the UDF, even though Spark has a really nice way to do integrated functional programming and relational stuff, it doesn't work really well with this part because generally what we want to do is we want to just add things to the data that's coming in. We don't want to get rid of anything. And we don't necessarily know all of the types that are coming in. So it's hard to use the full dataset API. So you end up having to use this kind of ugly UDF syntax. But it's not the end of the world, right? This is much nicer than writing a high view UDF. I promise, you've never written a high view UDF, you're lucky. And this is where your fun can be.  If you're an industry, you can spend a day or two. Or if your boss is wondering what you're doing, just have them email me, and I'll be like, no, it's super important. Trust me, and you can go and do some crazy stuff. And then we need to configure our pipeline stage. For pipeline stages in Spark, we use this parameter interface. And this just gives Spark a standard way of being able to configure and do sort of parameter grid searching. You probably wouldn't do a parameter grid search on your output column. It'd be a little weird. But you might do it on your input column, and you're not limited to strings here, right? So these are string parameters, but these could definitely be doubles, floats, and whatever. So you could do a parameter search on your tuning program. And then you provide some setters, and those are for humans to use. And it's really simple. And yeah, so we do it this way so that Spark's meta algorithms can work on it. If you don't know what parameters you should be adding to your machine learning models, you can go look at sharedparams.scala inside of Spark's code base and just like steal the ones that you want. You'll have to cut and paste the code or lie about being inside of package.org Apache Spark, cuz it's all private. If you lie about being inside of package.org Apache Spark, I don't know who you are. It's not my fault, but I do it pretty often myself. And so no harm, no foul, but your code's probably gonna break when you upgrade. Let's future use problem though. And if I've learned anything about scientists, it's that they don't seem to think about future use when it comes to their software, no offense. So that's really boring. We made word count, and I promised we were gonna go beyond word count. So let's go beyond word count. We're gonna make an estimator. This is the fancy thing. No one's excited, but it's okay. It's fancy. It's gonna like actually train on some input data. We do pretty much the same thing. So what our estimator does is we write a fit function. We have the same parameters to configure it. And then our fit function is gonna return our transformer. And so it's really simple. Yeah, this says November. That actually is old, but let's look at a really simple estimate. No, this is an old version of the slides, damn it. Okay, well, so I don't have the code for the estimator. But it's a fit function, which is just gonna return our transformer. Yay. So pretend that there's a fit function and it's gonna construct new hard-coded word count stage, or whatever it is you want. And if you wanna see the code for that, it's totally in this really nice blog post, which is a lot longer than 10 minutes, unfortunately. But hopefully maybe I trick someone into thinking that making their own Spark machine learning algorithm is a good use of their time. And you'll publish it to Maven Central. And then I can use it or tell people to use it.  If I didn't trick anyone into doing that, that's okay too. There's also this GitHub repo with a bunch of examples. They're written mostly by me, so they're a little, but if you wanna go ahead and look at the ones that are inside of Spark itself, you can find them here. And those ones are a little more, I wanna say, professional or production ready. They're not all great, but they put a lot more thought into them than I've put into mine. So you can definitely check those out. And they're gonna use internal APIs, but it's okay. You can just lie and say you're inside a package org Apache Spark. And there's API documentation and fun stuff. As an author of some books, I would be remiss if I didn't try and get you to give me your money. And so, and these aren't all my books, to be clear, I don't have that much time in my life. Don't buy this one, it's kinda out of date. Authors won't normally tell you that. But you should buy all of these other books. Even the ones I didn't write. But if you have an expense account, does anyone have an expense account? No? Okay, well, then don't buy several copies of this. But if you know someone with an expense account, maybe someone that works at Bloomberg, you can get them to buy several copies of High Performance Spark. It is the holiday gift of the season for whatever holiday is coming up next. If for some reason you don't wanna buy a book, which doesn't exist yet. That's okay. I understand. You can give me your email address at highperformancespark.com.  But please give me your money today rather than tomorrow, because money today is coffee. So, thank you. Any questions? One? Okay. Oh, doggie's name is Boo. She comes with me to all of my talks where I remember to bring her.


Hi, so today I'm going to be speaking about some quick wins for page speed. Actually, that's the talk title that I've submitted, but the real title of my talk is web performance for lazy people like me. So let me just speak a bit about myself. My name is Tejas. I make terrible jokes. You'll find a lot of them feel free to laugh and you know, make me not feel so bad, but I love closure and I love JavaScript. I work at Quintype and that's my credentials over there. So I've listed this talk as a maybe beginner to intermediate talk. I think there's been a lot of talks over this year's JSFoo and last year's about things like progressive web apps and stuff like that, but I wanted to kind of get back to some of the basics of what you can do to make your app faster. And in particular, I was looking for a few of the quicker things that you can do without rewriting your entire application and maybe porting it from one language to the other. What are some of the smaller things that we can actually do, which will take us a long way? So like most important or great talks, I'm going to start with an important quote. So if debugging is the process of removing software bugs, then programming must be the process of putting them in. This is from Edgar Dykstra. You might remember him if you studied computer science at Dykstra algorithm. So the first thing is why should I care? So let me answer this in the context of what I do, which is that we are sort of a software for a lot of India's most popular news sites. You might not have heard of us, but we power a lot of news sites behind the scenes. And the digital news space is incredibly competitive and maybe even worse than a lot of industries bounce rates are incredibly high, right? Just imagine how you interact with news.  You might click on it and then you've forgotten all about it and you're on to the next thing. And because we deal with a lot of news, many of our readers are from very rural parts of the country. We've worked with some customers whose main users are in like very rural parts of where the network connection is terrible and the devices that they're working with are also pretty. Yeah, so most of you would have gotten bored by now. So this is what that experience is for a lot of people where they kind of come to a big white screen and they don't see anything. I held on that slide for about four seconds and I know that in most of your heads, you're like, okay, what's going on? It's something go wrong over here.  Different reports have different numbers for this. And this is the first reason why you should care about your page load speed. And unfortunately, this is pretty brutal almost for every 150 or 200 milliseconds that it goes either way. You'll see that you're that the number of people who stick around and actually consume your content changes. And the second reason, and this is an update that Google has pushed in July 2018, is that Google is now using your page load time as an indicator into the PageRank algorithm for, you know, so they're giving you benefits if your page speed is good and they're penalizing you if it takes a long time to load your page. I don't know how many of you have noticed this new page, this new area coming up in the Google PageSpeed indicator site recently, which uses the Chrome user report, Chrome user experience report to actually tell you how fast or slow your page is on actual users. This is not an estimate. This is actual users and the time it took for them to experience your site. And like a lot of things, PageSpeed also is probably governed by the Pareto principle, right, which is otherwise known as the 80-20 rule. You can probably do about 20% of the work and get about 80% of the benefits. And after that, it comes down to a lot of squeezing that last bit of performance out. But we can actually do a lot of really quick things. And before we go too much further, I'm going to mention that a lot of these things are not in scope simply because they've been covered elsewhere or I think there's enough material out there on these and I'll put my slides up. So if any of these look very interesting to you, you can always look up the slides then figure out what to do over here. I'm also not covering making everything progressive web app with isomorphic rendering in part because this has already been covered. And also, and this is actually a true story, we actually spent a lot of time converting our entire site to a progressive web app, but we still didn't get like that sub second page load that we really wanted. So let me introduce you to the seven step program for a fast page load. So my first step is to build a chart. Here's what I made earlier, right? And this is mine, please, please don't just blindly copy my browser compatibility table. What you really want to do is segment your browsers according to how much you really care about them and how much effort you're willing to put in. So for me, it was the good in which I'm optimizing for speed, maybe the last five chromes, Firefox edge, Safari, Vivaldi. These are the browsers I really, really care about. And in these, I'm going to spend a lot of time benchmarking my performance and stuff like that. The bad, which is I wanted to work, but it's kind of slow. As the previous speaker mentioned, you see browsers up there because it's a pretty big browser in India, but we care a lot about it to work, but we're okay if it's a little bit slow. And the last category is browsers that you just don't care, right? I'm not going to spend any time trying to figure out how to get this to work on these older browsers, right? Obviously, this should be very much influenced by your actual business, right? I'm not going to make a blanket statement that IE6 is not worth covering or anything like that. Look at your analytics, look at your actual users, and figure out what they are really using, right? And be ruthless in trying to figure out what you should support. And I'll give a very simple example, which is like something as simple as CSS grids or Flexbox, which is covered by a lot of browsers, but maybe not covered by a lot of the older ones. Your development team can really choose about, do I want to spend about 3x the amount of time writing CSS to handle these old browsers or do I want to maybe cover this smaller set? And that's something to continuously keep in mind that supporting older devices costs you actual money, right? Both in terms of, you know, coding for the lowest common denominator as well as your dev effort. It's a decision you should be really pragmatic about. And my second and most important step in this program is to profile, right? Which leads me to step number three, profile. And for those in the back, that's profile. And just in case the people on the balcony missed it, profile. Step six is also, well, no, it's not profile, it's make a small change, but then profile, because that's the most important step over here. Why? Why should you actually profile your stuff? There's really two reasons. So the first is, because the speaker of today's talk, that's me, likes to make a lot of claims that you should not believe, right? There are no silver bullets out there. Because to quote Leo Tolstoy, all fast pages are alike, every slow page is slow in its own way. My problems are not your problems, right? I've optimized for a certain set of constraints. You may not care about that. You may have a totally different target audience. So please profile the most important thing. The next question that we want to answer is, what are you going to profile? So unfortunately, there are a lot of things that you actually can profile. And sometimes these are very orthogonal concerns. In order to optimize for one of these, you may end up sacrificing the other one. And it's very, very unfortunate, but these are, again, decisions that you'll need to make in a very practical manner for your business. As an example, you might care about the first time page load versus the subsequent load, which is jumping from one page to the other or even coming back a few days later to a different page on your site. And again, this is something that you know will be very business and domain contextual. So for example, we had a high bounce rate. So we care a lot about the first time page load. And the second time is, it's icing. Time to first contentful paint and time to interactive. And what's above the fold versus the time the entire page is completely loaded. So you're going to hear this a lot, which is above the fold. So this is what the fold is. Typically, if you look at on your mobile device, whatever is visible on the first screen, and maybe I'd argue maybe 20 or 30% below the bottom of that, that is what everyone refers to as the fold. So now that we know what we're going to profile, and ideally, you should have targets for each of these, which is I want my first load to be maybe under a second and subsequent load to be subsequent load to be under maybe half a second. How? So most people don't realize this, but the best tools to actually profile your site are in the browser itself. In this example, what I've actually done is I've clicked on more tools and remote devices. If you're building for an audience that's primarily on a mobile device, your best practice should be to actually profile on that device. It's not a thing a lot of people know, but just with a simple USB cable, you can attach your Chrome to, you know, Chrome running inside Android, and you can do a very similar thing between Safari and iOS. This panel actually will show you a lot of details, which I won't get into. Right. This is actually a picture of me sitting in an area which has terrible internet connection, trying to figure out why things are slow. The next tool I wanted to show off is something that's known as Google Lighthouse. Just raise your hand if anyone who's seen this. Well, okay, that's about half the audience. So Google Lighthouse, I think it showed up maybe last year, the year just a bit before that. And this actually shows up in the audit tab in Google. This is actually one of the most powerful tools for debugging your actual page speed, and they have releases of this almost every single month, and it just gets better and better. You can actually run this outside of Chrome as well, and we're going to maybe talk about that in a bit. But this actually goes through a lot against an actual browser, and it tells you after simulating your network, and it tells you how long things took to load. And the last question you want to ask is, well, how to profile? And this is one tool that I found very, very useful. This is called a webpack visual bundle analyzer, I think. Yeah, webpack bundle visualizer, sorry. So what this does is it loads up your webpack bundle, and it kind of tells you where your different hotspots are. Right? So in my example, I can see that my app.js is 350k out of which load-ash was 48 kilobytes. This kind of brings me to a myth in today's community that serving large assets with gzip is fine. It's really not. Compression reduces network, but not your processing. And India is actually in a very unique space in this, right? Because I think whereas maybe various other countries, the adoption of kind of higher end smartphones has been a lot higher. In India, the network, especially in like, for example, suburbs or slightly rural area, the network has improved thanks to a lot of work by the various telecom companies. But people are still not buying high-end hand phones. So you actually do have a huge amount of people who have decent-ish network, but terrible low-end smartphones, which actually brings me to sometimes the best JavaScript is done at all. A lot of people here do React, and everyone thinks about React for the front-end, binding, you know, well, rendering onto a container. But a fun read that I had is the BBC actually uses React only for server-side rendering. They completely do server-side rendering without any client-side rendering at all. Just because they felt like their site didn't demand that amount of dynamicism, but even though they enjoyed the framework.  Let's get on to what's the actual quick wins and what this talk is about. So the first thing I'm going to actually say is you can actually tell the browser what's important in your site. Most sites or most pages rather will look some variation of this. You'll open your HTML and you'll have some important CSS. It'll have, you know, maybe some images that are below the fold.  And then finally your app.js or whatever you actually need for interactivity. Your browser's smart, but you can actually make it a lot smarter. This actually brings me to the first tip that you can do, which is just, which is link headers.  So in the first line, I say that app.js, please reload it. What the browser does in this case is it makes the network request to download this JavaScript ahead of time. As soon as it sees this header, in fact, there's a very good chance that it will start to fetch the resource. This means that by the time you actually load the, you actually include the JavaScript on your page, it'll already probably be in memory or disk cache or whatever your browser is holding it for you and doesn't need to wait for network at that point. You can actually do this with JSON, with like fetch data as well. So for example, JSON, you can actually send that off to preload as well. And one thing that's sort of interesting that not many people will know is that if your CDN supports it, they'll actually do an HTTP to push for this. So people who are not familiar with HTTP to push, what that means is when I'm asking for this page, even before you ask me for this JavaScript, the CDN will just give it to you. Again, this is maybe great if you're trying to optimize for the first page load, but of course carries the risk that on the second page load, you might get a duplicate thing. So try to benchmark and see if this is actually worth it. But in our experience, we found this is something that's been really great. The next tip I'm going to come to is to inline your CSS, especially the ones that's important. So true story, I think I spent at least five years trying to figure out how to do critical CSS in the right way. I've tried passing it through Phantom.js and like, you know, every single method that that is there. But one day just an experiment, what I tried was I just took my entire CSS and I just pushed it into the head, right? I didn't even chunk it by page. I just put the entire CSS over there. It turns out it actually worked because anyway, I was downloading the entire CSS and from there, you could just improve on it. This does, of course, improve your first time page load. So again, you're duplicating it on every single page. So your subsequent loads may suffer a bit. But you know, you have other ways of doing that, including optimizing that, including with PWA or PJAX or any other way of loading your page and not duplicating it. Just from a security point of view, please remember to sign your CSS just in case you're doing this. But in general, and coming back to the principle of, you know, not making things work so much, compressing your CSS is like, it's probably the best thing you can do to actually reduce things a lot. And I know a problem that I've always had or my team has always had is we'll first start by writing an application and it will be great and performant and whatever. But then as requirements change, people will just forget to delete the old code, right?  So what we found here was CSS modules was actually a great way to kind of slowly fix this for us, right? And I'm not talking about CSS in JS over here.  But what I'm talking about is over here, you can see in the header.js, I'm importing a style and then I'm using that style in this component, right? So in essence, if I stop using this component, this CSS goes away from my CSS bundle, right? Which means that, which just means that I can use my regular webpack, hey, this class is not being used, you really want to import it as a way of also deleting old CSS. And another hidden feature that a lot of people don't know in Chrome is that Chrome has added a coverage tab. I think this is about three months ago. So Chrome has a coverage tab, which actually tells you what percentage of your CSS and JavaScript is actually being used. So you can see over there in the circle bit, this is actually pretty bad on one of my sites. It's about 64% unused. I think our internal target is to get it down to about 30%. Then we'll know that, you know, this is not worth optimizing anymore at this point. And the most important of all the CSS that sort of comes through, I would argue, is the font. This is I think one place that everyone kind of falters when building their site. And for those fonts are great because they really help push the branding of your site. But unfortunately, when you don't deal with them correctly, they end up being pretty slow. So the first thing I wanted to say is, please choose your FOIT or FOUT strategy. Yeah, please choose your FOUT or FOIT strategy very carefully. So what does that mean? I'm going to explain it, right? FOIT is a flash of unstyled invisible text and FOUT is a flash of unstyled text, right? So invisible versus unstyled, that's the difference. Speaking in English, what that means is while your font is loading, do you want all the text to be invisible? And then the font suddenly shows up? Or do you want to see a system font and then everything turns into that, into the font that you were trying to load? That's the two strategies and use font display to choose between these two behaviors. Font display will help you ensure that you choose these two strategies. But actually with this comes a secondary problem that may not be really obvious. By default, what browsers do is every single font that's loaded will cause a re-render of your page. So which means if you're loading four fonts, you have the initial render and then four renders after that. And by four fonts, it's probably two fonts with two different weights, a normal and a bold, which causes about which caused four renders on your page, right? And typically this will look like an earthquake. I don't know if any of you have seen that, but your screen's kind of moving a little bit left and right as the fonts get loaded one at a time. There's actually a JavaScript library, which will help you on this.  What you do is you say, give me a callback when all of my fonts are done. Or for example, or you can say two fonts are loaded and four or whatever, you have different options like that. And you can actually control this with CSS. So you would have a class which applies all your fonts at once, which forces the browser at least to do a single re-render as opposed to four re-renders. So let's come to the most heaviest part of your site. And I know that this has been covered including in the talk just before this, but images. Images are actually the single largest contributor to weight. About 55% of your page is probably images. So we had a great talk by Rahul from ImageKit yesterday. But yes, definitely use a service such as Imgics, ImageKit, Tumblr, Cloudflare, Polish, or any of these to make sure that you're serving the right image for the right device. And of course, these use WebP. Which is all great, but I wanted to call out probably the most important mistake that a lot of people who are not familiar with HTML5 do is please do not choose your image in JavaScript. It's going to be ridiculously slow and it's just not worth it. Your image tag has long supported, and the browser support for this is pretty good, has long supported a field called SourceSet. So what I'm doing over here is I'm saying this image, the source is large image.jpg and the source set is, and I'm giving a list of images along with the sizes that they correspond to. So small.jpg is 200 pixels, medium.jpg is 400 pixels. And I think most people stop at this, but please remember to put the third parameter which goes along with this. So the third parameter, which is sizes, helps your browser figure out which size it should actually ask for. So what the size is, in my case says, is that if the minimum width is 1024 pixels, that's what I call a desktop, then this image will occupy 25% of my browser screen. That's the VW viewport width. And on a mobile device, it's going to be a big image. It takes 100%. So what your browser actually does is says I'm on a MacBook 13 inch, that's 1440, and I'm going to take 25% of that. That's whatever number it is. And I'm going to pick the image that is slightly bigger than that. And maybe depending on my network, I may choose a smaller one, but the browser handles that for you. And this is actually very, very well supported, as long as all these images are in the same aspect ratio. If you're using a different aspect ratio, there's another there's another tool for this called the picture tag, which you can look up.  And with intersection observer, if you can, I'm calling out with the caveat over here is lazy load, whatever is below the fold. If you lazy load, what's above the fold, you're again, back to things being slow. I'm going to go through this quickly, because I know this previous speaker did a great job of covering intersection observer. But over here, I have an image. It has a source, which is just an empty GIF one cross one pixel just hard coded on the page. And it has a data source, which is the actual image. I'm going to create an intersection observer and say that start observe trigger my callback when it comes 100 pixels below the bottom of the screen. I'm going to observe with all of my on every image that has a data source. And for each online 15, you'll see that I just set the target source to the data source. Now this is really great because I'm able to use intersection observer, which is a technology. And you can use it as a polyfill on older browsers. Polyfills are the greatest because they let you use tomorrow's technology today. And people who are not familiar, this is what a polyfill is, right? Over here, I'm just trying to do new promise something or the other and promise is not supported in this browser. I'm sure everyone knows the solution to this, right? I'm going to import promise polyfill and just for the heck of it from the previous example, I'm going to include Babel and fetch and maybe another few polyfills. The tradeoff is that doing this blindly will probably end up with something like this where you can see over here, Babel polyfill is actually sitting in about 20% of my bundle. And that's simply not ideal because I don't want to make my faster browser slow just because some old browser out there doesn't support promises, which brings me to my next hack, which is a conditional right? So over here, you can see online to actually check if fetch is defined and window.promise is defined. And if it is, I include the entire polyfill, else I just load app. And then I later load app.js. I'm sure there's a webpack plugin, which will do this for you and much faster, but it's frankly just like a few lines of code so we weren't too bothered with it. This actually does support our overall goal, which is that it's really fast and has no performance penalty on my last five devices. And I think you see browser doesn't support promises and it'll load it. In fact, every time you load a library, you should check your bundle size, not just for polyfills. And I keep having this debate, I think with different people on my team who tell me stuff like, hey, you know, but when they just added the memory of Chrome, just went up sort of by maybe 15 or 16 MB. And should you care about it? So this my response is that, you know, 16 MB maybe on the server is not that big a deal. But 16 MB of RAM across 225,000 concurrent users, you're wasting about three and a half terabytes of RAM globally. So my argument is it's morally wrong for us to willingly waste RAM. So speaking of libraries, let's play a game. When I say it's 2018, you say we don't need it anymore. Okay. So yeah. So I'm going to start with low dash. It's 2018 and yep. So yeah. So let me kind of get started. I know a lot of you will know about this already, which is underscore dot map array and with some function, you could just rewrite that as array dot map. I think you'll kind of see in all of these discussions or these, these two or three libraries that I'm going to cover. I'm not saying bad things about these libraries at all. I don't think web development would have been even possible without low dash in the last, I don't know, like a few years, but browsers have slowly picked up and brought this functionality in house, which makes a lot of the use cases for these libraries more esoteric or for more obscure browsers that don't support this anymore. So with that in mind, let's don't, don't do this, right? Don't necessarily, even if you do need to use one library from low dash or say one function, like for example, omit, don't just import underscore from low dash. The reason is it actually pulls in the entire library for you, which can be quite huge. Instead do this. You can use a totally different tiny library such as object dot omit. If you really want to use low dash, you can import omit from low dash slash omit, which is right now my preferred way of doing it. But in webpack for doing import curly omit from low dash, we'll actually reduce and import only that one function. Thanks to web back for tree shaking abilities, right? I couldn't get the last one to work myself. So I'm kind of sticking with the, with the third one, but frankly, removing global imports of the entire low dash library actually brought down our, our bundle size by about, I think about 30, 40 kb. And the next thing, or maybe a little bit more anyway. So the next, next library I want to cover is jQuery. So I'm going to say it's 2018 and you guys will say, yeah, that's right. Right. So jQuery, I'm going to be a bit more nuanced because jQuery, everyone knows it does a lot of things. It's, it's, it's, it's really, it's a really powerful library that's been around for a long time. But what I've found in a lot of my own web apps was that what would happen is I would have most of my app written in React or view or whatever else the framework is today. And I just do react jQuery for a few small things like for example, fetching some JSON or maybe looking up a DOM, an element in the DOM and binding something to it or rendering react into it. It turns out you can actually get away without jQuery at all for some of these simpler use cases. So here's an example, a bit of code with jQuery.  I use document dot query selector or document dot query selector all to, to fetch my items. I'm just going to do dot class list dot add to add my class. And I'm going to use CSS transition to handle the 500 millisecond shrinking. And of course we have fetch instead of, instead of the, instead of the JSON APIs. And once again, I'm going to caveat this. I know that there's a huge wealth of libraries that are out there that are built on jQuery and I'm not going to pretend as if, you know, you can get rid of all of them overnight, but it is still a starting point for you to think. Once again, jQuery came in at a point where browser support for query selector and query selector all was pretty pathetic and, and you know, everyone would be implementing in a certain way. But as we've moved on to 2018, things have gotten a lot better. So last library I'm going to cover, but maybe not spend any time on it because we're out of time is moment. I know I love moment a lot. It's great for date manipulations and it's great for anything to do with the times and dates, but I found that if I'm only using something like to print out the current date, you can actually do this with a lot smaller libraries as well. The reason for this moment actually comes pre bundled with a bunch of local. So if you just import moment and don't do anything to prevent this, it'll come into like Dutch support in German and like every language almost that you could think of, which ended up bloating things quite a bit. So just in conclusion, some final thoughts. Although we were a PWA that wasn't nearly enough to get us to a sub second page load, right? In fact, you'll probably find that progressive web apps are all optimized for subsequent page loads and do very little for your first time page. Using a lot of these tricks as well as, you know, some of the PWA stuff, we brought our first content will paint down from about 350 milliseconds to 90 percent and saw somewhere between 35 and a 50 percent increase in traffic. And this should be a continuous journey, right? I've seen a lot of teams thinking about like a perfect day where we'll make everything slow for like a month and then, you know, one day we'll sort of clean it up. That's not, that's never a great idea because birthday never shows up. Every day should be performance day. And the last thing I'll say is the easiest way to get that to work is to measure your important metrics as part of CI. Lighthouse is now available as an npm module and can launch Chrome in headless mode and generate your response as a JSON response. It's very easy to run this every minute or every hour or whatever your capabilities are. And in fact, there are even services out there which will do this for you. There's one called Friota.sh, I think that's which will just run Lighthouse against your site every minute and tell you what your speed is and alert you when things are bad. In closing, I wanted to link to some great resources that I found. The first is the Chrome Developer podcast called HTTP 203 Non-Authoritative Content. This one's really great. They publish about a video every three days and every single video I'm like, wow, I didn't know about this. I think last week they did a great video on some of the new browser features which actually let you measure performance in the browser. So that's navigator.performance and it has a great amount of stuff on that. I of course showed you Webpack Visualizer and the last thing I wanted to show you is or was not sure but is cssstats.com in which you can actually, you will actually go through your site and tell you, these are how many fonts you've used. These are how many sizes you've used.  And as I have three seconds left on the clock, I'm done. Yeah, thank you. Before asking questions, I just have a couple of announcements. So there is a BOF on how to travel the world as a remote developer like freelancing stuff. And then there are two methods. Refresh tracks are going on like designing for voice and voice and VR interfaces. Please take the feedback forms and fill it like every feedback forms are end of this row. And then there is a break up to 420. You can continue questions. Yeah. So if there's any questions, raise your hand or however else they handle it. I'm not sure. Hey, I'm here straight. Wait, where? My left or my right? Hi. Yeah. Hello. So I just wanted to know how do you do? How is above the fold rendering then? So above the fold? Above the fold. Yeah. Yeah. So what I understand is, so if a user opens a website on his laptop or say, yeah, so the screen that he so the screen height which he, which he's currently seeing that is being rendered server side and the rest of it is rendered client side, right? Yes. So I just wanted to know how is it? How is this done? Where is the logic being written for this? Okay. So I think this kind of comes to, well, really what is the responsive design, right? Obviously there are two approaches to this. One is if you're relying on your CDN or something to do a lot of HTTP caching, then, then what we like to do is to render the, to give the same HTML back to both the mobile and the, and the, and the desktop and then render it in CSS, I mean, and render it with query selectors and whatever. And you can do a different approach if you don't put on caching very much. But to answer your specific question, I think at least what we do is the server side kind of will render whatever is above the fold for both the mobile and desktop. I think at least we've been kind of lucky in that the number of resources is drastically different. Like you might be able to see like five images on, on, on mobile versus say 12 or 17 on the, on the desktop. We found that the penalty for that hasn't been too high though, even though mobile only is using five or six of those 17 resources. Nice talk. Thank you.  I wanted, what is a parallax type style. Now I want my styles to scroll up based where I am on the browser. Right. But if I have not loaded the image that space will be empty, how to handle that part? Right. So that's why I think like, I think the previous talk also covered this pretty well, which is that I think the earlier way of doing this was you would use a lot of like, for example, jQuery, which would listen on scroll with, which would then calculate, for example, dot get bounding rectangle, typically to figure out what your images are coming into view that actually was really, really slow. The reason being that and when you start debugging with the, with the Chrome profiler, you'll see something a lot called reflows, which is what it's actually doing when the, when the browser is actually trying to query, figure out what's on the screen and kind of reshape everything, even calling, trying to figure out the position of an image with dot get bounding rectangle actually calls causes a reflow. And that was actually one of the reasons why this would be really, really slow. If you look at the intersection observer API, I'm just going to go back to that specific slide. Anyway, if you look at the intersection observer API, it actually gives you a lot of ways to very easily deal with this, right? So you can actually say that, that if you see line number six, it actually tells you that 100 pixels or 300 pixels below my screens when you should start loading. So that should give you a sufficient buffer one. And two is because intersection observer itself comes pre bundled with your browser. There's no question of the light of any external library loading before this loads. There's two things. I'm not sure about the support of this yet intersection observer. Yep. So it's in my, in my screen is actually, it's actually reasonably well supported. I believe Safari, I mean, mobile Safari and the desktop Safari also has support. You see browser is the only one that if I remember, you need to worry about, which is, which is edge is edge supports intersection observer if I'm not mistaken. And I think I, I'll need to check the chart on a counter question on that when we say lazy load. What happens is that there are no, if you see browsers, your browser doesn't load your page from the top of it. So if a user has stored, so say, let's say 50 percent of my screen and then he's, uh, refreshes the page, the actually the page loads at the 50 percent of them.  Are you saying you're looking at the page? Well, let's say my page was like three times the screen size. Okay. I've stole the second half of the page. Yes. When I refresh the page, what the browser automatically does it for me. It loads, loads from there. Instead of loading it from the start of the page, it loads me from the middle of the page where I was last told us. Sure. So what on lazy load will not allow me to know what is going to be loaded preloaded? Well, let me, let me think about that. Like, um, what I will say is that intersection observer I can see is very, very light. So frankly, even if you are at 50 percent of the page or whatever, intersection observer will figure out pretty instantly that you're at that 50 percent and will immediately trigger the, the, the callbacks for those images. And if you see the way intersection observer actually works, it says 20 pixels above the page, 100 pixels below. That's my example over here. So it won't load all the images that it took for you to get to that page. So, so whatever's on the first half of the page, it won't load that. It'll just load whatever's in the second half. Um, I'm not sure if it solves that specific use case, which is somehow you loaded the page at the 50 percent mark. Yes, if you don't lazy load the image at that, for that microbench market might be a bit faster. But I think overall what we've seen, including on UC browser is that, um, it's a pretty seamless experience, especially if you polyfill this, um, advanced.


Right, so that's the then the next topic which is block namespaces which is pretty similar to what Chris already said and that is that whenever you create a device a block device in whichever shape or Form that device will be globally visible to each and everything running on that system Visible on several areas one is as I said the The major minor numbers thing so you can always create create a device node And access the device via the device node it will show up in depth temp fs if enabled and And it will also show up in this fs under various things lists whatever So why it's possible to restrict the visibility Somewhat where the device see group it doesn't really resolve the underlying issue that is the device itself is globally accessible to each and everything and so that is why Why why we came up with the idea of block namespaces whether it wouldn't be possible similar to the network namespaces to just essentially have a mapping table internally for the major minor numbers visible to the process to the global major minor numbers roughly So those really the semantics you want because the network namespace is exclusive. It's a label namespace Which means that if you create a network namespace and a network namespace it sort of you lose the interface in His use case it sounds like you want the block device to propagate through children It's sort of it wants to be slightly more apparent child based namespace than a label namespace Yeah, well, this is not I block names of a support actually be coming from the other side What I want is to precisely restrict it So if you have a container which opens an ice guys device That ice because it was really should only be visited within that container to no one else Because really I mean it's it's that right. So now you need an admin because Devices are only certain operations on devices are only allowable to the admin So you've got to have a user namespace to get this to work as well. Yeah, I mean, yes, probably the There was a patch that It's taking one step back from the really hard problem of namespacing the actual device numbers There was a patch that a while back a colleague of mine did a previous company that I worked Who namespace DevTempFS? So made it possible that first of all you could mount DevTempFS into a container or meaning is sorry in an unprivileged container so namespacing of DevTempFS was done based on the user namespace essentially and Then you could mount DevTempFS in a container and then you could create He only did it for loop devices. This is where we did the original loop device work And when you created a new loop device via the Dev loop control interface from within that container Then the loop device would only show up in the DevTempFS mount of the container not on the host Nice story that seems Ollie seems in general pretty clean the problem really is Sisyphus Sisyphus is a worst Sisyphus is problematic more than proc in a sense because all devices will always show up in all Namespaces and all of the information attached to it. This is a problem that we've been briefly exchanging mails on for the loop of s It's essentially a hack to be honest the loop of s hack that I've worked on to provide namespace loop devices to container because currently this is not This is still not possible And that's really difficult the reason why we don't have a block device namespace is not because people thought this is a bad idea People thought this is a good idea. The reason we don't have it is because Greg was vehemently opposed to it and Namespacing Sisyphus and I mean I always thought if we this is just my If we were to do this properly then we at least need a new mount option probably for Sisyphus Yeah So that's Sisyphus so that we retain the old behavior in case Someone doesn't want to regress how Sisyphus works Yeah, and then give it a new give it a new mount option on the Host probably where you say give me the Sisyphus mount But only show me the devices that actually belong to my namespace. I mean sort of like is being done for security FS Yes, that's what I did for that's what I suggested for a security FS. Yeah, it's a massive amount of work Sure, it is. Yeah, it's I mean clear Eventually, this is something that we want to head for that we I mean what I would like to head for and that is that we indeed For Sisyphus filter out the view that it's that we only Present devices which are there which I guess we need to do anyway If we were to go about and virtualize Virtualizing the major minor numbers. Yeah, because the major minor numbers also show up in Sisyphus So if we have virtualized then each Process will have a different you view what will show up in yes, it's just block or sus character Exactly, so we will have to have that anyway Part of the other problem is this is a block device that you actually want to mount has a file system on it So then we have the problem of there are any certain number of file systems that are allowed to be mounted. Yeah But that's not that that's that's what I consider That's a container manager problem You can solve this which is not pretty but you know, it's at least possible like you can set up images in the container And then we did it via something quick excursion and then back to the original topic and then we use this call Interception to actually mount it so that that really works Block device number. Yeah block device namespaces. Okay, so the I I Forgot what I wanted to say. I'm sorry. I'm pretty jet like so no, but the the key thing is well I'm she let me challenge what you probably about to say Which is we don't if we did this and it was actually effectively namespacing Sisyphus. It would be for all devices It would work for block character everything Yeah, I wanted to say one one thing we have in common for actually giving you a shot Again, even though Greg is vehemently opposed to it We would need to talk to him probably about it before but one of the reasons is this the original story always was why it is An unacceptable devices belong to the initial namespace and Nowhere else But why yeah, it's not just the why but the story is no longer true for a couple of years now Think about it if you if you think about just network devices and you argue network devices don't have representations Don't have characterized the representations So we don't character network devices are actually special that that is why they are namespace because network devices on Properly namespace even in in Sisyphus But nowadays think about infinite event devices So rdma capable devices that you slice into as are taken as an infinite event device that you slice into various SRIOV virtual functions so that you have 20 or whatever I be devices these I be devices are all associated with a separate set of character devices in slash death you be verbs or whatever it is and People delegate infinite event devices to containers What they what you need to do right now is you need to move that infinite device the actual virtual function into the container and then you also need to make sure to pick out all of the character devices that belong to the I be device by parsing through Sisyphus and then Putting all of those character devices manually meaning the container manager needs to do it into the container the correct model for this is obviously You create you slice it up into different Into different net virtual functions you move that virtual function into the container and all of the devices Associated with this virtual function show up in depth tempFS That would be the model that we want because that's how device delegation in this case should work Yep, and this is we have the same the same problem on on the SCSI side With NPAV where we can create virtual SCSI hosts which really really really in the end of the day will be Will do belong to a container or a virtual machine, but they will all show up in the host and We actually have to explicitly disable you deaf to keep on running on these devices Which are exported over to the to the virtual machine. We did there's massive problems associated with this I have a long list of this because I've been struggling with this for such a long time System these you deaf manager Can currently well Leonard always argues it shouldn't run in a container because this of us isn't namespace and then you deaf gets confused because new dev numerates devices inside of the container and has a At database and then you'd have on the host as a database list and so on then they might start renaming things or so on So there is a lot of confusion because you know all of devices show up inside and and outside of the container And that is a massive problem because we have users that want to run system the ufd in their containers You know, you know why because you need it for network devices and network devices are properly namespace They're also namespace insistive as if you move a network device from The initial network namespace into a container network namespace then the device gets yanked from Sisyphus on the host and Into the container Sisyphus instance if it mounted a new Sisyphus instance and Sisyphus is tagged by the network namespace of the container Yeah, so and that's what I mean. So it's not unheard of. It's not that scissors can't isn't principle Not capable filtering out devices. It already does for our network gamespaces. It's just that well It doesn't do it for block for block devices or courage devices camp to speak of it Wait a minute. It's still not actually properly namespace if you want to go down the PCI bus You can still find the network card if you've seen me put a physical network card into the namespace You can still find it from the root doing that so it thinks that it has you have I think so So one of there was a more annoying issue when you created a Network when you created a new network device inside of a containers network namespace and user namespace then You had all of the Sisyphus entries show up correctly inside only inside of the container Sisyphus instance And the ownership was correct and it didn't show up on the host when you created a vet device on the host And moved it into the container the ownership wasn't changed so you had the wrong ownership on the host and inside of the container as well and Some paths weren't currently Correctly changed as well. And I think I've sent a patch series for this to to the networking tree in 2019 or something like this You can you can double check what I'm pretty sure there were a bunch of issues It's not properly namespace because this is not something that The namespacing knowledge hasn't propagated to all of the subsystem, which is totally understandable It's not that we did so far that has been done a great job at Explaining how namespaces work. There is not a lot of looking at the SROV use case for network devices Just pushing them into individual containers. And so there are still a lot of holes even in the Relatively well namespaced Networking networking file system Yeah, but in general, I agree we need we should at least try to get something like block device Namespaces so I'm tense I do wonder whether it would be possible to have it in a well staged approach that we first initially leave Sousa face well as it is Yeah, if we can Just ensure that we properly blank out the access to the devices via Via the device nodes i.e having a virtualized major minor time a table and You start as an initial step to separate out things and once that's in Then we can look at how we could properly filter out entries in Sousa face or whatever make Sousa face entries namespace So where I think those two things should be we should be able to separate them I think it's crucial even for the for the general Upstreaming story because if you come with a patch set that completely reworks Sousa face everything But the general question is do we want to go that direction or do I do we want to state? Well, actually it's a device which is a general thing and really should only should be only Should belong to the initial namespace and not to any container namespace. That's actually more underlying question This is your admin problem. So the device who requires an administrator to actually plug it in correctly So if you take the view that the container orchestration system just does all this for you It's the one that has to do the mount and then it can pass the mounted file system down into a container And if that's your only use case you're not quite containerized But effectively the orchestration system is coping for you, but yeah, I'm not talking about passing it off I'm talking about the use case that you have container which creates an ice-coz device and deletes it on when the container shut down Should this ice-coz device be visible in the host or not? That's what I think to Would we will do it either way the question is what do you want to do with or who controls what you do with the ice-coz? The control is complete within the container. No one else. Yeah, I think that's why I understood it It essentially works like the network network device like most operations can be done from inside of the container You need to mount it inside the container and we have all the trouble with the file systems and everything else It's so what I'm fishing for is how much interaction of the orchestration system. We presume exists. Do you need to do this? Works for the source devices. We don't usually have it's our IV I mean there are some if you do custom builds So we don't have the luxury of the network cards with virtual or physical functions I know it exists. I'm gonna be that way, but we are interested as I mean, this is something we would stone stores We would like to have it on the host but also within the namespace, but You have this device to manage it. It's there but inside of the container. I mean, we might want to give it like We have these Limited resources for stone drives and we might want to have that in a namespace So maybe the stone drive supports hundred open zones and we might want to have that container be able to do 20 And and this so we are looking into this and I'm happy that you're kind of also kind of we we think it's a good idea to Have this blog advice. We know that it is out of How you do containers or utility but but we do see for the high-performance database use cases they usually work with raw storage and Oh We need at least one more beer before I can even contemplate this I mean Adapted to the time zone yet, right? Oh blimey Possibly yes, of course we couldn't we can look into it, but it really is more QS issue which you raise and not really Because I wouldn't know how to map it at all at this time This would be because you would have to have concurrent access to that device And you would actually need to do some sort of QS on the concurrent access which really this is about it's not so much But that's not not so much about visibility. It's more about QS on access devices, which is you possibly can't do a Kind of works You should be able to do some sort of Can work but if you want to do it in the containerized way and how everything sets up and that's how C group were containerized That was the point of C group, isn't it? Anyway, so the question shall be Shall we try or shall I try or we try to see to have the blocks Names that makes a main namespace about or is it a lost cause can't hurt the situation is also vastly different the number of arguments for it is increased with overtime quite significantly Originally when when that was proposed Containers weren't as widely used and Delegating devices to containers was just a bunch of Yeah, a bunch of people were interested in this in the first place, so it wasn't really a big use case So it was easy to just say Don't delegate devices to containers Do you really need a new block namespace? Can you say that? block devices created by networks Network namespaces only show up in the network namespace. Yeah, that is in principle possible, but You end up with a You might end up with the same amount of the same amount of work because the device creation logic is different for network devices and for For character and block device what I mean by this what I mean by this is the character and block devices are based on the K object framework and The network devices if I remember this correctly, I haven't looked at this in about a year They are not based on K objects K objects at all So it's a totally different namespacing sorry some stores story So networking is namespace completely independent of character devices and block devices and so you need to hook into the Character and you can't take as far as I can tell you can't take the Character and block device creation out of the out of the block path You need to create a set of function out of the K object path You need to create a set of primitives and functions that allow you to create Namespace character and block devices anyway You need to do this in a generic way the looper fast pet looper fast patch set that I wrote past these functions at it Yeah, so and also the other thing is that we if we were doing this we would be completely losing out on infini band Because that's not really network as such so Oh Is it also running by the network namespace the infini men stuff if you're not using IP over B Yes, but also the underlying also the underlying infini men objects So in finna band can have two appearances one is as an IP thing in which it's basically just an IP transfer protocol The other is technically as a bus protocol where it appears a bit like a PCI bus that second one wouldn't be namespaced Exactly the second one wouldn't be which means that for anything over already. Maybe we'll be losing out Because it's just using IP over B for the initial discovery and everything else what it goes by a real infini band. I know A few years ago a new container was introduced specifically for our DMA interfaces Okay, I'm not really that into it. So yeah, you might be right anyway No, but I still prefer to have a different namespace for for block devices So if we're definitely so taking into the network namespace Doesn't really feel that right and again for loop devices wouldn't work because the device have no No clue with networking at all. Why should they be tired attack to a network namespace? And this is the first in principle the k-object logic in principle. This is one of the advantages has the ability to create objects create Sysafes entries based on namespace tags and The the current FS infrastructure, which is the underlying infrastructure that makes Sysafes possible has namespace tag as well So it means when you mount Sysafes inside for example a new network namespace then Sysafel will take a reference on the network namespace tag and attach it to the super block information structure This is file system specific nonsense But essentially it just means that Sysafes now is aware. I'm in a new network namespace Therefore, I should only show the network devices a network namespace devices that belong to my network namespace And exclude all of the others and I did similar logic For block and character devices based on the username space in this case I think Okay, good. Thank you


I don't know. I'm going to have to look at it tomorrow and kind of re-evaluate. I'm just trying to get better. You're coming off a pretty good start. Just how frustrating is it to take a step backwards? I mean, that's baseball. A lot of things could have gone differently today, but it just sucks because the hitters really gave me a lead and I kind of let it down. Was there anything in particular that felt off for you on the mound today? No. I mean, I was ahead of every hitter for the most part. 1202. Wasn't going to let Minstin hit me. And it would have sprayed a lot of hits around.


SCP Foundation. Department of Abnormalities. The SCP Foundation Department of Abnormalities has its main facility under a warehouse in London, England. This facility holds multiple anomalies of a variety of natures. These anomalies include the heart of man, a still beating human heart capable of distorting reality. Mr. Silence. Part of the Little Misters series of anomalies made by Dr. Wondertainment, the Morning Star. A hand in a half sword made in order-propadopolis style. Able to emit heat and fire. Despite these and other anomalies contained within the Department of Abnormalities facility, the main purpose of the facility is to contain a specific anomaly. Information on this anomaly and the lowest level of the facility within which it is contained are classified by O5 command. SCP Foundation. Department of Abnormalities.