I'm gonna confess I think Ted said it actually the best The speeches are actually an excuse to bring all you guys together. I know I enabled that last night And actually it was probably one of the best events we had I know that I spoke about being an architect and creating shells My house literally is that I was just commenting recently that it's a it's a monument to drywall or Gypsum board and the you know, I had the intention of making the house a kind of a gallery for space in a sacred space But the house doesn't come alive until it's filled with people and last night it roared and that that without a shadow of a doubt Was my my most famous my my favorite experience of the entire event Usually it's in the hallways or sitting down having a meal with somebody really quick discussing ideas But last night it was seeing my house come alive with the attendees and the speakers absolutely engaging each other for extended periods of time Yeah, we were we were talking about it just next door that What really sets this event apart from others is that the collection of people and the speakers to the audience It's just top quality getting to hang out with some people that don't get to meet and see very much We're spending more time with others that I do is it's always fun Always great discussions going on and insightful You know talks to be had we're all excited about the same sort of stuff And then you guys bring like, you know the best questions the best presence like the best ideas Yourself, it's it's just an awesome collection, and I'm always excited to be a part of it Yeah, this is my second one first one in the US and Getting to meet up with old friends and then making new friends. That's the community is the best part really and then The other part was the diverse diversity of the topics covered. It was really cool Partying with David Tien Which was pretty awesome and those of you were there, you know Hey, this is we've always tried to talk about this at the 21 convention How important it is to experience the convention and advertise that it just doesn't make sense You're like, but I watch the speeches on YouTube. How is it different? You guys all get that like this in for years That's it and let me just tell you I said this the first day And I try to say this at the beginning of all convention of the conventions is that this is the only one where there'll be like 10% to 15% of you guys that will go on to do something really really big like insane You know and it's just it doesn't happen. You know actually that's low It's probably a higher percentage, but there's always a click of guys that just They do it they take something that I said they go beyond you know or whoever else. So that's what happens here It's really cool. I'm probably a little biased on this question.  I Would I would never leave people in my house like unattended Like you're like, I'm gonna go to bed. You guys can still hang out and stuff afterwards. I would never let that happen I got too many weapons and stuff like an east comes and visits. I just like a whole day hiding stuff Anyways, what really is it sounds funny, but I joke about it a lot But it's true like not a lot of things in this world bring me joy so coming here and speaking and getting me other cool guys that There's lots of different paths to the top of the mountain There's lots of different paths to enlightenment like other guys that have some cool shit that they figured out and it's interesting because we all have our story we all went through so much shit and And came out on top and just meeting other people like that's pretty awesome But really the coolest thing the part that really brings me joy is hearing from you guys like a month from now Six months from now one of the guys on my forum like bought a flashlight Which is like you send me a Facebook message one day going hey bravo I bought that flashlight you talked about and my girlfriend and I were almost mugged and I ended up using it to keep her and Myself safe like that's the shit that just like just makes my day like and I'll Screenshot that stuff and put it up on my Facebook page And I'm like this is what this is why I do what I do and this is why I deal with so much bullshit Especially in the Pua world like I still get to go out there and help guys Which is really I think my purpose on life was going through all the shit and everything I did It's like being able to help other people out and share the stuff I'm passionate about like this doesn't even work to me This is just fun and somehow I get paid to do it like it's awesome So for me, I would say the biggest thing that I enjoy about this and have enjoyed about this because this is the first go Around for me with this convention is the pressure that you guys put on me I know when I was preparing to come and I was thinking about what I was doing when I was your age and Self-improvement was nowhere near a top priority for me not even close And so the fact that you guys are already so far ahead of the curve puts a lot of pressure on me And then the conversations that we've had in the halls or last night or just kind of back and forth the level of questions that you guys ask The sincerity with which you asked them and your willingness to actually engage with me on the answers is so indicative of the fact You guys take this stuff seriously as opposed to it just being kind of a passing hobby or something that you're kind of Yeah, I may be interested in but I'm not willing really willing to sacrifice for I go to other conventions where guys put skin in the game Financially but I can tell that mentally and emotionally you guys are putting skin in the game too and that makes me want to step up my game And so I appreciate the pressure you guys have put on me It's my first time speaking at the convention as well So I didn't know what to expect, but I got to say I really enjoyed the diverse topics the speakers Not everybody has the same beliefs But everybody's open to ideas and that openness and that coolness about it and just being Willing to hear people and see what works for you and see you know and discard what what doesn't and also like everybody else Mention how cool you guys are because for me. This is not about getting up and Self-aggrandizement or you know Any anything like that if what I said doesn't make a difference in your life then I failed regardless of how cool I looked on stage and Hearing you come up and talk to me afterward and the questions you asked me afterward. Just really I Get goosebumps. So thank you for allowing me to To do my thing Thanks, you know when I look across the room. I look at the other speakers I realized that we're all on the same journey. We're just at different parts of the journey Some of you guys are ahead Some of you guys are at places that I've been to and Some of you guys are starting out and so the journey is pretty linear. We're all heading towards the same point We're just going at about it in different paths in different ways And sometimes when we listen to one another and listening I think is the key secret here We find little shortcuts along the way. We find other roads we can take You know, we will have a perspective of how we look at life and to share the stage with these gentlemen and to share You know the the stage with you and and watching at home All of you are looking from your own perspective. So to really drink that in and find out what your perspective is That's really incredible because perspective changes perception and the more perspectives you can get the more perspectives You can experience whether you're talking to the speakers or the other attendees That's what really gets you thinking and gets you asking really good questions I think when you start with really good questions They lead you to very exciting places and different routes to get to that goal. So that's my thoughts


