All the posts from this blog have been moved to http://blog.teliaz.com.

All new posts will be published in my new blog from now on…
The main reason  is to be able to post live code and examples.

C u there!!!

PS: Comments will  still be answered …..


Windows 7 Features, Screenshots, Demo

Windows 7 Taskbar

Windows 7 System Tray


When you try to restore a database there are some very tricky stuff you need to know.

Continue reading ‘Restore Database MSSMS’


A list of widely used SQL settings Explained

  • ANSI NULLS
  • QUOTED_IDENTIFIER
  • ARITHMABORT
  • ANSI_DEFAULTS
  • ANSI_WARNINGS
  • DATEFIRST
  • DATEFORMAT
  • NOCOUNT
  • NOEXEC
  • IDENTITY_INSERT
  • IMPLICITY_TRANSACTIONS
  • LANGUAGE

ANSI NULLS
– Syntax

SET ANSI_NULLS {ON | OFF}

– Explanation

The SQL-92 standard requires that an equals (=) or not equal to (<>) comparison against a null value evaluates to FALSE. When SET ANSI_NULLS is ON, a SELECT statement using WHERE column_name = NULL returns zero rows even if there are null values in column_name. A SELECT statement using WHERE column_name <> NULL returns zero rows even if there are nonnull values in column_name.

When SET ANSI_NULLS is OFF, the Equals (=) and Not Equal To (<>) comparison operators do not follow the SQL-92 standard. A SELECT statement using WHERE column_name = NULL returns the rows with null values in column_name. A SELECT statement using WHERE column_name <> NULL returns the rows with nonnull values in the column.

Continue reading ‘T-SQL Settings Explained’


If you have an existing table (in my case products)
This is the code you ll use to Alter a column and Add Identity to it. This is the Only Solution found on the NET. Even SSIS Cant to this procedure automatically. I guess this is caused due to constrains bound to a table.

— ALTER COLUMN ID TO INT
ALTER TABLE [dbo].[Products]
ALTER COLUMN [Code] int NOT NULL;

GO

— RENAME THE TABLE TO A TEMP TABLE TO HOLD THE DATA (ANY DEPENDENCIES WILL BE LOST)
EXEC sp_rename ‘Products’, ‘ProductsTemp’
GO

–CREATE TABLE WITH IDENTITY
CREATE TABLE [dbo].[Products] (
[Code] INT IDENTITY PRIMARY KEY,
[Descr] nvarchar(250),
[Price] money,
)
GO

— SET IDENTITY INSERT ON
SET IDENTITY_INSERT [dbo].[Products] ON;
GO

— COPY DATA INTO NEW TABLE

INSERT INTO [dbo].[Products]
([CodeID]
,[Descr]
,[Price]
)

SELECT [CodeID]
,[Descr]
,[Price]
FROM [dbo].[ProductTemp]
GO

— DROP TEMP TABLE
DROP TABLE [ProductsTemp];
GO

— SET IDENTITY INSERT OFF
SET IDENTITY_INSERT [dbo].[Products] OFF;
GO

— Run DBCC to reset the identity value on the table
DBCC CHECKIDENT (Products, RESEED)
GO

— ** REMEMBER TO CHECK THE IDENTITY SEED OR ELSE
— FIND MAX CodeID AND Choose this DBCC CHECKIDENT (Products, RESEED, &lt;MaxIdFound&gt;)


One of the most impressive features in Google’s open source Chrome web browser is V8, a high-performance JavaScript virtual machine that was developed by a team of specialists in Denmark. Although Chrome’s performance beats the current stable version of Firefox, benchmarks show that Mozilla’s next-generation JavaScript engine actually outperforms V8.

Mozilla is using tracing optimization techniques and Adobe’s open source nanojit to increase the execution speed of SpiderMonkey, the JavaScript runtime engine in the Firefox web browser. The new engine, which is called TraceMonkey, delivers unprecedented JavaScript performance. The new optimizations have already landed in the latest Firefox nightly builds (but still have to be manually enabled) and will likely be included in Firefox 3.1.

