TopMenu

Presenting webcast on VS2010 productivity

The online session meeting being held on 24th Dec 2011. I’ll be presenting a session on How to increase productivity with Visual Studio 2010 and will talk about “Tools and Extensions that enhances the programming experience on VS2010” on 24th Dec 2011 from2:00pm – 3:00pm (IST) .

Understanding the Tools, Extensions like Visual Studio 2010 productivity power tool extension, VS2010 power command tool extension and other third party free tools that can speed up your programming just like that.

 

Time

Session

Abstract

24th Dec 2011 ( Saturday)
2.00 PM – 3.00 PM

Superproductive developers with Visual Studio 2010

You can be a superproductive developer you can speedup your coding, typing and remembering shortcut keys. Best you can take 100% of VS but if you want to take 150% output with VisualStudio there are other ways too.

Join the session to know “How to be superproductive with VisualStudio”.



The Target Audience :  Level 100 - Level 300
(Developers)

Meeting link - http://kolkatageeks.com/WebCast/JoinWebCast.aspx

See you there !

Cheers !

Amit

SSIS Script ERROR -The task is configured to pre-compile the script, but binary code is not found

If you’re working on SSIS with SqlServer 2005 version then you may encounter this error while working with Script Task. The Error message would be like -

“Error at Script Task: The task is configured to pre-compile the script, but binary code is not found. Please visit the IDE in Script Task Editor by clicking Design Script button to cause binary code to be generated.”

And you package will not run.

Root cause reported by Microsoft support team -

This problem occurs because of a recent change in the common language runtime (CLR) workstation runtime for builds of the Microsoft .NET Framework 2.0. The CLR workstation runtime is named Mscorwks.dll. The change introduces a compatibility problem for the Microsoft Visual Basic runtime engine that VSA uses. The Visual Basic runtime engine is named Vsavb7rt.dll. The problem prevents assemblies from being created correctly during the macro compilation operation. Because of this problem, existing packages that contain compiled scripts do not run.

And Here is the fix for this -

Download the hotfix package now.

This fix updates the SQL Server Integration Services 2005 (SSIS) scripting environment to work with a newly-released patch for a security vulnerability in the .Net Framework 2.0. Without this fix, any VB.Net scripts (Script Task or Script Component) in your SSIS packages may not execute, or work at design-time as expected.

After searching about the error I collected the above information to resolve the error. Hope this was helpful.

Free ebook on MVC 3 Razor view engine by Abhimanyu

The youngest blogger and my friend Abhimanyu kumar vatsa who is student just released his first book on MVC 3 Razor View Engine. I appreciate the effort and contribution towards the Microsoft community to add another knowledge resource for free.
Great work Abhi!! Keep the good spirit up Smile.
Download E-Book

In this e-book you will learn all about Razor View Engine introduced in MVC 3. I will walk through the simple steps and even I will keep my ideas simple so that you can understand the Razor View Engine better. My aim through this e-book is to teach Razor so I am going to play a little loose with rest all.

Redgate SQL Search fastest way to find your DB objects

Life is easy when you are equipped with right tools. Recently I found one more tool (you can call me Tool Maniac) “SQL Search” from RedGate for Sql Server and the fun is Its a free utility, you don’t have to pay for your comfort. Its gonna reduce your time to search you DB Object through manual navigation or by Sp_help/SP_helptext then copy the text and open it new query window.

Very first go and download the new tool from - http://www.red-gate.com/products/sql-development/sql-search/

Installation steps are as easy as click on Next –> Next and Finish.

Here is some cool feature I’m gonna show today -

After installation of the tool open the SQLServer management studio. Now you’ll see a new “SQL search” button on tool ribbon.

Now start searching Select your Instance, select DB select type of object you want to search blah! blah! blah!

The coolest feature I found is you can directly navigate to the db object in the Object Explorer.

Other perspectives -

  • Impact Analysis
    You want to rename one of your table columns but aren't sure what stored procedures reference it. Using SQL Search, you can search for the column name and find all the stored procedures where it is used.
  • Work faster
    Finding anything in the SSMS object tree requires a lot of clicking. Using SQL Search, you can press the shortcut combo, start typing the name, and jump right there.
  • Make your life easier
    You need to find stored procedures you've not yet finished writing. Using SQL Search, you can search for stored procedures containing the text 'TODO'.
  • Increase efficiency, reduce errors
    You are a DBA, and developers keep using 'SELECT *' in their views and stored procedures. You want to find all these and replace them with a correct list of columns to improve performance and prevent future bugs. Using SQL Search, you can look for 'SELECT *' in the text of stored procedures and views.

Now what are you thinking go ahead and save time for some other stuff you’re running on deadlines buddy.

Smile

CSharp Application commonly used terms

There are few terms being used when you deal with project development with Microsoft .Net technology. If you are a Team Lead or a senior developer or simply a beginner you may want to know about these terms which are extensively being used when working on project of .Net.

Application — refers to an assembly that has an entry point . When an application is run, a new application domain is created. Several different instantiations of an application can exist on the same machine at the same time, and each has its own application domain.


Application vs. program
Note that an application is just an assembly with an entry point, and an application may be used as a class library by another application. Common usage often has the terms application and program interchangeable, but there is a defined difference in C#; see the definition of program in the following text.
Application domain — an entity that enables application isolation by acting as a container for application state. An application domain acts as a container and boundary for the types defined in the application and the class libraries it uses. Types loaded into one application domain are distinct from the same type loaded into another application domain, and instances of objects are not directly shared between application domains. For instance, each application domain has its own copy of static variables for these types, and a static constructor for a type is run at most once per application domain. Implementations are free to provide implementation-specific policy or mechanisms for the creation and destruction of application domains.
Argument — an expression in the comma-separated list bounded by the parentheses in a
method or instance constructor call expression or bounded by the square brackets in an element access expression. It is also known as an actual argument.
Assembly — refers to one or more files that are output by the compiler as a result of program compilation. An assembly is a configured set of loadable code modules and other resources that together implement a unit of functionality. An assembly can contain types, the executable code used to implement these types, and references to other assemblies. The physical representation of an assembly is not defined by this specification. Essentially, an assembly is the output of the compiler.
Assembly vs. class files
It is interesting to compare the granularity of Java and C# compiler outputs. A C# compiler will probably emit an assembly, a Java compiler a collection of class files. This emphasizes an important C# design goal—to support components rather than individual types.
Behavior — external appearance or action.
Behavior, implementation-defined — unspecified behavior where each implementation documents how the choice is made.
Behavior, undefined — behavior, upon use of a non-portable or erroneous construct or of erroneous data, for which this International Standard imposes no requirements. [Possible handling of undefined behavior ranges from ignoring the situation completely with unpredictable results, to behaving during translation or execution in a documented manner characteristic of the environment (with or without the issuance of a diagnostic message), to terminating a translation or execution (with the issuance of a diagnostic message)].
Behavior, unspecified — behavior where this International Standard provides two or more possibilities and imposes no further requirements on which is chosen in any instance.
Class library — refers to an assembly that can be used by other assemblies. Use of a class library does not cause the creation of a new application domain. Instead, a class library is loaded into the application domain that uses it. For instance, when an application uses a class library, that class library is loaded into the application domain for that application. If an application uses a class library A that itself uses a class library B, then both A and B are loaded into the application domain for the application.
Accessing class libraries
The mechanism by which class libraries are made available to the current compilation is not defined by this specification.
Diagnostic message — a message belonging to an implementation-defined subset of the implementation’s output messages.
Error, compile-time — an error reported during program translation.
Exception — an error condition that is outside the ordinary expected behavior.
Implementation — particular set of software (running in a particular translation environment
under particular control options) that performs translation of programs for, and supports execution of methods in, a particular execution environment.
Namespace — a logical organizational system that provides a way of presenting program elements that are exposed to other programs.
Parameter — a variable declared as part of a method, instance constructor, operator, or indexer definition, which acquires a value on entry to that function member. It is also known as a formal parameter.
Program — refers to one or more source files that are presented to the compiler. Essentially,  a program is the input to the compiler.
Programs, assemblies, applications and class libraries
This definition of program differs from common usage. In C#, a program is just the input to
the compiler. The output of the compiler is an assembly, which is either an application or a
class library.
Program, valid — a C# program constructed according to the syntax rules and diagnosable semantic rules.
Program instantiation — the execution of an application.
Recommended practice — specification that is strongly recommended as being aligned with the intent of the standard, but that might be impractical for some implementations.
Source file — an ordered sequence of Unicode characters. Source files typically have a one-to one correspondence with files in a file system, but this correspondence is not required.
Unsafe code — code that is permitted to perform such lower-level operations as declaring and operating on pointers, performing conversions between pointers and integral types, and taking the address of variables. Such operations provide functionality such as permitting interfacing with the underlying operating system, accessing a memory-mapped device, or implementing a time-critical algorithm.
Warning, compile-time — an informational message reported during program translation, that is intended to identify a potentially questionable usage of a program element.

RIP Dennis Ritchie The GodFather of C & Unix 1941-2011

dennis_ritchie

Isaac Newton once said he stood on the shoulders of giants. Dennis Ritchie was a giant whose shoulders people like Steve Jobs stood on.

Dennis Ritchie, Creator of the C Programming Language & UNIX is dead at age 70.....all programmers owe him a moment of silence! Read his biography at Wikipedia.


