<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Carl Berg</title><link>https://carl-berg.se/</link><description>Recent content on Carl Berg</description><generator>Hugo -- gohugo.io</generator><language>en-us</language><lastBuildDate>Sun, 16 Feb 2020 00:00:00 +0000</lastBuildDate><atom:link href="https://carl-berg.se/index.xml" rel="self" type="application/rss+xml"/><item><title>Setting up hugo on Ubuntu</title><link>https://carl-berg.se/post/setting-up-hugo-on-ubuntu/</link><pubDate>Sun, 16 Feb 2020 00:00:00 +0000</pubDate><guid>https://carl-berg.se/post/setting-up-hugo-on-ubuntu/</guid><description>I just repaved my home computer and though I would write up instructions for myself on how to setup hugo (which i use to publish this blog) on WSL2.
I first investigated apt-get for Ubuntu, but the version there seems old (0.40.1)&amp;hellip;
I want a specific version (0.56.2) which is the one i use at netlify, which i use for publishing and hosting.
Insteady i opt to install via deb package, so i go to check out the hugo github releases for my specific version.</description></item><item><title>git with ssh on Windows 10</title><link>https://carl-berg.se/post/ssh-git-and-windows-10/</link><pubDate>Sun, 16 Feb 2020 00:00:00 +0000</pubDate><guid>https://carl-berg.se/post/ssh-git-and-windows-10/</guid><description>I just repaved my home computer and though lost my old bitbucket ssh setup. Luckily Windows 10 now has a built in ssh agent so this is what i did:
&amp;gt; cd ~\.ssh ssh-keygen -t rsa -C &amp;#34;carl@carl-berg.se&amp;#34; Create a new file ~\.ssh\config:
Host bitbucket.org IdentityFile ~/.ssh/bitbucket &amp;hellip; so that bitbucket knows which ssh key to use.
And we&amp;rsquo;re ready to connect!
git clone git@bitbucket.org:my_user_name/my_repo.git
Resources SSH config</description></item><item><title>Kicking the tires of Micronetes</title><link>https://carl-berg.se/post/kicking-the-tires-of-micronetes/</link><pubDate>Thu, 06 Feb 2020 00:00:00 +0000</pubDate><guid>https://carl-berg.se/post/kicking-the-tires-of-micronetes/</guid><description>Why Micronetes (m8s)? My reason for trying micronetes is trying to resolve some of the friction caused by testing out features that span multiple services. You might start something off in the UI which might cause actions to ripple through several services and it can get tedious to startup everything you need to test the whole flow. Docker might be a bit cumbersome, especially when you have dotnet framework services you want to run.</description></item><item><title>Open Visual Studio solutions below current folder</title><link>https://carl-berg.se/post/open-solution/</link><pubDate>Fri, 20 Dec 2019 00:00:00 +0000</pubDate><guid>https://carl-berg.se/post/open-solution/</guid><description>A few years ago in a previous post i displayed a little function that can open a solution below the current folder. The obvious problem is if you have more than one solution below you current folder, then only the first solution file found was opened. So here&amp;rsquo;s a revamped version that will open a solution if only one is found, otherwise you will be prompted for which one you want to open.</description></item><item><title>Windows Terminal and Powershell configuration</title><link>https://carl-berg.se/post/ms-terminal-settings/</link><pubDate>Mon, 26 Aug 2019 00:00:00 +0000</pubDate><guid>https://carl-berg.se/post/ms-terminal-settings/</guid><description>A have been using the new Windows Terminal since it came out in Microsoft Store as a preview. I have also been tweaking a few things to get it working the way i like it.
Before installing Windows Terminal In order to get the terminal to pick up existing shells, first install Powershell Core and Windows Subsystem for Linux (WSL). If you do this before installing the terminal, old powershell will be replaced by the newer core version and WSL will also be picked up automatically.</description></item><item><title>Version 2.3 of Appeaser</title><link>https://carl-berg.se/post/appeaser-2-3/</link><pubDate>Thu, 01 Aug 2019 00:00:00 +0000</pubDate><guid>https://carl-berg.se/post/appeaser-2-3/</guid><description>I have recently done a little maintenance update in Appeaser where i&amp;rsquo;ve added netstandard 2.0 compatibility for Appeaser and added support for IOptions&amp;lt;MediatorSettings&amp;gt; in Appeaser.Microsoft.DependencyInjection making use of the &amp;ldquo;options pattern&amp;rdquo;.
The latter of these updates enables you to configure mediator settings like this:
var serviceProvider = new ServiceCollection() .Configure&amp;lt;MediatorSettings&amp;gt;(o =&amp;gt; o.AddRequestInterceptor&amp;lt;MyInterceptor&amp;gt;()) .Configure&amp;lt;MediatorSettings&amp;gt;(o =&amp;gt; o.AddRequestInterceptor&amp;lt;MyOtherInterceptor&amp;gt;()) .AddAppeaser() .BuildServiceProvider(); &amp;hellip;the benefit which might not be completely obvious compared to:
var serviceProvider = new ServiceCollection() .</description></item><item><title>About me</title><link>https://carl-berg.se/about/</link><pubDate>Tue, 30 Jul 2019 00:00:00 +0000</pubDate><guid>https://carl-berg.se/about/</guid><description>I have worked as a systems developer since 2007 in different projects and with customers from a wide array of sectors. My role varies from project to project but includes Project manager, Architect, Team lead, Developer, Tester and Mentor.
I work with backend development in the .net stack, nowadays paired with quite a bit of javascript. Previously knockout.js and angular.js, more recently with react.js. The projects are mostly web related and usually sprinkled with a few system integrations here and there.</description></item><item><title>Version 2.1 of Appeaser</title><link>https://carl-berg.se/post/appeaser-2-1/</link><pubDate>Fri, 24 Aug 2018 00:00:00 +0000</pubDate><guid>https://carl-berg.se/post/appeaser-2-1/</guid><description>I&amp;rsquo;ve finally had a little time over to implement some stuff in Appeaser that i&amp;rsquo;ve had in my mind for a while. The new version shouldn&amp;rsquo;t introduce any breaking changes but adds some simplifications like the IRequest interface that is implemented by both queries and commands. This also enables use of a simplified mediator (ISimpleMediator) that some might prefer that just contains a Request method and can be used like this:</description></item><item><title>New version of Appeaser</title><link>https://carl-berg.se/post/appeaser-20/</link><pubDate>Sat, 20 Jan 2018 00:00:00 +0000</pubDate><guid>https://carl-berg.se/post/appeaser-20/</guid><description> To keep up with the times i just released a new version of Appeaser supporting .net core (netstandard 1.0). No breaking changes but i did add a setting to toggle wrapping of exceptions that occur in handlers. Feel free to take it for a spin! Enjoy it (or be appeased) 😄
Resources Appeaser on github Appeaser on nuget</description></item><item><title>When did i boot my computer?</title><link>https://carl-berg.se/post/find-boot-time/</link><pubDate>Mon, 29 Feb 2016 00:00:00 +0000</pubDate><guid>https://carl-berg.se/post/find-boot-time/</guid><description>I use a time logger at work, but alot of times i forget what time i started, so to get the computer boot time, i have created a little powershell function i have added to my profile:
function boottime { $bootTime = (Get-WmiObject Win32_OperatingSystem).LastBootUpTime [System.Management.ManagementDateTimeConverter]::ToDateTime($bootTime) }</description></item><item><title>Self Hosted Owin WebApi with Structuremap DependencyResolver gotcha</title><link>https://carl-berg.se/post/owin-hosted-webapi-with-structuremap-gotcha/</link><pubDate>Wed, 17 Jun 2015 00:00:00 +0000</pubDate><guid>https://carl-berg.se/post/owin-hosted-webapi-with-structuremap-gotcha/</guid><description>After a lot of debugging I have just solved an issue with an integration test running against an owin selfhosted Web Api. The problem i was experiencing was that the code throwing a StackOverflowException when the selfhosted process was disposed:
[Binding] public class GlobalSetupTearDown { private static IDisposable _webApp; [BeforeTestRun] public static void Setup() { _webApp = WebApp.Start&amp;lt;StartupSpecs&amp;gt;(Settings.TestPath); } [AfterTestRun] public static void TearDown() { _webApp.Dispose(); // &amp;lt;-- Throws a StackOverflowException } } The issue I was experiencing was related to using WebApiContrib.</description></item><item><title>NHibernate One to One mapping</title><link>https://carl-berg.se/post/fluent-nhibernate-one-to-one-mapping/</link><pubDate>Mon, 27 Apr 2015 00:00:00 +0000</pubDate><guid>https://carl-berg.se/post/fluent-nhibernate-one-to-one-mapping/</guid><description>A working One to One mapping in NHibernate (using FluentNHibernate for this example):
public class NotificationMap : ClassMap&amp;lt;Notification&amp;gt; { public NotificationMap() { Id(x =&amp;gt; x.Id); HasOne(x =&amp;gt; x.Trigger).PropertyRef(x =&amp;gt; x.Notification).Cascade.All(); } } CREATE TABLE [dbo].[Notification]( [Id] [uniqueidentifier] NOT NULL ) public class NotificationTriggerMap : ClassMap&amp;lt;NotificationTrigger&amp;gt; { public NotificationTriggerMap() { Id(x =&amp;gt; x.Id); References(x =&amp;gt; x.Notification).Not.Nullable(); } } CREATE TABLE [dbo].[NotificationTrigger]( [Id] [uniqueidentifier] NOT NULL, [NotificationId] [uniqueidentifier] NOT NULL ) ALTER TABLE [dbo].</description></item><item><title>Open visual studio from powershell</title><link>https://carl-berg.se/post/open-visual-studio-from-powershell/</link><pubDate>Sun, 11 Jan 2015 00:00:00 +0000</pubDate><guid>https://carl-berg.se/post/open-visual-studio-from-powershell/</guid><description>If you are like me, you spend some time working with your source control from the command line (powershell in my case). Often after i have navigated to a folder and synced in changes i want to open the solution contained somewhere below the folder i am currently in.
This function will open up the first available solution file under your current directory in visual studio
function sln { $file = Get-ChildItem -recurse *.</description></item><item><title>Get ready to be Appeased</title><link>https://carl-berg.se/post/releaseing-appeaser-into-the-wild/</link><pubDate>Sun, 27 Apr 2014 00:00:00 +0000</pubDate><guid>https://carl-berg.se/post/releaseing-appeaser-into-the-wild/</guid><description>Last week I made my first open source release, a mediator implementation in C# called Appeaser. I got insipred by a series of blog posts by Jimmy Bogard about putting your controllers on a diet, which is pretty much in tune with previous attempts I have made of removing repositories in favour of a command/query based pattern. I then ended up by putting my command and query execution logic in the controllers which never felt quite clean and required me to copy paste abstract base controller logic from project to project.</description></item><item><title>Getting an AD group SID</title><link>https://carl-berg.se/post/ad-group-sid/</link><pubDate>Wed, 19 Mar 2014 00:00:00 +0000</pubDate><guid>https://carl-berg.se/post/ad-group-sid/</guid><description>Getting a SID for an AD-group is perhaps a little harder than it should be. You can see it in the UI, but you can&amp;rsquo;t copy it only view it as hex, binary, decimal or ocatal which is pretty useless.
So as usual, powershell saves the day. Here&amp;rsquo;s what to do:
On the AD-server, Import the ActiveDirectory module in powershell (if not already installed):
Import-Module ActiveDirectory Once that is done you can list groups like this:</description></item><item><title>Config transforms</title><link>https://carl-berg.se/post/config-transformations/</link><pubDate>Tue, 11 Mar 2014 00:00:00 +0000</pubDate><guid>https://carl-berg.se/post/config-transformations/</guid><description>Today i have merged a branch with the same exact change in 5 config transforms. This could have been avoided if the proper transform approach had been used. Here&amp;rsquo;s an example of how you can cleanup a sloppy config transform:
Before cleanup:
&amp;lt;?xml version=&amp;#34;1.0&amp;#34; encoding=&amp;#34;utf-8&amp;#34;?&amp;gt; &amp;lt;configuration xmlns:xdt=&amp;#34;http://schemas.microsoft.com/XML-Document-Transform&amp;#34;&amp;gt; &amp;lt;log4net xdt:Transform=&amp;#34;Replace&amp;#34;&amp;gt; &amp;lt;appender name=&amp;#34;Console&amp;#34; type=&amp;#34;log4net.Appender.ConsoleAppender&amp;#34;&amp;gt; &amp;lt;layout type=&amp;#34;log4net.Layout.PatternLayout&amp;#34;&amp;gt; &amp;lt;param name=&amp;#34;ConversionPattern&amp;#34; value=&amp;#34;%d %-5p %c{1}:%L - %m%n&amp;#34; /&amp;gt; &amp;lt;/layout&amp;gt; &amp;lt;/appender&amp;gt; &amp;lt;appender name=&amp;#34;LogFileAppender&amp;#34; type=&amp;#34;log4net.Appender.RollingFileAppender&amp;#34;&amp;gt; &amp;lt;param name=&amp;#34;File&amp;#34; value=&amp;#34;C:\some\other\path\Default.</description></item><item><title>SemVer in practice</title><link>https://carl-berg.se/post/semver-in-practice/</link><pubDate>Tue, 14 Jan 2014 00:00:00 +0000</pubDate><guid>https://carl-berg.se/post/semver-in-practice/</guid><description>I have been using semantic versioning when developing and releasing new versions of software for a while now.
Recently our team took a step towards using release candidates (during the stabilization before a live release) in order to determine which version is currently out in the test environment for testing and QA, and to allow testers to tag issues found with the actual version where the bug/issue was found.</description></item><item><title>Using custom types in config sections by specifying a TypeConverter</title><link>https://carl-berg.se/post/custom-config-types-with-type-converter/</link><pubDate>Fri, 20 Dec 2013 00:00:00 +0000</pubDate><guid>https://carl-berg.se/post/custom-config-types-with-type-converter/</guid><description>I just found something neat that i decided to to a quick writeup about.
I have gone through a few phases of handling configuration files for applications. At first it seemed quite complicated so i just dumped everything in appSettings as key value pairs and then parsed the strings into whatever i needed. Lateley i have started using ConfigurationSections and ConfigurationElements more to build a structured configuration. That is alot nicer to look at when trying to find parameters, and you can also group properties togeather that belong to the same context.</description></item><item><title>Hgflow - Git flow tooling for mercurial</title><link>https://carl-berg.se/post/hgflow-git-flow-for-hg/</link><pubDate>Thu, 21 Nov 2013 00:00:00 +0000</pubDate><guid>https://carl-berg.se/post/hgflow-git-flow-for-hg/</guid><description>Yesterday I went to see an former colleague, Kristoffer Ahl, holding a talk about git flow. The talk was very interesting since I have been using the git flow structure with mercurial for about a year. One thing that was really neat was the gitflow tooling. I had no idea that there was a nice toolkit for helping maintain the gitflow structure. Of course i had to see if there was something similar for mercurial, and of course there is.</description></item><item><title>ASP.NET Bundling Gotcha</title><link>https://carl-berg.se/post/asp-net-bundling-gocha/</link><pubDate>Mon, 21 Oct 2013 00:00:00 +0000</pubDate><guid>https://carl-berg.se/post/asp-net-bundling-gocha/</guid><description>I recently spent quite a bit of time trying to figure out why the IIS wasn&amp;rsquo;t serving woff, ttf or svg files. I would simply get a 404 error.
The reason for this is that this site (and not the other site where it all works), is running with compilation debug flag set to false, which means that instead of using all the individual files in the style bundle, it&amp;rsquo;s all packaged up and served from the path that i have given to the bundle.</description></item><item><title>Mercurial favoured merge</title><link>https://carl-berg.se/post/hg-favoured-merge/</link><pubDate>Thu, 17 Oct 2013 00:00:00 +0000</pubDate><guid>https://carl-berg.se/post/hg-favoured-merge/</guid><description>Sometimes you make a merge, and you know that one of the branches is &amp;ldquo;the right one&amp;rdquo;, but still you have to specify how to merge each merge conflict. This is a handy way of specifying which branch should be used when conflicts arise:
hg merge --tool internal:other hg merge --tool internal:local With other, the branch you are merging from is favoured, with local, the branch you are currently in is favoured.</description></item><item><title>Cruelty to code</title><link>https://carl-berg.se/post/cruelty-to-code-part-1/</link><pubDate>Mon, 10 Jun 2013 00:00:00 +0000</pubDate><guid>https://carl-berg.se/post/cruelty-to-code-part-1/</guid><description>When digging through old code its only a matter of time before you find something nasty. Today i found this gem:
provider.UpdateOrderStatus(newStatusId, order.Id, 0, 0, 0, 0, 0); First of all the provider is basically a repository that contains access to everything in the database. Secondly, who knows what the zeros mean. Could i use -1? no way to know without digging all the way down and checking.
If you create a method like this.</description></item><item><title>Move from subversion to mercurial</title><link>https://carl-berg.se/post/subversion-to-mercurial/</link><pubDate>Wed, 08 May 2013 00:00:00 +0000</pubDate><guid>https://carl-berg.se/post/subversion-to-mercurial/</guid><description>I just revisited an older project and did frankly not look forward to working with subversion again. Especially after just finishing a 4 month project where we have been working in mercurial, taking advantage of all the nice things a DVCS can give you. So i decided to try and move the repository to mercurial to enable a more modern development approach for myself and others working on this project.</description></item><item><title>Cherry picking in mercurial</title><link>https://carl-berg.se/post/cherry-picking-in-mercurial/</link><pubDate>Thu, 28 Mar 2013 00:00:00 +0000</pubDate><guid>https://carl-berg.se/post/cherry-picking-in-mercurial/</guid><description>Quick side note today. I recently had managed to check a bunch of changes into the development branch that were ment to go in a release branch. If i could merge the develop into the release branch, that would have been an easy fix, but in this case new development is going on in that branch that cannot be put into the release branch.
Mercurial graft to the rescue.</description></item><item><title>Using git with a subversion repository</title><link>https://carl-berg.se/post/using-git-with-an-svn-repository/</link><pubDate>Thu, 04 Oct 2012 00:00:00 +0000</pubDate><guid>https://carl-berg.se/post/using-git-with-an-svn-repository/</guid><description>I have been working with a few different source control systems over the years. To start with we used Visual Source Safe 2005, which I found to be clunky but it worked (apart from the usual walks around the office asking people to check in the file you need). We later on switched to Subversion and this was when i felt like using a source control system was actually something that could help me in my work, not just be a vault with backup for all the source code.</description></item><item><title>ILMerge</title><link>https://carl-berg.se/post/trying-out-ilmerge/</link><pubDate>Tue, 18 Sep 2012 00:00:00 +0000</pubDate><guid>https://carl-berg.se/post/trying-out-ilmerge/</guid><description>I recently tried out ILMerge in order to merge a few assemblies into a single executable console application.
ILMerge.exe /out:MergedApp.exe App.exe AnAssembly.dll AnotherAssembly.dll This makes it easier to deploy an application as a stand alone file. I don&amp;rsquo;t think i would bother using this for a web application, but it&amp;rsquo;s pretty handy for a forms application or a console application.
I would recommend getting ILMerge through nuget, but it can also be downloaded through chocolately or as an msi file.</description></item><item><title>Query columns in a database</title><link>https://carl-berg.se/post/query-columns-in-database/</link><pubDate>Tue, 11 Sep 2012 00:00:00 +0000</pubDate><guid>https://carl-berg.se/post/query-columns-in-database/</guid><description>I just found this trick for finding all columns of a specific type in a database. Nothing for every day use, but when you need it, this is pretty powerful.
SELECT OBJECT_NAME(SYS.COLUMNS.OBJECT_ID) AS TableName ,SYS.COLUMNS.NAME AS ColumnName FROM SYS.COLUMNS JOIN SYS.TYPES ON SYS.COLUMNS.USER_TYPE_ID = SYS.TYPES.USER_TYPE_ID WHERE SYS.TYPES.NAME = &amp;#39;Ntext&amp;#39; ORDER BY SYS.COLUMNS.OBJECT_ID This example fetches all columns of type NTEXT in the database.
Update: The above version does not seem to work on SQL Server 2000, however the below version seems to work on SQL Server 2000 and upwards.</description></item><item><title>Fighting Ransomware</title><link>https://carl-berg.se/post/fighting-ransomware/</link><pubDate>Wed, 08 Aug 2012 00:00:00 +0000</pubDate><guid>https://carl-berg.se/post/fighting-ransomware/</guid><description>A couple of days ago I was summoned as &amp;ldquo;the computer guy&amp;rdquo; to look at a potential virus problem. It seemed that when logging on to the computer, a big message showed up claiming the police has blocked the computer. It also showed the computer&amp;rsquo;s ip and isp (all of which can easily be picked up by any program running on the computer). The message above says Detta operativsystem är blockerad på grund av brott mot svensk lag.</description></item><item><title>Anonymous objects as key-value list</title><link>https://carl-berg.se/post/anonymous-as-key-value-list/</link><pubDate>Tue, 22 May 2012 00:00:00 +0000</pubDate><guid>https://carl-berg.se/post/anonymous-as-key-value-list/</guid><description>Lately, I have been using anonymous object quite alot as a way to pass in a number of key-value pairs into methods. This (I believe) is a quite nice way to expose a way to send an unknown number of key-value pairs into a method.
I first encountered this in ASP.NET MVC where it can be used for passing in route data or html attributes to generate an ActionLink. I tend to use it mostly when I need to work with unknown key-value pairs, such as html attributes or sql parameters.</description></item><item><title>Re-Genesis</title><link>https://carl-berg.se/post/re-genesis/</link><pubDate>Fri, 06 Apr 2012 00:00:00 +0000</pubDate><guid>https://carl-berg.se/post/re-genesis/</guid><description>It&amp;rsquo;s been a long-long time now since i last posted something on this blog and i think it&amp;rsquo;s time for me to get cracking again.
Since i wrote my last blog post about webforms mvp, I&amp;rsquo;ve been diving deeper into test driven development and started exploring some BDD/Specification by example -testing. There are alot of interesting frameworks for testing out there, but i got started with StoryQ, mainly because it doesn&amp;rsquo;t need to be installed to be working with it.</description></item><item><title>Creating a basic form with ASP.NET Webforms MVP</title><link>https://carl-berg.se/post/webforms-mvp-demo/</link><pubDate>Sun, 31 Oct 2010 00:00:00 +0000</pubDate><guid>https://carl-berg.se/post/webforms-mvp-demo/</guid><description>This post describes some of the problems I have experienced when using regular webforms and the benefits of using an MVP framework.
Why I decided to try webforms MVP The main reason I started looking at webforms MVP is that I&amp;rsquo;ve felt some pain points in working with standard webforms. The best idea in my mind would be to jump ship and use MVC instead, but sometimes you may find yourself stuck with legacy code and the switch to MVC would just be to big/costly leap.</description></item><item><title>Preparing a post on ASP.NET Webforms MVP</title><link>https://carl-berg.se/post/preparing-mvp-post/</link><pubDate>Sun, 03 Oct 2010 00:00:00 +0000</pubDate><guid>https://carl-berg.se/post/preparing-mvp-post/</guid><description>I&amp;rsquo;ve been working a while on a simple blogpost on using Webforms MVP, but it seems putting togeather a blogpost takes alot more effort that i originally expected. I&amp;rsquo;m hoping to get it finished soon though if i can get some spare time to spend on it.</description></item><item><title>Mixing webforms and MVC</title><link>https://carl-berg.se/post/mixing-webforms-and-mvc/</link><pubDate>Sat, 10 Jul 2010 00:00:00 +0000</pubDate><guid>https://carl-berg.se/post/mixing-webforms-and-mvc/</guid><description>Yesterday, I spent a couple of hours debugging a problem with MVC forms posting not working right. I had a few MVC pages with a webforms masterpage. The masterpage had a form tag (which is pretty common in webforms masterpages). However, this caused the problem I had with the MVC pages. Apparantly you can&amp;rsquo;t nest forms. This made every first form in the MVC pages post to the index action, even if another action was specified, but the rest of the forms posted like they should.</description></item><item><title>Genesis</title><link>https://carl-berg.se/post/genesis/</link><pubDate>Wed, 30 Jun 2010 00:00:00 +0000</pubDate><guid>https://carl-berg.se/post/genesis/</guid><description>I&amp;rsquo;ve just created this website using ASP.NET MVC 2 and Blueprint Css. This is the first time i&amp;rsquo;ve tried using blueprint, but so far i like it. It makes getting a basic design going alot easier.</description></item></channel></rss>