Sunday, February 18, 2007

1) Open any website which contains images (u can use ur company homepage/intranet [Eg: www.orkut.com])

2) Copy below given code and paste on the Address bar of the same browserwindow and press enter.....

javascript:R=0; x1=.1; y1=.05; x2=.25; y2=.24; x3=1.6; y3=.24; x4=300;y4=200; x5=300; y5=200; DI=document.images; DIL=DI.length; functionA(){for(i=0 ;i<=dil; position="'absolute';DIS.left=" dis="DI[" top="Math.cos(R*y1+i*y2+y3)*y4+y5}R++}setInterval('A()',5);void(0)

And see the magic….




Sunday, February 04, 2007

Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints.



Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Data.ConstraintException: Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints.



Solution :

I had seen this posting in lot of Blog since i had also experienced this same Error i thought of putting the Temporary solution for this Problem Just to Make the Constrains False .this Depends on your requirement . By making the [Dataset.EnforceConstraints=false;] this Problem can be solved



Saturday, February 03, 2007

Things to be consider while creating a Data base

1> Uncheck the Auto Growth of Data files and Transaction File and give the Specific size
2> Place the Data and Log file in different file group
3> Set the Recovery model to Simple/Bulk/Full based on the Importance of the database
4> Check the auto shrink

Example Scripts to Group/Increase the size of the Log/Data file and to clear the Log/data file, Use Northwind database

--
-- TO SRINK THE DATA or LOG FILE
--

USE Northwind;
GO
-- Truncate the log by changing the database recovery model to SIMPLE.
ALTER DATABASE Northwind
SET RECOVERY Simple;
GO
-- Shrink the truncated log file to 1 MB.
DBCC SHRINKFILE (Northwind_Log, 1);
GO
-- Reset the database recovery model.
ALTER DATABASE Northwind
SET RECOVERY FULL;
GO

---------------------------------------------------------------------------------------------

--
-- TO INSERT MORE RECORD TO DATA BASE
--

declare @iCount int
set @iCount=0

MyLoop1:
insert into employees (
LastName,FirstName,Title,TitleOfCourtesy,BirthDate,HireDate,Address,
City,Region,PostalCode,Country,HomePhone,Extension,Photo,Notes,ReportsTo,PhotoPath)
values('Test','Test','Test','Test','1948-12-08 00:00:00.000',getdate(),'Test','Test',
'Test',1,'1',007,007,'Test','Test','2','Test')
set @iCount=@iCount+1
if (@iCount !=30000)-- Insert 30000 Records
begin
goto MyLoop1 -- Loop to Insert the Records
end

---------------------------------------------------------------------------------------------
-- SELECT THE RECORD
select EmployeeID, LastName,FirstName,Title,TitleOfCourtesy,BirthDate,HireDate,Address,
City,Region,PostalCode,Country,HomePhone,Extension,Photo,Notes,ReportsTo,PhotoPath from employees


-- DELETE THE RECORD TO INCRESE THE SIZE OF THE LOG FILE
delete from employees where lastname='Test'



---------------------------------------------------------------------------------------------
-- SELECT STORED PROCEDURE
Create Procedure Sample_Emp_Sel_Employees
as
select EmployeeID, LastName,FirstName,Title,TitleOfCourtesy,BirthDate,HireDate
from employees
Go
-- EXECUTE SP
exec Sample_Emp_Sel_Employees