Learning Curve…

Archive for December 2010

If you have different versions of Visual Studio (Say 2008/2010) installed in your system ,
And when you  opening Visual Studio with “devenv” command from “Run” window then
it opens a version of Visual Studio (say 2008) but you actually want Visual Studio 2010 should open by default.
Then you can simply change “devenv” command location using following steps :-
1. Open regeistry editor by typing regedit on Run.

2. Locate and open the following key My   Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\devenv.exe

3. Currently your devenv.exe mapped to C:\Program Files\Microsoft Visual Studio 9\Common7\IDE\devenv.exe — This is for VS2008

4. If you want open VS2010 from Command, you must change the map to

C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\devenv.exe

For this go to edit in registry edit and

Just change to 9 to 10.0
In this way you can switch to VS2008 to VS2010 or VS2010 to VS2008.

Following statements Update ROW_NUMBER value as field value (SQL Server )..

WITH CTE AS
(
SELECT  *,  ROW_NUMBER() OVER(ORDER  BY VacancyId) AS rnk
FROM dbo.Vacancy
)
UPDATE CTE
SET JobTitle = JobTitle+ + CONVERT(VARCHAR(10),rnk)

DELETE FROM dbo.Vacancy

WHERE VacancyId

IN (SELECT top 1000 VacancyId FROM Vacancy)

Some advantages of LINQ to Sql over SPs:-

1. Type safety: One of the key features of LINQ is that it is type safe, so it becomes much easier to write queries that are type checked at compile time.

2. Debugging support: any .NET debugger can be used to debug the queries. With sprocs, you cannot easily debug the SQL.

3.Vendor agnostic: LINQ works with lots of databases and the number of supported databases will only increase. Sprocs are not always portable between databases, either because of varying syntax or feature support (if the database supports sprocs at all).

4.Deployment: It’s easier to deploy a single assembly than to deploy a set of sprocs.

5.Easier: don’t have to learn T-SQL to do data access, nor do you have to learn the data access API (e.g. ADO.NET) necessary for calling the sprocs. It provides a lot of design-time functionality which is a dream and compiles down pretty much to the same code as ADO.NET would, it just provides the neat ability to reference tables, columns and data exactly as if you’re coding to regular classes and methods.

Some disadvantages of LINQ vs stored procedure:

1.Network traffic: sprocs need only serialize sproc-name and argument data over the wire while LINQ sends the entire query. This can get really bad if the queries are very complex. However, LINQ’s abstraction allows Microsoft to improve this over time.If there are some areas where sprocs are clearly better, then we can probably still write a sproc but access it using LINQ.

