All posts by worthposting

T-SQL Settings Explained

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

TraceMonkey and Javascript Engines Compared

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, IE8.
Continue reading TraceMonkey and Javascript Engines Compared

Sql Server 2008 – New Features

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

Powerfull Paging with Stored Procedure

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)

SQL SERVER – Reset sa Password

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’’ MUST_CHANGE
GO

or

From a command prompt

OSQL -S -E
EXEC sp_password NULL, ‘’, ’sa’
GO

Photoshop add transparency technique

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.

Meta Tags Explained

Recommended META-Tags
Meta Content Language (non-US English ONLY)
Meta Content Type
Meta Description
Meta Language (non-US English ONLY)

Optional META-Tags
Meta Abstract
Meta Author
Meta Copyright
Meta Designer
Meta Google
Meta Keywords
Meta MSN (No ODP)
Meta Title

.

.

.

.

.

.

Dont confuse meta with those cute html tags….

Not Recommended META – Tags
Meta Content Script Type
Meta Content Style Type
Meta Distribution
Meta Expires
Meta Generator
Meta MS Smart Tags
Meta Pragma No-Cache
Meta Publisher
Meta Rating
Meta Refresh
Meta Reply-To
Meta Resource Type
Meta Revisit After
Meta Robots
Meta Set Cookie
Meta Subject
Meta VW96.ObjectType

.

Continue reading Meta Tags Explained