Posts

Angular (2+): Core vs Shared Modules

Angular: Core vs Shared Modules If you're new to Angular, you might get confused between these two commonly used modules. So what do you put in either components?  What goes in CoreModule? Your CoreModule contains code that will be used to instantiate your app and load some core functionality.  The clearest and most important use of the CoreModule is the place to put your global/HTTP services. The idea is to make sure only one instance of those services will be created across the entire app. The CoreModule, by convention, is only included in your entire app once in AppModule (only in the "import" property of the "@NgModule()" decorator inside your main app.module.ts, not in any other module's "import") and this will ensure services inside it will be only created once in the entire app. This is especially important if you intend to lazy-load your feature modules. Since lazy-loaded modules are loaded on demand (eg when you access the rou...

Database Design: How to Decide What Column Types to Use in MySQL Databases

This post is assuming you have already determined your database and tables structure in your MySQL design. The next step would be to specify what types of data, length of the column data, if it can be null, and possibly default values. First, what type of data will this column contain? The three primitive data structures in MySQL are text, number, and date/time. Within the text data type, the subtypes are the following: CHAR(LENGTH) - Fixed-length field from 0 to 255 characters long. VARCHAR(LENGTH) - Variable-length field from 0 to 65,535 characters long.  TINYTEXT - A string with maximum length of 255 characters.  TEXT - A string with maximum length of 65,535 characters long. MEDIUMTEXT - A string with maximum length of 16,777,215 characters long. LONGTEXT  - A string with maximum length of 4,294,967,295 characters long.  Within the number data type, the subtypes are the following: TINYINT(LENGTH) - A number value that goes from -128 to 127 or,...