Programming

Enabling HTTPS Rewrites

When setting up a website, even if it’s just a generic blog like this one, it’s good to encrypt traffic to and from it using SSL. Obtaining certificates If you’re hosting a site on it’s own custom domain name rather than using a free hosting provider then you’ll likely need Read more…

By Shinigami, ago
Programming

jQuery Date Picker

Although there’s a date picker present in HTML5 this won’t always work in older browsers and doesn’t look that great anyway so it’s generally better to do this via jQuery. First off add the following script tags to the head section of your page. <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6/jquery.min.js" type="text/javascript"></script> <script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js" type="text/javascript"></script> Read more…

By Shinigami, ago
Programming

SQL Stored Procedure In .NET

I generally end up forgetting how to return results from a SQL stored procedure within .NET so I figured I’d put it here for reference. public static List<Blog> GetBlogSummaries() { List<Blog> blogs = new List<Blog>(); using (SqlConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings["BlogDatabase"].ConnectionString)) { using (SqlCommand command = new SqlCommand("sp__get_blog_summaries")) { command.CommandType Read more…

By Shinigami, ago
Programming

ASP.NET Core Connection Strings Class

There’s various different ways to access values from appsettings.json in ASP.NET Core, one way to do this is create a corresponding settings class and map the values to it. First off, add a connection stings section to your appsettings.json file like so (where {ConnectionString} obviously equals your connection string). "ConnectionStrings": Read more…

By Shinigami, ago
Programming

API .Net Core XML Ingestion

What I need to do here is to create an API that can authenticate and ingest an XML POST request, saving the provided data into a SQL database and returning a relevant HTML status code. Unfortunately this wasn’t quite as easy as I’d anticipated as the XML data will be Read more…

By Shinigami, ago
Programming

Basic HTML Code Snippets

This is essentially just based on Google prettify which can be found here. Just stick the following code in the head of the page to load the javascript. <script src="https://cdn.rawgit.com/google/code-prettify/master/loader/run_prettify.js"></script> And then put the code you’d like to prettify in the following tags. <pre class="prettyprint lang-html"></pre> If using this for Read more…

By Shinigami, ago