Полезные ссылки (25.10.2010)

.NET

  1. The Truth About Value Types — The way in the past I've usually pushed back on this myth is to say that the real statement should be "in the Microsoft implementation of C# on the desktop CLR, value types are stored on the stack when the value is a local variable or temporary that is not a closed-over local variable of a lambda or anonymous method, and the method body is not an iterator block, and the jitter chooses to not enregister the value."
  2. Converting a concatenated String into String.Format — The macro’s purpose is simple - turn a string that you are concatenating into a String.Format statement. This generally produces much more readable code and becomes more maintainable long term. It even attempts to recognize when you are already using a formatted ToString...
  3. Enumerating Through XML Elements Using LINQ-to-XML — 4Guys reader Dan D. recently emailed me with an inquiry surrounding my article series, Building a Store Locator ASP.NET Application Using Google Maps API, specifically on how to access a different set of XML elements within the XML data returned from the Google Maps API’s geocoding service. Google’s geocoding service is offered as a URL that, when requested, returns information about a particular address. For instance, if you point your browser to http://maps.google.com/maps/api/geocode/xml?address=1600+Pennsylvania+Ave,+Washington+D.C.&sensor=false you should see an XML response that indicates whether the address is valid, the formatted address, the components that make up the address, and geographical information about the address, including the latitude and longitude coordinates...
  4. Redlining C#'s Dynamic Features — Before I go any further: the point of this post isn't to convince you of anything (where have I read that before?) - it's to explore a new language feature completely and, hopefully, have a good discussion on it. If you are feeling a bit of a gag reflex - I think It's important to know why. What is it that is causing you to dislike what you're about to see? C# is going more and more dynamic - time and feature set have proven that. Maybe it's time to bend your thinking? Or maybe it's not...
  5. Links to Scott Guthrie's Using LINQ to SQL Tutorials — Back when Visual Studio 2008 came out, Scott Guthrie wrote an excellent series of blog posts on using LINQ to SQL. Unfortunately, the various installments are not easy to follow when starting from Part 1 and going onward, so I've decided to gather and organize the links here for myself and for anyone else interested in his tutorial...
  6. NuPack brings package management to Microsoft .NET — Microsoft has announced the beta release of NuPack, which is a package manager for .NET projects, mainly focused on open source libraries. NuPack itself is open source.
    I downloaded NuPack and took a look. It installs as a Visual Studio extension, and I used it with Visual Studio 2010. Once installed, you get a new Add Package Reference option for any .NET project, which opens this dialog...
  7. Some Best Practices for C# Application Development (Explained) — Few days ago, in one my earlier post, I listed “Some Best Practices for C# Application Development” from my past few years experience, which got a huge hit by my readers. I got several feedbacks on that too. Many of my readers gave valued suggestions too...

Читать полностью »

25.10.2010

Полезные ссылки (26.07.2010)

.NET

  1. CSLA 4 release — I am very happy to announce the release of CSLA 4, with support for .NET 4, Silverlight 4 and Visual Studio 2010....
  2. Extension Methods and the Debugger — One source of confusion I find myself clearing up a lot is the use of evaluating extension methods in the debugger windows. Users report evaluation as working sometimes but not others for the exact same piece of code. Such flaky behavior can only be the result of a poorly implemented feature or subtle user error...
  3. Creating a Collection from Singletons and Collections using LINQ — A key operation when doing pure functional transformations is the process of creating complex hierarchies of objects. We see this when transforming some data source (such as an Open XML WordprocessingML document) to a LINQ to XML tree, and we see this when writing a recursive descent parser. The recursive descent parser for Excel formulas is nothing more or less than a pure functional transform from the source string to a parse tree, which is a hierarchical object graph...
  4. Code-First Development with Entity Framework 4 — .NET 4 ships with a much improved version of Entity Framework (EF) – a data access library that lives in the System.Data.Entity namespace...
  5. Book Review: WCF 4.0 Multi-tier Services Development with LINQ to Entities — The great folks at Packt Publishing contacted me to ask if I was interested in reviewing a title for them. When I saw the title, I said “heck yes!” The book is WCF 4.0 Multi-tier Services Development with LINQ to Entities. I have closely followed WCF since its early days as “Indigo”, and I was excited to see a title that tackled a tough subject: using Entity Framework with WCF 4.0...

Читать полностью »

26.07.2010

Полезные ссылки (11.07.2010)

.NET

  1. C# Fundamentals: The Joys and Pitfalls of Enums — First, a quick recap of enums for those who are brand new or less familiar with them. Basically, enums a great way to declare a variable of a type that can be one of a fixed set of values.
    If you didn’t use enums, you would probably set up a bunch of string or integer constants instead. String comparison is, of course, more expensive than numeric comparison (though, of course, integers are harder to interpret through their raw values)...
  2. Floating point numbers and string representations — I’ve recently been doing some work on the HealthVault SDK to improve the consistency of how it deals with floating-point numbers, and thought that the information would be of general interest...
  3. Unit Tests and LINQ Queries — It’s easy to test LINQ queries when the LINQ queries always execute entirely in memory – like with LINQ to objects or LINQ to XML. All you need to do is put some in-memory data together and pass it to code executing the query...
  4. Recursive Descent Parser using LINQ: The Augmented Backus-Naur Form Grammar — A grammar is a device to define syntax for a language. A grammar is made up of rules, sometimes called productions. Each rule defines a symbol, when can then be further used in other rules. Grammars are not hard to understand; most developers instinctively understand grammars when they see them. When you learn a new programming language, almost without thinking about it, you assemble some version of the grammar in your head...
  5. Working with Zip Files in .NET [Richard Lee] — Before getting started, I’ll introduce myself. My name is Richard Lee, and I’m a developer intern on the BCL for the summer. I’ve only been here for a few weeks, but it’s been great working here. The people, the environment, and my project are all great. Speaking of which, my project is to add general purpose .NET APIs for reading and writing Zip files, which we’re considering adding to the next version of the .NET Framework...
  6. Null Or Empty Coalescing — In my last blog post, I wrote about the proper way to check for empty enumerations and proposed an IsNullOrEmpty method for collections which sparked a lot of discussion...
  7. Testing Email Sending — Recently I learned a couple of interesting things related to sending emails. One doesn’t relate to .NET at all, so if you’re a developer and you want to easily be able to test whether or not emails are working correctly in your application without actually sending them and/or installing a real SMTP server on your machine, pay attention. You can grab the smtp4dev application from codeplex, which will listen for SMTP emails...

Читать полностью »

11.07.2010

Полезные ссылки (15.06.2010)

.NET

  1. LINQPad Has Replaced Snippet Compiler in my ToolBox — I have been using Snippet Compiler for a long time now to do little, quick spikes or to try something out. If I needed to see how an object worked and I didn’t want to open up the full blown Visual Studio, I’d open up Snippet Compiler. Now I have a new tool to replace Snippet Compiler: LINQPad...
  2. Sometimes an enum is not the best idea — In our application we are dealing with a limited, but slowly growing number of suppliers. In some parts of the code each one is treated differently, in others parts we only have to identify them. Their id which is also understood by the outer world, is a simple integer number...
  3. Conditional Attribute — One cute feature of C# 1.0 was the introduction of the Conditional attribute. When you apply the conditional attribute to a method, calls to this method are only included in the resulting code if the appropriate define is set...
  4. Checking For Empty Enumerations — This method accepts a generic enumeration and then proceeds to check if the enumeration is null or empty. Do you see the potential problem with this code? I’ll give you a hint, it’s this line...
  5. C#: System.Lazy and the Singleton Design Pattern — So we've all coded a Singleton at one time or another. It's a really simple pattern and can be a slightly more elegant alternative to global variables. Make no mistake, Singletons can be abused and are often over-used -- but occasionally you find a Singleton is the most elegant solution...
  6. C# 4.0/BCL 4 Series: C# 4 Named Parameters — This is part of a series. I really should have combined Named Parameters when I wrote about Optional Parameters last time since they are similar and go well together. Again, nothing thrilling here to speak about in C# 4...
  7. C# 4.0/BCL 4 Series: C# 4 Optional Parameters — This is part of a series. C# 4 allows you to declare optional parameters in methods, constructors, and indexers. A parameter is optional if it specifies a default value in its declaration...
  8. Caveats of C# 4.0 optional parameters — C# 4.0 includes lots of shiny new hammers for us to bang away at every new and existing development problem we face. One of the more interesting features is the concept of named and optional parameters...
  9. Linq To Dataset: Display the contents of several tables in a data control — In several cases, we will be required to work with data in different datasets, or on the same dataset but at different DataTables. In these cases, the power of Linq will help us solve the problem quickly and easily...

Читать полностью »

15.06.2010

Полезные ссылки (13.05.2010)

.NET

  1. Simplify, Shorten and Speed Up Your LINQ Statements with "Let" (blog.nitriq.com) — I've been writing a lot of LINQ statements lately while working on Nitriq and have come across a pretty cool LINQ keyword - "let". It allows you to specify an intermediate calculation that can be referenced multiple times else where in your LINQ statement, including the where and select clauses...
  2. Entity Framework 4.0 POCO Classes and Data Services — If you've flipped on the POCO (Plain Ol' CLR Objects) code generation T4 templates for Entity Framework to enable testing or just 'cuz you like the code better, you might find that you lack the ability to expose that same model via Data Services as OData (Open Data). If you surf to the feed, you'll likely see something like this...
  3. — ...C# 4.0/BCL 4 Series: Complex numeric type — Like BigInteger, the Complex struct is another specialized numeric type new to Framework 4.0 and is for representing complex numbers with real and imaginary components of type double. It also lives in the System.Numerics.dll assembly. To use Complex, instantiate the struct, specifying the real and imvar aginary value...
  4. C# 4.0/BCL 4 Series: BigInteger — Another new type in Framework 4.0 os the BigInteger specialized numeric type. It lives in the new System.Numerics namespace and lets you represent an arbitrarily large integer without any loss of precision...
  5. C# 4.0/BCL 4 Series: System.Tuple — I mentioned, in my last post, that I was using C# 4.0 In A Nutshell to better my C# 3 and to come up to speed with C# 4/BCL 4. Another cool thing in Framework 4.0 is the generic set of classes for holding a set of differently typed objects called tuples. Like the Func<> and Action<> delegates, tuples also take up to 8 parameters...
  6. Use Extension method to write cleaner code — This blog post will show you step by step to refactoring some code to be more readable (at least what I think). Patrik Lownedahl gave me some of the ideas when we where talking about making code much cleaner. The following is an simple application that will have a list of movies (Normal and Transfer). The task of the application is to calculate the total sum of each movie and also display the price of each movie...
  7. All the posts in LINQ series
  8. Exploring LINQ #3 — LINQ keeps amazing me in its power and beauty. So much that for each problem I have to solve (coding problem that is) I find myself wondering can this be done with LINQ, and how...

Читать полностью »

13.05.2010

Полезные ссылки (02.05.2010)

.NET

  1. Layering enumerators — Now that I've touched upon XmlReader and how it can be used to stream data while allowing clean layering at the same time, I want to touch on the layer-able interface by excellence in the .NET Framework: IEnumerable...
  2. Reactive Framework Getting your LINQ on — Last time in our exploration of the Reactive Framework, we built a random Observable event generator. Now that we have our data source, we can start working with it. In the past, we would have hooked up event handlers to the event delegate and imperatively interacted with the values passed in the sender and EventArgs. Of course, when we Thinq LINQ, we try to find simpler, more declarative models to represent our intent...
  3. C#: Adding Functionality to 3rd Party Libraries With Extension Methods — Ever have one of those third party libraries that you love but it's missing that one feature or one piece of syntactical candy that would make it so much more useful? This, I truly think, is one of the best uses of extension methods...
  4. LINQ and Aggregate function — LINQ also provides with itself important aggregate function. Aggregate function are function that are applied over a sequence like and return only one value like Average, count, sum, Maximum...

Читать полностью »

02.05.2010

Полезные ссылки (27.04.2010)

.NET

  1. Reactive Framework Building an IObservable Event Generator — In my last post, I mentioned a number of cases where you may want to use the Reactive Framework. For some upcoming presentations, I wanted to focus on a couple of these scenarios, particularly on how you can use the Reactive Framework (rX) to work with events from device sensors. You can often find these kind of sensors in a number of industries, including Robotics, automated manufacturing systems, Medical monitors, Telecom usage, and Live financial feeds. In order to demonstrate using rX in this environment, I needed to build a module that simulated generating a bunch of sample random events. Below is the module that I created...
  2. Reactive Framework Why bother — Now that LINQ has been out for a while, I’m starting to work on a new set of talks that are related to some of the new extensions to LINQ. Although LINQ to databases (SQL, Entity Framework, etc) are interesting, I’ve always been partial to the more generalized abstraction that is found in LINQ to Objects and XML. One of the most compelling expansions on the core LINQ concepts at this point is the Reactive Framework (rX)...
  3. Lambda’s for .NET made easy… — he purpose of my blog is to explain things for a Silverlight developer. One of the best things about Lambda's is that you not only use them in Silverlight but any project targeting .net 3.5 I’ve seen several blog post that use lambda expressions always assuming the audience is familiar with them. The purpose of this post is to make them simple and easily understood. Let’s begin with a definition...
  4. C#: LINQ vs foreach - Round 1. — So I was reading Peter Kellner's blog entry on Resharper 5.0 and its LINQ refactoring and thought that was very cool. But that raised a point I had always been curious about in my head -- which is a better choice: manual foreach loops or LINQ...
  5. Working with Joins in LINQ — While working with data most of the time we have to work with relation between different lists of data. Many a times we want to fetch data from both the list at once. This requires us to make different kind of joins between the lists of data. LINQ support different kinds of join...
  6. Leveraging the Power of Typed DataSets, IEnumerable<>, and LINQ — ...In my previous post, I extolled my love of typed DataSets in .NET because they are not only quick to design and update, but also very easy to understand. Essentially, if you can read an entity-relationship model (a la ERwin or a Visio database diagram) -- which I suspect nearly all developers can -- then you can discern quite a bit of information from a typed DataSet
  7. Using C# 4.0’s DynamicObject as a Stored Procedure Wrapper — Ignoring the fashion, I still make a lot of use of DALs – typically when inheriting a codebase with an established database schema which is full of tried and trusted stored procedures. In the DAL a collection of base classes have all the scaffolding, so the usual pattern is to create a wrapper class for each stored procedure, giving typesafe access to parameter values and output. DAL calls then looks like instantiate wrapper-populate parameters-execute call...
  8. So You'd Like to Send Some Email (Through Code) — Despite my misgivings, email is the cockroach of communication mediums: you just can't kill it. Email is the one method of online contact that almost everyone -- at least for that subset of "everyone" which includes people who can bear to touch a computer at all -- is guaranteed to have, and use. Yes, you can make a fairly compelling case that email is for old stupid people, but let's table that discussion for now...
  9. Every Binary Tree There Is — The other day I wrote a little algorithm that did some operation on binary trees. I wanted to test it. I whipped up a few little test cases and it seemed fine, but I wasn’t quite satisfied. I was pretty confident, but maybe there was some odd binary tree topology that I hadn’t considered which would cause a bug...
  10. C# Extension Methods - To Extend or Not To Extend... — I've been thinking a lot about extension methods lately, and I must admit I both love them and hate them. They are a lot like sugar, they taste so nice and sweet, but they'll rot your teeth if you eat them too much...

Читать полностью »

27.04.2010

Полезные ссылки (12.04.2010)

.NET

  1. The Evolution Of C# — The first release of C# (C# 1.0) was all about building a new language for managed code that appealed, mostly, to C++ and Java programmers...
  2. Precision and accuracy of DateTime — The DateTime struct represents dates as a 64 bit number that measures the number of “ticks” since a particular start date. Ten million ticks equals one second...
  3. The performance implications of IEnumerable vs. IQueryable — It all started innocently enough. I was implementing a "Older Posts/Newer Posts" feature for my new web site and was writing code like this...

Читать полностью »

12.04.2010

Полезные ссылки (04.03.2010)

.NET

  1. The Weekly Source Code 51 - Asynchronous Database Access and LINQ to SQL Fun — You can learn a lot by reading other people's source code. That's the idea behind this series, "The Weekly Source Code." You can certainly become a better programmer by writing code but I think good writers become better by reading as much as they can...
  2. Thou Shalt not Iterate! : Part 2 — Last time we saw some interesting initialization constructs possible with LINQ. Hope some of you have tried it out. If not, it’s never too late. LinqPad is a good friend in need...

Читать полностью »

03.04.2010

Полезные ссылки (01.04.2010)

.NET

  1. Some Last-Minute New C# 4.0 Features — As I’m sure you know by now, we are done implementing C# 4. We’ve added support for interoperability with dynamic languages and legacy object models, named and optional parameters, the ability to “link” against interfaces from a Primary Interop Assembly, and my favourite feature, covariance and contravariance of interface and delegate types...
  2. Simplify Your Code with LINQ — I’m a big fan of LINQ and use it wherever I can to minimize code and make applications easier to maintain overall. I was going through a code file today refactoring it based on suggestions provided by Resharper and came across the following method...
  3. A C# implementation of the CallStream pattern — Dusan published this interesting post a couple of weeks ago about a novel JavaScript chaining pattern...
  4. LINQ: Single vs. First — I’ve witnessed and been involved in several discussions around the correctness or usefulness of the Single method in the LINQ API...

Читать полностью »

01.04.2010

Полезные ссылки (28.03.2010)

.NET

  1. Updated the CsvFileTester for Jet 4.0 — I was playing around building a tool to let me edit a database table in Excel, so I updated my CvsFileTester...
  2. Compare two XML Files using .Net — Many cases we need to validate staging and production data. Mostly the client have send only XML files(production) and we have to validate our end output(staging).In this tool, we Validate the schema and compare the datas...
  3. Adding the ForEach(Action) to IEnumerable — I return the original IEnumerable object to add 'chaining', something you can remove (i.e. void) if this capability is not required...

Читать полностью »

28.03.2010

Полезные ссылки (21.03.2010)

.NET

  1. Events get a little overhaul in C# 4, Part III: Breaking Changes — Now I’m here to tell you about some more in-your-face breaks that are a lot less subtle, and related to the binding change for += and -=. My hope is that anyone who actually sees these breaks will find this post and learn how to fix them. Let’s go...
  2. How to use String.Format in PowerShell? — Check out Formatting Types on the .NET Framework Developer's Guide or SteveX Compiled - String Formatting in C# (nice cheat sheet) for more examples...
  3. C# with keyword equivalent — There’s no with keyword in C#, like Visual Basic. So you end up writing code like this...
  4. Do not name a class the same as its namespace, Part Three — The reason we humans invented hierarchies in the first place is to organize a complicated body of stuff such that there’s a well-defined place for everything. Any time you see a hierarchy where there are two levels with the same name, something is messed up in the design of that hierarchy...
  5. Do not name a class the same as its namespace, Part Four — I said earlier that the fundamental reason for namespaces in the first place was organization of types into a hierarchy, not separation of two things with similar names. But suppose you are putting something into a namespace because you have two things that are of the same name and need to be kept separate...
  6. Convert Xml tree to a string quickly using .NET framework. — In web service enviroment, it is often necessary to convert the Xml tree to a string in order to calculate the hash or digital signature. NET framework provides several classes to parse XML document, each one has its own strength, here we investigate the difference of performance between them on my laptop. XmlUTF8TextReader is created using XmlDictionary.CreateTextReader() method with XmlReader interface. For XElement and XDocument...
  7. LINQ to Object Part #4: Querying Non- IEnumerable collections — In this article, I am going to show, how we could apply LINQ to query non-IEnumerable Collections...

Читать полностью »

21.03.2010

Полезные ссылки (14.03.2010)

.NET

  1. SQL Style Extensions for C# — Now you can use your favourite SQL functions inside C#, with the amazing new "SQL Style Extensions" class...
  2. Using PowerShell to demo PowerShell via PowerShellPoint! (aka “PowerPoint for PowerShell’ers…” or “We don’t need no stink’n PowerPoint to present PowerShell!”) — As I worked out my demos, I still needed to have some PowerPoint slides to point out key concepts and things like URLs. As I was putting the slides together something was bothering me. Why was I using PowerPoint? I'm going to be a session on PowerShell. Shouldn't I be using PowerShell? The first rule of the PowerShell club is to use PowerShell! That's the second rule as well...
  3. Strengthening your domain: Encapsulated collections — One of the common themes throughout the DDD book is that much of the nuts and bolts of structural domain-driven design is just plain good use of object-oriented programming. This is certainly true, but DDD adds some direction to OOP, along with roles, stereotypes and patterns. Much of the direction for building entities at the class level can, and should, come from test-driven development. TDD is a great tool for building OO systems...
  4. .Net, Native, P/Invoke marshaling just like magic… “Marshaling with C# Pocket Reference” (Think “Marshalling Guide for the Busy Dev Guy”) — I hate to say it, but I kind of suck at writing P/Invoke code. I just don’t do it enough, so end up cutting-n-pasting a good deal. sigh… I’ve been on the look out for a good Marshalling Guide for the Busy Dev Guy Guide...
  5. Do not name a class the same as its namespace, Part One — The Framework Design Guidelines say in section 3.4 “do not use the same name for a namespace and a type in that namespace”...
  6. Do not name a class the same as its namespace, Part Two — You take this code and run a third-party “decorator” tool over it that makes your class into a more colourful class...
  7. WPF and Text Blurriness, now with complete Clarity — The #1 complaint I hear about WPF (Windows Presentation Foundation) is that many fonts end up looking "blurry." It's a darned shame because really great applications like Evernote get criticized because of this one issue...
  8. LINQ to Object Part #2: Filtering and Sorting — I have created two classes for explanation purposes, Student and Hostel. The Student class has details about a student and the Hostel class has details about a hostel. Both classes have the property HostelNumber in common. I will be using this property to perform join operations in later articles. Both classes are shown below...

Читать полностью »

14.03.2010

Полезные ссылки (28.02.2010)

.NET

  1. Insert xml string into XmlDocument
  2. Thou Shalt not Iterate! : Part 1 — LINQ as we all know provides intrinsic data querying capabilities to the framework languages supporting LINQ. Going forward its an obvious way to code clean, and with growing number of LINQ providers (LINQ to SQL, LINQ to Entities, LINQ to XML, LINQ for Maps, and not to forget DryadLinq and pLinq for us Cloudy folks’ Parallel Computing needs, and so on) it looks to be the de facto standard for querying within dotnet framework languages...
  3. How to implement paging with LINQ — With large amounts of data, it is not a good practice to pull all records from database when you are showing a fraction of them in one page. It is always recommended to use data on demand approach...
  4. LINQ to XML Part 1 - XAttribute Class — In this article, I will give explanation on XAttribute class. This class is used to construct Attributes in XML Elements. After completing this article, you will learn the purpose of XAttribute class and how to use it in LINQ to SQL...
  5. LINQ to XML Part 4: Different way of Parsing string to create XML tree — In this article, I will show different way of parsing string to create XML tree using LINQ to XML...
  6. LINQ to XML Part 5: Catching Parsing Exceptions — This is a very high level article which will explain; how to handle exception in parsing XML using LINQ to XML...

Читать полностью »

28.02.2010

Полезные ссылки (21.02.2010)

.NET

  1. Excel Open XML & LINQ Part I — In the next few posts I'll roll out a little project for Excel that uses Open XML and LINQ. The scenario for this little Office solution has to do with my massive collection of music. I've collected over 1000 albums of music both from ...
  2. 60+ .NET libraries every developer should know about. — Every good developer knows never to re-invent the wheel, especially if there is software out there that has been tested by others, and has an established track record. As a developer using the .NET framework I’ve found some of these libraries invaluable, so I’m sharing them for some of the other dev’s out there with a brief outline of how to use...
  3. Linq Distinct and Custom Object Sort — The main purpose of this post is to show what's required in the main 3 .net languages for filtering and sorting.
    I decided to put these two problems together because they presented themselves to me simultaneously...

Читать полностью »

21.02.2010

Полезные ссылки (16.02.2010)

.NET

  1. Rollup Extension Method: Create Running Totals using LINQ to Objects — Recently, I had need for a new extension method for IEnumerable, which I call "Rollup". This extension method is sort of a cross between the Select and Aggregate extension methods. Like Select, when using this extension method you write a lambda expression to project the new value in a new collection. Unlike Select, in the projection lambda expression, you are passed the projected value for the immediately preceding element...
  2. LINQ: ToLookup vs ToDictionary — Some people are not sure of the difference between ToLookup vs ToDictionary LINQ methods...
  3. Architect 3 : Building Data Access Layer Using Microsoft Enterprise Library 4.1 — You have a Customer table with three fields: ID, LastName and FirstName. You are building a data access layer to retrieve all the records from the Customer table and return the result as a collection of Customer objects...
  4. Extension methods as default interface method implementations — One of my comments in the 2nd edition of the .NET Framework design guidelines (on page 164) was that you can use extension methods as a way of getting default implementations for interface methods. We've actually begun using these techniques here on my team...
  5. Tip 10 : Returning the first part of a string with delimiter — You have a string delimited by underscore such as 1stPart_2ndPart_3rdPart and want to return the first part of the string only...
  6. Windows PowerShell Quick Reference Guide Updated — Quick reference guide to commonly-used Windows PowerShell commands. For best results, open the file in Microsoft Word, print the contents to legal-sized paper (8 inches by 14 inches), and fold the resulting printout in half, making a four-page booklet...
  7. Enumerate Enum flags — produces a list of the selected flags in an enum that was built using [Flags]...

Читать полностью »

16.02.2010

Полезные ссылки (07.02.2010)

.NET

  1. Json in .NET — I use Json all the time, but I feel like its super annoying in .NET. Typically Id call some web service that returns Json. In .NET it seems like the best thing to is to define a data contract and use the DataContractSerializer...
  2. Performance: Using LCG to copy property values of two objects — Today I gave last performance boost to my property values copying mechanism. I would like to thank my readers Ron and David to remind me Lightweight Code Generation (LCG) and pointing me out aussie bloke blog entry Generic copy object using Lightweight Code Generation. In this posting I will show you last performance boost and put down a summary about my experiment...

Читать полностью »

07.02.2010

Полезные ссылки (04.02.2010)

.NET

  1. Back to Basics - Keep it Simple and Develop Your Sense of Smell - From Linq To CSV — I spoke to my friend and they said it was cool to share their code for this post. This post isn't meant to be a WTF or OMG look at that code, as is it meant to talk about some of the underlying issues. There's few things going on here and it's not all their fault, but it smells...
  2. Hanselminutes Podcast 198 - Reactive Extensions for .NET (Rx) with Erik Meijer — My one-hundred-and-ninety-eighth podcast is up. I sit down with Erik Meijer from the Cloud Programmability Team to hear about the Reactive Extensions for .NET (Rx). Rx is a library for composing asynchronous and event-based programs using observable collections. Sound boring? Not even a little. Rx is a prescription for awesome...
  3. Some Better-Written Custom String Methods using C# — In my daily web-surfing, I often stumble upon snippets of C# code posted by people. Usually, I can tweak it a bit. Sometimes, I can tweak it a lot. I usually post a quick comment to the site offering it. Today, I came upon some code that was so bad --- which the author said was from his forthcoming book! --- more drastic measures must be taken...
  4. Difference is comparison when using equals method or Double Equal to operator — There are normally two ways to compare 2 objects. One by using == operator and by using the equals method. But these two are not same in the way they implements the comparison...
  5. Style follows semantics — To me, this comes down to the question “is Bar useful solely for obtaining its value, or also for its side effects?” The stylistic choices should typically be driven by a desire to clearly communicate the semantics of the program fragment...

Читать полностью »

04.02.2010

Полезные ссылки (31.01.2010)

.NET

  1. Sample Reflection.Emit code for using exception filters from C# — In this post, I mentioned that one way to use exception filters from C# code is to generate them with Reflection.Emit. Personally I usually prefer static compilation (even post-build assembly merging or rewriting) – there’s really nothing here that necessitates dynamic code generation, but I can understand the desire to avoid complicating the build process...
  2. Custom String Methods using C# — Below are some custom string methods for C# that are found in VB.NET and various scripting languages: PCase, Replace, ToSingleSpace, CharCount, Reverse, Left, Right, and IsPalindrome. These methods are useful in common string operations. Since the .NET Framewrk does not natively ...
  3. String List of enum Names — Code snippet showing how to populate a List of enum names using LINQ...
  4. Playing With LINQ: Getting Interface Property Implementations — Today, my friend Nuno was writing some code to get the PropertyInfos of a class implementation of an interface...
  5. The beauty of C# and Linq — Today I faced the following challenge to solve: return all possible combinations of three source collections...
  6. Don't Use Try/Catch — Exception handling has been talked about a lot over the last decade and a half. However, despite a general consensus on how to properly handle exceptions, a divide on usage continues to exist. Improper exception handling is easy to spot, easy to avoid, and is a simple code (and developer) quality metric. I know absolute rules come off as close minded or exaggerated, but as a general rule...
  7. Extension Methods on Types You Own? — It’s no secret that I’m a fan of using extension methods to make code more concise and expressive. This is particularly handy for enhancing APIs outside of your control, from the base class library to ASP.NET MVC and SharePoint...

Читать полностью »

31.01.2010

Полезные ссылки (24.01.2010)

.NET

  1. D.C. and the Wrapper Factory — A while ago I wrote about using reflection for testing non-public members. Since then I've been increasingly annoyed by the repetitive nature of that approach. At some point it occurred to me that it should be possible to automate the mundane and boring task of writing the same kind of reflection code over and over again. However, there are two options for code generation each with some severe disadvantages. You can generate source code which means coupling the solution to a particular programming language and build system...
  2. Selecting Static Results with Dynamic LINQ — Dynamic LINQ (DLINQ) is a LINQ extension provided in the VS 2008 Samples. Scott Guthrie provides a good overview here: Dynamic LINQ (Part 1: Using the LINQ Dynamic Query Library), but the executive summary is that it implements certain query operations on IQueryable (the non-generic variety)...
  3. Quick Tip: Parse String to Nullable Value — When you’re dealing with a system like SharePoint that returns most data as strings, it’s common to want to parse the data back into a useful numeric format. The .NET framework offers several options to achieve this, namely the static methods on System.Convert and the static Parse() methods on the various value types. However, these are limited in that they turn null...
  4. Community Links LVIII
  5. RTM’d today: CLR via C#, Third Edition

Читать полностью »

24.01.2010

Полезные ссылки (21.01.2010)

.NET

  1. What’s the difference between a destructor and a finalizer? — Both are mechanisms for cleaning up a resource when it is no longer in use. When I was asked this, at first I didn’t think there was a difference. But some Wikipedia searches turned up a difference; the term “destructor” is typically used to mean a deterministically-invoked cleanup, whereas a “finalizer” runs when the garbage collector says to run it...
  2. Constructor over-injection anti-pattern — I’m interested in structure. We hear lots of talk about convention over configuration. I’m all for structure over convention (over configuration). This post is about laying out some code that is an anti-pattern. It uses 100% constructor injection. This code makes it easy for a container to bootstrap the construction of the objects...
  3. Constructor over-injection smell – follow up — Constructor over-injection, therefore, is a code smell, I believe. Without concrete do’s and don’ts, I believe it doesn’t deserve the explicit title of “anti-pattern”...
  4. Extension Method String.Reverse
  5. How to create a simple Extension method — ...How to create a simple Extension method. A simple example.Imagine for example the following scenario. You have an assembly created by someone else. This assembly contains a class called Products, this class has a field for the ProductName and for the ProductPrice

Читать полностью »

21.01.2010

Полезные ссылки (17.01.2010)

.NET

  1. Replace Foreach with LINQ — One of the best ways to start Thinqing in LINQ is to find places where you can replace iterative loops with LINQ queries. This won’t necessarily make your applications any faster at the moment, but by taking advantage of the declarative syntax, it will allow you to change your underlying implementation (ie. parallelize it with PLINQ) easier in the future. Recently, I came across some code that mimicked creating a control array as we used to have in VB6 by iterating over a list of fields and adding controls to a form adding the index to the end of the field name. As the fields are being added,we hook up event listeners along the way...
  2. Making Your Own 8K Homegrown Inversion of Control Container — If you develop software, chances are you you've worked with Inversion of Control containers and the Dependency Injection pattern. Many frameworks exist to address how to marry concrete implementations to abstract classes and interfaces...

Читать полностью »

17.01.2010

Полезные ссылки (14.01.2010)

.NET

  1. Quick Tip: Embedding and Accessing Schemas in .NET — I have a project I'm working on that requires the use of some extensive XML manipulation. While XML can be very powerful, XML without a schema is like JavaScript objects: no strong typing and the wild west as far as standards are concerned. A good, solid XML document will have a valid schema to validate against...
  2. Continuing to an outer loop — When you have a nested loop, sometimes you want to “continue” the outer loop, not the inner loop. For example, here we have a sequence of criteria and a sequence of items, and we wish to determine if there is any item which matches every criterion...
  3. 16 Ways To Create IObservables without implementing IObservable — The Reactive Extensions for .Net offers plenty of ways to create IObservables...
  4. Why Can't I Access A Protected Member From A Derived Class? Part Six — Reader Jesse McGrew asks an excellent follow-up question to my 2005 post about why you cannot access a protected member from a derived class. (You probably want to re-read that post in order to make sense of this one.)...
  5. Building custom LINQ expressions made easy with DynamicQueryable. — A colleague of mine recently called me out on the fact that I haven't blogged in … oh about a year and a half. Well it’s 2010 now and resolution season is in full swing so here’s my attempt at getting back on the ball (no promises though)...

Читать полностью »

14.01.2010

Полезные ссылки (10.01.2010)

.NET

  1. Getting Last Quarter end and Next Quarter End Extension methods — I wrote these utility extension methods to get the previous quarter end/month end and next quarter end/month end values for Financial calculations...
  2. How to get out of the GAC all the registered assemblies — You know how annoying the GAC shell extension makes it to access the actual assemblies...
  3. Simplified Many-To-Many Relationships with LINQ to SQL — Common questions when learning LINQ to SQL revolve around many-to-many relationships. This post will describe a scenario that needs queries across many-to-many relationships, show the data and the LINQ to SQL representation of that data, explain the query, and finally output the results...

Читать полностью »

10.01.2010

Полезные ссылки (07.01.2010)

.NET

  1. More LINQ with System.Interactive – Functional fun and taming side-effects — Being rooted in query comprehensions as seen in various functional programming languages (including (the) pure one(s)), one would expect LINQ to have a very functional basis. Indeed it has, but being hosted in various not functionally pure languages like C# and Visual Basic, odds are off reasoning about side-effects in a meaningful and doable manner. As we’ve seen before, when talking about the Do and Run operators, it’s perfectly possible for a query to exhibit side-effects during iteration. You don’t even have to look that far, since every lambda passed to a query operator is an opportunity of introducing effects. The delayed execution nature of LINQ queries makes that those effects appear at the point of query execution. So far, nothing new...
  2. Serializing ArrayLists of Disparate Objects to XML Strings — Since then, while reading a book about XML, I learned of even more power in the .Net XML Serialization libraries*. In addition to serializing objects and collections of objects you can serialize ArrayLists which can contain disparate or non-homogeneous objects. Techno-babble translation: Disparate and non-homogenous mean 'different'...

Читать полностью »

07.01.2010

Полезные ссылки (03.01.2010)

.NET

  1. Streaming OLAP with the Reactive Extensions (RX) for .Net — Streaming OLAP is something that comes up over and over again in the “CEP space” – using the Reactive Extensions for .Net this demo shows the basics; filtering, grouping, aggregates, and concurrent queries...
  2. More LINQ with System.Interactive – Sequences under construction — In order to perform operations over sequences using various combinators and operators, it’s obviously a prerequisite to have such sequences available. While collection types in the .NET Framework implement IEnumerable (or the non-generic counterpart, bridgeable to LINQ using the Cast Standard Query Operator), one often wants to construct sequences on the spot. Moreover, sequences often should have a lazy nature as their persistence in memory may be problematic or infeasible (infinite sequences). For all those reasons, constructor operators come in handy...
  3. More LINQ with System.Interactive – Exploiting the code = data relationship — Code and data are very similar animals, much more similar than you may expect them to be. We can approach this observation from two different angles, one being a machine-centric view. Today’s computers are realizations of von Neumann machines where instructions and data are treated on the same footage from a memory storage point of view. While this is very useful, it’s also the source of various security-related headaches such as script or SQL injection and data execution through e.g. stack overruns (Data Execution Prevention is one mitigation)...
  4. More LINQ with System.Interactive – More combinators for your Swiss Army Knife — Combinators are at the heart of LINQ’s expressive power, allowing sequences to be combined into new ones. In earlier posts, I’ve shown the essence of monadic computation through the following illustration...
  5. The Essence of LINQ – MinLINQ — Before reaching the catharsis in the “More LINQ with System.Interactive” series over here, I wanted to ensure a solid understanding of the essence of LINQ in my reader base. Often people forget the true essence of a technology due to the large number of auxiliary frameworks and extensions that are being provided. Or worse, sometimes a sense for the essence never materialized...
  6. LINQSQO v4.0 and MinLINQ v1.0 Now Available for Download — Introduced in my previous blog post on The Essence of LINQ – MinLINQ, the first release of this project is now available for reference at the LINQSQO CodePlex website at http://linqsqo.codeplex.com. Compared to the write-up over here in my previous post, there are a few small differences and caveats...
  7. The IDisposable Dispose Pattern — This is a full sample of a mostly safe way to implement IDisposable in C# (or .NET in general). The Finalizer method should make up for clients that forget to call Dispose(). Dispose() should always be re-entrant and should only do the work it is required...
  8. GridView using LINQ and Convert datetime to shortdate in LINQ. — In this article you will learn how to create a hyperlink in GridView using LINQ and Convert datetime to shortdate in LINQ...
  9. Covert color to Hex using C# — So you want convert a .NET color to hex or a hex color to .NET color. Well, its very easy to do this. We won’t have to write lots of code or a special class for it. Thanks to ColorTranslator class. We can convert between these with only 1 line of code. Here’s how its done...
  10. LINQ to XML with Hierarchical XML, Optional Elements, and Namespaces — Recently I had an interesting task to consume a particular XML document and populate a C# object from it. The structure of the XML document looked roughly like this...
  11. Fewer smaller .Net DLLs vs less large DLLs — Generally speaking it is better to have less large DLLs versus many smaller DLLs for the following reasons...

Читать полностью »

03.01.2010

Полезные ссылки (27.12.2009)

.NET

  1. Sort List and use Array.ForEach()
  2. LINQ Part 2 – LINQ for XML — Now that we’ve got some basics of LINQ for XML. I think we should also look into group by queries in LINQ for XML. My motivation here would be to find the total price of books for each of the genre. For this, I should write LINQ something similar to this below...
  3. LINQ Part 3 – LINQ for SQL — Now that we have some basics for LINQ for XML. Lets get deep into some using LINQ against Relational databases, aggregate functions, like group by and sort. The database we will be using is books, this can be obtained from this page. Once you download the database, mount it in SQL Server by attaching this mdf file. Once the mdf file is mounted, we can start with the following steps to do our first LINQ to SQL console program...
  4. Using LINQ and reflection to find matching properties of objects — As a side product of some experiments I wrote simple LINQ query that matches properties of two objects and returns these properties as list. The code I wrote is pretty simple and I packed it for you as method...
  5. More LINQ with System.Interactive – Getting Started — To get the Reactive Extensions, which include System.Interactive, visit the landing page on DevLabs over here. Downloads are available for .NET Framework 3.5 SP1, .NET Framework 4.0 Beta 2 and Silverlight 3. In this series, I’ll be using the “desktop CLR” distributions from Visual Studio 2008 and Visual Studio 2010...
  6. More LINQ with System.Interactive – The Ultimate Imperative — LINQ can be quite deceptive on a first encounter due to the lazy island it provides in an otherwise eagerly evaluated language like C# and Visual Basic. Simply writing down a query doesn’t cause it to be executed, assuming no eager operators like ToArray, ToList or ToDictionary are used. In fact, the composition of sequences lies at the heart of this since sequences can evaluate lazily, on demand when calling MoveNext on an enumerator. Iterators are a simple means to provide such a sequence, potentially capturing a sea of side-effects interleaved with the act of producing (or “yielding”) values...
  7. More LINQ with System.Interactive – Exceptional Exception Handling — Under regular circumstances, one expects sequences to produce data in response to iteration. However, it’s perfectly possibly for an iterator (or any enumerable object) to throw an exception in response to a MoveNext call. For example...
  8. Strip the last word from a string — A string extension method that strips the last word from the end of a string...
  9. My favorites .Net development toolkits — Rabbit MQ is a scalable message/queue AMQP server with WCF/C# client (free)...

Читать полностью »

27.12.2009