Okay, let's start First I briefly introduce myself My name is Mitya Trofimov. I work for JetBrains. I am team leader and developer of PyCharm IDE But today I won't be speaking about PyCharm in this talk If you want to discuss anything about PyCharm, come to JetBrains booth PyCharm team will be there during all the conference ready to answer all your questions Don't be shy mostly I Developing Java in Python Java has been my primary development language for the many years And Python for me is more than a language that I use It's like a subject of constant investigation like a snake that I examine Which step of scales it has which teeth and what is inside of it how to rebug it how to profile it and Also, I'm curious about new programming languages and a half a year ago. I started to play with Rust a bit I knew nothing about it at that moment still I don't know much about it now, but I hope that I will be able to introduce it to those who are not aware of it at all By the way, who have you have heard about Rust? That's pretty much and how many of you have tried it already develop some stuff. Oh, that's cool For those who have tried it, it will be I hope to be also interesting because I will show some corner corner cases Yes, so what is known about rust? Yes, and answering one more question Why why did I pick a rust? Why why did I started to invest my time and learning it? I found it interesting and also I wanted to develop a profiler for Python and to make it work fast. So, okay, I will tell about it Rust Rust is my Zilla project and they actually are using it already for the new browser engine called server The project started in 2010 as a site project of my Zilla employee grade on Hoare and The version one was released on May 15 this year. So now it is 1.1 and Before version one things were changing very at very high pace in the rust breaking compatibility And now it's still changing standard library. It's not polished Yet and ecosystem around is just starting to emerge. But now it's Has bake what compatibility and this allows to develop production applications and rust So what is the rust? What did I know about it when I started to learn it? What exactly kept with my eye? They told that it is fast Prevents nearly all six-folds guarantees threat safety close to the metal. It has zero cost abstractions pattern matching and type inference And that sounded very cool. I thought it would be very interesting to learn it First I started to listen some talks on YouTube nothing became clear for them Then I found some specification and turned up that it is already outdated the language Had just changed and then I found rust book For all of you who's interested I recommend this book The starting point it's online and we're well written and I don't think that a talk can help you to teach the language That's why today. I won't explain basics of rust at all. I don't have a goal to teach you the language But to give you a feeling of it Okay, so let's start with a small but real problem and As this is my advantage of rust let it be computational problem like computing primes So the problem is to compute prime numbers between two and n and prime number is the number that has no Devisors except itself and one so like two three five so on and we will solve our problem with the help of an algorithm called Repertance sieve Algorithm is simple the work with this way. We first take all the numbers from two to n and Then iteratively throw away those who have devisors so something like that We start to take two and then we throw away all events and then we proceed To the number three we take as a prime throw all the multiples of three and Then it will be five and all multiples of five are thrown away and seven and so on So here we see a Python implementation of our defense sieve It's quite beautiful. Isn't it here? We initialize our non-primes as an empty set and then we to rate through a range and If the current number is not in the set we increment our counter and update all the Multiples we put it into the set as a non-primes and then return it from the function Okay, so let's run it This is our function and also we have here main function Which takes command line argument as n and then it executes our function and prints output Okay, so it's something like Okay, so we have four between two and ten and Four one hundred We have something that seems to be correct Okay, let's measure the speed the time of this program We will comment out the output because it's always slows down the execution and Okay, and for One million make something like this one.  It's pretty fast But what if our Task is what we do care about speed. What if our task is to implement the the algorithm as Efficient as possible one of the obvious solution solutions is to use C programming language because everyone knows that C is very fast and it's efficient and Very well very good programs are written in C for example C Python and written on C So let's implement this algorithm and see so the program now is a bit longer But it's pretty much the same. So we have our defense function Unfortunately, there is no set in the standard standard library of C So we use array of primes and we where all items mark as one This means that is prime and when it's zero, it's not prime and then we iterate through it and if it's prime increment our counter and Then update of the multiples of zero and then we put our array Into the result structure and unfortunately there is no tuples in in C So we need to have this result structure which holds a counter and our array So and here we executed and we print the counter and Then we want to print all the primes We first put them into the another array, which is the length of of the counter So we iterate again. We put them and then we print them. So Looks quite quite similar. So we need to compile this and We Run it for ten. Okay, it works. Correct. Now we run it for hundred oops and We have segmentation fault Anybody knows where the the error is Yeah, I know that it's difficult, but let's see it Managed to print the Count of primes. So probably the error somewhere here. Let's examine those lines again. So we have all primes array and Which is the length of the total primes and then we iterate through our First primes array and if the number is prime we increment this counter and put it here So probably we could think that we have we go out of range here, but it's impossible because we start from Zero and we increment it With the same condition where we incremented here when this is true so it shouldn't go out of the range and Here we just print the data out of the array. What what is the problem and Actually that that kind of kind of problem that that could be called like a beautiful journey in C because you have no idea what's going on and I'll tell you what says the problem problem is not here that the problem is here because when we Returned our primes array we thought that we are returning array But actually what we do in C is that we return the pointer to this array So this is the pointer to array. It's not array itself and array was Allocated in the beginning of the function on on the stack and Actually, it was valid only in the scope of the function and when we after we Return the pointer to this array and we go out of the scope This array it's it's just no more. It has ceased to be it Expired and gone to meet it maker So and we still have a pointer to do it and that is the problem very common for C programmers. So that's called A dangling pointer pointer that points to know where to some random some random memory and That's why we get it would have a segmentation fold here So our task was to get our primes as fast as possible solution was implemented in C But C is not a solution. I Know that there are programs implemented in C and probably there are people who are convenient with C and who know How to use C efficiently and probably they don't make such errors But something still tells me that sometimes they do and I personally after years of Java and Python just can't imagine how to live in the world Where you can suddenly become a Pointer to a random date in memory So let's carry on to Rust finally, let's implement the same in rust What we will what we will do now is Just to Reimplement our C program, but in rust and we will see how Rust compiler handles this station. So here we have Our C program and here we have quite the same rust program if you don't understand little syntax details It doesn't matter because I just want you to to understand one basic concept For example What we do here we have the same structure and Actually, it denotes the same as in C. We have counter that is integer and this is the The pointer the pointer to array and then there is no Pointers in the rust but these denotes like it's called slice in the rust so it doesn't Holds the data doesn't hold the data. It just points to some data external for that structure So it's actually the same as in C and Then here we allocate our vector initialize it and we iterate and increment the counter Then we do The same as in C and here we return our vector as a slice Okay, so let's compile that oops I messed up with typing Yes, and we have compilation error and Rust compiler tells us that primes does not leave long enough so what it tells us that Exactly what we have here that hey, man, you cannot Compile that I won't allow you because you just want to return the pointer to the memory that will expire after we leave the context of this function and Actually This seems to be very strict, but what is better to get this error just in time before you run your program or To debug some mysterious Segmentation fold just in the weeks after you deployed your program on the To your users for example, I Think this is much better But let's let's run it. Let's make it work. We won't Fix this exact copy Because it doesn't make sense instead of that we just to implement it from scratch in more idiomatic rust because the rust has set And it has tuples like python. So we have much shorter solution and it resembles us python and Okay, let's run it Okay And for one million Something like so yes, it's 20 milliseconds. So it's like 25 or 30 times faster than python and the concept that that Helped rust compiler to to deduce the error that we had is called lifetimes if you are interested about the it read first book So concluding our comparison Python is 25 times slower than rust and And See doesn't work just but so rust is fast and safe But that is exactly what they told us in the beginning nothing new and Returning to our main topic can rust to make my python shine Yes, but if you search in the internet about communication between rust and python You'll quickly find some tutorials about foreign function interfaces You will even find examples like this These Examples are quite Clear and simple and they work if you try So this allows you to call rust code from your python code But it's not enough What if I want to access see python internals from rust what if I want to convert python string object to rust string What if I want to return a complex object from rust what what if I want to make rust library? as a module in python and Actually, that is what is needed in the real applications For example a python profiler by the way, hope you have ever used that profiler for python Yeah, that's cool But for those of you who hadn't I'll tell what profiler is profiler is a Program that measures frequency and duration of function calls of another program and Normally the less overhead it has the better So let's make a python profiler and rust and to see how it goes actually what that was my Initial idea idea when I started to experiment with the rust to try to make for example, it's simple tiny python profile There are two major types of profilers tracing profiles and sampling profiles also called statistical profiles and statistical profilers they periodically capture frames for any program and Normally it has less overhead and tracing profiler which traces all calls in the program Let's see how to implement statistical profile and trust but here We won't go step by step implement all the program because we don't have So much time we'll just focus on two important aspects and maybe we'll learn something all the way and the aspects are periodically and frames so How to run task periodically there is no no time in rust and the library yet But there is a wonderful library called me or metal IO me or is a lightweight library providing effectively different operational system abstractions like timing and We just create a event loop Set up a timing event in it and then we run a new thread and We pass there our event handler and what is interesting here is an event handler Our handler will capture frames and save them to statistics map That is a sampler object that we create it's called sampler and As our timer works in a separate thread that means that our sampler is a resource that is shared between different threads So it's a shared Mutable resource which is believed to be very dangerous As everybody knows so that share shared mutable state is a root of all evil But not in rust rust guarantees you as a safe shared mutable state which sounds like a lie, but it's true What we do is we just put our sampler into mutics Immutal exclusion primitive useful for protect a protecting Shared data when you create a mutics you transfer ownership of the data into the mutics immediately giving up the access to it and Then any access to the data through the mutics will block threads Waiting for the log to became available Thus making the data accessible only through them through the mutics by one thread at a time and To pass the reference to another thread we wrap it with the ARC ARC provides reference counting through atomic operations And it's also safe between threads and having done all that rust compiler guarantees us That we won't have any race conditions never It's just impossible and Not having done that well You can't access that object from different threads Rust compiler won't allow you to do that. It won't allow you even to pass This mutable data to another thread so it will be single thread usage only So compiler guarantees you that you your program will work and to understand this better Read about ownership and rust So capturing current frame For simplicity we'll capture only current execution line as we are not interested in in call three at the moment There are three pieces of information file name function name and line number That we will collect at every tick of our timer In Python there is a function in module C's that is called current frame Under the hood it use function by thread current frames looking into the C Python internals we will find out that The structure that we need is called actually underscore frame So we have this underscore frame structure that points to some To some pike code object that we also need and What we need now we we need to convert it some somehow from from C structure to rust structure to be able to use it in rust and That could be sometimes hard because some C types are Not very obvious how to map to rust types. There is no No, no strict mapping no direct mapping because they are just absent in idiomatic rust so There are special rust types for that to fulfill that gap For example C void is analog of void and asterisk mute is a special type that reflects C pointers and Normally there is null in rust at all but To check this row pointers so we have special method is null so knowing that We Write our code and remember that when One tiny thing but which is important When you're calling C function or using row pointer rust can't guarantee safety anymore all such expressions should be within unsafe block and I think That is what they mean when they say that rust prevents nearly all sick falls because that is the way The word nearly means that it doesn't prevent sick falls in unsafe blocks when Europe is sick or So knowing these mappings knowing how to use unsafe blocks we just create our structures in rust and Seems that we are very close There is everything that what we need but how to convert Python string to a rust string funny, but that was nearly the hardest problem I faced because Actually it was difficult and at some point I came up with something like this so it's just to convert The Python string to the rust string at the last line and it did work sometimes It didn't handle some differences between byte strings and unicode strings, and I was already I already started to implement that but Then I came across a library called rusty Python by Daniel Greenwald and my life became much more easier That is a beautiful library and I highly recommend it actually it appeared that The most things that I needed to communicate rust and Python Were there I only need to to add Some details for my specific case and also it's very good example of rust code For example a string conversion using this library looks like that and also It handles all the cases with unicode string representation and also it provides very very important abstractions like special log Corresponding to the global interpreter lock and Python Yes, and this is this is how you can expose your native rust library at the Python module using Using the rust macros. It's amazing. We read the source. It's very very cool written, so it's Just this line. There are a lot of more under the hood and they are very interesting So Enough it was much code And much very much details, but I'm not finished yet Now as we have a couple of minutes, let's see how our profile of works so So we're profiling this Py that we have written At the first time Okay, that's not interesting. We need to Wow, I thought that it will happen at some point It's impossible to make live demo without fails Yeah, so we comment out our print pythons make matter Um, yeah, let's start with Okay And this was fast. Let's make it for 10,000,000 Okay, it's very simple now. It's very basic, but whatever to tell us that the 85% of our time went in the light eight and 14% and light seven actually Nearly 1% was for output of this line So line eight is this one So what we are doing here is we are dating our set in array and What we are doing here 15-14% is very incremental counter inside the array. It looks believable. So it looks very Very logical. Oh Yes, and if you Still care about Performance in your Python applications, but you don't want to dig that deep into the native code I recommend you to listen to the talk of my colleague Katerina Tuzova that will take place on 23rd of July and Thursday She will show you how to write performant Python code Without using any C or REST. Thank you for your attention questions Is it possible to distribute REST code as a Python package install which can be installed using people? Yes, I've came across little library that allows you easily to Write your setup dot pi this way that it will compile your REST code if you have rust compile that installed Maybe it even downloads it. I don't know. I never tried it. I Wanted to try it but had no time before before and you just type setup setup dot pi Be able to install and it builds your REST from scratch like for C So type pi allows you to install six tensions. So there is a library that allows it for REST also Thank you


