SQL Server 2005 Script to Generate INSERT statements


This procedure generates INSERT statements using existing data from the given tables and views. Later, you can use these INSERT statements to generate the data. It's very useful when you have to ship or package a database application. This procedure also comes in handy when you have to send sample data to your vendor or technical support provider for troubleshooting purposes. 

Click here to read original article and download script.

The same script can be downloaded from here

Is the above link useful to you? Let us know your feedback, it will help us to improve our posting(s). or You can send your feedback linkOblast.

Tips to Extending Life of your Computer

Abstracts from original article:
I am going to learn a lot from your personal experiences too, so drop a comment with your ideas as it might be of great help to others reading this blog -
Tip 1 -
Handling of laptop / computers comes on top of the list for me. You must carefully handle your laptop esp in which environments (hot sun) you use them. Dont keep it in hot rooms or accidentally take it out in the rains :). Avoid damaging your laptop by dropping the bag etc. I have seen in the past that these equipments do contain delicate parts and often can get damaged easily. It is always a pain post their damage to get them back to the best conditions.
Tip 2 -
Have a good power supply option at home / work. Often the surge in power supply can hurt the battery life and can bring components down too. So highly recommend to use an UPS with surge protector. The life of the the batteries is always governed by the usage and charging patterns. DONOT always keep your PC power connected. I have been using this laptop (Lenevo T61p) for close to an year and my battery still lasts for ~2.5 hrs and this is quite useful esp for folks like me who are on the move.
Be practical to what you do when you are on a Battery mode.
2.1 - Tasks such as multi-media (movies, games, listening to music etc) can heavily use power.
2.2 – Move to a lower brightness setting on laptops when under battery mode unless you are in a bright environment where you need to jack-up the brightness.
2.3 – Turn off your wireless and Bluetooth if you are not using them. These are heavy on power usage and can drain your batteries really quick.
2.4 – When in unused state, these days Vista/Win7 allows you to configure what the laptop must do. Highly recommend to move into Hibernate state so that it saves valuable power when you need them.
2.5 – Though I highlighted the charge/discharge mechanism, I have been charging at my office time and I just discharge it to almost draining situation (<10%) in the evenings. This gives the batteries longer life and your usage will make sure you use each part of the battery. I have seen people who have the same model as I do and their battery doesnt even last 1 hr.
Tip 3 -
Maintaining your HDD is one of the key aspect of extending the life of your Laptop. Defragment your drives atleast once a month to make contiguous free space in your system. I have been using TreeSize for a while now and keep a tap on who is using what space in my system. You are the boss and you better be in control of the same. As we are on this topic, I loved the new addition of defragmentation of ALL volumes in one shot using commandline utility with Windows 7. In your commandprompt type:
defrag /C /H /V
to defragment all your drives. Very handy utility. Also you can always use the Disk Cleanup utility from the drive properties to cleanup unused junk data. It can sometimes free-up tons of space.


Click here to read the original article.

Is the above link useful to you? Let us know your feedback, it will help us to improve our posting(s). or You can send your feedback linkOblast.

"You require permission from administrator to delete file" in Windows 7


I have done fresh installation of Windows 7 in my C drive.
After successfull installation, I tried to delete one of the file from D drive and it gave me error
with the below error message.



After some Google, I found the solution.


Here are the steps:
  • Open command prompt with Admin rights.
  • Type the following command
    takeown /f YourFileName
  • Then grant Admin rights to yourself by this command
    cacls YourFileName /G YourLoginName:F
    When asked press "Y"
Thats it, You are done.

Now you will be able to delete unwanted files.



Is the above link useful to you? Let us know your feedback, it will help us to improve our posting(s). or You can send your feedback linkOblast.

GO : a systems programming language


Today I was searching for some useful script and just sighted a work "GO", and I clicked the link and found this:


GO: a systems programming language


Abstracts:
Go is an open source project, distributed under a BSD-style license. This document explains how to check out the sources, build them on your own machine, and run them.
There are two distinct ways to experiment with Go. This document focuses on the gc Go compiler and tools (6g, 8g etc.). For information on how to use gccgo, a more traditional compiler using the GCC back end, see Setting up and using gccgo.


Here is the original article :  Read More..




Is the above link useful to you? Let us know your feedback, it will help us to improve our posting(s). or You can send your feedback linkOblast.

Optimized Paging and Sorting in ASP.NET GridView


