background preloader

Programming

Facebook Twitter

Essential .NET Development Tools & More. Here is (mostly) comprehensive list of tools for development. It’s like Scott Hanselman’s, but focused almost purely on development, with a couple of extras. While you’re at it, go check his out. All opinions are my own and are not bought or sold. The Main Stuff Visual Studio – king of IDEs and the essential tool for .NET devs everywhere. SQL Server Management Studio – it ranges from a useful IDE for SQL to a huge time saver for things like table creation and script generation. SQL Server Profiler – for when I’m having a hard time figuring out exactly how well a SQL query is running or when the SQL that’s being emitted from Entity Framework is not immediately known to me, I always turn to Profiler. LINQPad – write LINQ queries using the best .NET code scratchpad on the market.

NimbleText – thanks to Scott Hanselman, I have found this program – and my new favorite way to write repetitive code or handle small or large data transformation tasks. Notepad++ – my text editor of choice. Web. OzCode: Innovative debugging extension for Visual Studio. Free .NET decompiler :: JetBrains dotPeek.

Javascripts

.NET Design Patterns in C# and VB.NET - Gang of Four (GOF) - DoFactory. Design patterns are solutions to software design problems you find again and again in real-world application development. Patterns are about reusable designs and interactions of objects. The 23 Gang of Four (GoF) patterns are generally considered the foundation for all other patterns. They are categorized in three groups: Creational, Structural, and Behavioral (for a complete list see below). To give you a head start, the C# source code for each pattern is provided in 2 forms: structural and real-world. Structural code uses type names as defined in the pattern definition and UML diagrams. Real-world code provides real-world programming situations where you may use these patterns.

A third form, .NET optimized, demonstrates design patterns that fully exploit built-in .NET 4.5 features, such as, generics, attributes, delegates, reflection, and more. The 23 Gang of Four Design Patterns .. Revisited. The Gang of Four (GoF)(from Design Patterns: Elements of Reusable Object-Oriented Software, Addison-Wesley Professional Computing Series, by Erich Gamma, Richard Helm, Ralph Johnson, and John Vlissides). These 23 GoF patterns are generally considered the foundation for all other patterns. They are categorized in three groups: Creational, Structural, and Behavioral.

Creational Patterns Abstract Factory: Creates an instance of several families of classes. Provide an interface for creating families of related or dependent objects without specifying their concrete classes. Builder: Separates object construction from its representation. Separate the construction of a complex object from its representation so that the same construction processes can create different representations. Structural Patterns Adapter: Match interfaces of different classes.Convert the interface of a class into another interface clients expect.

Behavioral Patterns. See the Intermediate Language for C# Code. Introduction Sil is an addin for Visual Studio that let's you quickly disassemble and inspect code. How does it work? First, find some code you're interested in: Next. right click on the method name (or property, or class etc) and choose 'Disassemble': Finally, the disassembly for your selection is shown in a new document window, with some extra functionality such as the ability to show or hide the source comments: Why would we care about the disassembly? 1. C# has a lot of syntactic sugar - lambda expressions, linq, using statements, multicast delegates and so on. 2. There are many things we learn about .NET and C# - and these are often quite high level. In this article, I'll show you how to use Sil, and also describe how it works - you can use the code as a starting point for your own Visual Studio addins. Let me try it! Once you've installed Sil, just open any C# code and right click on something you're interested in.

The Standalone Application You can run Sil as a standalone application. Set a default parameter value for a JavaScript function. Text Rotation with CSS. Once again, after reading somebody else's article, I felt inspired to put together an alternative example. In this case: Text Rotation. Within the article I linked to, the example uses an image sprite and a sprinkle of CSS to get things positioned right. Well, maybe not so much a sprinkle. It's like the top fell off the pepper shaker and you've suddenly got a large pile of pepper on your food. Thankfully, many of the popular browsers of today support the ability to rotate HTML elements.

<div class="example-date"><span class="day">31</span><span class="month">July</span><span class="year">2009</span></div> Nice and clean without too many extras. The Magical CSS For Webkit and Firefox (as of 3.5), you can take advantage of the proposed transform property to handle the rotation.

-webkit-transform: rotate(-90deg); -moz-transform: rotate(-90deg); In order to perform a transformation, the element has to be set to display:block. Filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=3); ServiceLocator and Unity – Be Careful - Jeremiah Clark's Blog. Chris Tavarez has provided a handy adapter ( UnityServiceLocator ) for using ServiceLocator to resolve types from a Unity container.

