Tuesday, July 19, 2011

How to force a file to download in ASP.NET

Sometime you may want to force the user to download a particular file even though browser can open that file type because of any of your business need. This can be easily achieved by adding the content-disposition header in the response of your page. protected void Page_Load(object sender, EventArgs e) { Response.Clear(); Response.AddHeader("content-disposition", "attachment;filename=.gif"); Response.ContentType = "image/GIF"; Response.WriteFile(Server.MapPath(@"~/computer.gif")); Response.End(); }

Thursday, March 18, 2010

Setting up PHP with IIS 6 on Windows XP

This is a small guide on setting up PHP under IIS 6 on a Windows XP/2003 server. If you have any questions or queries about it please don't hesitate to leave me a comment.

Installing PHP

  • Get the latest php (5.2.6 at present) from PHP.net's download page. Download the zip packager rather than the installer.
  • Extract the zip file to c:\php
  • Copy php.ini-dist file to php.ini
  • Edit the c:\php\php.ini file and
    • Set the session.save_path to a temporary directory on your server, you could create a special one for this (e.g. c:\php\session)
    • Set the upload_tmp_dir to a temporary directory on your server, you could create a special on for this (e.g. c:\php\upload)
    • Set the SMTP setting to the ip of your smtp server. It won't work with authentication so make sure you can send from your web server through that smtp server without a user/pass
    • Set the sendmail_from to the email you want all emails from the server to come from
    • Set the upload_max_filesize setting to something a little large (if necessary). Default is 2M. I think 8M is normally ok.
    • Set your extension_dir=C:\php\ext
    • Set post_max_size to at least the size of your upload_max_filesize (+ a little bit more). Default is 8M. 10M should probably be ok if you increased the upload_max_filesize to 8M.
    • Uncomment (by removing the ; at the start of the line)"cgi.force_redirect" and change the value to 0 instead of 1
    • Add these lines to the end of the file
      extension=php_curl.dll
      extension=php_gd2.dll
      extension=php_imap.dll
      extension=php_mysql.dll
      
  • Save and exit the file

Setting up IIS and file/directory permissions

  • Now open the IIS management console by typing Start->Run and typing %SystemRoot%\system32\inetsrv\iis.msc
  • Find out what user we need to give write access to by
    • Edit the properties of the web site you are going to install the php application into
    • On the directory security tab, click the edit button under anonymous access and authentication control
    • Copy down the user name under the anonymous access section (it is allowed right ?). It's usually COMPUTER\IUSR_COMPUTER where COMPUTER is the name of the computer running IIS
  • Now right click on the c:\php\session directory and go to properties, click the security tab, click add and in the box type in the name you copied down before.
  • Click check names and it should underline the name, then click ok.
  • Click modify and it should check all the other necessary boxes for you.
  • Click ok
  • If there is no security tab, then in windows explorer
    • Go to the Tools menu, choose 'Folder Options'.
    • Choose the 'View' tab and find the option called 'Use simple file sharing' (usually the last one) and untick it.
    • Click apply, then ok.
    • Go back to the previous step
  • Repeat this for the c:\php\upload directory and any other directories which need to be writeable by your php application.
  • Now go back to the IIS management console, right click on the website you want to setup php for and go to properties.
  • Click the documents tab and click add and type in index.php and click ok. This tells the webserver to look for index.php files for a default file.
  • Now, still in the iis management console, click the home directory tab, click on the configuration button and then click add.
  • Browse to the c:\php\php-cgi.exe file for the executable and .php for the extension. We want it for All Verbs which is checked by default, check script engine and uncheck "Check that file exists" then click ok.
  • Then click ok until all the dialogs are closed and restart your website in the iis control panel by clicking the restart button in the toolbar or by right click and choosing restart from the tasks menu.
  • Now create a file in your web root called info.php and put in it then browse to that file in your web browser via it's url. It should bring up a phpinfo page which will let you check that mysql is enabled, the session.save_path is right etc.

Wednesday, March 10, 2010

MVC-Based Web Application V/S Web Forms-Based Web Application

Advantages of an MVC-Based Web Application

The ASP.NET MVC framework offers the following advantages:
  • It makes it easier to manage complexity by dividing an application into the model, the view, and the controller.
  • It does not use view state or server-based forms. This makes the MVC framework ideal for developers who want full control over the behavior of an application.
  • It uses a Front Controller pattern that processes Web application requests through a single controller. This enables you to design an application that supports a rich routing infrastructure. For more information, see Front Controller on the MSDN Web site.
  • It provides better support for test-driven development (TDD).
  • It works well for Web applications that are supported by large teams of developers and Web designers who need a high degree of control over the application behavior.

Advantages of a Web Forms-Based Web Application

The Web Forms-based framework offers the following advantages:
  • It supports an event model that preserves state over HTTP, which benefits line-of-business Web application development. The Web Forms-based application provides dozens of events that are supported in hundreds of server controls.
  • It uses a Page Controller pattern that adds functionality to individual pages. For more information, see Page Controller on the MSDN Web site.
  • It uses view state or server-based forms, which can make managing state information easier.
  • It works well for small teams of Web developers and designers who want to take advantage of the large number of components available for rapid application development.
  • In general, it is less complex for application development, because the components (the Page class, controls, and so on) are tightly integrated and usually require less code than the MVC model.

Monday, January 4, 2010

What is PTT or PoC?

PTT PoC or Push to Talk over Cellular is a service option for a cellular phone network which permits subscribers to use their phone as a walkie-talkie. A typical Push to Talk connection connects almost instantly. One significant advantage of PoC is that it allows a single person to reach an active talk group with a single button press; users no longer need to make several calls to coordinate with a group. Push-to-talk cellular calls are half duplex communications — while one person transmits, the other(s) receive. Traditional mobile phone networks and devices utilize full-duplex communications, allowing customers to call other persons on a mobile or land-line network and be able to simultaneously talk and hear the other party. Such communications require a connection to be started by dialing a phone number and the other party answering the call, and the connection remains active until either party ends the call or the connection is dropped due to signal loss or a network outage. Therefore, telephone communication protocol does not allow for casual and immediate transmissions to be sent to other parties on the network. Whereas telephone calls require the lengthy process of dialing, network switching and routing, call setup, and waiting for the other party to answer, a two-way radio has a much quicker protocol because of the immediacy of push to talk communication. Full-duplex operation on mobile phone networks is made possible by using separate frequencies for transmission and reception. Mobile Push-to-Talk service, offered by some mobile carriers, adds functionality for individual half-duplex transmissions to be sent to another party on the system without needing an existing connection to be already established. Since the system is half-duplex, only one user can transmit by PTT at a time; the other party is unable to transmit until the transmitting user unkeys their PTT button. Currently, PTT service is supported only between parties on the same mobile carrier service, and users with different carriers will be unable to transmit to each other by PTT.

Tuesday, December 8, 2009

What is CDMA?

