Alright, so in the interest of leaving as much time as possible for questions and discussion at the end, we're going to get started. Welcome everybody, my name is Ivan Booth and I'm the Drupal Con front-end track chair. I'm a freelance developer at rootwork.org and I'm happy to introduce three of the folks behind Twig and Drupal. Twig, a part of Symphony, is being adopted in Drupal 8 as long as some Twig sprints go well on Friday, so I'm sure they'll talk more about that. I'll leave it to these three to explain why Twig is so great, but I'll say that when these folks presented at bad camp, there were literally gasps of joy from Drupal themers. Not something that happens very often. So to quickly introduce these three, Jen Lampton is leading the charge to overhaul theming in Drupal 8. She's been a contributor to the Drupal community since 2006 and maintains modules like total control admin dashboard. She's also the lead coordinator of Bay Area Drupal camp, despite her lack of an eye patch. Bad camp, that's a pirate theme. She does, however, like horses, which makes sense because Twig is basically a pony that everyone gets to have. Fabian Franz was born on the same day as the new operating system and has pretty much been contributing to free and open source communities ever since. He's been a contributor to the Drupal community since 2009 and is a technical lead at Trellen. Fabian has been helping Jen get Twig in core, which makes sense because Twig is going to make Drupal themers dance. And John Albin Wilkins has browsed the entire worldwide web, literally. So it was 1993 and consisted of two websites, but still, how many other people can make that claim? And he found the web pretty ugly because since then he's been making websites more usable, accessible, and beautiful. He works at Palantir and has made foundational contributions to CSS, SaaS, and Compass, mobile and responsive web design. He also maintains a little base theme called Zen, which happens to be the most installed Drupal theme ever. In his spare time, he enjoys playing with lemurs at his home in Taiwan, which makes sense because when themers look at Twig, they're going to go, ah, so with that, please welcome Jen, Fabian, and John. We had some intro slides. We're going to skip right to the point. So Drupal 8 is going to have a new theme engine. We evaluated a bunch of them very early in the process and decided on Twig. Twig is a PHP templating engine that is already very well documented. So Drupal itself has a little bit of a problem with creating great documentation, so we're really happy to be adopting a framework that already has documentation of its own. Twig is also extendable, which means that we've written extensions for Twig that work specifically for Drupal, but also anyone in the contrib space can come along and further extend Twig to meet whatever needs they have to, so we're not relying on getting it exactly right the first time through, which is good. Twig is also secure. The security team has been complaining about 100% of all Drupal themes with a little rounding error being insecure. And that's just because it's really hard to do it right. With Twig, we can put some protections into place that'll prevent all of the security holes that we're dealing with right now. Yeah, there's still some work going on. So that's also a possibility to sprint on. If you're on the security team and want to make it better. Twig is also really fast. So compared to some similar templating engines like Smarty, it leaves all the other ones in the dust, so we're really happy to be using something that's not going to be slowing us down too much. And it also has really great IDE integration. It turns out, go ahead. Sorry for the fast. For those that have been profiling Twig, there's one number that's standard out 0.3%. So Twig also integrates really great with IDEs. So anyone who wants fancy syntax highlighting is going to get it, which is really great. Can't get that right now with PHP template. And it also looks recognizable. So even if you've never heard of Twig before, if you've used any of these other languages, you'll be able to parse the files and scan them and read them in ways that make sense. Twig was also written by the creator of Symphony, which we're also adopting for Drupal 8. So those two systems play really nicely together. Who wants to see what it looks like? No one. OK, well, you can go then. Thank you. In order to print a variable, you use the syntax with two curly braces on either side and just type the name of the variable. In order to drill into a variable, so if your variable happens to be a more complicated data structure, you get from the top level to the second level by putting in a dot. And that's exactly the same, whether it's an object, an array, or anything else that we can come to invent in the near future. If you want to get something inside, you just type a dot. By the way, there's tons of chairs over on this side. I know it's hard to see from the door, but chairs. If you want to add a comment into a Twig template, it's a curly brace and a pound sign. And if you want to run commands, so if statements, four loops, you use a curly brace and a percent symbol. And we'll show you some actual code a little later too. Wrong way. So we had rolled together a bunch of patches that converted all of the PHP template files in Drupal 8 into Twig files. We got it ready at about 11.30 p.m. two nights ago. And since then, I started trying to actually use it to create a theme. I created one last night. Some of you might have been watching on Twitter. Some of them went really, really well. Some of them went not that well. When I got to the end, I decided that it wasn't really worth me going through the process of creating a theme in front of you. But I do want to walk you through the theme that we created, just so you can see what the code looks like. But I'm going to start off by painting the picture of the site that I was trying to build. So this is usually how I build it. Go ahead. One question before. Who of you have used Drake before? And who of you wants to use it? Whoa. Whoa. More importantly, how many people here like PHP template? Yeah, that's what I thought. Thanks. OK. So here's the premise. We're going to build a website. Home page is very straightforward, just a bunch of text on it. We're going to have a second kind of page that has one of the fields pulled out of the content and shoved into a little side area. And then we want to treat the markup especially so that if there's more than one value in the field, we want to wrap it in a section tag. So we've got some special control we want to do over our HTML. So three very simple things we're trying to achieve here in this theme. So I did happen to put all of this code, please. So I did happen to put all of this code on GitHub if you want to pull it down and rifle it through yourself at your own paster. More than welcome to do that. The Git project is called Twigified, although the theme has been renamed to Twiggy. OK. You will learn a song now. We have actually a Twig jingle. And it's 1-7-5-7-5-5-0. Come review it. Patch be a Drupal 8 hero. So all together. 1-7-5-7-5-5-0. Come review a patch be a Drupal 8 hero. And now you. OK. So we have here this theme that I created. Now that I've got my monitor resized. Where the homepage just has a giant header on it. We've got some content in a straight column. And all that really is is just a new template file for the homepage and a new style sheet. So just really quickly I want to show you the page template. And it should look pretty similar to PHP template right now, if you could see it all. And that's because the first step of making all of these conversions is just getting it working. And the easiest way to get stuff working is not to actually change very much. So right now we just took the PHP template and we're converting it to Twig. Once we get that done, there will be a lot of room for improvements. I know Martin is eagerly waiting to get his hands on the markup so he can change that. There's a whole bunch of people, teams of people who are getting ready to change the CSS. Right now all we're looking at is the syntax of this template file. So just as in PHP template, top of the file starts with a bunch of documentation, points out all of the available variables. This might not be exactly the same at the end when we're done with all of this. But for the most part, it'll tell you everything that's here for you to use. And then when you get to the actual markup, it's going to look a little bit more like markup. We basically have HTML tags. And when a variable needs to be printed, it's just printed in little curly braces. When you need to run some logic on it, it reads a little bit more like English than PHP did. If site name or site slogan, you don't need to worry about dollar signs or is sets or is array and not empty or any of that stuff that you had to do in Drupal 7land. You can just say if site name and print it. So pretty straightforward. We've got a lot of white space in here. It makes it easy to read. A lot of things that should look really similar. There's a couple of differences, variables. Like we said, if you want to render something that's a second level or deeper, you drill into them with a dot. It should be, for most of the stuff you see printed in any template file in Drupal 8, we've got a section at the documentation in the top that tells you what all of those things are. There's also a little method that lets you print out all of the available variables that we're going to clean up and give you a really pretty view into later. So the next thing I want to show you is a node template. And we have Morton. So Morton will make sure it will be usable. Well, you complained so long until it's good. You have been hurt finally. So the node template. What we want to do here is pull out an individual field and display it in a sidebar. I'm not sure how good the color is on these matters I can't see up here. It's just got a little gray background on the side. We pulled out an image and we've just moved it somewhere else on the page. So if we look at the node template, you'll notice that I put in a new little div here called info bar. I've pulled out the individual field content.field underscore image and thrown it in that little sidebar. And let's say we had, I guess I could talk about this now. One thing you'll notice here is a little bit weird. It's got a section of code in here that says block. And what that's doing is identifying a place on the page where you can say, hey, twig, something in this area is gonna be different. And then what we can do, Drupal seven land when you would create a copy of this node template to use for a different node type, you would have to copy the whole thing all over again. Well in twig land, what we can do is create a specific version of it that says here's the article template. It's exactly the same as that node template except for this difference. So in here I've just got a little piece of content that says, hey, this is just the difference of the two templates. So you no longer have duplicate code all over your site. So if I wanted to go and look at what an article looks like that is actually in my blog section, you'll notice that the caption now has some additional text there that says, hey, this is the diff of the original node template and now it's article override. Yeah, the fact that this node dash dash article twig file is literally three lines long. I mean, the significant part of it anyway is like, okay, four lines. But this is a huge win for me. There's so many times I see themes that have like seven or eight node dash dash something.tpl files and they all look almost identical and I can't tell what the heck's going on and when I open up a file. This is gonna make it really, really obvious and just so much better for everybody's workflow. Woo hoo. Okay, so the only thing about that is and we want to ask the Drupal community here, do you find the term block for that confusing? Who finds it confusing? Who would prefer code block instead? Who does not find it confusing and finds it pretty straightforward? So are you all people who've used twig before? A couple. If you used twig before and you called it block and you opened a Drupal file and it was called code block, would you be able to figure out what it was doing? No. So we might need to document that. We might be able to just provide you with both and Drupal coding standards would have code block but block for twig background backwards compatibility would still work. Would that be a good compromise? Who likes that? The question is a twig block the same as a Drupal block and they're not at all. One of the great wins of integrating all these other third party code is that we don't have to write so much and the integration becomes my cleaner. The downside is that everybody has their own sort of terminologies and they seem to conflict with each other. How many people were at this smacks session yesterday and then beat their head against the wall afterwards because of the module and themes and smacks? I, this is a really thorny problem and there is no good solution. I tried to rename block but it didn't go over well. Like Drupal blocks. And I say there is no good solution but really what I really want to happen is I want for you to figure out the really good solution and tell me and me go, oh, obviously. But so just think about it everybody and then come talk to me afterwards, okay? Thanks. Yep. All right, so the next example, what we want to do is treat the field and the sidebar slightly differently if there's more than one of them. So if there's one thing, we just throw it in this little gray area. If there's two of them, we want to wrap it in a section tag. So this is a, you want really fine-grained control over your HTML in particular. This is the code you want to generate. It's a section tag surrounded by a couple of figure tags. Each one should contain only its image and its caption. So I'm going to be overriding the field template specifically for images because these are figure tags. I don't want to roam in every field around my images. And so I've written some code here which checks to see how many items are inside my field. And if there's more than one, it'll print a section tag and then it'll loop through all of the items, print each one out along with a caption which happens to just be caption because that's what I put there. And then at the end again, it checks to see how many items are in there and prints the closing tag if there's more than one. So if we go to a page on the site that has more than one image, it'll wrap it in a section tag which is styled slightly differently in this case. Yay, that's how you do that. Okay, back to presentation mode. So I wanted to go over a little bit of things for trying to solve the problems in Drupal 7 because you're like, yeah, of course it's supposed to work that way but it didn't always go so well. So one of the first pain points that we have in Drupal 7 is the fact that inside template files, there are variables, sometimes they're strings, sometimes they're arrays, sometimes they're objects and it's up to everybody who is using the template files to know which ones are which which can be really frustrating. So here's an example of node template where it uses an arrow to print out the node ID. There's an example of the page template where it uses square brackets and text to get into an array. So in twig, any time you print any one of those variables, you're always gonna use a dot operator to get deeper inside it, so that problem should be solved. The second one is that we actually have two different ways of printing things into our template files as well.  So now it's up to the person using these template files to know which variables are safe to just print and which ones need to be rendered in order to be printed. So that's also pretty confusing. In twig, we're removing all calls to render from any template, so if you wanna print anything, you just put the name of the variable in there and it'll know whether it needs to be rendered or not and do it correctly. So that problem solved. Right now in Drupal, there are two ways to override the markup that comes out of core. First, you can find a template somewhere in the file system, create a copy into your theme and change the markup there. And second, sometimes the markup you're looking for doesn't actually come from a template, it comes from a PHP function, which is called the theme function. Well, in a perfect world, in twig, we would be able to replace all of the theme functions in all of core with template files. So there would only be a single way of overriding any kind of markup in any part of Drupal. So right now there's two ways. It's really confusing to figure out when to use which one. Sometimes there's one that's provided but it's not actually used and so you've gotta do some magic in order to make your stuff get used appropriately. And what we wanna do in the future is make it so that there's no question. You always go to the same place you copy and change your markup in the same way. We started converting every single theme function in every single template file and all of core to twig turns out there's a lot. And a lot more than even I ever anticipated. And we realized that Drupal 8 should be coming out soon-ish. And so maybe we should just focus on maybe replacing PHP template with twig before we try and rewrite the world. So what we've done is split all of our issues apart into first template conversions and then we'll do theme functions later. So right now if you were to go and play with a giant mega patch it's only gonna convert PHP templates to twig templates. But what we can do is go through all of those other functions later and be like do we need this, throw it out. If we don't need it, okay if we do we need it. Let's see, would it be better served as a theme function or wait, why is this even in the theme system? We have theme functions that don't need to be theme functions. So refactoring the whole thing with a kind of a holistic approach from top down takes time and we wanna do it but there's only so much of us. So come to the sprints on Friday and we can hopefully make this make more sense to people with a single way to override markup. So to do. And the other thing here was that when I mean a theme function is just some PHP code that's pretty fast. It's not even going through the whole templating system. And when we started this process and kind of had this first kind of work in progress mega mega patch which had like all the theme function and everything converted. We did some profiling on it. It was pretty bad because as Jen said there were things like same HTML tag which template was just output and you really don't need a template for that. So where we're going is into a direction where Drupal is still fast by default and talk a little bit more about that later but for everything you can implement template and then the Drupal can ship with some example files and those can be used just copy it into your theme removes the example and you are all set. Yeah and in Drupal 7 the theme system we got a little crazy.  We have pictures. Yeah, yeah, yeah. We, they were like oh this should be a theme function because it has HTML and they just did that like crazy and with twig front end developers are taking control of the theme system and Morton has promised that he will spank any backend developer who, yeah that sounds bad actually. Nevermind. Yeah school, he will school any backend developer. It is true, I will. Yeah on any, the proper method of adding twig file and I want all of us to work together so that we don't have the issues that we've had in the past where the backend developers were just, they didn't have any direction from us and they just did whatever they thought was right and they had no clue what they were doing really so we need everybody to get involved and take control of the theme system. And the front end developers have now taken over the performance department so we are in a good way. So yeah, there's a way too many versions of everything probably because every module developer decided to create their own theme function anytime they had any output to produce. So one of the things we're noticing is that we've got a bunch of different functions that all do the same thing. So what we're trying to do is consolidate and instead of saying you know this doesn't need to be a theme function this does we're saying these two things are almost the same is there a way that we can use the same function for these and in the process of analyzing all of the markup that Drupal normally produces we can put together kind of a set of components that are like these are the standard patterns of HTML that are used all around Drupal and if you need to implement something in the future module developer use one of these things that already exists don't write your own. So we're also going through a holistic kind of what's the most important patterns we see in Drupal and can we create templates that encourage people to follow those patterns instead of slightly breaking them for their own purposes. So these are the lists of all of our template actually this is probably not enough because this is before we had some new modules get into core but this is the code we're looking at cleaning up here. You just need to double that one side to have views added. So yeah just twice as many as you could not pick out in that list. So again this is something that takes a lot of time trying to break down everything we have so we're working on it we could use some help come to the sprint on Friday and we're gonna mark that one as to do as well. So the next problem is insecurity this is something that plagues everyone whether they know about it or not usually more when they don't know about it just because Drupal makes it really easy to do things in a way that's really bad for your site. For example when you need to get at the data of something in Drupal 7 you have a node object there and you can just drill right into it and grab whatever you need and it's PHP so you can just print it right to the page no problem. Well actually that is a problem most people who are doing this don't know it's a problem they don't know that needs to be sanitized they don't know it might need to be translated they don't know what's going on in that data they just know it's there and they can use it so they do. What we wanna do in Twig is make that sanitization happen automatically so that you have a variable there and you can drill into it and you can print it to the page and the instant you say print this thing Twig will go hold on a minute let me get you a safe version to use and gives you what you need. So we wanna make that invisible so front-end developers can focus on what they're good at their HTML, CSS, JavaScript and not have to care about the Drupal and hopefully that'll make things go a little bit better. I was actually creating this set of slides for the first time and I was like well you know what's really horrible is when people put SQL queries in their template files ha ha ha and so I typed one in and then I got distracted by something and accidentally reloaded my page and actually dropped my node table when I was creating the second one.  So another thing we wanna do is make sure that only the functions that we want people to be able to use in template files are allowed so you can't do things like run database queries and get yourself into a lot of trouble when you're working on presentations. So we've got a auto-escape feature in twig that we're learning how to implement for Drupal which will help with the sanitization. We've got three different approaches of how we can turn that on so that'll definitely happen in one way or another and we're limiting the PHP functions that are allowed and there's probably some of you who are like don't take away my PHP, well that's okay. Remember how we said twig was extendable. If you have some crazy use case where you need to add some functions that we haven't thought of, you can do it. You can extend it to do whatever you need. So that's fixed. You can even put that DB drop back. No, no, don't do that, don't do that, mostly fixed. So the next problem is that the language of Drupal, at least in the front end in Drupal 7 in particular was getting too specific to only Drupal. So you're having a hard time onboarding people who are experts in HTML, CSF and JavaScript because they need to know all of the Drupal that stuck into these files. We wanna take the Drupal out and make the files look more like what they're used to working with and also make it more approachable to anyone. So if you know twig, we wanna bring you in. If you know any other similar framework, we wanna be able to bring you in too. And the first place you look when you try and customize something in Drupal is usually in the front end. So we want those files to be legible, readable, approachable and not scary. So the fact that twig is used elsewhere on the web is good. It's syntactically similar to other languages which is also good and it's gonna look a lot more like HTML by the time we're done with it. Less PHP functions, more template files. Hopefully people will find that more appealing. So that's fixed. And the last one, this is really hard to fix, but Drupal right now is running a really, really complicated set of systems in order to generate content on the page. It looks a little bit like this. So if you tried to follow the path of a page request to figure out where some variable is coming from, you'll notice that it doesn't just come from one place and go to some other place. It kind of goes around in circles and triangles and death spirals. Yeah, this was a slide that I presented at DrupalCon San Francisco, trying to explain the new theming system that we just created to backend developers. And it was really, really frightening. And once I laid it out like this, I tried explaining it in 60 seconds or less. It was very, very challenging. But we noticed that once I laid it out like this, that there was some sort of hidden messages about this system. You don't have that slide? Oh, there's a video for a better slide that, anyway. So this is like crazy, crazy complicated. I don't even know how to just. It's okay, you don't have to do it. I don't have to explain it. Yeah, this is. Yeah, you've all lived this. You know how horrible this is. There's just too many different things going on all at the same time. The point is what we wanna try to do is kind of to say to you, use a template and don't care about the rest. So what we're gonna try and do is fix this up a little bit in Drupal 8. The first thing we wanna do is remove theme functions. So we only have template files. And if we can do that, it eliminates two of these subsystems, the original theme function and the theme override you put in your theme. The next thing we wanna do is remove process functions. This was another layer of processing that went between pre-process and rendering and templates that we added basically so that we could flatten arrays into strings. So that in the pre-process layer, you can stick your classes into an array. And in the template, you could print classes and they would come out as a string. Well, we needed some place to make that happen. Well, Twig can do that for us. It can do that when you say, show me the classes. It goes, hold on, let me make that array into a string for you. So we don't need that whole layer of rendering in there to make all of that happen. So, and this is actually not entirely thanks to Twig.  So using a newer version of PHP made this possible, but Twig does it already. So by using Twig, we can get rid of the process layer, which will help a lot too. We'd like to remove the entire Drupal render pipeline as well. Drupal render was something that we created in Drupal 7 so that you could do really complicated things with all of your content at the very last minute. Not we, sorry. Someone created. And it's really, really powerful, as long as you know how to do exactly what you want with it, but there's one person who knows how to do exactly what they want with it, it might be John. And so for him, it's great, but he still hates it. So we're like, well, if it's great, but you hate it, maybe it's not the right tool for the job. So what we wanna do is let Twig actually handle the rendering of all of those things. When you say, hey, give me a node author, Twig will say, hey, I know a node author is supposed to be a link, here's a link, and give it to you without having to run through the render system. So this is something that's been on our list of to-dos for a really, really long time, and we postponed it because we're like, oh, we're not gonna get to it. And then yesterday, when I tried to make a theme without it, I realized that it's not good enough, we have to fix this render problem. So we're gonna go back to the board, we've got some working ideas of how to solve it and see if we can get that done 8-app. So come to the sprint on Friday. The next thing we'd like to do is hook page alter, we need to get rid of that. That's kind of a big question mark, it might be the responsibility of a core initiative called Scotch, it might not happen, it might, who knows, we don't know, we don't like it, we wanna kill it, we're gonna figure out how, but it might not happen in Drupal 8. We'd also like to get rid of template preprocess and the entire preprocess layer. And now you'll notice that the title of the slide changed to Drupal 9 because we probably won't have time to do this in Drupal 8, but it's one of these things where a lot of people who are already theme developers are like, wait, wait, that's my favorite toy, why are you taking that away? Well, we wanna give you another toy that does exactly the same thing, but doesn't require Drupal to stop what it's doing and get a bunch of stuff ready that you're never gonna use and then start what it's doing again. So we wanna give you the same tool, probably have a different name, that does exactly the same thing, that'll work a little more efficiently with the rest of Twig. So there's a lot of preprocess functions in core and we need to do a lot of work on cleaning them up in Drupal 8 and then a lot more work on getting rid of them entirely in Drupal 9. But just that alone gets rid of a lot of those complicated subsystems that are going on in Drupal 7 and I think that'll help make the process of creating themes a lot simpler for everyone as well. The most important part here is it's no longer visible to the schema in that. We are kinda hiding all that complexity. Some of it is still available kind of in the backend and you can still all do crazy stuff. I mean, in Drupal you can do everything with 20 ways. But the usual schema that just wants this seam done and just wants to change this tag and just wants to change this list and just wants to add a class here can do that. And that's kinda the goal, to make it consistent and usable. So we've got a lot of stuff to remove. We like cutting stuff out of core but that's gonna take a lot of work so we're gonna mark that one as to do as well. So I don't know, do you guys think Twig is gonna help us get through all of these problems for having this Drupal 7? Okay. We do too. So as it turns out, we are going through this process of saying hey, okay, well now that we're using Twig, let's kind of look at the way we're doing things in Drupal with a new I and see what else we get out of it. And it turns out that there's a bunch of cool stuff that we get for free that we had never anticipated even being possible. The first one is that people want to be able to edit stuff in the browser, right? Having an IDE or some complicated workflow to change things is great for those of us who already work that way. But there's a bunch of people who are like, I just want to change this template. Well, can you just show it to me and then I can tip, edit and hit save. And guess what? There's a module in Contrib called Content Template or Contemplate which does that and it's been doing that with PHP for a really long time which is a really horrible idea so nobody go install it right now. Don't do this, it's bad. But with using something like twig that's no longer PHP code, it's now safe to save it. You can edit it, you can make changes, you can save it and it's not gonna explode your database or whatever Contemplate was gonna do when you weren't looking. And it will even be fast. And it will be fast. So yeah, we got a huge win by being able to finally edit this stuff. Yeah, the favorite thing to do with Contemplate was to edit your PHP file and accidentally introduce a syntax error and then have your entire site go into widescreen and have no way to edit it because now your website's a widescreen. Yeah, with twig though, basically it would do validation and it would not allow you to save that file or even if it did, it would just skip that template and go onto something else. So. So, saving PHP code in the database is bad. Twig in the database is okay. You can also save it to disk. Modules like Contemplate become useful again, which is great. And people who are used to systems like WordPress or other tools that give you in-browser editing, we can build something in Contrib that would do something similar to make those people happy. Also, twig is a language that's PHP-ish, but it also can be used in conjunction with other languages that aren't PHP-ish, for example, JavaScript. So if you wanted to use the same template file on the back end as the front end, you can do that. So, for example, if you're doing a HX page rebuild where you edit save and you don't want to reload the whole page, you just want to load the piece of the page you changed, you can use the same template file to render that from PHP as you can in JavaScript. So there are already packages out there that do this, in particular there's one called twig.js, that because we're using something like twig, we can just integrate with this other project and build a really cool Contrib module that lets you do that both ways. So I think that's really cool. And then the biggest thing for me, and this is just, this is definitely a pipe dream, but if someone here wants to build it, I'll be your best friend, we finally have the ability to have two-way communication between the code and the user interface. So for a really long time, we've always had this issue of like, well, okay, I went to the theme settings and I changed something, and then my template file, I did something else, and the two things disagree with each other. Like this says don't print the menu, and this says print the menu, which one wins? And for forever, we've said, well, the code always wins. I mean, we'll just break the user interface, it's no big deal. Like that checkbox won't do anything anymore. I'll remove the if check, it'll be fine. But then you have some poor end user who's like, I keep checking the checkbox and saving the page and nothing's happening. Well, finally, we have the ability to like, hey, Twig, has this file been changed? And Twig will be like, yeah, someone removed that if statement or that variable doesn't exist. And then Drupal will go, oh, well, I'm just gonna disable this checkbox. So someone goes to the settings page and it says, sorry, your template's been overwritten and the settings are disabled. There's at least a queue to the user that, oh, they can't change this, they're not gonna keep clicking the button and wondering what's going on. So that's like a low level, like, okay, two-way communication, cool. So if you take that one step further and say if Twig can talk to Drupal and make it do stuff like disable files, maybe we can go one step further and say, well, okay, the normal workflow for creating a theme is writing this beautiful HTML and CSS and then handing it over to a theme or a developer and saying, make Drupal do this. And then developers just spend a lot of time just like cutting up into little pieces and figuring out where to put it and building architecture that matches and then like sticking it on and it doesn't always work right. Well, what if you could just take that template file and throw it into your Twig theme and take, well, with our new zoom, Twig would say, okay, I see that you've put this block in this region and this field over here. So here you go, I built your Drupal site for you. Okay, so it's gotta have the architecture. It's gotta have the architecture to match. You gotta know the name of the block, you gotta know the name of the field. But there is a possibility for something like this to actually happen, which is definitely gonna completely revolutionize the Drupal world, if not the whole world. So I think that's the coolest thing ever. So anyone working on that? Start coding already. And we are working very hard at the moment to get Twig in core so that we can do all those things later in Contrub as well. So that's one very important goal of our initiative, that even if we cannot get to all things now in core, we are enabling Contrub to do and less possibilities. All right, so that's like our basic idea here, but there's a lot of stuff that you can do to make your Twig different from our Twig. Yeah, just real quick. What we did was we showed, we added really nice debugging output. So there's a key called TwigDebug equals true and we just need to get quickly back to our test theme here and take a look at the source. And what you can see is for each of those nodes and other theme cores like our region, et cetera, you see the file name, you see the theme suggestions and everything, so you're easily able to kind of now what templates could I use here? And that's a useful debug output we've built. So activating the bug is one way kind of to always, we build your templates while you are working on them. Currently in Drupal 8, it needs to be fast by default for production side. So if you are adding a template, nothing happens and you're like, what? This is by design because we wanna not have to check every time has this template changed, has this template changed, has this template changed, but you can actually enable this functionality and that's very easy. You just go in your settings PHP and you set this other key, quick auto-related reload equals true and then it will automatically reload and you can just edit your template files normally and it will always be compiled on the fly and always be accurate. The other thing is there's a trick cache key and some people try to change it and they were like, my Drupal is so slow suddenly. So don't do this, this is really kind of more developer only key. You don't need it, forget it just unless you want to see how your site is slow. The other nice thing is it's very easy and that's just one little code example, how you can extend trick. You're just defining a trick extension and then you have two functions like get functions and get filters and you can just define URL and T and then you can, from then on, you can use these functions and filters from your trick templates and those are just kind of, the first key is kind of the PHP that's called and the other part is how it's called and trick. Then we have people might ask kind of, what does change for me? I'm so used to the Drupal 7 way, what are the API changes? So one of the things we made sure of is yes, we created actually more render arrays for now but that's a good thing because this will allow us to, together with the infrastructure, the other people are working on to drill down into everything and to laser render everything. So for example, there were some templates that were like doing a huge stuff of preparation and rendering and doing everything and you're in your template and you don't need all of that because you just want to do some of that output. You can remove it and because we are kind of lazy rendering everything, it's much, much faster in that.  So that's a simple change here. As Jen said, there will be some more changes with a refactoring of the render API of that. Stay tuned. The other thing is the markup utility functions. I've already talked a little about that. There are some things like an HTML tag or a link where it really does not make so much sense that you need to change all of that link. There might be however, a use case that you want to alter the input of a link like the path or something where you need to change something in the structure of the link but most often you don't need to change the template itself. So what a markup utility function is, it's a seam function which is always fast and a variable kind of preprocessor that can be used for a template in one. And this map initiative kind of allows us to make that possible that for every seam function and for everything that is in Drupal you can implement a template but you don't need to. And that's kind of the idea here. The other thing is, well I've built this really, really big seam in Drupal 7 and it's all two coding standards and now I want to switch to Drupal 8. Do I have to redo this again? We've been given today a very impressive demo of Twiggy Fire. It's a module called by Forrest Maas and at Elephant Ventures on Twitter and they've demoed it today. They've shown a Drupal 7 seam, did some drush command and out came a Twig Drupal 8 seam. So it's not yet completely ready, it's in the sandbox but when Drupal 8 ships it will be ready and it will be your upgrade path to upgrade your seams. We've gone a long road. So yeah, we want to talk a little bit about all of the work that we've been doing for the past 13 months in order to get here. I know you guys are like, wait, why isn't Twig in core right now? It's hard to change all of the markup that comes out of Drupal. It originally started in one sandbox and we tried one approach which made a little bit of progress. We got to play with all of the systems but it didn't actually get it working so then we abandoned the first sandbox, moved to another sandbox, just basically forked core and started playing around with everything. We got it working in the second sandbox and then we started changing every single thing. We changed every theme function, we changed every template file, we changed everything. We had hundreds of people working on it and then when we got it close enough we're like okay, let's take all these conversions that we've been working on, generating all these spreadsheets and lists of who's working on what and move it into the Drupal core queue and group it into ways that make sense. So where would you want to apply a patch?  So this file is getting converted with these theme functions and these template files. So here's the change. And we started working through all of this stuff. We've got this meta issue here at node 175, 7550. You might have heard that before tonight. Where we started going through and making all of these changes. Every single one of these needs to be reviewed, it needs to be tested. We need to compare the markup before and after and so if you guys want to jump in and start working on these, that would be awesome but hold tight, something more important. About halfway through we realized that the scope of what we were trying to do exceeded our ability to do it in the next week which is what we wanted. So we ended up saying, okay, well what's the most important thing? Most important thing is to get rid of PHP template. So what we're gonna do is create this new issue and it's just gonna be all of the conversions of PHP template files into Twig. And so enter node 1987, 510 where we started just doing all of the conversions of the template files. And as we're doing these conversions people are like, wait a minute, we don't wanna make Drupal any slower because Drupal's already really slow and it's really late and if we make it any slower, we're gonna be in trouble. So it came down to all of the front end developers to learn how to benchmark Drupal and benchmark every single template conversion we had. So Fabian wrote this awesome little script and everybody got training on how to install XHPROF, all of these CSS experts were like, oh yeah, let me test that for you. And we got most of it done, which is amazing. So this is node 1987, 510. What we've done is converted all of these things, benchmark gotten, core committers sign off to make sure that they pass approval and we wanna get this committed this week. So if you have five minutes right now or five hours tomorrow or whenever you wanna do it, this is where we need the most attention and this will basically get rid of PHP template and get Twig and core. So this is definitely the most important thing to do right now. And once we have this mega patch in, it is in core, it's not getting out again, it is fixed. So let's get this done. So now we've got all that stuff benchmarked and we're getting in core and we're getting it approved. We also realized yesterday that it's not good enough. Some people might be happy that I don't think it's good enough, not good enough for me. I want Twig to be awesome. I don't want it to just be slightly better than PHP template. In order to do that, we've gotta make sure all of the use cases that theme developers have brought to us and said, I wanna do this in triple eight. I wanna print a node and I wanna drill into its field, image field and write my own IMG tag and print out the source right there. We need to make sure that all of that data is available in that node template in order for them to do that, which requires the refactoring of the render system. Oh, by the way, we gotta start working on that yesterday as well. So that's where we stand right now. We're really close to getting Twig in. We've got a lot more work to do to make Drupal eight as awesome as it possibly could do, but it looks like there's a lot of people in this room. So if we could close the door and just have everyone just get out your laptops, I think we'll be okay.  But everyone who came before, definitely we need to thank, there are a whole bunch of people who contributed to the first two sandboxes at previous sprints. We've got a whole bunch of people who have posted patches from their home or office or car or phone with conversions. We've got a whole bunch of people who are reviewing all of those patches. Maybe they didn't feel comfortable posting a patch, but they know how to look at HTML. We've got a whole bunch of people attending sprints now.  There's people in the sprint rooms right now working on it. And we've got a whole bunch of new people added to maintainers.txt just because of their work on this Twig project, which has been really great. We have a list here of all of these names. I'm not sure you can read them all, but there are a lot of people, front-end developers mostly, who are now core developers, which I think is really great for Drupal as a whole. If you've contributed to Twig, can you please stand up right now? Yeah, yeah, we have everyone stand up. Thank you so much. I really appreciate all the work you've done. So like I said, we're not done. Node 175, 7550. We need more help, but there's an IRC channel, Drupal-Twig. If you've got questions about anything, you can go in there if you want mentoring. You can come and talk to us in the Coder Lounge. There's a bunch of stuff we gotta do. Finishing template conversions and benchmark refactoring the render API, removing the process layer, converting all of the theme functions to template files or markup utility functions that'll also be determined by the render API refactor. Cleaning up the pre-process layer, cleaning up the markup generated by core and overall improving Drupal's performance. I know five weeks isn't a lot of time, but I think we can definitely get it done. So come help us, especially come to the sprint on Friday and we will take all of the new contributors. Just go to the session, get set up, come see us, and we'll get you to work. So with that. One last thing before that, I was really, really amazed for this XH Profkit. We had like four days, like 12 people sprinting at every time. It was amazingly awesome here at Drupal-Con. It's, the Drupal community is fantastic and the front end is even more fantastic. All right, so we have a microphone up here in the front. So if anyone has any questions, come up and ask them and I'm sure you have questions. So don't be shy, we're friendly. I will take this to grab another little issue. Jen, she will hate me for this, but as soon as Jen says go, we have the mega patch in, then we as front enders who know about markup but know about CSS have a responsibility. That responsibility is to make Drupal look like a modern system. That means that I used to blame John for all of the bad things in Drupal 7, which I think is pretty fair. The thing is that what John promised me is that apparently I'm leading the markup initiative for something for this. So everything that's gonna be wrong and the markup is gonna be my fault. I'm a very short man. I don't have the shoulders to bear all of Drupal on my shoulders. I need help. I need people with opinions about markup. We used to be really pretty opinionated. So if you don't know even know how to do all of this stuff, just know about markup and CSS. We have an issue called dream markup, which is just a hashtag for on D.O. Go in and search there and you can see us going really into the specifics about markup. But even more important on Friday, I will be willing to sit in the corner and flesh out each little bit and piece and figure out how we're actually gonna do it. So if you don't even know how to install Drupal on your machine, but you actually know how markup should look and be, I need your help. I need it really bad because I'm willing to take the fight with John and we're probably gonna have that. What? Thank you, Morten. We wanted to take one more question. It's Morten DK. Next question, please. Next question. Hi, so now that PHP is outside of the team plate, the battle always is like to know where the variables huge array has inside. How can I check that now without PHP inside? So there's no DPM anymore, I guess. Well, so we're gonna give you a twig inspector that'll basically be a DPM. Right now there's a dump function that you can put anything you wanna look into inside the dump function. It's not pretty. We only used it for the first time a couple of days ago. So we've got to refactor a little bit, but you will have a variable inspector inside that template file and it might even be in the docs at the top, so you just uncomment it and then it'll say these are your available variables and you comment it back out when you're done. Do you need to check the source code or can I just see it like that is DPM right now, basically? Yeah, it's just. There will be a replacement for DPM. Yeah, you won't need a development module, it'll just be in core. Okay, thank you. Sure. So you said that some functions with still, PHP functions were still available in twig? Yes. Which ones are there? So you saw a screenshot where we had added URL and T, right? So inside a template file, you can pipe anything to T and it'll translate it, you can pipe something to URL and it'll turn a path into a link, right? So there's gonna be a whole bunch of those and it's gonna be based on what we find in our existing templates and what's needed. There might be stuff like a format plural that we really handy to have right in a template file. So we're gonna come up with a list of stuff that we think should be added. There's already an issue on Drupal.org that's like add these things as filters or functions or whatever it is we want them to be. But if you have used cases that are different than the ones that we know, add them to that issue and we can get them in. And can we alter this list or the white list? Can we what? Can we alter the list? Can we alter the list? So you can extend twig. So if you had your own like twig pack or something twig super pack, I don't know what you wanna call it, you can add anything you want in the same way that you want. And you can also replace any functions you don't want. You can alter twig completely and 100%. So with your vision of having all the process and pre-process functions gone, where do you see the functionality going from there?  I don't know what that looks like yet and we won't until we get closer to it right now. We're really focused on getting this converted. So for Drupal 8, at least as far as we can see right now, pre-process will still be there and you'll be doing everything in pre-process exactly as you did before. So if you wanna add new variables, you wanna alter variables, you wanna add classes, you can do it all in pre-process, but what we wanna build is a way that you can do it more easily directly from the template file and don't need to go into pre-process. Pre-process will still be there. In Drupal 9, I'd like to get rid of pre-process entirely and give us something that's not quite so non-performant.  None of those variables are prepared at all until the instant you say, print this variable and that'll make Drupal a lot faster. One of the things that I do a lot with pre-process functions is, you know, there's like 18 different types, excuse me, 18 different types of node types on like really large sites and rather than having 18 TPL files, you just have one pre-process file and do some sort of logic in there to different things. That's the easiest way in Drupal 7, but with Twig, they've got that new code block thing and then it becomes like having an actual like node dash dash article Twig file that just has that little bit of three bits of lines of code actually makes it easier to see what's going on in the system than trying to dive into the template.php file and find the right pre-process and then understand the logic. So it actually, a lot of those things that you have to do it inside of pre-process will be much simpler and better organized and easier to understand using Twig native stuff. Part of the reason why we don't know what it looks like yet is because we're not planning on removing pre-process in Drupal 8. Thank you. I'm one of those developers that got lightheaded when you said something about removing pre-process because I use it quite a bit. One of the best practices as I've always understood it is to keep your templates as clean from logic as possible and do everything in pre-process but yet in the examples I was noticing you were doing stuff like running through loops and doing a lot of logic in the template. So I'm wondering, is that basic premise changing? No, so it's exactly the same code as we had in the PHP template files. So the PHP template files also had loops and stuff in them. It's just the Twig equivalent syntax for doing that. So what we wanna keep out of the template files are stuff like database queries and complicated functions. We wanna move those someplace else and just have you print the variables. But sometimes printing the variable means looping through all of the items in a menu or looping through all of the items in a field. And so there's syntax for that in Twig. So first of all, logic should be in templates. That's why Twig is not just print this variable or something that has kind of like this programming language but that so far everyone could understand that I've spoken to and quite easily in that. The other thing is if you now in Drupal 7 wanted to have an item list and you wanted to have your own item list you would need to copy all of this code from api.drupal.org, copy it in your template PHP, then change it a little thing and it's very, very complicated. It would be much easier if you just copied the template, changed the thing and you're done. And in that it's easier and it's also easier to understand because all of that complicated logic, it's all, there's still some complicated logic in the pre-process but no more complicated logic in the template and that's kind of the goal of that. I just wanna like follow on this idea of this best practice of not having any logic in the template file and I bet you can go back and find videos of me saying that, right? And the truth is that that is a lie. I've been living a lie for these years. And the reason for that is I've come to understand is that really there are two different kinds of logic. There's business logic and then there's display logic. We need some things for like lists, right? This is a display, a design decision about you have to loop through these items, right? And it's perfectly fine for that kind of logic to be in a template file but what you don't want is the sort of business logic stuff and keeping that stuff in the template.php makes a lot of sense or whatever, a module or something like that, right? Okay. Hi, I was just wondering if you could explain how the editing of templates through the Drupal UI is going to affect disk-based templates that are stored in code or in version control? Well, it depends on whoever writes the module. We're not, that's not something we're doing in core. Oh, that's not gonna be in core. So, yeah, and it's definitely the kind of thing where whoever takes that on and wants to make that happen will make their own decisions and it'll be based on that. Those were just things that like, oh, look what we could also get us but that's not something we're working on. Okay, thanks. Sure. I can put on my sort of pregnistication hat. There's a CMI initiative where they're writing like all these different YAML files to YAML configurations that go into files and certainly there's gonna be a lot of sort of existing Drupal 8s of examples of how different things are supposed to work as far as configuration management and then I think that like the person who decides to take Contemplate module which seems a logical place for it to do to be the Drupal 8 version of this module may look at those examples and come up with a system where you, you're editing it on the fly and maybe it's saving it to disk, you know, inside these files that are similar to Contemplate. Wherever it's stored, it's not important because with Twig those files are compiled to PHP so it's still a PHP like template that's generated in the end so it really doesn't matter where that file is coming from. If you wanted to, you could store that file on Amazon S3 or wherever and just get it or get it from FTP server or create it on the fly, you could create a template on the fly, you could create something that would create templates on the fly so possibilities are endless. Yeah, I guess my question was just if you're editing a template through the UI that's stored out on your server and then you're pushing code, updated code from version control, that's got an old version of that template, where are you sourcing from? So it probably wouldn't overwrite the template that's already on disk and we've got patterns for this already with CMI where when you export something to CMI it goes into a directory that's not actually overwriting its original, you just have to grab it and import it some other way. So there might be a similar model like that. You might also, you could still save it to the database, you could save it anywhere, so. Okay, thanks. Sure, any other questions? Okay, so we need you all to come to the sprint on Friday, but please also evaluate the session. If you go to the schedule for DrupalCon you can find our session and evaluate it there. Thank you very much. So we're also doing a bof, if anyone's interested in talking about this more casually that starts right now at five o'clock. So in 12 minutes, do you know what room it's in? A, one, something, go look at the bof schedule or follow someone who knows. But we're gonna do a twig bof. Don't follow John Alvin.


