Friday, December 02, 2011

What is a Virtual Machine?

Virtual machine is a tightly isolated software container that can run its own operating systems and applications as if it were a physical computer. A virtual machine behaves exactly like a physical computer and contains it own virtual (i.e., software-based) CPU, RAM hard disk and network interface card (NIC).
An operating system can’t tell the difference between a virtual machine and a physical machine, nor can applications or other computers on a network. Even the virtual machine thinks it is a “real” computer. Nevertheless, a virtual machine is composed entirely of software and contains no hardware components whatsoever. As a result, virtual machines offer a number of distinct advantages over physical hardware.

VMs are created within a virtualization layer, such as a hypervisor or a virtualization platform that runs on top of a client or server operating system. This operating system is known as the host OS. The virtualization layer can be used to create many individual, isolated VM environments.

Typically, guest operating systems and programs are not aware that they are running on a virtual platform and, as long as the VM's virtual platform is supported, this software can be installed in the same way it would be deployed to physical server hardware. For example, the guest OS might appear to have a physical hard disk attached to it, but actual I/O requests are translated by the virtualization layer so they actually occur against a file that is accessible by the host OS.

Virtual machines can provide numerous advantages over the installation of OS's and software directly on physical hardware. Isolation ensures that applications and services that run within a VM cannot interfere with the host OS or other VMs. VMs can also be easily moved, copied, and reassigned between host servers to optimize hardware resource utilization. Administrators can also take advantage of virtual environments to simply backups, disaster recovery, new deployments and basic system administration tasks. The use of virtual machines also comes with several important management considerations, many of which can be addressed through general systems administration best practices and tools that are designed to managed VMs.

Saturday, November 26, 2011

Reopen the Last Browsing Session in Firefox

Mozilla Firefox offers tabbed browsing, the ability to open several Web pages in a single instance of Firefox, each page opening in a new tab. One convenient feature available in Firefox is the ability for the browser to save opened tabs from a session then restore them when you re-open the browser. This way you can pick back up browsing wherever you left off. Additionally, you can access tabs from a previous browsing session, even if this feature is disabled, if you accidentally closed the browser before you were finished working. Recently I ran into a problem by accidentally closing window. But no worries we can restore by setting few settings in Firefox.

Setup Firefox To Automatically Restore Browsing Session

  1. Open the Firefox browser on your computer.
  2. Click on the "Firefox" option from the file menu and select "Options." A new window will open.
  3. Click on the "General" tab in the Options window.
  4. Click the "When Firefox starts" drop-down menu under the "Startup" section and select, "Show my windows and tabs from last time."
  5. Click "OK" to save your settings. Each time you close the browser Firefox saves any open tabs or windows and re-opens them automatically when you start the browser again.

Restore Tabs from Previous Browsing Session

  1. Open the Firefox browser on your computer.
  2. Click on the "Firefox" option from the file menu, select "History" then hover over "Recently Closed Tabs." A list of closed tabs from your previous browsing session will appear.
  3. Scroll down and click on one of the recently closed tabs. It will automatically open in a new tab within Firefox.
  4. Repeat Steps 2 and 3 until all tabs from your previous Firefox session appear in the browser.

Sunday, November 13, 2011

Validators Control to allow only Integers

Here are few different ways you can use native .NET validation controls to validate to allow only integers. We can do it in two ways one by using regular expression and one with compare validators

Method 1: Compare Validator
<asp:TextBox ID="NewMobileTextBox" runat="server" Width="280px" autocomplete="off"
CssClass="signuptxtbox" ></asp:TextBox>
<asp:RequiredFieldValidator ID="NewMobileRequired" runat="server" ControlToValidate="NewMobileTextBox"
CssClass="failureNotification" Display="Dynamic" ErrorMessage="New Mobile is required." ToolTip="New Mobile is required." ValidationGroup="ChangeNewMobileValidationGroup">*</asp:RequiredFieldValidator>
<asp:CompareValidator ID="NewMobileCompare" runat="server" ControlToValidate="NewMobileTextBox" CssClass="failureNotification" Display="Dynamic" Operator="DataTypeCheck" ErrorMessage="Mobile Number should be numeric only." ValidationGroup="ChangeNewMobileValidationGroup" Type="Integer">*</asp:CompareValidator>


Method 2: Regular Expression Validator

<asp:TextBox ID="NewMobileTextBox" runat="server" Width="280px" autocomplete="off"
CssClass="signuptxtbox" ></asp:TextBox><asp:RequiredFieldValidator ID="NewMobileRequired" runat="server" ControlToValidate="NewMobileTextBox"
CssClass="failureNotification" Display="Dynamic" ErrorMessage="New Mobile is required." ToolTip="New Mobile is required." ValidationGroup="ChangeNewMobileValidationGroup">*</asp:RequiredFieldValidator>
<asp:RegularExpressionValidator ID="mobileRGEX" runat="server"
ControlToValidate="NewMobileTextBox" CssClass="failureNotification"
ErrorMessage="Please Enter Only Numbers" ValidationExpression="^\d+$"
ValidationGroup="ChangeNewMobileValidationGroup"></asp:RegularExpressionValidator>

Saturday, November 12, 2011

Hot Fix For Windows 7 Start Menu Search Not Working

Sometimes in windows 7 start menu search will not work. Many blogs will tell you to edit the registry. But it is not recommended. Microsoft released the hotfix for this. Download at: http://support.microsoft.com/hotfix/KBHotfix.aspx?kbnum=977380&kbln=en-us

Wednesday, November 02, 2011

Regex validate Email address C#

This is how we can validating email address through C# using Regular Expression. Here is the sample code,

using System.Text.RegularExpressions;



public bool vaildateEmail(string useremail)
{
bool istrue = false;
Regex reNum = new Regex(@"\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*");
CaptureCollection cc = reNum.Match(useremail).Captures;
if (cc.Count == 1)
{
istrue = true;
}
return istrue;
}

Delete All Files using C#

