Wriju's BLOG

.NET, Cloud and everything

VB.NET 10 : Working with Array

Working with Array in VB.NET 2010 (VS 2010) is real fun. You can leave it to the compiler to decide. Be it one dimensional array, two dimensional array or jagged array.. One-dimensional Array When you declare something Dim arr() As Integer = New Integer() {1, 2, 3, 4} You explicitly mention the type so on…. Read more

What is Private Cloud – Watch it out Live!!!

Register today! http://msevents.microsoft.com/CUI/WebCastEventDetails.aspx?EventID=1032432793&EventCategory=4&culture=en-US&CountryCode=US   TechNet Webcast: Building a Private Cloud with the Dynamic Data Center Toolkit for Enterprises (Level 300)   Event ID: 1032432793   Register Online         Language(s): English. Product(s): Microsoft System Center Virtual Machine Manager,Microsoft System Center Virtual Machine Manager 2007. Audience(s): IT Decision Maker,IT Generalist. Duration: 60 Minutes Start Date:… Read more

Patterns for Parallel Programming

WOW!!! When I first saw it.   Patterns for Parallel Programming: Understanding and Applying Parallel Patterns with the .NET Framework 4   http://www.microsoft.com/downloads/details.aspx?FamilyID=86b3d32b-ad26-4bb8-a3ae-c1637026c3ee&displaylang=en   You must must read it!!!   Namoskar!!!  … Read more

VB.NET 10 : Optional Nullable Parameter

If you want to assign Nothing to the optional parameter in VB.NET 10, it is just like to obvious now, Sub Main()     ‘Passing value for the optional parament _age     MyFunc(“Wriju”, “wriju@contoso.com”, 30)       ‘No value is supplied for the optional parament _age     MyFunc(“Writam”, “writam@contoso.com”) End Sub     Sub MyFunc(ByVal _name… Read more

VB.NET 10 : Multiline Lambdas

With implicit line continuation VB.NET 10 now allows you to write the multiline Lambdas. That means like your normal Functions you can write functions under Lambdas. So now you may write like, Dim arrInt As Integer() = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}   Dim myFinc = Array.FindAll(arrInt, Function(n)                                        If… Read more

Parallel Computing: PLINQ

Visual Studio 2010 has new API for LINQ (Language Integrated Query). This helps us to implement the power of Parallel Computing in declarative manner. LINQ without Parallel Extension It will take 3 sec for 28 thousand elements. static void Main(string[] args) {     Stopwatch sw = Stopwatch.StartNew();         DoIt();       Console.WriteLine(“Elapsed = “… Read more

Parallel Computing: The new “Task” API

Visual Studio 2010 has new API called “Task”. This helps us to create small pieces of work and execute in distributed manner under multi core machine. Unlike thread it has flexibility to adopt the lower number of CPU without changing code. With improved CLR thread pool local processes are not confined in local thread pool… Read more

Seven Things to Know about Windows 7

1) Simple to Use. The Snap feature arranges windows side-by-side by dragging programs. You can then pin your favorite programs to the Windows Taskbar. Finding often-used programs and files is easier with Windows 7. The streamlined user interface includes a cleaner desktop and task bar. Using the Jump Lists feature, you can place the cursor… Read more

Visual Studio 2010 Beta 2

I have installed the Beta 2 of Visual Studio 2010. I love its splash screen Go get it and enjoy!!! Find more information at http://msdn.microsoft.com/en-us/vstudio/dd582936.aspx MSDN Subscribers: Download the Beta The Visual Studio 2010 and .NET Framework Beta 2 is available to MSDN subscribers on Monday, October 19th, with general availability on October 21st. How… Read more

VB.NET 10 : Nullable Optional Parameter

You can create method with optional parameter and also make them Nullable. Optional with default value Sub Test(ByVal _name As String, ByVal _email As String, Optional ByVal _age As Integer = 30)   Optional and Nullable Sub Test(ByVal _name As String, ByVal _email As String, Optional ByVal _age As Integer? = Nothing) Similarly you also… Read more

VB.NET 10 : Collection Initializer

Another useful feature which was missing in VB.Net 9 is available in Visual Studio 2010. This provides option to declare and initialize with series of values with the keyword Form. Dim myList As New List(Of Integer) From {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}   For Each i In myList     Console.WriteLine(i)… Read more

Web Application Toolkits to the Web Announcement

  Today with the announcement of Microsoft WebsiteSpark, we are launching a number of Web Application Toolkits to the Web. Web Application Toolkits are designed to enable Web Developers to simply extend their web application capabilities by providing them with a packaged set of running samples, templates and documentation.     The goal for the… Read more

What’s new in ASP.NET 4.0 and Visual Studio Beta 2?

List is quite big!!!   Core Services    Web.config File Minification    Extensible Output Caching    Auto-Start Web Applications    Permanently Redirecting a Page    The Incredible Shrinking Session State    Expanding the Range of Allowable URLs    Extensible Request Validation    Object Caching and Object Caching Extensibility    Extensible HTML, URL, and HTTP Header… Read more

Parallel Computing: Leverage the better hardware tomorrow

It has quite a sometime we have been using .NET with System.Threading namespace. So what is new there in Parallel Computing in .NET Framework 4.0 with Visual Studio 2010. There are a lot   Ø  Task-based fine grained parallelism Ø  Better debugger feature Ø  Structured Parallelism Ø  Declarative Parallelism   Above all you are getting… Read more

C# 4.0 and Parallel Programming Resources

C# 4.0   The Future of C# by Anders Hejlsberg at PDC 2008 https://channel9.msdn.com/pdc2008/TL16/   Slide Deck http://mschnlnine.vo.llnwd.net/d1/pdc08/PPTX/TL16.pptx   Sample Code and Whitepapers http://code.msdn.microsoft.com/csharpfuture/   C# 4.0, Dynamic Programming and JSON http://www.nikhilk.net/CSharp-Dynamic-Programming-JSON.aspx   Easy to understand Co- and Contra Varinace http://blogs.msdn.com/charlie/archive/2008/10/28/linq-farm-covariance-and-contravariance-in-visual-studio-2010.aspx   Parallel Programming   PDC 2008 Session by Daniel Moth   Parallel Programming for… Read more

C# 4.0 : Co-variance and Contra-variance

Here I am going to talk about the feature called Covariance and Contravariance. To show you the example I will use delegate. Now what is it? This would be a big question and with no hesitance I must say that you should visit Eric’s blog. There are some articles which will help you understand. To… Read more

Welcome to Microsoft Web Platform

    It is amazing to see so many Web Platform utilities are clubbed together in one single place. What you may need to develop website, are available here.   http://www.microsoft.com/web/default.aspx   If you go to downloads section http://www.microsoft.com/web/downloads/default.aspx you will get lot of things here, Namoskar!!!… Read more

Visual Basic 10 : Line Continuation Magic

There are some new enhancements in Visual Basic 2010 or Visual Basic 10 where you can really have greater flexibility on how you handle multiple lines for continuous statements,   ‘Explicit Continious Line (no need to use & _ ) Dim sContinuation As String =     “Hey you know I can write multiple lines without… Read more

NotifyIcon : Display Windows Form in System Tray

While talking to different people I get this question. And in Visual Studio it is very easy to do,   You need Windows Forms Application, then drag and drop NotifyIcon there. Set one icon with that control so that it is visible,   public partial class Form1 : Form {     public Form1()     {… Read more

Presenting Windows Azure in Talking Tech 2009

I am currently back from New Delhi where I have presented Windows Azure – Microsoft Cloud Computing. This Saturday I am going to Chennai for the same purpose. In Delhi (actually in Gurgaon) I enjoyed the interactivity where people had lots of questions. Just wanted to face many more of such opportunities to help Developer… Read more

Azure : Pricing & Licensing Overview

Should you have question, please visit http://www.microsoft.com/azure/pricing.mspx How will Microsoft charge for the Azure Services Platform? Subject to certain limits, Azure Services will be available without charge during our Community Technology Preview (CTP). Once Microsoft Azure launches for commercial use, we will offer a portfolio of services and you will be billed according to your… Read more

Visual Studio 2010 : Multi Targeting

Like Visual Studio 2008, in Visual Studio 2010 also we have multi-target. So ideally you can create project targeting Framework 2.0, 3.0, 3.5 and 4.0. This behaviour is little different here. Earlier, we have Framework 3,5 carrying both 2.0 and 3.0. So in Visual Studio 2008 it was just the intellisense alter and control load… Read more

ADO.NET Entity Framework v2 : ExecuteStoreQuery

There is now an option in ADO.Net Entity Framework v2 for us to execute store query,   IEnumerable<Customer> custs =  ctx.ExecuteStoreQuery<Customer>(“SELECT * FROM Customers”, null);   foreach (var c in custs) {     Console.WriteLine(c.CustomerID);     }   Namoskar!!!  … Read more

Visual Studio 2010 and .NET Framework 4 Beta 1 Walkthroughs

Watch out the videos on Visual Studio 2010 at http://msdn.microsoft.com/en-us/teamsystem/dd441784.aspx Here are some of them, Ø  Dynamic Programming in Visual C# and Visual Basic   Ø  Office Programmability in Visual C# and VisualBasic   Ø  Test-driven Development with Generate From Usage   Ø  F# in Visual Studio 2010   Ø  Deploying Multiple Office Solutions in… Read more

LINQ to CSV : Getting data the way you want

Getting data from CSV is one of the mostly used business in applications/tools development. Here how we can do it in LINQ, You have a table called Emp with the below details, CREATE TABLE [dbo].[Emp](       [Id] [int] IDENTITY(1,1) NOT NULL,       [FirstName] [varchar](50) NOT NULL,       [LastName] [varchar](50) NULL,  CONSTRAINT [PK_Emp] PRIMARY KEY CLUSTERED… Read more

Setup and Deployment : Custom Action to Capture User Input

Purpose Users are allowed to pass Product Key while installing in .msi. During that we want to capture it for registration to avoid piracy. Challenges When we use “Customer Information” dialog in “Start” action, it has “SerialNumberTemplate”. But capturing information from there is really tough as mentioned in the article http://support.microsoft.com/kb/253683/en-us. So we have to… Read more

LINQ to XML : Understanding Annotations

Annotations are used for private use. It does not directly associated and known as Black Box in XML world. This can also be considered as meta tag. Below is an example on how it can be handled. I have created a sample Windows Applications and will try to capture my understanding. /// <summary> /// Class… Read more

Visual Studio 2010 and .NET Framework 4 Beta 1 Download Today!!!

Resources and excitements are available for you in Visual Studio 2010 Beta 1. Try this out from today at http://go.microsoft.com/fwlink/?LinkId=151799. There are a bunch of resources available for you there apart from the bits. I have installed it with my museum PC (which hold Visual Studio 6, Visual Studio.NET 2003, Visual Studio.NET 2005, Visual Studio.NET… Read more

LINQ – Uniformity All Over

I have spent a while with LINQ and still feel very new whenever I explore some new power. Here I am going to describe you how LINQ uniformly allows you write for the various types of data.   In-memory data source ++++++++++++++++ List<int> arrInt = new List<int> { 1, 2, 3, 4, 5, 6, 7,… Read more

Immediate Window is missing in Visual Studio Menu

  When you do not see “Immediate” window under Debug menu of Visual Studio you may get frustrated. But there is a quick way to get it when required,   Go to View > Other Windows > Command Window or press Ctrl+W, A   Then type immed. It will bring the Immediate Window.   And… Read more

LINQ to SQL : Understanding Compiled Query

Understanding Compiled Query connects me to my experience in C# 3.0. Based on my personal understanding I am discussing it.   You may be aware of Func<>. And you know it is a flexible delegate which allows you create reusable functions. Exactly the same way we can create compiled query so that we can prevent… Read more

ADO.NET Entity Framework : Editing a detached Object

In Layered scenario, you might need to pass an object to another method while updating. Carrying open Context is not good however you may try the below approach by using “CreateEntityKey”. But this will not work if you have configured your edmx with Stored Procedure, reason behind that is static void Main(string[] args) {    … Read more

ASP.NET 3.5 ListView and DataPager : Making RSS Reader

ASP.NET 3.5 comes with bundle of new data bound controls. Among them ListView and DataPager are the ones I am going talk here. To me ListView is the enhanced from of DataRepeater. It has got everything you might need to create an app with your HTML/CSS skill set. Today you often visit blogs and you… Read more

Data Services (aka Astoria) : CRUD (Select / Insert / Update / Delete )

Creating Astoria is very easy and many of you might have tried that out. What important for us is to work with that data. If you are developing Visual Studio Solution then things are quite obvious as mentioned below, Either you will have Astoria or you will create that service. I am not going in… Read more

LINQ to SQL : Returning Scalar Value from Stored Procedure

In LINQ to SQL it is not that easy thing to achieve as compared to other features. Let us assume you have a Stored Procedure like, Case 1: With Output Parameter CREATE PROCEDURE [dbo].[GetEmployeeCount]       @OutVal DateTime OUTPUT AS BEGIN       SELECT @OutVal = GetDate() END You need to write code which will look like,… Read more

LINQ to SQL : Using ChangeSet for Audit Trail

Most of the transactional scenario, you may need to add the transaction to some table for ref. many apps does it for admin perspective.   Problem   You can do it in LINQ to SQL with ChangeSet but the problem is with Inserts. It does not give you the Identity field value until and unless… Read more

ADO.NET Entity Framework and Data Services Case Study

Story of Misys Healthcare Systems is very interesting. They have increased 60% of their development process while migrating their apps to ASP.NET Ajax using Entity Framework and Data Services.   Full story at http://www.microsoft.com/casestudies/casestudy.aspx?casestudyid=4000002427   Namoskar!!!… Read more

Silverlight 3 Announced

Hurray!!! We have it finally!!!! We have added 50 new features. It can run Silverlight video in non-browser environment. 60+ new highly customizable controls with source code are available. It has auto update feature And Many more…. Rich Internet Application is just a matter of choice. Be smart and have Silverlight 3. Tools For You… Read more

ADO.NET Entity Framework vs LINQ to SQL

  I have been getting a continuous request on what we should be using? LINQ to SQL or ADO.NET Entity Framework? I have posted few articles on that, please feel free to visit   Choosing between ADO.NET Entity Framework and LINQ to SQL Choosing between LINQ to SQL and Entity Framework   ADO.NET Entity Framework… Read more

Azure Services White Papers

Introducing the Azure™ Services Platform Using computers in the cloud can make lots of sense. Rather than buying and maintaining your own machines, why not exploit the acres of Internet-accessible servers on offer today? Get an early look into the Azure Services Platform in this White Paper by David Chappell. An Introduction to Microsoft .NET… Read more

ADO.NET Entity Framework Resources

Compiled Resources http://www.renaissance.co.il/downloads/Entity%20Framework%20Essential%20Resources.pdf   Articles   Next-Generation Data Access: Making the Conceptual Level Real http://msdn.microsoft.com/en-us/library/aa730866(VS.80).aspx   The ADO.NET Entity Framework Overview http://msdn.microsoft.com/en-us/library/aa697427(VS.80).aspx   ADO.NET Tech Preview: Entity Data Model http://msdn.microsoft.com/en-us/library/aa697428(VS.80).aspx   ADO.NET Entity Framework Overview http://blogs.msdn.com/adonet/archive/2008/03/27/ado-net-entity-framework-performance-comparison.aspx   Channel9 Videos   ADO.NET Entity Framework on Channel 9 Pablo Castro, Mike Pizzo, and Britt Johnston http://blogs.msdn.com/adonet/archive/2006/07/19/671805.aspx  … Read more

Choosing between ADO.NET Entity Framework and LINQ to SQL

As part of my day to job I come across a very common question from the developer community that one should be using LINQ to SQL (L2S) or ADO.NET Entity Framework (EF).   Earlier I have posted a blog containing the features http://blogs.msdn.com/wriju/archive/2009/01/05/choosing-between-linq-to-sql-and-entity-framework.aspx.    To me I feel very excited about EF as it has got… Read more

ADO.NET Data Services : Accessing Non-Relational Data

As you all know Astoria (Data Services) supports anything as backend. Not necessarily you need to have a Relational database to access data.   So if you talk about offline data like collection of an Object which may or may not come from an external entity (like XML) can also be exposed via Astoria.  … Read more

ADO.NET Data Services (Astoria) Resources

ADO.NET Entity Framework Resources http://msdn.microsoft.com/en-us/library/cc907912.aspx   Overview: ADO.NET Data Services http://msdn.microsoft.com/en-us/library/cc956153.aspx   ADO.NET Data Services Team Blog http://blogs.msdn.com/astoriateam/   Phani Raj’s Blog http://blogs.msdn.com/phaniraj/   Mike’s Podcast ADO.NET Data Services (VS08 Sp1 B1) – Surfacing Data ADO.NET Data Services (VS08 Sp1 B1) – Querying ADO.NET Data Services (VS08 Sp1 B1) – .NET Clients ADO.NET Data Services… Read more

C# 4.0 : New Extension Method “Zip”

While browsing the features I found an interesting extension method called “Zip”. How it works, let’s check it. List<string> names = new List<string> {“Debajyoti”, “Sumitra”, “Wriju” , “Writam”, “Tupur” };   List<int> ages = new List<int>{ 67, 58, 30, 24, 26 };   var zipped = names.Zip(ages, (name, age) => name + ” is “… Read more

C# 4.0 : Named Arguments

For methods having numerous arguments we tend to get confused. And this is also pain for others while reviewing the code. C# 4.0 gives us an opportunity to pass parameters with name. How it works, let’s check it. Suppose you have a method like below, public static class TestClass {    public static void ParamMethod(string… Read more

C# 4.0 : Optional Parameters

Days of creating multiple overloads to avoid parameters are gone. You no more have to create many methods and pass the default one there. C# 4.0 brings to us the concept of “optional” parameters. How it works, let’s check it. Suppose you have a method like below, public static class TestClass {    public static… Read more

C# 4.0 : Dynamic Objects

“Working with dynamic objects statically” – Anders Hejlsberg When you work with C# 4.0 you get to work with many unmanaged world “dynamically”. What does that mean to you? It means you do not do things “statically” as you used to do in C# or in VB.NET. There are many benefits in static programming like… Read more

ADO.NET Entity Framework : Working with Stored Procedure

Here we go, I generally get questions from developers that if they will have to scrub the existing powerful stored procedure they have written by investing time and money. The answer to that is “NO”. You must enjoy using it as it has its own power.   So it is very simple in ADO.NET Entity… Read more

ADO.NET Entity Framework : Paging EntitySQL

Paging in EntitySQL is really easy to achieve. You have got two important sub-clauses (or query operators) are available, SKIP and LIMIT.   So your paging EntitySQL query would ideally look like, “SELECT VALUE e FROM NorthwindEntities.Customers AS e ORDER BY e.CompanyName SKIP 10 LIMIT 10 “;   The most important part is that you… Read more

ADO.NET Entity Framework : Using EntityClient and EntitySQL

Using Entity Framework with LINQ is simple and fun stuff. But if you are concerned about the performance and comfortable writing ADO.NET like code then EntityClient is for you. It resides under System.Data.EntityClient namespace. If you are using it you also need to use the EntitySQL (not T-SQL) so the query will be little different…. Read more

ADO.NET and Data Articles by John Papa

Many of you might be following John Papa’s article on Data and related topics. Myself have came across many of his and are still following. I would like to share a list of articles by him published in MSDN Magazine and available online for you. Data Points: Designing an Entity Data Model With the Entity… Read more

ADO.NET Data Services Resources

Help yourself by exploring below resources on ADO.NET Data Services (aka "Project Astoria"). Data Platform Developer Center – Data Services page Data services conceptual documentation on MSDN Data services API reference documentation on MSDN Data services team blog Data services online forum (a place to ask us your data services related questions) Whitepaper: Using ADO.NET… Read more

Welcome to the World of Windows Azure

I am very much excited as I should be to start with my First Windows Azure Application. I did install the Azure related bits in my machine and got the token for uploading my test application. Then with the passion cherished by created the application which I am running at http://wriju.cloudapp.net, so let us enjoy…. Read more

.NET Services White Papers (Dec 2008 CTP)

There are four papers on   Introduction to Microsoft .NET Services Microsoft .NET Access Control Service Microsoft .NET Service Bus Microsoft .NET Workflow Service   at http://www.microsoft.com/downloads/details.aspx?FamilyID=5057e2b3-c8e5-4b26-a601-ff9621589ce3&DisplayLang=en   Namoskar!!!… Read more

App Arch Guide 2.0 Pocket Reference

Actual Application Architecture Guide 2.0 is of 300+ pages. So it is very difficult to carry every time. Patterns and Practices team have came up with smaller editions depending upon the interests and areas.   Find all of them here, http://www.codeplex.com/AppArch/Wiki/View.aspx?title=Pocket%20Guides&referringTitle=Home   Namoskar!!!… Read more

Free EBooks at CodePlex

There are many more books available. Go and grab them   ·         Acceptance Test Engineering Guidance ·         Application Architecture Guidance ·         Common Service Locator ·         Composite Application Guidance for WPF ·         Design for Operations ·         Enterprise Library ·         ESB Guidance ·         GAX Extensions Library ·         Guidance Explorer ·         Performance Testing Guidance for Web Applications ·        … Read more

Free EBooks on Architecture

Dear all, This indeed a good news for us, there has been many freely available guides. Why you should be paying others? Get the copy now for free Application Architecture Guide 2.0 Enterprise Library Guidance Explorer Performance Testing Guidance for Web Applications Security Guidance for Applications Smart Client Architecture and Design Guide Team Development with… Read more

LINQ to Entity : Supported and Unsupported Methods

There is a correction for this Post, so do I have changed the title. Thanks to Chris Love who pointed me the faults with earlier post, I got few question on some of the popular paging methods of LINQ which does not work on LINQ to Entity. This is by design and quite logical. In… Read more