background preloader

.net

Facebook Twitter

Programming

Tools. C# Architecture. Wcf. Continuousintegration. Windbg. .net3.5. Hudson. Diagnostics. Console, TDD. Refactoring. Path to .NET 3.5 Developer Certification - TheArchitect.co.uk - Transactions on object models. Free source code and programming. Introduction Wouldn't it be nice if we could (like in a database) take an object-oriented domain model, start a transaction, do wild things with the data and relationships, and then eventually just roll back these changes? My opinion: Yes, it would! Especially if we tend to use as "less" as possible of the functionalities of a relational database and as much as possible the benefits of object orientation. In those system designs, the possibility of managing object model transactions is necessary.

For the TechNewLogic "Stasy" framework - a high level implementation of the Unit-Of-Work design pattern ( I wrote a little demo extension that makes transactions possible. Summary Automatic tracking of property changes via a specialized lightweight .NET proxy. Example Here, we have quite a simple object model. The following code snippet demonstrates how to use the transaction framework. Scott Hanselman's Computer Zen - .NET Framework Library Sou. A YUI DataTable Styled GridView.

Lately I have been spending more and more time browsing through the YUI Developer pages. I have worked exclusively with Microsoft's .Net Framework for the past 5 years, but I find it interesting to learn about other competing technologies as well (I even went so far to get certified on Sun's Java platform). I don't know if it is boredom or curiosity, but I generally find it interesting to see what tools, development environments, programming languages and other techniques non-Microsoft engineers are using. I try to come out of these research projects with something concrete that I can potentially use in my day to day activities as a .Net web developer.

During my most recent effort I came across what I thought was a slick looking GridView like control (YUI calls it a DataTable Control). You can play around with the interactive demo for it here. The control renders as an HTML Table, and has a few sorting features that are sometimes a little difficult to do with the standard asp:GridView. Microsoft Live Labs : Volta. Switching Between HTTP and HTTPS Automatically: Version 2. Free. This project is now being maintained on Google Code under the new name “Security Switch”.

All updates will be posted and tracked there. This article will remain here for educational purposes, but all issues should be reported at its new location. A new version of this library is also available from the Google Code site: Introduction Let's face it. Providing sensitive information on a Web site is a risk. See the What's New section for the latest updates. Background Enter Secure Sockets Layer. There are caveats when implementing a Web site that makes use of the HTTPS protocol. To make things worse, many browsers download pages referenced by a relative URL with the same protocol as the last request. <! Generally, it is not a good idea to encrypt every single page request with SSL.

A Solution Being forced to use absolute URLs for internal links in a Web site is less than appealing. Configuration ... .:: Blocks4.NET ::. Free .NET Components. Writing GIS and Mapping Software for .NET. Free source code and. Download C# and VB.NET source code - 42 KB Introduction In part one of this series, I described how to write an interpreter for raw GPS NMEA data. Part two described how to monitor and enforce GPS precision data to develop commercial-quality software. The articles includes source code in C# and VB.NET which harness the power of GPS satellites to determine the current location, synchronize the computer clock to atomic time, and point to a satellite on a cloudy day. Yet, even with all of this code, most developers still need a way to display GPS information along with other geographic features. With the help of my colleague Phil Smith, a lead developer of our “GIS.NET” mapping component and the “Geodesy.NET” coordinate and projection library, this article will teach you how to generate your own maps.

The Rule of Threes In order to understand the technology behind mapping, it’s necessary to have a solid understanding of three coordinate systems: geographic, projected, and pixel. Conclusion. Hibernate Mapping Cheat Sheet. A many-to-many reference is basically a collection. Class A holds a reference to a set of class B instances (as in the one-to-many case), but B might have multiple A's. Scenario We have two classes, Foo and Bar which are related to each other as follows: Set Foo.getBars() // of Bar instances<class name="Foo" table="foo"> ...

This time we cannot have an extra column on Bar as that would dictate that each Bar has only one Foo. Bidirectionality This relationship can be declared both ways, with Bar having getFoos(), by suitable code changes to Bar and the following schema change: <class name="Bar" table="bar"> ... Now your Bars will know who their Foos are. No extra columns are generated for the bidirectionality.

If you want independent collections of Foos on Bars and Bars on Foos (i.e. membership one way doesn't imply the other), you need to declare Bar's table to be bar_foo. Mapping Enums to Strings and Strings to Enums in .NET. I recently stumbled across a blog post demonstrating how to convert enums to strings using the Description attribute. I thought it might be useful to expand on that example by providing a function that reverses the process (e.g. takes in the resulting string and converts it back to the enum). This would allow you to do things like store off the description into a database and load it back into an enum or populate a dropdown list with the descriptions and save the user's selection back into your domain as an enum.

Rather than diving straight into code, let's just take a quick look at what the finished product lets you do. Say you have the following enumeration: The code from the original blog post will allow you to retrieve any of the Description attributes by calling the ToDescription extension method: And with the code I wrote, you will be able to perform the opposite conversion by calling the ToEnum extension method: Ok, now let's look at how it all works:

Exploring System.Web.Routing. Most of you have probably been hearing a lot recently about the new ASP.NET MVC framework and the many features that it has which will hopefully simplify web development for those of us that want to get “closer to the browser”. One of the features that they were initially implementing for the MVC framework was a new routing engine that gives you a flexible way of mapping urls to specific pages in your application. Early on they realized that the System.Web.Routing infrastructure was not only applicable to ASP.NET MVC, but could be used in any ASP.NET application to allow for much easier url rewriting. (They also realized that they wanted to use it in the Dynamic Data stuff!) Because of this they moved Routing out of the System.Web.Mvc namespace and into the System.Web namespace. Well, this namespace just shipped as part of .net 3.5 SP1, so lets take a look at how it works!

System.Web.Routing has two core concepts. "Catalog/{Category}/{ProductId}" So, I hope you see where this is going. Utilities.NET - Home. WaitHandles - Auto/ManualResetEvent and Mutex. Monitor.Wait/Pulse isn't the only way of waiting for something to happen in one thread and telling that thread that it's happened in another.

Win32 programmers have been using various other mechanisms for a long time, and these are exposed by the AutoResetEvent, ManualResetEvent and Mutex classes, all of which derive from WaitHandle. All of these classes are in the System.Threading namespace. (The Win32 Semaphore mechanism does not have a managed wrapper in .NET 1.1. It's present in .NET 2.0, but if you need to use it before then, you could either wrap it yourself using P/Invoke, or write your own counting semaphore class.) Some people may be surprised to learn that using these classes can be significantly slower than using the various Monitor methods. WaitHandle itself only exposes a few useful instance methods/properties: WaitOne() - used to wait for the handle to be free/signalled.

In addition, it has two useful static methods which deal with sets of WaitHandles: Auto/ManualResetEvent. FileHelpers: the .Net way to import text files | sides of march. I am working on a project where I have to import data from thousands of text files. These text files vary in formats: they use different delimiters; they use quoted identifiers never, sometimes, or always; they sometimes have missing end-of-row columns. Importing these took a combination of custom scripts (to clean up and reformat) and XML format files for SQL’s BCP (bulk copy) command… until I found FileHelpers.

FileHelpers by Marcos Meli is a .Net library which provides services to import and export text in delimited and fixed-length file formats. It takes a unique approach to the file import problem: You write a class, giving it properties to store the data in the text file.You apply attributes to the class and properties, describing the format of the file and applying import rules.You import the file using a single command, which creates an array of objects populated with the data from the text file.

Importing this file now becomes as easy as writing two lines of code. Incredible! The EventPool revisited - The Code Project - C# Programming. Download source - 21.49 KB Introduction I recently started using Marc Clifton's excellent EventPool component to simplify the use of creating and using events. As Marc indicates in his writeup on the component, there are some drawbacks relating to the use of EventArgs based on the limitations of .NET 1, .NET 1.1. Background With the advent of .NET 2 and the introduction of generics, it seemed the ideal opportunity to revisit the EventPool and see what could be done to enhance it.

Some of the new functionality is based on differences between .NET 1 and 2. Here are a list of features that have been added: The ability to use event arguments derived from EventArgs. Here we go through the different ways of using the EventPool. Derived Event Arguments Suppose that you want to subscribe to an event handler which uses an event argument class called AddEventArgs. EventPoolHandler.EventPool.Subscribe ("Add", new EventHandler<AddEventArgs>(AddEventHandler)); To actually raise the event, you call: Sample.