FeedCity logo

FeedCity

lennybacon.com

Not verified No WebSub updates No Webmention updates Valid

Recent content on lennybacon.com

Generator
Hugo -- gohugo.io
Public lists
HWC DUS

lennybacon.com Valid

Python's urandom as non-admin

A few weeks ago I set up a new mercurial server fronted by “hgweb-cgi”. The application pool is, as python 2.66, in x64 mode. It has a dedicated ad account from the Managed Service Accounts OU. I set the privileges to deny logon locally and run as service and batch. Everything works fine… until you want to push: HTTP 502 Bad Gateway. IIS failed request tracing lead me to the relevant python source line:

lennybacon.com Valid

CSS 3.0 as the only schema in Visual Studio

As Visual Studio keeps forgetting the settings that also affect validation and falls back to the oh-so-90-style-2.1-css-version just delete ALL other schemas. Thanks to the industry known Sweat Swank for searching the registry key.

lennybacon.com Valid

Visual Studio Intellisense support for parameters in JavaScript

From the perspective of a .NET developer JavaScript lacks of intellisense. Of course, Visual Studio is capable of showing intellisense for defined objects and their members, but when it comes to parameters we face the untyped world. Last year I did a project with a few developers who had to leave their beloved C# world and enter the JavaScript area. Their motivation declined from day to day. So I thought of how to provide them with what they were missing like water in the desert.

lennybacon.com Valid

Autorun T4 templates on build

<ItemGroup> <T4Template Include="Model.tt"> <Generator>TextTemplatingFileGenerator</Generator> <LastGenOutput>Model.cs</LastGenOutput> </T4Template> </ItemGroup> ... <!-- Define target for code generation --> <Target Name="T4Generation"> <Message Text="Running Text Transformation..." /> <Exec Command="&quot;TextTransform.exe&quot; &quot;%(T4Template.FullPath)&quot; -out @(T4Template->'%(FileName).wxs')" /> </Target> <!-- Add target for code generation as dependency of "CoreCompile"-target --> <PropertyGroup> <CoreCompileDependsOn>@(CoreCompileDependsOn);T4Generation</CoreCompileDependsOn> </PropertyGroup>

lennybacon.com Valid

MsBuild finding directories if not given as parameter

I’m a lazy developer. Being lazy does not mean I avoid to work. It means that I like to reflect things I am doing and optimize and atomize stuff to get more time on the valuable tasks. Code generation is a tool I tend to use quite regularly and T4 is at most my generator of choice. Generated files can cause a lot of merging conflicts. So they are not to be checked into my source control system (currently my choice is HG/Mercurial).

lennybacon.com Valid

Could not load file or assembly exception and how to fix your builds when using nuget packages

Once in a while it happens that an exception is thrown like the following: Could not load file or assembly ‘devcoach.Core, Version=1.0.11308.1, Culture=neutral, PublicKeyToken=0313e76cb5077f22’ or one of its dependencies. The located assembly’s manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040) What did cause this exception to be fired? Lets have a look at the following picture which illustrates the scenario. The build order is defined by the dependencies.

lennybacon.com Valid

Chaining asynchronous javascript calls