Okay, so I'm Ryan Tomego and this is the Shell Haters Handbook and Josh told me we were going to have some sick AV here today and so I figured I'd take advantage of it and do the monster with 20-foot ASCII art, so I don't know, I think it turned out pretty good. I'm here today to talk about the Unix Shell, which may seem kind of strange at a Ruby conference, but there was no Shell conference and so, no, when I think about the technologies that I use and the languages that I use and get the most value out of, not maybe the ones that are most interesting to me or the ones that I want to learn, but the ones that I actually use the most to produce, the Unix Shell ranks up there kind of strangely very high. In fact, I'd say after Ruby and maybe JavaScript, I'd probably use Shell more than any other language. Thank you. Or Shell Haters, remember? It's a boom, actually. And so that's a little bit disturbing for me, but also really interesting and so I started thinking about that and I don't, you rarely see people talking about Shell programming, but it's a very big part of my programming tool chain and so I thought it would be interesting to talk about. And I'm not a sysadmin, I guess I'm an application developer, I work on Sinatra and Rack and some other Ruby projects that Josh mentioned and I work at GitHub where I do product work and front-end things and so I don't really use Shell to, I don't deliver products in Shell that often, but I really couldn't imagine delivering them at all without or as quickly without Shell. And I think that's kind of interesting, I think it makes it worth talking about a little bit because it is a very much a misunderstood programming language, I think. And so just to hone in a little bit more on specifically what I want to talk about today, the Shell has kind of two modes of operating. One is the interactive command line, which I'm sure you're all familiar with. It's, you know, you put in a command or some stuff and then a command runs and some stuff comes out. If you're lucky it's like a cow saying words. If you're not lucky it's like removing all your files or shutting down the internet or whatever. And so this I feel like in at least the Ruby world is pretty well known and used, you almost can't do Ruby development without some use of the interactive Shell. And that's not what I want to talk about today. The Shell is also a programming language and this is where I think it's used much less. And I actually think it's a really interesting programming language. But it's hard to approach it and there's some problems with it, some kind of fundamental learning challenges with coming up to speed and Shell and really kind of understanding it. And so that's kind of the rationale for this talk. Has anybody heard of this project? Yeah? Yeah, this RBM came on the scene like maybe a year ago now. I don't know if you even know if it's been that long. And it's really just lit the Ruby world on fire. I mean, it's pretty much just assumed that you use RBM now. Everybody's doing it. If you haven't checked it out, please do. And a lot of the reasons that RBM is able to do a lot of the things that it does is because it embraces Shell and uses the Shell to its fullest. You just can't get RBM's features without Shell programming. And a pretty large chunk of RBM is Shell. So if you want to work on it, if you want to hack on it, it's good to know these kinds of things. Another project that uses Shell a lot, a lot of people don't know this, but Git originally was mostly a series of Shell scripts. And then some of the core utilities, the plumbing commands were written in C, but a lot of it was written in Shell. And then later those would move to C. So it was kind of this classically designed Unix program where you start off with a single command and then you add more commands. And the Shell really kind of defines the way that Git would evolve. And the reason that it has so many commands is largely due to the Shell and the way that it kind of forces you to program. So that's another piece of software that's near and dear to my heart as far as GitHub goes. Oh, this is like my one funny slide and I just messed it up. What I was going to say is that a lot of people, whenever Git first came out, went and looked at it and heard about this new interesting distributed version control system and everything and went and looked at it and saw that it was a bunch of Shell code. And they thought it was a joke. They were like, oh, you can't actually use this to get anything done. That's just silly. And then, of course, haters are going to hate. And we're going to do a little bit of that today too. And I think it's important to do that with Shell because it does have some issues. And so I think one of the keys to understanding Shell and really getting your head around it is to understand that it's not a general purpose language. And if you're looking at it as a general purpose language like a Ruby or a Perl or a Python or a C or any of these kind of languages, then you evaluate it that way and you're going to get a bad result. It's actually a special purpose language that's designed to assemble commands. And I want to kind of illustrate this through an example. So here we have a very simple Hello World Shell script with a twist. But basically, it's a Hello program. It takes a single argument and then echoes back Hello, whatever name you put in. So if you say Hello Josh, you'll say Hello Josh. But it has a twist in that if you say Hello World, then it'll tell you how cliche you are. So it's a very simple bit of Shell code. But I think we should just take a moment and just hate on this a little bit, right? Like, syntactically, Ruby were used to a very aesthetically pleasing language, a very good language. And so I look at this and I see some things that I really immediately don't like. One of them is the square brackets for the conditional part. I mean, that just seems strange to me. And then there's the superfluous then. We all know that you shouldn't really need that. There's ways around that. And it's just taking up lines. Also, the line or the end of the if is fi. And so there's a lot of these kind of things that are just kind of annoying and kind of heartbreaking. You just don't feel right programming this, right? It kind of feels dirty and gross. But I think if you can set the sort of superficial syntax differences aside, you can see that it's actually not that much different. You're still able to express the kinds of things that you would express in a language like Ruby.  And so that's interesting. It's important that programming languages have that. So now we're going to make it a little bit more interesting. Let's say the boss comes in and he's poking around, and he sees this Hello program, and he's, you know, clever guy. And so the first thing he does is he runs it Hello World. And of course, it tells him he said cliche. And he's got kind of thin sin and a big ego. And so he's not happy about this. He's steaming mad. And so basically, it's like I want that removed from the script, whatever. And so you don't really want to remove it because you like it. And instead, you add this conditional. And you would say, well, if the name is world and the current user is not the boss, then do the cliche joke. Otherwise, just let him say Hello World all day.  And so here we see another little bit of syntax we're able to do ands in conditional spray. But again, it's like dash a, it's just kind of ugly, like why would you do it like that? What you're one character away from and or do double ampersand or something sensible, right? And so these things just kind of great on you. But still, I think it's a it's again, I think a superficial syntax difference, you're able to express the things that you need to express. So now let's go a step further.   Like there's like the thomus thing at like, why is that like half the people I know their computers, how many people here their name is their name in their computer is Mordor. Oh, great. So nobody beautiful. And this, this would do nothing that okay. So but anyway, we want to add another thing that if you're if your computer name is named Mordor, then just always call that person cliche, no matter what they put into this program, right? And so here is where I start to get like, flaming mad about this language. Because now we have an or that's totally different from the and now we have an and that's a dash a and our or is like this double bar thing and not only that, but we have another new set of brackets. And so if you're learning this language, the way that I learned languages, which is you go when you look at a bunch of code and you try to use what you know of existing programming languages to reason about this language syntax, it's extremely aggravating. So let's keep going with this though. Now we have we notice there's a bug in this program. And the bug is that if you just say hello with no name, it doesn't really give you a nice message or tell you that you're using it wrong. It just says hello. And that's not right. We wanted to give an error message. So we do an else. And here again, we see another kind of weird syntax thing with the dash Z that means zero length. We're testing if the string is your length, if it is, then we want to say a usage message and exit nine zero. We see more brackets. It's mostly consistent with the stuff up there. So not that bad. But then again, another then like 10% of our code at this point are thens, whatever. But let's keep going. So now let's say the boss comes in again.  Like I'd rather it be like if they don't have an account on the machine, then they should you shouldn't be able to say hello to them or something. And so you're like, okay, whatever. Go ahead and add that. And so you check the Etsy password file to make sure whoever you're saying hello to actually is a person on this box. And if not, you fail. Now this is where I get just insanely mad at this language. Because now we have another and but it's different than the one up there, right? Like up there, it's like dash A. And down here, it's two ampersands. And not only that, but there's just a grep. And like there's no brackets around it. So we've got stuff in brackets, we've got stuff outside of brackets. There just doesn't seem to be any rhyme reasons like how this language is working. And so this can be extremely frustrating. Now I think that at this point, you really have two options.  I don't even care. I'm going to rewrite this in Ruby or something sensible.  And I'll admit that for a very long time, I just, I took the first option. I just like, I don't charge, I could rewrite this faster than I could learn how it works. But let's say you do go and look at the documentation. So I'll say, man, you do this on Linux. It's like no manual entry for it, which that's actually not that weird. It's part of the built in shell language. So you're probably looking under the shell interpreter. On Mac, if you do man it, you get something slightly better or maybe worse. I don't know, just use out like all these commands and like stuff about built-ins or whatever. And so you really don't learn anything there. But I guess you learn that it's like built in or something. So then let's say you happen to know that Bash has help built in. So if for anything that's part of the primitive or part of the base language, you can say help and then that language element, it'll give you a short synopsis. And then you'll get this. It's like if commands then commands, else commands then commands, else commands, five. So it's like, at first it doesn't seem too helpful. You read in the description, if commands list is executed, it says zero. It doesn't really seem like this is helping you that much. But the thing to notice is that, look at how the commands is the same, right? So like it's if, commands, and then commands. So that seems to indicate that they're they're the same thing. The thing that comes after the if and the thing that's in the body of the if are both commands. So that just seems kind of bizarre. I mean that looks like language syntax and the brackets and things like that.  If you do this on your machine right now, you'll actually get a manual page. So you can do man bracket and that's because bracket is a program. It's the test program. And you can see here under name you have test comma bracket. So it's like shell has this alternative syntax or something built in the special way of saying text. Or does it? If you go if you say which bracket, you'll see that it's actually a program on your file system. There's an executable file under bin or maybe user bin depending on what kind of unix you're on. If you ls it, you can see that it's just a normal file executable. If you dip it with test you can see that they're identical. So it's actually not a special syntax at all. It's that you're running a test program and the whole if part were commands. And so we can run this on the command line and just get a feel for how test works. Test one equals one, echo something, test one equals zero. So the actual evaluation of an expression in shell isn't even built into shell. It's a separate program. And that's because shell really doesn't do anything at all except for assemble programs in different ways and do things based on the exit status of those programs. And then the bottom one, I love that just for fun, run the bracket. See that it does the same thing. So if we were to rewrite the final example and instead of using brackets, use test, I think we can see it may not be aesthetically as nice, although I mean it's horrible no matter what you do. But this way I think it's a lot more evident of what's going on, like how shell actually works beneath the scenes. You have if and then you're running a test program with those arguments. And test is what's processing them and determining whether that expression is true or false. The or is shell syntax and then you have more tests. And so you can kind of, it makes more sense now. It seems like the language is almost consistent with itself. Question.  There is no, I actually had a slide in here where I left the closing bracket off, but you can't do that. It'll actually validate that the closing bracket is there even though it doesn't do anything at all. I mean like it's completely worthless. It's just to make the language look like a general purpose language, which I really think is a shame because it's not a general purpose language. It's a special purpose language meant for assembling commands in different ways. And so just to highlight, here we have the shell grammar. If and then and the ampersands and the or there, those are all parts of the shell. And then everything else are commands. And the shell doesn't really know what they're doing. It just knows that they're exiting or more or less doing different things. And so this is used throughout shell. You'll see while true in same programming language, you think that or in almost every programming language, true is some kind of primitive value, how you mean something. In shell, it's a command. It does one thing. It just exits with zero. False is the same way. It just exits with one. And so you can use these commands as part of language elements. You could run a while loop like this. And you can use any commands there. So you can write your own commands. You could write true in Ruby. It doesn't really matter. The shell doesn't care. It's just executing commands and doing things based on it. Here we see a more often used example of test. Again, that's not a special syntax. It's really running a command. There it is the other way. So again, I just think it's kind of mind blowing that shell looks like a general purpose language, but really it's a special purpose language where the fundamental abstraction is the command. Almost everything that the shell knows how to do is either about executing commands, assembling them into pipelines, assembling them into and or less things like that. And that's really all that it does. It doesn't know anything else. And there's a couple of different kinds of commands. I think this is kind of insanely powerful considering that shell was developed almost 40 years ago. At least the first shell was developed through the 70s. And you have built in commands which are implemented in the shell. So those don't actually things like test and true and false are actually today built inside of the shell. So they don't actually execute those commands on this for performance reasons of having not having to sort of the other process. But they work exactly the same as external programs. So all the show show programs that were written at the time when they did execute this you could bring those into built ins and they still work great. Shell also has functions. They work a little bit differently than functions as we know them. Then though they're basically little mini programs. They take a set of arguments and act exactly like commands. In fact they have the exact same semantics as commands. You can do anything in functions that you can do in a shell script. So you can have if blocks and while blocks and pipelines or whatever you want. And then you can use that function inside of a pipeline or you can use it as the conditional part of an if statement. The semantics are all the same. Later you could take that function, move it into a file, make it executable, remove the function and all your programs will continue to work. If you ported that shell script then to Ruby all your programs will continue to work. So there's like an insane amount of decoupling between the shell language and the commands and how they're implemented. I think that's really powerful and interesting. And lastly ALIS is also work exactly the same way. So if you have a shell ALIS you can assemble that in a pipeline and do all these same things with it. And they can change any way you want. And so the title of the talk is The Shell Haters Handbook and I really just wanted to mostly hate on shell. But I figured I didn't want to like make the conference overly negative and stuff. So I figured we'd do at least one fun thing with shell. And I think everybody really likes pipelines, right? That's one part of shell that I think most people really appreciate. And I just wanted to go through building pipelines and kind of the process of developing them. And so we have a simple problem here. Let's say we have the we have a ebook. It's Jonathan Swift's a modest proposal. And so I'm assigning it to a variable there because the URL was too long. It was like messing up my graph and stuff. So anytime you see URL it refers to that. And so usually what I do when I'm when I'm working on this stuff is, well, I should say the problem. What we want to do is we want to know a word frequency count of what words are most used in this work.  So what we would do is we might start by just grabbing the URL with curl. And now we have that text on standard output. And now we just want to slowly move it toward trying to get that unique frequency count. So we would start by adding a pipeline and maybe we'd use the TR command and use that there's a lot of ways that you could do this but you said you pipe that to Ruby, you could pipe it to Pearl, whatever. I use TR on purpose because it's a standard unix utility and it's something that also Ruby has, right? Like Ruby has a TR method on string. And the TR command has roughly the same functions the same way. It's actually something Pearl borrowed from Shell or the standard unix utilities that Ruby borrowed from Pearl. And so here what we're doing is we're saying anything that's not an alphabetical character replace it with a line or a new line. And pretty much that's it. The C means not or it's a compliment argument. It means anything not in that first sub arguments. So we do that. We can see now that our text is now one word per line. And so we can see though that we have some empty lines. We don't want those in there. So maybe we'd like that over to grab dash B. So we're kind of just taking it one step at a time and just moving the stream closer and closer to our final destination. And what happens here is now it's starting to get a little bit harder to maintain because I'm this command line is starting to get a little bit long. And so there's a really cool trick if you use bash with the standard line innings and I think ZSH works the same way. You can hit control XE and that will actually open your current that'll open your current command line in your editor. So in my case it's them. You can see by the sidebar on the left. I tried to make that look like an editor that's my line numbers. And so now I'm in an editor and now I have a little bit more control where I can iterate on this program a little bit more. So the first thing I might do is just break it into multiple lines. There's a couple reasons to do this. One is just because it's a little bit more readable and two because it's easier to insert things into the pipeline at any point. It's just a matter of adding a line and adding something to the pipeline. So I've also decided to sort out the output. So that's probably a good start. We can start to take a look at what it might look like sorted. So if I run this now I see that I have each word on a separate line with we can see all the A's there and then actual and agree and so it's going good. If I do control XE again I'm back in here. Now I might pipe that over to unique which takes a sorted input and condenses it down to one line per unique line that's in the input. But there's also a C argument that says show the frequency of that word. So how many of them were there? So now we're getting really close. We can see that there are nine A's and one actual. So we're almost there. We just need it to be sort of the right way. So we can add this sort dash Rn and boom we're done. So there's our top lines and this is extremely useful in all kinds of ways. Log files and database dumps you can really rip through files really pretty quickly and easily at the command line like this and they evolve into programs of their own. So the next thing I might do is move this into its own file, make it executable, give it a name and allow it to take an argument. And so that's the way it kind of shell programs you get from the command line into shell programs and these get more and more complex as you go. And so enough of the lovey-dovey pipeline stuff. I want to get back to the hate a little bit. The other thing that's really, really rough when you're starting out as shell is there's a big documentation problem. Basically it's mostly garbage. And there's a couple of reasons for this. One we saw earlier the man and help commands don't always work when you'd like them to. So the reference system that's built into your computer probably doesn't work the way that you'd like it to. Another problem is that there's just a lot of shells and I want to run through these real quick just to give an idea. You have the early shells. These moved pretty much in a line. So you had Thompson Shell was the original Unix shell written by Ken Thompson himself and then that was improved by Maschischell. Everybody moved to Maschischell and then that was improved by Steve Bourne and everybody moved to Bourne Shell. Now Bourne Shell isn't batched. That's an important distinguished thing to distinguish. We'll get to bash a little bit later. But Bourne Shell was the first shell where you could really write fairly robust programs and it actually kind of set the style of Unix programming of the time because you didn't really have general purpose languages like we do then. You had C which was general purpose but lower level. The types of stuff that you didn't see were build special purpose languages to hook into the shell to do something. Just quickly, if we could go back to here, look at all the special purpose languages in here. You have the shell which is one and then you have TR. I mean that's really a special purpose language, right? It's a program that processes a language that says a set of characters and replacements to make on. BREP is definitely a special purpose language and then you have other languages like AUK and SED and all those were special purpose. And so that was kind of the way that you wrote a lot of programs at the time. And then there was another round of shells and this is where people started to innovate quite a bit. So you had CSH that broke with the basic foreign shell syntax and added some interactive features looking more like C. Foreign shell really took foreign shell to the next level and then you had some other shells that were focused on performance or part of other operating systems, things like that. And then that brings us to the modern shells, the shells that are most typically used today. And probably the most popular shell I think by far is Bash. It's a default shell on Mac. It's a default shell on most Linux systems, although not Deviant. The last shell is. But CSH is also popular. How many people here use CSH? It's a lot. OK, that's a good number. CSH is really popular in the Ruby community. It's a great shell. It's interactive, and its capabilities are definitely a lot better than anything else out there. But a lot of what these shells did is they added a lot of those types of features. So these shells focus almost entirely on making the command line aspects of the shell better. So read line and command completion and all these kinds of things were really developed during this era of shells. And the problem is that in order to do that, they had to add a lot of new stuff to the shell language. Especially Bash has just an insane number of new features that aren't included in the earlier shells for things like arrays and string functions and all these things that were previous to Bash punted off to individual special purpose programs to do. Now those are in Bash. And so in my opinion, this creates sort of a problem when you're trying to learn shell because it takes what is really a fairly simple thing. It makes it complex. Here we have the Bash man page which is roughly 40,000 words. And the Dash man page by comparison, which is a much smaller shell, much lighter. It doesn't have a lot of the interactive features. It's more of a pure shell implementation. It's only 10,000. So Bash is 40,000 or 1,000 times. Four times larger than Dash. And so that creates a problem. I think when I was trying to learn shell, I'd go into the Bash man page and it's just like a big mess of stuff that I'm not really interested in. And it seems like it's important because it's there, but it's almost annoying. And so this is from the Bash man page. They even know this.  And some people, I personally, I don't like Bash. I like it as an interactive shell, but I hate it for these reasons that I feel like it's really kind of made it a lot harder to learn shell and approach shell.  There's some like resource issues there. I don't really care about it as runtime. I used it to run my scripts. I use it too as my interactive shell, but I don't use it for documentation at all. What I do use is POSIX shell. And I just want to quickly get to this running over. But so POSIX shell is kind of weird. It's not an actual shell. You can't go and download POSIX shell or install it, but all of the shells that I listed on the modern shell page are POSIX compliant. So they all know POSIX. And what POSIX was is it was they went to standardized Unix because there were like 10 of these things. They were all proprietary and all the different Unixes were going in different directions. So POSIX came along, the IAAA and the open group and like 10 other groups and it's a real complicated history and standardized all these things. And one of the things that they standardized is the shell. And they did a really good job of it because what they did is they took like almost a top down approach which hadn't been done before. All these things are just kind of evolving. They looked at the shell and they looked at the standard utilities and they said what is kind of the minimal amount of stuff that we need to have like a working operating system and that's also the most common and portable between operating systems. And so at the time it was all about portability but today I don't really care about that. I mean I'd like my shell programs to run on Mac. I'd like them to run on Linux but I don't really care about portability the way that they did. What I care about is that I have good documentation that's minimal that I can go in and understand and discover how to work in this programming language. And so that's just great about POSIX shell. The problem with it and this is the thing that I hate again about shell programming is you can't find the thing. It's like impossible. It's like one of these weird standards that like you go here and there's like a bookstore or I'm sorry like you have a shopping cart and all that stuff and it's just kind of a mess. And then but there's a free HTML version so you go to that and then you get like one of these forms and it's just like what is going on? I just want to see like some documentation and in the meantime if you go to Google and search for shell there's like all these bash tutorials that are talking about their string functions and stuff and that kind of information is really easy to get at. And so that's basically another time that I just give up. You know what I mean? Screw it. And so I'll save the trouble. That URL right there is to the POSIX specification. I'm not going to open it. It's nice. It's like it almost looks like Ruby's documentation. You have the shell language, the standard shell utilities. There's only about 40 of them. That's another big problem. You have thousands of commands on your machine. Which ones are the like poor ones used for shell stuff? And the table of contents is a little messed up. So I threw together a page at this URL shellhaters.huroku.com slash POSIX. And I tried to basically, these linked to the POSIX documentation pages. And I tried to just do like almost like a cheat sheet or an intro. So these are shell building commands and then all your standard POSIX shell commands. And I can't recommend enough using this document if you're running a shell programming or you're interested in shell programming. Use this documentation because it'll save you a lot of time and it's just introducing you to the things that are really important about these programs instead of being a big mess of stuff that people have added over the past decade to bash. And so thank you guys for the talk. I'm Ryan Tomego. Thank you very much, Ryan. We can do one question. Yeah. There's actually a lot of things. I don't know if there's any like SysAdmin's or shell programmers. Do you have a good question? What's that? Repeat the question. Oh, I'm sorry. He said, how can you hate on bash without talking about string escaping? And there's actually like a lot of things that I could have hated on that I had to cut out. I ran a little long. The first time I put this together, the first time I rehearsed it, it ran for, I think an hour and 45 minutes or something. So I was just like, I was like, man, so I tried to cut it down and some of it was pretty good. I had some string escaping. I didn't even talk about set E, which is like a major, major thing in shell programming. The first line in your script should always be steady. It's basically like act saying thing. Look that up in the posix documentation. But it just kind of shows how many things that I didn't get to because that's kind of a critically important part of it. But so I'm sorry. There was a lot of things like that that I didn't get to. Thank you very much. That's it. You can talk to Ray Moore in a break.


Hello and welcome to the session. This is Professor Farhad. In this session we would look at an actual CPA simulation that was released by the AICPA. The AICPA is the organization that administers the CPA exam. So this is the real deal. You're going to look at an actual simulation, what would you would see on the exam day. And this simulation deals with the regulation section. As always I would like to remind you to connect with me on LinkedIn if you haven't done so. YouTube is where you would need to subscribe. I have 1600 plus accounting, auditing, finance and tax lectures. This is a list of all the courses that I covered and for this session my income tax course will cover this topic specifically. On my website in addition to my lectures I have additional resources such as notes, PowerPoint slides, true, false, multiple choice. If you're studying for your CPA exam 2000 plus CPA questions. So in this session we're going to look at an actual simulation. Let's go ahead and look at the simulation. So this is what the simulation would look like. Now the first thing I want you to notice is we're going to go through this simulation step by step. I want you to notice that this simulation covers only one topic and it covers the S corporation. What does that mean? It means that a simulation is no more than asking you the questions in a different format. It's asking you the same thing that's on the multiple choice except in a different format and this simulation it's covered only one topic. So simply put the AICPA giving you the simulation to test your knowledge whether you know how C corporation works or not. So let's go ahead and try to resolve this problem to see and as I'm going through this problem I will show you that these same questions could be asked in a multiple choice. So this simulation is nothing more than along several multiple choice questions combined together. Okay. Hopefully you can see my screen. Falcon Inc is a calendar year S corporation. This is important. It's S corporation owned equally by two shareholders, Jennifer and Marvin. Falcon reports its income and expenses on an accrual method of accounting. Falcon has always been an S corporation and has no debt. Falcon's controller has provided information for the completion of Falcon's year four 1120 S U.S. income tax return for S corporation. So they gave us the information to complete the 1120 S. A copy of Falcon's income statement for the year end of December 31st, year four and additional information related to Falcon and its shareholder can be found in the exhibit above. So there we go. They're giving you the income statement. They're giving you the numbers. Let's take a look at the income statement. So I'm going to have to go ahead and grab the income statement to the to the to the site. So they're giving you an income statement. So they're giving you sales cost of goods sold gross profit salaries and wages repairs and expenses scan through them real quick depreciation expense shareable contribution payroll taxes penalties and fines business insurance total expenses income before other expenses 445 other income bank interest income capital loss on land total other income and expenses and net income the maker's depreciation on our asset was 20 000 for year four we did not purchase any new asset in year four the capital loss for the sale of the land used in the trade or business to unrelated party the penalties and fines are for late payments of payroll. Okay so this is the first exhibit so it's basically they simply put an income statement and this is basically maybe a financial income statement so we're going to keep this on the site for now you can close it for now or we can close it until we answer the question and we have additional information in what are the additional information I don't think they're going to have to scroll back and forth on the exam day because this is a mock exam that's why I'm scrolling back and forth and what we have here is Falcon's accumulated adjustment account the AAA account January 1st 100 000 total distribution to shareholder during the year 30 000 it's distributed equally it means 15 000 each and Jennifer Sullivan's shareholder tax basis January 1st year 4 is 60 000 Marvin Starby shareholder tax basis January 1st year 4 75 000 fair enough so they're giving you a bunch of information they're giving you an income statement as well as additional information about this company so let's see what they're asking us and how would you approach this question so the first question which is the cell B2 Falcon's year four ordinary business income to be reported on the form 11 20 simply put what they're asking us is do you know how to compute the 11 20 income so I'm going to have to go to the income statement here right I start with sales and you you can do to you could pull your calculator here okay so you're going to have a calculator or you can do this manually it doesn't matter but you're going to have a calculator so I'm going to start with sales my sales is 1.2 million I'm going to start with sales that's going to go on the that's going to go on the 11 20 s minus cost of goods sold half a million I'm sorry I made a mistake let me clear this 1.2 million and you want to get used to this calculator before you sit for the exam minus half a million that's 700 of gross income do we deduct salaries and wages yes we do minus 203 that's equal to 479 do we deduct repairs and expenses sure we do those are regular expenses minus 10 000 do we deduct depreciation expense yes we do but what we are told depreciation expense was 20 000 notice down here it says depreciation expense 20 000 be careful to deduct 20 000 not deduct the gap depreciation by telling you makers 20 000 is they do you understand that makers is 20 000 that's what they're asking you minus 20 000 so that's the depreciation amount so if you computed the depreciation correctly you will notice that everything else will be incorrect okay then payroll taxes 18 000 that's deducted then we deduct uh do we deduct penalties and fines hopefully you know this penalties and fines are not deductible do you deduct business insurance yes you do minus 9 000 equal to 440 do you add bank interest income no we don't this is a separately stated item here you need to know what are separately stated items oh by the way and I skipped charitable contribution of 5000 I did not deduct this 5000 here why because charitable contribution is separately stated item capital loss on sale of land capital loss separately stated item it's not deducted well I accounted for everything and it seems as my answer should be 440 000 so this is the answer to the first question so the first question is 440 000 except so this is your answer so basically what did this question ask you this question asks you do you know do you know what gets deducted on 11 20 s and do you know what are separately stated items so I listed what's deducted and they they gave you the depreciation kind of you if you don't know that tax depreciation is called makers then you should not be sitting for the exam but the point is tax depreciation is makers okay so that's that uh sums of falcons year four separately stated item of taxable income and deductible expenses to be reported on form 11 20 s schedule k shareholder pro rata share item well simply put like two and three if you don't know how to do three you're gonna you're not gonna know how to do if you don't know how to do three I'm sorry if you don't have to do two ends if you don't know how to answer two you cannot answer three why because when you answer two I told you what which one are the separately stated item so notice what the so here's what I'm trying to tell you this is the big picture what is the big picture for the CPA simulation multiple choice only ask you one specific thing about about about about s corporation in a simulation the AI CPA the industry wants to know if you understand everything the big picture does that make sense okay because if two is if two is incorrect three will be incorrect automatically if you included anything as separately stated item in your deduction or in your income then you don't know what which one are the separately stated item I hope you're getting you're you're seeing what I'm trying to say so my point for all of this is you got to know your things you cannot answer multiple choice questions practice multiple multiple choice questions in order to pass the exam you have to understand all about s corporation and to know all about s corporation well again on my youtube channel I have a whole thing about s corporation several lectures and several exercises and several multiple choice that's gonna strengthen your your knowledge so you cannot know it halfway through because if you know what halfway through and notice if we make one mistake you're gonna see if we made a mistake and b2 all the other answers will be incorrect so that so three will be incorrect if we made an answer into why because if you don't know what are the separately stated items then you don't know how to add them how to add the separately stated items so let's to compute the separately stated item remember to clear your table that's the first thing you want to know and what are the separately stated item we said we had three separately stated item charitable contribution which we did not deduct which is negative 5000 so we're gonna start with negative 5000 remember this is a negative number because it's an expense okay then penalties and fines are penalties and fines separately stated item because we did not deduct them no they are still not deductible on a personal level so penalties and fines are still not deductible therefore we do not separately stated item not deductible just let them go bank interest income that one thousand dollar we did not include now we can include plus one thousand that were negative four thousand and we have capital loss that's also separately stated item we did not deduct minus 24 000 minus 20 000 sorry 20 so the total separately stated items are negative 24 000 5000 charitable contribution deduction one thousand of interest income that this goes to the to the shareholder and the capital loss of 20 000 let's go ahead and input the answer okay it says if an answer is zero enter zero uh what about if it's negative let's see um you have an ask for review so make sure you read the construction enter income and gain as positive and losses and expenses as negative so I have to enter it as negative so be careful negative 24 000 so remember what the read the instruction carefully we're done with this once again I know I'm repeating myself but if you don't know the separately stated item versus non separately stated item two and three will be wrong automatically falcons non deductible expense so which one we could not deduct which expense there's nothing we can do about is the fines and penalties two thousand dollars fines and penalties two thousand dollar remember to enter those as negative negative two thousand dollar and that was that was fines and penalties we could not deduct again if you don't know this like if you took the two thousand and you deducted it on under falcons then you're going to get this question wrong what if you took this two thousand and use you consider it separately stated you're going to get this question wrong because you don't know it's non deductible okay so notice it's all interconnected either they're going to know you know something about s corporation or you don't know okay so all five could be wrong if you get if you make one mistake that's so far so far actually all of them will be wrong you'll see all of them will be wrong if you make one mistake now how would they grade you that's interesting I don't know how you know how do they grade you because they cannot see your work but that's I cannot answer that question because grading you is still a black box really um falcons year four accumulated adjustment account balance so now they want the year end AAA account and again if you don't know what AAA account please go to my website under under s corporation I have a one whole lecture just about the AAA account and what is the AAA account so what is the AAA account what's the beginning balance of AAA account we go to additional information the beginning beginning balance was 100 000 now you need to know what affects the AAA well net income affects the AAA separately stated items penalties and fines although you cannot deduct them the effect AAA any distribution to shareholders so we have all of those so let's go ahead and compute our AAA ending balance so let's start let's look at our calculator here and start to look at the AAA the beginning AAA again make sure to clear your tape before you start that the beginning AAA this is for the whole company is 100 000 then we're going to add to the AAA ordinary income ordinary income was computed at 440 000 I'm sure you're you're starting to see why if you make one mistake that's it your answers will be incorrect so you will add you will add 440 000 then separately stated items they have expenses we deduct those negative negative 24 000 then we deduct the penalties although we cannot deduct them for tax purposes for the AAA account they're deducted minus 2000 now the distribution also reduced AAA minus 30 000 equal to 484 000 therefore the ending AAA the ending AAA is 484 000 once again if you don't know what the AAA account is please go to my website to my website or to my youtube to learn about this okay now the last question is Jennifer Sullivan shareholder tax basis at December 31st at December 31st December 1st Jennifer's basis was 60 000 what's going to happen is this Jennifer's basis it's gonna let's clear the tape Jennifer basis it's going to increase and decrease by certain items well if we have income it's going to increase the basis if we have loss it's going to decrease the basis here we have income if we have penalties okay penalties we're going to decrease the basis although they are not deductible but they will decrease the basis any distribution will decrease the basis we had distribution here so you want to know the items that affect the basis the items that affect the basis starting with her with her basis is $100 000 now here at this point if what you want to do is on a piece of paper basically you know take 440 000 and hopefully you know 50% of 440 is 220 so basically you will need to start with the beginning balance the beginning balance is 100 000 I'm sorry the beginning balance is 60 000 Jennifer's beginning balance is 60 000 beginning basis is 60 000 then we're going to add half of the income half of the income is 220 hopefully it'll give you numbers where you can you don't have to do the computation so why did I add why did I add 220 not 440 because she owns half of the half of the partnership then we're going to deduct half of the separately stated item minus 12 000 that's going to reduce her basis then we're going to deduct half of the penalty which is a thousand because she get half of it and we're going to deduct the distribution half of the distribution 15 000 so overall her basis will be 252 000 so as again as you saw in this exercise as this exercise clearly shows that you need to have a good understanding of S corporation in other words on the multiple choice here's what the CPA is trying to combat they're trying to combat that you answer some of the questions by mistake correctly okay so on the multiple choice they can ask you only about one answer in this question they would know for sure or they will have the assurance look this candidate understand S corporation or this candidate is missing items so therefore just by not knowing what separately stated items are all your answers will be incorrect all of them all five of them okay hopefully this this this simulation kind of gave you a different point of view and that's my that's my purpose gave you a different point of view about how to approach your study how to approach the the studying for the exam because if someone tells you just answer multiple choice questions and you'll be fine you will not be fine my philosophy was and would always be you have to be prepared and to be prepared you have to understand the information inside out how can I help you in this process well go to my website I have additional resources subscribe and I have many exercises all what we went through is an exercise in a typical college undergraduate textbook this is what it is so if you open an undergraduate textbook I'm sure all of you were accounting students remember the homework this is basically a homework from an exercise from your chapter that's all what the simulation is don't let the word simulation intimidate you I'm here to help you study hard reach out to me and good luck