Pioneer of Computing Resting in Peace...
*Dennis Ritchie has graduated from Harvard University with degrees in physics and applied mathematics and has started began working at the Bell Labs Computing Sciences Research Center and received a Ph.D. from Harvard.
*He is the creator of the C programming language and a key developer of the Unix operating system, and as co-author of the definitive book on C, The C Programming Language

kd14
* He is one of the pioneers of modern computing. The C language is still widely used today in application and operating system development


You don't know him ? He is the Father of C, without him Operating Systems(Windows, Apple) wouldn't be here, Games, Programs, Apps on your Apple, Android, wouldn't exist. Many say he is the Father of Computer Science, He has so many achievements..

image

Dennis Ritchie (1941-2011). His pointer has been cast to void *; his process has terminated with exit code 0.

Binary_Checksum the Alternate of NewID() to fetch random records in SqlServer

Sometimes its required to fetch random records from database. The simplest approach is to use NewID() with order by clause. Well I have no problem with that but when you have large table to query then It’ll start popping up the issues of performance. Why? I’ll try to answer this question with alternative solution.

To start with I’ve Adventureworks database with around 260000 records in a table and we’ve a query that will take a random record from it.

SELECT TOP 1 [BusinessEntityID] FROM HumanResources.EmployeePayHistory  ORDER BY NEWID()

The problem with this query is, when you look at the execution plan then you’ll find it performs a sort operation before it picks a top record.

image

So 91% of the cost is due to the sort operation. Well this will happen if you use NewID() to pick the random records it first sorts the records based on NewID() which is worst case for sorting based on GUID values.

Now get rid of Sort operation of NEWID() by- BINARY_CHECKSUM

Best approach is to use the BinaryCheckSum instead of NewID to reduce the sort operation to perform on NEWID column generated in Memory.

SELECT TOP 1 [BusinessEntityID]

 

FROM HumanResources.EmployeePayHistory

 

WHERE (ABS(CAST(

 

(BINARY_CHECKSUM(*) *

 

RAND()) as int)) % 100) < 10

The BINARY_CHECKSUM function generates a checksum value that is based on the values of the columns that you specify. If two rows are different, they typically will generate different checksum numbers. TheBINARY_CHECKSUM function generally is used to verify whether any of the columns in a row in a table have changed. However, for our purposes, it generates a number that looks like a random number for each row.

Another form of using BinaryCheckSum can be:

SELECT TOP 1 [BusinessEntityID]

 

FROM HumanResources.EmployeePayHistory

 

WHERE

 

(ABS(CAST(

 

(BINARY_CHECKSUM

 

([BusinessEntityID], NEWID())) as int))

 

% 100) < 10

Both will form of Binary_Cheksum will have same query Execution plan with similar cost.

Now lets have a look at the Figures analyzed by the Microsoft team to compare performance of both queries.

13 million rows

         

NEWID query

253

347,420

13,810,132

14,157,552

422,891

BINARY_CHECKSUM query

21

347,420

0

347,420

49,203

And in our case here I’ve also did some comparison based on Query plans of Old query of NEWID and new query with BINARY_CHECKSUM

image

Just another tips improving performance but if you have to pick random records from small tables in SQL then you can still use NEWID() with no issues.

Let me know you feedback. Please do comments if you like to.

Fastest way to populate datatable using ADO.Net classes

Alright folks who knows the panic of using SqlDataAdapter class to fill the Datatable in case if you required only a single table to fill from database. This post is to show you there’s an alternate way to get a DataTable and that’s alternate way is returning DataReader from the command object after executing the command.

image

Well I always thought of DataReader when it comes to performance but I can’t forget to keep the data in memory and also keeping in mind that DataReader works in connected mode. So I came up with the mixed approach means reading the fetching the data from DataReader and then fill the data into a DataTable. The next thing was to make it reusable so finally I did some juggling with the code and came with the code below that can convert your DataReader object to DataTable.

Always use IDataReader to receive the object returned from the Command.ExecuteReader() method.

you can get the schema of the Table by method that is available through the IDataReader interface GetSchemaTable(). I’ll use this method to get the schema of the table that IDataReader is holding. Then creating a new DataTable using the data we received from the schema and then start populating it by using the data in the DataReader. See below snippet I’ve put all the ideas together and created this method GetDataTableFromDataReader().

