Posts

Stop Visual Studio from Eating Disk Space

Image
If you you Visual Studio and NuGet, chances are that you have been affected by this issue! Navigate to \Users\{Your username}\AppData\Local\Temp\NuGetScratch and check the size of the folder. In my case, I had 40GB  of temporary files that have never been cleaned up. Now in Visual Studio, navigate to Tools > NuGet Package Manager > Package Manager Settings In the dialog box, click Clear All NuGet Cache(s). This will empty out several temporary folders, including the previously mentioned NuGetScratch which is the worst offender. Note that this operation may take some time and Visual Studio may be unresponsive while the operation completes. Thanks for reading!

Web Config Transformations

Web config transformations allow for developers to cut down on duplicated XML in configuration files by providing a way to change only the non-static values for the appropriate environment. A value that would be expected to change between environments is something like a connection string, whereas library versions would remain the same for any deployment of an application. Transformations can be tricky: often times developers do not have the required access to view the transformed version of the file on a production environment. The best way to configure your transformations is to use a site like the one below which uses the same transformation functions as the build and shows you the output. https://webconfigtransformationtester.apphb.com/ https://msdn.microsoft.com/en-us/library/dd465326(v=vs.110).aspx The second link above is to Microsoft's documentation of the possible transforms. The key takeaway from this reference is the purpose of Transform and Locator . Transform  ...

Clean up your LINQ with Load Expressions

Often times in an application, you will need data from across several tables. One approach to get all this data at once is to use the LINQ .Include() function, which will pull in all the data of the specified parent or child table. However, this can often be too heavy, as you may not need every column so you end up pulling more data from the database than is required. When this is the case, the best practice is to use a Data Transfer Object or DTO which is one flat object that combines properties from parents and children. Below, I demonstrate a simple use of a DTO, using . Include() var products = Uow.Context.Products.Include(x => x.ParentTable).Include(x => x.ChildTable).ToList(); var dtoList = new List<ProductDto>(); foreach ( var product in products) { var dto = new ProductDto{ // Copy over properties ... // Copy over parent properties ... // Copy over child properties ... }; dtoList.Add(dto); } As I mentioned before, this i...

Scheduling Tasks With Azure Scheduler

Image
In many applications it is necessary to send email notifications on a schedule. There are many ways to achieve this functionality: using a Windows service,  Windows Task Scheduler, or a number of other third party solutions. In our case, we don't have much control over our web server and so we decided against a Windows service. We ended up going with Azure Scheduler which provides a reliable way to hit a network endpoint on a user defined schedule. While not a free solution in most cases, the cost is low for the majority of small applications. Here's how to set up Azure Scheduler: Open the Azure portal and open the Scheduler Job Collections blade. This can be accessed by searching for scheduler in the top search bar in the Azure portal. Click Add in the top left corner. Name the job. The name can only have alphanumeric characters, hyphens, and underscores. Select or create a new job collection.  If creating a new job collection, select your...

Git good with Git

There will come a time in every developers life where they will have to learn how to use more than one version control software. Here are some steps to set up a Git repository. STEP 1  - Download the latest version of  Git here . STEP 2  - Open your terminal on your local machine. STEP 3  - You will need to tell Git who you are so that all your commits are labeled properly git config --global user.name "YOUR NAME HERE" And your email address: git config --global user.email "YOUR EMAIL ADDRESS HERE"   STEP 4  - Initiate your local repo: cd <directory you want to use git on> git init Finally you can clone your repo: git clone ssh://milo@example.com/path/to/my-project.git cd my-project STEP 5  - Get to work! The code won't write itself!

Software Versioning and You

It's hard to image that after developing for so long that there was a time that I didn't use any type of software versioning software. Yes, you heard me right, there was a time that I would simply edit some code and upload it to a live environment without a way to track any changes. Versioning software like Subversion allows you to keep track of changes to your code in case. Below you will find steps to set up a svn (Subversion) repository on a host machine and locally. STEP 1  -    Insure your host machine has svn install. Just log into the machine and punch in: which svn Your output should look something like this: :~$ which svn /usr/bin/svn If your some reason you don't have svn installed on your host,  here  is where you can get started. STEP 2  -  Now that you have svn installed on your host you can create a repository. Here is the command for that: svnadmin create (PATH TO YOU REPO HERE eg. /users/svnuser/myrepo) STEP 3  ...

HighCharts Tech Tip

Image
So you have a website with tons of data but don’t have a visualization solution. HighCharts is a purely JavaScript based chart solution that may be the answer to your searching. It is compatible with all modern browsers. If you need a solution for school or your non-profit organization HighCharts is free to use. It offers line, spline, area, area spline, column, bar, pie, scatter, angular gauges, area range, area spline range, column range and polar chart types. Many of which can also be combined. It allows for multiple axes, tooltip point labels, export and print, and zooming. HighChart can have data supplied statically or dynamically through ajax. The GSA Carbon Footprint tool uses the Highcharts library to visualize carbon emissions data.  The General Services Administration (GSA) developed the GSA Carbon Footprint Tool to help Federal Agencies calculate, report, and reduce their greenhouse gas (GHG) emissions as specified under Executive Order (EO) 13514.  https://www.car...