Bellow as you can see are the SunSpider Javascript Results in FF, Chrome and IE7.
Continue reading ‘TraceMonkey and Javascript Engines Compared’


If you work with SQL Server on a regular basis, either writing custom queries, designing databases, or optimizing queries, this is a must see video as it covers a number of the enhancements to SQL Server 2008 including:

– SQL Management Studio improvements including IntelliSense
– New Data Types for just dates or times (no more storing time when you only need the date)
– New Hierarchical data support .IsDescendent(), that can automatically pull a hierarchical view of data (no more custom recursive queries)
– New Grouping Sets statement which enables you to automatically group dimensions in a query for easy aggregation and reporting
– New Merge statement which provides automatic insert/update semantics for keeping multiple data sources in sync
– New FileStream attribute that enables you to include files that are stored in the server file system, but can be managed by SQL Server
– New data types and support for Geodata and geometry
– New support for optimizing “empty” or row/column tables using the sparse keyword


Lets consider a simple table called employee( emp_id, name, salary). Now, suppose that we need to create a gridview with paging. One option is to bring all the data from database and do the paging in client-side and another one is to do selective fetch. In both cases we can use a stored procedure that takes some parameter and returns a resultset.

Let’s see the following…

CREATE PROCEDURE GetEmployees
@Status int,
@StartIndex int,
@PageSize int
AS

WITH FilteredList( [emp_id],[name], [salary], [RowNumber])
AS
(
SELECT
[emp_id],
[name],
[salary],
ROW_NUMBER() OVER ( ORDER BY [ID] DESC) AS [RowNumber]

FROM
Employee
)

SELECT
*
FROM
FilteredList
WHERE
RowNumber BETWEEN (@StartIndex + 1) AND (@StartIndex + @PageSize)


1.Open the SQL Server express management studio
2.Connect to SQL Server using windows authentication
3.Right click the server name and choose properties
4.Go to security tab. Change server authentication to “SQL Server and Windows Authentication mode”
5.Click OK and restart SQL Server
6.Go to SQL Server studio management express
7.Expand the server and choose security and expand logins
8.Right click on SA, from properties modify the password and confirm password

OR

To reset the sa password, you can make the following:
1. Login to the SQL Server box as the Administrator.
2. Run SQL Server Enterprise Manager.
3. Right-click the server name and choose ‘Edit SQL Server Registration properties’.
4. Choose ‘Use Windows authentication’ and click OK button.
5. Expand a server, expand a Security and click Logins.
6. Double-click the sa login and specify new password on the General tab. (enable Login to)

Or You Can Use

USE [master]
GO
ALTER LOGIN [sa] WITH DEFAULT_DATABASE=[master],
DEFAULT_LANGUAGE=[us_english], CHECK_EXPIRATION=ON, CHECK_POLICY=ON
GO
USE [master]
GO
ALTER LOGIN [sa] WITH PASSWORD=N'<insert_new_password_here>’ MUST_CHANGE
GO

or

From a command prompt
OSQL -S <insert_servername_here> -E
1> EXEC sp_password NULL, ‘<insert_new_password_here>’, ‘sa’
2> GO


Let’s say you have an image with no transparency.
This is a  technique i found to make photos transparent to a specific color.

In the following tut color was black.

You can follow these step to add the desired transparency
PHOTOSHOP NEEDED

Step no 1.
Make a copy of the image. Make it in grayscale. Play a little with the levels so you can do the grey areas whiter.
Make a brush with this image. (DEFINE BRUSH)

Step 2.
Take the original image with no transparency and add a layer mask.
Then use the brush you made in the first step.

Step 3.
Save image in psd or png format. You re Done!!!

These are the before and after images
Original Image

The image “with transparency” (added a random background there to see the result)

The cool thing using this technique is that you dont need to lasso or feather anything. All steps are a standard procedure. The only thing you must master is the leveling so that you can make the transparency to a desired level.