public DataTable GetDataTableFromDataReader(IDataReader dataReader)
{
    DataTable schemaTable = dataReader.GetSchemaTable();
    DataTable resultTable = new DataTable();

    foreach (DataRow dataRow in schemaTable.Rows)
    {
        DataColumn dataColumn = new DataColumn();
        dataColumn.ColumnName = dataRow["ColumnName"].ToString();
        dataColumn.DataType = Type.GetType(dataRow["DataType"].ToString());
        dataColumn.ReadOnly = (bool)dataRow["IsReadOnly"];
        dataColumn.AutoIncrement = (bool)dataRow["IsAutoIncrement"];
        dataColumn.Unique = (bool)dataRow["IsUnique"];

        resultTable.Columns.Add(dataColumn);
    }

    while (dataReader.Read())
    {
        DataRow dataRow = resultTable.NewRow();
        for (int i = 0; i < resultTable.Columns.Count - 1; i++)
        {
            dataRow[i] = dataReader[i];
        }
        resultTable.Rows.Add(dataRow);
    }

    return resultTable;
}

Now you can  use this method to fetch the data in the DataReader and then get the DataTable from it. Its really fast I’m telling you. Yeah people can ask me about the complexity of creating another table’s schema and looping through the records. But this method is still worth using SqlDataAdapter class instead.

Let me go though a small demo over this. Let create a DB connection and use this method and the Adapter method to get the Performance records.

public class DAL
{
    static SqlConnection connection;
    public DAL()
    {
        connection = new SqlConnection();
        connection.ConnectionString = System.Configuration.ConfigurationSettings.AppSettings["myConnectionString"];
    }

    public DataTable GetDataTableByAdapter(string query)
    {
        connection.Open();
        DateTime start = DateTime.Now;
        DataTable dt = new DataTable();
        new SqlDataAdapter(query, connection).Fill(dt);
        TimeSpan ts = DateTime.Now.Subtract(start);
        System.Diagnostics.Trace.Write("Time Elapsed in Adapter: "+ts.TotalMilliseconds);
        connection.Close();
        return dt;
    }

    public DataTable GetDataTableFast(string query)
    {
        connection.Open();
        DateTime start = DateTime.Now;
        IDataReader rdr = new SqlCommand(query, connection).ExecuteReader();
        DataTable resultTable = GetDataTableFromDataReader(rdr);
        TimeSpan ts = DateTime.Now.Subtract(start);
        System.Diagnostics.Trace.Write("Time Elapsed in Custom : " + ts.TotalMilliseconds);
        connection.Close();
        return resultTable;
    }
}

Now lets call this method in a console application and then we’ll go through the Trace where the code will be writing the elapsed time in individual operation.

static void Main(string[] args)
        {
            DAL dal = Singleton<DAL>.Instance;
            string query = "Select * from Production.Product";
           
            DataTable dt1 = dal.GetDataTableFast(query);
            DataTable dt = dal.GetDataTableByAdapter(query);
            System.Console.Read();
        }

Now Run the code and lets have a look at figures. I ran this program 2 times just to make sure counts are correct

First Run -      Time Elapsed in Adapter: 93.0053 Time Elapsed in Custom : 13.0008

Second Run - Time Elapsed in Custom : 129.0074 Time Elapsed in Adapter: 14.0008

So I’m sure you must be impressed with performance here. Moreover you can make it more fast by using the Parallel.For() and Parallel.Foreach() loop if you are working on .Net 4.0 and have a multicore processor.

Hot smileGet Smarter..Get Faster!! Nobody wants to wait.

image

Performance Dashboard Reports in SSMS SQL Server 2008 R2 to find the Bottlenecks

SqlServer developers, DBAs or if you are just normal developer who often uses the SSMS if you are assigned to optimize the database performance and you’re not much familiar or don’t' want to play around with DMVs and DMFs then Performance Dashboard Reports are for you.

Go and download the performance dashboard reports from here. and add it as a custom report to Management Studio (SSMS). It is a free download! Read on below to find out how to install it and use it on your SQL Server. I have also included custom modified files as attachment in end of the post that allow you to use this for a SQL Server 2008 instance. This is provided “as is” with no guarantees.

What will you get by these reports?

Well, These reports are created covering the performance aspects for SQL Server instance. The reports are mainly intended to quickly identify performance problems and help resolve them. These reports use the DMV’s that came out with SQL 2005, so they are very fast & reliable information when troubleshooting a performance problem. Some of the common problems that can be detected using the Dashboard Reports are:

1) CPU bottlenecks (which queries are consuming the most CPU and Plan for this query)

2) IO bottlenecks (which queries are performing the most IO and Plan for this query).

3) Index recommendations generated by the query optimizer (missing index recommendations pulled from sys.dm_db_missing_index_details and sys.dm_db_missing_index_group_stats)

4) Blocking

5) Latch contention and other Wait Types

Pre-Requisites

1. You need to have Management Studio installed on the machine where you intend to use the Performance Dashboard Reports (could be either client or server machine).

2. If you are still using SQL Server 2005 the it needs to have at a minimum SP2 applied (build 9.0.3042 or greater)