Полезные ссылки (20.12.2009)

.NET

  1. Array.ForEach method — simple example for the Array.ForEach method...
  2. C# Delegates, Anonymous Methods, and Lambda Expressions – O My! — Delegates, anonymous methods, and lambda expressions can be very confusing in .NET. I think this is proven in code like the example below. Which one of the calls to First compiles? Which one returns the answer we are looking for; namely the Customer with the ID 5. The answer, incidentally, is that all six calls to First not only compile, but all find the correct customer and are functionally equivalent. If you are at all confused as to why this is true, this article is for you...
  3. My MonoTouch ebook is out - Build iPhone apps with C# and run on the iPhone — This Wrox Blox is for .NET developers who want to learn to develop for the iPhone with C# using MonoTouch and MonoDevelop on the Mac. The iPhone is the smartphone leader in mindshare and the amount of money spent on applications. This lead in money spent on applications is expected to grow over the next several years. Objective-C is the native language for iPhone development. .NET developers, who work in the largest general area of development frameworks, have looked at iPhone developers...
  4. Effectus: Building UI based on conventions — Each feature have a Presenter (business logic for the feature), a View Model, which is directly bound to the View and is the main way that Presenter has to communicate with the View. The main responsibility of the Model is to be bound to the UI, and allow the presenter to update it, but it is not quite enough...

Читать полностью »

20.12.2009

Полезные ссылки (17.12.2009)

Web

  1. 20 Best jQuery Tips and Tricks Collection — jQuery adds amazing effects to your designs. With the beauty and attraction of animations and effects comes the overhead to speed and performance. A well optimised and efficiently crafted jQuery design can impress result in a lasting effect on the users. Create efficient and optimized jQiuery designs with this collection of jQuery tips and tricks colelction, which is a compendium of several easy ways to generate commonly used efefcts...
  2. soapUI 3.5 beta1 - The Protocol Release
  3. Using setTimeout to Delay Showing Event-Delegation Tooltips — In my last two tutorials, I explained how to use event delegation for showing and hiding tooltips. In a comment on the first one, Jan Aagaard asked how we might go about enhancing the script by adding a small delay before showing a tooltip. The answer lies with two JavaScript functions, setTimeout() and clearTimeout()...
  4. Binding Multiple Events to Reduce Redundancy with Event-Delegation Tooltips — Last time I showed how to use event delegation to create a simple tooltip for a huge number of elements without running into the problem of binding an event handler to all of those elements. In this tutorial, I'm going to refine that tooltip script...
  5. 50+ jQuery Plugins for Form Enhancements — Easy user interaction and data collection is really a key functionality on most websites and web applications. Providing users high quality and intuitive input forms may be just what is needed to make your users take the time to fill in and submit the information you’re trying to collect. In this article I have collected a number of really essential jQuery Form Enhancements. A few cheat sheets have been added as well...
  6. How to parse JSON from C# — WCF is cool because it is very very versatile. It is very well architected. One of the things WCF comes with is very good support for very thin clients, i.e. JavaScript, JSON...
  7. Feature List jQuery Plugin — Feature List requires very simple markup and can be easily styles using CSS. It also offers configuration options for customizing the behavior such as: specifying the default tab; enabling or disabling pause when the mouse hovers over the tabs; and setting transitions delays...
  8. 10 CSS Snippets to Save Precious Time — Today, I have compiled a set of 10 CSS snippets that can save you a lot of time and effort. These codes are needed frequently when developing CSS-based websites or themes. Just bookmark these codes (Ctrl + D) so that you don’t have to look for them on the Internet every time...
  9. A free standing ASP.NET Pager Web Control — Paging in ASP.NET has been relatively easy with stock controls supporting basic paging functionality. However, recently I built an MVC application and one of the things I ran into was that I HAD TO build manual paging support into a few of my pages. Dealing with list controls and rendering markup is easy enough, but doing paging is a little more involved. I ended up with a small but flexible component that can be dropped anywhere. As it turns out the task of creating a semi-generic Pager control for MVC was fairly easily...

Читать полностью »

17.12.2009

Полезные ссылки (13-12-2009)

Web

  1. Styling HTML Lists with CSS: Techniques and Resources — If you’re new to CSS, this article should provide a good overview of the different types of lists available, as well as some of the browser quirks that occur in relation to HTML lists, with some helpful advice that should prevent those quirks from becoming major road blocks to good design...
  2. Use Less to reduce CSS clutter! — Reading a post by Phil Haack, I learned about a neat technology called LESS that helps reduce the amount of CSS and duplicated code you have to create. It was originally a Ruby Gem but now has a .Net port called .Less which can be found at...

Читать полностью »

13.12.2009

Полезные ссылки (10.12.2009)

.NET

  1. Coming soon: Jeffrey Richter’s CLR via C#, Third Edition
  2. Demystifying LINQ Aggregates — This post aims to dissect the power that exists in the Aggregate LINQ operator. I have realized that most programmers use it sparingly and have decided to put a couple of examples to clarify how you can use the Aggregate operator to perform a few tricks. The screenshot below relates to the small examples that follow...
  3. C# Code to send an email — I’ve been doing some testing of email enabled lists, and I needed to send quite a lot of emails, so I wrote a little console app to do it. Here’s the core of the code I used, in case I need it again, or it’s useful to someone. It uses System.Net.Mail...
  4. LINQ query operators and null lists — One of my pet peeves with the LINQ extension methods is their inability to handle null source lists. For example, this will throw an ArgumentNullException...
  5. Query transformations are syntactic — As you probably know, there are two ways to write a LINQ query in C#. The way I personally prefer is to use the “query comprehension” syntax...
  6. Free (reg-ware) PowerShell v1 eBook (593 pages) – “SAPIEN’s Windows Powershell V1.0: TFM” — With the recent release of Windows PowerShell v.2 and the immanent publication of our well regarded Windows PowerShell v.2 TFM book by Don Jones and Jeff Hicks, SAPIEN is releasing our Windows PowerShell v.1 TFM eBook as a FREE download to the public. Even though this eBook is for version 1 of PowerShell, the book still contains loads of valuable information about PowerShell’s core workings and cmdlets...
  7. More On The Death of If-Else — Following along with Aaron’s post using C#, we’d start with a list of Channel objects...
  8. A LINQ Tutorial: Adding/Updating/Deleting Data — A tutorial that walks through adding/updating/deleting data in your database with LINQ to SQL while keeping your class relationships (M:M, 1:M, and M:1) synchronized...

Читать полностью »

10.12.2009

Полезные ссылки (06.12.2009)

.NET

  1. Differences between using the ‘Convert’ class vs. casting (Part 2 of 2) — In the last post I was puzzled by what I thought were some inconsistencies between using the cast operator and Convert.ToInt32 when trying to convert an object typed as a decimal to an int...
  2. Better than Contains() — Sometimes you wish you could do better than the method you need to use. Case in point: Contains(). It is a fine method and is meant for more than strings. If you need custom logic to decide if two objects are equal or “the same” for the sake of sorting or searching you write your own comparer and pass that in. So, I don’t have anything against the Contains()...

Читать полностью »

06.12.2009

Полезные ссылки (03.12.2009)

.NET

  1. LINQ Part 1 – LINQ for XML — It looked like we should look a bit about LINQ fundamentals before we actually get into the core programming for our Silverlight twitter application. So we’ll look into LINQ for a few more posts, then we will proceed with our usual Silverlight stuff. Line INtegrated Query allows us to use Query language to select data from almost any type of data sources like XML, SQL, Objects, etc.... For more information about LINQ, visit this page, I don’t want to get deep into the details. You can get the sample XML files...

Читать полностью »

03.12.2009

Полезные ссылки (29.11.2009)

.NET

  1. Flexible Enumerations — Sometimes enumerations in .NET just don’t cut it. In the end they’re just a numeric value to which a piece of string metadata is attached to some of the values. Consider the following enumerations...
  2. Sample: Get Calendar Data Using Exchange Web Services (C#) — When someone asked my former manager David Treadwell what he did on a daily basis his answer was “Go to meetings and delete email”. Unfortunately that often describes my life as well. It is always challenging to manage your time. I want to ensure I’m spending enough on technology, people, customers...
  3. Windows 7 Ribbon for WinForms – Yes you can… — Windows Ribbon for WinForms is a .NET wrapper for Windows 7 Ribbon control. It will allow WinForms developers to use Microsoft Windows 7 Ribbon control in their WinForms applications. The project includes the library RibbonLib, which adds support for Windows Ribbon to WinForms application and sample applications that demonstrates the use of the library and the different Ribbon features available...

Читать полностью »

29.11.2009

Полезные ссылки (22.11.2009)

Web

  1. Fiddler – How to mimic a specific browser version request? — Fiddler tool doesn’t need any introduction, it is a great tool to debug a lot of client side issues with Internet Explorer, and other browsers as well . There are a few times when you have a different version of a browser, and you want to know what the server renders for different version of browser...
  2. How to troubleshoot slow Page Rendering in ASP.NET? — Before I answer this question, let us have a quick refresher. Answer this question diligently… Is Page_Render in ASP.NET really an EVENT? A BIG ZERO if you have said YES...
  3. Designing CSS Buttons: Techniques and Resources — Before we explain how to style buttons, let’s clear up a common misconception: buttons are not links. The main purpose of a link is to navigate between pages and views, whereas buttons allow you to perform an action (such as submit a form)...
  4. Create astonishing iCal-like calendars using jQuery — I wanted to create a calendar that would be similar to the iPhone Calendar application (or, if you want, to the little calendar on the left bottom corner in iCal). And I also wanted to keep the code as little and sweet as possible...
  5. Text Effects In jQuery — jQuery is not just about Menus and Animation Effects. With jQuery you can also create attractive text effects and play with the text to communicate well with the users. With this collection, you can create text gradients, text fly effects, text glow...

Читать полностью »

22.11.2009

Полезные ссылки (15.11.2009)

.NET

  1. Useful Query Editor Query - 1 — This is the first of possibly a series of useful queries that can be added to the Query Editor (available in PowerCommands for Reflector addin). I’m hoping that some of the queries that I have created and found useful end up being useful for you too...

Web

  1. 55 Decisive Useful jQuery Tutorials — I would like to present an well-aware language best tutorials, as you know jQuery is a lightweight JavaScript library that accentuate communication between JavaScript and HTML, there is advanced features and strong support are common influence for developers preferring jQuery then JavaScript...
  2. Microsoft Visual Round Trip Analyzer — If you are a web developer, and haven’t heard of VRTA yet, you should try downloading it from here. It is free and it depends on Microsoft Network Monitor. To have the real knowledge about this VRTA, read the following article - 12 Steps To Faster Web Pages With Visual Round Trip Analyzer...

Читать полностью »

15.11.2009

Полезные ссылки (12.11.2009)

.NET

  1. PowerPivot Jump Start! — As you may already know, the new name for Project Gemini is PowerPivot and the official names are PowerPivot for Excel and PowerPivot for SharePoint...
  2. Post #7 – Serializing Dictionary to/from XML — I spent a bit of time searching for the magic of how to use XmlSerialize with the Dictionary type this morning and thought I’d share the easy-to-use result...
  3. The Best Culture Invariant Format for DateTime — If you are looking to display how to display DateTime as text without causing confusion to users in different countries then good choices is either "o" or "r"...

Читать полностью »

12.11.2009

Полезные ссылки (08.11.2009)

.NET

  1. Casting lists using LINQ #2 — In my previous post I showed the LINQ way to cast List<SomeDeriveType> to List<SomeBaseObject>...
  2. C# 4.0 new features: Named and Optional arguments — Optional arguments: This feature allows you to omit arguments when calling methods. This is done by defining a method with assigning default values to parameters. For better understanding, let's take a look at the below example...
  3. Jumping the trampoline in C# – Stack-friendly recursion — Recursion is a widely known technique to decompose a problem in smaller “instances” of the same problem. For example, performing tree operations (e.g. in the context of data structures, user interfaces, hierarchical stores, XML, etc) can be expressed in terms of a navigation strategy over the tree where one performs the same operation to subtrees...

Читать полностью »

08.11.2009

Полезные ссылки (05.11.2009)

.NET

  1. Introducing Debugging for MonoTouch — Perhaps the most important new feature in MonoTouch 1.2 is that it now has a debugger that supports debugging on both the iPhone simulator and on the iPhone/iPod Touch...
  2. Memory leaks and profiling with .Net — I wrote some moths ago an article about the GC and highlighted some particularities (unsafe and unmanaged code, disposing and finalizing, etc)...
  3. Use Extension Methods to Phase Out a Bad API — I’m working on a project for a customer where we are trying to get a new version of a product out the door. We need to add some features to an existing API, but don’t want to break the existing API for existing customers. Common story, common place to be...
  4. CRUD operations using LINQ — I will use the AdventureWorks database to demonstrate how to perform CRUD operations using LINQ. You can use LINQPad (a free tool) to execute your C# statements without going through the hassle of writing a program using Visual Studio 2008...
  5. Now Available: patterns & practices Application Architecture Book — The Microsoft Application Architecture Guide, 2nd edition, is now available on Amazon and should be available on the shelf at your local bookstores soon. The PDF was downloaded ~180,000 times. This is the Microsoft platform playbook for application architecture. You can think of it as a set of blueprints, and as your personal mentor for building common types of applications on the Microsoft platform: mobile, RIA, services, and Web applications...

Читать полностью »

05.11.2009

Полезные ссылки (01.11.2009)

Web

  1. jQuery UI Dialog: Part 2 – The Modal Dialog — This is part 2 of my series on the jQuery UI Dialog. Part 1 – The Default Dialog covered the most basic usage of the dialog widget. In this second part I will demonstrate a simple modal dialog...
  2. Constraining Tables with CSS — For example, consider the classic master/detail view that we often find in software applications, in which items are shown in a summary table and each row provides a link to allow users to see more detail about the item...
  3. Calling asp.net webservice from JQuery — Today I was trying to call ASP.Net web service from JQuery. I thought it was easy first. But when tried implementing them I felt the difficulty. I don't had this problem while calling Ajax enabled WCF service from JQuery. Hence I did a small Bing and found out some useful tips to share...

Читать полностью »

01.11.2009

Полезные ссылки (29.10.2009)

.NET

  1. .NET RIA Services Overview — Observing tendency in application development, you can see a clear regularity which shows that a lot of applications have being developed in Internet instead of the desktop way. This tendency is taking place in the last years because of the opportunity to create more interactive web applications. Evolution of JavaScript, Silverlight, Flash, etc. makes it possible. Now we see that many web applications do not receive a personal page when you access it, but load additional data thanks to more web server references. Such an approach allows us to avoid page reloads. So, web-based applications are considered more interactive and can provide more responsive interface...
  2. WPF 4 (VS 2010 and .NET 4.0 Series) — WPF (Windows Presentation Foundation) is one of the core components of the .NET Framework, and enables developers to build rich, differentiated Windows client applications. WPF 4 includes major productivity, performance and capability improvements – in particular in the areas of Controls, XAML, Text, Graphics, Windows 7 integration (multitouch, taskbar integration, etc), Core Fundamentals, and Deployment. This is the first of several posts I’ll do over the coming months about some of the improvements and new features...

Читать полностью »

29.10.2009

Полезные ссылки (25.10.2009)

Web

  1. Kwicks for jQuery – Horizontal Animated Menu — Menu of a web page is the most important and maybe the most clicked link on your web page. Do you want your menu look sexy with an awesome animation on your website? Follow me, I will walk you to the final result of using Kwicks – jQuery Plugin...
  2. Live Preview with jQuery — In this post I want to explain How To Implement Live Content Preview with jQuery. This is very basic jquery tutorial using keyup() element...
  3. Best jQuery iPhone Style Plugins — Unleash the power of jQuery on iPhone and create impressive iPhone style cool effects and widgets with these jQuery plugins...
  4. Parsing JSON in JavaScript — There are times when your web services are not returned as pure JSON objects but rather the string representations of JSON. So we will have to parse JSON string to JSON object...
  5. The Ultimate Guide to Creating a Design and Converting it to HTML and CSS — This screencast will serve as the final entry in a multi-part series across the TUTS sites which demonstrates how to build a beautiful home page for a fictional business. We learned how to create the wireframe on Vectortuts+; we added color, textures, and effects on Psdtuts+; now, we’ll take our completed PSD and convert it into a nicely coded HTML and CSS website...
  6. 14 jQuery Plugins for Enhanced Content Viewing — Whether you need to display content within a limited amount of space or you just want to make a section of your website more engaging, jQuery is an excellent solution. With jQuery you can easily create accordion style content boxes, image galleries, and content sliders. Here are 14 excellent jQuery plugins for adding this type of functionality to your site...

Читать полностью »

25.10.2009

Полезные ссылки (18.10.2009)

Web

  1. jQuery Selectors — n this article I will not be discussing on how to write selectors and their usage in jQuery but will point you to two very useful tools which will help you in getting the right selector the very first time.But before that lets list down the various type of selectors that we can use in our jQuery code.Following is the list of various type of selector...
  2. Using jQuery To Create Stunning Tooltips in your ASP.NET Applications — I’ll be focusing some future articles on these tools, but this article will concentrate on how to create stunning tooltips using this plugin. The end result in this article will show you how to create these tooltips using dynamic data by using jQuery’s Ajax functionality. The end result will look something like this...
  3. 10 Fresh jQuery Tutorials to Enhance Navigation Menus — A few years ago, when designers wanted to add cool effects to the navigation of a website they used Flash. We all know the types of problems that caused. Now with the growing popularity of javascript frameworks like jQuery, those same types of “Flash-like” effects can be achieved without Flash. Here are 10 jQuery tutorials and techniques to enhance your website’s navigation and menus...
  4. Learning Flex – Working with Web Services — Flex applications can use web services that are defined by a WSDL (web Service Description Language) an XML based standard that defines available operations and possibly data types used by the operations...
  5. Announcing Microsoft Ajax Library (Preview 6) and the Microsoft Ajax Minifier — In addition to the client library improvements, we also today released a new (free) Microsoft AJAX Minifier tool. This tool allows you to substantially improve the performance of your websites by reducing the size of your JavaScript files. It can be run both as a command-line tool, and also ships as a Visual Studio MSBuild task that you can integrate into your VS projects to automatically minify your JavaScript files whenever you do a build...
  6. ASP.NET MVC 1.0 Scripts Available on Microsoft CDN — A little while ago, Scott Guthrie announced the launch of the Microsoft Ajax CDN. In his post he talked about how ASP.NET 4 will have support for the CDN as well as the list of scripts that are included...
  7. Creating Beautiful Dialogs Using JQuery UI — Dialog boxes are frequently used in web applications to provide additonal information to the user. Dialog boxes are not hard to create but creating attractive draggable and stretchable dialog boxes is hard. In this article we are going to demonstrate how to use JQuery UI library to create attractive dialog boxes...

Читать полностью »

18.10.2009

Полезные ссылки (15.10.2009)

.NET

  1. The Application Architecture Guide 2.0 Is Here! — The Application Architecture Guide 2nd Edition is finally available! The complete guide is hosted on MSDN here. We’ve sent the guide off to MS Press for printing, so the printed version should be available from your favorite bookstore soon...
  2. How to iterate over contained controls to set a common event handler (Click) in .NET — The requirement was to assign a click event handler to all Label Controls contained in a .NET User Control. This is a simple technique but I found there was no good documentation on how to do this...
  3. PowerCommands for Reflector 1.3 and Introducing Query Editor — This morning I moved out the changes for PowerCommands for Reflector 1.3. There are now 26 commands in the addin. The two newest being ‘Open in Reflector’ and ‘Query Editor’...
  4. LINQ To SQL Tips & Tricks: String Operations — LINQ brought developers a very user friendly and domain independent style of writing queries. The fact that the way queries are written is domain independent doesn’t mean that any query will compile the same way or even run the same way. You’ll always need to know how the provider will behave. LINQ To Objects, for example, will compile queries as a Func<> delegate and the query methods will return IEnumerable(T) implementations...
  5. Tip 37 – How to do a Conditional Include — Someone asked how to do a Conditional Include a couple of days ago on StackOverflow. They wanted to query for some entity (lets say Movies) and eager load some related items (lets say Reviews) but only if the reviews match some criteria (i.e. Review.Stars == 5)...

Читать полностью »

15.10.2009

Полезные ссылки (11.10.2009)

.NET

  1. A Feed You Should Read #7 – A Continuous Learner’s Weblog, Links — Links, links, links. Links here, links there, links everywhere. From Email, tweets, IM’s, text messages, TV, snail mail, friends, family, coworkers, links from all sides. Sometimes it feels we’re drowning in links. Yet there are those who are our link lifeguards, providing life preservers, acting as our silent yet thoughtful guides, day in and out...
  2. Model View Presenter via .NET — Model-View-Presenter is a design pattern for separating the concerns of display and display coordination when interacting with an underlying object model / domain. Better put as Model, Presenter, View due to the sequence of connections that are actually involved...

Читать полностью »

11.10.2009

Полезные ссылки (04.10.2009)

.NET

  1. LINQ to SQL Paging Gotcha — I ran into an issue with how LINQ to SQL implements the Skip and Take operators which leads to records being repeated or missing when performing custom paging...
  2. Attaching an Event Handler — Whenever I need to attach an event handler, usually I use one of these methods, a delegate, anonymous method, or lambda expression...
  3. Enum with String Value — Use this Enum and attribute class in conjunction so that you can create integer enums with string values attached...
  4. String interning and String.Empty — Surely if A equals B, and B equals C, then A equals C; that's the transitive property of equality. It appears to have been thoroughly violated here...

Читать полностью »

04.10.2009

Полезные ссылки (27.09.2009)

.NET

  1. Implementing a LINQ version of SQL’s LIKE Operator — One of the requirements of one of my recent projects was to implement a search page which allowed the user to enter a search term that supported wildcards. The search term could contain any number of wildcards in any position within that term...
  2. Reading and Writing data using custom methods and the System.Xml Namespace — On a previous post dealing with Xml Serialization I mentioned that one of the ways you could achieve this was by customizing the read and write methods. I’m going to bypass the wrapping the code into Read/Write methods and go straight to the code...

Читать полностью »

27.09.2009

Полезные ссылки (24.09.2009)

.NET

  1. Logging with log4net — log4net is a great little logging library. There seem to be some mixed results out there as to whether or not it outperforms the Enterprise Library's Logging Application Block, although it appears to me the general findings are that log4net is faster. For me, I guess it would come down to how badly I wanted integration with the rest of the Enterprise Library. If that's not a priority, log4net can be a lightweight, fast way to get logging going in your application...
  2. Becoming really rich with C# — Or maybe not, please do not hold me responsible if you lose money following this system. Having said that, it is my opinion that there are very few concepts that are important in investing. Three big ones are value, diversification and momentum. This post is about the latter two and how to use C# to create a simple trading system that uses both...
  3. What's in Your Collection? Part 3 of 3: Custom Collections — We've covered the interfaces and some concrete instances of collections provided by the .NET Framework. Now you are interested in moving things to the next level. What if the provided collections simply don't meet your business requirements? What are some ways you can use the collections concept to build your own classes to solve business problems?...

Читать полностью »

24.09.2009

Полезные ссылки (21.09.2009)

.NET

  1. Gallio 3.1 is here — Yesterday I noticed that a new version of Gallio, my favorite Test and Automation platform, was released a few days ago. Although the official version number suggests only a small progression (we are coming from v.3.0.6 SR2 and now have v3.1), it is a major upgrade that brings not only some minor improvements, but a wealth of new features. Among the highlights are...
  2. Hacking LINQ Expressions: Join With Comparer — In this installment of my Hacking LINQ series we’ll take a look at providing an IEqualityComparer for use in a LINQ join clause...

Читать полностью »

21.09.2009

Полезные ссылки (17.09.2009)

.NET

  1. Embedding .Net controls to NotifyIcon Balloon Tooltip. — Some guys asked me if it is possible to add a hyperlink to the NotifyIcon Balloon Tooltip. It’s not too hard to add it with WinAPI, but an idea was born to embed .NET controls to it. There could be a number of purposes for this. Again, you can add a hyperlink to make a user go to a specified web-site. You can add an image to the tooltip and so on. So I've used a standard .NET NotifyIcon and tried to modify it. There is an example of how it looks...
  2. Date Handling Tip Part 2: Get the Month Name as Extension Method — After my last post on the GetMonthName, I had a question on how to add this method to the DateTime class as an Extension method. I thought this would make a good follow-up, so here is how you can accomplish this...
  3. How do I inform one form that data in another form got changed? — This short sample demonstrates how to let one form in a Windows Forms application know when data in another form got changed. To implement this behavior I’ll show you how to create an event on Form2 and how to subscribe to this event on Form1 using the Handles keyword. The C# source code uses delegates to implement the aforementioned behavior...
  4. How to simulate IN Clause in LINQ queries — When working with the LINQ queries for SQL one of the common queries that we need to run is the select query with IN clause. In SQL IN clause is used to provide more than one value to match in the where clause...
  5. Using LINQ to query object hierarchies — I used LINQ to solve the following problem: find all titles of objects at hierarchy level X when you know object ID in hierarchy level Y. I cannot imagine if there is some other solution that is same short and clear as one that LINQ provides. Take a look and decide by yourself...
  6. Hacking LINQ Expressions: Select With Index — First, a point of clarification: I use LINQ Expressions to mean (Language-INtegrated) Query Expressions (the language feature) rather than Expression Trees (the .NET 3.5 library in System.Linq.Expressions)...
  7. iPhone Gets .Net App Development — Novell has announced MonoTouch 1.0, a commercial SDK that allows developers to build iPhone apps using Microsoft's .Net Framework instead of the Apple-designated C or Objective-C languages...

Читать полностью »

17.09.2009

Полезные ссылки (14.09.2009)

.NET

  1. Testing to see if a record Exists in LINQ to SQL — There are a number of options you can consider when testing to see if a record exists using LINQ to SQL. Which one should you use? It depends… In general, check the generated SQL for various options in SQL Management Studio to see the how the various execution plans compare. For example, each of the following can tell you if a record exists...
  2. NHibernate Profiler v1.0 Released — The NHibernate Profiler started about a year ago, and I estimated it at about three months of development. We released the public beta version in that time frame, and I think that we could have called in v1.0 then...
  3. Taming Your Sequence’s Side-Effects Through IEnumerable.Let — Side-effects don’t fit together very well with functional-style delayed computation, as observed in LINQ. Having such constructs embedded in an otherwise eagerly evaluated imperative language like C# can cause quite some confusion from time to time. A few samples (due to Erik Meijer) of such “mishaps” are shown below...
  4. Simplifying LazyLinq — This is the fourth in a series of posts on LazyLinq, a wrapper to support lazy initialization and deferred disposal of a LINQ query context...
  5. Announcing Gallio and MbUnit v3.1! — Gallio v3.1 is a major upgrade to the platform. This release includes many new features, better performance, and improved robustness...

Читать полностью »

14.09.2009

Полезные ссылки (10.09.2009)

.NET

  1. Set Difference Minus Operation with LINQ in C# — Sometimes you want to use a Difference (or Minus) set operation which goes like this: Give me all elements from set A that do not exist in set B. Or simply put A – B. The LINQ Except method does this if both sets A and B are of the same type, but frequently the sets are of different types and must have their identifiers matched. Here is a quick little example of how to do this with LINQ...
  2. MonoDevelop 2.2 Beta 1: We go cross platform. — Since the beginning of time, man has yearned to get a cross platform .NET IDE. Homer's Odyssey described one man's effort to achieve such a thing. And it was not until today, September 9th of 2009 that the world can test out such a tool...
  3. — Creating a full blown url shrinking service was pocking around in my mind for quite some time(of course by using Twitter). Since I heard quite a few good things on Entity Framework 4.0, so I decided to start with it. The first thing I usually do when developing an application is creating the domain model. But to create the domain model, we first have to define the basic functionalities...

Читать полностью »

10.09.2009

Полезные ссылки (03.09.2009)

.NET

  1. BASIC: Binding ListBox and DropDownList using LINQ — This example shows the basic way on how to populate a data from database to a ListBox/DropDownList control using LINQ to SQL...
  2. LINQ Tools — I’ve recently started giving a series of talks on LINQ based tools. While Visual Studio offers a lot in regards to support for LINQ, there are a number of mostly free tools that come in handy both from a usability and a learning experience. I gave a brief look at some of the tools as part of Russ’s Tool Shed which should be airing on MSDN’s Channel 9 in early October. In addition, I’m premiering the full presentation at this weekend’s Tallahassee Code Camp. If you can’t make it out, feel free to try the tools on this list to see if they help you thinq LINQ. Also, let me know if I’m missing any tools that you think are worthy to be included in the list...
  3. Building Performant Line of Business Applications with LINQ to SQL — Each step in the scenario requires different entities in different configurations; to keep explanations brief we will only use the Customer, SalesOrderHeader, SalesOrderDetail, and Product entities. The basis for which you tune is based on the business objects for each bullet of the scenario, starting with minimizing what data you really need...
  4. Rhino Mocks 3.6 — This release is mostly to put out all the patches & fixes that went into Rhino Mocks since the 3.5 release, almost a year ago...

Читать полностью »

03.09.2009

Полезные ссылки (31.08.2009)

Web

  1. 20 jQuery Plugins and Tutorials to Enhance Forms — In this post we have a selection of jQuery plugins and tutorials for enhancing and aiding in the development of the dreaded form area. There are the always important validation plugins, plugins that will give the form added functionality (stretching text-areas, auto-tabbing…)...
  2. CSS Vertical Centering Tutorial — Vertical centering with CSS seems to be a large obsticle in the Web design world and I notice a lot of people favor -based layouts when the need for vertical center arises. That's too bad...
  3. Getting and setting max zIndex with jQuery — I have a fair number of applications that use pop up windows and other draggable elements that are stackable. When dragging and moving windows around the page it’s often critical to ensure that windows show up in the proper zOrder without having to explicitly assign the window order...
  4. Create a Stunning Sliding Door Effect with jQuery — This tutorial is going to be awesome! I got inspired by my friend's Image Splitting Effect from Tutsvalley. I decided to take one step further, create a four corners sliding door effect...
  5. Читать полностью »

    31.08.2009

    Полезные ссылки (27.08.2009)

    .NET

    1. Quick Tip: Cast DataItem in ListView to Business Object — So this is one of those things that has slipped past me for all these months and now that I’ve discovered it, I can’t believe I went without it. I recently found out that I can access a business object in the ItemDataBound event of a ListView which makes it way easier to do some last minute control changing (such as binding labels or hyperlinks, etc.)...
    2. Building Line of Business Applications with LINQ to SQL — The LINQ framework offers a basic pattern of sequence operators, allowing for primitive behavior such as filtering, grouping, and joining over collections and types. The support of the high level query comprehension syntax in C# 3.0 is paramount to developing an application quickly and allows for transparent development practices for developers where querying an in-memory collection or a remote database works the same...
    3. Iterator Blocks Part Seven: Why no anonymous iterators? — It would be totally awesome to be able to build yourself a little sequence generator in-place that closed over local variables. The reason why not is straightforward: the benefits don't outweigh the costs. The awesomeness of making sequence generators in-place is actually pretty small in the grand scheme of things and nominal methods do the job well enough in most scenarios. So the benefits are not that compelling...

    Читать полностью »

    27.08.2009

    Полезные ссылки (23.08.2009)

    .NET

    1. Extend OpenFileDialog and SaveFileDialog the easy way — If you used WinForms, chances are that at some point you wanted to extend the OpenFileDialog or SaveFileDialog, but you gave up because there is no easy way to do it, especially if you wanted to add some new graphical elements. Even in the MFC days, such a task was not as daunting as it is for .NET because these classes are sealed, exposing only 16 properties, 5 methods and 3 events that can be used to customize the dialogs. Martin Parry's article on MSDN can give you an insight into how you can customize the OpenFileDialog using the OFNHookProc function and PInvoke...
    2. Introducing LazyLinq: Queryability — Before we try to query ILazyQueryable, it’s instructive to look at how System.Linq.Queryable works. There are essentially three types of operators on IQueryable...

    Читать полностью »

    23.08.2009

    Полезные ссылки (20.08.2009)

    .NET

    1. How to Fill a ListBox/DropDownList from an Enum — There was a question about this on the Asp.Net forums and after a quick search I didn't find a good generic function so I thought I'd supply one...
    2. LINQ to Ducks – Bringing Back The Duck-Typed foreach Statement To LINQ — I promise, it will be a (relatively) short post this time. You all know the foreach statement in C#, don’t you? Think twice before you answer and tell me exactly how the following works...
    3. Why all .NET developers need a memory profiler ! — It is one of the dirty secrets of software development: the number of memory leaks that find their way into production code. Memory leaks are a special category of bug because they can easily go unnoticed. The user's perspective is that they start work using your application and everything is fine. If it is an application that is used lightly, maybe run once every morning to create a report, than everything is fine for ever. If it is a long-running application then eventually it will cause problems, though the user may not know which bit of software is to blame. Since Windows rarely runs out of memory, the user might just notice everything slowing down...
    4. A total n00b’s guide to migrating from a custom data layer to Nhibernate: so many choices — One of the great things about NHibernate is its vibrant community and ecosystem. So many people are using it or building other libraries on top of it that you can be pretty sure that there is always a reasonable solution to any problem you might face...

    Читать полностью »

    20.08.2009

    Полезные ссылки (16.08.2009)

    .NET

    1. StringBuilderPlus Improves Upon StringBuilder — The above image shows that to concatenate about 40,000 strings in C# takes about 3 seconds. With the StringBuilderPlus, you can concatenate those same strings about a hundred times faster (or, 1/30th of a second). The experienced developer will note that StringBuilder can do this too, but there are a few weaknesses in StringBuilder that many people don't know about (skip to the "Problem" section to read more about that). StringBuilderPlus remedies those, as explained below, in the "Solution" section of the article...
    2. TestDriven.Net 2.23 Beta – Faster! — It turns out that the JIT compiler for x64 is considerably slower than for x86 (and uses more memory). You can easily improve the startup time for your EXE projects by changing them to compile for x86. In fact this is what Microsoft is doing in Visual Studio 2010 (the default for EXEs will be x86). It’s only worth compiling EXEs for AnyCPU if your application might use a lot of memory. See Rick Byers’ post on the subject: AnyCPU Exes are usually more trouble than they're worth...
    3. TestDriven.Net 2.23 Beta – Cleaner Stack Traces — You have probably noticed with previous versions of TestDriven.Net, stack traces could turn into an unruly mess of file path information...
    4. LINQ Tip of the week: LINQ and Anonymous types — Consider the case where we want to obtain a subset of data instead of an entire persistent instance. For example, if we want to obtain the contact details of all Customers based in London we would use the following query...
    5. Simplifying enumeration of Office object model collections with Linq and Extension methods — I found an interesting post on Deborah's Developer MindScape (via Greg’s blog )and wanted to share a modification of the technique that can simplify the use of Office object models in C# and VB. I use this heavily in my VisioAutomation library...

    Читать полностью »

    16.08.2009

    Полезные ссылки (13.08.2009)

    .NET

    1. Raising Events, Event Handlers, and the Use of Delegates — When working with an IDE like Visual Studio, most events, particularly those involving Windows Forms applications, are nonlinear. That is, you might have to wait for a user to click a button or press a key to then respond to that event. In server applications, you might have to wait (and listen) for an incoming network request. These capabilities are provided by events in the .NET Framework. Any developer will notice the connection between events and delegates in technical documentation. This article will assume a working knowledge of the .NET Framework 2.0 and Visual Studio 2005 (2008), with the intention of defining both events and delegates...
    2. db4o Object Manager for .NET Improvements — Since the announcement that Object Manager Enterprise would be added to our open source offerings we take the time and a lot of improvements were made: bugs were fixed, code were rewritten and we started to add tests (incipient, but at least we started)...
    3. Statement Trees With Less Pain – Follow-Up on System.Linq.Expressions v4.0 — In my last post, Expression Trees, Take Two – Introducing System.Linq.Expressions v4.0, I showed how to the extensions to the LINQ expression trees API opens up for full-blown statement trees including support for assignment, control flow, etc. One popular question that came up in the comments section is on the lack of language-level support for statement trees...

    Читать полностью »

    13.08.2009

    Полезные ссылки (09.08.2009)

    .NET

    1. Creating vCard with image in .Net — vCard is popular format for exchanging contacts. Besides e-mail clients also modern mobile phones are able to read and send contacts as vCard. This posting introduces same ideas how to implement vCard support in your applications and how to add images to vCards...
    2. Interesting LINQ Exercise — A co-worker posed an interesting LINQ problem to me tonight so I figured I’d share. They had a collection of items and wanted an algorithm that would create a “collection of collections” where the first three items would be grouped together, second three items, on so on. For example, given a sequence like this: { “a”, “b”, “c”, “d”, “e”, “f”, “g”, “h” }, it would create a structure that contained 3 groups – the first element would be { “a”, “b”, “c” }, the second would be { “d”, “e”, “f” } and the third { “g”, “h” }. They already had an algorithm working fine but it was using a “brute force” approach and took about 15-20 lines of code. It “felt like” you could solve the same problem more elegantly with a LINQ solution and with less lines of code...
    3. Windows 7 Code Pack V. 1.0 Released — The Windows® API Code Pack for Microsoft® .NET Framework provides support for various features of Windows 7 and previous releases of that operating system. The Code Pack has reached version 1.0 and has been published on Code Gallery...
    4. A Whirlwind Tour through the Managed Extensibility Framework — From a hotel lobby in the sunny city of Durban, South-Africa, waiting for my plane transfer after a great TechEd Africa event. Why not write a blog post on one of my talks: the Managed Extensibility Framework, or MEF. As we steam ahead to release .NET 4.0, it’s great to see the amount of new APIs that will make it into this release. I had the opportunity to talk on three of those the past few days...
    5. Fun With the ?? Operator in C#: if { } or ?? – Which is Faster? — Yesterday evening at work a team member and I were pair programming. We had a disagreement about how to code a few lines. The question was around whether to use the ?? operator or to use an if statement using String.IsNullOrEmpty. We settled it like most developers do and that is with a benchmark...

    Читать полностью »

    09.08.2009

    Полезные ссылки (06.08.2009)

    .NET

    1. StackOverflow answer – why learn multi-core programming? #2 — In my last post I talked about how multi-threading can be used to improve responsiveness while loading a file. I’ve put together a sample program (source included) that shows how to do this in C# 3.0, .NET 3.5, and WPF using Visual Studio 2008. You can find a zip file with a complete project attached...
    2. Introducing LazyLinq: Overview — This is the first in a series of posts on LazyLinq, a wrapper to support lazy initialization and deferred disposal of a LINQ query context, including LINQ to SQL’s DataContext...
    3. How to create 3 tire application using LINQ — As you know that in 3 tier architecture there are three layers...
    4. Simplistic Object Copying in .NET — In many applications it’s necessary to copy data between objects. Especially these days where we often have entities and Data Transfer Objects (DTO) where data needs to be shuttled back and forth between two objects I find it handy to have a simple routine that performs at least rudimentary, shallow data copying for me without manually having to write data mapping code at least if the properties identically or nearly identically. A few days ago I had a lengthy discussion about this topic on Twitter as well and some suggestions that some sort of data copying mechanism should be built into the .NET framework...
    5. Aspcts of Polymorphism in .NET Parts 1 & 2 – Inheritance — .NET Developers come in various shapes and sizes, not only physically, but also in terms of their expertise and experience. The polymorphic nature of the .NET Framework now allows their code to benefit from similar diversity. Sadly, though, it is entirely possible with .NET languages and tools, such as Visual Studio 2008, for developers to build programs and web sites without necessarily needing to know or understand the underlying complexity of what they are doing. I've come across so-called developers whose approach to solving problems has greatly improved their search engine skills as they scour the internet for code samples they can lift to fix the problem they're currently facing. Sadly, though, their attitude towards actually understanding and getting to grips with the problem domain is one of laziness. For this reason developers can work commercially...
    6. Aspects of Polymorphism in .NET Part 3 - Abstract Classes — Abstraction is at the top level of most things we're familiar with on a day to day basis. In our Ford Focus illustration we were dealing with a concrete instance of an abstract concept - vehicle. Although a person may be said to own a vehicle, it's meaningless without specifying the type of vehicle he or she possesses. For most of us this is a car, but for some it might be a plane, a boat, a bike, a helicopter etc. We then further solidify things by becoming more and more specific about things - what make, model, variation of car we have, for example...
    7. Aspects of Polymorphism in .NET Part 4 - Interfaces — I have often read that Interfaces can be likened to contracts. The thinking behind this analogy is that a class implementing an interface MUST implement ALL of the methods and properties declared by the interface, much the way that an employee MUST carry out all of the responsibilities contained in his contract of employment if he wants to keep his job...

    Читать полностью »

    06.08.2009