I'm First Lieutenant John Butler. I'm the Senior Air Director and also the Operations Officer for Subic Bay, the IFR Detachment. So today we actually conducted one of our Mets McCree. So as I said, my role in the training that we accomplished today is the Operations Officer. So I did a lot of the planning and coordination before we actually came out to the Philippines as well as the Senior Air Director who is essentially the radar supervisor and can work with the controllers and maintainers to ensure we're properly conducting operations here on the airfield. So operating here in the Philippines is very unique. We're operating with some of the host nation controllers. So we have liaison officers in the tower. We also have a bunch of controllers down in Manila who are operating in kind of a joint environment. We have a lot of coordination that needs to happen, especially because it is not U.S. airspace. So there's a lot of coordination and a lot of planning that needs to be done ahead of coming out here. And then once we're actually out in the Philippines, again, it's very hot. It's a very humid environment. So it prepares the Marines for environments like that. So this training and Balikatan 23 is essentially an opportunity for us to work again with host nations and also have the Marines come out, execute their mission essential tasks and be able to conduct their job and their mission occupational specialty. So being able to come out and interact and coordinate with the host nation and also the Philippine armed forces, it really provides us an opportunity to integrate and kind of cross train with them and it makes us better in the long run. So coming out here and executing Balikatan, this is one of the larger exercises that we have throughout our year, our annual training cycle. So Balikatan 23 is one of the largest bilateral exercises. The first Marine aircraft wing conducts throughout the fiscal year. It allows us to interact with the host nation and armed forces of the Philippines and it really allows us to prepare for future operations by integrating with them, coordinating with them and training alongside them. So I'm a part of the air traffic control facility and I bring out a capability that's very unique. So the IFR debt or the detachment is essentially a radar system, a expeditionary radar system that provides air traffic control services in a degraded and austere environment. So we're essentially able to employ using very little logistics and able to provide a radar that that location may not have. So it offers our aircraft in first maw the ability to operate in areas where usually they're not able to.


Hey folks, so welcome to this new session and new topic on polynomials so We are going to discuss What all polynomials are there and how polynomials are defined why are polynomials called so and different types of polynomials and Primarily, then we'll be Trying to visualize polynomials on graph paper and then we will be studying about Let's say something called zeros of a polynomial and the properties around zeros of the polynomial So in this series of sessions, we will be covering all these topics, which I just discussed So in this session, we are going to discuss what all polynomials are and how do we define them and what are different types of polynomials? So let's do a quick Overview on polynomials. So we'll actually start with the very basic Concept in algebra. So as you know, these things are studied under algebra okay, so The first song was first thing which would have learned in algebra is something called a term Is it so a term is of the form of a times x to the power? Let us say n Where you know this a is nothing, but this is called the what is this called? This is called coefficient isn't it coefficient of this term and x is the variable so it need not be x you can have any other alpha Alphabet instead of x or any Greek alphabet as well and n is called the exponent Exponent or power right? So this is usually comprises this usually comprises our Algebraic term guys now next in line was our definition of let's say expression so a combination of Multiple terms separated by let's say addition and subtraction operator That is called an expression. So example of an expression for and for that matter what is an example of a term So let's say 3x square is a term then root 2 y to the power half is also term Like that. Okay. Now expression will be nothing but combination of these terms So hence if we say 4x square minus 2 y plus 3z X let us say this is this is a this is an expression, right? More specifically, this is a this is an algebraic expression, right algebraic expression now Category of x algebraic expressions are called polynomials polynomials and we define polynomials by you know polynomials and And the usual way of denoting polynomials is we write a capital letter and Within brackets the variable in which the polynomial is so px is a polynomial okay polynomial in x and it is generally expressed like this a n x to the power n Plus a n minus 1 x to the power n minus 1 plus so on and so forth. Let us say a 1 x and Plus a 0 Okay, once again, so if you see there are multiple terms, isn't it all these are terms this one is term This was another term another term another term now where if you see a 1 a 2 a 3 and So on and so forth till a n minus 1 and a n now don't get confused by the subscripts Which I'm writing so 1 2 3 So I can't use let's say I don't have hundred odd Alphabets to use as a coefficient as to denote coefficient So hence we do a smart thing. So we just write a and simply write 1 2 3 as a Suscript so that you know how many how many are here actually it starts from a naught So if you see there are n plus 1 coefficients, right? So all these all these belong belong to the set of real numbers So hence all are what what do I mean? I mean all of these coefficients are they have to be real numbers Real numbers. There is something called complex numbers as well, which you will study later, but In this case, we are confining ourselves only to real number coefficients. Okay now x is a variable, you know And n is a n is a non-negative Non-negative that means zero positive or any positive integer n is a non-negative integer So that means it's basically whole number right n can be a any whole number. So this kind of expression whenever you will see They are called polynomials, okay, they are called polynomials now Example of a polynomial is so let us say px is Equal to now I'm writing some examples of polynomial px is equal to 3x square minus 2x plus 1 this is a Polynomial right another polynomial. Let us say capital F of x is equal to is equal to 5 x minus 24 x to the power 3 Minus 51 y now if it is in x we can't write why let us say x to the power 4. This is again a Polynomial another example, let us say a small gx you can write this like this as well. Let us say root x square minus 7 by 5 let us say x Right, this is another example So if you see the coefficients are real 7 by 5 minus 7 by 5 and root 2 both are real and x is a variable and the powers are All non-negative integers. So these are all polynomials. What are not polynomials not examples of? polynomials, so if you see what are not poly no mails What are not polynomial? So if you see they're not polynomials basically so any expression like x to the power half Minus y by z. These are all let us say this is a polynomial This is sorry. This is an expression But if you see the powers are half and z is z has to be raised to power minus one here So hence these are all this is not a polynomial not a poly no mere Similarly, let us say root 2 X to the power root 2 right x to the power root 2 minus. Let us say y root y These are also these are also not a polynomial Now mind you in in the above definition. We have used px So we have used a polynomial only in one variable that doesn't mean it cannot Polynomials cannot exist in multiple variables. Okay, so a multiple variable polynomial p x y could be Could be let us say a A n x to the power n plus let us say b n y to the power n Plus a n minus 1 x to the power n minus 1 plus b n minus 1 y to the power n minus 1 and so on and so forth and let us say it is a 1 x plus b 1 y Plus a 0 plus b 0 where you know that a 0 a 1 a 2 all are and till a n all belongs to the set of real number and b 1 b 2 so on and so forth till b n also belongs to the set of Real numbers so hence you can have polynomials in one variable polynomials in multiple variables, right? But in our this course. We are going to restrict ourselves to the study of polynomials of only one Variable right next comes a concept of degree of a polynomial degree of Degree of a polynomial So what is that degree of a polynomial? This particular concept is going to be used a lot Then we'll be dealing with factorization of polynomials and Finding zeros of a polynomial and things like that. So what is the degree of a polynomial? It's nothing, but the it is defined as the exponent the exponent the exponent of the of the highest exponent of the highest degree term highest degree term in a highest degree term in a In a polynomial in a polynomial, right? The exponent of the highest degree term in a polynomial Okay, what does it mean? So let us take an example. So for example if I have fx is equal to x cube Minus 3 x square plus 2x plus 7. Let us say so what is the highest degree term? So highest degree term is this so degree of this term will be the degree of the polynomial So hence we say degree of fx is nothing but 3 Okay, similarly, let us say I have g of e is given as 2 t square minus 3 t cube plus 40 to the power 7 right so the highest degree term in this is this and what is the degree of this term 7 so what we are right? degree of sorry degree degree of GT degree of GT is equal to how much seven degree of GT is equal to how much seven now Okay, now We might have let's say polynomials like this So fx let's say fx y is another polynomial and it is like x cube y minus 27 x square y square plus let us say 42 x y to the power 4 What is the degree of this polynomial? The degree of this polynomial is 5 y highest degree term So if you see what is the degree here 1 so this degree of this term is 4 Degree of again this one is 2 plus 2 which is 4 and degree here is 1 plus 4 which is 5 so highest degree is 5 so hence degree of this polynomial is 5 I Hope you understood What is meant by degree of a? polynomial right Now let we will be taking up the different types of polynomial basis their degree


I don't understand why people feel that hatred makes a country strong. I don't understand why people feel that being abusive, being nasty, being cruel makes a country strong. I think it makes a country weak. That's not what India is. I asked Nelson Mandela after he came out of jail 26 years. Mr. Mandela, you were in jail for so long. What gave you hope? Did India's freedom struggle give me hope? I said, what do you mean by that? He said, well, what Mahatma Gandhi taught, the fact that you should be compassionate, even to your opponent. You should respect even your opponent. These are Indian values. This is the most powerful thing that we have. Why are we throwing it away? And it is not only I who is thinking this. Millions of people, youngsters, men, women feel the same thing. It's a very powerful thing. They will realize that the principles that we are putting across here are not just political principles. They are principles that you can use in your life. They are principles that you can use with your brother, with your sister, with people you are working with. A little respect will not weaken India. It will only strengthen India. A little bit of affection, a little bit of love will only strengthen India. That's the idea. I felt that my duty in a time when India is internally fractured, in pain, where violence is being spread across the country, where hatred is being spread across the country, to show that there is another way possible. Where you are affectionate and loving to people, where you can disagree with them, where you can say, I actually don't like your views, but I can still go to you and say, I don't like your views, but I'm ready to listen to your views and I'm not going to beat you because I'm more powerful. I'm not going to thrash you because I'm more powerful as an Indian citizen to place that on the tip. And that is the idea of the Bharat Jodo Yatra.