Definition: CDMA, or Code Division Multiple Access, is a competing cell phone service technology to GSM, which is the world’s most widely used cell phone standard. CDMA uses a “spread-spectrum” technique whereby electromagnetic energy is spread to allow for a signal with a wider bandwidth. This allows multiple people on multiple cell phones to be “multiplexed” over the same channel to share a bandwidth of frequencies. With CDMA technology, data and voice packets are separated using codes and then transmitted using a wide frequency range. Since more space is often allocated for data with CDMA, this standard became attractive for 3G high-speed mobile Internet use. The CDMA standard was originally designed by Qualcomm in the U.S. and is primarily used in the U.S. and portions of Asia by other carriers. Sprint, Virgin Mobile and Verizon Wireless use CDMA while T-Mobile and AT&T use GSM. While CDMA and GSM compete head on in terms of higher bandwidth speed (i.e. for surfing the mobile Web), GSM has more complete global coverage due to roaming and international roaming contracts. GSM technology tends to cover rural areas in the U.S. more completely than CDMA. Over time, CDMA won out over less advanced TDMA technology, which was incorporated into more advanced GSM.

What is EDGE?

Definition: EDGE takes GSM even further. GSM, which stands for Global System forMobile communications, reigns as the world’s most widely used cell phone technology. EDGE, which stands for Enhanced Data rates for GSM Evolution, is a faster version of GSM. EDGE is a high-speed 3G technology that was built upon the GSM standard. EDGE networks are designed to deliver multimedia applications such as streaming television, audio and video to mobile phones at speeds up to 384 Kbps. Such speeds still pale in comparison, though, to standard DSL and high-speed cable access today. EDGE delivers a boost of more than three times the capacity and performance over GSM. The EDGE standard was first launched in the United States in 2003 by Cingular, which is now AT&T, on top of the GSM standard. AT&T, T-Mobile and Rogers Wireless in Canada all use EDGE networks.

What is GSM?

Definition: GSM, which stands for Global System for Mobile communications, reigns as the world’s most widely used cell phone technology. Cell phones use a cell phone service carrier’s GSM network by searching for cell phone towers in the nearby area. The origins of GSM can be traced back to 1982 when the Groupe Spécial Mobile (GSM) was created by the European Conference of Postal and Telecommunications Administrations (CEPT) for the purpose of designing a pan-European mobile technology. It is approximated that 80 percent of the world uses GSM technology when placing wireless calls, according to the GSM Association (GSMA), which represents the interests of the worldwide mobile communications industry. This amounts to nearly 3 billion global people. Cell phone carriers T-Mobile and AT&T use GSM for their cell phone networks. Sprint, Virgin Mobile and Verizon Wireless use the competing CDMA standard. For practical and everyday purposes, GSM offers users wider international roaming capabilities than other U.S. network technologies and can enable a cell phone to be a “world phone”. More advanced GSM incorporates the earlier TDMA standard. GSM carriers have roaming contracts with other GSM carriers and typically cover rural areas more completely than competing CDMA carriers (and often without roaming charges, too). GSM also has the advantage of using SIM (Subscriber Identity Module)cards in the U.S. The SIM card, which acts as your digital identity, is tied to your cell phone service carrier’s network rather than to the handset itself. This allows for easy exchange from one phone to another without new cell phone service activation. GSM uses digital technology and is a second-generation (2G) cell phone system. GSM, which predates CDMA, is especially strong in Europe. EDGE is faster than GSM and was built upon GSM.

Saturday, February 21, 2009

Ten ways to speed up the download time of your web pages

Ten ways to speed up the download time of your web pages

Why is download speed so important?

Do you like to wait for pages to download? Neither do your site users. Read on...

1. Lay out your pages with CSS, not tables

CSS downloads faster than tables because:

  • Browsers read through tables twice before displaying their contents, once to work out their structure and once to determine their content

  • Tables appear on the screen all in one go - no part of the table will appear until the entire table is downloaded and rendered

  • Tables encourage the use of spacer images to aid with positioning

  • CSS generally requires less code than cumbersome tables

  • All code to do with the layout can be placed in an external CSS document, which will be called up just once and then cached (stored) on the user's computer; table layout, stored in each HTML document, must be loaded up each time a new page downloads

  • With CSS you can control the order items download on to the screen - make the content appear before slow-loading images and your site users will definitely appreciate it

To learn more about CSS and the amazing things it can do for your website, check out the excellent tutorials both here at DNzone or at places like HTML Dog.

2. Don't use images to display text

It's our old friend CSS to the rescue again. There's no need to use images to display text as so much can be accomplished through CSS. Have a look at this code:

a:link.example, a:visited.example, a:active.example
{
color:#fff;
background:#f90;
font-size:1.2em;
font-weight:bold;
text-decoration:none;
padding:0.2em;
border:4px #00f outset
}

a:hover.example
}
color:#fff;
background:#fa1;
font-size:1.2em;
font-weight:bold;
text-decoration:none;
padding:0.2em;
border:4px #00f inset
}

This will give you a really simple button that appears to be pushed down when you mouseover it - See it in action here if you like.

3. Call up decorative images through CSS

It's possible to present images as part of the background, called up through CSS. If you've got an image that's 200px by 100px you can use the following HTML code:

<div class="pretty-image"></div>

And this CSS:

.pretty-image
{
background: url(filename.gif);
width: 200px;
height: 100px
}

This may at first seem a little pointless but this technique could really improve the download time of your pages. Browsers basically download background images after everything else. By using this technique, your text will load instantaneously and your site users can freely roam about the page while your 50kb fancy image downloads.

This technique disables the ALT attribute though so if you really want to have one then replace the above HTML code with this:

<image src="spacer.gif" class="pretty-image" alt="description" />

Spacer.gif is a 1px x 1px transparent image. Now you have a 50 byte transparent image and the main content loading first, and your great big decorative image, complete with ALT text, loading second. Perfect.

Please note that this technique is only good for decorative images and not informational ones. Any user who has CSS disabled will not be able to see your CSS-embedded images (or their alternative text).

4. Use contextual selectors

This is inefficient:

<p class="text">This is a sentence</p>
<p class="text">This is another sentence</p>
<p class="text">This is yet another sentence</p>
<p class="text">This is one more sentence</p>

.text
{
color: #03c;
font-size: 2em
}

Instead of assigning a value to each individual paragraph, we can nest them within a <div> tag and assign a value to this tag:

<div class="text">
<p>This is a sentence</p>
<p>This is another sentence</p>
<p>This is yet another sentence</p>
<p>This is one more sentence</p>
</div>

.text p
{
color: #03c;
font-size:2em
}

This second CSS example basically says that every paragraph within class="text" should be assigned a colour value of #03c and a font size of 2em.

At first glance this doesn't look too important, but if you can apply this properly throughout your document you can easily knock off 20% of the file size.

You may have noticed the colour values are shorter than normal. #03c is a shortened version of #0033cc - you can assign this abbreviated value to any colour value like this.

5. Use shorthand CSS properties

Font

Use:

font: 1em/1.5em bold italic serif

...instead of:

font-size: 1em;
line-height: 1.5em;
font-weight: bold;
font-style: italic;
font-family: serif

Border

Use:

border: 1px black solid

...instead of

border-width: 1px;
border-color: black;
border-style: solid

Background

Use:

background: #fff url(image.gif) no-repeat top left

...instead of:

background-color: #fff;
background-image: url(image.gif);
background-repeat: no-repeat;
background-position: top left;

Margin, padding, border

Use:

margin: 2px 1px 3px 4px (top, right, bottom, left)

...instead of:

margin-top: 2px;
margin-right: 1px;
margin-bottom: 3px;
margin-right: 4px

Use:

margin: 5em 1em 3em (top, left and right, bottom)

...instead of:

margin-top: 5em;
margin-bottom: 1em;
margin-right: 1em;
margin-right: 4em

Use:

margin: 5% 1% (top and bottom, left and right)

...instead of:

margin-top: 5%;
margin-bottom: 5%;
margin-right: 1%;
margin-right: 1%

These rules can be applied to margin, border and padding.

6. Minimise white space, line returns and comment tags

Every single letter or space in your HTML code takes up one byte. It doesn't sound like much but it all adds up. We've found that by working through your page source and eliminating unnecessary white space and comments, you can shave off up to, or even over (if your HTML is really inefficient) 10% of its file size.

7. Use relative call-ups

Try to avoid absolute call ups as they take up more space. An example of an absolute call up is: <a href="http://www.URL.com/filename.htm">.

Much better would be <a href="filename.htm">. But what if some files are in different folders to other ones? Use these shorthand properties:

8. Remove unnecessary META tags and META content

Most META tags are pretty much unnecessary and don't achieve very much. If you're interested, you can see a list of META tags that are available. The most important tags for search engine optimisation are the keywords and description tags, although due to mass abuse they've lost a lot of importance in recent times.

When using these META tags try to keep the content for each under 200 characters - anything more increases the size of your pages. Lengthy META tags are not good for search engines anyway because they dilute your keywords.

9. Put CSS and JavaScript into external documents

To place CSS in an external document use:

<link type="text/css" rel="stylesheet" href="filename.css" />

To place JavaScript in an external document use:

<script language="JavaScript" src="filename.js" type="text/javascript"></script>

Any external file is called up just once and then cached (stored) on the user's computer. Instead of repeating JavaScript or CSS over and over again in HTML files, just write it out once in an external document.

And don't forget, there's no limit to the number of these external documents that you can use! For example, instead of making one huge CSS document, have one main one and some others that are specific to certain areas of your site.

 

10. Use / at the end of directory links

Don't do this: <a href="http://www.URL.com/directoryname">

Do this instead: <a href="http://www.URL.com/directoryname/">

Why? If there's no slash at the end of the URL the server doesn't know if the link is pointing to a file or to a directory. By including the slash the server instantly knows that the URL is pointing to a directory and doesn't need to spend any time trying to work it out.

Friday, August 29, 2008

Prevent user from back to the previous page after logout

Problem: Prevent user from back to the previous page after logout.

Solution: For this scenario, my idea is to write a cookie when logout (check the “SetLogoutCookie” function), and read the cookie when page load for each web page except login.aspx (check the “RedirectToLoginPage” function). If the data in cookie means logout then redirect current page to login.aspx.

***** default.aspx ****** <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title>Untitled Page</title> <script type="text/javascript">

function SetLogoutCookie(value)

{

var exdate=new Date();

exdate.setDate(exdate.getDate()+1);

var expires = ";

expires=" + exdate.toGMTString();

document.cookie = "logout=" + value + expires+";

path=/";

}

function Checklogout() {

var c_start = document.cookie.indexOf("logout=");

if (c_start!=-1) { c_start=c_start + 7; c_end=document.cookie.indexOf(";",c_start)

if (c_end==-1)

{

c_end=document.cookie.length;

} if(document.cookie.substring(c_start,c_end)== "true")

{

return true; }

}

return false;

}

function RedirectToLoginPage() {

if (Checklogout()) { window.location = "login.aspx";

}

}

</script>

</head>

<body onload="RedirectToLoginPage()"> <form id="form1" runat="server">

<div>

<asp:LinkButton ID="LinkButton1" runat="server" OnClick="LinkButton1_Click" OnClientClick="SetLogoutCookie('true')">Log out </asp:LinkButton>

</div>

</form>

</body>

</html>

************* default.aspx.cs ********************************

protected void LinkButton1_Click(object sender, EventArgs e)

{

FormsAuthentication.SignOut();

FormsAuthentication.RedirectToLoginPage(); }

************ login.aspx ************************************

<html xmlns="http://www.w3.org/1999/xhtml">

<head runat="server">

<title>Untitled Page</title>

<script type="text/javascript">

function SetLogoutCookie(value)

{

var exdate=new Date();

exdate.setDate(exdate.getDate()+1);

var expires = "; expires="+exdate.toGMTString();

document.cookie = "logout=" + value + expires+";

path=/";

}

</script>

</head>

<body>

<form id="form1" runat="server">

<div>

Name:<asp:TextBox ID="TBName" runat="server">test</asp:TextBox>

<br />

Password:<asp:TextBox ID="TBPassword" runat="server" TextMode="Password"></asp:TextBox>

<br />

<asp:LinkButton ID="LinkButton1" runat="server" OnClick="LinkButton1_Click" OnClientClick="SetLogoutCookie('false')">Login</asp:LinkButton></div>

</form>

</body>

</html>

************ login.aspx.cs ***********************************

protected void LinkButton1_Click(object sender, EventArgs e)

{

if (FormsAuthentication.Authenticate(TBName.Text,TBPassword.Text))

{ FormsAuthentication.RedirectFromLoginPage(TBName.Text,false);

}

}

************ web.config **********************************

<authentication mode="Forms">

<forms name="appNameAuth" path="/" loginUrl="login.aspx"

protection="All" timeout="30">

<credentials passwordFormat="Clear">

<user name="test" password="test" />

</credentials>

</forms>

</authentication>

<authorization>

<deny users="?" />

</authorization>

Tuesday, June 24, 2008

SQL Optimization Tips