The good thing about JavaScript is that its network/ajax calls are asynchronous. The bad thing about JavaScript is that its network/ajax calls are asynchronous. It’s bad because nested calls increase complexity. Look at the following sample methods: function f1(callback) { console.log('f1'); if (callback != null) { console.log('hasCallback'); callback(); } } function f2(callback) { console.log('f2'); if (callback != null) { console.log('hasCallback'); callback(); } } function f3(callback) { console.log('f3'); if (callback != null) { console.

lennybacon.com Valid

ICE Lingen 2011

It’s community summer again. The same procedure as every year. In the middle there is some refreshing ICE. The ICE-Conference in Lingen is something special to me because it is an admin event. I’m a developer. Maybe It’s caused by my roots – yeh, I was an admin once. Maybe caused by the fact that I tend to build bridges between admins and devs and build my developments aware of infrastructure.

lennybacon.com Valid

NRW Conf 2011 community conference: The doors are open

Since the year 2005 the non-commercial organization JustCommunity e.V. organises once a year the NRW Conf community event. Over the time it has become one of the biggest community events in Germany. This years conference will be on the 8th and 9th of September located in Wuppertal, Germany. We will host over 20 speakers and sessions from Germany and Europe, and as last year there will be a workshop day upfront:

lennybacon.com Valid

Figure out if the current running application is a web application without a reference to System.Web.dll

Especially in core libraries I tend to not reference System.Web.dll to keep the .NET Framework Client Profile as an option of compilation. I use the following code to figure out if the current running application is a web application namespace devcoach.Extensions { public static partial class AppDomainExtensions { public static bool IsWebApp(this AppDomain appDomain) { var configFile = (string)appDomain.GetData("APP_CONFIG_FILE"); if (string.IsNullOrEmpty(configFile)) return false; return Path.GetFileNameWithoutExtension(configFile).Equals( "WEB", StringComparison.OrdinalIgnoreCase); } } }

lennybacon.com Valid

Settings in Silverlight

A few months ago I was developing a Silverlight Line of Business Application with a customer when I stumbled across the requirement to store some information over multiple user sessions - user works with the app, closes the browser and reopens the browser and works with the app again. My first idea was to store the info in a cookie. It all worked out fine until I started to enable the localization using the culture/uiculture param.

lennybacon.com Valid

.NET Day Franken 2011

Am 21. Mai war ich Sprecher auf dem .NET Day Franken. Ein weiteres tolles Event für die .NET Community. Vielen Dank an Thomas Müller, und Bernd Hengelein und Michael Wiedeking!

lennybacon.com Valid

dotnet Cologne 2011

Am 6. Mai fand in Köln die dotnet Cologne statt. Neben meinem Sprecher-Engagement hat es mich sehr gefreut, dass unsere Firma, devcoach, dieses gelungene Community-Event als Platin-Sponsor unterstützen konnte. Ein großes Dankeschön an Albert Weinert, Roland Weigelt und Stefan Lange!

lennybacon.com Valid

New Visual Studio Style

I’ve been with a dark theme for a while but always hat a few issues with my prior theme. Today I created a new one: http://studiostyl.es/schemes/lennybacon-s-new-dark

lennybacon.com Valid

Setting up a local SSL development environment for multiple sites

The environment should also work on a notebook while working at a coffee shop. The need for a NIC that is always connected. Add a loopback adapter… [WIN] + [R] | hdwwiz.exe Open the “Network and Sharing Center” … Click “Change adapter settings” and identify the loopback adapter… Rename the loopback adapter… Open loopback adapter’s properties… Disable IP v6… Edit IP v4 settings and assign an IP Address… Click advanced an add another IP address for each SSL-Site to be hosted… Open “IIS Manager” and click “Server Certificates”… Click “Create self signed certificate” for each SSL site to be hosted and choose the host name as friendly name… Assign each site to be hosted a dedicated IP address plus certificate… Associated IP addresses with host names in the hosts file (or install DNS Services when on Server 2008)… Done!

lennybacon.com Valid

Resharper 6 WPF binding validation

I usually do most stuff in the markup view. As loose coupled view models cannot be validated its … ugly. But today I experienced this: I hit [ALT] + [ENTER] The following code was added (the type name “LoginViewModel” and its namespace was addedmanually…): Now I got binding validation: Nice!

lennybacon.com Valid

ASP.NET MVC 3: German Web Casts Series

Heute sind die ASP.NET MVC 3 Web Casts die ich machen durfte online gegangen: ASP.NET MVC ist Teil des ASP.NET Framework; Anfang 2011 ist die Version 3 des ASP.NET MVC erschienen. Diese Webcast-Reihe führt in das Entwurfsprinzip des Model View Controller-Schema (MVC) ein. ASP.NET MVC (Teil 1 von 3) – Fundamentals ASP.NET MVC (Teil 2 von 3) - Views & Layouts mit Razor ASP.NET MVC (Teil 3 von 3) - Forms, Binding & Validation

lennybacon.com Valid

Nuget Package Reference Switcher Extension for Visual Studio

I really like the idea of nuget package management. I tend to use packages also for internal libraries. But in a debugging session I sometimes need to debug or even change the referenced project. What I usually do is to add the foreign project to my solution and change the reference from the “Package Reference” to a “Project Reference”. After I did my changes to the foreign project I commit it, rebuild the package, upload it and reload the package to my local projects package directory.

lennybacon.com Valid

WCF Data Services Client does not close connections!

Have you ever worked with the WCF DataServices Client? I was contributing to the nuget project and experienced some problems. After a few operations (web request through either the WCF Data Service Context or manually through a WebRequest) operations started to time out. I used (the fabulous) reflector pro to digg into the sources. What you see here is a class utilized to return the result of a WCF Data Services request.

lennybacon.com Valid

Generating code files with correct namespaces using T4

The Visual Studio built in Code Generator T4 is mostly used to generate code files. As code in .NET is organized in namespaces I needed a way to figure out the correct namespace for the generated file. T4 provides the ability to access properties of the Host. When using Visual Studio this is the EnvDTE automation object. This gives us access to the project properties that contain a property for the default namespace for the project.

lennybacon.com Valid

Regions are like knives

Most people state that regions are bad. I prefer a more fine grained definition: Regions in code are like knives. They can cause serious injury. But a surgeon can use one to do good. What are region intended for? Regions provide you the ability to expand and collapse code. You can do this with members, classes and namespaces without a region. The difference is that the region keeps the collapsed state when opening a file.

lennybacon.com Valid

Enable editing of enumerable data in ASP.NET MVC

I’m currently working on an ASP.NET MVC project. Today I stumbled across a requirement that involved enabling the editing of data that is displayed (on a lets call it master page). The specialty of the data is it’s an enumerable. I had a few Ideas how to solve the problem. 1. Ajaxification Pro: I like jQuery. I like that you can directly edit stuff Con: I like to have a low-level fallback

lennybacon.com Valid

Do not debug on daylight saving time switch

WTF? Solution: Unmark the auto adjustment EDIT: While I blogged this I had the same issue on my blog. Here is the snapshot of the event log Event code: 3005 Event message: An unhandled exception has occurred. Event time: 10/31/2010 2:11:48 AM Event time (UTC): 10/31/2010 12:11:48 AM Event ID: 2da507c58aa84c7b8ed29e8fbf3908bc Event sequence: 496 Event occurrence: 9 Event detail code: 0 Application information: Application domain: /LM/W3SVC/4/ROOT-1-XXXXXXXXXXX Trust level: Full Application Virtual Path: / Application Path: X:\xxxxxxx\lennybacon.

lennybacon.com Valid

More comfort reading values from lines in CSV-files

Today I had to read values from multiple CVS-files. I wanted to build a testable and reusable solution instead of the ugly sequential spaghetti that easily happens. So here is a sample of a line: var lineReadFromCsv = "42;Daniel;Fisher;1980-03-25;{79704C0D-1A4F-4DDD-80F6-CA79E81BF7CD}"; To increase the readability I created enumerations that point to the index of the position of the values in each line that I wanted to read: public enum DataFormatField { Id = 0, GivenName = 1, Surname = 2, DateOfBirth = 3, UniqueId = 4, } I created a class called ParserParameter that contains enums that

lennybacon.com Valid

Ultimate Guide to speed up Visual Studio

I believe that better tools lead to better results. That’s why I care about my tools performance a lot! Recently I had a conversation with Peter Kirchner and Kay Giza on how to speed up Visual Studio. Specifically by configuring you Anti-Virus software. But beside that there are loads of things that you can do. So I decided to share the tweaks on environment: Visual Studio 2008 Options Disable “Animate environment tools”…

lennybacon.com Valid

Adding errors to the model state the typed way

Ah… there is one left. We do not only want to remove properties form the model state the typed way. What about adding error messages? Here we go: using System; using System.Linq.Expressions; using System.Reflection; using System.Web.Mvc; namespace devcoach.Web.Mvc { /// <summary> /// Extensions for the <see cref="ModelStateDictionary"/> class. /// </summary> public static class ModelStateDictionaryExtensions { /// <summary> /// Removes the specified member from the <see cref="ModelStateDictionary"/>. /// </summary> /// <param name="me">Me.

lennybacon.com Valid

Removing properties from the model state the typed way

I’m currently working with Philip on a project which also has an ASP.NET MVC (by the way I really like the .MVC idea somebody came up the last weeks) project. We came to the point where we needed to remove the required property “Password” if the user is registering using OAuth. Argh. That’s is not typed! So I wrote a small extension method that I added to the devcoach.Web.Mvc assembly I’d like to share here: