Automatically Including Complex Properties with EntityFramework

Recently I found it necessary to generalize code related to “including” complex properties when using the Entity Framework and lazy loading. For anyone that has done composition with the Entity Framework, especially in aspnetcore, knows how much of a pain it can be to get data out and into JSON. This is how I tackled the problem. The first step is to create an attribute that we can use on properties to signify that they should be included when pulling data from the database. I have called this . Personally…

Adding a New User to MySQL

Whenever you boot up a service like MySQL which has a root user, it's best practice to create users for your specific needs that are limited by security and scope. In the case of running a WordPress or similar MySQL based application, it's best to limit the user to a specific database. We begin by loading the MySQL CLI. We then create the new user. If you haven't created the database yet, now would be an excellent time. Note that we want to limit the user's scope to just such that even if we were to…

Dynamically Bound Inputs with Angular (1.6)

As I continue to learn angular, I have found myself moving towards more abstract/dynamic programming with javascript. That is, relying on a languages features to alter the functionality of piece of code through data. Recently I’ve discovered the need for dynamically bound inputs – or input fields that bind to a scope during runtime and are unknown at “compile” time. The following provides a basic approach towards that end. First, some basic data testing. Our will contain a model for us to bind to, and we…

Enable URL Rewriting on Apache

After installing apache, you can enable mod_rewrite by running the following commands. You will probably want to use the file to configure your mod_rewrite. In this case, you should make sure to allow overrides by modifying your site’s configuration file. If you haven’t already, I suggest creating/copying the default config in . To enable the file, add the following. You may want to change a few of the settings to fit your specific needs, the key here is the line, which allows the file to be used…

Effective Nightly Backups with cron

Cron is a way of scheduling tasks on linux based machines; most often used to run nightly, weekly or monthly batch processes to move data or restart services. Crontab is the tool on ubuntu to interact with the cron daemon and really simplifies the process. To start, we need to start editing our crontab file. If this is your first time using crontab, it should prompt you that it’s creating a new file and ask you for an editor. I typically use nano on Ubuntu and vi/vim on other distros. To do this, run the…

©2018 John Sedlak. All Rights Reserved.