Jack @ ASP.NET

As a software engineer, I focus on .NET, especially asp.net, C#, WCF and so on, and I am also very interested in Search Engine Optimization.

Entries for the ‘Programming’ Category

VS 2010 Webinar Session Overviews

Visual Studio 2010 is set to be released in April.  Microsoft has made significant investments to improve the “Testing”, “Architecture”, and “Developer” tools within Visual Studio to make it an even more powerful productivity solution.

VS 2010 Webinar Session Overviews:

TITLE DESCRIPTION
Full Testing Experience: Professional QA with Visual Studio 2010 Join us as we demonstrate the testing and quality assurance lifecycle using Visual Studio 2010 and Team Foundation Server. We’ll dive into the testing tools and testing process you can use to dramatically improve the effectiveness of your QA and Test efforts. You’ll see the Microsoft Test and Lab Manager (MTLM) in all its glory as we explore how to manage your test environment, organize test suites, test cases, requirements and bugs, and how to manage both automated and manual test runs. In addition, you’ll see how to easily create an automated test from an existing manual test run. Finally, and most importantly, you’ll discover how insanely easy it is to create bugs that can be simply and reliably reproduced by developers – VS 2010 is that powerful.
Improving Development Practices with  Visual Studio 2010 This is an overview of the new development and database tools in Visual Studio 2010. New capabilities of historical debugging, code analysis, profiling and the new test impact analysis will be demonstrated. Working with Team Foundation Server (TFS) 2010, gated-check-in will be discussed as well as the tester/developer collaboration experience. The new architect tools will be demonstrated to facilitate a better understanding of how modeling is a part of the development experience.
Lab Manager – The Ultimate “No More No Repro” Tool Designing, building and testing code is a hard job. A job made even harder by the fact that most organizations don’t have development and test environments that are clean, easily reset and similar to the production environment. Enter virtualization…and Lab Manager. Lab manager allows you to define, configure and create complete development or test environments as needed. It can coordinate both physical and virtual environments, and comes with an incredibly powerful suite of effective tools that make managing environments simple and cost effective. Attend this webcast event to see Lab Manager in action!
Managing Requirements with Team Foundation Server 2010 Requirements management is a struggle for many organizations. A distinction must be drawn between requirements elicitation, requirements documentation and requirements management. Team Foundation Server provides rich capabilities for managing requirements and can easily be integrated with your preferred tools for documenting requirements. Best practices of requirement elicitation, documentation, management and traceability will be discussed in the context of the requirement lifecycle and how TFS 2010 and third party tools can maximize your overall requirements management process.
Overview of Visual Studio 2010 ALM Tools This overview of Visual Studio 2010 highlights the difference between Team System 2008 and Visual Studio 2010. Emphasis will be put on what migration steps need to be taken to maximize new features including testing tools, version control, work item tracking and build enhancements. As a basis for demonstration, the development processes and practices used to create Notion Tools for Team System will be shown, including branching models, build and deployment automation, custom reporting and workflows.
Streamlining Testing with  Visual Studio 2010 ALM Tools This Visual Studio 2010 overview features Visual Studio Test Elements 2010 testing tools including using the new Microsoft Test and Lab Manager to manage and automate your UI testing. The use of Test Lab will be discussed as a means of automating the creation of virtual environments for testing purposes. Deploying to VM environments during build will be demonstrated and facilitate a robust developer/tester lifecycle. For a taste of real-world use, the test plans and test process used to perform multi-platform testing of Notion Tools for Team System will be shown.
Using Team Foundation Server 2010 for Non-Windows Development This is an overview of best practices for utilizing Team Foundation Server (TFS) 2010 and the Teamprise Client Suite for development activities beyond Microsoft and the Windows platform. This webcast shows development teams using mixed and non-Microsoft platforms how to effectively leverage TFS 2010 to adopt work item tracking, version control, and automated build and test technologies.
Visual Studio 2010 Quality Tools for Developers This webcast event will demonstrate how developers use Visual Studio 2010 and Team Foundation Server to create high quality code, reliably reproduce and efficiently fix reported bugs, and truly work with the testing team. We’ll demonstrate the use of several important tools, such as test impact analysis, IntelliTrace, and other tools that help you understand your code, pinpoint bugs and efficiently fix them. Let’s face it – fixing bugs is both tedious and hard. VS 2010 provides the tools to both you and the tester to make finding, reproducing and fixing bugs dramatically simpler.
What’s New in Visual Studio 2010 Why you should consider Visual Studio and Team Foundation Server 2010. We’re going to discuss the specific business value of the Visual Studio ALM tools now and later. Free webinar event to learn how to get the most out of the Visual Studio investments that your organization has made. You owe it to yourself to learn how this new solution will help you be a more productive in your role!
  • Digg
  • DZone
  • Yahoo Buzz
  • Delicious
  • Reddit
  • StumbleUpon
  • SmakNews
  • Jumptags
  • Ping
  • Share/Bookmark

Keyboard Shortcut Tricks in Visual Studio 2010

  1. visual-studio-2010-asp.net4 Insert a blank line above or below the current line:
    Go to any line in the Editor and press CTRL + Enter to insert a line above or CTRL + SHIFT + Enter to insert a line below the current line.
  2. Pasting a single selection into a box selection
    ALT + Left Mouse
  3. Zoom in or out of text in the Editor using the mouse wheel
    CTRL + Mouse Wheel
  4. Zero-length box selection
    Alt + Left Mouse
    • Assume that you have a a situation with some variables like the ones below and you want to make them all public
    • The answer is a zero-length box selection.  Hold down your ALT key and Left Mouse Button, then drag straight down
    • Release the ALT key and the Left Mouse Button.
    • Done~
  • Digg
  • DZone
  • Yahoo Buzz
  • Delicious
  • Reddit
  • StumbleUpon
  • SmakNews
  • Jumptags
  • Ping
  • Share/Bookmark

Current .NET Version Penetration

The bad news is that only 52.7% of the users has .NET Framework 3.5 installed on their PCs, but as you can see from the table they become more and more very fast:

  Mar-08 Jun-09 Aug-09 Oct-09
Dot Nothing 28.12% 25.60% 25.53% 21.40%
.NET 1.0 2.59% 0.60% 0.40% 0.30%
.NET 1.1 23.22% 13.00% 8.41% 7.70%
.NET 2.0 27.41% 23.20% 23.02% 11.60%
.NET 3.0 17.67% 14.40% 10.01% 6.30%
.NET 3.5 0.99% 21.82% 32.63% 52.70%
  • Digg
  • DZone
  • Yahoo Buzz
  • Delicious
  • Reddit
  • StumbleUpon
  • SmakNews
  • Jumptags
  • Ping
  • Share/Bookmark

List(T).BinarySearch in C#

I think most of us are quite familiar with binary search. Binary search is an algorithm for locating the position of an element in a sorted list by checking the middle, eliminating half of the list from consideration, and then performing the search on the remaining half.If the middle element is equal to the sought value, then the position has been found; otherwise, the upper half or lower half is chosen for search based on whether the element is greater than or less than the middle element. The method reduces the number of elements needed to be checked by a factor of two each time, and finds the target value, if it exists in logarithmic time. A binary search is a dichotomy divide and conquer search algorithm.

In C#, .Net provide a List<T>.BinarySearch Method (T) which can be used easily. here is a demo:

   1: // Init a long type list

   2: var myList = new List<long>();

   3: foreach (var item in "269, 361, 347, 355, 352, 346, 351, 354".Split(','))

   4: {

   5:     myList.Add(long.Parse(item.Trim()));

   6: }

   7:  

   8: // sort

   9: myList.Sort();

  10: var ret = myList.BinarySearch(347);

  11: Console.WriteLine(ret);

Note, I have a ‘myList.Sort();’ before call the BinarySearch, why? It is because BinarySearch will Search the entire sorted System.Collections.Generic.List<T> for an element using the default comparer and returns the zero-based index of the element.

Yes, it is sorted list that binary search will operate on! So remember make your list sorted before call binary search function

  • Digg
  • DZone
  • Yahoo Buzz
  • Delicious
  • Reddit
  • StumbleUpon
  • SmakNews
  • Jumptags
  • Ping
  • Share/Bookmark

.NET Development for the iPhone

Until recently your only choice for developing applications for Apple’s iPhone was to jump into the Apple development ecosystem. This means being willing to write Objective-C code in the XCode IDE. For many developers, learning Objective-C was seen as a huge barrier-to-entry. This is especially true for many .NET developers whom have never had to worry about memory management, pointers, and other C language responsibilities that they are unfamiliar with.

All this has changed with the introduction the MonoTouch framework, a part of Novell’s Mono Project. The Mono Project is an open-source implementation of Microsoft .NET Platform. It allows you to run .NET applications on nearly any platform, including Apple, FreeBSD, Linux, Unix, and others. MonoTouch, which is a new part of the Mono Project, allows you to write applications using C# with .NET platform that run on the iPhone.

The intent of this article is to provide a solid introduction to the MonoTouch platform, where to find all the necessary pieces, the limitations of it, and how to build a basic application.

How does it Work?

When building MonoTouch applications, most of the non-UI .NET 3.5 stack is either already available, or is in the roadmap to be included. This allows you to write applications using many of the .NET Framework Technologies that you’re already familiar with, including Windows Communication Framework (WCF), Workflow Foundation (WF), etc. It also includes nearly all of the Base Class Library (BCL) including things like Garbage Collection, Threading, Math Functions, System.Net, Cryptography, etc. For a list of available standard .NET assemblies see http://monotouch.net/Documentation/Assemblies. This is accomplished through a MonoTouch-specific set of base .NET libraries, similarly to how Silverlight and Moonlight work.