2.Less flexible: Sprocs can take full advantage of a database’s feature set. LINQ tends to be more generic in its support. This is common in any kind of language abstraction (e.g. C# vs assembler).

3.Recompiling: If you need to make changes to the way you do data access, you need to recompile, version, and redeploy your assembly. Sprocs can sometimes allow a DBA to tune the data access routine without a need to redeploy anything.

Web Site Projects

You create a new Web Site Project by Choosing File ➪ New Web Site or File ➪ New ➪ Web Site.

A Web Site Project site is simply a Windows folder with a bunch of files and subfolders in it. There is no collective file (known as the project file with a .vbproj or .csproj extension) that keeps track of all the individual files in the web site.

This makes it very easy to create copies of the site, move them, and share them with others, because there are no dependencies with files on your local system.

Besides a lot of positive feedback on this move, Microsoft also received a lot of negative response from developers who complained that Web Site Projects were too limiting for their development environment. Because there is no container file that keeps track of everything in the site, it became much harder to exclude files or folders from the site and work with source control .

Web Application Projects

Web Application Projects make it easier for developers who work in teams or who need more control over the contents of the site and their compilation and deployment processes to build web sites , because the whole web site is managed as a project with a single project file that keeps track of all the content of the web site.

The Universal Selector

The Universal selector, indicated by an asterisk (*), applies to all elements in your page. The

Universal selector can be used to set global settings like a font family. The following rule set changes the font for all elements in your page to Arial:

*

{

font-family: Arial;

}

The Type Selector

The Type selector enables you to point to an HTML element of a specific type. With a Type selector, all HTML elements of that type will be styled accordingly.

h1

{

color: Green;

}

This Type selector now applies to all <h1> elements in your code and gives them a green color. Type selectors are not case sensitive, so you can use both h1 and H1 to refer to the same heading.

The ID Selector

The ID selector is always prefixed by a hash symbol (#) and enables you to refer to a single element in the page. Within an HTML or ASPX page, you can give an element a unique ID using the id attribute. With the ID selector, you can change the behavior for that single element, like this:

#IntroText

{

font-style: italic;

}

Because you can reuse this ID across multiple pages in your site (it only has to be unique within a single page), you can use this rule to quickly change the appearance of an element that you use once per page, but more than once in your site, for example with the following HTML code:

<p id=”IntroText”>I am italic because I have the right ID.</p>

<p id=”BodyText”>I am NOT italic because I have a different ID.</p>

In this example, the #IntroText selector changes the font of the first paragraph — which has the

Matching id attribute — but leaves the other paragraph unmodified. ID selectors are case sensitive,so make sure that the id attribute and the selector always use the same casing.

The Class Selector

The Class selector enables you to style multiple HTML elements through the class attribute. This

is handy when you want to give the same type of formatting to a number of unrelated HTML

Designing Your Web Pages elements. The following rule changes the text to red and bold for all HTML elements that have their class attributes set to Highlight:

.Highlight

{

font-weight: bold;

color: Red;

}

The following code snippet uses the Highlight class to make the contents of a <span> element and a link (<a>) appear with a bold typeface:

This is normal text but <span class=”Highlight”>this is Red and Bold.</span>

This is also normal text but <a href=”CssDemo.aspx” class=”Highlight”>this link is Red and Bold as well. </a>

Notice that the selector uses a period in its name, but you don’t use this period when referring to the selector in the class attribute. The class attribute is very useful because it enables you to reuse a piece of CSS for many different purposes, regardless of the HTML element that uses the class.

Grouping and Combining Selectors

CSS also enables you to group multiple selectors by separating them with a comma. This is handy if you want to apply the same styles to different elements. The following rule turns all headings in the page to red:

h1, h2, h3, h4, h5, h6

{

color: Red;

}

Moreover, with CSS you can also combine selectors, enabling you to hierarchically point to a specific element in a page. You can do this by separating the selectors with a space. The following example targets all <p> elements that fall within an element with an id of MainContent, leaving all other paragraphs unmodified.

#MainContent p

{

font-size: 18px;

}

Note that combining is very different from grouping. Grouping is just a shortcut to avoid typing the same declarations over and over again, whereas combining enables you to target specific elements in your document.

With combining, you’re not limited to ID and Type selectors; you can also use it with the other

selectors, as is demonstrated with the following example:

#MainContent p.Attention

{

font-weight: bold;

}

This rule changes all paragraphs with the class Attention within the element with its id set to

MainContent and leaves all others untouched. The following HTML snippet uses this rule to show the effect:

<div id=”MainContent”>

<p class=”Attention”>My class is Attention, so my text is bold.</p>

<p>My text is not bold, as it lacks the Attention class.</p>

</div>

<p class=”Attention”>I am NOT bold because I don’t fall within MainContent.</p>

Web service is a part of WCF. WCF offers much more flexibility and portability to develop a service when comparing to web service. Still we are having more advantages over Web service, following table provides detailed difference between them:-


Features Web Service WCF
Hosting It can be hosted in IIS It can be hosted in IIS, windows activation service, Self-hosting, Windows service
Programming [WebService] attribute has to be added to the class [ServiceContraact] attribute has to be added to the class
Model [WebMethod] attribute represents the method exposed to client [OperationContract] attribute represents the method exposed to client
Operation One-way, Request- Response are the different operations supported in web service One-Way, Request-Response, Duplex are different type of operations supported in WCF
XML System.Xml.serialization name space is used for serialization System.Runtime.Serialization namespace is used for serialization
Encoding XML 1.0, MTOM(Message Transmission Optimization Mechanism), DIME, Custom XML 1.0, MTOM, Binary, Custom
Transports Can be accessed through HTTP, TCP, Custom Can be accessed through HTTP, TCP, Named pipes, MSMQ,P2P, Custom
Protocols Security Security, Reliable messaging, Transactions

Learning days (Calendar)

December 2010
M T W T F S S
    Jan »
 12345
6789101112
13141516171819
20212223242526
2728293031  

Knowledge Bank (Archives)

I am on Twitter

Blog Stats

  • 504,344 hits

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Join 43 other followers

%d bloggers like this: