Restore Deleted Files or Folders

How m any times it has happened to you that you have deleted a file or a folder and then realised later that you really need it. That's the time when you feel really helpless and scold yourself of deleting it. Only thing that you want that time is to recover it by any means possible.

There are good news for you if you are using Windows Vista. It is very easy to recover if you accidentally delete or rename a file or folder. You can restore a shadow copy of that file or folder, and all you need to know is the location of the file or folder was saved to.

Follow these steps to restore a file or folder that was deleted or renamed:


1. Go To Start and Open Documents.

2. Click the arrow next to Folders at the bottom of the left pane.

3. Open the folder that contained the file or folder that was deleted or renamed.

4. Right-click somewhere in the folder (without selecting a file or folder), and then click Restore previous versions.

5. Double-click a previous version of the folder that contains the file or folder you want to restore.

6. In the folder, drag the file or folder that you want to restore to another location, such as your desktop or another folder.

The version of the file or folder is saved to the location that you selected.

[ Click Here to Read More... ]

Access tables from different databases in SQL Server

This article will explain how can you join tables from different databases.

Suppose you have a table Table1 in Database DB1 and other table Table2 in DB2 on the same servers and currently you are using Database DB1 then to access the Table2 you can simply prefix it with DB2..

Note the two dots after the Database name.

For example,

SELECT * FROM TABLE1 JOIN DB2..TABLE2
ON TABLE1.KEY = DB2..TABLE2.KEY

[ Click Here to Read More... ]

Introduction to XML Web Services

XML web service can be defined as a unit of code that can be invoked via HTTP requests. Unlike a traditional web application, however, XML web services are not (necessarily) used to emit HTML back to a browser for display purposes. Rather, an XML web service often exposes the same sort of functionality found in a standard .NET code library.

Not only a Web based application but a console or windows from application can also use the functions provided by a web service.

Simplest example of a web service in our daily life can be given as a service that is used to validate credit card accounts when you are making electronic transactions. Every e-commerce web site validates the credit cards for transactions and there is no need for every such web site to have code written to do this in their own application. Instead, all e-commerce websites can access a single web service to validate the credit card.

In general, to use web services your applications have to do three things:

  1. Find appropriate Service (Discovery Service):

Before a client can invoke the functionality of a web service, it must first know of its existence and location.

For finding the appropriate service, there are different options.
If you are the individual (or company) who is building the client and XML web service, the discovery phase is quite simple given that you already know the location of the web service in question.


In other cases, an application first uses the Universal Description, Discovery and Integration (UDDI) registry to determine where a specific service can be found. UDDI is a web-based distributed directory that enables web services to list themselves on the Internet and discover each other, similar to a traditional phone book’s yellow and white pages.

  1. Determine what kind of messages web service will accept, and in what format (Descriptive Service):

Once a client knows the location of a given XML web service, the client must fully understand the functionalities provided by the service. He must know what inputs and in which format are required to use an operation of the service in question. For example, the client must know that there is a method named GetTemperature() that takes some input parameters and sends back a return value.

For this purpose XML-based metadata is used to describe a XML web service and it is termed the Web Service Description Language (WSDL).
Using this, a web service created in any language can be accessed by an application developed in any other or same language and any platform.
Using the WSDL description a client can find that what kind of operations the Service provides and what are the inputs that the operation expects and what it gives as a return value.

  1. Communications mechanism to get data to and from the web service (Transport Protocol):

Hypertext Transport Protocol (HTTP) is used as the transport mechanism to access the Web Services. The data packets transferred apply the Simple Object Access Protocol (SOAP), with the use of XML statements. The XML provides a placeholder for data, either input to the web service or output back to the application.

SOAP is a standard of the World Wide Web Consortium, and its specification can be found at www.w3.org/tr/soap. It describes an XML-based message passing format for communications between networked computers and other devices.

HTTP GET and HTTP POST can also be used in place of SOAP but they are restricted to a limited set of core data XML schema types. On the other hand, SOAP can be used with complex types.

.NET web services use SOAP to transfer the data.

[ Click Here to Read More... ]

solution for "Validation of viewstate MAC failed" in ASP.NET 2.0

