to do joins in application that is a rescue for disaster because you get you get all the downsides and essentially no upsides ok the one t-shirts no you you are fine you are way too much ok now let's look at couple of examples I think we see a common seat of MySQL MongoDB online e-commerce many of those are built using MySQL right some of the popular frameworks like magenta open source e-commerce application uses MySQL and why it's important because well e-commerce often use a full feature transaction right that is very updated multiple data pointers in the same transaction is kind of very important typically good feed for those data sizes unless you are Amazon or something right typically is not so large for e-commerce right even 10 million of items you are selling is not a big deal for modern systems often you would have a long application developer is kind of iterated over long period of time right and you often would have many applications are used by many kind of different models different things talking to relational database directly right and I think that is a good fit now another example of a good fit now for MongoDB would be something like an online game back end for online gaming MongoDB is is pretty big why well because one thing with games is if they really become popular they can grow very very fast right and in fact you can scale easily through the shard and without significant upfront investment as you would have with MySQL is great now in many cases the data in this case is used by one application oops what was that your pretty much game is kind of even embedded in that application right so in this case using MongoDB works very well and frankly the data in that case is very complicated right like your character handle sword and that has a whole bunch of different properties it fits in a document model often much better than MySQL and also especially because that is one application you will think for the document level consistency often enough and also in terms of space of development you find many of those games they are very active development development kind of is very small right or on ill okay well I would say in this case right because it becomes a complex application logic that's often I see happen in the application that transaction right and that's typically the database is just held as a persistence as a persistence layer right so it's it's not relying on the transaction in this case right but but you are right right I mean in this case with a document level kind of transactions you have to be thinking carefully how exactly you manage those but I think in this case I would mention something on this which is interesting I think in many case you have to also understand the cost of this transaction remember I was working with years ago with one online processing right those guys are using my some tables I was thinking how guys you are processing credit card transactions and using my some tables that makes sense for me and say hey you know what it's not a big deal right our average transaction side is 10 bucks so if once in a blue moon my skill crashes and we lose couple of transactions people call support and we lose kind of 20 bucks and that's it problem solved so well again that was the choice and it worked for them but I think it's good to also to understand right if some events are very rare you maybe just be able to deal with that in a my skill world still many of us rely on my skill as in cross replication they choose not to enable in a semi-synth replication because semi-synth replication is expensive right but they say well if it happens to crash and I lose couple of transactions failover to slave so be it hopefully nobody even my boss doesn't he's not going to notice that okay so now a few more things I wanted to to share which corresponds to per corner contribution to the ecosystem one thing we just released is our new version of per corner serif among good e.b and some other products which come with it so what is per corner serif among good e.b well our proposition here is very simple to similar to what they have in my skill we provide the 100% free and open source version which is 100% comfortable compatible with one good e.b but offers you something more what is that something more well we provide you additional storage engines such as memory engine write for end memory workloads and Mongo rocks for write optimized workloads we provide whole bunch of features for which only exist in one good e.b enterprise such as pluggable authentication or auditing and we do some other stuff like query performance monitoring tools and for backups another thing what we add is a tool called per corner monitoring management it was now released for about 6 months but in our new version we really get significantly significantly better for support for MongoDB now what is that tool about well a lot of that is really trying to analyze my skill in the future MongoDB workloads for example we can take a look at the queries and kind of see what queries are causing the load on your my skill server which you find is very very important both for DBAs as well as for engineers you can take a look in the query and see why those queries are causing the load for example in this case you can say hey this query spends about 10% of its time waiting on the door and 15% of the time waiting on logs right which allows me to understand how to make it run faster and then actually I can also do from the same page and understand the create table, explain and other stuff which allows me to optimize that query all kind of from a single page we also integrate with per corner tool kit anybody heard about per corner tool kit some of you do so for example you can take a look at what information about the system and my skill which is often very helpful if you are looking at many systems right they all kind of maybe configure differently they also provide a lot of graphs do anybody use Grafana here I think Grafana is pretty cool and what you do here is you provide the integration with Grafana with kind of custom dashboards for my skill and MongoDB as well as the creating system so you can have a whole bunch of nice dashboards for Linux and hardware information on the database level for MongoDB a lot of insights what is going on on the MongoDB level actually I can tell you what in terms of the depth it goes into we have much more details than MongoDB Ops Manager in terms of so if you guys are doing some advanced tuning you should like that and you welcome you to check out the demo actually there is a demo probably available online which runs for maybe 20 different hosts so you can see how it works with my skill MariaDB MongoDB per corner ok now I am going to show you guys a few slides which are entirely created by marketing so don't help me against me but I need somebody to let me come here one I really don't but anyway I tell that just to anyway we have to corner live conference so if you guys are interested in my skill MongoDB Postgres so actually open source database in general we have whole bunch of them being covered and discussed on at per corner live and we offer you discount codes for that now, surprise we are also hiring so if you know someone who is kind of smart and really have a patient for open source databases encourage them to contact us and apply also please if you want to talk more to us stop by at our booth number 219 at the at the expo hall here ok and now I guys I really need to give out those t-shirts ok yes let's start from first row yes that's right so we do support MongoDB and we do have our own fork of MongoDB called per corner 0 for MongoDB yes the question was about per corner 0 for MongoDB well yes our promise in this case is what we maintain the version which is compatible with appropriate version of MongoDB community edition but we also add some additional features in this case kind of to provide more features in the open source ok support for 3BSD you can just pick one ok support for 3BSD well I would say we don't officially do build for 3BSD while I know per corner server is included in ports the reason for us is not enough commercial demand if you look for us to maintain that because I don't want just to set up and do a build I want to make sure if you're doing support for a certain platform it really invests a lot about performance engineering quality assurance for that and we just can't do that yet for MongoDB for 3BSD hopefully we'll be in position to do that ok what happens and what so what that means right that means you should remember kind of in my scoping similar to my stuff but actually it's a bit better so what happens in this case is if I'm doing the update which modifies for example million of documents and let's say MongoDB crashed in the middle what will happen is some of them will get updated some of them won't what MongoDB grantees you is that they're not going to be document which is kind of half update where part of that was update part not and then it was kind of not corrupted right but there is no guarantee what it will be or not that would be the proper full transaction support which is not there at least so MongoDB has a replication right so what we are thinking about mainly in this case is a single node when it speaks about the multi node stuff there is a concept called write concern in MongoDB when you write the document you can specify how it should be propagated through a replica set in order to be considered done typically it would say majority concern so that means the transaction only completes when data was propagated to the majority of the nodes and in this case if that node dies it's complete iteration it's still guaranteed that it will have this data does that make sense? but again that applies on a per document level it's not the whole set which is acknowledged okay yes do you want a t-shirt? why don't you oh okay how is the user management in MySQL compared to MongoDB? well you got me I haven't had a t-shirt to tell you anything meaningful I just don't know well I would say I think that's possible in this case I wouldn't say how fine-grained MongoDB permissions are compared to MySQL I just can't answer that node's MongoDB enough to answer for gentlemen no? well so when you speak like you're going to serve for MongoDB it is binary compatible right so you don't need to start need to transfer anything you can shut down your MongoDB server install to your corner binary start it up and it will work so it's it's binary compatible if you only use MySQL community edition so for example you can say hey I want to use MongoRock storage engine right and in this case you can just build a MongoRock node you can add it to the replica set it will synchronize the data and then you can promote it as a master right if you want so MongoDB makes it relatively easy to do this kind of integration well for MongoDB yes so I was thinking about something like if you want to deal with synonyms right and some other kind of yeah well I would say it's it's my understanding while MongoDB has support of full tech search right it's it's really not that advanced as elastic search is because elastic search really started as full tech search first right and then started then MongoDB took another path okay any other questions come on guys I need some more t-shirts no more questions yeah come on gentlemen back well I think in this case that's going to depend a lot about how exactly what exactly you're doing right different kind of benefits back and forth let me give you one example right for example very known bottleneck in MongoDB right now if you think about documents which can embed another documents the problem for them can be pretty large right now if you are doing heavy updates when that becomes expensive you are updating large documents all the time it's kind of similar to trying in my school to update one block right now in this case you are faced with this kind of two interesting choices there is mf1 storage engine which actually has special features where it can go in the document directly and update the field like for example if you're doing an increment but that has a pretty course lock in and a lot of other problems or you can go to wire tie which has a pretty good good concurrency control right with multiple documents but it has it has to kind of write the whole documents when you update that right and a lot of people have been kind of really stuck between those two options and none of them is really good choice right now in a relational data we often normalize the data so you have let's say some very thin table right which maintains your counter right and you just fetch them to join right so the answer is it depends so you know I can't throw that far so you'll have to come closer right I mean I kind of have a dirty throw the last one oh my gosh and I think that's actually the female t-shirt for a change is there anybody left oh we can left that for oh forget oh shit we are in California right okay anyway anyone wants the next t-shirt okay okay well out of time but on a break so if you guys have any more questions I would be happy to answer them mic check one two three mic check one two three mic check one two three mic check one two three mic check one two three mic check one two three mic check one two three mic check one two three can we control how is the mic check in one oh three mic check one two three mic check one two three mic check one two three mic check one two three mic check one two three mic check one two three four five six seven eight nine ten mic check one two 1, 2, 3, 4, 5, 6, 7, 8, 9, 10. 1, 2, 3, 4. They should be able to hear me. Bill is a community college instructor in Arizona. One of the class of class. He has a couple of professors in Boston, and I'm going to teach him about them, especially about education. So he's also a black student. Hi, my name is Phil Beslowski, and I'm sorry for the delay. There was just a few hiccups, and I can't actually see on the screen here what I'm doing, so I'm going to have a little bit of dyslexia going back and forth. One of the things that my students have asked over time is how do you handle hierarchical data in my SQL? And I know a lot of people are going to go, well, there are other graph-based databases that can do that better and the rest. But the question was, can you do it? And there's several different models, and I realized in the process of going through two of them, that's going to be an hour talk, even if I hadn't already wasted about 15 minutes. But these slides are done in Reveal.js, and you can just simply go to this address if you want to a little bit later, and I will post it up on scale as well. You can just download it, unzip it, open up the index file, and you'll have pretty well all the code and everything else. I am a bit of a character at work. It's kind of odd being in the business department and being a little different here. I've been a faculty at Mason Community College since roughly 1994. I've only been full-time since about 2001. I've been using Linux since about 1994. I remember downloading 32 floppies in order to use Slackware at one point. Peach Blanks OS, PHP, Python, JavaScript, HTML, MySQL and others.  So hierarchical data. Almost everything that we deal with is hierarchical. Some of it's just one or two levels, but genealogical trees, family trees, post-threads where you want to be able to keep track of who's responding to who. Okay, a little bit of an echo. And company organizational charts. Parts lists. If you've ever seen some of the books that they sell for repairing cars back when you could repair a car, you just have this huge exploded diagram of parts, and those are all usually subsets of parts that go into another part and so on. And of course, category and sub-category relationships. The classic adjacency list, which is probably the easiest to set up. It's the easiest to insert. It's the most difficult to get the tree back out if you go more than one or two levels. Nested sets, which I also have an example of here that we'll work through, is a whole different way of organizing it. It's very easy to recreate the tree, but you'll see that when you go to do some of the updates. In a really large method set table, depending on where you do an insert, you could end up having to update every single row, except for one, in the table. So you can see how that can be kind of expensive. There's a couple of other methods, which I won't get to today, though I have a couple of links to them at the end of the slides. Path enumeration, which is where they basically do like a comma-separated list or some value-separated list of the path for a particular one. Again, definitely not even first normal and has some issues that you still have to iterate to the list. Closure tables, I've got a couple of links on. I haven't really played with those too much yet. So first off, again, adjacency list. It's easy to insert a new item and just can be very difficult to retrieve to many levels. So I've got a simple tree here that I threw together really quickly. You've got computer, and underneath it, you've got programming, graphics, and, of course, databases. And then some subcategories underneath them, and in some cases some sub-subcategories. And in the case of routines, there's even an additional subcategory. And, you know, you could argue why is it important to keep track of this. If you're familiar with things like breadcrumbs on some websites where you're able to file your way back, that's one of the reasons why you might do something like this, where you're worried about the relationships between the subcategories rather than just which category applies. It's an amazingly simple schema.  In this case, we're just having the category name. And then you have a parent category ID that just points to the primary key within the same table. Fairly straightforward, fairly easy to set up. And, you know, you can see it's just category ID, category name, primary category ID, and a unique key just so I don't duplicate any of the category names. Now, the fun part, let's see how the dyslexia goes here. I need to use the force. Yeah, I did that on purpose. My students grow when I do that too. Okay, so this earlier, three warning. So I just wanted to, actually, let's make sure it'll be actually created here, if anything. Okay, so I've got that, and it's got a unique key and it's got the foreign key, so we could ignore the error. It's just an extra bit of code that got copied in. First level inserts, you can kind of take advantage of the fact that you know that the very first thing you insert is going to be number one. So you could just cheat if you want to insert into the table and give it the name. The very first top level is usually null or some case is zero because you want to know what your top node is going to be. And so I've got computer and then programming which refers to one, graphics which refers to one, databases which refers to one, web design which refers to one. And of course, if something goes wrong like my SQL now tends to have a habit if an insert fails, it still increments the auto increment, in which case this will blow up because that one is a foreign key and it's got a point to the right one. So again, this is kind of lazy. As soon as you're going to do any more inserts, it's better to either create some functions and some procedures to do this for you. So I just created a couple of really helpful little functions here. One basically if you give the category name, it gives you the ID, and the other one if you give it the name, the category ID, it gives you the name. Two that I'm going to be using a couple of my others. They're fairly easy. Nothing too exciting on them. They just basically take one variable and then do a quick lookup and return that value. And as their functions, they have to be used within a query. Again, this is the fun part of not being able to actually see what I'm doing here. Okay. And then this is my procedure. Yep, see, I'm accidentally copying stuff below the list here. So I have to be a little bit more careful. I'll copy from the bottom up. So this is my first procedure. It just simply takes in the category name you want to add and then the parent category name that you want to look up, rather than having to try and do this by yourself.  It then basically looks up that information, makes sure the parent category ID is not null, and then does the insert. This is one of those handy little procedures. You could also do this. Let's make sure I only go as far as I'm supposed to here. See, I still copied below, as it was getting some of this already. So here's where I was just adding in all those different little pieces. And out of curiosity, let's see, do I get all? Yep. So I'll still have to be a little bit more careful on this. If we don't take a look at the table, you can see the setup. Programming has a parent of one, which is computer graphics has a parent of one, databases is a parent one. Vector has a parent of three, which is under graphics. Inkscape has a parent of six, which is under vector and so on. So we've got the relationships there. That's pretty well the basic setup. And like I said, the creation and insertion is really easy on the adjacency list. And you're actually having foreign key to primary key relationships as well. I don't know how basic folks are expecting things, or how advanced, if anybody has any questions, feel free to interrupt me. But we have effectively data in there. Now, here's where you run into the problem. I would like to be able to search for particular parts of the tree. Like say, if I pick programming, I would like to get every single piece that's underneath programming. So languages, and of course under languages, the languages that are there. So you could try and do, if you do programming, so I'm just selecting the category ID, category name from the table, where the parent category ID is the category ID for programming. That's what that little function of mine did. So it's looking up the parent category ID for programming, and that's going to show me every child that has that as its parent. And again, I have selected too much, so I'm going to do it from the bottom. So programming, oh, didn't I not get languages in there? Programming has no children. Oh, we used a different one. Let's do databases. And you can see that there's two children under databases. So some of my copy and pasting is messing up here because I can't see what's going on with the screen. But that one works. So we've got databases that has SQL and no SQL, but I know, because I set this up, that there's additional children underneath there. So I could of course then go, okay, well fine. Let's then find all the pieces that are under SQL. And hey, I see that there's MySQL, MSSQL, PostgreSQL, Routines, Triggers, and so on. But I also know that underneath Routines that there's procedures and functions. So this is one of the difficulties. You have to make some fairly complex queries to try and get the full tree. Or you can try and have your web interface go through and just query at the top levels and then rotate through and query all the sub-levels. And recursion is its own reward, right? So this is one of the complaints that people have about this. You can of course try to find the parents of all the children. And so again, I'm just using my little functions here. I'm grabbing the category ID, but I'm telling it to get the category name. So it's displaying it that way as child. And then I'm doing the parent category ID and again getting the name. But the weird part of course is that this is where you have to do a self-join. You have to basically join categories, adjunct categories T1, to adjunct categories T2 and alias it. And then a little bit here, we're going to see sub-query heck. So this is going to be interesting. Let's see if I can do this without messing things up. I can always put the S in the beginning here. And still doesn't like that. I will try one more. You can see that programming, graphics, databases, and web design have the parent computer. Vector has the parent for graphics. 3D has for graphics. Bitmap has for graphics. Sequel, parent has databases. So it's going through and you can find the parents of everything fairly quickly. And by looking at this, you can kind of figure out, okay, well it looks like computers at the top and then those four underneath that and then those are underneath that, but it's not incredibly obvious from this. So again, it's easy to do inserts. I can add stuff fairly quickly. The database is small. It does the, you know, foreign key, primary key relationships. But retrieving the entire tree is a couple of variations here. If we use group concatenate, I can have the parent and then a list of the children. So again, you can kind of see some of the queries you can do to try and help you iterate through these. And again, you get to see how good I am at selecting stuff here. Whoops, and I goofed again. Those are the numbers. It shows us that two, three, four, and five are children of one. For the child three, it has offspring six, eight, and ten. Four has, and you get the idea. And with just a few changes, we can actually make that more human readable. So we just use that little function I created to tell it to look up the name when you give it the ID. And that's the only thing I added was that little function call to adjacent underscore get cap name. And you can see that, yeah, it is giving the information. So programming, graphics, database, and web design is under computer. Vector 3D and bitmap is under graphics. Database is SQL, no SQL. SQL has MySQL, MS SQL, PostgreSQL routines and triggers. So you can retrieve the information. It just simply can take a little bit more complex queries and again, some rotating through. I hope this is somewhat interesting. I've been watching a lot of folks where they talk about stuff, but I figure we'd try to actually do some things. So, you want to go through all the levels. And this is where you run to the problem. I happen to know that I've got up to, I think, five levels. So I have to do five self left joins to try and get the whole information here. So this is somewhat insane. You see, table one dot cat name, table two dot cat name, table three dot cat name, all the way out to table five dot cat name, doing left joins between all those aliases for the exact same table. And the result isn't bad, but there's folks who are probably already cringing. How big are these table? How big is this table? And you're doing a self join five or six times. It could definitely add up to a little bit of time on the computer here. Obviously, level one computer, because that's top. There is nothing other than just a computer that's set and all. And you see, it has programming underneath it. And there's nothing under programming because those inserts failed because I didn't copy it right. But graphics has vector escape, computer graphics, 3D blender. And you can see how you're basically creating the breadcrumb trail here. So again, another query that you can use. But you're having to do these insane join to the table, to the table, to the table, to the table. Leaf nodes, those are the ones at the end of the branch. There's nothing beyond them. They don't have any kids. They're fairly easy to find. You still have to do a join between the table where you're basically matching where the category D equals the primary category D, and where the category ID is null. So this will show us where they don't have anything beyond the end. And there's a few. Looking through that, yeah, I believe those are indeed all the ones that are terminal. You could double check from the list that we've got there, but that is showing all the ones that are at the end of the branches. They have no children themselves. So you can easily find the ones towards the end. Also, as quiet as my students. And usually it's just, I don't know if it's shocked. They don't know what to ask. They don't have enough coffee. But now comes the more interesting part. I want to basically delete a node in the middle of that tree branch, right?  And normally if I were to delete a parent, what happens to the branch that it's attached to? It's orphan. It's basically its own little tree. You could graft it on someplace else, potentially. Now, of course, if you're just needing to update it, you may just simply want to change the name of the category rather than wiping out the node. But say that you do want to. One of the things that you can do is basically go through and have it update the parent category ID to the new, to the parent, basically to the grandparent. So I'm creating a procedure here called Adjust Adjacency List Delete Node. It just takes the name of the node you want to delete. And the first thing I do is I want to get the new parent ID. And that new parent ID will basically be the grandparent, if you will. The parent of the one that I'm about to delete. The old parent, of course, is the one that I'm about to delete, getting their IDs. And then I just simply do an update where I set the parent category ID equal to the new parent, where the parent category ID equals the old parent. So basically any row that has the old parent as a parent ID just gets the grandparent. And that's actually fairly quick. I'm going to pick on MySQL. So we're going to pick on the NodeSQL folks. And we're going to delete them. So that means that all of those relational databases will just be underneath databases. They won't be under databases, NodeSQL, blah, blah, blah. Now let's see. MongoDB, Cassandra and Spanx have a parent of four, and four is databases. So SQL's gone. They've all been basically moved up the chain. Again, that wasn't too bad. The real fun part, of course, is if you're trying to rearrange and prune the trees, but you can still do it. It's when you're trying to go through multiple levels. I don't have to worry about the sub-levels of if they had any children, because all I'm worried about is their parent ID. The other ones are already pointing to them, so that's no problem. Really easy to update. Retrieving the tree can be very difficult, and depending on how many levels, you could have so many self-joins that your eyes are going to start. And, of course, that takes up more memory. All those have to be stored in memory, and it slows things down. Not so much anymore. I mean, thankfully, when Oracle did take it over, the one thing they did do is sub-queries work much better now. Prior to five, I think it was five, five, it was, yeah, they were pretty bad. They would say, you know, do it with a join instead. But, again, you're doing queries within queries, and how many levels do you need to go? Some people will put in things like they'll put a level, a depth-level field, so you calculate how deep you are, and that helps you iterate through it. Some will also try to do a path enumeration where you'll see a comma-separated or slash-separated set of values of the primary key chain for that particular field. Again, for updating it, inserting it, looking up little bits of information really quick and easy, the whole tree can be a little inefficient. Again, it depends on what you're using it for. My students hate it. They always go, well, what's the best situation here? My answer is always, it depends on what you're doing. But that is some of the big complaints about the adjacency list. Now, I tried to put this together. I realized I need to work on Inkscape a little bit, but this is a concept for how nested sets work, so I wish I had a whiteboard to draw on, but I think if I draw on this wall, they're going to get very upset. So the idea here is that everything is a nested set, so you have an overall container for a computer, and I only picked two because I was running out of room, then you had programming and databases, then you had languages, and within languages you have PHP and Python, within databases you have SQL and NoSQL, within SQL you've got MySQL, I didn't have room for the other two or three, and in NoSQL you have MongoDB. And the way that this works is you just start counting from the left. So the left value for a computer is one, the left value for programming is two, the left value for languages is three, the left value for PHP is four, the right value is five, and basically it's bounding values. You know that something is at least a child or grandchild or whatever because it's within the range. I know in this particular case that any value that's between one and 20, so a left value of one, if they're greater than one and less than 20, they're at least somewhere inside of the computer level. If it's the value of somewhere between two and nine, you know that they're underneath programming. If it's between 12 and 13 in this case, I know it's MySQL. So this is nested sets. Really cool for pulling up the tree. However, you can already see a potential problem. Anybody guess where the big, big complaint about this one is? Inserts. Say that for some reason I've got a fairly big set here. Maybe, well, we'll say a medium size. A couple hundred thousand records, right? And I have to insert something basically inside here. So this doesn't have to change. This doesn't have to change. This doesn't have to change. This doesn't have to change. But then all of these, oh, wait a minute, these are all attached to, oh my goodness, you have to do an update on every single row. And there are ways to do that. I'll show you. But you can see how that could become kind of inefficient. So nested sets, I know I'll reiterate this a little bit later, they're great for things that don't have a lot of regular inserts and updates. A parts diagram for an engine or something would be great for this because you don't usually change that. It'll take a little while to get it set up. It'll be really easy to get the parts you want out of it. But thankfully you're not going to have to make changes to it too often. But if you're trying to keep track of a really active discussion board, oh, probably not the best way to go. Again, pretty simple for the table itself. You've got the category ID, category name, and L value and right value. Oh, yes, and I want to make sure I point this out here. It's a little bit red. For this one, as I haven't played with the nested sets quite as much, I heavily used a lot of stuff from this particular person's presentation. I turned several of them into, again, it's kind of been red. It's matching hierarchical data in my sequel by Mike Hillier. And the links are at the end of the page. This is also a link. Some good stuff. I changed a few things, and I turned a lot of his queries into procedures because to me that just seems to be more useful. When he wrote this, apparently there were still quite a few people using MySQL 4, and he wanted to make sure it would work for them too. My general feeling at this point in time is to stop using 4. I mean, really. You're right up there with the XP stuff. So, the other big difference is the values that set up the relationships are not foreign keys. There is no internal foreign key pointer. These are just numbers. So you do have potential issues with, you know, referential integrity again, but they're just numbers. So there's nothing too exciting for those. Lost my mouse again. Ah, there it is.  I was about to watch a man fail to top a highlight stuff problem. You think at my age I would know how to copy and paste. Hard way. He actually set up several and then went to do an insert. I am going to do it the single hardest way. I'm going to put in my top value, which goes from one to two. So that means for the other 29 things, I'm going to have to do an insert that increments those values every single time. Apparently I am a sucker for this. So this is just inserting computer and a left value of one and a right value of two. Again, kind of boring. And computer, one, two. I don't want to have to try to recalculate this. So this is where we're going to do it in a procedure. And other than a few name changes, this is other than the fact that I turned it into a procedure, this is almost directly lifted from his example. Why reinvent the wheel when it works. So I'm creating a procedure called nest add category. It takes one variable, two variables, the category name and the parent category name. And I have to figure out what the right value is going to be. So I need to get the value, the left value of the parent category. So I need to know where I'm going to start on the left-hand side. So if I'm going to insert after four, because that's the edge of the parent category, I need to get that number. Because I know I'm going to be changing everything from out there. So that's all that's doing.  I need to set the right value equal to right value plus two, where the right value is greater than the new right value. And then I have to do the same thing for the left value, left value plus two, where L value is again greater than the new right value. And then, and only then can I insert in here the values that I've gotten. You can see it calculates out the new right plus one and for the left part the new right plus two. It's a beautiful little set of queries that he created. And they make a wonderful procedure. The one thing that he did that you can't do really with procedures in MySQL is that he would lock the table before he did his stuff and then unlock it at the end. You can't actually do that. Now to a certain extent the procedures themselves partially lock the rows involved, but there is a, I'm not quite clear whether or not there's a potential race condition here that you can run into. So I'm just going to call that and one at a time add this. So this first one of course is going to move that, that right one over two and then put in two and three and it's just gonna keep getting worse. So each one of these is having to move more and more and more values by updating more and more rows. Well the problem is that this is all one web page. I'm using, I decided to be cute and I decided to use a reveal and this is all one web page. So I just have to be careful here. Okay. Now remember right now the values are left, one, right, two and these do take a little while. And now notice computer goes from one to 60 when it was one to two and okay obviously everything else is in between it. You'll see that programming goes from 46 to 59, graphics goes from 28 to 45, databases goes from two to 27 and you get the basic idea here. So you can do inserts.  But it's done for you. The drawback of course is that this does take a while. This is a small dataset. Could you picture on something that is 100,000 rows or longer? It could take a while. Yeah and that actually if you look at John Selkow's book one of his ideas is that you can either use a decimal setup or you can just simply start out with your basic tree. So you've got a couple hundred ones and just pat them by a thousand between each one. And then just do the math. The insert query would be a little bit more complex because we'd have to look at what range it needs to go into. But the insert would be much quicker because it would only actually it wouldn't have to update anything. It would just do the insert. Eventually you're probably going to learn to the problem or you're still going to have to do it. But yes that is one method for this. I am deliberately showing you the worst case scenario. In fact in a few cases I probably made it harder for myself than I needed to. But yeah that's actually a very good point. Those index values if you pat them, you know, spread them out by a thousand and then you just simply have your query look at where the range edges are and insert some parts in between there. You do get a diminishing returns over time but if you have enough space you may never run into a problem until you switch jobs. So you know, next person has to deal with it. So there's some really neat queries that they use for these types of things between multiple tables. However, 5.7 turned on several strict modes and one of them, only full group by, breaks a lot of the fun things that my SQL folks do which is probably not standard and probably has the other database folks cringing. But I'm going to temporarily disable it by just setting SQL mode to everything but that because that next query just doesn't work and I did not have the time to try and rewrite it so it did. Basically in 5.7 they turned out a lot of things one of which is the if a insert starts but fails still increment the auto increment value. As a teacher, that one kind of drove me nuts. I understand why they might do it but so I turned that one off. This one I'm just going to temporarily disable. Now if you're not using 5.7 you may not have this issue but on this little machine here that's what I'm using so it causes problems. So I'm just going to temporarily turn that off and only last for this session so as soon as this window closes it's gone. It does give me a warning that how dare you turn off some of the strict mode that we turned on. You can turn me in later. Now, you can't get the entire query relatively easily by doing a couple of things that I modified slightly to make it look pretty. So we're concatenating and repeating through basically two spaces and an account minus one basically just looping through from nested cats as node nested cats as parent. And we're just looking where the node value for the left side is between the parent value L value and the parent R value. And group by node.cat underscore name and order by node.L value and the reason why it's upset is that we're grouping by cat underscore name which is not what we're doing the aggregate query on. So this is normally considered a no-no in the only full group by. But it works pretty well even if we do have to disable the strict mode stuff to do it. And notice databases and graphics and programming are the first in-depth level under computer. Under databases, you've got NoSQL, SQL. Under NoSQL, you've got Sphinx, Cassandra, MongoDB. Under SQL, you've got triggers, routines. Under routines, you've got functions, procedures. Then you back to PostgreSQL. It retrieved the tree perfectly. And there wasn't all that join, join, join, join, join, join for every level type thing. So again, this is the considered to be the big plus of nested sets is that it's much easier to extract the tree or parts of the tree from it. But as you can see, the inserts are a bit of a problem. One of the other fun things though is how do you prune it? So I basically, again, modified one of theirs into a procedure where it basically finds the left value, the right value, and the width, the range, which is the r value minus left value. And then it deletes from that where the left value is between my left and my right. And then you update it and basically for all the sub ones go through and put the numbers back. So I'm going to pick on NoSQL again. Why not? I'm going to recreate this taking longer. I think my delete one is down here. So I'm going to delete NoSQL and it should hopefully re-nest them. Oh, nest delcat. Okay, I've got a typo. I've changed some names and I forgot to fix this. I'll have to re-upload those. I'll print it out for you. It does say that there's 24 rows affected because it had to re-number everything. Notice the value now goes from 1 to 52 and I don't see NoSQL. I also don't see Sphinx. I don't see Mongo. I don't see Cassandra. And it re-numbered everything. So now instead of going from 1 to 60 it goes from 1 to 52. And it deleted four rows which makes sense for NoSQL and the other three. Let's put that stuff back and thankfully that's really easy with nesting. This can reuse that and it will just put them in the appropriate spots. It may not be in the exact same order but it will be the same level. So I'm going to undo that. You see it goes from 1 to 60 again and you do see NoSQL. It's between... it goes from 3 to 10 which means it's definitely under databases which goes from 2 to 27. And MongoDB goes from 8 to 9 which is a NoSQL, 6 to 7 and then 4 to 5. So 4, 5, 6, 7, 8, 9. That's basically how it's supposed to work. This one is where you have to do a couple of extra updates. This is where you're going to remove the parent and just move all of them up one level. And then I guess I'm out of time at that point. We're going to delete the node, NoSQL but we are going to keep Mongo, Sphinx and Cassandra. And you'll see that NoSQL is missing but MongoDB, Cassandra, Sphinx are still there. The numbers have changed slightly. They now go 3, 4, 5, 6, 7, 8 instead of the 4, 5, 6, 7, 8, 9. And that means that they're now under databases directly. They're not under NoSQL. So, again, you can prune these and move it around. If you've got a situation where you have a lot of related data but you don't need to update it, again, easy to retrieve the tree removing the node or branch can make a lot of changes. Insert in the node can make huge changes. Ridiculous numbers of changes. So, some basic thoughts. Again, nested sets, full tree inserts are painful. Parts list for machine assembly would be great. Anything that doesn't change rapidly. If you're doing updates on a huge nested set, well, if it's a really huge nested set, more than once or twice a week is probably too much. If you're trying to, you know, get new tags or stuff that you want to keep the relationships between, I'm not sure why you do that. It would be a nightmare. Adjacents list. Inserts are very easy to do and very fast. Retrieving the full tree can take iteration. There are tricks to get around this. One of them is a variation on this called closure tables, which is kind of funky. And again, usually folks who actually do try to retrieve the tree do a series of little queries and then have some web interface or something else do the iteration to rebuild it for them. And that depends on how often you really need to keep the full tree. If you just need one particular path, that's not too bad. Recreating the whole tree, that is kind of a bit of a pain. And again, there's path enumeration. I don't really like that one. I don't like having multiple pieces of data in one cell. It just bugs me because of normalization. Closure tables, which there's a couple of good links on at the end here that I didn't have an example time to do. And modified adjacency lists where you can do some funky things. One example is what happens if you have two parents? I don't know about you, but quite a few folks at least had two biological parents at one point in time. You can actually create a join table that does two links to the same primary key and set up that way with it. And then you could have potentially multiple parents and so on. I've been playing around with that one, but I didn't quite get it done. Oh, that is a horrible color for the links. Again, I will re-upload this a little bit later today. And I will also put the link into the question. Anybody have any questions? Anybody learn anything useful today, maybe? I mean, I figured I could just sit and talk about it, but I wanted to try and show you how it can work. I'll be at it in a couple of cases, a really difficult example. Well, which one? In nested set, it's pretty easy. Nested set, it's very easy. Just simply go, my left value is 12, my right value is 20. Any left value that's greater than 12 and any right value that's less than 20, there are my descendants, whether they're my direct children or so on. Right. Now, depending on how you're doing it, so the method where you pad it won't work, but you can also go wherever the difference between the left value and the right value is greater than one, you know that they have grandkids and so on, and you can work your way through it. I've actually got one that does that, so it's slight variation on it. Let's see if I can go back. Now, I'm doing it for the whole table, but where is the query? Again, it's basically looking where the particular node we're looking at is between the parent value and the left value and right value, and basically just repeating through it. Again, we're doing a little bit of that. Again, we're doing a little bit of iteration, but it's pretty easy in a nested set to do this particular part, and I didn't copy properly. I'm thinking about the first level, right? So I'm at 12. The one that's right at 13 has to be one of my children. Figure out the range of that from 13 to, say, 18. Well, then you know 19 is one of my children, and then that one goes from a range of 19 to 25. Well, if there's a 26 that's within my range, then I know that's one of my children, and you can just work your way through it that way. It can be, but you can effectively fake it out with this little repeat set up here. But notice, sorry, you can email me later if you want to right now. I haven't slept yet, so I... I thought I did fairly well, but I think I'm losing steam here at the end. But it is definitely doable, and it's not quite so bad because it's kind of built into the table, yes. Oh, yeah, for the indenting, yeah. Which effectively does the results you want, because if you're indented, and actually, to be fair, I didn't do that. That was code I modified from that other site. And I don't work with the message sets as much. I don't usually have that many levels to deal with, and I was always paranoid about the inserts. Depending on the size, they're not too bad, but as soon as you get to be big, this looks nightmarish, potentially. Again, I hate to use the... It depends, but for a parts assembly list, and that's the set would go, there's a lot of folks that hate the adjacency set list. And I'm not entirely sure why. I think mainly because they have to retrieve the tree a lot, so they are using modified versions of nested sets. The closure tables, which are kind of funky, if you check out the link, everything links to everything in its path, including there'll be...  It's a funky little set that supposedly is a little bit more efficient than the best of both worlds. What I quite often have done when I was using the adjacency list method is I would periodically create a table that would update periodically that kept track of the levels and everything else. The problem is that as soon as you start doing inserts to it, that falls out of date, you need to update it. So again, some drawbacks. There's some real arguments depending on what you're doing that mySQL and a relational database may not be what you should be using. For some of this, there are reasons why you might throw it into a NoSQL database. You can do it. And there are methods, and they keep coming up with doing better ones. But there are times where it's like, not sure why you're using mySQL other than your boss won't let you use anything else. Family Tree. Let's see if I can find the image that I did here. I was going to try and do that, and I just did not get to it. But I do believe I created a image that I can show you of kind of the basic idea here. Here we go. And this is included even though it's not part of the slide show. So you've got your people table. You have a separate table that acts as a join table with itself, effectively. So you've got your relationship ID, you've got the parent ID, the child ID. You can potentially have a child with multiple parents here, beyond just the normal two. You could also put in the type of relationship, whether it's biological mother, dates and other fun little things like this. But this does work. It does have some of the same potential issues that the adjacency list normally has in that retrieving the full tree can be kind of tricky. Retrieving one branch might not be quite so bad. But you can have multiple, I mean, again, potentially one person could have, assuming you're talking about people, thousands of parents. My guess is somewhere one of your scripts went bad, if that's the case, but it's possible. Does that make sense? Well, this is a variation of an adjacency list and it's really about the only way to do multiple parents. And I'm not even sure how you would do multiple parents with the nested set. It doesn't really... I've never even thought about that. Maybe that's why I was avoiding them. But yeah. So this is one method of doing it. I've had a couple of students. Apparently there's a Arizona Akita Breeders Association. And he put together a database of all the different dogs and who bred with who, pups and so on. And obviously there you do have multiple parents, half siblings and so on. He used a variation on this and it worked pretty well. He had to do some kind of funky procedures to pull out some of the data. But they worked pretty well. Well, I made up for the 14 minutes and wasted it at the beginning. So you got your full hour. I hope there's some useful stuff there and I hope I was relatively coherent. I arrived this morning and was working on this towards the last bit. Because a couple things broke and I couldn't figure out why that one query wouldn't work.  I will do that real quick. Let's go back one more. Maybe highlighting it will make it easier to read. I'm really impressed. A million spam a day. I didn't think my bandwidth could handle that. They used the same username and password as they used for our district office and a couple years ago our district office got hacked. So a little Chinese botnet. Well, the IP addresses were coming from China who actually owned it. Got it and it was for three days one million spam. I'm really impressed. One million spam a day. One million spam a day. For three days one million spam a day. I was blacklisted for most of the internet. Cleaned it up. Everybody dropped me off their list except for Barracuda. You have to go to them and pretty well beg and plead. Here's what I did. Here's how I fixed it. Please put me on probation for 30 days and I finally got off probation. And I tell my students, please don't use the same password. Well, not really. I'd have to change the domain name if I'm using the same domain name. The IP address doesn't really matter. Some of those attacks will go by IP address but some will go by domain name too. I hope that was useful. I'll be happy to talk afterwards. That must be somewhat coherent.