Steps to Install:

For SQLServer 2005

1. Run the setup exe downloaded from HERE.

2. Once you install the above, go to %\Program Files\Microsoft SQL Server\90\Tools\PerformanceDashboard and run the setup.sql script against the SQL instance that you want to monitor the performance for.

For SQLServer 2008 R2

1. Run the setup exe downloaded from HERE.

2. Once you install the above. Download the attachment from the link at end of this post and extract the files. You’ll find two files there copy them and paste them to %\Program Files\Microsoft SQL Server\90\Tools\PerformanceDashboard. Overwrite the old files and run the setup.sql script against the SQL instance that you want to monitor the performance for.

Start using the performance reports

Note: The script will create some Stored Procedures, table-valued & scalar functions in the MSDB database. All the SP’s created by Dashboard with have the schema MS_PerfDashboard.

If you want more information on the newly created objects, use the query below
If you want more information on the newly created objects, use the query below
select * from sys.objects where schema_id = SCHEMA_ID('MS_PerfDashboard')

Now, Open a new management studio window, right-click on instance name -> Reports -> Custom Reports.

image

Browse to the location %\Program Files\Microsoft SQL Server\90\Tools\PerformanceDashboard and choose the performance_dashboard_main.rdl and click OK. This will add the performance dashboard to SSMS.

Next time when you right-click on the instance and go to Reports, you should see the entry performance_dashboard_main. Clicking on this will launch the Main Dashboard page.

Below is the screenshot of what the performance report will look like:

image

Few basic fixes you can do quickly:

Missing Indexes -

In the Miscellaneous Information it’ll show you the Missing Indexes link. Click it will open the other reports that will not only show you the Missing index information but also the queries to created them.

Expensive Queries -

If you have queries running on your server instance as job or frequently and consuming lots of resources you’ll find these reports very useful.

image

Report for queries taking higher CPU time will be show by the graph you can click on the bar and find the query details like execution plan, time etc.

Export your reports – Reports should have Export function so it is there. Just right click on any report and select Excel or PDF.

image

Sound interesting.. umm then go ahead and explore more Nerd smile.

You can find some more interesting material of using Performance dashboard reports

1. PPT on Performance Dashboard Reports by Amit Banarjee

2. Perfromance Dashboard “troubleshooting problems” Video by Harish Chawla 

I hope you will enjoy this small but great Dashboard to tune your SqlServers.

download the upadted setup.sql for SqlServer 2008

How to Fix Selenium popup alerts problem in Web Automation Testing

Selenium is popular framework that is being used with automation testing of webpages. But there is a problem that is being faced by the testing teams is it doesn’t support the handling of Popup or alert() boxes being called on onload() or onbeforeunload() event of browser. There’s workarounds exists like AutoIT etc. Special case seen for this is when we have Confirmation applied before navigating away from a page and selenium would fail to handle this and Automation will fail. One of my colleague was facing the same problem and he don’t want to use AutoIT. So I came with my own solution that can be used as fix and work well in handling the popups/alerts.

Environment: NUnit, Selenium, C#

The best way to deal with such alert box or popup is to use vbscript. It can identify the running window instance by its title and will send the “Enter” key to send ok.

The complete code for vbs will be:


Set oShell = CreateObject("WScript.Shell")
Set
args = WScript.Arguments
arg1 = args.Item(0)

If oShell.AppActivate(arg1) Then
Wscript.Sleep 500
oShell.SendKeys
"{ENTER}"
End
If

Create a new vbs file copy & paste the above code save it.

Next step is to call the vbs file when you webpage is showing the alert/popup with ok/cancel (whatever) buttons. To call the vbs you need to change your methods calls in NUnit.

So create a function that can call the vbs as separate process asynchronously to open and wait for a while to open the page and alert box to appear. Copy and paste the below method code. The function will take title of the window as argument and call the vbs file. I’ve named the vbs file to auto.vbs here.

public Thread SimulateClickForConfirmation(string title)
{

//Simulate autoclick on IE windows
Thread th = new Thread(new ThreadStart
(() => {
Thread
.Sleep(1000);
Process script = new Process
();
script.StartInfo.FileName =
Environment.CurrentDirectory + "\\auto.vbs"
;
script.StartInfo.Arguments = title;
script.Start();
script.WaitForExit();
script.Close();
}));

th.Start();

return th;
}

Now you’ll call this function when you want to simulate the click for the alert or confirmation popup.

for e.g:

Thread th = pObj.SimulateClickForConfirmation(currentPage.Title);

//navigating away from the current page by clicking through selenium
selenium.Click(Someotherpage);

//abort the thread if previous statement gets executed
th.Abort();

This will activate the browser window and click on the alerts or confirmation box’s default button. I hope this would help our testing team facing such problems.

