During my time in the Air Force, I always had the threat of last-minute deployment to a foreign country at a moment’s notice. This is one of the many reasons why I intentionally sought out degree programs at universities that were provided online. Some might see this as an easy way to get a degree, but anyone who has taken an online course will tell you that this is not the case. For online courses, you have to be disciplined enough to incorporate reading, studying and discussion posting into your already packed day. This is especially hard if you are working long days already and would rather crash on the couch when you get home from work!
The Node file system has an event called a ‘drain’ that is used to control a write stream for writing a large file. According to the documentation, ‘If a call to stream.write(chunk) returns false, the ‘drain’ event will be emitted when it is appropriate to resume writing data to the stream.’ This means that it only triggers when the write isn’t working and it has allowed for an appropriate amount of time so that you don’t end up with a ‘heap out of memory error’ and have to start the script again.
One of the things I’ve noticed is the planning stage of designing the schema for your database is the most important thing to do before anything else. You must understand how your data is structured or could be structured and should think about the different queries that will need to be made in order to get the information you need. If you have several different tables, you need to be clear on what items they are representing and the relationships that are between them. This includes the potential for needing a join table as well as the use of foreign keys to establish relationships.
I found that I was doing pretty good in my technical assessment until I got to the part that said not to let a duplicate be saved into the database. This turned into a search of what kind of statement can I use within my ‘create’ function that will check for the record in the table first. What I have found since then is there are a few ways to do this.
Recursion is when a function calls itself either directly or indirectly. You can solve a problem using recursion if it can be broken down into smaller problems that can be solved using the same steps. An example of this is a prompt called ‘recursion-total-sales.’ This function takes in an object of unknown size, but it could be nested with an employee being a manager of a team and then an employee in that team also being a manager. From the prompt: totalSales
accepts one argument, an object containing an employee who manages a sales team, and returns the total sales for the entire team. Note: it is possible that any employee also manages a team.