If you are having a large page that uses lot of time to load and you are using built-in databound controls such as GridView, DetailsView or FormView which utilize DataKeyNames then there may be the cases whenever you perform a post back before the page loading is complete you get the follwoing error:

[HttpException (0x80004005): Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that configuration specifies the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster.]



It is an observation that whenever GridView uses DataKeyNames it requires the ViewState to be encrypted. For this, Page adds <input type="hidden" name="__VIEWSTATEENCRYPTED" id="__VIEWSTATEENCRYPTED" value="" /> field just before closing of the <form> tag.

Now, if the page takes lot of time to load and you click on event then this hidden field might not bet yet rendered to the browser.

It means this field was omitted during postback, and Page doesn't "know" that viewstate is encrypted and thus causes the Exception.

A solution to this problem is to add follwoing ocde in the web.config :

<pages enableEventValidation="false" viewStateEncryptionMode ="Never" />


[ Click Here to Read More... ]

Exception Handling in SSIS Script Task

In SSIS Script Task you can use the same Structured Exception Handling (SEH) as in normal VB.NET or C# code.

Using this Structured Exception Handling you can catch specific errors as they occur and perform any appropriate action needed like letting the user know about what kind of error occurred, or logging the error or to perform some specific plan of action depending on the error.

In SSIS Script task you can Return Failure Status whenever an error is caught.

Here is an example of exception handling in Visual Basic.NET.

Public Sub Main()
Try
Dim fileContent As String
FileIO.FileSystem.ReadAllText("C:\file.txt")
Catch ex As System.IO.FileNotFoundException
Dts.TaskResult = Dts.Results.Failure
Return
End Try
Dts.TaskResult = Dts.Results.Success
End Sub


Above code tries to read the content of the file C:\file.txt and it will fail if file does not exist and throw an exception of type System.IO.FileNotFoundException. This exception will be caught in the catch block where we are returning the TaskResult as Failure. Additionally, you can perform any other action you want in this catch block.

[ Click Here to Read More... ]

Debug SSIS Script Component

While working with your SSIS package, have not you ever tried debugging a script component transformation by putting a breakpoint in the VB code? Well, i did and found that, unfortunately, it does not work.

On the other hand we are able to debug a script task using breakpoints in the same way as we do in Visual Studio IDE. But now how we go ahead with debugging a script component?

The only options to do the same are to either use the Row Count component or a Data Viewer.

Row Count task won’t be that much useful as it simply states how many rows passes through it.

On the other hand we can utilize the Data Viewer as a much better way to debug our script component. To add a Data Viewer, select the connector arrow leaving the script component that you want to debug, right click it and select Edit (you can also simply double click on that arrow). This will open up the Data Flow Path Editor. Just click on Add to add the data viewer. On the Configure Data Viewer screen, select Grid as the type. Click the Grid tab. Now you can select all those columns that you wish to see are in the Displayed Columns list. Now just close this window.

Now if you run your package, a Data Viewer window will be displayed and it will be filled with the data just after the script component is executed. This will be the data output by the Script Component. Click the Play button to continue package execution, or simply close the window. This way you can monitor all the data rows going through the script component.

I will admit that this work around of using a data viewer for debugging can never make up for the visual studio kind of debugging, but this is all we have got. We just can hope that future versions will have better debugging for a script component also as it is for the script task currently.

[ Click Here to Read More... ]

State Management with ASP.NET 2.0 : Profile Feature

Its a common thing to have State Management in almost all the Web Applications, but use of this has always been a contentious issue. A developer has to decide whether the user data should be stored per session or should it persist across the sessions.

Using sessions states we can always very easily store the information temporarily. This typically works by assigning to each new user a unique session key that is used as an index for an in-memory data store and lasts only for the duration of the session.

What if you want to store data across the sessions? This is typically done by having a back end data store indexed by some user key. But again a question arises, what if you want to store data across sessions for anonymous users also? This is answered very well by the new Profile feature of ASP.NET 2.0.

Using this Profile feature, you can quickly build a web application that stores user information like user preferences or any other data into a database. Profile is similar to Session State but in one regard that it is persistent across the sessions. Profile feature has a strong link up with the ASP.NET membership system and this is why data for the authenticated users or clients is stored with their real identified instead of some arbitrary generated keys. For anonymous clients an identifier is generated for them and is stored as a persistent cookie, so that every time that same machine access the site the preferences or data for that client machine will be retained.

How you can use this Profile feature effectively and how to implement better state management using it is explained in this MSDN Magazine Article.

[ Click Here to Read More... ]
Posted in Labels: | 0 comments Links to this post

ASP.NET 2.0 : Web Deployment Projects - Website Model of Development

I always used to ask myself while creating a web project in Visual Studio 2003 with ASP.NET 1.1, that why the hell we need to install the IIS even though our aim is to just develop a web application and not to host it.

For all of those who used to think the same Microsoft came up with the Website Model of development with ASP.NET 2.0.

Now with ASP.NET 2.0 and Visual Studio 2005 instead of creating a new project inside Visual Studio, the Web site model lets you point to a directory and start writing pages and code. Not only this the built-in ASP.NET Development Server can be used to quickly test your site (even without installing IIS), which hosts ASP.NET in a local process and prevents the need to install IIS to begin developing.

This new website model enables us to develop our web application without thinking about packaging and deployment.

If your application is complete and you are ready to deploy, you have several options. The simplest choice is to copy your files to a live server and let everything be compiled on-demand (as it was in your test environment). The second option is to use the aspnet_compiler.exe utility and precompile the application into a binary release.

To know in details about these deployment techniques and more advanced concepts just go through this MSDN Magazine article by Fritz Onion

[ Click Here to Read More... ]
Posted in Labels: | 0 comments Links to this post

Fix Error : "Task Manager has been disabled by your administrator"

When you are trying to open the task manager by CTRL+ALT+DEL then are you getting the following dialog box saying "Task Manager has been disabled by your administrator".

Task Manager has been disabled by your administrator

There may be several reasons for this to happen.
1. You use account that was blocked via the "Local Group Policy" or "Domain Group Policy".
2. Some registry settings block you from using "Task Manager".
3. Your system has been infected by a Trojan that is blocking you to use you Task manager.

The thrird reason is the most dangerous one and the only solution for that is to update your Anti Virus Program, Scan your system and remove the Trojan.

How to fix the other issues we will discuss it here :


The best thing regarding this that i will recommend you all is to go through the following Microsoft support document and follow the procedures mentioned there: Microsoft Support


Other thing that i found out is a toll to fix the registry for the same. You can get the tool from here -> Registry Tool

[ Click Here to Read More... ]

Data Structures and Algorithms with Object-Oriented Design Patterns in C#

Let me share with you a book whose primary goal is to promote object-oriented design using C# and to illustrate the use of the emerging object-oriented design patterns.

The book deals with software design patterns like: singleton, container, enumeration, adapter and visitor and how we can use them in an Object Oriented Approach with C#.

Virtually all of the data structures are presented in the context of a single, unified, polymorphic class hierarchy. This framework clearly shows the relationships between data structures and it illustrates how polymorphism and inheritance can be used effectively. In addition, algorithmic abstraction is used extensively when presenting classes of algorithms. By using algorithmic abstraction, it is possible to describe a generic algorithm without having to worry about the details of a particular concrete realization of that algorithm.

A secondary goal of the book is to present mathematical tools just in time. Analysis techniques and proofs are presented as needed and in the proper context. In the past when the topics in this book were taught at the graduate level, an author could rely on students having the needed background in mathematics. However, because the book is targeted for second and third-year students, it is necessary to fill in the background as needed. To the extent possible without compromising correctness, the presentation fosters intuitive understanding of the concepts rather than mathematical rigor.

This book presents the various data structures and algorithms as complete C# program fragments. All the program fragments presented in this book have been extracted automatically from the source code files of working and tested programs. It has been tested that by developing the proper abstractions, it is possible to present the concepts as fully functional programs without resorting to pseudo-code or to hand-waving.

This book does not teach the basics of programming. It is assumed that you have taken an introductory course in programming and that you have learned how to write a program in C#. That is, you have learned the rules of C# syntax and you have learned how to put together C# statements in order to solve rudimentary programming problems.

View/Download This Book

[ Click Here to Read More... ]