This means that you can compile standard .NET 3.5 code libraries using the MonoTouch core assemblies and use them in your application. So if, for example, you have a specialized library that does advanced math functions for engineering problems that you use for other applications, you can simply include the code library in your MonoTouch solution, and reference it. When you build your solution, it will compile it using the MonoTouch libraries, and it will then be available in your application.

MonoTouch also includes wrappers to the native iPhone APIs such as Location (GPS), the accelerometer, address book, etc. It also gives you the ability to bind to native Objective-C libraries that are not wrapped, so you can interop directly with existing Objective-C code.

How do I Distribute My Apps?

MonoTouch applications are distributed the exact same way that traditional iPhone applications are distributed, either via the Apple App Store, or Enterprise deployment.

The App Store is an online repository that allows users to pay for applications (if they’re not free), and download them. It is available from within iTunes, or directly from the iPhone itself. In order to get a license to distribute via the App Store, you must register with Apple, and pay $99/year.

Enterprise deployment is for those wishing to develop internal applications for a company, and distribute them to employees, etc., without listing them with the App Store.

What is the Licensing Model?

Unlike Mono, MonoTouch is not open source and is a commercial product. That means if you want to do anything useful with it you have to purchase a license. MonoTouch comes in three flavors and prices:

  • Professional ($399) – A single personal developer license that allows you to develop applications and distribute them via the Apple App-Store.
  • Enterprise ($999) – A single corporate developer license that allows you to develop applications and distribute via the App-store, or enterprise deployment.
  • Enterprise, 5 Seat ($3,999) – The same as the Enterprise license, but includes 5 seats.

All three options include a year of free updates.

There is also an evaluation edition that allows you deploy to the simulator only. For the purposes of this introduction, that is all we’ll need.

  • Digg
  • DZone
  • Yahoo Buzz
  • Delicious
  • Reddit
  • StumbleUpon
  • SmakNews
  • Jumptags
  • Ping
  • Share/Bookmark

Effective C#, What Content got dropped

It should be clear from the additional content what’s new: I added coverage of the significant C#4.0 features like dynamic invocation and named / optional parameters. New library additions like PLINQ are also covered.

It’s much harder to see how I decided which items to drop. There are 15 completely new items in the 2nd edition, so that meant finding 15 items to drop. (Several other items have the same title, but were significantly rewritten – that will be the subject of another blog post.) Here’s how I decided which items to remove:

Items that are less important now. A number of the items in the first edition discussed techniques that were much more important before generics were available. Some of these items were those that discussed boxing and unboxing, the collection classes, and the data set class. All of those techniques and libraries were far more useful in C# 1.x than in the current .NET universe.

Items that have become common practice. C# has been around for almost a decade, and the community is much more mature than it was in 2004, when Effective C# was published. Some of the items are part of the conventional wisdom now

Items that assumed your last language was C++ or Java. The early adopters of C# were developers that came from C++ (on the Windows platform) along with some developers that came from Java. That’s no longer true.  College grads (since 2002 or so) are using C# for their first professional programming experience. Others are coming from VB, Ruby, Python, or PHP. (I’m not claiming that C# is grabbing market share from all those languages; the migration happens in all directions.) It just wasn’t right to assume that every C# developer has C++ or Java experience anymore.

The poster child for dropping items is the original Item 41, where I advocated using DataSets rather than implementing IBindingList yourself. I didn’t rewrite this item because the obvious answer now is to use BindingList<T> when you need the IBindingList capability. If you were using DataSets for some other reason, pick some other generic collection type. There are many, and the options grew again in .NET 4.0. Those generic collections have better APIs (the type parameter means the compiler ensures type correctness), and better performance (boxing / unboxing doesn’t apply. It’s not often that it’s trivial to get better performance and better chances at correctness. Even in the 1.x days, I didn’t advocate using DataSets are part of a service API. That was and still is a painful choice.

There’s also been many enhancements in the .NET framework that mean there are better data solutions. LINQ, along with the query syntax pattern (See Item 36 in More Effective C#), means there are much better ways to work with data in .NET 4.0.  Chapters 4 and 5 of More Effective C# discuss these important techniques. The entity framework has matured, and is a better way to handle data transfer between layers and machine boundaries. (I still need to look more closely at the latest EF, I know some of the changes, but not all).

  • Digg
  • DZone
  • Yahoo Buzz
  • Delicious
  • Reddit
  • StumbleUpon
  • SmakNews
  • Jumptags
  • Ping
  • Share/Bookmark