The night before Christmas, my clement seemed more. It was the night before Christmas when all through the house, not a creature was stirring, not even a mouse. The stockings were hung by the chimney with care and hopes that St. Nicholas soon would be there. The children were nestled, all snug in their beds while visions of sugar plums danced in their heads. And Mama in her kerchief and I in my cap had just settled down for a long winter's nap. When out on the lawn there arose such a clatter, I sprang from my bed to see what was the matter. Away to the window I flew like a flash, tore open the shutters, and threw up the sash. The moon on the breast of the new fallen snow gave a luster of midday to objects below, when what to my wondering eyes should appear, but a miniature sleigh and eight tiny reindeer. With a little old driver so lively and quick, I knew in a moment it must be St. Nick. More rapid than eagles his coarsers they came, and he whistled and shouted and called them by name. Now Dasher, now Dancer, now Prancer, and Vixen, on Comet, on Cupid, on Donder, and Blitzen. To the top of the porch, to the top of the wall, now Dashaway, Dashaway, Dashaway all. As dry leaves that before the wild hurricane fly, when they meet with an obstacle, mount to the sky, so up to the housetop the coarsers they flew with a sleigh full of toys and St. Nicholas too. And then in a twinkle I heard on the roof the prancing and pawing of each little hoof. As I drew in my head and was turning around, down the chimney St. Nicholas came with a bound. He was dressed all in fur from his head to his foot, and his clothes were all tarnished with ashes and soot, a bundle of toys he had flung on his back, and he looked like a peddler just opening his pack.  The stump of a pipe he held tight in his teeth, and the smoke in encircled his head like a wreath. I do not smoke anymore, children.  He was chubby and plump, a right jolly old elf, and I laughed what I saw him in spite of myself. A wink of his eye and a twist of his head soon gave me to know I had nothing to dread.  He sprang to his sleigh, to his team gave a whistle, and away they all flew like the down of a thistle. But I heard him exclaim as he drove out of sight, happy Christmas to all, and to all, a good night. One, two, three. Do, do, do, do, do, do, do, do, do, do, do, do, do, do, do, ah, it's the holiday season. Do, do, ah, and Santa Claus is coming round, The Christmas snow is right on the ground When old Santa gets into town He'll be coming down the chimney Coming down the chimney Coming down the chimney down Happy holiday Happy holiday Happy holiday While the merry bells