For Deleting all the files first you need to get the list of file names from the specified directory (using static method Directory.Get­Files. Then delete all files from the list.
Method 1
using System.IO;

string[] filePaths = Directory.GetFiles(@"c:\Directory\");
foreach (string filePath in filePaths)
  File.Delete(filePath)

Method 2

To Delete all files using one code line, you can use Array.ForEach with combination of anonymous method.

Array.ForEach(Directory.GetFiles(@"c:\MyDirectory\"),delegate(string path) 
{ File.Delete(path); });

How to get current page Filename using C#

There are different ways to get current page filename using c#. Here are 3 methods you can use for your advantage.

Method 1
string currentPageFileName = new FileInfo(this.Request.Url.LocalPath).Name;

Method 2

string sPath = HttpContext.Current.Request.Url.AbsolutePath;
string[] strarry = sPath.Split('/');
int lengh = strarry.Length;
string sReturnPage = strarry[lengh - 1];

Method 3

string absPath = System.Web.HttpContext.Current.Request.Url.AbsolutePath;
System.IO.FileInfo finfo = new System.IO.FileInfo(absPath);
string fileName = finfo.Name;

 

Out of these I like Method 1 and 3 as its straight forward. Use a per your advantage. Good luck.

C# Checking a File exists in Folder

How to get all files from a folder and compare a whether that file exists in that folder or not. Here is a sample code where you can loop through the code and check the file.

I have declared a variable to check there it exists or not.

private bool isFileExists = false;


Now I have this code to check whether file exists and based on it I’ll redirect in to that page.


string searchfolder = Server.MapPath("~") + "\\TestFolder";
DirectoryInfo Dir = new DirectoryInfo(searchfolder);
FileInfo[] FileList = Dir.GetFiles("*.aspx", SearchOption.AllDirectories);
foreach (FileInfo FI in FileList)
{
if (FI.Name == redirectPage)
{
isFileExists = true;
break;
}
}
if (isFileExists == true)
{
Response.Redirect("~/redirectPage");
}
else
{
Response.Redirect("
~/OtherRedirect.aspx");
}

Here I have search pattern as *.aspx as I need to check these files. This can be based on the files you want to check

Monday, October 24, 2011

Silverlight Integration Pack for Microsoft Enterprise Library 5.0

Silverlight Integration Pack for Enterprise Library is a collection of guidance and reusable application blocks designed to assist Silverlight application developers with common LOB development challenges. This release includes: Caching Application Block, Exception Handling Application Block, Logging Application Block, Policy Injection Application Block, Validation Application Block, and Unity Application Block. These blocks are designed to encapsulate recommended practices which facilitate consistency, ease of use, integration, and extensibility. The release also addresses the needs of those who would like to port their existing LOB applications, that already leverage Enterprise Library, to Silverlight

This release includes:

  • Caching Application Block with support for:
    • In-memory cache
    • Isolated storage cache
    • Expiration and scavenging policies
    • Notification of cache purging
  • Validation Application Block with support for:
    • Multi-level complex validation
    • Attribute-based specification of validation rules
    • Configuration-based specification of validation rules
    • Simple cross-field validation
    • Self-validation
    • Cross-tier validation (through WCF RIA Services integration)
    • Multiple rule-sets
    • Meta data type for updating entities with external classes in Silverlight
    • Rich set of built-in validators
  • Logging Application Block, including:
    • Notification trace listener
    • Isolated storage trace listener
    • Remote service trace listener with support of batch logging
    • Implementation of a WCF Remote logging service that integrates with the desktop version of the Logging Application Block
    • Logging filters
    • Tracing
    • Logging settings runtime change API
  • Exception Handling Application Block, including:
    • Simple configurable, policy-based mechanism for dealing with exceptions consistently
    • Wrap handler
    • Replace handler
    • Logging handler
  • Unity Application Block – a dependency injection container
  • Dependency injection container independence (Unity ships with the Enterprise Library, but can be replaced with a different container)
  • Unity Interception mechanism, with support for:
    • Virtual method interception
    • Interface interception
  • Policy Injection Application Block, including:
    • Validation handler
    • Exception Handling handler
    • Logging handler
  • Flexible configuration options, including:
    • XAML-based configuration support
    • Asynchronous configuration loading
    • Interactive configuration console supporting profiles (desktop vs. Silverlight)
    • Translation tool for XAML config (needed to convert conventional XML configuration files):
      • Standalone command-line tool
      • Config console wizard
      • MS Build task
    • Programmatic configuration support via a fluent interface
  • StockTrader V2 Reference Implementation
Download

Download the "Enterprise Library 5.0 Silverlight Integration Pack.msi" and install it. Alternatively, download specific application blocks from NuGet.
To get the optional configuration tool, install it separately from the Visual Studio gallery or download and install the Microsoft.Practices.EnterpriseLibrary.ConfigConsole.vsix package.

Microsoft Enterprise Library 5.0

Microsoft Enterprise Library is a collection of reusable application blocks designed to assist software developers with common enterprise development challenges. This release includes: Caching Application Block, Cryptography Application Block, Data Access Application Block, Exception Handling Application Block, Logging Application Block, Policy Injection Application Block, Security Application Block, Validation Application Block, and Unity Application Block.
This major release of Enterprise Library contains many compelling new features and updates that will make developers more productive. These include:

  • Major architectural refactoring that provides improved testability and maintainability through full support of the dependency injection style of development
  • Dependency injection container independence (Unity ships with Enterprise Library, but you can replace it with a container of your choice)
  • Programmatic configuration support, including a fluent configuration interface and an XSD schema to enable IntelliSense
  • Redesign of the configuration tool to provide:
    • A more usable and intuitive look and feel
    • Extensibility improvements through meta-data driven configuration visualizations that replace the requirement to write design time code
    • A wizard framework that can help to simplify complex configuration tasks
  • Data accessors for more intuitive processing of data query results
  • Asynchronous data access support
  • Honoring validation attributes between Validation Application Block and DataAnnotations
  • Integration with Windows Presentation Foundation (WPF) validation mechanisms
  • Support for complex configuration scenarios, including additive merge from multiple configuration sources and hierarchical merge
  • Optimized cache scavenging
  • Better performance when logging
  • A reduction of the number of assemblies
  • Support for the .NET 4.0 Framework and integration with Microsoft Visual Studio 2010
  • Improvements to Unity

Download the MSI and install

Wednesday, October 12, 2011

Understanding SOAP and REST

Which is better SOAP or REST? One of the most common discussions. Both REST and SOAP are different approaches in writing the service oriented applications. REST is an architectural style for building client-server applications. SOAP is a protocol for exchanging data between two endpoints.

It is more appropriate if you compare REST with RPC(remote procedure call). RPC is a style of building client-server applications. Compared to RPC there won’t be generated proxy for client which is less coupled to the service.

REST relies on HTTP, requests for data[Get requests] can be cached. RPC systems not having such infrastructure even when using SOAP over HTTP.

Both REST and SOAP can used to implement similar functionality but SOAP should be used when a particular feature of SOAP is needed.

Security

Is SOAP is more secured than REST? answer is no. It is easy to make REST based service secure as it is to make SOAP service.The security in REST  is in the form of HTTP-based authentication and Secure Sockets Layer(SSL).  Because of WS-* specifications SOAP supports the end-to-end message security.

Transactions

This is another feature that SOAP and WS-*  supports where REST has none.

WS-Atomic transactions supports distributed, two-phase commit transactional semantics over SOAP-based services. REST has no support for distributed transactions. To create something like transactions in REST you create a  resource called Transaction. When client wants to do some transaction and then he creates a resource that specifies all the correct resources.

Interoperability

SOAP services are less interoperable than REST Services. In terms of platforms, For REST all you need is HTTP stack. REST has widest interoperability like mobile devices,household devices, POS devices etc. The problem in SOAP and WS-* is the large number of standards to choose from.

Metadata

There is no direct way in REST to generating client from server-side-generated metadata. In SOAP with WSDL we can generate the client proxies. In REST we can achieve the same using WADL (Web Application Description Language). WSDL makes easier in generating the proxy than writing some code fro generating for REST service.

Protocol Support

Though REST is currently tied with HTTP but you still can implement the REST features on other protocols until vendors add support for this.

IS REST is for Internet-facing apps and SOAP for enterprise apps?

Answer is no. This question comes due to lack of distributed transaction support in REST vs explicit WS-atomic transactions in SOAP.

ASP.NET doesn’t have support for distributed transactions, but does that mean ASP.NET isn’t useful for enterprises?

Enterprise applications need scalability and speed. SOAP services are much harder to scale than RESTful services. Most of the scaling features can not be used with SOAP because SOAP uses POST only over HTTP.

Conclusion

“Which is better, REST or SOAP?” is “It depends”. Both REST and SOAP has advantages and disadvantages when it comes to building the services. When you need the features that are easy to implement using REST or SOAP choose it..

Saturday, September 10, 2011

Convert DateTime values to W3C DateTime format in C#

ConvertDateToW3CTime() function takes a C# DateTime value and converts it to a W3C formatted date/time value.
The function works by first converting the date/time parameter to a UTC (Coordinated Universal Time) value and formatting it. It then appends the UTC offset time to the previously formatted string.

The T placed between the date and time simply indicates that the numbers following it are Time values. The UTC offset can be one 3 states, zero e.g. there is not difference in time between the UTC value and the local value. A zero value is identified by simply appending the letter Z to the end of the formatted datetime value. If the offset time is greater than 0 then it is preceded with a + sign, e.g. 2 hours and 30 minutes over the UTC time would be written as +02:30. If the offset is less than the UTC value then it is preceded with a sign e.g. -01:00.

/// <summary>
/// Converts a datetime value to w3c format
/// </summary>
/// <param name="date"></param>
/// <returns></returns>
public static string ConvertDateToW3CTime(DateTime date)
{
//Get the utc offset from the date value
var utcOffset = TimeZone.CurrentTimeZone.GetUtcOffset(date);
string w3CTime = date.ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ss");
//append the offset e.g. z=0, add 1 hour is +01:00
w3CTime += utcOffset == TimeSpan.Zero ? "Z" :
String.Format("{0}{1:00}:{2:00}", (utcOffset > TimeSpan.Zero ? "+" : "-")
, utcOffset.Hours, utcOffset.Minutes);

return w3CTime;
}



Here is an example, how to use it


ConvertDateToW3CTime(DateTime.Now);
//Output 2011-10-17T19:10:48+01:00

Thursday, August 25, 2011

How to Close the Browser Window from a Silverlight Application

All secured sites ask you to close your browser window after you sign out from a web application. This is a security measure which actually removes all session details from the browser cache.

If you are developing a secured site and want to close the browser window just after the user logs out from the application, this small tip will help you. If you want to develop the same behavior in your Silverlight application, this is how we can do the trick.

Use  the "System.Windows.Browser.HtmlPage.Window.Invoke()" method to call the Close() method of the browser window, as shown in the below code snippet:

private void OnWindowCloseClick(object sender, RoutedEventArgs e)
{
    System.Windows.Browser.HtmlPage.Window.Invoke("close");
}

The above code when called will close the browser window where your Silverlight application is hosted. If it is a tab, it will close the Window tab instead. If you are using it inside Internet Explorer, it will ask you whether you really want to close the browser. If you press "No", it will remain in that page, and clicking "Yes" will close the browser tab/window

Monday, August 01, 2011

Tips for Cross Browser Compatibility

Cross-browser compatibility is one of the most time consuming tasks for any web designer. We’ve seen many different articles over the net describing common problems and fixes. There are some things you should consider for Safari and Firefox also, and IE isn’t always the culprit for your CSS woes. Here is a quick summary of How to get Cross Browser Compatibility Every Time:

  • Always use strict doctype and standards-compliant HTML/CSS
  • Always use a reset at the start of your css
  • Use -moz-opacity:0.99 on text elements to clean up rendering in Firefox, and text-shadow: #000 0 0 0 in Safari
  • Never resize images in the CSS or HTML
  • Check font rendering in every browser. Don’t use Lucida
  • Size text as a % in the body, and as em’s throughout
  • All layout divs that are floated should include display:inline and overflow:hidden
  • Containers should have overflow:auto and trigger hasLayout via a width or height
  • Don’t use any fancy CSS3 selectors
  • Don’t use transparent PNG’s unless you have loaded the alpha

Thursday, July 21, 2011

Keyboard Shortcuts: SQL Server Management Studio

SQL Server Management Studio offers users two keyboard schemes. By default, it uses the Standard scheme, with keyboard shortcuts based on Microsoft Visual Studio. A second scheme, called SQL Server 2000, closely resembles the tools from SQL Server 2000, in particular the keyboard shortcuts from the Query Analyzer. In a few cases, SQL Server Management Studio cannot offer the keyboard shortcuts from Query Analyzer. To change the keyboard scheme or add additional keyboard shortcuts, on the Tools menu, click Options. Select the desired keyboard scheme on the Environment, Keyboard page.

For Shortcuts page. Click here to navigate.

Friday, June 24, 2011

How to: Dummy Credit card # for Testing

Here are list of credit card numbers which we can use for testing purpose. You can use this numbers and give other details like year and month and cvv as dummy ones. These  works for testing purpose.

Credit Card Type

Credit Card Number

American Express

378282246310005

American Express

371449635398431

AMEX Corporate

378734493671000

Diners Club

30569309025904

Diners Club

38520000023237

Discover

6011111111111117

Discover

6011000990139424

JCB

3530111333300000

JCB

3566002020360505

MasterCard

5555555555554444

MasterCard

5105105105105100

Visa

4111111111111111

Visa

4012888888881881

Monday, June 06, 2011

Difference Between Add Service Reference And Web Reference?

Service References or WCF comes from VS 2008 and above with an extension as .svc and Web References are their from the beginning as .asmx.

The main difference between WCF service and Webservice while consuming, we need to add them in solution as reference to access them.

Add Web Reference is a wrapper over wsdl.exe and can be used to create proxies for .NET 1.1 or 2.0 clients. This means we are pointing to a WCF service you have to be pointing to an endpoint that uses basicHttpBinding.

Add Service Reference is a wrapper over svcutil.exe and also creates clients proxies (and additionally web.config entries). These proxies, however, can only be consumed by .NET 3.0+ clients.

Below image will show you how to add web reference from Service Reference. Right click theService References from solution explorer, then select advance button on Add Services windowyou will get to the form as in below image and then will be able to add Web Reference via Addweb Reference window..

image

But there is some things which changed in VS2010 about adding web references to a class library. So in VS 2010 you cannot add Web Reference directly.  Here is how you need to do it.

From Project -> Add Service Reference ..., (From Solution Explorer, Right Click on Project, From the drop down Menu, Select Add Service Reference)

image

This window will appear, Click advanced,

image

On Add Service Settings window, Now click on Add Web Reference

image

This will open add Web reference window from where we can add web service. Hope this helps. Good luck.

Saturday, May 28, 2011

How to Add validations controls Programmatically

I was looking for some server side validation message which can done without posting back to server. I tried doing javascript and writing that script to literal control and I have been thinking of doing a better way. But here is the cool way to do this.

// Dynamically adding Validation control
RequiredFieldValidator Validator = new RequiredFieldValidator();
Validator.ErrorMessage = "No data to download for your request.";
// Validation group must be specified as to which group you need to bind
Validator.ValidationGroup = "Group1";
Validator.IsValid = false;
Validator.Visible = false;
Page.Form.Controls.Add(Validator);

All you need to do is Depending on your need you need to change message and validation group. We need to set up validation group properly.


Happy coding Smile

Wednesday, May 18, 2011

How to add a ServiceThrottlingBehavior to a WCF Service?

When working with WCF especially when middle-tier client applications uses Windows Communication Foundation, you should always think about performance and take some major design decisions and tuning parameters.

By adding ServiceThrottlingbehavior in web.config we can achieve high performance using WCF. Below is the sample serivceThrottleconfiguration settings in web.config in .NET 4.0 Framework.

 <behaviors>
      <serviceBehaviors>
        <behavior name="CommonService">
          <serviceMetadata httpGetEnabled="true" />
          <serviceDebug includeExceptionDetailInFaults="false" />
          <dataContractSerializer maxItemsInObjectGraph="2147483647" />
          <serviceThrottling maxConcurrentCalls="16" 
                             maxConcurrentInstances="116"   
                             maxConcurrentSessions="100"   />
        </behavior>
      </serviceBehaviors>
    </behaviors>

The main purpose for the throttling settings can be classified into the following two aspects:


  1. Controlled resource usage: With the throttling of concurrent execution, the usage of resources such as memory or threads can be limited to a reasonable level so that the system works well without hitting reliability issues.

  2. Balanced performance load: Systems always work in a balanced way when the load is controlled. If there are too much concurrent execution happening, a lot of contention and bookkeeping would happen and thus it would hurt the performance of the system.

In WCF 4, the default values of these settings are revised so that people don’t have to change the defaults in most cases. Here are the main changes:


  • MaxConcurrentSessions: default is 100 * ProcessorCount

  • MaxConcurrentCalls: default is 16 * ProcessorCount

  • MaxConcurrentInstances: default is the total of the above two, which follows the same pattern as before.

“ProcessorCount” is used as multiplier for the settings. So on a 4-proc server, you would get the default of MaxConcurrentCalls as 16 * 4 = 64. Thus the consideration is that, when you write a WCF service and you use the default settings, the service can be deployed to any system from low-end one-proc server to high-end such as 24-way server without having to change the settings. So CPU uses count as the multiplier.

Please note, these changes are for the default settings only. If you explicitly set these settings in either configuration or in code, the system would use the settings that you provided. No “ProcessCount” multiplier would be applied.

Tuesday, May 17, 2011

Web.config transformations in .NET 4.0

The web.config has now been refactored, and with ASP.Net 4 a lot of the settings that were previously found in the web.config file have now been moved to the machine.config file. This significantly reduces the size of the file, which I think is a great bonus.

Web.config transformations cater for moving your application between your relevant environments (e.g. DEV, QA, PROD). The transformations work on the relevant configurations you setup.
To create your own Configuration build with configuration transformations, create a new ASP.NET Web Application in Visual Studio 2010. Next, in the menu select "Build" and then "Configuration Manager". In the "Active Solution Configuration" drop down, select "New". Name the relevant configuration, for example I'm calling mine "DEV" and copying the settings from the "Debug" configuration.

Make sure "Create new project configurations" is selected. Once you click okay, you will see your Web.config file now has a "+" next to it in your solution explorer.

If you don't see the "+", build you solution, right click the web.config file and select "Add Config Transformations".
You will see for each of your build configurations there will be a "Web.[Build Configuration Name].config" file. If you open any of these files, you will see place holders for different sections of your original web.config file.

To change settings per your relevant build configuration, check out the following MSDN Article:Web.config Transformation Syntax for Web Application Project Deployment

Hope this helps.

Sunday, May 15, 2011

When to use .NET Framework Client Profile

The .NET Framework 4 Client Profile is a subset of the .NET Framework 4 that is optimized for client applications. It provides functionality for most client applications, including Windows Presentation Foundation (WPF), Windows Forms, Windows Communication Foundation (WCF), and ClickOnce features. This enables faster deployment and a smaller install package for applications that target the .NET Framework 4 Client Profile.

Check out following MSDN Page for Client Profile:.NET Framework Client Profile

How to Creating an HTML Signature in Outlook 2007

Here is the workaround to create HTML signatures for Outlook 2007. When you create a signature in Outlook 2007 it creates 3 separate files (.htm, .txt and .rtf). To create a more custom signature you can write it in HTML – this is especially useful for when dealing with graphics and advanced formatting.

How to create signature in Outlook 2007:

  1. In Outlook go to Tools > Options and the Mail Format tab.
  2. Click the Signatures button.
  3. Click the New button.
  4. Give your signature a name like ‘MySignature′
  5. Click on OK

Outlook doesn’t require any content to be added and will create the 3 individual files. Click OK and close Outlook

How to Locate your signature folder: Copy one of the following lines depending on what your operating system is.

  • Windows 7: %userprofile%\AppData\Roaming\Microsoft\Signatures
  • Vista: %userprofile%\AppData\Roaming\Microsoft\Signatures
  • XP-2003: %userprofile%\Application Data\Microsoft\Signatures

Click on Start and then Run – paste the line you copied into the Run box and hit Enter

You should see 3 files created for your "MySignature” file (in .htm, .txt and .rtf formats). If you can’t see the file extensions, go to Tools / Folder Options / View and untick ‘Hide extensions for known file types’, or right-click the file and select ‘Properties’ to determine the file type.

Replace the HTML file created by Outlook:
Take your HTML signature file and use it to replace the .htm file in your signature folder (i.e. save it as in this system folder, using the same filename as the .htm signature file created by Outlook ).

To start using your new signature:
Restart Outlook.

It worked for me on Outlook 2007 and Outlook 2010. Hope this is useful for you Smile

Wednesday, May 04, 2011

Remote Server Administration Tools for Windows 7

Remote Server Administration Tools for Windows 7 with SP1 enables IT administrators to manage roles and features that are installed on remote computers that are running Windows Server 2008 R2 with SP1 or Windows Server 2008 R2 (and, for some roles and features, Windows Server 2008 or Windows Server 2003) from a remote computer that is running Windows 7 or Windows 7 with SP1. It includes support for remote management of computers that are running either the Server Core or full installation options of Windows Server 2008 R2 with SP1, Windows Server 2008 R2, and for some roles and features, Windows Server 2008. Some roles and features on Windows Server 2003 can be managed remotely by using Remote Server Administration Tools for Windows 7 with SP1, although the Server Core installation option is not available with the Windows Server 2003 operating system.


This feature is comparable in functionality to the Windows Server 2003 Administrative Tools Pack and Remote Server Administration Tools for Windows Vista with Service Pack 1 (SP1).

Remote Server Administration Tools for Windows 7 with SP1 can be installed on computers that are running the Enterprise, Professional, or Ultimate editions of Windows 7 or Windows 7 with SP1. This software can be installed ONLY on computers that are running the Enterprise, Professional, or Ultimate editions of Windows 7 or Windows 7 with SP1; it cannot be installed on target servers that you want to manage.


Both x86- and x64-based versions of Remote Server Administration Tools for Windows 7 with SP1 are available for download on this page. Download and install the version that matches the architecture of the computer on which you plan to install the administration tools.

For more information go to MSDN for help. You can download this for 32 bit and 64 bit in the this URL.

Google SketchUp 8

Here are the features that Google is providing with this SketchUp software. Because almost everything is somewhere. By using this everyone can do 3D Modeling.

Whether you're designing in context, creating a shadow study or photo-modeling existing structures, SketchUp 8 provides easy access to Google's huge collection of geographic resources.

  • add-geo-location
    Model geo-location with Google Maps

    We've built Maps right into SketchUp. Adding a geo-location to your model is now an elegant, one-app process.

  • color-terrain
    Color imagery and more accurate terrain

    The snapshot you get when you add a geo-location to your model now includes 3D terrain data that's more accurate, and -- for the first time -- aerial imagery in color.

  • photo-match-improvements
    Match Photo improvements

    Our Match Photo feature lets you trace one or more photographs to build a model; it's an incredibly powerful tool. For SketchUp 8, we've tweaked some things to make using Match Photo easier than ever.

  • building-maker
    SketchUp, meet Building Maker

    When it comes to modeling existing buildings, it's hard to beat Google Building Maker for speed and efficiency. We've made it simpler to open and refine Building Maker models in SketchUp. Watch a video

    Watch a video about modeling in context with SketchUp 8

Download Google SketchUp 8

Friday, April 15, 2011

Silverlight 5 Beta Released & Microsoft Silverlight 5 Beta Tools for VS 2010 SP1

Microsoft has just released first beta of upcoming Silverlight 5.
Microsoft Silverlight 5 Beta Tools for Visual Studio 2010 Service Pack 1 is an Add-on and pre-requisite files for Visual Studio 2010 Service Pack 1 to develop Silverlight 5 Beta and Microsoft WCF RIA Services V1.0 SP2 Preview (April 2011) applications.
Download: Silverlight 5 Tools Beta
Microsoft® Silverlight™ 5 Software Development Kit Beta
Silverlight 5 Beta Documentation

Getting Started with Silverlight 5 Beta

Monday, April 11, 2011

10 Great Features in 10 Different OSes

If you are making the ultimate OS, what features would you choose?

  1. Mac OS X, Time Machine: Apple introduced Time Machine backup software with the Mac OS X 10.5 in 2007. You can back up to a local drive connected via USB or Fire wire, or even to network storage via Ethernet or Wi-Fi. As long as your backup volume is available. Time Machine creates hourly, daily and weekly incremental backups of your system.
  2. Unix, The Shell Terminal: There's always tension between command-line and graphical interfaces, and for the last decade or more, GUIs have been the dominant face of most OSes. But as Max Steenbergen writes in his article "Commands Lines: Alive & Kicking" for UX Magazine, the command line is making a comeback via app launchers like Alfred, Launchy and GNOME Do.
  3. Ubuntu, Simplified Linux Setup: Ubuntu aims for easy installation and configuration, and that's been my experience so far. You can download a live CD ISO or a Windows installer to get going. It doesn't require much of a commitment if you just want to give Ubuntu a try. Burn the ISO to CD and boot from that, or install it in a virtual machine using VirtualBox, Virtual PC or VMWare Player
  4. BeOS, 64-Bit Journaling File System: When Jean Louis Gasse left Apple, he founded a new team that created the charming and forward-looking BeOS in 1991.The file system included with BeOS, however, is one of its truly cool features. Called BFS (BeOS File System), it was a 64-bit journaling file system using file attributes, or metadata. The ability to query and sort against file metadata gave BFS some relational database-like quality similar to what we may finally see via WinFS in Windows 8. The 64-bit address space gave BFS the theoretical ability to support volumes of more than eight exobytes and files over 30 GB. This at a time when 30 GB hard drives were hardly commonplace.
  5. IRIX, SGI Dogfight: The first components of what would become the Dogfight demo were created by Gary Tarolli in the early '80s. OK, technically Dogfight wasn't an OS feature like some of the other items we've discussed here, but it was designed specifically to highlight the advanced (for the time) 3D rendering capabilities of SGI's systems.
  6. NeXTSTEP, Right-Click Context Menu: While the Mac OS didn’t embrace the right-click context menu until much later, it was an OS feature from the start in NeXTSTEP.
  7. MS-DOS, BASIC: MS-DOS was undeniably the dominant desktop operating system throughout the '80s, and every one of those computers running MS-DOS included the Microsoft BASIC programming language in one form or another. In fact, the version of BASIC created by Paul Allen and Bill Gates predates even MS-DOS, originating as Altair BASIC in the '70s
  8. Windows 3.0, Alt-Tab Task Switching: Pressing the Alt and Tab keys brings up a window that displays an icon for each open window present on the system (even if minimized). The currently active window is highlighted by default. Holding down the Alt key, you release and press the Tab key to move the highlight to the next window, thereby making it the active window and bringing it to the front.
  9. iOS, Multi-Touch: The introduction of what we now know as iOS for the iPhone in 2007, however, represented the first chance for many of us to have a hands-on experience with multi-touch
  10. Windows 7, Start Menu and Taskbar: The Start menu and taskbar as we know them in Windows today debuted in Windows 95. With each new release of Windows, new features have been added: integrated search, pinned applications, recently used files and one-click access to often used folders and system configuration tools. Vista added the ability to type a string into the search box and get a list of files and applications matching that string. Windows 7 made that feature actually work properly (mostly through more efficient file indexing) and added per-application recently used file listings.

These are captured from blog of Terrence Dorsey, who is the editor of MSDN Magazine.

Tuesday, March 22, 2011

Visual Studio 2010 Key binding Posters

If you like those little Visual Studio keyboard shortcuts, you can download posters from the below location. Here are reference posters for the default key bindings in Visual Studio 2010 for Visual Basic, Visual C#, Visual C++ and Visual F#

Download here.

Saturday, March 12, 2011

Difference Between Build and Re-Build in Visual Studio .Net?

Build means compile and link only the source files that have changed since the last build, while Rebuild means compile and link all source files regardless of whether they changed or not. Build is the normal thing to do and is faster. Sometimes the versions of project target components can get out of sync and rebuild is necessary to make the build successful. In practice, you never need to Clean.

Build or Rebuild Solution builds or rebuilds all projects in the your solution, while Build or Rebuild <project name> builds or rebuilds the StartUp project. To set the StartUp project, right click on the desired project name in the Solution Explorer tab and select Set as StartUp project. The project name now appears in bold.

Build.BuildSolution F6 or CTRL+SHIFT+B Builds all the projects in the solution.
Build.BuildSelection SHIFT+F6 Builds the selected project
and its dependencies.

Hope this helps Smile

Friday, March 11, 2011

Firefox speaks your language

Firefox is available in over 70 languages, download Firefox that speaks your language.

Download from here for fully localized versions.

Tuesday, March 08, 2011

Active Sync for Windows Vista and Window 7

ActiveSync 4.5 will not work for Windows Vista and above for that we need to install Windows Mobile Device Center.

The Windows Mobile Device Center enables you to set up new partnerships, synchronize content and manage music, pictures and video with Windows Mobile powered devices (Windows Mobile 2003 or later). The Windows Mobile Device Center combines an efficient business-data synchronization platform with a compelling user experience. The Windows Mobile Device Center helps you to quickly set up new partnerships, synchronize business-critical information such as e-mail, contacts and calendar appointments, easily manage your synchronization settings, and transfer business documents between your device and PC

Step 1: Connect your phone

Grab your phone and the USB cable that came with it. If you need some additional help setting up and using your new phone, see Windows Phone 6.5 basics for more information.

Step 2: Download the sync software for your computer

Choose the sync software for your computer's operating system, which you can download here:

  • If you have Windows Vista or Windows 7, your sync settings will be managed through Windows Mobile Device Center.

  • If you have Windows XP SP3, your sync settings will be managed through ActiveSync. Download ActiveSync 4.5 for here.

Step 3: Get Microsoft Office Outlook

To sync your phone's email, calendar, and contacts with your computer, you'll need to have Outlook installed on your computer. We recommend the latest version for the best experience. When you're ready to start syncing, see Sync Windows Phone 6.5 with my computer.

Hope this helps.

Sunday, February 20, 2011

Google Chrome 10 beta Released

Google has just released Chrome 10 beta (10.0.648.82 for all you perfectionists) and it brings with it a whole slew of new things to play with.

First off, there’s a significant JavaScript performance boost thanks to the updated V8 engine. According to Google, this version of the V8 engine offers a 66% performance advantage over the current stable release. That alone is pretty impressive.

Download Google Chrome beta 10 here.

Friday, February 18, 2011

Microsoft Code Samples for Developers

This code sample library will help all developers to find useful code in various dot net areas. Microsoft goal is to centralized all codes in one place. This library having below things:

  • Microsoft All-in-One Code Framework: Free, centralized code sample library
    • Code Samples
    • Services
  • Microsoft SDKs: provide documentation, code samples, tools etc..
  • MSDN Code Gallery:  download and share sample applications, code snippets and other resources.

You can download it from here

Wednesday, February 16, 2011

Download: ASP.NET MVC 3

ASP.NET MVC 3 is a framework for developing highly testable and maintainable Web applications by leveraging the Model-View-Controller (MVC) pattern. The framework encourages developers to maintain a clear separation of concerns among the responsibilities of the application – the UI logic using the view, user-input handling using the controller, and the domain logic using the model. ASP.NET MVC applications are easily testable using techniques such as test-driven development (TDD). The installation package includes templates and tools for Visual Studio 2010 to increase productivity when writing ASP.NET MVC applications. For example, the Add View dialog box takes advantage of customizable code generation (T4) templates to generate a view based on a model object. The default project template allows the developer to automatically hook up a unit-test project that is associated with the ASP.NET MVC application. Because the ASP.NET MVC framework is built on ASP.NET 4, developers can take advantage of existing ASP.NET features like authentication and authorization, profile settings, localization, and so on. Go through this help to get started MVC 3.

MVC stands for model-view-controller. MVC is a pattern for developing applications that are well architected and easy to maintain. MVC-based applications contain:

  • Controllers: Classes that handle incoming requests to the application, retrieve model data, and then specify view templates that return a response to the client.
  • Models: Classes that represent the data of the application and that use validation logic to enforce business rules for that data.
  • Views: Template files that your application uses to dynamically generate HTML responses.

Download MVC 3

Thursday, February 10, 2011

How do I know which version of SQL Server I'm running?

When working with SQL Servers or other features that are version-specific, you often need to know what version of SQL Server is running on the target server.

For SQL 7.0 and earlier, You can query

SELECT @@VERSION

And the following query will work on SQL Server 2000 and up:

SELECT 'SQL Server ' 
+ CAST(SERVERPROPERTY('productversion') AS VARCHAR) + ' - ' 
+ CAST(SERVERPROPERTY('productlevel') AS VARCHAR) + ' (' 
+ CAST(SERVERPROPERTY('edition') AS VARCHAR) + ')'
 

Monday, February 07, 2011

Different types of status in Bug report

Here is the description of all the status with its brief description

1. Bug: When QA files new bug.

2. Deferred: If the bug is not related to current build or cannot be fixed in this release or bug is not important to fix immediately then the project manager can set the bug status as deferred.

3. Assigned: ‘Assigned to’ field is set by project lead or manager and assigns bug to developer.

4. In Process: This is the state of issue when Developer starts working on the assigned issue.

5. Resolved/Fixed: When developer makes necessary code changes and verifies the changes then he/she can make bug status as ‘Fixed’ and the bug is passed to testing team.

6. Could not reproduce: If developer is not able to reproduce the bug by the steps given in bug report by QA then developer can mark the bug as ‘CNR’. QA needs action to check if bug is reproduced and can assign to developer with detailed reproducing steps.

7. Need more information: If developer is not clear about the bug reproduce steps provided by QA to reproduce the bug, then he/she can mark it as “Need more information’. In this case QA needs to add detailed reproducing steps and assign bug back to dev for fix.

8. Reopen: If QA is not satisfy with the fix and if bug is still reproducible even after fix then QA can mark it as ‘Reopen’ so that developer can take appropriate action.

9. Closed: If bug is verified by the QA team and if the fix is ok and problem is solved then QA can mark bug as ‘Closed’.

10. Rejected/Invalid: Sometimes developer or team lead can mark the bug as Rejected or invalid if the system is working according to specifications and bug is just due to some misinterpretation.

11. Not a Bug: If the reported issue is not a bug or not for the current build then project lead or manager will set the status to 'NAB'

Sunday, February 06, 2011

How to write a good bug report?

Here is the synopsis on writing a good bug report. Hope you all know about Bugs. Here I’ll tell you how can we write better bug reports and how to use bug tracker.

Why we need a good Bug report?
If your bug report is effective, chances are higher that it will get fixed. So fixing a bug depends on how effectively you report it. If tester is not reporting bug correctly, programmer will most likely reject this bug stating as irreproducible.
1) Reproducible:If your bug is not reproducible it will never get fixed. You should clearly mention the steps to reproduce the bug. Do not assume or skip any reproducing step. Step by step described bug problem is easy to reproduce and fix.
2) Be Specific:Do not write a essay about the problem. Be Specific and to the point. Try to summarize the problem in minimum words yet in effective way. Do not combine multiple problems even they seem to be similar. Write different reports for each problem.
3) Having clearly specified bug number: When you are talking about the bug, identify it with bug number. Ex: Issue 101 etc. This will help to identify the bug record. Note the number and brief description of each bug you reported.

How to Report a Bug in Bug tracker?
While reporting a bug, don’t forget to mention version, Product, component or module, Platform (Ex: Mention the hardware platform where you found this bug. The various platforms like ‘PC’, ‘MAC’ etc.).
Operating system (Ex: Mention all operating systems where you found the bug. Operating systems like Windows, Linux, Unix, SunOS, Mac OS. Mention the different OS versions also if applicable like Windows NT, Windows 2000, Windows XP etc.)
Title: Should be easy specific to the bug.
Priority: When bug should be fixed? Priority is generally set from High to Low.
Status: When you are logging the bug in bug tracking system you can find different status, I have given more detail about test status in my blog here.
Comments: A brief summary of the bug mostly in 60 or below words. Make sure your summary is reflecting what the problem is and where it is.

A detailed description of bug. Use following fields for description field:
Reproduce steps: Clearly mention the steps to reproduce the bug.
Expected result: How application should behave on above mentioned steps.
Actual result: What is the actual result on running above steps i.e. the bug behavior.

URL: The page URL on which bug occurred is always helpful
All your comments will be seen in chronological order.

Attachments: Any screen shot or related document is helpful for developer or your manager. A picture is more powerful than mere words.

History: History will tell you all the activities related to the issue among the users.

Some Bonus tips to write a good bug report:

1) Report the problem immediately: If you found any bug while testing, do not wait to write detail bug report later. Instead write the bug report immediately. This will ensure a good and reproducible bug report. If you decide to write the bug report later on then chances are high to miss the important steps in your report.
2) Reproduce the bug three times before writing bug report: Your bug should be reproducible. Make sure your steps are robust enough to reproduce the bug without any ambiguity. If your bug is not reproducible every time you can still file a bug mentioning the periodic nature of the bug.
3) Test the same bug occurrence on other similar module:
Sometimes developer use same code for different similar modules. So chances are high that bug in one module can occur in other similar modules as well. Even you can try to find more severe version of the bug you found.
4) Write a good bug summary:
Bug summary will help developers to quickly analyze the bug nature. Poor quality report will unnecessarily increase the development and testing time. Communicate well through your bug report summary. Keep in mind bug summary is used as a reference to search the bug in bug inventory.
5) Read bug report before hitting Submit button:Read all sentences, wording, steps used in bug report. See if any sentence is creating ambiguity that can lead to misinterpretation. Misleading words or sentences should be avoided in order to have a clear bug report.

Conclusion:
Your efforts towards writing good bug report will not only save company resources but also create a good relationship between you and developers.

Friday, January 14, 2011

Internet Information Services (IIS) 7.5 Express

Microsoft has released final version of it’s so called lighter version of IIS 7.5 called as “IIS 7.5 Express” which makes developers to utilize the features of IIS 7.5 in Windows XP and above Operating system environments. IIS 7.5 Express is a simple and self-contained version of IIS 7.5 that is optimized for developers. IIS 7.5 Express enhances your ability to develop and test web applications on Windows by combining the power of IIS 7.5 with the convenience of a lightweight web server like the ASP.NET Development Server (also known as Cassini). IIS 7.5 Express is included with Microsoft Web Matrix, an integrated suite of tools designed to make developing web applications on Windows simple and seamless. IIS 7.5 Express can also be used with Visual Studio 2010 as a powerful alternative to Cassini. The benefits of using IIS 7.5 Express include:

  • The same web server that runs on your production server is now available on your development computer.
  • Most tasks can be done without the need for administrative privileges.
  • IIS 7.5 Express runs on Windows XP and all later versions of Windows.
  • Many users can work independently on the same computer.

Download: IIS 7.5 Express Final

Thursday, January 13, 2011

Export GridView to Excel in ASP.NET

Here is the same code to export GridView from C# in ASP.NET

protected void ExportButton_Click(object sender, EventArgs e)
{
   Response.AddHeader("content-disposition", "attachment;filename=Contacts.xls");
   Response.Charset = String.Empty;
   Response.ContentType = "application/vnd.xls";
   System.IO.StringWriter sw = new System.IO.StringWriter();
   System.Web.UI.HtmlTextWriter hw = new HtmlTextWriter(sw);
   ContactsGridView.RenderControl(hw);
   Response.Write(sw.ToString());
   Response.End();
 }
Hope this is useful Just kidding

How to update Web.config dynamically?

I need to update web.config dynamically? So this is what I did, this code below has done the trick for me.

string value = "webmaster@company.com";
Configuration config = webConfigurationManager.OpenWebConfiguration("~");
AppSettingsSection appsetting = config.GetSection("appSettings");
appsetting.Settings("fromAddress").Value = value;
config.Save();
Make sure to add System.Web.Configuration in the namespace. Have fun Light bulb

Thursday, January 06, 2011

assemblyBinding: Using Shared DLLs in .NET

How to Share DLLs in VS 2010. Recently I and my team had a problem working with a Shared DLL. Our developers are saving our project in different locations of our computer. Few are saving in D drive and few in E drive. So while getting latest solution from the Visual source safe some of us are having missing references problem with the DLLs when we have Shared DLLs in a location. So to resolve this we have created a folder in *\bin folder with name Shareddlls and placed all the Shared dls in that folder.

