Feeds:
Posts
Comments

[tweetmeme  source=”aabdulmoniem” only_single=false]

I have just finished a Manning Book titled “jQuery in Action”. I am here just to share my opinion with you about this book.

Really, it gives me a good starting point in jQuery commands and utility functions. Also, it demonstrated many practical examples to test the core API of jQuery. So, I think it is a good start for beginners who need to know what is the jQuery?!

Also, it gives me a very high level of the plugin capability in jQuery and introduced me with some famous plugins like forms plugin, UI plugin,  Live query plugin, and dimension plugin.

But IMHO, I think it is just suitable to give you highlights about the core API of jQuery and it doesn’t stand as a jQuery reference at all. So, if you  are expecting when you read this book to be a jQuery guru then you are wrong.

Also, I have missed practical examples on the interaction of jQuery with ASP.NET and how we can use them efficiently together. The book didn’t mention ASP.NET altogether because it is focusing on the core API.

So, it is a very basic jQuery book in my opinion suitable to learn how to write jQuery scripts and some basic concepts to give you a starting point to read more advanced materials.

Advertisements

[tweetmeme  source=”aabdulmoniem” only_single=false]

The VS 2010 debugger has a some great new capabilities like Intellitrace (historical debugging), the new parallel/multithreaded debugging capabilities, and dump debugging support.

For now we will demonstrate some new tiny usability improvements in VS debugger.

1 – Break Points Labels

Suppose that we have a windows application with one form and two buttons on it. We have also two click event handlers and a constructor. Then we added three break points one in the constructor and one in each click handler.

Open the break points window from Debug -> Windows -> Breakpoints. You will see the following:

As we can see, we can’t distinguish these three break points from each other by just looking into the break points window. VS 2010 comes with a new capability “Breakpoints Labels” which allows you to attach label/labels to each break point. See the following steps:

1) Right-click on any breakpoint

1) Right-click on any break point

2) Add label

2) Add label

3) See the new labels attached to the breakpoints

3) See the new labels attached to the break points

Filtering and Searching by labels:

Enable/Disable break points by label:

This gives you an advantage to disable some break points you don’t want to break while debugging which share some common label (behavior, position … etc).

2 – Import / Export break points

This capability allows you to import/export break points to XML files to share them with another team member or to attach them in a bug work item in TFS for example.

3 – Pinned Data Tips

Using this feature, VS 2010 allows you to better track values while you are in debugging session or even you are not.

I will just enter a debugging session, and just hover over any variable I want to track.

You can pin this value for later tracking, also you can add some comments, and for sure you can un-pin it at any time:

We can also Import / Export these data tips as the breakpoint for later share:

One great feature, is that you have the ability to see what is the last value of a specific variable in the last debugging session even if you are not in a debugging session! WOW! Close the debugging session, and look at the screen shot:

That’s it. I think that VS has added some very great capabilities to its powerful debugger. Happy debugging!


[tweetmeme source=”aabdulmoniem” only_single=false]

Old versions of VS like 2008 was really painful when trying to navigate from an interface method to its implementation. Now, as we have seen a lot of improvements in navigability in VS 2010, we have been introduced with a very cool new window called: “Call Hierarchy”.

Only you have to right-click on any name you want to trace its call hierarchy and click on “View Call Hierarchy” like the following screen shot:

VS 2010 will handle the rest. It will open a new dockable window for you titled: “Call Hierarchy”

Lets examine some features of this window:

1 – Calls to and Calls from:

As you can see, you can investigate all the called paths from the chosen method or all the called paths to the chosen method.

2 – Call sites

You can click on any call path from the left side of the window to see all the call sites on the right window plus you can navigate to the chosen call site if you want by double clicking on any call site.

3 – Navigate to the call from or call to paths:

You can also navigate to the call path by clicking any code path from the left window.

4 – Filtering call hierarchy:

You can filter the call hierarchy by solution, project and document as shown in the following screen shot:

Now, let’s see more complex scenarios when trying to navigate for virtual or interface methods.

Suppose that we have a class Employee and Manager both are implementing an interface IHuman and inheriting from a class Person. Let’s see these four types:

Person class:

public class Person
{
     public string Title { get; set; }
     public string FirstName { get; set; }
     public string LastName { get; set; }

     public string FullName
     {
         get
         {
             return Title + " " + FirstName + " " + LastName;
         }
     }

     public Person()
     {
     }

     public Person(string title, string firstName, string lastName)
     {
          Title = title;
          FirstName = firstName;
          LastName = lastName;
     }

     public virtual void PrintInformation()
     {
          Console.WriteLine(FullName);
     }
}

IHuman interface:

public interface IHuman
{
     void Talk(string talking);
     void Eat(string food);
}

Employee class:

public class Employee : Person, IHuman
{
     public string Salary { get; set; }

     #region IHuman Members

      public void Talk(string talking)
      {
           Console.WriteLine("I am saying: " + talking);
      }

      public void Eat(string food)
      {
           Console.WriteLine("I am eating: " + food);
      }

      #endregion

      public override void PrintInformation()
      {
           base.PrintInformation();
           Console.WriteLine(Salary);
      }
}

And Manager class:

public class Manager : Person, IHuman
{
     public string DepartmentName { get; set; }

     #region IHuman Members

     public void Talk(string talking)
     {
          Console.WriteLine("I am saying: " + talking);
     }

     public void Eat(string food)
     {
         Console.WriteLine("I am eating: " + food);
     }

     #endregion

     public override void PrintInformation()
     {
          base.PrintInformation();
          Console.WriteLine(DepartmentName);
     }
}

As you can see that Employee and Manager classes override the PrintInformation method which is a Person virtual method. Also, they implement the two methods Talk and Eat of IHuman interface.