So Don’t stop testing.. Smile.

RadDock vs WebParts comparison list

To compare RadDock and Webparts, I did some research and I found few points that
can help you taking decision which control to use either RadDoc or WebParts. Both provides you user personalization experience. Below are my listings:

Features of Webparts and RadDock

WebParts provide the following features out of the box:

  • Adding new WebParts to the page

  • Editing the content of a WebPart

  • Binding WebParts

These features are not built-in within the RadDock control but can be easily implemented.

RadDock provides:

  • [Live] resize functionality

  • Rich client-side API

  • Animations

  • Smooth drag and drop

  • Cross-browser compatibility

  • 13 built-in Skins

Ease of development

RadDock allows developers to create dynamic pages, the content of which can be personalized
by end users, and then the changes are saved and later restored to the last state.
Inbuilt features are available to support the rapid development and can be customized
as per the requirements. Built-in skin and CSS support.

Save state in cookies for statically created RadDocks.
Dynamically add or delete RadDocks via Ajax and save their state in the session

Microsoft WebParts allow developers to easily create a portal, i.e. they represent
the parts for creating and personalizing page layouts, contributing content, uploading
documents, etc. - things related to portals. Webparts has to be designed from scratch
but can be built in separate DLL and installed in the GAC to reuse across applications.
Creation of webpart and Adding skin/css requires work from scratch and provide high
level of customization.

Personalization

Available Features:
Asp.net Webparts allows the personalization with two types of control:

Shared control: - An authorized user can personalize both Shared and User scoped
properties on the control for all users. In the case of a dynamic control (a control
that is added to the page programmatically, or from a catalog of controls), an authorized
user can permanently delete it for all users. In the case of a static control (a
control that is declared in the markup of an .aspx page), it cannot be deleted,
although an authorized user can close the control for all users.

Per-User control: - The control cannot be personalized with the page in Shared scope,
because the control does not even appear on the page. The control only appears when
the page is in User scope.

RadDock controls are always in shared mode and allow all users to interact. But
you can customize them to persist/Not-persist the changes in layout state as per
the user.

Ease of Customization:

For custom personalization you need to create a custom provider class in Asp.net
WebParts. WebPartPersonalization class Implements the logic necessary to carry out
personalization actions.

Customization of the RadDock would be much easier as more focus would be on logic
rather than the look n feel. RadDock allow saving/loading of layout so no need to
create custom provider.

Pros and Cons
  • The biggest drawback of webparts is that it does not open the properties section
    inside the webpart. Instead, it opens in a zone on the main screen.

  • An even bigger drawback of WebParts is that you can't edit the properties while
    in catalog view. To switch between the two, you need to do a postback.

  • For RADDOCK there’s no need to implement any provider. Instead it requires customizing
    the scope and persistence of user’s layout.

  • WebParts work only when in admin mode.

  • Webparts are using the table layout which itself seems problematic in some cases.

References:

http://demos.telerik.com/aspnet-ajax/dock/examples/myportal/defaultcs.aspx

http://msdn.microsoft.com/en-us/library/z36h8be9.aspx">
http://www.telerik.com/community/forums/aspnet-ajax/docking/comparison-with-the-asp-net-web-part-framework.aspx

http://www.telerik.com/community/forums/aspnet-ajax/docking/comparison-with-the-asp-net-web-part-framework.aspx

Improve your productivity with New PowerCommands Tool on VisualStudio 2010

If you gone through the last post about Productivity Power Tool and found it useful then here' I’m again with a new HotShot stuff that will increase your productivity +1 level up. Are you ready to take a tour on this? yes.. you are thats why you are developers guys. So lets get started. So our next Tool for Visual Studio 2010 is PowerCommands Tool.

Go and download the PowerCommands for Visual Studio 2010 here.

SNAGHTML18848871 Download PowerCommands for Visual Studio 2010 Extension

[ I somehow manage to create this image to looks relevant Hot smile]

This is hottest in the market I’m telling you When I saw the download and rating, it made me post about it. imageSee the figures when I was writing this post. And these figures it earned in very short time.

 

Install it simple steps as any other addin for VS2010. Now restart visual studio and lets see what you can do with it:

1. New Context menu commands for files, projects and solution

Right click on any file in the Project and see new options

image

i) Yes Open Containing Folder is previously was only for Project and Solution files but now each file can be directly be navigated in the containing folder.

ii) Open the CommandPrompt in the Containing folder. You may ask how often will I use it.. But I can tell you few instance svcutil, wsdl, snkey etc. for these utilities you need command prompt. Now this sounds cool isn’t it.

2. Copy Reference

Now its more cool then ever and easy with time saving on adding reference. If you have one reference in one project in your solution and want to add the same in other project then Right Click the reference and Copy Reference. Go and Paste it in other project.

