Google PlusFacebookTwitter

Hosting services easily on windows

By on Apr 15, 2016 in Deployment | 0 comments

Building applications, even servers, as console applications is great. Easy to run, easy to debug. Easy to host in a safe, error recoverable fashion.. wait what? Yes that’s right. Not out of the box of course, and not using any of the multitude of service installers out there. Use NSSM, Non-Sucking Service Manager. It’s been around for quite some time actually, I think I used it first time a few years ago but still going strong. Basically it provides an interface on top of the windows services runner and allows you to configure all the options you need, error and standard output logs, rolling, recovery and arguments for your executable. Simply...

MvvmLight and CanExecute

By on Mar 2, 2016 in Development | 0 comments

Today is going to be a very short post, more of a pingback really. We are using MvvmLight as it is the defacto mvvm library of WPF but when I upgraded the libraries from the .Net 4.0 versions to .Net 4.6.1 the other day most of our application broke down. The CanExecute callback of all our relay commands stopped working (and I would’ve know this far earlier if the CI had been working, lesson learned again). After a whole lot of digging I came across this comment in the source code: If you are using this class in WPF4.5 or above, you need to use the GalaSoft.MvvmLight.CommandWpf namespace (instead of GalaSoft.MvvmLight.Command). This will enable (or restore) the CommandManager class which handles automatic enabling/disabling of controls based on the CanExecute delegate. Which can be tracked back to the release notes of MvvmLight version 5.0.2: Important note about issue 7659: In...

Loggly gotchas

By on Feb 23, 2016 in Deployment | 0 comments

I’ve setup Loggly today, really nice service but I found a few gotchas you need to keep in mind to get it working. I’m doing this on a docker instance, I’m sure there are other and better ways of doing this (suggestions are very welcome), since I wanted it to be a scripted part of our current platform that’s the road I went down though. We are using the scaled down Debian Jessie AspNet vNext container as a base file when we’re deploying. Basically I’ve copied their dockerfile and built on it. This means there were quite a few packages missing that are required to get Loggly working. Required packages Here is a docker run statement to install the required packages. RUN apt-get -qq update && apt-get -fqqy install telnet sudo rsyslog wget We need these packages in order to be able to run the configuration command to setup rsyslog to push the...

Configuring Serilog from json

By on Feb 1, 2016 in Environment | 0 comments

The past weeks I’ve been working with creating a service API in Asp.Net 5 and .Net Core, exciting stuff. We’re running this in a docker container configured from the base Asp Net containers so it’s all easy to deploy. Well almost. you have to have logging right? And the file structure isn’t quite the same when debugging on a windows machine and running it in a *nix based environment. So what to do? File based configuration of course. We’re using Serilog for logging, hooking this into the Asp.Net 5 logging structure. Serilog is a very mature framework and has loads of plugins, only they’re not all ported to .Net Core and in general quite a few things are missing. The Serilog team has been kind enough to open a little entryway for us if we do want to feed it configuration. This is the ReadFrom property on the logger class. I simply read key-value pairs...

Slowness in Selenium RemoteWebDriver using Ruby on Windows

By on Dec 16, 2015 in Development, Performance | 0 comments

I’ve spent the day profiling trying to figure out why our RemoteWebDriver usage of Winium.Desktop is so much slower than just running the tests straight through Winium.Cruciatus. The profile yielded that TCPSocket#initialize was the culprit, strange, opening a socket shouldn’t take that long. A quick google gave me this post for an answer. Could try require 'resolv-replace' before hand, or using 127.0.0.1 instead of localhost. 123 Could tryrequire 'resolv-replace' before hand, or using 127.0.0.1 instead oflocalhost. I didn’t go as far as to require the resolv-replace but just changed my ‘localhost:9999’ to ‘127.0.0.1:999’ instead and my 10 calls of a total 10sec dropped to 0.5sec total. Remarkable. So that’s an easy fix for you if you find yourself in the same...

Jenkins with Visual Studio Online

By on Nov 30, 2015 in Development, Environment, Tooling, Tools | 0 comments

On my current project we’re using Jenkins as a CI platform and Visual Studio Online with TFS for source control. I’ve been wanting to setup the builds on our intranet again to run the integration tests relying on intranet access each check-in. I had an issue with this, as I did last time I tried it and figured I need to retain this information somewhere. If you are doing this with using Git you’ve come to the wrong place though, Microsoft has a great article about that themselves. This is the error I ended up getting: FATAL: com.microsoft.tfs.core.exceptions.TECoreException: The SOAP endpoint https://infuse.visualstudio.com/Services/v1.0/Registration.asmx could not be contacted. HTTP status: 404 java.lang.RuntimeException: com.microsoft.tfs.core.exceptions.TECoreException: The SOAP endpoint https://infuse.visualstudio.com/Services/v1.0/Registration.asmx could not be...

Decoding html text to plain text in C#

By on Okt 6, 2015 in Development | 2 comments

I’ve found myself having to convert HTML to plain text a few times in a row now and thought I would post my very simple solution for it. It’s got a few caveats, for example it won’t handle pre tags or margins on divs and such thing. Not even paragraphs. But I just wanted a simple conversion so it was enough for me, feel free to extend it.

Lazy day

By on Sep 29, 2015 in Clean code, Development | 0 comments

Today we’re not having a post on the soothing music of Enya but the Lazy<T> class in .Net 4.0. This is probably old news to most out there but I just found it recently (having learned that lazy loading is usually something to avoid, temporal dependencies and all that). It’s nothing complicated really but it reads quite nicely so I’ve used it a few times now and thought I’d bump it. As an example, I’ve got a simple PageObject which would make sense to not load all elements into, and especially wait to load them until we need them because before then, they might not even exist on the page. C# internal class PageObject { private readonly AutomationElement _mainWindow; private readonly Lazy<AutomationElement> _password; private readonly Lazy<AutomationElement> _serverUrl; private readonly Lazy<AutomationElement> _project; private...