SQL Optimization Tips • Use views and stored procedures instead of heavy-duty queries. This can reduce network traffic, because your client will send to server only stored procedure or view name (perhaps with some parameters) instead of large heavy-duty queries text. This can be used to facilitate permission management also, because you can restrict user access to table columns they should not see. • Try to use constraints instead of triggers, whenever possible. Constraints are much more efficient than triggers and can boost performance. So, you should use constraints instead of triggers, whenever possible. • Use table variables instead of temporary tables. Table variables require less locking and logging resources than temporary tables, so table variables should be used whenever possible. The table variables are available in SQL Server 2000 only. • Try to use UNION ALL statement instead of UNION, whenever possible. The UNION ALL statement is much faster than UNION, because UNION ALL statement does not look for duplicate rows, and UNION statement does look for duplicate rows, whether or not they exist. • Try to avoid using the DISTINCT clause, whenever possible. Because using the DISTINCT clause will result in some performance degradation, you should use this clause only when it is necessary. • Try to avoid using SQL Server cursors, whenever possible. SQL Server cursors can result in some performance degradation in comparison with select statements. Try to use correlated sub-query or derived tables, if you need to perform row-by-row operations. • Try to avoid the HAVING clause, whenever possible. The HAVING clause is used to restrict the result set returned by the GROUP BY clause. When you use GROUP BY with the HAVING clause, the GROUP BY clause divides the rows into sets of grouped rows and aggregates their values, and then the HAVING clause eliminates undesired aggregated groups. In many cases, you can write your select statement so, that it will contain only WHERE and GROUP BY clauses without HAVING clause. This can improve the performance of your query. • If you need to return the total table's row count, you can use alternative way instead of SELECT COUNT(*) statement. Because SELECT COUNT(*) statement make a full table scan to return the total table's row count, it can take very many time for the large table. There is another way to determine the total row count in a table. You can use sysindexes system table, in this case. There is ROWS column in the sysindexes table. This column contains the total row count for each table in your database. So, you can use the following select statement instead of SELECT COUNT(*): SELECT rows FROM sysindexes WHERE id = OBJECT_ID('table_name') AND indid < 2 So, you can improve the speed of such queries in several times. • Include SET NOCOUNT ON statement into your stored procedures to stop the message indicating the number of rows affected by a T-SQL statement. This can reduce network traffic, because your client will not receive the message indicating the number of rows affected by a T-SQL statement. • Try to restrict the queries result set by using the WHERE clause. This can results in good performance benefits, because SQL Server will return to client only particular rows, not all rows from the table(s). This can reduce network traffic and boost the overall performance of the query. • Use the select statements with TOP keyword or the SET ROWCOUNT statement, if you need to return only the first n rows. This can improve performance of your queries, because the smaller result set will be returned. This can also reduce the traffic between the server and the clients. • Try to restrict the queries result set by returning only the particular columns from the table, not all table's columns. This can results in good performance benefits, because SQL Server will return to client only particular columns, not all table's columns. This can reduce network traffic and boost the overall performance of the query. 1.Indexes 2.avoid more number of triggers on the table 3.unnecessary complicated joins 4.correct use of Group by clause with the select list 5 In worst cases Denormalization Index Optimization tips • Every index increases the time in takes to perform INSERTS, UPDATES and DELETES, so the number of indexes should not be very much. Try to use maximum 4-5 indexes on one table, not more. If you have read-only table, then the number of indexes may be increased. • Keep your indexes as narrow as possible. This reduces the size of the index and reduces the number of reads required to read the index. • Try to create indexes on columns that have integer values rather than character values. • If you create a composite (multi-column) index, the order of the columns in the key are very important. Try to order the columns in the key as to enhance selectivity, with the most selective columns to the leftmost of the key. • If you want to join several tables, try to create surrogate integer keys for this purpose and create indexes on their columns. • Create surrogate integer primary key (identity for example) if your table will not have many insert operations. • Clustered indexes are more preferable than nonclustered, if you need to select by a range of values or you need to sort results set with GROUP BY or ORDER BY. • If your application will be performing the same query over and over on the same table, consider creating a covering index on the table. • You can use the SQL Server Profiler Create Trace Wizard with "Identify Scans of Large Tables" trace to determine which tables in your database may need indexes. This trace will show which tables are being scanned by queries instead of using an index. • You can use sp_MSforeachtable undocumented stored procedure to rebuild all indexes in your database. Try to schedule it to execute during CPU idle time and slow production periods. sp_MSforeachtable @command1="print '?' DBCC DBREINDEX ('?')"

Thursday, June 12, 2008

How to Determine CompactFramework Version

If you are developing mobile application for Windows PocketPC and Windows Mobile using Microsoft Compact Framework, you may need to deploy Compact Framework to targeted mobile device in order to run your application. It is crucial to determine what version is currently installed on targeted device and if the installed version fits your application requirement. Different builds may work differently and thus may break your application if installed wrong version. How to Check If Compact Framework Already Installed on Mobile Device There are few ways to check if any compact framework has been installed. However, I will show you the basic ways to determine compact framework installation. 1. On your device, go to My Device -> Windows and run cgacutil.exe. The version will be displayed on screen. 2. Check if \Windows\mscoree.dll file exists. If this file is exists, that means the compact framework has been installed. Now you know Compact Framework already installed on the mobile device and want to know which revision and builds is being installed. How to Determine Compact Framework Version In order to check the version installed, you can access the registry key on targeted mobile. The registry key that you want to look at is HKLM\SOFTWARE\Microsoft\.NetCompactFramework All versions of Compact Framework installed will be listed in this key. Take not that all Compact Framework 1,2 and 3.5 (beta) can co-exists at the same time on the same mobile device. Thus, you may see both versions on the list if both versions already installed. For more information on what the revision number means, please refer to table below. Compact Framework Version List There are 2 tables below that list out all builds and revisions for Compact Framework 1.0 , Compact Framework 2.0 and Compact Framework 3.5. (There won’t be a CF 3.0). Compact Framework 1.0 1.0.2268.00 RTM 1.0.3111.00 SP1 1.0.3226.00 SP2 Recall 1.0.3227.00 SP2 Beta 1.0.3316.00 SP2 Final 1.0.4292.0 SP3
Compact Framework 2.0 2.0.5238.00 RTM 2.0.6129.0 SP1 2.0.7045.0 SP2
Compact Framework 3.5 3.5.7066.0 Beta 1 3.5.7121.0 Beta 2

Requirements for Pocket PC/ Windows Mobile to run .Net Application with SQL Server.

1) To Connect PDA to PC you need ActiveSync software . 2) After Mobile Connected with PC download the SQL Compact 3.1 SDK and coy these 3 cab files from C:\Program Files\Microsoft SQL Server Compact Edition\v3.1\SDK\bin\wce500\armv4i to your device: #sqlce30.wce5.armv4i.CAB #sqlce30.repl.wce5.armv4i.CAB #sqlce30.dev.ENU.wce5.armv4i.CAB 3)Install NetCFSetupv2.msi from PC. It will install .Net Compact framework 2.0 in both PC and Mobile. You can download 1>NetCFSetupv2.msi from Here 2>SSCEDeviceRuntime-ENU.msi from Here

Some Usefule links regarding Pocket PC development

http://pocketpccentral.net/!pocket_pcs.htm#phone http://www.microsoft.com/downloads http://msdn.microsoft.com/en-us/library/fkack1sx.aspx

How can I tell if my Pocket PC has a Pocket PC 2000/2002/2003 or a Windows Mobile 5 or 6 Operating System?

Q: How can I tell if my Pocket PC has a Pocket PC 2000/2002/2003 or a Windows Mobile 5 or 6 Operating System? A: To find out what Pocket PC version you are running follow the steps below: * Select Start, then Settings on your Pocket PC * Choose the System tab, then the About icon * If the copyright in the About screen is 2001 or later, then you have a Pocket PC 2002 or later Pocket PC device. * If the operating system version is 4.0 but less than 5.0 it is a Pocket PC 2003 or 2003 Device * If the operating system version is 5.0 but less than 5.2 it is a Windows Mobile 5 Pocket PC or Pocket PC Phone Device. * If the operating system version is 5.2 or greater is a Windows Mobile 6 device. Windows Mobile 6 comes in three variations: - Classic (touch screen, no phone capabilities) previously 'Pocket PC' - Standard (non-touch screen) previously 'Smartphone' - Professional (touch screen with phone) previously 'Pocket PC Phone Edition'

Wednesday, June 11, 2008

WinCE Problem - .Net compact framework 2.0 installation problem

Solution for following errors (for .net compact framework 2.0): 1) "Installation of netcfv2.wce4.armv4.cab was unsuccessful" in WinCE mobile 2) "This application requires a newer version of the microsoft .net compact framework than the version installed on this device" Normally this error comes when your mobile has older version of compact framework and you are trying to install .net application of newer version. SOLUTION: 1) Install or reinstall NetCFSetupv2.msi in desktop. It will install .net compact framework in both desktop pc and mobile. --have a good day.(RK)

Tuesday, May 27, 2008

Caching in ASP.NET

Abstract Caching can dramatically improve the performance of your application by storing the page output or application data across HTTP requests. In this article, Joydip discusses the different types of Caching in ASP.NET with lucid code examples.

Caching is a feature of ASP.NET that improves the performance of web applications by minimizing the usage of server resources to a great extent. This article discusses Caching, its types and contains some lucid code examples to illustrate On- Demand Data Caching.

What is Caching?

Caching is a feature that stores data in local memory, allowing incoming requests to be served from memory directly.

Benefits of Caching

The following are the benefits of using Caching

  • Faster page rendering
  • Minimization of database hits
  • Minimization of the consumption of server resources

Types of Caching

Caching in ASP.NET can be of the following types
  • Page Output Caching
  • Page Fragment Caching
  • Data Caching
  • Page Output Caching

This is a concept by virtue of which the output of pages is cached using an Output Cache engine and all subsequent requests are served from the cache. Whenever a new request comes, this engine would check if there is a corresponding cache entry for this page. If there is a cache hit, i.e., if the engine finds a corresponding cache entry for this page, the page is rendered from the cache, else, the page being requested is rendered dynamically.

This is particularly useful for pages that are static and thus do not change for a considerable period of time.

Page output caching can be implemented in either of the following two ways:

  • At design time using the OutputCache directive
  • At runtime using the HttpPolicy class

The following is the complete syntax of page output caching directive

<%@ OutputCache Duration="no of seconds"
Location="Any | Client | Downstream | Server | None"
VaryByControl="control"
VaryByCustom="browser |customstring"
VaryByHeader="headers"
VaryByParam="parameter" %>

The following statement is used to implement output caching in an aspx page at design time. The directive is placed at the top of the .aspx page.

<%@OutputCache Duration="30"
VaryByParam="none" %>

The duration parameter specifies for how long the page would be in cache and the VaryByParam parameter is used to cache different views of the page. In the code example above, the cache duration is 30 seconds. Cache duration is a required field, and must be set to an integer greater than zero. The VaryByParam parameter, which is also required, specifies whether the cached page would differ in versions based on any parameter. A value of * in the same parameter indicates that the page would be cached based on all the Get/Post parameters. We can also specify one or more Get/Post parameter(s). Hence, the same statement shown above can have the following variations. The VaryByParam parameter is particularly useful in situations where we require caching a page based on certain criteria. As an example, we might require to cache a specific page based on the EmployeeID.

<%@OutputCache Duration="30"
VaryByParam="*" Location = "Any"%>  

<%@OutputCache Duration="30"
VaryByParam="EmployeeID" Location = "Client" %>  
<%@OutputCache Duration="30"
VaryByParam="EmployeeID;Basic" %> 

The VaryByParam parameter can also have multiple parameters as shown in the example above.

The location parameter is used to specify the cache location, either the server of the client.

To set a page's cacheability programmatically we have to use the method Response.Cache.SetCacheability. This method accepts the following parameters

  • NoCache
  • Private
  • Public
  • Server

The code snippet below shows how to set a page’s cacheability programmatically:

Response.Cache.SetCacheability(HttpCacheability.Server);

Additionally we can set other properties which map to the same fields available when using the OutputCache directive on the page:

Response.Cache.SetExpires(DateTime.Now.AddSeconds(30));
Response.Cache.SetValidUntilExpires(true);
Response.Cache.VaryByParams["EmployeeID"]= true; 

Page Fragment Caching

This allows specific portions of the page to be cached rather than caching the whole page. This is useful in situations where we can have a page that contains both static and dynamic content. The following code depicts how this can be accomplished.

<%@ OutputCache Duration="15"
VaryByControl="EmpID;DeptID" VaryByParam="*"%>   

This directive is placed at the top of any User Control (.axcx file).

Data Caching

The following code is an implementation of On-Demand caching. The method GetUserInfo checks to see if the data exists in the cache. If it is present, it is returned from the cache, else, the GetUserInfoFromDatabase method fills the DataSet from the database and then populates the Cache.

public DataSet GetUserInfo()
{  

  string cacheKey = "UserInfo";  
  DataSet ds = Cache[cacheKey] as DataSet;  
  if (ds == null)  

 {    
   ds = GetUserInfoFromDatabase();    
   Cache.Insert(cacheKey, ds, null, NoAbsoluteExpiration,      
   TimeSpan.FromHours(15),CacheItemPriority.High, null);  

}     
return ds;
}  

DataSet GetUserInfoFromDatabase() {
// Usual code to populate a data set from thedatabase. This data set 

// object is then returned. 
}

Cache Expirations

Cache expirations can be of the following types

  • Time Based Expiration
  • Dependency Based Expiration
  • Time Based Expiration

This is used to specify a specific period of time for which the page would remain in the cache. The following statement specifies such expiration for a page in the code behind of a file using C#.

Response.Cache.SetExpires(DateTime.Now.AddSeconds(120));
This can also be accomplished by stating the same in the output cache directive as shown here.
<%@OutputCache Duration="60"
VaryByParam="None" %>

Cache Expiration

Cache expiration strategies can be implemented in either of the following two ways:
  • Time Based
  • File Based
  • Key Based
Time Based Expiration

This is implemented by specifying a specific duration for which the item would remain in the cache. When the time elapses, the item is removed from the cache and subsequent requests to retrieve the item returns a null. Time based expiration strategies can be of the following two types:

  • Absolute
  • Sliding
  • Absolute
Cache.Insert("UserInfo", dsUserInfo, null,
DateTime.Now.AddMinutes(1), NoSlidingExpiration); 

Sliding

Cache.Insert("UserInfo", dsUserInfo, null,
NoAbsoluteExpiration,

TimeSpan.FromSeconds(60));

Note that you cannot use both Absolute and Sliding expirations at the same time.

File Based Expiration

This is implemented by using a file as a dependency. Whenever the contents of the dependency file are changed, the cached is invalidated. Please refer to the code below.
CacheDependency cacheDependency = newCacheDependency("userinfo.xml");
Cache.Insert("UserInfo", xmldocObject,cacheDependency); 
In addition to files, entire folders can be monitored for changes using the CacheDependency class.

Key Based Expiration