image

2. Copy As Project Reference
This command copies a project as a project reference to the clipboard. It can be executed from a project node. Quick way to adding the project as reference.

3. Commands for solution file

Right on the solution file will show you few new commands added.

image

=> Copy Path
This command copies the full path of the currently selected item to the clipboard. It can be executed by right-clicking one of these nodes in the Solution Explorer:
The solution node; A project node; Any project item node; Any folder.

=> Format document on save / Remove and Sort Usings on save
The Format document on save option formats the tabs, spaces, and so on of the document being saved. It is equivalent to pointing to the Edit menu, clicking Advanced, and then clicking Format Document. The Remove and sort usings option removes unused using statements and sorts the remaining using statements in the document being saved.
Note: The Remove and sort usings option is only available for C#  documents.
Note: Format document on save and Remove and sort usings both are initially defaulted OFF.

=> Collapse Projects
Super cool for you if you have large number of projects in your solutions. This command collapses a project or projects in the Solution Explorer starting from the root selected node. Collapsing a project can increase the readability of the solution. This command can be executed from three different places: solution, solution folders and project nodes respectively.

=> Remove and Sort Usings (Batch command to all files/Projects)
This command removes and sort using statements for all classes given a project. It is useful, for example, in removing or organizing the using statements generated by a wizard. This command can be executed from a solution node or a single project node.

=> Show All Files (Batch command to all files/Projects)
This command shows the hidden files in all projects displayed in the Solution Explorer when the solution node is selected. It enhances the Show All Files button, which normally shows only the hidden files in the selected project node.

image

Copy & Paste Class
Just like references This command copies a selected class entire content to the clipboard, renaming the class. This command is normally followed by a Paste Class command, which renames the class to avoid a compilation error. It can be executed from a single project item or a project item with dependent sub items. Paste command pastes a class entire content from the clipboard, renaming the class to avoid a compilation error. This command is normally preceded by a Copy Class command. It can be executed from a project or folder node.

Edit Project File
This command opens the MSBuild project file for a selected project inside Visual Studio. It combines the existing Unload Project and Edit Project commands.

Tab commands

=> Undo Close
This command reopens a closed document , returning the cursor to its last position. To reopen the most recently closed document, point to the Edit menu, then click Undo Close. Alternately, you can use the Ctrl + Shift + Z shortcut.
To reopen any other recently closed document, point to the View menu, click Other Windows, and then click Undo Close Window. The Undo Close window appears, typically next to the Output window. Double-click any document in the list to reopen it.

=> Close All
This command closes all documents. It can be executed from a document tab.

File Menu

=> Clear Recent File List
This command clears the Visual Studio recent file list. The Clear Recent File List command brings up a Clear File dialog which allows any or all recent files to be selected.

=> Clear Recent Project List
This command clears the Visual Studio recent project list. The Clear Recent Project List command brings up a Clear File dialog which allows any or all recent projects to be selected.

Code Perspective

=> Email CodeSnippet
To email the lines of text you select in the code editor, right-click anywhere in the editor and then click Email CodeSnippet. Easy peasy to send the peace of code which needs to be sent and discussed and subject line is seems to be meaning full! Winking smile

image


=> Insert Guid Attribute
This command adds a Guid attribute to a selected class. From the code editor, right-click anywhere within the class definition, then click Insert Guid Attribute.

=> Refactor any hardcoded value to constants

Just select the value and right click on it | Refactor | ExtractConstant. See screenshot below

image

I hope you have enjoyed the show. You must be feeling something like:

 

 image

 

 

Dear Readers!!! I always try to come with best of my finding for you so keep an eye on www.cshandler.com

Improve your productivity with VisualStudio 2010– Productivity Power Tools

Are you a smart visual studio 2010 developer? If you want to be then this post is for you. This post is for Visual Studio 2010 users to get productive while working. Whatever you missed to have in your VS release, is here. While writing the code your another task is to manage the things around and this tool will help you providing everything on the table. Best features ever seen with good UI and at very small cost of performance overhead if you have minimal requirement of hardware configuration for VS2010.

Very first Go and Download the VS2010 Productivity Power Tool from here.

image Download ProPowerTools

Installation is as smooth as like another plugin. After Installing you may want to visit features that I liked most. There’s lots of things you would see are available as options to quick clicks. but below are mine favorites and I use them massively.

1. Improved Add reference prompt box with search

This is one of the feature I’ve ever waited cause manually going through and finding the references of assembly..ohh that sucks!! But now you can just type in search box and everything that matches get filtered and you can select it plus box will be there you can add more if you want and then just close the box when you’re done. and its loading fast.

image

