FeedCity logo

FeedCity

Websites and blogs of people that attended a Homebrew Website Club Düsseldorf.

A public list by dan.

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:

lennybacon.com Valid

How to resolve referenced assemblies with NGem

NGem is a small utility that can help you to resolve assembly references (third-party or you own framework stuff). This is the second post on how to work with NGem. Lets assume you create a new project and start with creating its directory: In the new project directory you can now run NGem to resolve the latest versions of the assemblies that you like to reference from a http reachable location.

lennybacon.com Valid

How to create a ngem package

NGem is a small utility that can help you to resolve assembly references (third-party or you own framework stuff). This is the first post on how to work with NGem. So lets imagine you have created a few assemblies: The assembly in the directory ObjectModel.Data relies on the one called ObjectModel. So we need to create a reference… Its pretty straight forward. Just create a file in the corresponding directory called References.

lennybacon.com Valid

Re: How to change the default browser in Visual Studio programmatically

I’d really like to thank Scott Hanselman for digging into the nitty gritty details of how to change the Visual Studio Default Browser. But… let me cite one of the comments: Should adding browser options to Visual Studio be <sarcasm>this easy</sarcasm>? I hope we all agree on: Go fix this! As I have not found my way to powershell (yet) and I want to have VS Integration (as Scott finalizes his post) too: Here comes the macro version…

lennybacon.com Valid

NGem

I was really enthusiastic about Nu as I first read about it. But the problem for a lot of customers and also for myself is that it cannot cope with private assemblies – stuff that is not open source. Today I started a new open source project with Philip – NGem: A gem like 3rdPartyAssembly resolver and packer with support for private gem repositories. You can find the source code at github.

lennybacon.com Valid

ASP.NET MVC User Group Mini Series

Last week I did talks on ASP.NET MVC and ASP.NET Controls at the .NET Developer Group Braunschweig and Dotnet User Group Dortmund. This way I’d like to thank Lars Keller and Paul Mitzel as well as all attendees for joining and havig such a great time! Slides will be up on the user group pages soon as I submitted them today to Paul and Lars.

lennybacon.com Valid

Damn that itunes

I just went over to itunes to get the black keys album brothers. What an amazing experience again. Let’s crunsch some numbers: The album has 15 tracks itunes crashed 22 times until all downloads finished. WTF #1 Last but not least… itunes did not add the tracks to my purchases or my library. damn. A look into the the file system shows what’s going on. WTF #2 Ok so I tried to start the download again as it seems it had not finished, but…

lennybacon.com Valid

Not-so-developers, welcome aboard Visual Studio…

The last days proved what I was telling a lot of people in the last years on training and coaching gigs… Ayende praises “The return of the secretary”. Donald writes about “the brownfield mess”. I’m so with these guys! I feel the pain too. In my opinion there have been some dark places in the framework since ever: DataSet, ViewState, SqlDataSource, yada yada yada… Same as it ever was! On the other side it must be said, that you do not start developing at a hundred.

lennybacon.com Valid

CQRS & Event Sourcing by Dennis Doomen @ #DotNedUG

After I saw what Dennis was preparing (from his messenger status) I decided to give our neighbors in the Netherlands a visit and join his Session … about “Command Query Responsibility Segregation” at the DotNED user group. He talked about how this style differs from the classic architecture. The audience had a lot of fun discussing on the differences, cons and pros. It has been quite a while that I had architecture discussions in such a big circle and I really enjoyed the topics that were hit.

lennybacon.com Valid

Docx 2 UnitTest

I’m proud to announce our first open source project released on GitHub. The Docx2UnitTest Code Generator is based on an idea of Thomas Bandt. You can read his blog post here. Philip Proplesch started out with a T4 template (of course edited with Tim Fischer’s fabulous tangible T4 Editor). After he told me about it I had the idea of doing it with a code generator (Visual Studio custom tool). The advantage is that you do not need to copy the T4 files around.