diff --git a/content/blog/Compressing-images-with-tinypng.md b/content/blog/Compressing-images-with-tinypng.md index 7ab6254..59c4fb2 100644 --- a/content/blog/Compressing-images-with-tinypng.md +++ b/content/blog/Compressing-images-with-tinypng.md @@ -17,4 +17,4 @@ So I figured out they have a cli in npm. Easy to install, just use npm to global Now you have to call the cli, this is the flags I use `tinypng . -r -k YourKeyHere`. The period tells tinypng to look in the current directory for images, `-r` tells it to look recursively, or essentially to look through child directories as well, and the `-k YourKeyHere` is the key you get by logging in. On the free plan you get 500 compressions a month. Hopefully you will fall into the pit of success like I did! -![an image showing the tiny png results](3.png) \ No newline at end of file +![an image showing the tiny png results](../img/Compressing-images-with-tinypng/3.png) diff --git a/content/blog/Wiring-up-client-side-logs-into-c-node-js-logging-frameworks.md b/content/blog/Wiring-up-client-side-logs-into-c-node-js-logging-frameworks.md index 188b12b..e69de29 100644 --- a/content/blog/Wiring-up-client-side-logs-into-c-node-js-logging-frameworks.md +++ b/content/blog/Wiring-up-client-side-logs-into-c-node-js-logging-frameworks.md @@ -1,101 +0,0 @@ ---- -title: 'Wiring up client side logs into c#/node.js logging frameworks' -tags: - - - csharp - - logging - - library -permalink: /wiring-up-client-side-logs-into-c-sharp-logging-frameworks/ -id: 60 -updated: '2015-11-01 08:53:04' -date: 2015-11-01T13:22:07.000Z ---- - -Around a year ago I joined a new team where I work, and this team was starting to undertake a full rewrite of their code. We were going from a full c#/mvc app to a tiny c# api, and a very big SPA. - -Early one one of the **huge** things to do was to make sure that our JavaScript error logs could land in our Log4Net infrastructure. I started to write something to do just that, and as I was coding I quickly realized this was less trivial that it sounded. We had something internal we could use, but it was tied to a lot of other code that we didn't want to pull in. - -I started Bingling around and I stumbled across [jsnlog](http://jsnlog.com/). JSN log lets you quickly wire up your client side logs to your server. I have been able to get PR's into the [code base](https://github.com/mperdeck/jsnlog) and the guy behind it has been very friendly to me when I have had questions. - -When you install the nuget package it drops this into your app_start. - -```csharp - -using System; -using System.Web.Routing; -using System.Web.Mvc; - -[assembly: WebActivatorEx.PostApplicationStartMethod( - typeof(EmptyLog4Net.App_Start.JSNLogConfig), "PostStart")] - -namespace EmptyLog4Net.App_Start { - public static class JSNLogConfig { - public static void PostStart() { - // Insert a route that ignores the jsnlog.logger route. That way, - // requests for jsnlog.logger will get through to the handler defined - // in web.config. - // - // The route must take this particular form, including the constraint, - // otherwise ActionLink will be confused by this route and generate the wrong URLs. - - var jsnlogRoute = new Route("{*jsnloglogger}", new StopRoutingHandler()); - jsnlogRoute.Constraints = new RouteValueDictionary {{ "jsnloglogger", @"jsnlog\.logger(/.*)?" }}; - RouteTable.Routes.Insert(0, jsnlogRoute); - } - } -} -``` - -The whole thing is a html handler, so this code just simply makes sure the handler gets the first route. - -When you are going to render a page you have to inject this razor: - -`@Html.Raw(JSNLog.JavascriptLogging.Configure())` and the jsnlog javascript file. - -Then whenever you want to log anything client side you can do the following. - -```javascript -JL("jsLogger").fatal("client log message"); -``` - -You can also set jsnlog as the global js error handler. - -```javascript -window.onerror = function (errorMsg, url, lineNumber, column, errorObj) { - // Send object with all data to server side log, using severity fatal, - // from logger "onerrorLogger" - JL("onerrorLogger").fatalException({ - "msg": "Exception!", - "errorMsg": errorMsg, "url": url, - "line number": lineNumber, "column": column - }, errorObj); - - // Tell browser to run its own error handler as well - return false; -} - -``` - -The docs are quite good, and it seems to work fine as a commonjs module (since we browserify things). The tool is super configurable through the web.config, and you can change the url it logs to. - - -```xml - - - ... - - - - - - - - - - -``` - - -JSNLog is a great way to get your client side logs into your server infrastructure fast. The library has fantastic support for node, and every major [.NET logging framework](https://www.nuget.org/packages?q=jsnlog). Someone in the community even made a php plugin! The [examples](https://github.com/mperdeck/jsnlogSimpleWorkingDemos) are endless - -Overall I am really pleased with JSNLog, it filled a need that I needed, and it meant I was able to focus on what I did best, not figure out how logging worked. diff --git a/content/blog/cli.gif b/content/blog/cli.gif new file mode 100644 index 0000000..da132f6 Binary files /dev/null and b/content/blog/cli.gif differ diff --git a/content/blog/dockerize-that-old-webforms-app.md b/content/blog/dockerize-that-old-webforms-app.md index c3c518f..fceff9f 100644 --- a/content/blog/dockerize-that-old-webforms-app.md +++ b/content/blog/dockerize-that-old-webforms-app.md @@ -8,7 +8,7 @@ tags: So now that Windows server 2016 is [generally avalible](https://blogs.technet.microsoft.com/hybridcloud/2016/10/12/another-big-step-in-hybrid-cloud-windows-server-2016-general-availability/) for the first time ever windows users can now use containers. Ok, so what exactly are containers? Well more or less they are virtual operating systems that **share** the same kernel as the host OS. In regular VM's the hardware is shared between machines, but containers go a step further and share the kernel of the OS. Why does this matter? Well because you are sharing an existing kernel that is already running, your startup times are instantanious. To put this in perspective, this is virtualization at the OS level. -On Linux, containers have been a thing for a long time. This technology is called LXC. Docker itself is a layer ontop of various container platforms embedded in operating systems. +On Linux, containers have been a thing for a long time. This technology is called LXC. Docker itself is a layer ontop of various container platforms embedded in operating systems. @@ -58,6 +58,6 @@ Even legacy applications can be improved with some kind of build automation. Sta In my sample I created a gulp file that takes in a version number (which could be passed by our CI system). Patches the AssemblyInfo.cs files, restores nuget packages, and compiles down a docker image to be used later. All with the simple command of `gulp build --version 1.0.0` -The created docker image could easily be uploaded to some kind of storage. +The created docker image could easily be uploaded to some kind of storage. diff --git a/content/img/5-web-performance-tips-for-2019/.keep b/content/img/5-web-performance-tips-for-2019/.keep deleted file mode 100644 index e69de29..0000000 diff --git a/content/img/Accessibility-Driven-Development/.keep b/content/img/Accessibility-Driven-Development/.keep deleted file mode 100644 index e69de29..0000000 diff --git a/content/img/Announcing-gulp-nuget-restore/.keep b/content/img/Announcing-gulp-nuget-restore/.keep deleted file mode 100644 index e69de29..0000000 diff --git a/content/img/Bringin-turbolinks-to-net/.keep b/content/img/Bringin-turbolinks-to-net/.keep deleted file mode 100644 index e69de29..0000000 diff --git a/content/img/Bringing-configuration-management-to-the-underconfigured/.keep b/content/img/Bringing-configuration-management-to-the-underconfigured/.keep deleted file mode 100644 index e69de29..0000000 diff --git a/content/img/Building-a-remote-cache-server-for-Turborepo.md/.keep b/content/img/Building-a-remote-cache-server-for-Turborepo.md/.keep deleted file mode 100644 index e69de29..0000000 diff --git a/content/img/Building-attractive-CLIs-in-JavaScript/.keep b/content/img/Building-attractive-CLIs-in-JavaScript/.keep deleted file mode 100644 index e69de29..0000000 diff --git a/content/img/Commiting-a-new-file-to-github-through-the-github-api/.keep b/content/img/Commiting-a-new-file-to-github-through-the-github-api/.keep deleted file mode 100644 index e69de29..0000000 diff --git a/content/img/Dynamically-changing-the-site-theme-meta-tag/.keep b/content/img/Dynamically-changing-the-site-theme-meta-tag/.keep deleted file mode 100644 index e69de29..0000000 diff --git a/content/img/Fixing-your-build-after-updating-all-nuget-packages/.keep b/content/img/Fixing-your-build-after-updating-all-nuget-packages/.keep deleted file mode 100644 index e69de29..0000000 diff --git a/content/img/Hosting-craft-on-heroku/.keep b/content/img/Hosting-craft-on-heroku/.keep deleted file mode 100644 index e69de29..0000000 diff --git a/content/img/Hosting-your-blog-on-the-cheap/.keep b/content/img/Hosting-your-blog-on-the-cheap/.keep deleted file mode 100644 index e69de29..0000000 diff --git a/content/img/Hosting-your-webapp-on-the-cheap/.keep b/content/img/Hosting-your-webapp-on-the-cheap/.keep deleted file mode 100644 index e69de29..0000000 diff --git a/content/img/How-to-host-a-javascript-monorepo-on-heroku.md/.keep b/content/img/How-to-host-a-javascript-monorepo-on-heroku.md/.keep deleted file mode 100644 index e69de29..0000000 diff --git a/content/img/Just-got-a-Nexus-5x/.keep b/content/img/Just-got-a-Nexus-5x/.keep deleted file mode 100644 index e69de29..0000000 diff --git a/content/img/Parsing-cli-arguments-in-dotnet-core-Console-App/.keep b/content/img/Parsing-cli-arguments-in-dotnet-core-Console-App/.keep deleted file mode 100644 index e69de29..0000000 diff --git a/content/img/Precompiling-razor-views-in-dotnet-core/.keep b/content/img/Precompiling-razor-views-in-dotnet-core/.keep deleted file mode 100644 index e69de29..0000000 diff --git a/content/img/Securing-your-dotnet-core-apps-with-hardhat/.keep b/content/img/Securing-your-dotnet-core-apps-with-hardhat/.keep deleted file mode 100644 index e69de29..0000000 diff --git a/content/img/Serving-AMP-Pages-with-dotnet-core/.keep b/content/img/Serving-AMP-Pages-with-dotnet-core/.keep deleted file mode 100644 index e69de29..0000000 diff --git a/content/img/Speeding-up-CraftCMS-on-Heroku/.keep b/content/img/Speeding-up-CraftCMS-on-Heroku/.keep deleted file mode 100644 index e69de29..0000000 diff --git a/content/img/VS-17-and-dotnet-core-tools-Today-will-be-a-historic-day/.keep b/content/img/VS-17-and-dotnet-core-tools-Today-will-be-a-historic-day/.keep deleted file mode 100644 index e69de29..0000000 diff --git a/content/img/about/.keep b/content/img/about/.keep deleted file mode 100644 index e69de29..0000000 diff --git a/content/img/dockerize-that-old-webforms-app/.keep b/content/img/dockerize-that-old-webforms-app/.keep deleted file mode 100644 index e69de29..0000000 diff --git a/content/img/making-a-minimal-webapp-with-dotnet-core/.keep b/content/img/making-a-minimal-webapp-with-dotnet-core/.keep deleted file mode 100644 index e69de29..0000000 diff --git a/content/img/use-dotnet-rc2-with-appveyor/.keep b/content/img/use-dotnet-rc2-with-appveyor/.keep deleted file mode 100644 index e69de29..0000000 diff --git a/eleventy.config.js b/eleventy.config.js index 45ff26a..3f70b25 100644 --- a/eleventy.config.js +++ b/eleventy.config.js @@ -108,6 +108,10 @@ module.exports = function(eleventyConfig) { "njk", "html", "liquid", + "jpg", + "jpeg", + "gif", + "webp" ], // Pre-process *.md files with: (default: `liquid`) diff --git a/fix-dates.js b/fix-dates.js new file mode 100644 index 0000000..0006707 --- /dev/null +++ b/fix-dates.js @@ -0,0 +1,18 @@ +const fs = require('fs/promises'); + + +async function run() { + const files = await fs.readdir('./content/blog'); + console.log(files); + + await Promise.all(files + .filter(file => file.endsWith('.md')) + .map(async (file) => { + // const fileContent = await fs.readFile(file, 'utf8'); + // regex find the line date: + // const date = fileContent.match(/date: (.*)/); + // const parsedDate = date[1].split(' '); + })); +} + +run();