Alright guys and welcome back to channel. Now there's a lot of things that I've learned after four years of medical school and three years of residence, most of them being medicine. And that's the problem is that there have been a lot of skills, particularly adult skills that I need to survive now to become successful tomorrow, that school hasn't taught me, hasn't probably taught you. This video will talk about exactly what those are and exactly where you can learn them to improve. Let's get started. In case you're new here, welcome. My name is Lakshman, internal medicine physician, and my entire job on this channel is to help make your life easier regardless of what kind of student you are and doing it with less stress. And so in today's video, we're going to talk about some of those adult skills that you just wish you had learned amongst all of those books and piles of syllabus chapters and lectures. And after going through the video, if there's something I missed, add it down in the comment section. If something you wish this school had taught you, just completely fail to do so. So number one is having a good conversation. Now I learned this the hard way in medical school where it's very easy to become secluded away from individuals, especially when you're in your medical textbooks. And sometimes when you do get the chance to enter the real world, when I was interacting with my at that time fiance and my wife, when I was acting with my family and friends, it was very easy to talk only about medical school and being a medical student. And a lot of times we just don't know how to have conversations about other worldly activities. But as I've learned now as a full time physician, yes, people initially care about what you do and kind of what your work is like. But if all you talk about is your work-life balance or your time as a student, people become less interested in you because your life is really one dimensional. So having good conversations and being able to talk to people, what about themselves and being able to have them extract all the interesting things and feel like you're somebody who they can convene in. And any conversation they want to have really is a nice skill. Those are the people that you want to hang out with. And so becoming that person for other people is truly where you get to grow as an individual. And one of my favorite books that's really taught me this is how to win friends and influence people by Dale Carnegie. So if you guys are interested, I'll link it down below. But in case you don't want to read another book and you want to put action immediately, one of the best things that I've learned to do is usually getting myself like two to three day blocks where I just don't talk about things that are very repetitive in my life. Being work, school, academics, sometimes it's the empty journey, which sometimes I've been probably annoying my wife about when I talk about over and over again. So having these things, you're just like, man, this is not my best conversation starter because I'm probably like overdoing it. And you'll be interested in finding that when you do this activity, it's not really about you talking about something different, but more so you tend to just listen more because the things you talk about are kind of off the table and people will start convening in you. And this is really where conversations start and you become that person that people have to go to. Now skill number two that school doesn't teach you is time management. School is great about adding things to your schedule, but doesn't really tell you how to manage those. Now as a student, you know, we become more efficient just because of necessity. The quizzes and tests become more frequent, the information becomes more overloaded and medical school is very easy for me. Take essentially a college level class in a span of about two weeks and then be tested on it over and over again for years. It was pretty brutal. And so you can understand simply out of necessity and simply to be able to tread water in medical school, time management became a thing. And usually the default situation is that if it could become more efficient, I would just spend more time doing it, which is not the answer. And here's why. When you're a full time, whatever it's a doctor or a teacher or a lawyer or whatever you end up doing in your personal life, your time becomes even more valuable. And so the things that you never learned how to be efficient on just adding more hours, once those hours become less and less available to you, then you really don't know what to do with yourself. And this is really where it becomes anxiety and stress and burnout really come to the equation. And a good thought exercises. Think about times where you thought you were busy. Think about high school where you thought your schedule was full. Think about college where you thought things couldn't get crazier. And if you do professional school like me in medical school where I was like, man, this is like the most insane my life will ever get. And then I do my first year residency and game over. Then I do my second year and then third year and things just become more complex in your life. And the best way to combat all of that is by becoming efficient at whatever stage you are right now. So then when time is more limited, you're one, better at understanding how to prioritize. And two, understanding how to be efficient and say no to the things that don't really help you progress and move forward with your time. Now, I really don't have one resource that's really helped me with my time management over time. Certain resources and kind of influencers, including Cal Newport, which was in some of my favorite books when I was a student. I'll link those down below as well as his website. As well as YouTube channels like Mat Diabella, Ali Abdaal, who do a really good job of kind of breaking down how to live your life a little bit more simply and kind of more productively and effectively. And also with the sense of purpose is really kind of what you want. And then use those ideas to inspire different things you want to try out. And then you eventually end up in a productivity kind of loophole where people just drag you in and you work on becoming a little bit more efficient. And that's really where life becomes a little bit more fun. Now, adult skill number three that we don't learn absolutely pretty much at all is how to manage your money. Now, this is a huge problem for obviously a lot of students, but it becomes really complex for a certain population who may do a lot of schooling. So I went to college and I had loans in medical school. If you want to watch a video of how many loans I have and how much loans I have, you can watch this video right here. And it becomes even more complex if you are somebody like me who has been a first generation college grad, which I really appreciated. But neither myself nor my parents really knew how you manage the debt that comes with education you're pursuing. And usually when you're on this timeline of pursuing education, working or working full time is usually not likely. And if you do, you're really just kind of trying to make it through to be able to pay for your expenses. But things like personal finance, budgeting, investing, saving for the future. And also asking yourself questions like which form of personal investments will help you progress and actually grow. Something like medical school obviously will help me have a higher salary in the future. But also which investments you probably have paid for yourself that really haven't given you any dividends. Those things that you buy usually the tangible things. They won't really tell you those differences and then add on complexities like taxes and interest and credit cards and all of the things that the world of finance will either do really well for you if you know what you're doing or will kind of use you as a victim to make more money themselves. No one really teaches you how to manage their money.   But no one really teaches you in medical school and residency like how to manage your money. What insurance do I need as a doctor? How should I save? How should I live when I first get a real salary as a physician? When do I pay my debt off? What rate do I do it? When should I buy a house? How big of a house should I buy? Those are all questions that you ask in the individual moment. But if only school had kind of taught you that so that way when you are working towards your education and or having a small income on the side, you then kind of already know what directions you're going to take once that money is actually there. And so certain outlets that I've learned finances through the past few years include YouTube channels like Graham Stephan which does a really good job of making finances very entertaining. As well as things like blogs such as Mr. Money Mustache if you want to learn about the fire movement and how you can retire pretty much in a short amount of time but just using basic principles and math to check out that. As well as certain books and I'll link them down below. I think there's a book that's called like the Random Walkdown Investing. It's like the one thing I read that really just changed the game on how I save, how I invest. And so so many more. If you guys are interested in even more of a bundle on how to manage finances especially as a medical professional then there are more videos that I just constantly keep adding just because I'm a geek about it to them at a leave academy. So if you guys are interested you can check those out or if you want to check out some of the videos that we've made about money and finance here at YouTube I'll also be linked down below in a playlist.  Seems like a very minutia thing but I went to the dentist today and I basically was given a bill that was going for $700 for a cleaning that honestly doesn't seem too extravagant. I'm asking myself like how much of this do I need? How much of this is actually being paid from insurance? Which things should I be taking advantage of that I'm not? For example, I can get contacts apparently for $150 every single year with my insurance which kind of new but don't always take the advantage of. And ironically even myself as a physician we're just not really taught about how to manage insurance and personal insurance and liability insurance, auto insurance, health insurance all until we actually have to do it. And then we just kind of put the trust in what our company is supporting us and hoping that we have a good service. And sometimes a lot of us you may have been burned where we think we're paying for something good and then something happens. Like I've paid for, you know, warranty insurances on things like laptops and laptops gone bad and somebody said, oh, this is the situation where we can't help you. And honestly would have just saved a lot of headache if somebody on the education trail had said, okay, we're gonna have a class about insurance and what type of things to look for when you're buying a house? What kind of insurance do you need? When you're buying a car? Do you need insurance or not? The answer is yes. When you're buying health insurance what kind of things should be looking for higher deductible, higher premium? This is like small minutiae things but until you start making this accelerate and start having to care about your own health insurance and care and your parents aren't paying it for you, it suddenly becomes, oh man, I have to actually think about that. And so if you guys are interested in learning about different types of health insurances and other types of resources for all the different insurances that you need as an adult, I'll link those down below. And the next adult skill that school doesn't really do the best job of teaching as they're at least doing well is managing meaningful and romantic relationships. Now, especially when you're in a situation where education pretty much takes the majority of your life, medical school being a great one, thinking about your future, your future partner, doesn't always come to a certain kind of aware that it should happen or you should find the right person, but sometimes you become so busy you're not really sure how to dedicate time until you can be looking if you haven't found anyone. And then two, when the opportunities come that you do get to interact with somebody who may be a good fit for you of how to make that work with a busy schedule. I see this problem in medicine all the time where students and physicians are just not sure how to make it work with somebody who just has a completely different life than them and doesn't understand the life of a doctor which is very understandably busy. But even once you get into a situation where you are in a relationship, how to manage that and how to have proper communication with somebody really is only limited to practice and trial by error. Now, this is obviously a skill that school never taught me well, but I lucked out because while I was through the schooling process I met my now wife and we've been through together for quite some time and you guys want to see our tips of how to manage a relationship and kind of a busy kind of life, particularly in medicine, you can check out this interview that I did with her a couple of years ago. But one of the things my wife and I pride ourselves about and then again school never taught us this experience did is that we don't really fight, we don't actually have arguments and that's mainly because one, we don't like confrontation. And two, we're just good at understanding and how communicating of when the other person bugs us. And I know per se I definitely have a lot of bug worthy qualities and she's literally allowed me to make early agreement to a YouTube studio. So I can understand how I can get very annoying but having those kinds of communications and understands between the other person really comes with time. Again, school doesn't always allow both the time or the ability to do that and sometimes you just have to say I'm going to dedicate time in my life to explore relationships, explore communications and connections with people and even if you're in a situation where you don't find that person in the near future, literally giving yourself the opportunity to look and have time and interact with people and become again really good conversation starter and a good listener will develop those skills that are super important to make those relationships truly high quality when your life gets busy. Initially I thought about leaving this kind of topic out of the video but I realized that if there is one thing in school that I didn't really learn as well is how to manage my relationships outside of school and thankfully I just had a support system and a wife that really helped kind of build that time and that bond that made school so much easier and so when you're going through a tough part and a challenging part of your life those outside relationships can be so important and so vital to help you grow and that person grows and then you kind of grow together as well as individually but unfortunately that's not a skill that school teets as and sometimes we just have to develop those time management skills to dedicate time to develop those relationships and those conversations and regardless of what type of relationships you end up developing whether it's romantic or support based you are going to be much more successful much more happier much more fulfilled in your life on everything you choose to do and before we get to the last few things real quick is there anything I'm missing so far in this video that you wish school would have taught you go ahead and drop those on the comment section and by the way while you're there just hit that like button to really support the channel I truly appreciate it but the next worldly skill that school probably should teach every single buddy so much better is prioritizing your physical as well as mental health now there is so many things that are involved in physical and mental health but unfortunately when you're in academics the main focus is doing well in academics get that grade be at a certain percentile to look more impressive to colleges and medical schools and residencies and there's always an idea of trying to impress but sometimes there is a lack of focus on impressing yourself and growing yourself and so sometimes that includes understanding how to take a break so you mentally can be relaxed and not stressed how to do things for your own physical health so what kind of exercises are fun for you so it doesn't feel like work but sometimes it feels like something you should be growing in so I've learned that I enjoy running not because I enjoy running but I enjoy feeling like I can run four miles a day and then five miles today and then seven miles the next week and then etc. and going forward so currently I'm in the form of training for a marathon mainly not because of physical desire to be able to run 26 miles but for the mental capacity of saying I just did a goal that my body couldn't do a year ago but having that ability which again school didn't teach me to say these are areas in my life that are not quite optimized maybe you're not the greatest runner you don't have the best endurance you haven't run another half marathon you haven't run a marathon develop a skill to where that becomes a goal and maybe you can check something else off and then moving on to the next thing for example I'm not the best cook I wish that I could just have like a month or two session of like taking a course or watching YouTube channels where I just make crazy things and learn small things about cooking maybe in the future but those are things that I know I need to work on to improve my physical health my mental health and just my overall progress but again school doesn't teach us and then last but not least is to really identify your true passion we go through a timeline of school ideally to reach a success we're usually in the form of a job so if you go to medical school you want to become a doctor you want a job as a physician if you go to computer science you want to have a life as coder or working for a software company but there isn't always a connection where the thing you end up doing is completely your passion maybe there's some overlaps but there are some things that you wish you could be doing on the side perfect example for me is I created an MD journey simply to share my own experiences but then it became clear to me that one thing that I really do enjoy doing is to self reflect on things that are working or not working and then just kind of putting it in the form of either blog posts and email and now here a video or a podcast and helping other people and then as you do it more you start to develop a momentum that says oh I'm actually decently okay at putting ideas together and saying these are the things that you should consider doing in your own life because I've either screwed up try not to do that or this worked for me maybe you should try and putting those in the forms of videos and so I realized that in addition to my desire to help people who are sick as a physician I also want to help people through my own experiences and you can probably find your own passions that are not being completely fulfilled by your own work or academic life and so you can ask yourself like what would I want to spend more of my time and if they told you that you had to work for free to you know have enough to be able to live for a month with all your food and mortgages paid like what would you do more of instead of actually focusing on work or academics and that really starts to ask you questions like where can you develop interest where can you grow your passion and what kind of things you can do on the side to again make your whole life a little bit more complete but those guys are some of the worldly and adulting skills at school just hasn't taught me didn't teach me well and hopefully and thankfully I've developed some of them some of them still working on let me know in the comment section what type of things that you feel like I may have missed on that maybe you feel like school didn't teach you but now suddenly you have been able to pick those up later on those questions and comments down below if you do have a specific question for me whether by medical school or something else there is a link down below to ask me anything and essentially if you drop your email I'll basically send you a video response to that question or your questions and if those questions are appropriate for the general audience I may share those on our YouTube channel and as I hinted on earlier in the video if you are trying to learn some of those adulting skills especially in medical school things like time management managing your money relationships interacting with patients finding that side passion and motivation which is all of our best step-by-step things on how to study rotations board exams but also things like time management money management a bunch of adult skills you'll need to know as your future of the physician if you guys are interested I'll be linked down below but regardless guys if you did enjoy this video hit that like button hit it 2, 3, 4, 5 more times apparently you have to hit an odd number of times to make sure that you don't unlike your life so consider hitting it 3, 5 or 7 times but don't hit it 2 or 4 times I guess and consider hitting that subscribe I've actually enjoyed making it for you and thanks for being a part of my journey hopefully that was a little help to you guys on yours and I'll see you guys in the next one if you did enjoy this video then check out these two videos right here how to use Anki like a pro and how to study in medical school step-by-step you'll probably enjoy this one but until then guys I'll see you all in the next one take care of my friends peace