Now let’s play with the call hierarchy feature from the Person class. Right-click on the PrintInformation method in the Person class and choose the “View Call Hierarchy” menu item. See the next screen shot:

As you can see, we can navigate to all the overrides from this window very easily and forgetting about the hassle of Find or Find All References!

Let’s switch to the IHuman interface and see what is the call hierarchy of the Talk method:

Really, pretty neat!


[tweetmeme source=”aabdulmoniem” only_single=false]

Continuing talking about searching and navigation improvements in VS as we did before. Another improved and a very good feature is the “Navigate To” dialog box to navigate through code in our solution.

All you have to do is to use the key combination (CTRL + ,) to open this new dialog. See the following screen shot:

You can use the search text box to write one of the following:

  1. Any part of any name you want to search about.
  2. Pascal case of any name you want to search about like (CP) will give you any result has two words separated by Pascal convention like (ChangePassoword) or (ChangeCurrentPassword) or (CCP) will return you (ChangeCurrentPassword) only.
  3. Type two or more words separated by space to indicate that you want any type has all these words.

By selecting any search result automatically VS will take you to the code file containing this search result.

Pretty good!


[tweetmeme source=”aabdulmoniem” only_single=false]

Update:
Box selection is one of the old features of the VS but it was only supporting you in VS 2008 with deleting or either copying this text.

ScottGu said:

Box selection is a feature that has been in Visual Studio for awhile (although not many people knew about it).  It allows you to select a rectangular region of text within the code editor by holding down the Alt key while selecting the text region with the mouse.  With VS 2008 you could then copy or delete the selected text.

VS 2010 now enables several more capabilities with box selection including:

  • Text Insertion: Typing with box selection now allows you to insert new text into every selected line.
  • Paste/Replace: You can now paste the contents of one box selection into another and have the content flow correctly.
  • Zero-Length Boxes: You can now make a vertical selection zero characters wide to create a multi-line insert point for new or copied text.

All you have to do is to click on ALT key + left mouse button and then drag. What will you see?

As you can see there is light blue box is drawn as long as you drag. This box represents as a boundary to some text in the code file. You can then do whatever you want with this selection either to copy it for example or even delete it.

Let’s see more appropriate example. What if I have some public variables and I want to make them all private.

The old way to make this, is to go line by line and change public to private but if I have 10 lines, or may be 100, or even 1000?! This is really a consuming task.

Here is the box selection comes to the rescue. See the next screen shots:

Step 1: Select the public keywords (ALT + Left Mouse Button + Drag)

Step 2: Type private and see what will happen?

After completion!


[tweetmeme source=”aabdulmoniem” only_single=false]

Older versions of VS like 2003 and 2005 were dedicated to only one framework. This was annoying because you have to use multiple versions of VS to develop multi-target applications which wasn’t very feasible at this time!

VS 2008 had come with a great feature called Multi-Target support which enables developers to develop multi-target applications on the same IDE.  So, I can develop a program under .NET 2.0 and using the same VS to develop another one with .NET 3.5 or even convert the old one to .NET 3.5. Great feature, huh!

The problem was that all these versions will run on the same CLR, they are only different in class libraries! So, VS 2008 was primarily focused on filtering the different assemblies and project templates according the developer’s framework choice but everything else was working on the same CLR like compiling and debugging for example.

This wasn’t perfect because the intellisense of VS 2008 always showing the libraries of .NET 3.5 even if you are using .NET 2.0! This makes the chance that developers using .NET 2.0 adding code snippets which is supported only in .NET 3.5 by accident.

VS 2010 comes to the rescue. Now you can develop many programs under many different frameworks safely because the intellisense has been improved to show only what your framework supports.

Enough talking let’s see some screen shots. Just I will create two different web applications targeting different frameworks. The first one will target .NET 2.0:

And the second one will target .NET 4.0:

Now we have two web applications in our Solution Explorer:

Now let’s examine some differences, as we see DotNet2 project is the startup one so we will just run the page and open the integrated server information of VS 2010 to see the following:

But when we mark DotNet4 project as the startup one and run it you will see a different server information:

As you saw the difference is a clean separation between old CLR and new CLR. Good shot!

Let’s see another difference while working with VS Toolbox. We will just open the default page of the DotNet2 web application and open the VS ToolBox data tab to see what the supported controls are in ASP.NET 2.0:

And for the DotNet4 project, we will a different control list:

As we can see that VS 2010 now filters the tool box to show different controls according to the targeted .NET framework. Amazing!

Another one is, the property grid. Let’s see what is the difference. Drag a button on the default page for both projects and let’s see what the property grid will show. In DotNet2 project:

And for DotNet4 project:

As we can see, VS 2010 filters the properties which are supported in each framework correctly. Nice!

Last one, is the Intellisense which we have talked about firstly. Let’s try to write a statement like (Response.Re) in the two projects and let’s see what is the difference. In DotNet2 project:

And in DotNet4 project:

As we can see, VS 2010 filters the methods and properties which are supported in the targeted framework automatically for you to prevent to from accidentally writing something not appropriate.

A very good addition to this new version VS 2010.


[tweetmeme source=”aabdulmoniem” only_single=false]

In old editions of VS to find all the references of a specific variable on the same file for example you have to do that:

Right Click on the variable -> Click on find all references

Then VS will give you all the references he found within the page or not in a new separate window (Results window).

Now, with the new theme of VS 2010 which is “Keep the developer into focus”, you can accomplish that scenario only by putting your mouse cursor on top of the required variable and let VS 2010 do it for you out of the box ;). See the next image:

References Highlighting

FirstName property is highlighted

%d bloggers like this: