If making cheesy movie title spoofs involving web development, paid money, I would have a steady flow of income. If you had told me a year ago that I would be running a blog with quite a few entries, mostly dealing with technology I would have laughed. It isn't that I have never thought about doing a blog, but rather I could never get it started. As far as maintaining it and coming up with new things to write about where I’m not just rambling filling up space with random words, is a skill that deserves an award equivalent to a Grammy. I am really proud of the blog post that I have made, and I hope that those of you that read these have enjoyed them and will continue to read them after I am done with my schooling and transfer my blog into the professional world!
A callback is simply a function that will take a little bit of time to return a result. They are asynchronous and are used for accessing values from databases. Whenever you start getting into really complex coding and have many nested callback functions you start chartering over into “callback hell” territory. The structure ends up looking pyramid like and becomes difficult to read. If there is an error in one function then, all the other functions that are nested will be affected as well. The “callback hell” can be avoided by using event queue and promises. A promise is a returned object from any asynchronous function, to which callback methods can be added based on the previous functions result.
When speaking of Stubs in Node.js, we can explain them by stating that they are dummy objects that are used for testing. Stubs affect the behavior of components or modules.
If you have not gotten the idea of this blog, it is all about Node. In this paragraph we will be covering chaining. Chaining can be achieved through by using the async npm module. The two most commonly used methods for chaining functions are parallel. These include callbacks and tasks. If any of the functions return an error than the callback function will be fired off. Another way would be by series, which would also call a callback function. the main difference is that the callback would be accessed after the task is finished rather than when the function returns an error!
When on the computer and I hear the word “console” I immediately think of the command line for some reason. I think of something that can be used to control everything else. When talking about Node, console refers to a global object that is used to print different levels of messages to stdout and stderr. There are many ways to print information that include warnings, error messages, and informational messages. There are many methods that can be used to access this information, however due to the high number of methods it would make more sense for you the reader, to look them up individually.
What if you are running a program on node and wish to exit the application? I am here to tell you that there is a way to achieve this. There are things called exit codes that can be used to kill/exit the program. An example of some of these include process.exit(), process.kill().
A clustered index is a type of index which sorts the data rows in the table on their key values. A clustered index defines the order in which data is sorted in the table which can be sorted in only one way. There can only be one clustered index per database. A non-clustered index stores the data at one location and indices at another location. The index contains pointers to the location of that data. A single table can have many non-clustered indexes as an index in the non-clustered index is stored in different places.
There are four types of user-defined functions. There is one that doesn't have arguments and doesn't return a value. There is one that has no arguments but does have a return value. There is another that has an argument but doesnt return value. The last is one that has both an argument and a return value.