You can then use ServiceLocator.SetLocatorProvider() to register the UnityServiceLocator as the default provider for ServiceLocator. For this example, we will be using ServiceLocator and Unity to resolve the type IFoo to Foo using a singleton lifetime. Then we will get two instances of IFoo and compare to ensure that they are the same object. Here are four different approaches to configuring ServiceLocator and Unity that I have found during my searches on the web: 1: static void Main( string [] args) 3: UnityServiceLocator locator = new UnityServiceLocator(ConfigureUnityContainer()); 4: ServiceLocator.SetLocatorProvider(() => locator); 6: var a = ServiceLocator.Current.GetInstance<IFoo>(); 7: var b = ServiceLocator.Current.GetInstance<IFoo>(); 9: Console.WriteLine(a.Equals(b)); 12: private static IUnityContainer ConfigureUnityContainer() 16: return container;

.NET Junkie - Dependency Injection in ASP.NET Web Forms with the Common Service Locator. When working with IoC frameworks, one should always try to minimize the amount of application code that takes a dependency on that framework. In an ideal world, there would only be a single place in the application were the container is queried for dependencies. ASP.NET Web Forms however, was never designed with these concepts in mind. It therefore is tempting to directly request for dependencies in the Page classes instead of looking for a workaround.

This is what a Page could look like without such a workaround: public partial class _Default : System.Web.UI. Public _Default () { this .userService = ServiceLocator .Current.GetInstance<IUserService>(); } } While this doesn’t look that bad, it creates a dependency on an particular implementation and even when your calling an abstraction (as I do with the Common Service Locator in the example) you might want to prevent this, because you’ve still got a dependency and a bit of plumbing in each and every page. protected _Default () { } Why does everyone say dependency injection in ASP.NET webforms is hard when PageHandlerFactory and IHttpHandlerFactory exist. Inversion of Control and Dependency Injection: Working with Windsor Container. Oren Eini November 2006 Applies to: Visual Studio 2005 Team Edition for Software Architects .NET Framework Inversion of Control (IoC) Dependency Injection (DI) Windsor Container Summary: This article discusses how to use Inversion of Control and Dependency Injection, generic specialization, the decorator pattern, chains of responsibilities, and extensible software to build robust, extensible, working software. (16 printed pages) Contents How to Build Better SoftwareThe First Feature: Dispatching an OrderLooking at a More Complex Example How to Build Better Software Close your eyes, take a deep breath, click your heels three times, and say, "There's no better thing than Inversion of Control and Dependency Injection, generic specialization, the decorator pattern, chains of responsibilities, and extensible software.

" This article will discuss using all of the aforementioned to build robust, extensible, working software. If you want to learn all about Windsor itself, you can go to its Web site. <! 10 Tips for the SQL Server PowerShell Scripter - Hey, Scripting Guy! Blog. Summary: Microsoft PowerShell MVP, Chad Miller shares his top ten tips for the SQL Server Windows PowerShell scripter. Microsoft Scripting Guy, Ed Wilson, is here. Today’s blog is a bit unique. I was throwing around ideas with Chad Miller, and somehow we came up with the idea that he would share some tips for the SQL Server Windows PowerShell scripter. You can read more about Chad and see his other blog posts on the Hey, Scripting Guy! Blog site. And now, Chad… 1. Here-strings are great for working with strings that span multiple lines or contain characters you would normally need to escape, such as embedded quotes.

$group = "PRD" #Don't do this: $query = "SELECT DISTINCT" $query +="`n s.server_name" $query += "`n FROM msdb.dbo.sysmanagement_shared_registered_servers s" $query +="`n JOIN msdb.dbo.sysmanagement_shared_server_groups g ON s.server_group_id = g.server_group_id" $query += "`n WHERE g.name = '$group'" #Instead use a here-string: $query = @" s.server_name WHERE g.name = '$group' 2. 3. 4. Project-less scripted C# with ScriptCS and Roslyn. Manifesto for Minimalist Software Engineers | Minifesto.org. Creating an MSI Package for C# Windows Application Using a Visual Studio Setup Project. Download source - 818.7 KB Introduction There are number of ways provided by Microsoft to create a setup project for windows application.

But when I started to create one, I got nothing but queries and confusions of how to start and where to start. There are numerous articles I found explaining to create a setup project, but some did not work, and some did not have a live example to follow. The driving force for me to write this article is my QC team, who accept the main application for testing, and who also verified my setup installer with their 100% effort. In this article I would like to explain a step by step process to create a windows application and a setup installer for the same in a very simple manner, that is easy to understand and follow knowing that there are a number of other ways to do the same thing. Start the Show First, let’s create a simple one form windows application, with only a text box and a button. Primary Objective So far so good. Create Shortcuts Uninstall Step 1 Step 2.

.NET