I was searching for the way to optimize the output on one my site.

Found the follwoing article quite useful for Optimization in Paging and Sorting.

Here are the abstracts of the article:

Paging and sorting are most commonly used features of ASP.NET GridView. And it is very easy to use/implement these features in GridView with small chunk of lines. In this article I am going to demonstrate what are the performance drawbacks of using conventional way to page and sort your GridView and then I will demonstrate 'An Optimized way to implement Paging and Sorting'.

What are conventional steps for Paging and Sorting?

Usually we perform the following steps to enable paging and sorting in our GridView.
1. Set AllowPaging and AllowSorting Properties of GridView to True to enable paging and sorting respectively e.g
1.<asp:GridView ID="GridView1" runat="server" AllowPaging="true" AllowSorting="true"  >
2. asp:GridView>
2. Set the PageSize property to mention how many records will be display on each page.
3. Set the SortExpression property of each column. By default each Data Bound columns has the bounded column name as default value for the SortExpression property.
4. Handle PageIndexChanging and Sorting Events of GridView to respond to paging and sorting actions respectively, like so:
01.<asp:GridView ID="GridView1" runat="server" AllowPaging="true"
02.            AllowSorting="true" onpageindexchanging="GridView1_PageIndexChanging"
03.            onsorting="GridView1_Sorting"  >
04.        asp:GridView>
05. protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
06.{
07.}
08.protected void GridView1_Sorting(object sender, GridViewSortEventArgs e)
09.{
10.}
5. Put some logic in the event handlers to do their jobs
5a. In the PageIndexChanging Event Handler method, we usually get the data from database or somewhere from the Cache and rebind our Grid with that data. After rebinding we change the PageIndex property of the GridView to a new page index to display the page that was selected by the user.
1.protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
2. {
3.     GridView1.DataSource = GetData(); // GetData() is a method that will get Data from Database/Cache/Session to display in Grid.
4.     GridView1.DataBind();
5.     GridView1.PageIndex = e.NewPageIndex;
6. }
5b. In the Sorting event handler method, we get the sorted data according to the sort expression from our data source (data source could be database/cache/session etc) and then rebind the Grid to display the sorted records.
And that's it.

Drawbacks

In conventional way of paging and sorting we get complete set of data instead of getting only the portion of data that is required to display on current/requested page. As you can see on each pageIndexChanging call we are getting all the data from our data source and then binding it to the GridView. Ideally we should get only the data that we need to display on the requested page.

Hmmm...Sounds good but HOW??

The question that may arise in your mind could be "It seems good in theory that we should only get the required data, but practically if we bind only one page of data with GridView then it would assume that this is the only data that it needs to display. So how does the GridView even display page numbers and total records count? It is a genuine question, so let's try to answer!

An Optimized Way to implement Paging and Sorting

As in the start of this article, we discuss the conventional 5 steps to implement paging and sorting in ASP.NET GridView . In this solution we will use the first 3 steps as described above, and perform the 4th and 5th steps by ourselves. We will use an ObjectDataSource that will perform these steps for us in an optimized way.

High Level Overview

We will optimize the code on both Database and Presentation layers.
At the Database Level we will write a stored procedure in such a way that it would return only one page of records. The stored procedure takes the page size, page index and a sort expression as input parameters and returns sorted records for a particular page index.
At the Presentation layer, we will use ObjectDataSource’s virtual paging feature to optimize the paging. Virtual paging is not a term defined by Microsoft. I used it by myself because ObjectDataSource exposes some properties and methods that allow us to bind only one page of data with GridView and to define the total number of records in database (not in one page), so that the GridView can extract out the total number of pages that need to be display in the page area of the GridView. In the next sections we will see what these properties and methods are, and how to use them.
If you are not familiar with ObjectDataSource then you should first read some articles on that. Here are some articles:

Implementation Details


Database Layer

We have an employee table in a database with the following schema:

And we wrote the following stored procedure that has two select statements. The first select statement will return the total number of employees in the Employee table and the second dynamic select statement will return the sorted records for one page according to the provided start index, page size, and sortby parameters.
01.Create PROCEDURE spGetAllEmployee
02.    (
03.    @startIndex     int,
04.    @pageSize       int,
05.    @sortBy     nvarchar(30),
06.    @totalEmployees int OUTPUT     
07.    )
08.AS
09.    SET NOCOUNT ON
10. DECLARE
11.    @sqlStatement nvarchar(max),   
12.    @upperBound int
13.  IF @startIndex  < 1 SET @startIndex = 1
14.  IF @pageSize < 1 SET @pageSize = 1
15.  SET @upperBound = @startIndex + @pageSize
16. Select @totalEmployees=Count(*) From Employee
17.  SET @sqlStatement = ' SELECT E.EmployeeID, E.EmployeeCode, E.Name, E.Department, E.Salary
18.                FROM (
19.                      SELECT  ROW_NUMBER() OVER(ORDER BY ' + @sortBy + ') AS rowNumber, *
20.                      FROM    Employee
21.                     ) AS E
22.                WHERE  rowNumber >= ' + CONVERT(varchar(9), @startIndex) + ' AND
23.                       rowNumber <  ' + CONVERT(varchar(9), @upperBound)
24.  exec (@sqlStatement)
One thing that I want to explain in the above stored procedure is the ROW_NUMBER() function that makes it possible for us to select only one page of data. The ROW_NUMBER() method is included in the 2005 release of TSQL. It actually adds an integer column in the selected record set, that contains the record number for each record . It seems very simple but in fact it's very helpful as we are going to perform nested quires. As we did in our stored procedure, in the nested query we select all employees records sorted by the provided sort expression, and add a row number for each record using the ROW_NUMBER() method. In the outer query we filter the result rows by using lower and upper bound indexes so that we return only the rows between lower and upper bounds.

Data Access layer

In the Data Access Layer we will write a class that will be responsible to call the spGetAllEmployee sorted procedure to get employee records and return the employee list to the business logic layer. To avoid increasing the complexity and length of the article I am only posting the code that is used to fetch the records from the database. I am not posting any helper code/classes; however the complete code is available for download.


 If you wanna read the original article just click here




Is the above link useful to you? Let us know your feedback, it will help us to improve our posting(s). or You can send your feedback linkOblast.

Google Closure Library


The Closure Library is a broad, well-tested, modular, and cross-browser JavaScript library. You can pull just what you need from a large set of reusable UI widgets and controls, and from lower-level utilities for DOM manipulation, server communication, animation, data structures, unit testing, rich-text editing, and more.

 To know more about Google Closure Libary and download the same as well click here


By

Google Voice

Abstracts:

We've just started to release a preview of Google Voice, an application that helps you better manage your voice communications. Google Voice will be available initially to existing users of GrandCentral, a service we acquired in July of 2007.

The new application improves the way you use your phone. You can get transcripts of your voicemail (see the video below) and archive and search all of the SMS text messages you send and receive. You can also use the service to make low-priced international calls and easily access Goog-411 directory assistance.


 Official Google Blog: Here comes Google Voice




For details click here

Is the above link useful to you? Let us know your feedback, it will help us to improve our posting(s). or You can send your feedback linkOblast.

SharePoint 2010 Feature: Sandboxed Solution

SharePoint 2010 introduces new feature called Sandboxed Solutions. These sandboxed solutions are nothing but .wsp packages which has limited access to resources and runs isolated alongside other processes. Sandboxed solutions will not be able to make updates beyond the scope of the current site. You are also limited in performing farm level and web application level changes.
But Why Sandboxed Solutions?
Today, in SharePoint Server 2007, solutions are deployed in the farm level though you can activate features per web application or site. There is no proper way you can centrally manage/administer these solutions in a shared environment per web application or site. With sandboxed solutions, administrators can now allocate quotas, monitor the usage and also prevent excessive usage of resources by the solution. But yes, you are limited in the functionality what the solution can access, but as long as the solution scope is not beyond the site level, it is always better to build sandboxed solutions.
Surprisingly, Sandboxed solutions are going to play a major role in Microsoft Online Services very soon :)
Building a Sandboxed Solution
Building a Sandboxed solution is as simple as building a normal SharePoint application (Web Part, User Control etc.,).
Refer the following MSDN Article to find out more about Sandboxed Solutions. From MSDN:
The following capabilities and elements are available in sandboxed solutions:
The following capabilities and elements are not available in sandboxed solutions:
  • Custom Action groups
  • HideCustomAction element
  • Content Type Binding
  • Web Application-scoped Features
  • Farm-scoped Features

Click here to read the original article by chakkaradeep


Is the above link useful to you? Let us know your feedback, it will help us to improve our posting(s). or You can send your feedback linkOblast.