The third type of dependency is the key dependency. With it, a cache entry can be made to depend on another, existing dependency. When the depended-upon entry changes or expires, the dependent entry will also be expired. An array of keys can be specified as a single CacheDependency.
string[] keys = new string[] {"key"};
CacheDependency cacheDependency = newCacheDependency(null,keys);
Cache.Insert("UserInfo", xmldocObject,cacheDependency);

Using Callbacks

The delegate CacheItemRemovedCallback event handler is used to respond to the event that is raised when an item is deleted from cache. This handler contains the code to populate / re-populate the cache. Please refer to the code snippet below.
public void onRemoveCallBack(string str, objectobj, CacheItemRemovedReason reason)
{  
   DataSet dataset = GetUserInfoFromDatabase();  

   Cache["userInfo"] = dataset;
} 

1. First declare a class variable onRemove as shown below.

private static CacheItemRemovedCallback onRemove = null; 

2. This delegate is invoked as shown below.

onRemove = newCacheItemRemovedCallback(this.onRemoveCallBack);

3. The following code snippet shows how this handler is specified when items are added to the Cache.


Cache.Insert("userInfo", ds, null, DateTime.Now.AddMinutes(2),
NoSlidingExpiration, CacheItemPriority.High,
CacheItemPriorityDecay.Slow, onRemove);

The Cache Class

The Add/Insert method of the Cache class is used to add/insert an item into the cache. The Remove method removes a specified item from the cache. The Cache class contains the following properties and methods.

Properties

  • Count
  • Item

Methods

  • Add
  • Equals
  • Get
  • GetEnumerator
  • GetHashCode
  • GetType
  • Insert
  • Remove (Overloaded)
  • ToString
Conclusion Judicious use of the right type of caching can dramatically improve the performance of web applications. For more information about caching, please visit the ASPAlliance Caching

Microsoft .NET Terminologies at a Glance