Hey there friends. Thanks for checking in. At one point or another most of us decided it would be wise to carry a gun It's a dangerous world out there very violent crime happens everywhere I don't care how safe you feel what your neighborhood crime statistics tell you or any of that Crime could happen anywhere. Why do you suppose every time you turn on the news or somebody saying I can't believe what happened? Things like that don't happen around here. Well, yes, they do. Let's just face the truth So I want to share with you when I began carrying it now back in 2000 I became a landlord spent a side business for a number of years I've rented many houses throughout the years and I still do but I remember I had a vacant house And I received the phone call from a lady. She was the sweetest thing. Oh that the house is perfect I saw the pictures. It's so cute. It'd just be me my husband and my my young child Can I plant flowers? You know, I want to I want to see the house and she fooled me And I made an appointment to show her that house as I'm waiting for them to show up a Van pulls up and four dudes jump out They jumped out in an intimidating manner real tough guy, you know tough guys walking around. Is this the house and And then she walked out too Did not look like I thought she would look after speaking with her on the phone, but that's separate. So I'm thinking This is not a good situation here. I am with five people in the house It's completely vacant and I'm very vulnerable and to top it off one guy bumps into me Just kind of nudges up against me. I say, okay there now. I began to feel Anxious I began to feel nervous. I began to feel like I am very vulnerable right now But I was sure not to show it. Okay. I've always learned don't show it act confidence walk firmly Be confident and and I was able to do that. Meanwhile.  They they get in the house when they spread out now These are common tactics. They start picking things apart, you know demanding things You're gonna change out this carpet. Are you gonna add a washing machine? Are you what about this chip in the door? You know, I started hearing this stuff It's a common tactic people pick apart the house then they try to negotiate down the rent I've seen it a thousand times and they were doing that But I said, hey, how about if we all stick together we'll go around the house And then we could discuss any of the issues that you want to discuss and they completely ignored me So I walking around right around after five minutes another guy bumps into me now now I'm thinking this is a plan. Where exactly is this going and how's it going to end? I am vulnerable and The lady was no treat either. She was complaining and saying what do you think about this bill? This is no good and and I couldn't wait to get rid of them, but I couldn't get rid of them Okay, when I finally did I said, okay, we're about ready to wrap it up here Why don't you guys go ahead and talk about it and you know, we'll get back in touch. They wouldn't leave now these guys had Were following me with my back turned on several occasions. I tried to avoid it But I couldn't because they spread out. I did not do a good job of organizing the people saying hey Look, if we're gonna do this, we have to do it this way or say hey You know what how about two of you come in and everybody else can wait in the van and I'll be happy to show Maybe two at a time or whatever. I would never do that or handle that the way I did today but I had to learn I was a young landlord at the time and I thought to myself the disparity of force here is Pretty intense and this could go bad at any given time. There was a point I thought it would go bad like they were invading my space one guy got real close to me And I was just standing there like this, but I was nervous I it was you know, I was trembling inside, but I tried not to show it. Maybe I did show it I'm not sure but I said to myself at that time I will never put myself in this situation again now in 2001 Michigan became a shell issue state That means that they shall issue you a permit a carry permit if you take the training and you're legally qualified And all the liberals heads were spinning. They say oh, it's gonna be like the Wild West. This is so terrible Well, it's been fine, but at that point I took the training I received my permit and I've been carrying ever since every day Not when I feel like I'm going into a rough area or when I feel like something bad may happen every day For all those years and you say well, why are you making this video? Nothing bad happened to you? Well, it certainly could have and I know there are a lot of people out there who They did experience some type of violence.  I'll never feel that way again and Yes, it is true Carrying a gun can be uncomfortable, but it certainly is comforting.  I'm not saying I would have pulled the gun on these guys I'm not saying that at all But it would have leveled the playing field given that the disparity of force was so strong in that situation Not always comfortable, but it's definitely Comforting and if you don't carry I highly encourage you to think about it If you like videos like this, please subscribe and share I always appreciate thumbs up button Thanks for watching and you guys be safe