What's up guys I'm back with the vlog feels good to be back. I was away last week So that's why you weren't seeing so many videos coming out. We were at the ABS Chicago show That hair show was pretty cool. We did a lot of fun things the whole free salon education team was out there So hopefully we got to say hi to you Today on the vlog I'm super psyched because we went to we did a men's cut obviously you can see him staring right there We did a men's cut, but I did a combo cut of scissors razor A few different things to create the texture that you're gonna see in this longer men's cut The great thing about this cut is that it's very versatile and it's for those guys They're growing out their fate it gives them a goal to go towards when they're trying to grow their hair out So a lot of guys are trying to grow their hair long now instead of fading it out so this is definitely a good transition cut for you and That's pretty much it. So I use my DB 20 scissor from Mizutani also my 7-inch solid scissor I use the chopstick pro from Donald Scott all this stuff that we have on free salon education comm I think you're gonna dig the technique and if you love tools, this is definitely the cup for you very simple and That's pretty much it. So we're gonna get started. Let's go here. We go with a step by step All right guys, so we're gonna start off by taking a center parting what I want to do is I want to split the head in half Because I'm gonna work on each half of the head, but I wanted to work from the occipital bone over So that's just the easiest way most men's cuts.  So Sectioning in a balanced way works the best So we're gonna start off by taking a vertical section straight out from the head now Elevation is the key to this haircut being In a form of what men are gonna like what I wanted to do is create Layering not too much graduation. So in the back the occipital bone Kind of bends down towards the nape. So what I'm doing is I'm elevating up higher than that To create that kind of at least 90 degree if not a little bit higher angle in the haircut Everything's coming over to the previous section So traveling guide across the back of the head and we're just working our way all the way over to the corner So everything's just gonna keep coming straight back creating that more balanced shape in the back of the head Now you'll notice that I shift the way I hold my scissor towards the bottom section That's just so I don't have to twist my wrist too much It's just a technique that you'll see some people using just for a comfort thing more than anything So working my way down Now what I've done is obviously created a lot of length on the bottom We're gonna go through and cut that later using a different technique. So When I'm doing haircutting, I'm not always Going straight for what I want the length to be I'm working with the layers first getting the layers where I want them and then I'll deal with the length later Throughout the cut. So I'm keeping my body position the same now when I'm going through I'm scooping the hair So I'm doing more of a backhand comb technique What that's gonna do is keep the consistency of how I've been combing the hair throughout the entire cut We've talked about this multiple times every vlog on Always combing towards your guideline. So my guideline is coming from the center or from the left So I'm combing the hair towards the left to meet the guideline Anytime you move your guide or you comb your guide towards the new hair You're shifting your guide from where it lives and you're gonna throw off your entire haircut. So Scooping that hair bringing it to the guide and then just working that palm to palm technique The same exact way that I did on the opposite side. This is building our structure This is really setting the layers in the back of the head This is the most important part of the cut because if this is too bulky or too Built up too graduated. It's gonna complete. It's not gonna look like a men's cut It's gonna look like a women's cut and that's not what we want or it could get moldy if we leave it too long So really getting those layers right now a lot of you are probably asking well, how do I get the layers, right? How do I? Pick the length of the layers. I think it's just based on your guests So just figure out where you think the layers are gonna be comfortable and then give them Maybe a month's worth of growth so they can come back in and get it cleaned up Now we want to round off the back. I don't want to square it The reason I want to round it is because I'm gonna connect it to the back portion So we started off. I use my DB 20 scissor now. I'm using my chopstick pro from Donald Scott. This is another I think 35 to $39 tool on free salon education I love this tool for women's cutting and men's cutting but this is where if I want to get in tighter to the head so We use the carving comb and we're working with layering and texturizing with this This is more for a precision type feel if you want to get really close to your section more like a feather razor So I'm combing and I'm working the angle across Creating that horizontal line and then I just shift into the corner and round that corner off Which kind of gives it a nice hug to the hairline So now I comb the hair in the direction. I want to part it That's another key thing that I like to do I like to get the hair flowing and then go for my parting just keeps you from getting tangled up in the hair And then I'm working diagonal back. So I want to start off. I'm gonna find my connection point now This doesn't have to be exact. It's how long do you want the front of the hair to be? I want him to be able to tuck this hair back So I'm gonna go a little bit longer with it and my strokes with the razor are nice and heavy because that's gonna Give me a lot more texture in the haircut. So you'll notice that a nice heavy stroke through there It's gonna. Give me a very point-cutted feel point-cutted if that's a word. I'm gonna go through there and just Do those heavy strokes create that texture guys hair is all about texture at this length Because it's not only gonna give them a cool look But it's also gonna take out a lot of the bulk which is what we want to accomplish now If they have finer hair You might want to create some more solid lines in there because they're already gonna have that separation and definition in the haircut So just working the round of the head diagonal back sectionings following the round of the head and The elevation is nice and high want to create layers. I do not want to create too much graduation Once you get to the top part like around this point right here There's a little bit of graduation happening But because of the heaviness of the strokes on the razor you're really breaking down that Graduation you can see how the flow just works. I love this technique Like I said in the beginning. This is a great haircut for guys that are trying to grow their hair out You could wear this haircut until it's about down to your shoulders So you would do the same exact technique just keep working it a little bit longer each time So flowing into the back This is absolutely at graduation at this point because the crown of the head is our top point So coming straight out off the crown would be 90 degrees So we're at almost zero, but again heavy strokes of the razor helps counteract the heavy density that might happen in the haircut Same thing on the other side working that diagonal back section connecting it to the back portion that we cut at the beginning Heavy strokes of the razor keeping that razor blade at 45 degrees I've seen a lot of people in classes that keep the razor at 90 degrees To the hair which is scraping the cuticle and that ruins the hair You want to keep that blade at 45 degrees. It should feel like you're barely cutting anything when you're cutting with the razor As you go over the hair that that's how you know you're doing it, correct So keep working diagonal back Heavy strokes like I said Creating that texture taking out that density. That's the beauty of working with the razor I love working in the middle part with the razor the beginning I was building that structure so you could do it with the razor as well But I like building stronger Structures for my base with harder lines and then going through and softening the lines over top of the haircut I think a lot of people get caught up with the fact that alright I started it with with a scissor so now I got to finish it with the scissor You don't have to do that you have many tools to do the job and and there's different ways of going about different things So the razor is going to create a completely different look than the scissor and they go well together So now we're going to work through the top taking horizontal sections across the top the first one We're going to work as our guide our guide is coming from the back to connect the front and back Then I'm going to work that horizontal section over direct it to the previous Until I get to the middle of the head Then I'm going to over direct everything all the way back to the middle of the head to create extra length in the front So you can see that there the reason I want to create the extra length in the front Is because he's going to toss it back and I don't want this haircut to look like it's following the round of the head I want that kind of heaviness to flop over the top I think that's what gives this haircut kind of a cool look So over directing everything back using a lot of point cutting. This is back with my DB 20 scissor again This is my favorite all-around wet hair dry hair scissor Is a 5.7 inch DB 20 from as a Tani that we have on free salon education now This is the Mizutani solid. This is my 7 inch scissor that I love for scissor over comb The reason I like a longer scissor for scissor over comb is just the amount of hair that you can cut at the same time as you're working And also the solid scissor. This is a brand-new scissor. This is the titanium version The cool thing about it is that because it has the titanium plating It's even stronger and it just flows through that hair so fast So even though it's a 7 inch scissor, which would normally get weak towards the tip. It's not weak whatsoever So I really dig that scissor for scissor over comb now when you get the titanium plating Just so you guys know if you order it on our site It's a $50 upgrade and it takes a little bit longer to get the scissor if we don't have it in stock But it's worth it now We're gonna go through with the tip of the chopstick pro and just work the edge This is great for women's cutting and men's cutting just to soften And create more texture around the edges of the haircut Now I'm gonna go through blow drying just with my hands not a lot of drying Now a big mistake that guys make is they put product in their wet hair now Water the products that are normally made for guys are water-soluble, so they rinse out easy So if you put them in wet hair it dilutes the product too much and then they just end up looking greasy this so you get it About 90% 80% dry and then put in we're using the rusell blue pomade Which is just a really thick firmer hold Pomade, but it still gives a lot of movement to the hair and a lot of shine So I dig this product for this cut. I Love if I had the right hair. I would definitely wear this cut. I love the length in the back I love the top just kind of kicked over. So I hope you guys like this cut Definitely check out more of our cuts every day at 10 a.m. On this vlog. Thank you guys so much for watching check out free salon education comm if you guys like this cut make sure that you hit the like button hit the subscribe button and Share this video just copy the link share this video with all your friends and make sure that you hit that little button That allows you to know to get no alert every time we post a video so you guys can stay On top of everything that we're doing because we're posting videos every day So make sure that you're on our list. Thank you guys so much for watching and I'll see you guys on the next video. Thanks


