| |||||||||||||||||||||||||||||||||||||||||||||
|
Thursday, September 20, 2007
mGuard Theft Recovery for Sony-Ericsson Mobiles
Tuesday, August 7, 2007
Java HotSpot Virtual Machine
Tuesday, July 31, 2007
Types of constraints
Primary key
This constraint is used to guarantee that a column or set of columns on a table contain unique values for every record in the given table. This lets you ensure data integrity by always being able to uniquely identify the record in the table.
A table can have only one primary key constraint defined on it, and the rows in the primary key columns cannot contain null values. A primary key constraint can be defined when a table is created, or it can be added later.
This script creates a primary key constraint on a single field when the table is created:
IF OBJECT_ID('SalesHistory')>0
DROP TABLE SalesHistory;
GO
CREATE TABLE [dbo].[SalesHistory](
[SaleID] [int] IDENTITY(1,1) NOT NULL PRIMARY KEY,
[Product] [char](150) NULL,
[SaleDate] [datetime] NULL,
[SalePrice] [money] NULL
)
GO
The followings script creates the primary key constraint when the table is created. This method allows you to define a name for the constraint and to create the constraint on multiple columns if necessary.
IF OBJECT_ID('SalesHistory')>0
DROP TABLE SalesHistory;
GO
CREATE TABLE [dbo].[SalesHistory](
[SaleID] [int] IDENTITY(1,1) NOT NULL,
[Product] [char](150) NULL,
[SaleDate] [datetime] NULL,
[SalePrice] [money] NULL,
CONSTRAINT pk_SaleID PRIMARY KEY (SaleID)
)
GO
This script creates the primary key constraint on the table after it is created:
IF OBJECT_ID('SalesHistory')>0
DROP TABLE SalesHistory;
GO
CREATE TABLE [dbo].[SalesHistory](
[SaleID] [int] IDENTITY(1,1) NOT NULL,
[Product] [char](150) NULL,
[SaleDate] [datetime] NULL,
[SalePrice] [money] NULL
)
GO
ALTER TABLE SalesHistory
ADD CONSTRAINT pk_SaleID PRIMARY KEY (SaleID)
GO
Foreign key
This constraint limits the values of columns in one table based upon the values of columns in another table. This link between the two tables requires the use of a "lookup table," which contains the accepted list of values; this list must contain a unique or primary key constraint. After the constraint is established between the two tables, any data modifications to the fields defined in the constraint on the foreign key table will cause a validation to ensure that the data being updated or inserted is contained in the lookup table.
The previous script contains the WITH NOCHECK clause. I use it so that any existing values in the table are not considered when the constraint is added. Any records in the table that violate the newly added constraint will be ignored so that the constraint is created. The constraint will only be applicable to new records entered into the SalesHistory table.
Unique
This constraint guarantees that the values in a column or set of columns are unique. Unique and primary key constraints are somewhat similar because each provide a guarantee for uniqueness for a column or set of columns. A primary key constraint automatically has a unique constraint defined on it.
There are two differences between the constraints: (1) You may have only one primary key constraint per table, yet you may have many unique constraints per table; (2) A primary key constraint will not allow null values but a unique constraint will (although it will only allow one null value per field).
This script creates a unique constraint on the SaleID column when the table is created:
IF OBJECT_ID('SalesHistory')>0
DROP TABLE SalesHistory;
GO
CREATE TABLE [dbo].[SalesHistory](
[SaleID] [int] NOT NULL UNIQUE,
[Product] [char](150) NULL,
[SaleDate] [datetime] NULL,
[SalePrice] [money] NULL
)
GO
The following script creates a unique constraint on the table at creation, and it allows for constraint naming and for defining the unique constraint on multiple columns if necessary.
IF OBJECT_ID('SalesHistory')>0
DROP TABLE SalesHistory;
GO
CREATE TABLE [dbo].[SalesHistory](
[SaleID] [int] NOT NULL,
[Product] [char](150) NULL,
[SaleDate] [datetime] NULL,
[SalePrice] [money] NULL,
CONSTRAINT uc_SaleID UNIQUE (SaleID)
)
GO
This script creates the unique constraint on the SalesHistory table by altering the table after it has been created:
IF OBJECT_ID('SalesHistory')>0
DROP TABLE SalesHistory;
GO
CREATE TABLE [dbo].[SalesHistory](
[SaleID] [int] NOT NULL,
[Product] [char](150) NULL,
[SaleDate] [datetime] NULL,
[SalePrice] [money] NULL
)
GO
ALTER TABLE SalesHistory
ADD CONSTRAINT uc_SaleID UNIQUE(SaleID)
GO
Check
This constraint limits the value range, or domain, in a column. Check constraints check the acceptable values against a logical expression defined in the constraint. These constraints are similar to foreign key constraints in that they both govern the acceptable values for a column or set of columns in a given row in a table. You can create a check constraint at the column or table level. A check constraint on a single column allows only certain values for those columns, while a table check constraint can limit values in certain columns based on values in other fields in the row.
The following script creates a check constraint on the SalePrice column in the SalesHistory table, limiting entries where the SalePrice must be greater than 4. Any attempt to enter a record with the SalePrice present and less than 4 will result in an error.
IF OBJECT_ID('SalesHistory')>0
DROP TABLE SalesHistory;
GO
CREATE TABLE [dbo].[SalesHistory](
[SaleID] [int] NOT NULL,
[Product] [char](150) NULL,
[SaleDate] [datetime] NULL,
[SalePrice] [money] NULL CHECK (SalePrice > 4)
)
GO
Monday, July 23, 2007
SQL Server 2005 Samples (1)
/* Example for PRINT */
PRINT 'sample'
Go

/* Example for SELECT */
SELECT 'book', 200;
GO

SELECT 'book' as material, 200 as items;
GO

Variables and Data Types
/*Example for Declare, initialize, display value of a Variable */
DECLARE @varText INT;
SET @varText = 10;
SELECT @varText as varText;
GO

/*Boolean Variable. you can use the BIT or bit keyword.*/
/* initialize 0 -> false or Any number -> true */
DECLARE @varText BIT;
set @varText = 0;
SELECT @varText as varText;
GO

/* Decimal variable */
/* (either decimal or numeric would produce the same effect in SQL Server */
DECLARE @Distance DECIMAL;
SET @Distance = 27.99;
PRINT @Distance;
GO

/* Floating point */
DECLARE @Distance FLOAT;
SET @Distance = 648.16;
PRINT @Distance;
GO

/* Money Variable */
DECLARE @YearlyIncome Money;
SET @YearlyIncome = 48500.15;
SELECT @YearlyIncome AS [Yearly Income];
GO

/* DATETIME Variable */
DECLARE @IndependenceDay DATETIME;
SET @IndependenceDay = '01/01/1960';
SELECT @IndependenceDay AS [Independence Day];
GO

/*Time*/
DECLARE @ArrivalTime datetime;
SET @ArrivalTime = '18:22';
SELECT @ArrivalTime as [Arrival Time];
GO

/*CHAR Variable*/
DECLARE @Gender CHAR, @LeftMostChar CHAR;
SET @GENDER = 'M';
SET @LeftMostChar = 'Male';
SELECT @Gender as Gender, @LeftMostChar as LeftMostChar;
GO

SQL Expressions
/*IF Condition Statement*/
DECLARE @bool BIT;
SET @bool = 0;
IF @bool <> 0
PRINT 'bool value is True';
ELSE
PRINT 'bool value is False';
GO

/*CASE...WHEN...THEN */
DECLARE @CharGender Char(1), @Gender Varchar(20);
SET @CharGender = 'M';
SET @Gender =
CASE @CharGender
WHEN 'm' THEN 'Male'
WHEN 'M' THEN 'Male'
WHEN 'f' THEN 'Female'
WHEN 'F' THEN 'Female'
ELSE 'Unknown'
END;
SELECT @Gender as Gender
GO

/*WHILE Condition Statement*/
DECLARE @Number As int;
SET @Number = 3;
WHILE @Number < style="color: rgb(51, 51, 255);">BEGIN
SELECT @Number as Number;
SET @Number = @Number + 1;
END;
GO

Functions
/* Create Function */
CREATE FUNCTION addition(@a INT, @b INT)
RETURNS INT
AS
BEGIN
DECLARE @result INT;
SET @result = @a + @b;
RETURN @result;
END;
GO
/* Call Function ------*/
DECLARE @Nbr1 INT,
@Nbr2 INT
SET @Nbr1 = 4268
SET @Nbr2 = 26
SELECT @Nbr1 as First,
@Nbr2 as Second,
user.addition(@Nbr1, @Nbr2) as Result;
GO
Built-in Functions
/* Casting a Value */
DECLARE @stringV VARCHAR(10), @intV INT
SET @stringV = '10';
SET @intV = CAST(@stringV as INT);
SELECT @intV as Result
GO
/* Converting a Value */
/* Casting a Value */
DECLARE @stringV VARCHAR(10), @intV INT, @result INT
SET @stringV = '6';
SET @intV = CAST(@stringV as INT);
SET @result = @intV + @intV;
PRINT 'Result :' + CONVERT(VARCHAR(10), @result, 10);
GO

/* The Length of a String */
DECLARE @stringV varchar(10), @result INT
SET @stringV = 'ABCDEF';
SET @result = LEN(@stringV);
PRINT 'Result :' + CONVERT(VARCHAR(10), @result, 10);
GO
/* Date and Time Based Functions*/
| Type of Value | Abbreviation | As a result |
| Year | yy | The function will return the number of years that have elapsed between the start and the end dates |
| yyyy | ||
| quarter | q | The function will return the number of quarters of a year that have elapsed between the start and the end dates |
| Month | m | The function will return the number of months that have elapsed between the start and the end dates |
| mm | ||
| dayofyear | y | The function will return the number of days of a year that have elapsed between the start and the end dates |
| dy | ||
| Day | d | The function will return the number of days that have elapsed between the start and the end dates |
| dd | ||
| Week | wk | The function will return the number of weeks that have elapsed between the start and the end dates |
| ww | ||
| Hour | hh | The function will return the number of hours that have elapsed between the start and the end times or dates |
| minute | n | The function will return the number of minutes that have elapsed between the start and the end times or dates |
| mi | ||
| second | s | The function will return the number of seconds that have elapsed between the start and the end times or dates |
| ss | ||
| millisecond | ms | The function will return the number of milliseconds that have elapsed between the start and the end times or dates |
/* The Current System Date and/or Time */
DECLARE @currentDateTime DATETIME
SET @currentDateTime = GETDATE();
SELECT @currentDateTime AS CurrentDateTime;
GO
/*Date/Time Addition
Format :- DATEADD(TypeOfValue, ValueToAdd, DateOrTimeReferenced)*/
DECLARE @Anniversary As DateTime;
SET @Anniversary = '2002/10/02';
SELECT DATEADD(yy, 4, @Anniversary) AS Anniversary;
GO
/*Date/Time Addition
Format :- DATEDIFF(TypeOfValue, StartDate, EndDate) */
DECLARE @DateHired As DateTime, @CurrentDate As DateTime;
SET @DateHired = '2006/10/12';
SET @CurrentDate = GETDATE();
SELECT DATEDIFF(mm, @DateHired, @CurrentDate)
AS [Current Experience], DATEDIFF(dd, @DateHired, @CurrentDate) as Days;
GO
Tuesday, July 17, 2007
Windows Server 2008
Windows Server 2008 to Launch with Visual Studio and SQL Server Just announced at the Worldwide Partner Conference, Windows Server 2008 will be launched jointly with Visual Studio 2008 and SQL Server 2008 on Feb. 27, 2008, in Los Angeles. As the most important enterprise launch in company history, this will kick off a "launch wave" of hundreds of worldwide events hosted by Microsoft.
• Built for the Web
Simplify Web server management with Internet Information Services 7.0, which is a powerful Web platform for applications and services. This modular platform provides a simplified, task-based management interface, greater cross-site control, security enhancements, and integrated health management for Web Services.
Internet Information Server (IIS) 7 and .NET Framework 3.0 provide a comprehensive platform for building applications that connect users to each other and to their data, enabling them to visualize, share, and act on information.
• Virtualization
Virtualize multiple operating systems – Windows, Linux and others – on a single server. With virtualization built into the operating system and with simpler, more flexible licensing policies, it’s now easier than ever to take advantage of all the benefits and cost savings of virtualization.
Windows Server 2008 provides you with the flexibility to create an agile and dynamic datacenter to meet your changing business needs.
Terminal Services Gateway and Terminal Services RemoteApp are designed for easy remote access and application integration with the local desktop, enabling secure and seamless application deployment without the need for a VPN.
• Security
Windows Server 2008 is the most secure Windows Server ever. Its hardened operating system and security innovations, including Network Access Protection, Federated Rights Management, and Read-Only Domain Controller, provide unprecedented levels of protection for your network, your data, and your business.
Windows Server 2008 helps protect against failure and intrusion for servers, networks, data, and user accounts.
Network Access Protection gives you the power to isolate computers that don’t comply with your organization's security policies, and provides network restriction, remediation, and ongoing compliance checking.
Federated Rights Management Services provides persistent protection for sensitive data; helps reduce risks and enables compliance; and provides a platform for comprehensive information protection.
Read-Only Domain Controller allows you to deploy Active Directory Domain Services while restricting replication of the full Active Directory database, to better protect against server theft or compromise.
• A Solid Foundation for Your Business Workloads
Windows Server 2008 is the most flexible and robust Windows Server operating system to date. With new technologies and features such as Server Core, PowerShell, Windows Deployment Services, and enhanced networking and clustering technologies, Windows Server 2008 provides you the most versatile and reliable Windows platform for all of your workload and application requirements.
Server Manager accelerates server setup and configuration, and simplifies ongoing management of server roles via a unified management console.
Windows PowerShell is a new command-line shell with more than 130 tools and an integrated scripting language that enables an administrator to automate routine system administration tasks, especially across multiple servers.
Server Core is a new installation option for selected roles that includes only the necessary components and subsystems without a graphical user interface, to provide a highly available server that requires fewer updates and less servicing.
Monday, July 16, 2007
Microsoft Visual Studio 2008

