Check Your Code For Errors
Hey there, wouldn't it be nice if you made a typo or you forgot to do something or left the brackets off that there was actually errors that appeared and told you which line they were on and how to fix them, there is such a thing, it's not installed by default. It's an extension. I'm going to show you how to work with that. Plus other ways of checking your code and asking for help. Let's get going. Alright, so two by default, you've got error checking in CSS for some reason but not in html. You might have noticed that already. So when I do something wrong in here and I forget to put a colon in okay or Yeah, for the colon in kind of like some weird things come up and it says it doesn't know, you know, it's not expecting things and how to quick fix. Okay. These never seem to work. None of the quick fixes work. It's going to be down to you to fix okay. And you're gonna have to go through and say where does the problem start? Okay. The problem starts here so something just before that is w...
rong. Okay. But that's helpful just to know kind of where it starts and actually that's deleted as well. I'll show you where else it starts. I'm done here. You can see there's like a little errors right down the bottom left here and I click on this and it says Colin expected. That's actually helpful expecting Colin didn't get one. Okay. So on line three. Okay. And it's affecting down line 15 as well. So what I'm saying? Okay but line on a character 15 so line three there it is there Now when you have a really big CSS sheet, it becomes more useful when there's like online 1000. Okay. So on line three is a problem and all the rest of these don't worry about until you fix the first one because if you fix the first one, they will all go away. Okay. There's a cascade of errors that are fixed by the first one. Now this doesn't work in html by default. Okay. So if I put something in here that's not meant to be in there and the thing doesn't know what to do. It doesn't tell me there's nothing to do if I miss the beginning tag and I do parts of that. Okay. It's gone red but there's no kind of like problem error. I'm not even sure if it goes red by default, I'm pretty sure that's because of the plug in I installed earlier on. So let's turn on this error checking. Okay. We're gonna do the exact same thing as before. So it's the same as installing an extension, click on this icon here. Okay. And I'm gonna make it bigger so you can see in this top here and delete what's there and I'm going to say I'd like html here. So this is where it gets a little bit card because you're like, what do I call it? And there is no like good rule, you just gotta start typing and seeing seeing what results appear. You might do some google searches in terms of error checking. Sometimes it's called hinting or limiting with an L L I N. T. Okay, you can learn things. Um and uh huh I searched around trying to find one and the one that I use is called html hint, but even then it's really hard to find in this list. Okay, there's some google searches and I found the one I want. It's actually just one word, html hints. You've got no chance of finding it. Okay. So I know that this extension search bar is okay to get started and try and find things, but just jump out to google and figure out and just ask the question what is a good plug in for this thing that I'm trying to do, You can see here, it's a really popular 1. 4 stars works for me and it's got half a million downloads click on it. Have a look, you read through what it does and how it works and I'm going to click install and we're gonna wait and it works. This one doesn't say restart, does it? Some of them say restart. A lot of them don't anymore, they used to, but if it's not working, you can turn it off and restart it. So let's make it work. So let's close down this little tab. It was just showing me like a little preview to the product, let's get it all three set, let's go back to our Explorer and let's make this a bit smaller. And now if I do some errors, put in some random codes where there shouldn't be look a little green thing and it tells me there's a special character in the wrong place. Okay. It doesn't really tell me much again, but at least I know where the error is. Okay. It's on line 13 I can go find it. So in terms of air checking that's a good place to get started. Turn on the extension. I'm going to close it down for the moment and just keep an eye on this. Okay. If you're like, hmm, it's not working. And before you email me and say, hey, it's not working. Check your errors down here. You might be able to self diagnose now. Another thing to do before you, you know, reach out to see if there's a problem because sometimes there's, it's not actually a problem. You might do something in here and change the code and check it in your browser and the browser is not showing it and you're like something's wrong sometimes. Okay. Probably One out of every 50 times for me. It's not actually broken. The code is perfect in here. The browser. Okay. Where you've been previewing, it's just holding on to old data. Okay, you can do something called casing and cases your previous version of your website. So when you're saying update, it's going I'll use this other cased version of your website to be fast and smart and you're like no, no no don't be fast and smart. I want you to reload every time and the way to make it do that refresh can work but there's like a real like definite way of making it reload. Okay? Because sometimes refresh still um like if you've downloaded images here, often the browser goes well if it's the same name of the same image, I will not update it because it's the same image with the same name but you've you know, you physically change the image. Okay. So sometimes things don't update even though they should talking too long, show them how to do it dan. It's under view. Okay. And turn on this scary set of tools. Okay. So view developer. Okay. And click on developer tools. Okay click on that and this opens up the panel down the bottom yours won't look like mine. I can't remember what it looks like by default. I'm going to turn that off, I can't remember. And but let's talk about the main thing so don't worry about what appears here. What you want to do is the option. So now when you hit reload you can right click it and it gives you these two new options that weren't there before because now you're like looking under the hood using the chrome developer tools you have this option empty cache and hot Reload that's the you forget everything you know about my website and reload it exactly the way I'm displaying it here in the S code and that can sometimes, you know if I'm doing problems I'm like sure it should be right. Why is it not working? Everything is perfect. I go in there, check that, do it and sometimes it fixes your like if you, you know, instead of spending time trying to reach out and figure out how broken it's not actually broken. Just the browser didn't update. Alright, what else can you do now? You can totally ask questions of this course. Like there's comments, use the comment section and use social media like you see all the social media in the class exercise files. Okay reach out that way. But often like it's just me for this course, the new course. You know I tried my best to answer questions. Sometimes I get a bit backlogged or it's the weekend on holiday. So like definitely use that as an option but you will also find google searches. I know it's a lame thing to say go and search on google but what you'll find is there's a couple of main places actually one main place it's called stack overflow stack overflow. Oh stack overflow will appear in lots of your search results. But searching in this site, it's just amazing that I listen to a podcast. The guy started this like it's it's for designers and developers anything web ask a question in here, you will find lots and lots of really useful answers and the curated answers from other users and what you'll probably find is you don't actually have to ask a question. You can log in and sign up and ask a question, but you'll find it's probably already been asked, especially at kind of our level here where we're just getting started. So stack overflow is an amazing sight to get and you get a response straightaways, I guess what I'm saying, If you're still having problems, Drop me a line. All the different ways that this site gets viewed, this video course gets viewed. Um yeah, use the comments or ask question button and often to kind of fix your problem, I need to see the code. Okay, so zip it up. Okay, so compress it into like a little folder and send that along, you know, like a link. Maybe using Dropbox. So I need the files, you have to work out a way that works for you. Sometimes you send it as a system. Okay descending things. Dropbox is a really good one because obviously screenshots are really hard to kind of, I can kind of see what's going on, but it's a little bit hard to edit your code, otherwise I'm gonna start retyping the whole thing and trying to work out what went wrong Now. My only thing is if you're asking questions to say you post a question, have a look through the other comments and see your questions and see if there's one that you can answer. Say you're just you know you're finding this not easy but you're like, you've got that concept, you're like man div tags got it locked in and you see a question somebody asking about div tags. I'd love to try and start that sort of momentum where if you're asking a question you have to answer somebody else's as well or at least give your best opinion or try and try and do it. Okay so that we can I guess get answers quickly and for you you'll find it super valuable if you are able to answer somebody else's questions. It's it's pretty amazing like being able to articulate that to someone else really drives it home in your own mind about that topic. And plus if I'm on holiday sipping pina coladas, somebody needs to help. But don't worry I've got a baby and a five year old, there's no peanut coladas in my near future. So to recap, do your own error checking using the html hint, okay that we just installed in visual studio code check that it's not actually a problem okay by refreshing your browser but remember you've got to do that by going into view and going into developer and inspect tools okay our developer tools and then right clicking the refresh button stacks Skills is an amazing place. Try it with me as well. Okay. We're using the comments or hit me up on social media. And one last thing before we go is there might be a say it happens a bit like I'll go into my extension. See, and I'll be like, oh great, this one works. It looks like it works. I install it and I just can't make it work or it's broken. And so sometimes you need to uninstall um, extensions. So to do that, click on this little weird clear extension inputs. Okay. So with that cleared your search disappears and it tells you things like the ones we'll tell you exactly what's enabled. Okay, what's recommended? I never find that useful, but over here it tells me the ones I've enabled so I can click on them and say actually actually my hunt doesn't work. I'm going to install it and try a different one. You can disable it temporarily. Say that you're like actually is it working, is it breaking something else. Let's just disable it and then test something and then enable it again to see if that thing goes away. I've never had to do that often. The star rating kind of fixes that or at least guarantees a half decent plug in or extension and that's it. That is html checking it's on by default for your CSS. Let's move on now and actually start building the structure for our project one. the restaurant. I'll see you in the next video.