The Word of God is the foundation upon which we build that friendship with the Holy Spirit. In fact, the Word of God is the substance with which the Holy Spirit creates the character of Christ in you. If you're serious about drawing closer to the Holy Spirit, you're going to get serious about the Word of God. If you're serious about hearing the Holy Spirit, you'll get serious about the Word of God. Now this can be challenging sometimes because in our lives there are many different distractions after all. The flesh craves entertainment. The flesh always craves something else or what's next. And because of that, we have to learn to subject the flesh, say no to the flesh, and instead stay focused on the things of God.


So welcome to this course on abstract algebra. Now we're going to start with the sets. Now sets are not always the most exciting thing in the world, yet if you open a textbook on discrete mathematics, on real analysis, on group theory, and indeed on abstract algebra, chances are it's going to start off with sets. So we've just got to become familiar with sets. Although as I say it's not the most exciting thing, it's actually quite important and it really will help us as we ease into proofs, and of course proofs is a very important part of mathematics. Let's have a look. Now we're going to define sets in a certain way in this course. So let's do that. Let's say our sets and how we're going to define sets is this, we're going to say it's a well-defined, so well-defined collection of elements. So that's one way to define a set. Now there are various types of sets and you can read up about that. For the purposes of this course, we're going to know exactly what goes inside of our set and what is not inside of our sets. So if that is a set, just another word that is sometimes used as a class, but we're going to use this term set, is what is an element? What is an element? Well an element is just the building blocks, the building blocks, building blocks of a set. And that is the elements, that is the building blocks, that is how we populate a set. So I'm going to use some notation in this course. So let's just have a look at notation because depending on where you study, what book you read, there's going to be different notations, the notations that I'm going to use here is always a capital letter. It's going to denote the name of my set and if I list the building blocks or the elements, I'm going to use curly braces and let's say that the following r, s and t are elements, they are elements of my set. I might also write something like this, r, s and t, r and s and t, so that's and are elements, they are elements of my set a. And if I have something like p, p is not an element, I'm going to write that p is not an element of a there. So let's construct a nice notation. Imagine I have the building blocks, the elements 1, 2, 3, 4, 5, how can I write that? I'm going to call this my good example a1, so a subscript 1 might also be how I write an element and that is going to equal all the elements x such that, x, so that's such that, x is an element of the natural numbers, my double struck in there and which is going to be a, x is less than or equal to 5. So that is a well-defined set and that is good set notation because a1 now is really going to be the elements 1, 2, 3, 4 and 5. No problem there. Let's construct a set where we say let's take all the natural numbers divisible by 5. I'm going to call that a2, a2 and I can write that as such. All elements of x such that x is an element of, we said we wanted the natural numbers and x is divisible by 5. So here really we're going to have a2 is going to equal, 5 is divisible by 5 without a remainder, 10, 15, 20 and it goes up to infinity and we use the dot notation for that. So that brings us to these sets that we're going to use all the time in abstract algebra. That is the set of natural numbers and that means 1, 2, 3, 4, 5 up to infinity. So we start at the number 1 for natural numbers. Of course that means we must have the integers double struck z and that is just going to go from negative infinity, say negative 2, negative 1, 0, 1, 2 all the way to positive infinity. That brings us to the rational numbers. The set of rational numbers denoted there by double struck q and that is going to be all the elements x such that x is equal to p over q, p over q and x is an element, we should say p there, p is an element of the rational numbers. I should say the integers, q is an element of the integers there and q is not equal to 0. So we've all seen those. The rational numbers is this equation of integers and then of course we're going to have the real numbers and that just falls on the real line. So all rational and irrational numbers, remember an irrational number cannot be expressed as the quotient of integers. So that's really what we're going to use in this course on abstract algebra. Next up I just want to remind you when two sets are equal. So if I have a set A2 here and that set equals the elements 1, 2 and 3 and I have the A sub 3, my second set there and that contains the elements 1, 1, 2, 2, 2, 3, 1, 2, 3, those two are exactly the same. When we have repetitive elements like that we only view them once. So this A3 is actually going to be the same 1, 2, 3 and elements are the same. They are equal to each other if they have the same building blocks or the same elements. So these two sets, although they appear different here, remember by definition we really are going to view them as exactly the same. So just as some of the notation, just so that you can be on board with what's going to be used in this course, it's always different for all sorts of courses and all four sorts of textbooks. But this is what we're going to stick to. Next up we're going to have a look at subsets.


Extra DWI enforcement over the holidays around Minnesota resulted in more than 2,000 arrests. According to the Minnesota Department of Public Safety Office of Traffic Safety, 2,407 people were arrested during the added enforcement campaign which ran from November 23rd through December 30th. More than 300 officers, deputies and troopers participated in the campaign on weekends and holidays. 11 agencies reported a blood alcohol level of .30 or higher. If you've enjoyed this segment of Lakeland News, please consider making a tax-deductible contribution to Lakeland Public Television.


Happy New Year everyone! And thanks for 2021. It was a great year for this channel. I only started making videos in the beginning of July and by the end of the year I already had 1,300 subscribers, 35,000 views on the videos and a total of more than 3,000 view hours. And that's all thanks to you, so thank you. In 2022 I plan to make more of the same, but I do plan to slow down a bit. Specifically, I plan to go to a bi-weekly release schedule and that's for two reasons. Firstly, making a video takes a full day. So for half a year I've been spending half of my weekends making these videos, which is not quite sustainable. Also, I'm slowly but surely running out of topics to cover. So suggestions are welcome. Keep them coming. Thank you.