Russia's Defense Ministry said on April 18 that its strategic and multi-purpose nuclear submarine had been deployed in the Pacific as part of a snap-review of Russia's Pacific Fleet combat readiness, as ordered by President Vladimir Putin. Naval minesweepers ensured a safe departure for the submarines from their base on the Kamchatka Peninsula in Russia's Far East, close to sea borders with the US and Japan. The submarines departed bases under smoke screens with special naval forces on speedboats escorting them, ministry said. The ministry also said on Monday that two 142 anti-submarine aircraft of Russia's Pacific Fleet performed sorties aimed at searching for enemy submarines. The aircraft stayed in the air for the maximum duration, they are able to stay airborne.


the state of clean energy. I'm your host, Mitch Ewan. Our underwriter is the Hawaii Energy Policy Forum. That's a program of the Hawaii Natural Energy Institute. I'm very pleased to welcome our guest, return guest, Peter Sternlich, of Sustainable Energy Hawaii. And today we're going to be talking story about our global energy reality and its implications for humanity. So Peter, welcome to the show. Thank you. Pleasure to be here. Yeah. So just to get us calibrated and get going on this, how important is energy? I mean, we all know what energy is, I think. What is the relationship between energy and our economy and our way of life and how we live? Well, I mean, there's, you know, there are those that say energy is everything or everything is energy. But within the context of our economy, energy really is the master resource. So what you see here is a chart that graphs GDP and energy consumption against each other. And just so people just tell them what GDP is. That's a gross domestic product. The pressure. It kind of measures how well our economy is. Yeah, the pressure was on. So what the historical data in this chart shows us is that there's a direct correlation between the two and that the deviation between energy consumption and global GDP over 50 years has been less than 1%. So at the bottom, excuse me, at the bottom, we have a quote from Robert Ayers where essentially he describes or explains that everything that takes place in every economy requires energy. And so what we do is we actually transform that energy into products and services.   There's everything in the roads and the steel for the seat you're sitting on, the buildings, everything took energy, the clothes you're wearing. It's there. So we're hearing a lot about climate change these days. Every time we have a new storm or a new disaster, we talk about climate change. And there seems to be a desire to reduce and eventually eliminate the use of fossil fuels. What are your thoughts on how this is influencing policy? We are the policy forum here. Yeah. Well, today, we're definitely deeply involved with climate change. But I think the reality is that what we're doing is we're involved in an energy transition. We're changing how we power our economy. What we're trying to do is literally is to electrify the global economy. We're going from fossil fuels to electricity. And the way we are explaining or justifying doing that to ourselves is that we're trying to decarbonize everything. So anyhow, I think it is fair to say that decarbonization is the primary goal around which global energy policy is being conducted. We want to decarbonize our energy consumption. But if we look at the big picture of energy consumption, as I look at that big picture of energy consumption, I find myself asking some questions. Like, is decarbonization really the best metric for setting policy? I mean, carbon is an issue. And I'm not suggesting it isn't. But is it the only issue surrounding energy that needs our attention today? So one of the questions to begin with is, are we being effective at this strategy? Are we reducing the amount of fossil fuels we're using? And are we reducing the amount of carbon we're emitting into the atmosphere? So given today's economy and the population that we have on the planet, do we actually think we can eliminate fossil fuels from our energy mix at any point in the future and keep the system, the economy, the way that we live going consistently? Well, let's look at some data now and to show the impact, the percentages of fossil fuels versus the upcoming renewables. Sure. So what you have here is a graph that tallies global energy consumption since 1800. And it runs through 2022, which is the last year that we have a complete annual set of data. And it includes both fossil fuels and renewables. And what we've done here or what the people who created this chart have done is they've converted everything into a common metric, which is electricity terawatt hours. And so from there, we can compare oil to solar panels or wind turbines or hydroelectric plants. So if you look at the graph, you can see that the three sources with the highest energy output are oil, coal, and natural gas. And towards the bottom are all the renewables that are electrical power, hydro, biomass, nuclear, wind, solar, etc. And if we look at the vertical index there, we see that oil alone provides 50,000 terawatts of power in the year 22, if you look at the far, far right hand side. Coal is right behind it, about 45 natural gases at 40. All the renewables sit at about 12,000 or less. That's pretty low. So just to... We're getting there. Take it to the last 20 years. Let's drill down further and pull up the next slide. There you go. And we've got some nice little red circles there. So why don't you explain what we're seeing there, Peter? So this is the same chart, but it's stretched out horizontally to only cover the range of the year 2022. And I think this is the time frame we really want to look at, because that's where the majority of our decarbonization efforts have taken place. And we see that hydro to additional biomass, nuclear have maintained a relatively constant level or contribution to the energy mix. But that wind, solar, and renewables are really just coming into play. This is not looking very good, Peter. So... Well, I mean, realistically, you've got to start somewhere. But I think the point of this is that we're trying to... That we're looking at what is driving our strategy. And what's driving our strategy is the idea of decarbonizing our atmosphere because of climate change. And so the question is, are we actually doing that? We can actually take some of the data that was pulled off these charts and drill down into it. So what we have here is on the left, we have a chart that represents the energy consumption during the year 2000. And on the right, we have the year 2022. We can also see that what we've done is broken the data into subcategories of fossil fuels and no or low carbon fuels. So the nuclear and biomass... I was going to say, yeah, nuclear and biomass aren't really renewables. But for the ease of discussion, I'm just going to, as we go on, I'm going to refer to them as renewables, even though they're labeled as no and low carbon. So in the year 2000, we consumed about 94,000 terawatts of fossil fuels and about 28,000 terawatts of renewables. And that mix calculates out to be about 77% of the energy mix was fossil fuels and 23% renewables. So if we look at 2022... Which is 22 years. Yeah, it's actually 23. But if we look at 2022, we see that we consumed 137,000 terawatts of fossil fuels, which is an increase of 45% in that period of time. So we're consuming... I thought we were supposed to be going down. Yeah, we were, but we went up 45% since 2000. And with renewables, it grew also about the same amount, 46%. And so between the two overall, the increase in energy was 46%. You can see that at the very bottom of this slide. And what really shocked me was to look at the relationship between renewables and fossil fuels over that, the 2020-22 time frame. And it didn't change at all. It's exactly the same. It's amazing. So not only are we consuming more fossil fuels, we're logically emitting more carbon and greenhouse gases. So this focus on decarbonization goes back to the question I asked a little earlier. Why do we believe that this is something we can achieve? And is carbon... And this is something that I'm not meaning to suggest that pursuing these other renewables is a waste of time. But the way we describe what we're doing and what's motivating us in the goal we're seeking may not be properly assessed. It may be, but it may not be. I'm looking at the historical data and I'm going, where's the progress? So what's the connection between fossil fuels and renewable energy? Are renewables truly fossil-free? I guess that's how you define it. Yeah. And the thing is, as far as the general public goes, as far as just our community and how we look at this, we think about renewable energy and we think about solar panels and we think about wind turbines and batteries and all the stuff that we're using to to transition away from direct use of fossil fuels. But there's a difference between a renewable energy source. Sunlight is a renewable energy source. The heat under our feet with geothermal is a renewable energy source. But the systems that we use to transform that energy into something that can do work for us requires fossil fuels. To do the mining of raw materials, the processing, the manufacturing, the assembly of the systems and the distribution, the global distribution of everything that we produce in the world in a global economy, that is exclusively done with fossil fuels and in particular liquid fossil fuels. Petroleum is what powers all this stuff. Yeah. You've got to get all this stuff from the mine to the factory and, like you said, take ships and trucks and everything else like that. And they all run it right now. They all run on fossil fuels. Yeah. So I think it's important that as a society, as a culture, we have a proper picture of what it is that we're attempting to do and also what we're actually doing and succeeding at. Because if we focus on carbon and we have other situations, which we'll get to into a little bit later in this presentation, are we picking our battles? Are we verbalizing it in the proper context so that we approach it with the right expectations? Because people don't like to be disappointed. All of these systems start with mining. And it's not something that we think about, but everything is made from stuff we dig up out of the ground. And that includes oil and coal and all of the metals and minerals that we use to manufacture all this stuff, the silicon, the polysilicon that goes into our solar panels, that comes out of the ground. I think having an understanding that that's what's happening, I think is important again so it sets our expectations in a proper way. So where do we get all this stuff that we dig out of the ground? This is an illustration of the mining productivity around the world and the size of the circles is relative to the volume of minerals that are specified by the little colored pie slices around there. And I think it's pretty clear that the largest contributor to mining raw materials and here's CRM and SRM are critical raw materials and strategic raw materials. So these are all things that, as the names suggest, are critical and strategic to our national security and also the way we want to live. So if we go to the next slide. Before you do that, I just want everybody to focus on the China pie. Look how big that is compared to everybody else. That's our good friend. It's our good friend. No geopolitics there at all. Yeah. So okay, now we can move on to the next. And this next slide is also kind of overwhelming. Yeah, because it's also, it has to do with where all of these things are processed.  And so it's got to be filtered and processed and purified so that we can make stuff out of it. And as that slide illustrates, the vast majority of processing and in particular for critical raw materials, China again is the number one. It's dominant. It's absolutely dominant. I think that paints the picture is that there is in addition to a supply chain issue, one of the things that affects the supply chain is geopolitics. And it's also going to be economics. So if for any reason, you know, the supplies are curtailed in any way at all, who's going to get them? Who makes that decision? How much does it cost? These all have implications in our desire to decarbonize. So that's a prime example of that is the solar industry. So if we go to the next slide, it's really staggering. We're really relying on, you know, just solar panels, solar panels, solar panels. I mean, I don't know. I mean, one of the things that I suppose I could have pointed out in that chart that showed the comparison between 2000 and 2022 was that the deployment of solar globally in that period of time was 110,000% increase. So that's an 1,100 times what we were doing in 2000 is what we were doing in 1,100 times that much. That's a lot. In 2022 is a lot. And it made zero difference in the mix. And we still increased how much possible. So yeah, I mean, so anyhow, yeah, if we go back to this, you know, to the slide with the map about the polysilicon. So that is, yeah, that one. So China is, again, dominant. They control 75% of the global polysilicon supply from which panels are made. And they manufacture 80% of the finished panels. So, you know, again, it's like, you know, we look ahead 20 years and they're selling economic oxygen. And we're dependent on that. How do we become, you know, looking at the solution, which is something that probably will take a whole program in and of itself, the world needs to become locally self-reliant, self-sufficient. And that, yeah, that's a whole another subject. So anyhow, we're fabricating or we're creating quite a level of dependency in addition to the carbon we're putting into the atmosphere. So let's have a look at some of the critical materials. So let's pull up the next slide, slide 12. I think we'll spend a little bit of time on this slide because this is a very important description of what we need. All right. I'm pulling this up on a different screen so that I can see it. So a colleague of mine who works with the Geological Survey of Finland, Simon Michele, has done some pretty groundbreaking work and done some, he's done an analysis of, okay, if we want to replace fossil fuels, what's it going to take? So he's looked at the constituent portions of copper, nickel, lithium, cobalt, graphite, bonadium that will go into not only the generation systems, but also the storage systems that we have to use because all of these things wind and solar are intermittent. They don't, they're all, you know, they're affected by weather and of course, whether the sun is shining or not. So in the leftmost column of numbers, he's calculated the amount of metals that would be required to produce just one generation of what he's referring to as technology units to phase out fossil fuels. So with copper, he's come up with this number of 4,730,000,000 metric tons. But in the middle column, what we see is that what all the geological surveys around the world estimate as being the total reserve on planet earth is only 18% of that. So the, so our ability to build this from those mined materials may not exist at the level we're targeting. And is that part of, part of the discussion that we're, we're having when we formulate policy that is the economy, energy and the economy are one and the same. So when we make policy involving energy, we're making economic policy and economic policy affects how all of us interact with the grocery store. Well also, you know, if we say we're going to electrify every car, every car is going to be a battery electric vehicle. And then you've got to re re conductor your grid. You're gonna have to add a lot more copper to that grid. In addition to the copper that goes in all these electric vehicles. Well, so, you know, that's, that's pretty scary. Yeah. And we need to move on because I know we're running short on time. But they hit in the history of mankind, we've mined 700 million tons of copper. And that goes back 6000 years. We still need to come up with another 880,000 tons. But and we need to do it by 2050, right? That's what 20 years. So but I also want to look at the where you've got the circle. Let's talk about actual mines. Yeah. So I mean, that's really, that's really stunning. Yeah. So my colleague, Simon, his PhD is in mining. And he spent decades in the mining industry. And so this is an important thing, because, you know, people, let's just go look for more economists go, well, we'll just go get more. We'll find more as if it's infinitely replaceable. And that's traditional economics. So a stat that he's come up with is that for every 1000 deposits you discovered, only one or two become mines. And the ones that do become mines take 20 years to develop. And then out of 10 out of the 10, so that so if you get 10 out of what 500 or 1000 discovery or 5000 deposits that you discover, you know, 20 to 30% go bankrupt. Right. So this is not as it's not as easy as just let's go dig up more. It's more complicated than that. Right. Well, let's have a look at the oil situation. We're coming down to the finish line here. Well, yeah. So with petroleum, which is really used for industrial transportation, that is a finite resource. And there's been a lot of discussion for many years about the fact that the amount that we use, which is now about 100 million barrels a day. Okay. So we're using 37 billion barrels a year. Wow. Right. So we're using over, you know, so in 30 years. So anyhow, it's a trillion barrels. And then they're just, we're using it at an incredible rate. So that's that's the flow rate of petroleum. So this company, which is one of the most respected, highly regarded energy analytical companies in the world, rice and energy in 2021 and 2022, determined that the recoverable reserves and when we say recoverable, that means economically and technically recoverable. I mean, if it costs $500 a barrel to recover oil, you're looking at a global recession or a depression. So you can't, the economics are really important. So what they're forecasting is that, and this is what's in the red, is that the global production of oil and natural gas liquids is going to contract by 50% by 2050. So that's in 26 years. Right. Okay. That we'll have half of what we have today. And that's the stuff that moves the global economy. It's, it is what moves things from China to the United States to India, everywhere around the world. So this is something that we need to consider too. What does this ultimately mean? Are we, we, I come to the conclusion that we're looking at it at an irreversible contraction in the in the economy, because there's just simply going to be less energy for many. We're running out of time. We're running out of time. So we can't be continuing to use fossil fuels. So we may, we may be forced into stopping in cutting back on fossil fuels because of the supply issue. So we need all those scientists to come up there and find some unobtainium to fuel our economy. But it could be a number of other things. But we're running out of time too. So I want to go quickly to the last slide, which is gives an idea. Just quickly, Peter, just show how. Yeah, very, very quickly. I mean, you look at the lower left or the lower right hand corner and essentially what this is a graph of is the transition time for traditional biomass, which is that large gray portion. And the darker gray is coal. And then you have the rise of oil and you have a timeline running along the lower, lower portion. But basically the purpose of this slide is to go energy transitions. Take a long time at the transitions that we're looking at here took place when the global population was a billion, billion and a half people were over eight now. So making that transition is, is it a reasonable expectation? Is it a reasonable goal that we can tell ourselves after we got discovered? So these are questions I want to ask. And I think they are very relevant when it comes to formulating our public policy. Absolutely. So anyway, we've run out of time on the show. And this is really a fascinating set of information that you gave us, Peter. So thank you so much. And I know you worked like all week putting this together. So it was really nice, really good of you to do it. I think we have enough material to maybe come back and have a round two, but we can kind of zero in on one or two specific areas. What we do is important. You know, we got to figure out what to do. What do we do now? Exactly. What's next? So we'll have to leave it there. As I said, we're running, we've run out of time. So we've been watching Hawaii, The State of Clean Energy on Big Tech, Hawaii. We've been talking history about our story about our global energy reality. We've been looking at reality on this show and its implications for humanity. And I wish we had lots of good solutions. With Peter Sternlich, who has shared his insights on this important topic. So thank you so much, Peter. I really appreciate it. And thanks to our viewers for tuning in. I'm Michio and we'll be back in two weeks with another edition of Hawaii, The State of Clean Energy.


Olympic Cooperation here is an opportunity for a U.S. tank company team and a Greek battle group to come together and learn how to conduct force-on-force operations and live-fire operations with each other. Most importantly, I think, is that we develop at the soldier level as just an understanding of how capable each one of our forces is. You'll learn a little bit more about the tactics, techniques, and procedures that each of us use, how we can integrate together. Demonstration of combat-armed firepower. Really enjoyed seeing armor, met infantry, aviation, medical engineers, the communication systems, and even the dogs out here today. What a tremendous display of what our two nations are capable of and the relationship that we have. Greece is such a strategic importance to the U.S. Army and to the United States. Together, through further investments in interoperability, collaboration, and your regional leadership, we will develop higher collective readiness. And this exercise demonstrates just how capable you are and how quickly U.S. and Hellenic forces can integrate and fight together.