Abstract This article defines many important terminologies that are related to Microsoft .NET so as to enable the reader to have a ready guide to the technical terms. Terminologies related to Microsoft .NET Framework, ASP.NET, ADO.NET, XML, Biztalk Server, etc. are covered. This will also help readers prepare themselves to go into interviews confidently. Overview [ Back To Top ] My objective in designing this article is to put an end to the arduous struggle of an IT professional seeking an understandable resource for the core terminologies of Microsoft.NET. Let me save you valuable time and energy by providing you with an article that gives you many of the important terminologies in Microsoft .NET and its related technologies. This article discusses most of the important terminologies related to Microsoft .NET Framework, ASP.NET, ADO.NET, Remoting and Web Services. The terminologies are not organized in an alphabetical order, rather they are organized in the order of the categories that they belong to. The Common Language Specification This is a subset of the Common Type System (CTS) and defines a set of conventions that are targeted at language interoperability of all the languages that run within the .NET environment. The Common Type System The Common Type System (CTS) is a standard that defines the necessary rules for type interoperability for the languages targeting the .NET environment. The common type system supports the following types. · Value Types · Reference Types .NET Framework Class Library The .NET Framework Class Library (FCL) is a set of managed classes that are responsible for providing access to the system services in the managed environment of Microsoft.NET. The Common Language Runtime The CLR is a runtime execution engine of .NET that provides an environment to execute programs that are targeted at the .NET platform. It provides memory allocation, security, code verification, type verification, exception handling and garbage collection in the managed environment. Common Language Infrastructure The Common Language Infrastructure or the CLI provides support for language interoperability in the .NET managed environment. It is comprised of the following features. · A File Format (PE) · Metadata · MSIL · Base Class Library Assembly An assembly is a group of resources and types, along with the metadata about those resources and types, deployed as a single unit. Just In Time Compiler The Just In Time Compiler or the JIT is responsible for compiling units of code and caching them at runtime as and when they are needed. Since the compilation occurs at runtime, it is known as a Just In Time Compilation. MSIL A program compiled in the .NET managed environment generates an intermediate code to support platform independence. This is called the MSIL or Microsoft Intermediate Language. Strong Name A Strong Name is a unique identifier given to an assembly using cryptography and a digital signature that is used to identify a particular assembly. An assembly is provided a strong name using the utility called sn.exe. A strong name consists of the following. · Name of the Assembly · Digital Signature · Version Number · Culture Information Global Assembly Cache The Global Assembly Cache is a system wide storage of shared assemblies. Assemblies can be stored or moved to and from the Global Assembly Cache using a tool called GacUtil. Managed Code A managed code is one that provides restricted access to the system’s resources and can be executed only in a managed environment that is provided in Microsoft .NET by the Common Language Runtime. Un-Managed Code An Un-Managed code is one that executes outside of the Common Language Runtime environment and can perform unsafe operations. Managed Data Managed Data refers to the objects that are created by the Common Language Runtime environment and can be garbage collected implicitly by the Garbage Collector. Shared Assembly A Shared Assembly is one that can be referred by more that one application. All shared assemblies should contain a strong name and should be located in the Global Assembly Cache (GAC). Private Assembly A Private Assembly is one that is private to one application. In other words, it can be accessed by the containing application only. Satellite Assembly When you wish to localize the application, it can be written in culture-neutral code and can distribute the localized modules in separate assemblies called satellite assemblies. Assembly Manifest The Assembly Manifest contains the information about an assembly. This includes the version number of the assembly, the list of the files that comprise the assembly, etc. An assembly manifest is contained in the dll file or the exe file itself. Resource A resource refers to an addressable unit of data that is available for use by an application. It consists of one or more of the following. · Texts · Files · Documents · Images · The .NET tool called resgen.exe is used to create resource files from the resource information that is stored in text or XML files. Localization Localization is the practice of designing and developing software that will properly use all of the conventions defined for a specific locale. An assembly that is used to provide localization feature in ASP.NET applications is referred to as a Satellite Assembly. Native Image Generator This is a .NET tool that is used to compile a managed assembly to the native code and then store that in the local assembly cache. The name of this tool is Ngen.exe. Value Type A value type is one that contains the value rather than the reference and is stored in the stack memory. Examples of value types are integers, floats, doubles, structures, etc. Reference Type A reference type contains a reference to the actual object in memory and is stored in the managed heap. Objects of classes are good examples of reference types. Boxing Boxing refers to the conversion of a value type to a reference type. Value types are stored in the stack and reference types are stored in the managed heap. Un-Boxing This refers to the conversion of a reference type to a value type. Garbage Collection Garbage Collection is a technique introduced in Microsoft .NET that manages memory cleanup implicitly. This implicit reclaiming of memory in the .NET managed environment is handled by the Common Language Runtime. Dispose Method The Dispose method can be used in an unsealed class to cleanup resources explicitly. It should be noted that both the Dispose and the Finalize methods should make a call to their parents' respective methods after they have disposed or finalized their own members. A class that needs to have this method implemented should implement the IDisposable interface. Finalize Method The finalize method is a protected member of the Object class and is implicitly called at the runtime to cleanup unmanaged resources before the object is destroyed. Code Verification This is a feature that enforces type safety or type security by checking the code prior to its execution in the run time environment. Therefore, it does not allow malicious code to get executed in the managed environment. Authentication and Authorization This is a security measure that is used to specify the user’s identity and authorization in ASP.NET. The process of authorization determines whether an authenticated user has access to a specific resource. Authentication and Authorization details of an ASP.NET application are specified in the web.config file. There can be three types of authentication in ASP.NET. · Forms Authentication · Windows Authentication · Passport Authentication Web.Config File The web.config file is the configuration file for an ASP.NET web application. Typically, the following information is stored in a web.config file. · Database Connection Strings · Security · Session States · Impersonation · Error handling Machine.Config File The machine.config file contains the configuration settings for the entire application and is located in the Config sub-folder of the Microsoft .NET installation directory. ASP.NET ASP.NET is a language neutral, interoperable, server-side technology that allows creation, execution and deployment of scalable Web Applications and Services. Caching Caching is a feature that stores the data in the memory for serving the incoming requests from the memory itself. Caching in ASP.NET can be of three types. · Page Output Caching · Page Fragment Caching · Data Caching Singleton Pattern A singleton pattern states that we can have a singleton class that can be instantiated only once in the application domain and provides a global point of access to it. Application Domain An application domain refers to the logical and physical boundary created around every .NET application. An application domain is created by the Common Language Runtime and supports execution of multiple .NET applications in the same process by isolating them in different application domains. View State This is a client-side state management technique that continues the state of server controls by maintaining the state of pages across postbacks. The view state is an encoded hashed string and is stored in a hidden field called __VIEWSTATE. Session State A session is the period of a connection between a server and a client. The Session State allows storage of objects in a user’s session. A session can be stored in one of the following ways. · InProc · State Server · SQL Server Application State This is a state management technique that allows objects to be stored and then globally accessed or shared by multiple modules of the application. In ASP.NET, application state is maintained by the class HttpApplicationState. Interface Definition Language (IDL) The Interface definition Language (IDL) defines a protocol between the server and the client so that they can communicate in heterogeneous environments. Universal Description, Discovery and Integration (UDDI) Universal Description, Discovery and Integration is a platform independent, XML based, distributed directory that allows the enterprises to list themselves over the internet. The UDDI business registration contains the following features. · Green Pages · White Pages · Yellow Pages Web Service Description Language (WSDL) The Web Service Description Language (WSDL) defines XML based contract services for describing the network services as a collection of communication end points. A WSDL document contains the following. · Messages · Operation · Types · Service · Port and its type Simple Object Oriented Protocol (SOAP) This is an XML-based protocol that is used to exchange structured data and type information in a distributed environment. Web Services A web service is SOAP based, platform–independent software component that exposes itself through open communication channels of the web applications running on potentially different platforms. Remoting Remoting allows two processes, a Server and a Client, to inter-communicate in the same system, the same network or across networks. In Remoting, a server and client communicate using a Channel. Service Oriented Architecture Service Oriented Architecture is an architecture that provides a seamless Enterprise Information Integration between loosely coupled distributed applications or services over the network. Service A service is an implementation of a well-defined, self-contained, independent business functionality that accepts one or more requests and returns one or more responses through a well-defined, standard interface. Smart Client Architecture The Smart Client Architecture is a deployable, multi-platform architecture that allows local application to connect to a server based application using web services. It provides an adaptive and rich user interactive experience by using local resources. A Smart Client application can work in both connected and disconnected modes. ADO.NET ADO.NET is an object oriented data access technology that enables you to access data from a managed environment. It is essentially a collection of some classes used to communicate between an application and a database. Connection Pool A Connection Pool is a pool of available or ready-to-use connections. When a new connection is requested it is served from the connection pool if one exists. If not, a new connection is created. Connection Pooling improves the performance of applications to a large extent. DataProvider A DataProvider encapsulates the protocols that ADO.NET uses to interact with different types of databases. DataSet The DataSet is an in–memory, disconnected, XML compliant representation of the data. Data in a DataSet can be changed, unlike a DataReader which is read only. DataReader A DataReader is a connected, forward only, read only stream of data that is retrieved from the database. DataAdapter The DataAdapter is a bridge between the DataSet and the underlying database. It provides a set of methods and properties to move data between a database and its in-memory representation, the DataSet. DataView A DataView is a class that provides a customized view of the DataSet. It is typically used to sort or filter the rows. Command The Command object is used to send the SQL Statements to the database. Commands are used to insert data, retrieve data and execute stored procedures in the database. Connection The Connection object establishes a connection to the database using the user name, password and the database name as parameters. Transactions A transaction is a block of statements that guarantees that all or none of the statements in the block are executed. In ADO.NET, a transaction can be started by using the BeginTransaction() method on the currently active Connection. To commit the transaction, the method CommitTransaction() is used. In order to abandon the transaction, the method Rollback() is executed. Serialization This refers to the storage of an object into a persistent storage medium in a stream of bytes. The opposite is de-serialization and is used to retrieve a serialized object from a storage medium. Reflection This is a feature that allows us to inspect the metadata of an assembly at runtime. Reflection can be used to retrieve metadata information, such as the following. · Classes · Methods · Properties · Events Biztalk Server This is a set of Microsoft Server Applications that allow integration, automation and management of different server applications. Exchange Server This is a set of Microsoft Server Applications that are responsible for integrating messaging and data storage technologies. Commerce Server This is Microsoft’s Business Server that is used for managing and developing business web sites. Array An array is a collection of homogenous objects. It is a group of elements of the same type that share a common name. The size of an array is fixed and cannot be changed at runtime. ArrayList An ArrayList is a collection of heterogeneous elements- elements of different types. Unlike an array, its size can be changed dynamically. HashTable A HashTable is a collection of heterogeneous objects that can be referred using either an index or a key. Elements of an ArrayList can be referred to using an index only. COM+ COM+ or COM Plus is a distributed, transactional, component-based technology that can be used in a multi-tiered architecture and provides support for Object Pooling. Delegate A delegate is a managed function pointer that refers to a method. A multi-cast delegate is one that points to and can eventually fire off different methods. A delegate is used to implement event handling in Microsoft .NET. Event Handler An event handler is a method that is executed in response to an event. Exception An exception is an event that is generated as a result of a runtime error. An exception is handled using the exception blocks. An exception that cannot be handled is referred to as a fatal exception and causes the flow of execution of the current program to terminate unexpectedly. Try/Catch Block A try/catch block is used in exception handling and provides a mechanism to trap runtime errors that can occur on execution of the application. A try block contains the code that can generate a runtime error. The catch block contains statements that are executed once the appropriate exception has occurred. A try block can contain one or more catch blocks or a finally block. Finally Block A finally block is one that is executed irrespective of whether an exception occurs or not. Typically, it is used in Exception Handling mechanism to release resources. Namespace A namespace refers to a logical grouping of types or identifiers used in a program.

22 New Features of Visual Studio 2008 for .NET Professionals

1. LINQ Support

LINQ essentially is the composition of many standard query operators that allow you to work with data in a more intuitive way regardless.

LINQ

The benefits of using LINQ are significant – Compile time checking C# language queries, and the ability to debug step by step through queries.