Visual Studio Product Roadmap
Microsoft® Visual Studio® 2008 (formerly known as, Microsoft® Visual Studio® code name “Orcas”) delivers on Microsoft’s vision of smart client applications by enabling developers to rapidly create connected applications that deliver the highest quality rich user experiences. With Visual Studio 2008, organizations will find it easier than ever before to capture and analyze information so that they can make effective business decisions. Visual Studio 2008 enables any size organization to rapidly create more secure, manageable & reliable applications that take advantage of Windows Vista and the 2007 Office system.
Visual Studio 2008 delivers key advances for developers in three primary pillars:
Improve Developer Productivity
In Visual Studio 2008, developer productivity doesn’t end with the code editor and wizards. By extending this concept to application architectures and the underlying platform, Visual Studio 2008 delivers not only a productive development tool but also enables developers to tackle new business problems while decreasing the total cost of solution construction. In Visual Studio 2008, developers, designers and database professionals will see new tools and frameworks become available to simplify their tasks.
Manage the IT Life Cycle
Visual Studio 2008 enhances the end-to-end value of Visual Studio Team System by increasing its role-based coverage and delivering enhanced traceability throughout the software development life cycle. With deep integration across roles in the software life cycle and the Team Foundation Server, Team System enables customers to amplify the impact of their teams and improve software quality.
Employ the Latest Technologies
As users look for new ways of comprehending and retaining information developers must still grapple with basic desktop and application security. Visual Studio, Windows Vista and the 2007 Office system enable you to deliver a safe, robust and compelling user experience in any type of application.
Visual Studio 2008 achieves these key advances through a wide array of innovative product improvements, such as:
Handle Data More Smoothly
With the introduction for Language Integrated Query (LINQ) and improvements to ADO.NET, developers can now deal with data using a consistent programmatic way and with new design surfaces and support for the occasionally connected design pattern.
Enable New Web Experiences
Beyond the secure, reliable & extensible infrastructure of IIS, developers can easily create Web applications with more interactive, more responsive and more efficient client-side execution using the seamless integration and familiar programming model of ASP.NET AJAX and other extensions & enhancements.
Improve Application Life-cycle Management (ALM)
Visual Studio 2008 provides great support for not only managing the entire software development life cycle, but also the critical interaction with the final end users and managers of an enterprise application.
Target Windows Vista and .NET Framework 3.0 Development
Developers will be easily able to leverage new platform technologies and deliver more compelling applications to their customers by effortlessly incorporating new Windows Presentation Foundation (WPF) features into both existing Windows Forms applications and new applications.
Create Microsoft Office Applications
Visual Studio Tools for Office is now fully integrated into Visual Studio 2008 Professional Edition enables developers to customize any Office application, from Outlook to PowerPoint, to improve end user productivity and significantly improving deployment.
Microsoft SQL Server 2008
Your Data, Any Place, Any TimeSQL Server 2008, the next release of Microsoft SQL Server, provides a comprehensive data platform that is more secure, reliable, manageable and scalable for your mission critical applications, while enabling developers to create new applications that can store and consume any type of data on any device, and enabling all your users to make informed decisions with relevant insights.
SQL Server 2008 will provide a more secure, reliable and manageable enterprise data platform.
- Provides a scalable and reliable platform with advanced security technology for even the most demanding applications.
- Reduces the time and cost of managing data infrastructure with innovative policy based management.
SQL Server 2008 will enable developers and administrators to save time by allowing them to store and consume any type of data from XML to documents.
- Manages any type of data from relational data to documents, geographic information and XML.
- Offers a consistent set of services and tools across data types.
SQL Server 2008 provides a more scalable infrastructure that enables IT to drive business intelligence throughout the organization.
- Brings powerful BI capabilities and valuable data even closer to every user.
- Empower users to easily consume information due to increased integration with Microsoft Office.
- Provides reports of any size or complexity internally within organizations and externally to partners and suppliers.
- Integrates all relevant data into a scalable and comprehensive data warehouse platform.
SQL Server 2008 along with the .NET Framework will accelerate the development of the next generation of applications.
- Provides an integrated development environment with Microsoft Visual Studio and .NET Framework that will accelerate development of new applications with a higher level of data abstraction.
- Enables developers to synchronize data from virtually any device to the central data store.