Apr 30

I just can’t miss that one! It comes from Matt Berseth’s blog where he describes how GridView, DetailsView and ModalPopup Controls can be nicely working together.

GridView, DetailsView and ModalPopup Controls in Master-Detail

Here is a quick quote from his post:
“I am sure everyone is pretty familiar with Master/Details style of editing data, but just in case - here is how my page works. The grid shows 12 rows of customer data. The far right column in the grid contains a hyperlink that when clicked brings the detail view of the row into focus so the corresponding row can be edited. The detail view is a popup control and contains a Save and Close buttons. When close is clicked, the detail popup is dismissed and the user goes back to viewing the main grid. When they click Save, some simple validation checks are run (all are RequiredFieldValidators for this sample) and the new data values are persisted, and finally the detail popup is dismissed and the main grid is refreshed so that it displays the changes.”

You can find the rest here. Matt has done a wonderful job sharing also the source code.

Mar 30

Today will post about two things. One is hot fix available for VB performance issue in VS2008. It addresses performance issues in the following scenarios:

- The IDE takes a long time to build/rebuild the solution.

- You experience a slow response time when you press F5 to start debugging.

- You experience a slow response time in the Code Editor.

- You experience a slow response time in IntelliSense.

The performance issue is caused by having large files in your project that contain XML documentation. You’re most likely to run into these large files when using designer-generated files for web references and/or datasets. If you’ve found that turning off the option under the Compile tab in project properties for “Generate XML Documentation File” improves your performance, then this hotfix should address your issue.

Download it here.

The other is this useful tool called GhostDoc which enables you to generate XML description of your functions in VS 2008. I use this when coding in VB.NET though the VB.NET support is still experimental. This free add-in uses customizable templates to generate consistent, English-readable documentation based on the current context. To use it, right-click (or use CTRL + SHIFT + D) to document the current element:

Coding in VB.NET with VS 2008

This generates the following documentation (note GhostDoc split the property name into words and created a sentence from it):

Coding in VB.NET with VS 2008

Download GhostDoc from here.

Feb 16

This is MUST read from every dotNet programmer. It is written by Peter Ritchie on DevX.com and presents the new features of C# 3.0 syntax.

These guidelines will help you understand new additions to C# 3.0 syntax and avoid some of the pitfalls you can encounter when using them.

C# 3.0 includes a few syntactical additions to the language. For the most part, Microsoft added these language additions to support Language Integrated Query (LINQ). These features include (but are not limited to) lambda expressions, extension methods, anonymous types, implicitly typed local variables, automatic properties, and object initializers.

Most of the syntax additions fulfill very specific needs and should not reduce the importance of established coding and design methodologies and guidelines. When in doubt, prefer your established guidelines over the new syntax.

What is covered in his article:

- Lambda Expressions
- Extension Methods
- Anonymous Types
- Implicitly Typed Local Variables
- Object Initializers
- Automatic Properties

All these are presented with nice and small code samples. Read it here.

Feb 09

On 8th of Feb Microsoft released a hot-fix for the latest Visual Studio 2008. Scott Guthrie blogged about that release and I can’t miss that post. On Monday will install it personally and will blog about it. Here is what it should fix:

HTML Source view performance

* Source editor freezes for a few seconds when typing in a page with a custom control that has more than two levels of sub-properties.
* “View Code” right-click context menu command takes a long time to appear with web application projects.
* Visual Studio has very slow behavior when opening large HTML documents.
* Visual Studio has responsiveness issues when working with big HTML files with certain markup.
* The Tab/Shift-Tab (Indent/Un-indent) operation is slow with large HTML selections.

Design view performance

* Slow typing in design view with certain page markup configurations.

HTML editing

* Quotes are not inserted after Class or CssClass attribute even when the option is enabled.
* Visual Studio crashes when ServiceReference element points back to the current web page.

JavaScript editing

* When opening a JavaScript file, colorization of the client script is sometimes delayed several seconds.
* JavaScript IntelliSense does not work if an empty string property is encountered before the current line of editing.
* JavaScript IntelliSense does not work when jQuery is used.

Web Site build performance

* Build is very slow when Bin folder contains large number of assemblies and .refresh files with web-site projects.

Installation Notes

For more information on how to download and install the above patch, please read this blog post here. In particular, if you are using Windows Vista with UAC enabled, make sure to extract the patch to a directory other than “c:\” (otherwise you’ll see an access denied error).

To verify that this hot-fix patch successfully installed, launch VS 2008 and select the Help->About menu item. Make sure that there is an entry that says ‘Hotfix for Microsoft Visual Studio Team System 2008 Team Suite – ENU (KB946581)’.

If you ever want to remove the patch, go to Control Panel -> Add/Remove Programs and select “Hotfix for Microsoft Visual Studio 2008 – KB946581” under Microsoft Visual Studio 2008 (or Visual Web Developer Express 2008) and click “Remove”.

Download

Here

Jan 30

Omar AL Zabir had published one of his great posts again. This one is dedicated to ASP.NET performance and scalability secrets. Here are part of his explanation words:

ASP.NET 2.0 has many secrets, when revealed, can give you big performance and scalability boost. For instance, there are secret bottlenecks in Membership and Profile provider which can be solved easily to make authentication and authorization faster. Furthermore, ASP.NET Http pipeline can be tweaked to avoid executing unnecessary code that gets hit on each and every request. Not only that, ASP.NET Worker Process can be pushed to its limit to squeeze out every drop of performance out of it. Page fragment output caching on the browser (not on the server) can save significant amount of download time on repeated visits. On demand UI loading can give your site a fast and smooth feeling. Finally, Content Delivery Networks (CDN) and proper use of HTTP Cache headers can make your website screaming fast when implemented properly. In this article, you will learn these techniques that can give your ASP.NET application a big performance and scalability boost and prepare it to perform well under 10 times to 100 times more traffic.

In that article he will cover:
* ASP.NET Pipeline optimization
* ASP.NET Process configuration optimization
* Things you must do for ASP.NET before going live
* Content Delivery Network
* Caching AJAX calls on browser
* Making best use of Browser Cache
* On demand progressive UI loading for fast smooth experience
* Optimize ASP.NET 2.0 Profile provider
* How to query ASP.NET 2.0 Membership tables without bringing down the site
* Prevent Denial of Service (DOS) attack

Read more here

Jan 24

Once again Microsoft brings some knowledge to the masses :) This time its free e-books. All the headings speak for them selfs and with few words these books are MUST HAVE for every developer. Only few chapters are included in pdf’s as you are encouraged to buy them! Here is the content:

ms_linq_cvr.jpgIntroducing Microsoft LINQ
by Paolo Pialorsi and Marco Russo

ISBN: 9780735623910

* Chapter 1: LINQ Introduction
* Chapter 2: C# Language Features
* Chapter 3: Visual Basic 9.0 Language Features
* Chapter 4: LINQ Syntax Fundamentals
* Chapter 5: LINQ to ADO.NET
* Chapter 6: LINQ to XML

ms_ajax_cvr.jpgIntroducing Microsoft ASP.NET AJAX
by Dino Esposito

ISBN: 9780735624139

* Chapter 1: The AJAX Revolution
* Chapter 5: The AJAX Control Toolkit

ms_silverlight_cvr.jpgIntroducing Microsoft Silverlight 1.0
by Laurence Moroney

ISBN: 9780735625396

* Chapter 1: Silverlight and User Experience
* Chapter 5: Programming Silverlight with JavaScript

Log into Microsoft Press home page for more info here
Jan 21

Brad Abrams just converted the existing Web Site Starter Kit from the VS 2005 web site to use the new dot Net 3.5 framework, LINQ and Ajax extenders. Here is the full source code for that.

Here are some of the key points from his post:

- VS2008 Can Target .NET Framework 2.0
- Upgrade to ASP.NET 3.5 and Take Advantage of Linq
- Ajax Enabling the Site
- Tricking out the site with the Ajax Control Toolkit

read the whole post here

Jan 04

This one I found today, it was published on 18th of Dec by Tony Davis on http://www.simple-talk.com. Its quite interesting post I loved reading it.
Here is a short brief:
Visual Basic v9 appeared on November 19. In the past, the new release of Microsoft’s longest-running language might have caused a stir, but it was part of Microsoft .NET Framework 3.5 and there were plenty of other distractions. The changes to VB itself were pretty minor: The ‘Inline IF’ was finally retired in favour of a true ternary IF. We got support for LINQ, Lambda expressions like those of Python, support for XML Literals, and Type Inference. Hopefully, the real changes to the language will come with Visual Basic v10, which will use the Dynamic Language Runtime, and benefit from experience gained in the development of IronPython. It is set to be released with Silverlight 2 as ‘Dynamic Visual Basic’. In the meantime C# continues to increase its dominance in the .NET world. Poor JScript.NET seems to be in terminal decline despite its high quality, though it is, like VB, promised a DLR makeover for SilverLight, and is likely to be renamed ‘Managed JScript’.