2. Expression Blend Support

Expression blend is XAML generator tool for silverlight applications. You can install Expression blend as an embedded plug-in to Visual Studio 2008. By this you can get extensive web designer and JavaScript tool.

3. Windows Presentation Foundation

WPF provides you an extensive graphic functionality you never seen these before. Visual Studio 2008 contains plenty of WPF Windows Presentation Foundation Library templates. By this a visual developer who is new to .NET, C# and VB.NET can easily develop the 2D and 3D graphic applications.

Visual Studio 2008 provides free game development library kits for games developers. currently this game development kits are available for C++ and also 2D/3D Dark Matter one image and sounds sets.

4. VS 2008 Multi-Targeting Support

Earlier you were not able to working with .NET 1.1 applications directly in visual studio 2005. Now in Visual studio 2008 you are able to create, run, debug the .NET 2.0, .NET 3.0 and .NET 3.5 applications. You can also deploy .NET 2.0 applications in the machines which contains only .NET 2.0 not .NET 3.x.

5. AJAX support for ASP.NET

AJAX

Previously developer has to install AJAX control library separately that does not come from VS, but now if you install Visual Studio 2008, you can built-in AJAX control library. This Ajax Library contains plenty of rich AJAX controls like Menu, TreeView, webparts and also these components support JSON and VS 2008 contains in built ASP.NET AJAX Control Extenders.

6. JavaScript Debugging Support

Since starting of web development all the developers got frustration with solving javascript errors. Debugging the error in javascript is very difficult. Now Visual Studio 2008 makes it is simpler with javascript debugging. You can set break points and run the javaScript step by step and you can watch the local variables when you were debugging the javascript and solution explorer provides javascript document navigation support.

7. Nested Master Page Support

Already Visual Studio 2005 supports nested master pages concept with .NET 2.0, but the problem with this Visual Studio 2005 that pages based on nested masters can't be edited using WYSIWYG web designer. But now in VS 2008 you can even edit the nested master pages.

8. LINQ Intellisense and Javascript Intellisense support for silverlight applications

javascriptintellisense

Most happy part for .NET developers is Visual Studio 2008 contains intellisense support for javascript. Javascript Intellisense makes developers life easy when writing client side validation, AJAX applications and also when writing Silverlight applications

Intellisense Support: When we are writing the LINQ Query VS provides LINQ query syntax as tool tips.

9. Organize Imports or Usings: We have Organize Imports feature already in Eclipse. SInce many days I have been waiting for this feature even in VS. Now VS contains Organize Imports feature which removes unnecessary namespaces which you have imported. You can select all the namespaces and right click on it, then you can get context menu with Organize imports options like "Remove Unused Usings", "Sort Usings", "Remove and Sort". Refactoring support for new .NET 3.x features like Anonymous types, Extension Methods, Lambda Expressions.

10. Intellisense Filtering: Earlier in VS 2005 when we were typing with intellisense box all the items were being displayed. For example If we type the letter 'K' then intellisense takes you to the items starts with 'K' but also all other items will be presented in intellisense box. Now in VS 2008 if you press 'K' only the items starts with 'K' will be filtered and displayed.

11. Intellisense Box display position

javascriptintellisense

Earlier in some cases when you were typing the an object name and pressing . (period) then intellisense was being displayed in the position of the object which you have typed. Here the code which we type will go back to the dropdown, in this case sometimes programmer may disturb to what he was typing. Now in VS 2008 If you hold the Ctrl key while the intellisense is dropping down then intellisense box will become semi-transparent mode.

12. Visual Studio 2008 Split View

spit

VS 205 has a feature show both design and source code in single window. but both the windows tiles horizontally. In VS 2008 we can configure this split view feature to vertically, this allows developers to use maximum screen on laptops and wide-screen monitors.

Here one of the good feature is if you select any HTML or ASP markup text in source window automatically corresponding item will be selected in design window.

13. HTML JavaScript warnings, not as errors: VS 2005 mixes HTML errors and C# and VB.NET errors and shows in one window. Now VS 2008 separates this and shows javascript and HTML errors as warnings. But this is configurable feature.

14. Debugging .NET Framework Library Source Code:

Now in VS 2008 you can debug the source code of .NET Framework Library methods. Lets say If you want to debug the DataBind() method of DataGrid control you can place a debugging point over there and continue with debug the source code of DataBind() method.

15. In built Silverlight Library

silverlight

Earlier we used to install silverlight SDK separately, Now in VS 2008 it is inbuilt, with this you can create, debug and deploy the silverlight applications.

16. Visual Studio LINQ Designer

LINQ

Already you know in VS 2005 we have inbuilt SQL Server IDE feature. by this you no need to use any other tools like SQL Server Query Analyzer and SQL Server Enterprise Manger. You have directly database explorer by this you can create connections to your database and you can view the tables and stored procedures in VS IDE itself. But now in VS 2008 it has View Designer window capability with LINQ-to-SQL.

17. Inbuilt C++ SDK

Earlier It was so difficult to download and configure the C++ SDK Libraries and tools for developing windows based applications. Now it is inbuilt with VS 2008 and configurable

18. Multilingual User Interface Architecture - MUI

MUI

MUI is an architecture contains packages from Microsoft Windows and Microsoft Office libraries. This supports the user to change the text language display as he wish.

Visual Studio is now in English, Spanish, French, German, Italian, Chinese Simplified, Chinese Traditional, Japanese, and Korean. Over the next couple of months. Microsoft is reengineering the MUI which supports nine local languages then you can even view Visual studio in other 9 local languages.

19. Microsoft Popfly Support

popfly

Microsoft Popfly explorer is an add-on to VS 2008, by this directly you can deploy or hosting the Silverlight applications and Marshup objects

20. Free Tools and Resources

People may feel that I am a promoter to Visual Studio 2008 as a salesman, but we get plenty of free resources and free tools with Visual Studio 2008.

  • Visual Studio 2008 Trial
  • 101 LINQ Samples
  • Free .NET 3.5 control libraries with free sample programs,
  • You can get plenty of free video training tutorials from Microsoft BDLC - Beginner Developer Learning Center,
  • C++ games development library,
  • Microsoft has provided lot of e-Books,
  • P2P library and
  • Microsoft is providing Coding4Fun sample program kit.
  • Visual Studio Registration Discounts: If you register the Visual Studio you get Free Control Libraries, Books, Images, and Discounts.
  • Download Visual Studio 2008 free trial

    21. We can use for Commercial

    Earlier you were spending lot of money to host your .NET applications for commercial use. Now you no need to worry Now Microsoft is providing you to host your application free on Popfly for web pages and also visual studio express projects.

    If you like this article, Please share with others

    Other Interested .NET Readings:
    Writing/Developing Facebook Applications in .NET using Facebook.NET SDK
    Refactor .NET code using Visual Studio and Refactor! Pro
    Dead-end for Microsoft ?
    .NET Obfuscation using Dotfuscator for Source Code Protection
    Windows System Tray Programming using C# and VB.NET
    Microsoft Office 2007 Features and Free Download