2. Quick Access
Quick Access is a new tool window that allows users to search for and execute common tasks within the Visual Studio IDE. Not sure where a particular menu command is located? Want a quick way to create a new Silverlight project? By using Quick Access, you can efficiently find and execute common VS operations without taking your hands off the keyboard. Quick Access allows users to:

  • Execute Main Menu and Context Menu commands
  • Open the New Project Dialog with a specific Project Template selected
  • Show a tool window
  • Jump to a Visual Studio Options page
  • Navigate to an open document in your Tab Well
  • Create and execute a series of actions (task)

To use, press Ctrl+3 to launch Quick Access, type in your search term (e.g., “debug”), and press Enter on the desired result. If your search term returns too many results, continue pressing Ctrl+3 to cycle through each category of results.

3. Auto Brace Completion
Automatic Brace Completion improves the productivity of writing code by automatically inserting the closing code construct when the opening construct is typed for VB & C#. More specifically, this extension:

  • Supports the following constructs: (), {}, [], <>, “”, and ‘’.
  • Allows you to press <TAB> to navigate past the next enclosing brace
  • Allows you to automatically complete a statement in C# by inserting the closing semi-colon and moving you to the next line with SHIFT + ENTER

The extensions from the previous Productivity Power Tools have been included and improved.

4. HTML Copy

If you are a blogger then you’ll love it cause you may want to copy the code as HTML when you add it to your post. I’m telling you it’s a worth utility. you’ll no longer have to go fix up the formatting of your code when you paste it into a TFS bug form or any other HTML based control. It is possible to modify the html format which gets copied to the clipboard and with the release you now have the ability to customize that to suite your needs. You can go to Tools | Options | Productivity Power Tools | HTML Copy or Simply just press CTRL + 3 and type “HTML COPY” Winking smile

5. Triple Click
It’s never been easier to select a line of code from the mouse by simple triple-clicking anywhere on the line.

6. Move Line Up/Down Commands
This is pretty cool..! This extension maps the Alt+Up Arrow & Alt+Down Arrow keys such that they will move the current line of code or the selected lines up and down through the editor.

7. Enhanced Tool Tip

Navigate directly to the Definitions and see just by expanding the nodes what’s inside.

image

8. Turn Off the Feature you don’t like or want to use

Ahh.. and atlast there is lots of extensions in there, few must be helpful for you but not all so whatever feature you feels annoying you just go to Tools | Options | Productivity Power Tools and find the extension on the right (remember to scroll!). It requires a restart of Visual Studio to change effect.

SNAGHTML182b1830

The above list is something I liked most out of this Productivity Power Tools. I hope you will find more useful ways to utilize them all.

I hope you like this post. Also have a look at another post on New productive Tool from Visual Studio Toolbox The PowerCommands Tool.

How to create your own custom code snippets in Visual Studio

If you are a developer and do lots of programming then Most of the time code lines get repeated. So you have to write them again and again or if you do copy paste then every time you have to change the name and ID’s or whatever is to be changed for readability. Visual Studio facilitates you to create you own custom code snippets for such situations. There are already such snippets comes and get installed with visual studio.

image Snippet Symbol that appears in Intellisense window.

for e.g. in C# we have snippet like below:

ctor – for default class constructor

for – for default for loop snippet

svm – for main function

prop – to create property

etc. So what you do is just type these words and double tap on TAB key and code get generated there just like that. This is one of feature that I love in our VisualStudio.

I suggest you a must have tool that you want to use and surely will love it. The Snippet Designer for VisualStudio. you can also write your own code snippet.

Download the addin from here:

Snippet designer for Visual Studio 2010/2008

Install the plugin Restart your VisualStudio. Now follow below steps:

Go to Menu File-> New –> File.. option

image

you’ll see a new template installed there for Snippet Designer

image

Select the CodeSnippet file template and click ok.

Now mention the name of SnippetName [it’ll appear as the tooltip when you use this snippet in your code] and select you language for which you want to create the snippet.

image

Now start typing you code or just copy paste it from you source. Now its time to choose the Literals you may want to change by your own at the time use. Wrap the string with $ It’ll automatically replace all the occurrences of that string in your snippet. See the snapshot below:

image

Now you are almost done here. Now Go to properties window and mention a shortcut that’ll let this snippet appear

image

Now save the file by pressing Ctrl + S and select a location to save this snippet file.

image

Now Open a new project and start typing the shortcut key you mentioned.

image

You custom code snippet will appear now double Tap the TAB key

image

Now change the values of the literal you have want to as per your choice.

and you are done Smile . I hope next time you go for some demo or something you might want to create some Snippets like this so that you don’t have to type your code again and again and by just pressing few keys and your code will appear just like that. Impress your audience or your colleagues.

Be a Smart Programmer.