For .NET scripting, things already look a lot livelier, thanks in part to the Dynamic Language Runtime (DLR). IronPython and PowerShell have, in the past year, found good solid niches, thanks to their effortless access to the CLR and, in the case of IronPython, excellent tutorials and good compatibility with existing Python code. We all hoped for more with IronRuby, which now seems to be stuck in a pre-alpha limbo due more to legal than technical problems. This is disappointing for those of us who liked some of the ideas in Ruby on Rails. While we wait for Ruby, there is Boo and Nemerle to play with.
read the whole

Dec 13

Part 4 from Bill Horst’s series, now its functions turn.

Functions

SQL SELECT clauses often involve functions, which can be scalar or aggregate. An aggregate function is applied to a field over all the selected records, while a scalar function is called with individual values, one record at a time. It is possible to re-create both kinds of functions with VB LINQ expressions, but in very different ways.

Scalar Functions

Scalar functions are called on each record with whatever parameters are specified. They can appear various places in a SQL query, such as in the SELECT clause. The Scalar Functions available differ from system to system, but usually, there will be an analogous VB method that can be used. If using a Scalar Function in a LINQ Select clause, you will probably need to specify an alias as well (FirstThreeLetters, CurrentTime).

SQL

SELECT LEFT(ItemName, 3) FirstThreeLetters, NOW() CurrentTime
FROM OrderTable

VB

From Shipment In OrderTable _
Select FirstThreeLetters = Left(Shipment.ItemName, 3), CurrentTime = Now

In the above case, Left and Now are methods already built into VB, defined in Microsoft.VisualBasic.dll. This will likely be the case for most common scalar functions you will find in SQL statements. Even if the function you wish to call does not exist in VB already, you can define your own methods, too. However, user-defined methods cannot be used in a Database query, as they will throw an exception at runtime. In the below example, MyFunction is a user-defined function called from the Select clause.

VB

From Shipment In OrderTable _
Select MyFunction(Shipment.Cost, Shipment.ShippingZip)

Aggregate Functions

Aggregate functions are called on certain fields over an entire set of records, and return one value. In a SQL statement, they can appear in the SELECT clause. With VB LINQ, this concept appears a bit differently.

A VB LINQ expression usually begins with a From clause. However, they can also begin with an Aggregate clause. The Aggregate clause has the same syntax as a From clause, except that it starts with a different keyword. If a query starts with an Aggregate clause, it must end with an Into clause. An Into clause is a comma-delimited list of Aggregate function calls, with aliases that can accompany them. The below example shows a SQL SELECT statement that uses Aggregate functions, and an equivalent VB LINQ expression.

SQL

SELECT SUM(Cost) TotalCost, COUNT(*)
FROM OrderTable
WHERE OrderDate > “Sept-29-2007

VB

Aggregate Shipment In OrderTable _
Where Shipment.OrderDate > #9/29/2007# _
Into TotalCost = Sum(Shipment.Cost), Count()

read source

Dec 11

I found that one at the Visual Basic Team Blog. Over here she puts together a list of some of the new features in Visual Basic 2008:

I like these :)
2) If Operator

Ever notice that the IIF function returns something of type Object? This means that you don’t get Intellisense or type-checking by default on that result. For those of you that insist on type-safe, early-bound code, you have to cast the result. The code then looks something like this:

Dim intC As Integer = CInt(IIf(intA = intB, intA, intB - 1))

With the If operator, you can now write that line as:

Dim intD As Integer = If(intA = intB, intA, intB)

And with type inference it gets even easier on the eyes:

4) Nullable

Nullable is the feature you’ll notice but rarely have to think about. It’s basically the .NET representation for a Nullable value type (Integer, Date, etc.) Using the designer for LINQ to SQL, the Object-Relational Mapping layer introduced in Visual Studio 2008, nullable columns in your database are mapped to this type. The result is that you can write the following expression in VB and the right thing happens – null valued rows propagate null. In the example below, the Independence property on the Country type is a nullable date, denoted as Date?

        Dim virginIslands As New Country With {.Independence = Nothing}
        Dim palau As New Country With {.Independence = #10/1/1994#}
 
        Dim vILength = #8/24/2005# - virginIslands.Independence ' Nothing
        Dim pLength = #8/24/2005# - palau.Independence ' 3980.00:00:00

9) Type inference for loop variables

Check out the following code:

And this code:

Without having to specify the type of the control variable, it’s inferred from right-hand-side expression or the collection we’re iterating over.

read all of them from here