Once we have done this we need to add piece of code in web.config.

 <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <probing privatePath="bin;bin/shareddlls" />
    </assemblyBinding>
  </runtime>

This worked perfectly for me. Microsoft rocks. When I first read that .NET assemblies could be "redirected" at runtime, I was stunned and a little bit suspicious. By using Assembly Binding Redirection you can redirect an assembly binding reference to another version of an assembly by using entries in the application or machine configuration files. You can redirect references to .NET Framework assemblies, third-party assemblies, or assemblies of your own application. Each version of the .NET Framework has a machine configuration file, and any redirection information in that file affect all applications running under that version of the .NET Framework.


Redirecting .NET Framework Assembly Binding


The .NET Framework assembly unification model treats all .NET Framework assemblies of a given version, and the runtime of that version, as a single unit. The redirections that occur with this model are the default behavior for the runtime.
There are several ways to instruct the runtime to load a .NET Framework assembly with a different version than that of the loaded runtime:



  • Add settings in the application configuration file.

  • Add settings in the machine configuration file.

  • Create a publisher policy file that is distributed with a component to specify which assemblies a component should use.

A binding redirection in an application configuration file for a unified .NET Framework assembly cancels the unification for that assembly. To redirect an assembly binding reference for an assembly that is not part of the .NET Framework, specify the binding redirection information in the application configuration file using the <assemblyBinding> element.

SQL Server AZURE code-named "Denali" is ready for Download

Microsoft SQL Server code-named “Denali” empowers organizations to be more agile in today’s competitive market. Customers can efficiently deliver mission-critical solutions through a highly scalable and available platform. Industry-leading tools help developers quickly build innovative applications while data integration and management tools help deliver credible data reliably to the right users and new user experiences expand the reach of BI to enable meaningful insights. It provides a highly available and scalable platform with greater flexibility, ease of use, lower TCO, and the performance required by the most mission-critical applications.

Top SQL Azure Features:

  • No software to install or hardware to set up.
  • High availability and fault tolerance.
  • Simple provisioning and deployment.
  • Frictionless application development.
  • Scalable databases based on business needs.
  • Multitenant support.
  • Integration with Microsoft Visual Studio.
  • Transact-SQL development support.
  • Familiar, relational database model.
  • ADO.NET, OBDC, JBDC, PHP, and OData support.

Download free trail from here.