Tuesday, December 5, 2017

How to reload page every 5 second?

<meta http-equiv="refresh" content="5; URL=http://www.example.com/home.html">

If it has to be in the script use setTimeout like:

setTimeout(function(){
   window.location.reload(1);
}, 5000);

Sunday, November 5, 2017

Differences Between SQL Server Temporary Tables and Table Variables



What are Temporary Tables in SQL Server?

Temporary Tables are tables that are temporarily created for a particular session. Once the session is terminated, the temporary tables are automatically deleted. In other words, these are the physical tables, which are created in tempdb database in SQL Server.

What are Table Variables in SQL Server?

Table variables are laid out like tables. They are partially stored both in the memory and in the disk.

Array Of Differences Between Temp tables and Table Variables in SQL Server

In this section, we have listed the major differences between Temporary Tables and Table Variables. They are

1. Syntax

The syntax for creating Temporary Table and Table Variable differs largely.

How to Create Temporary Table in SQL Server?

-- Create Temporary Table

CREATE TABLE #Student

(Id INT, Name VARCHAR(50))

--Insert Two records

INSERT INTO #Student

VALUES(1,'Name1')

INSERT INTO #Student

VALUES(2,'Name2')

--Retrieve the records

SELECT * FROM #Student

--DROP Temporary Table

DROP TABLE #Student

GO

How to Create Table Variable in SQL Server?

-- Create Table Variable

DECLARE @Student TABLE

(

 Id INT,

 Name VARCHAR(50) 

)

--Insert Two records

INSERT INTO @Student

VALUES(1,'Name1')

INSERT INTO @Student

VALUES(2,'Name2')

--Retrieve the records

SELECT* FROM @Student

GO

2. Types of Temporary Table in SQL Server

There are mainly two types of Temporary Tables-Local & Global Temporary Tables.

Local Temporary Table: These tables are only available for the session that has created them. Once the session is terminated, these tables are automatically deleted. They can be also be deleted explicitly.
Global Temporary Table: These tables are available for all the sessions and users. They are not deleted until the last session using them is terminated. Similar to local Temporary Table, a user can delete them explicitly.
Table Variable

They can be declared in batch or stored procedure. Unlike Temporary Tables, they cannot be dropped explicitly. Once the batch execution is finished, the Table Variables are dropped automatically.

3. Storage Location of a Temporary Table

The Temporary Tables are stored in tempdb database of SQL server.

Table Variable

The Table Variables are stored in both the memory and the disk in the tempdb database.

4. Structure Modification

Temporary Table

The structure of Temporary Tables can be created even after its creation. Thus, we can use DDL statements like ALTER, DROP and CREATE as shown in the below-mentioned example. In the example we have created a Temporary Table named as Student. In this we will add an Address column and then finally drop the table.

--Create Temporary Table

  CREATE TABLE #Student

  (Id INT, Name VARCHAR(50))

  GO

  --Add Address Column

  ALTER TABLE #Student

  ADD Address VARCHAR(400)

  GO

  --DROP Temporary Table

  DROP TABLE #Student

  GO

Table Variable

The structure of Table Variables cannot be changed once they are created. Thus, it means that DDL commands cannot be run in Table Variables.

5. User Defined Functions

Temporary Table

They are not allowed in the user-defined functions.

Table Variable

The table variables can be used in user-defined functions.

6. Transactions

Temporary Table

They support the explicit transactions that are defined by the user.

Table Variable

They do not participate in the transactions that have been explicitly defined by the user.

7. Indexes

Temporary Table

Local and Global Temporary Tables support creation of indexes on them in order to increase the performance.

Table Variable

Table Variables do not allow creation of indexes on them.

8. Locking

Temporary Tables

Since the Temporary Tables are physical tables, while reading from the table, SQL Optimizer puts a read lock on the table.

Table Variable

Since the Table Variables are partially stored in the memory, they cannot be accessed by any other user or process that the current user. Therefore, no read lock is put on the Table Variable.

Tuesday, August 22, 2017

To Add a New Column to an Existing Table in Entity Framework

The "Update Model from Database" is hard/slow to use . It generates other stuff that you probably don't want/need. So manually adding the column that you need will work better. I suggest you do it outside the VS editor since depending on how many models/tables, it can be very slow opening the file in VS.

1. So in Windows Exlorer,right click on the *.edmx file and open with XML (Text) Editor.

 2. Search for the text <EntityType Name="YourTableNameToAddColumn">.

 3. Add the property <Property Name="YourNewColumnName" Type="varchar" MaxLength="50" />

 4. Search for the text <MappingFragment StoreEntitySet="YourTableNameToAddColumn">

 5. Add mapping to the new column <ScalarProperty Name="YourNewColumnName" ColumnName="YourNewColumnName"/>

 6. Save the *.edmx file.

Syntax:

1.Search for the text <EntityType Name="YourTableNameToAddColumn">.

2.Add the property <Property Name="LastName" Type="varchar" MaxLength="50" Nullable="false" />
<EntityType Name="tblUsers">
          <Key>
            <PropertyRef Name="UserID_pk" />
          </Key>
          <Property Name="UserID_pk" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
          <Property Name="FirstName" Type="varchar" MaxLength="50" Nullable="false" />
          <Property Name="MiddleName" Type="varchar" MaxLength="50" />
          <Property Name="LastName" Type="varchar" MaxLength="50" Nullable="false" />        
        </EntityType>

    <EntityType Name="tblUser">
          <Key>
            <PropertyRef Name="UserID_pk" />
          </Key>
          <Property Name="UserID_pk" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
          <Property Name="FirstName" Type="String" Nullable="false" MaxLength="50" FixedLength="false" Unicode="false" />
          <Property Name="MiddleName" Type="String" MaxLength="50" FixedLength="false" Unicode="false" />
          <Property Name="LastName" Type="String" Nullable="false" MaxLength="50" FixedLength="false" Unicode="false" />      
        </EntityType>

3.Search for the text <MappingFragment StoreEntitySet="YourTableNameToAddColumn">
4.Add mapping to the new column <ScalarProperty Name="YourNewColumnName" ColumnName="YourNewColumnName"/>

    <EntitySetMapping Name="tblUsers">
            <EntityTypeMapping TypeName="YourModel.tblUser">
              <MappingFragment StoreEntitySet="tblUsers">              
                <ScalarProperty Name="LastName" ColumnName="LastName" />
                <ScalarProperty Name="MiddleName" ColumnName="MiddleName" />
                <ScalarProperty Name="FirstName" ColumnName="FirstName" />
                <ScalarProperty Name="UserID_pk" ColumnName="UserID_pk" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
 6. Save the *.edmx file

Wednesday, August 2, 2017

How to execute a Stored Procedure with EF Code First

Here is class structure and procedures.

public class Books_Result
    {
        public int BookId{ get; set; }    
        public string BookName{ get; set; }
        public string AuthorName{ get; set; }
        public decimal BookRate{ get; set; }    
        public string Description{ get; set; }
        public bool Active{ get; set; }
    }


CREATE PROCEDURE YourStoredProcedureName
 @SortBy VARCHAR(5000) ,
        @FilterBy VARCHAR(5000) ,
          @BookName VARCHAR(5000)
        @TotalRecords INT OUT ,  
        @TotalDisplayRecords INT OUT
AS
BEGIN

  SET @TotalRecords = 0
  SET @TotalDisplayRecords = 0

DECLARE @sqlQuery  AS NVARCHAR(MAX)

set @sqlQuery  =N'SELECT BookId,BookName,AuthorName,BookRate,Description FROM [Books]
WHERE BookName= @BookName

set @TotalDisplayOutputRecords=( SELECT COUNT(*)  [Books]
WHERE BookName= @BookName  )
'
EXECUTE sp_executesql @sqlQuery,
   N'@TotalDisplayOutputRecords INT OUT',  
   @TotalDisplayOutputRecords = @TotalDisplayRecords OUT  
 
 SET @TotalRecords = @TotalDisplayRecords

END

This method will return an DbRawSqlQuery, which you can enumerate using For / ForEach loop. For executing procedure with output parameter.
             DataTable dt = new DataTable();
          using (var Entities = new YourEntities())
            {
                var TotalRecords = new ObjectParameter("TotalRecords", typeof(int));
                var TotalDisplayRecords = new ObjectParameter("TotalDisplayRecords", typeof(int));
                System.Data.SqlClient.SqlParameter[] param = new               System.Data.SqlClient.SqlParameter[5];
                param[0] = new System.Data.SqlClient.SqlParameter();
                param[0].ParameterName = "@SortBy";
                param[0].Size = 5000;
                param[0].SqlDbType = SqlDbType.VarChar;
                param[0].Value = "BookId asc";

                param[1] = new System.Data.SqlClient.SqlParameter();
                param[1].ParameterName = "@FilterBy";
                param[1].Size = 5000;
                param[1].SqlDbType = SqlDbType.VarChar;
                param[1].Value = "";

                param[2] = new System.Data.SqlClient.SqlParameter();
                param[2].ParameterName = "@BookName";
                param[2].Size = 5000;
                param[2].SqlDbType = SqlDbType.VarChar;
                param[2].Value = "Entity Framework";
             
                param[3] = new System.Data.SqlClient.SqlParameter();
                param[3].ParameterName = "@TotalRecords";
                param[3].SqlDbType = SqlDbType.Int;
                param[3].Value = DBNull.Value;

                param[3].Direction = ParameterDirection.InputOutput;

                param[4] = new System.Data.SqlClient.SqlParameter();
                param[4].ParameterName = "@TotalDisplayRecords";
                param[4].SqlDbType = SqlDbType.Int;
                param[4].Value = DBNull.Value;

                param[4].Direction = ParameterDirection.InputOutput;

                var  BookCollectionList= Entities.ExecuteStoreQuery<Books_Result>      ("YourStoredProcedureName @SortBy, @FilterBy, @BookName,  @TotalRecords out , @TotalDisplayRecords out", param).ToList();
                dt = BookCollectionList.ToDataTable();
                TotalRecords = Convert.ToInt32(param[3].Value);
                TotalDisplayRecords = Convert.ToInt32(param[4].Value);
            }

Tuesday, August 1, 2017

Script to generate DROP/ADD queries for Foreign Keys, Primary Keys and Default constraints of a DB/Table


Script to generate DROP/ADD queries for Foreign Keys, Primary Keys and Default constraints of a DB/Table

Foreign keys
The foreign key constraint query basically bears details of the constraint_name, parent table name, child table name and the participating columns. In addition one key aspect is to script out the constraint with respect to the is_trusted and is_enabled status flags as they decide the key feature as to whether the constraint is active or not.
These info can be obtained from the following system tables:

sysforeignkeys
syscolumns
Drop Foreign Key

The drop foreign key query can be generated quite simply with the help of constraint name and the parent/child table names.

---------------------------------------------
--ALTER TABLE DROP FOREIGN CONSTRAINT Queries
---------------------------------------------
SELECT DISTINCT
 'ALTER TABLE '+QUOTENAME(OBJECT_SCHEMA_NAME(fkeyid))+'.'+QUOTENAME(OBJECT_NAME(fkeyid))+
' DROP CONSTRAINT '+QUOTENAME(OBJECT_NAME(constid))
AS Drop_Foreign_Key_Constraint_Query
FROM sys.sysforeignkeys sfk
/*Include below statement for generating queries for a particular table*/
--WHERE fkeyid=OBJECT_ID('table_name')


Add Foreign key

The ADD FOREIGN KEY query can be generated by coupling the sysconstraints system table with the syscolumns table to get the parent/children table names and the corresponding column names.

------------------------------------------------
--ALTER TABLE CREATE FOREIGN CONSTRAINT Queries
------------------------------------------------

--Obtaining the necessary info from the sys tables
SELECT
 constid,QUOTENAME(OBJECT_NAME(constid)) as constraint_name
,CASE WHEN fk.is_not_trusted=1 THEN 'WITH NOCHECK' ELSE 'WITH CHECK' END as trusted_status
,QUOTENAME(OBJECT_SCHEMA_NAME(fkeyid))+'.'+QUOTENAME(OBJECT_NAME(fkeyid)) AS fk_table,QUOTENAME(c1.name) AS fk_col
,QUOTENAME(OBJECT_SCHEMA_NAME(rkeyid))+'.'+QUOTENAME(OBJECT_NAME(rkeyid)) AS rk_table,QUOTENAME(c2.name) AS rk_col
,CASE WHEN fk.delete_referential_action=1 AND fk.delete_referential_action_desc='CASCADE' THEN 'ON DELETE CASCADE ' ELSE '' END AS delete_cascade
,CASE WHEN fk.update_referential_action=1 AND fk.update_referential_action_desc='CASCADE' THEN 'ON UPDATE CASCADE ' ELSE '' END AS update_cascade
,CASE WHEN fk.is_disabled=1 THEN 'NOCHECK' ELSE 'CHECK' END AS check_status
--,sysfk.*,fk.*
INTO #temp_fk
FROM sys.sysforeignkeys sysfk
INNER JOIN sys.foreign_keys fk ON sysfk.constid=fk.object_id
INNER JOIN sys.columns c1 ON sysfk.fkeyid=c1.object_id and sysfk.fkey=c1.column_id
INNER JOIN sys.columns c2 ON sysfk.rkeyid=c2.object_id and sysfk.rkey=c2.column_id
/*Include below statement for generating queries for a particular table*/
--WHERE fkeyid=OBJECT_ID('table_name')
ORDER BY constid,sysfk.keyno

--building the column list for foreign/primary key tables
;WITH cte
AS
(
SELECT DISTINCT
constraint_name,trusted_status
,fk_table
,SUBSTRING((SELECT ','+fk_col FROM #temp_fk WHERE constid=c.constid FOR XML PATH('')),2,99999) AS fk_col_list
,rk_table
,SUBSTRING((SELECT ','+rk_col FROM #temp_fk WHERE constid=c.constid FOR XML PATH('')),2,99999) AS rk_col_list
,check_status
,delete_cascade,update_cascade
FROM
#temp_fk c
)
--forming the ADD CONSTRAINT query
SELECT
'ALTER TABLE '+fk_table
+' '+trusted_status
+' ADD CONSTRAINT '+constraint_name
+' FOREIGN KEY('+fk_col_list+') REFERENCES '
+rk_table+'('+rk_col_list+')'
+' '+delete_cascade+update_cascade+';'
+' ALTER TABLE '+fk_table+' '+check_status+' CONSTRAINT '+constraint_name
AS Add_Foreign_Key_Constraint_Query
FROM cte

--dropping the temp tables
DROP TABLE #temp_fk


Primary Keys

One can obtain the basic info of the primary keys existing int the database from sys.sysconstraints and sys.key_constraints. These tables give us a fair idea on the base table name, the constraint name and the columns upon which these act upon. Though these details form the crux of a primary key constraint, info such as index type being used with the primary key, the order of columns and the current status of the constraint are also equally important.

These info can be obtained using other system and information_schema tables such as:

    information_schema.key_column_usage
    sys.indexes
    sys.index_columns and the like..
So having had the base tables, it only requires to pair them up with the right set of joins using the key columns and correct usage of column data to frame the query.

Drop Primary key

A primary key of a table can be dropped only when there parent any dependent foreign key constraints on it. This action of dropping of  foreign keys can be achieved using the script given in the previous section.

It requires just the name of the constraint and the base table name to frame the query for dropping of a primary key. Having obtained them from sys.key_constraints, the query can be designed as follows:

-------------------------------------------------
--ALTER TABLE DROP PRIMARY KEY CONSTRAINT Queries
-------------------------------------------------
SELECT DISTINCT
'ALTER TABLE '+QUOTENAME(OBJECT_SCHEMA_NAME(parent_object_id))+'.'+QUOTENAME(OBJECT_NAME(parent_object_id))+' DROP CONSTRAINT '+QUOTENAME(name)
AS Drop_Primary_Key_Constraint_Query
FROM sys.key_constraints skc
WHERE type='PK'
/*Include below statement for generating queries for a particular table*/
--AND parent_object_id=object_id('table_name')

Add Primary key

Creation of primary keys as an "ALTER TABLE tbl_name ADD CONSTRAINT constr_name .." syntax requires more details than seen above. With the usage of other system tables we can obtain the necessary details and script the query as follows:

---------------------------------------------------
--ALTER TABLE CREATE PRIMARY KEY CONSTRAINT Queries
---------------------------------------------------
SELECT
 QUOTENAME(OBJECT_SCHEMA_NAME(parent_object_id))+'.'+QUOTENAME(OBJECT_NAME(parent_object_id)) AS pk_table--PK table name
,skc.object_id AS constid
,QUOTENAME(skc.name) AS constraint_name--PK name
,QUOTENAME(iskcu.column_name) + CASE WHEN sic.is_descending_key=1 THEN ' DESC' ELSE ' ASC' END  AS pk_col
,iskcu.ordinal_position
,CASE WHEN unique_index_id=1 THEN 'UNIQUE' ELSE '' END as index_unique_type
,si.name AS index_name
,si.type_desc AS index_type
,QUOTENAME(fg.name) AS filegroup_name
,'WITH('
+' PAD_INDEX = '+CASE WHEN si.is_padded=0 THEN 'OFF' ELSE 'ON' END +','
+' IGNORE_DUP_KEY = '+CASE WHEN si.ignore_dup_key=0 THEN 'OFF' ELSE 'ON' END +','
+' ALLOW_ROW_LOCKS = '+CASE WHEN si.allow_row_locks=0 THEN 'OFF' ELSE 'ON' END +','
+' ALLOW_PAGE_LOCKS = '+CASE WHEN si.allow_page_locks=0 THEN 'OFF' ELSE 'ON' END
+')' AS index_property
--,*
INTO #temp_pk
FROM sys.key_constraints skc
INNER JOIN information_schema.key_column_usage iskcu ON skc.name=iskcu.constraint_name
INNER JOIN sys.indexes si ON si.object_id=skc.parent_object_id and si.is_primary_key=1
INNER JOIN sys.index_columns sic ON si.object_id=sic.object_id and si.index_id=sic.index_id
INNER JOIN sys.columns c ON sic.object_id=c.object_id AND sic.column_id=c.column_id
INNER JOIN sys.filegroups fg ON si.data_space_id=fg.data_space_id
WHERE
skc.type='PK'
AND iskcu.column_name=c.name
/*Include below statement for generating queries for a particular table*/
--AND skc.parent_object_id= object_id('table_name')
ORDER BY skc.parent_object_id,skc.name,ordinal_position

;WITH cte
AS
(
SELECT
pk_table
,constraint_name
,index_type
,SUBSTRING((SELECT ','+pk_col FROM #temp_pk WHERE constid=t.constid FOR XML PATH('')),2,99999) AS pk_col_list
,index_unique_type
,filegroup_name
,index_property
FROM #temp_pk t
)
--forming the ADD CONSTRAINT query
SELECT DISTINCT
'ALTER TABLE '+pk_table
+' ADD CONSTRAINT '+constraint_name
+' PRIMARY KEY '+CAST(index_type COLLATE database_default AS VARCHAR(100))
+' ('+pk_col_list+')'
+index_property
+' ON '+filegroup_name+''
AS Create_Primary_Key_Constraint_Query
FROM cte

--dropping the temp tables
DROP TABLE #temp_pk


Default Constraints
Default constraints on a column allows for automatic population of data in the absence of user supplied values. These can be created during the table creation itself or by means of an ALTER TABLE statement as well.

Drop Default Constraint

The default constraint existing on a column of a table can be dropped with the knowledge of the table name and the corresponding default constraint name. The following script generates these DROP CONSTRAINT statements using info from sys.default_constraints table.

/*****************************************DEFAULT CONSTRAINT****************************************************/

---------------------------------------------
--ALTER TABLE DROP DEFAULT CONSTRAINT Queries
---------------------------------------------
SELECT
'ALTER TABLE '+QUOTENAME(OBJECT_SCHEMA_NAME(parent_object_id))+'.'+QUOTENAME(object_name(parent_object_id))
+' DROP CONSTRAINT '+QUOTENAME(sdc.name)+''
AS Drop_Default_Constraint_Query
FROM sys.default_constraints sdc
/*Include below statement for generating queries for a particular table*/
--WHERE parent_object_id=object_id('table_name')


Add Default Constraint

The ADD CONSTRAINT query can be generated by using the default definition and other columns of the sys.default_constraints system table as follows:
---------------------------------------------
--ALTER TABLE CREATE DEFAULT CONSTRAINT Queries
---------------------------------------------
select
'ALTER TABLE '+QUOTENAME(OBJECT_SCHEMA_NAME(parent_object_id))+'.'+QUOTENAME(OBJECT_NAME(parent_object_id))
+' ADD CONSTRAINT '+QUOTENAME(sdc.name)+' DEFAULT '+definition+' FOR '+QUOTENAME(c.name)+''
AS Add_Default_Constraint_Query
FROM sys.default_constraints sdc
inner join sys.columns c ON sdc.parent_object_id=c.object_id and sdc.parent_column_id=c.column_id
/*Include below statement for generating queries for a particular table*/
--WHERE parent_object_id=object_id('table_name')

Tuesday, August 13, 2013

Top 25 Motto's

சிறந்த 25 பொன்மொழிகள்!
1. அதிகம் பேசாதவனை உலகம் அதிகம் விரும்புகிறது. அளந்து பேசுபவனை அதிகம் மதிக்கிறது. அதிகம் செயல்படுபவனையே கைகூப்பித் தொழுகிறது.

 2. கற்ற அறிவையும், பெற்ற செல்வத்தையும் இறுதிக் காலம் வரை மற்றவர்களுக்காகச் செலவிடுங்கள்.

3. ந‌ம்மு‌ட‌ன் வா‌ழ்வோரை‌ப் பு‌ரி‌ந்து கொ‌ள்வத‌ற்கு ந‌ம்மை முத‌லி‌ல் பு‌ரி‌ந்து கொ‌ள்ள வே‌ண்டு‌ம். 
  
4. ந‌ம்‌பி‌க்கை குறையு‌ம் போது ஒ‌வ்வொரு ம‌னிதனு‌ம் நெ‌றிய‌ற்ற கொ‌ள்கையை மே‌ற்கொ‌ள்‌கிறா‌ன்.

5. சலித்துக் கொள்பவன் ஒவ்வொரு வாய்ப்பிலும் உள்ள ஆபத்தைப் பார்க்கிறான். சாதிப்பவன் ஒவ்வொரு ஆபத்திலும் உள்ள வாய்ப்பினைப் பார்க்கிறான்.

6. ம‌கி‌ழ்‌ச்‌சி எ‌ன்ற உண‌ர்‌ச்‌சி ம‌ட்டு‌ம் இ‌ல்லா‌‌வி‌ட்டா‌ல் வா‌ழ்‌க்கை எ‌ன்பது சும‌க்க முடியாத பெ‌ரிய சுமையா‌கி‌யிரு‌க்கு‌ம்.

7. உலகம் ஒரு விசித்திரமான கல்லூரி. இங்கே பாடம் சொல்லிக்கொடுத்துத் தேர்வு வைப்பது இல்லை. தேர்வு வைத்த பிறகே பாடம் கற்பிக்கப்படுகிறது.

8. சிக்கனம் என்பது ஒருவன் பணத்தை எவ்வளவு குறைவாகச் செலவு செய்கிறான் என்பதைப் பொறுத்தது அல்ல. அதை அவன் எவ்வளவு உபயோகமாகச் செலவிடுகிறான் என்பதைப் பொறுத்தது ஆகும்.

9. எதை இழந்தீர்கள் என்பதல்ல முக்கியம், என்ன மிச்சம் இருக்கிறது என்பதே முக்கியம்.

10. அரிய சாதனைகள் அனைத்தும் வலிமையினால் செய்யப்பட்டவை அல்ல; விடாமுயற்சியினால் தான். 

11. முன்நோக்கி செல்லும் போது கனிவாயிரு. ஒருவேளை பின்நோக்கி வரநேரிட்டால் யாராவது உதவுவார்கள்.

12. ரகசியத்தை வெளிப்படுத்தியவனுக்கும், துக்கத்தை வெளிப்படுத்தாதவனுக்கும் மனதில் நிம்மதி இருக்காது.

13. எல்லோரையும் நம்புவது அபாயகரமானது. ஒருவரையும் நம்பாமல் இருப்பது இன்னும் அபாயகரமானது.

14. எல்லாத் துன்பங்களுக்கும் இரண்டு மருந்துகள் உள்ளன. ஒன்று காலம், இன்னொன்று மெளனம். 

15. எல்லோரும் தம்மை விட்டு விட்டு வேறுயாரையோ சீர்திருத்த முயலுகிறார்கள்.

16. ஆசையில்லாத முயற்சியால் பயனில்லை. முயற்சியில்லாத ஆசையால் பயனில்லை. 

17. செயல் புரியாத மனிதனுக்கு தெய்வம் ஒருபோதும் உதவி செய்யாது.

18. சண்டைக்குப் பின் வரும் சமாதானத்தைவிட, என்றும் சண்டையே இல்லாத சமாதானம்தான். வேண்டும்.

19. நேற்றைய பொழுதும் நிஜமில்லை; நாளைய பொழுதும் நிச்சயமில்லை; இன்றைக்கு மட்டுமே நம் கையில்.

20. மகிழ்ச்சியாய் நீ வீணாக்கிய தருணங்களெல்லாம் வீணானவையல்ல.

21. பழமையைப் பற்றி ஒன்றுமே தெரியாமல் புதுமையைச் சிறப்பாகப் படைக்க முடியாது.

22. வாசிப்புப் பழக்கம் என்பது அருமையான ருசி, அழகான பசி. ஒரு முறை சுவைக்கப் பழகிவிட்டால் அது தொடர்ந்து வரும்.

23. நீங்க‌ள் விரும்புவ‌து ஒருவேளை உங்க‌ளுக்கு கிடைக்காம‌ல் போக‌லாம். ஆனால் உங்க‌ளுக்கு த‌குதியான‌து உங்க‌ளுக்கு க‌ண்டிப்பாக‌ கிடைத்தே தீரும்.

24. அறிவு ஒன்றுதான் அச்சத்தை முறிக்கும் அரிய மருந்து. அறிவை வளர்த்துக் கொண்டால் எல்லாவிதமான பயங்களும் அகன்றுவிடும்.


25. தவறு நேர்ந்து விடுமோ என்று அஞ்சி அஞ்சி எந்த செயலையும் செய்யாமல் பின் வாங்குவது இழிவானது. 

Sunday, August 11, 2013

PMOLED vs AMOLED

Introduction:-

OLED is a new technology for thin, efficient and bright displays. There are two types of OLEDs: Passive-Matrix (PMOLED) and Active-Matrix (AMOLED).
OLED is a new technology that can make thin, efficient and bright displays. OLEDs are made from organic light-emitting materials, and do not require any backlight and filtering systems that are used in LCDs. 

                             Samsung Galaxy S (AMOLED)

There are two types of OLED displays - PMOLED and AMOLED. The difference is in the driving electronics - it can be either Passive Matrix (PM) or Active Matrix (AM).

                                   A PMOLED MP3 player

A PMOLED display uses a simple control scheme in which you control each row (or line) in the display sequentially (one at a time). PMOLED electronics do not contain a storage capacitor and so the pixels in each line are actually off most of the time.
To compensate for this you need to use more voltage to make them brighter. If you have 10 lines, for example, you have to make the one line that is on 10 times as bright (the real number is less then 10, but that's the general idea).
So while PMOLEDs are easy (and cheap) to fabricate, they are not efficient and the OLED materials suffer from lower lifetime (due to the high voltage needed). PMOLED displays are also restricted in resolution and size (the more lines you have, the more voltage you have to use). PMOLED displays are usually small (up to 3" typically) and are used to display character data or small icons: they are being used in MP3 players, mobile phone sub displays, etc.
An AMOLED (Active-Matrix OLED) is driven by a TFT which contains a storage capacitor that maintains the line pixel states, and so enables large size (and large resolution) displays. AMOLEDs can be made much larger than PMOLED and have no restriction on size or resolution.
The first OLED products in the market used PMOLEDs - these were MP3 players, sub-displays on cellphones and radio decks for automobiles. The displays were small and usually with just one or two colors. When AMOLED panels started to emerge in 2007 and 2008 we have seen these larger displays in mobile video players, digital cameras, mobile phones main displays and even OLED TV sets.
                        LG AMOLED TV prototype


Today there are several companies that are working on technologies that actually close the gap between PMOLEDs and AMOLEDs - offering a sort of hybrid system. The promise is that these displays will be both easy to make and allow power efficient larger displays. We still have to wait and see whether these technologies actually work on commercial displays.

AMOLED

OLED displays are made from organic (carbon based) materials that emit light when electricity is applied. OLEDs can be used to create displays - and these are bright and efficient with a fast response time and a wide viewing angle. OLED display can be made very thin (the thinnest prototype is 50 microns...) and even transparent or flexible. The possibilities are almost endless...

                     Samsung Transparent AMOLED prototype

The term AMOLED means Active-Matrix OLED. The 'active-matrix' part refers to the driving electronics, or the TFT layer. When you display an image, you actually display it line by line (sequentially) as you can only change one line at a time. An AMOLED uses a TFT which contains a storage capacitor which maintains the line pixel states, and so enables large size (and large resolution) displays
A PMOLED uses a simpler kind of driver electronics - without a storage capacitor. This means that each line is turned off when you move to the next line. So let's say you have 10 rows in your display - each row will only be on 1/10 of the time.
 The brightness of each row has to be 10 times the brightness you'd get in an AMOLED. So you use more voltage which shortens the lifetime of the OLED materials and also results in a less efficient display. So while PMOLEDs are cheaper to make than AMOLEDs they are limited in size and resolution (the largest PMOLED is only 5", and most of them are around 1" to 3"). Most PMOLEDs are used for character display, and not to show photos or videos.
                                 OSD 2 color 0.96-inch PMOLED

These terms relate to the driving method of the OLED display. A PMOLED (Passive-Matrix OLED) is limited in size and resolution, but is cheaper and easier to make than an AMOLED (which uses an Active-Matrix). An AMOLED uses an active-matrix TFT array and storage capacitors. While these displays are more efficient and can be made large, they are also more complicated to make.
PMOLED displays are used in mp3 players or secondary displays on cell phones while AMOLEDs are used in Smartphone displays, digital cameras and TVs.

Samsung is the clear leader in AMOLED production. Samsung are actually using the term AMOLED to brand these kinds of displays. Samsung is making 2" to 5" panels today, used in many mobile phones, digital cameras and other mobile devices. Samsung is also showing prototypes of larger (14" up to 42") AMOLED panels, but these aren't produced yet.
                                            Samsung Galaxy S

Samsung's Super-AMOLED displays are AMOLED displays with an integrated touch function. Samsung has placed a touch-sensor (on-cell) over the display and made it evaporate. The thickness of the touch sensor is just 0.001mm and this allows the screen to provide better images and to have great visibility even in direct sunlight. Super-AMOLEDs also have better lifetime than regular AMOLED and are very responsive to touch. In January 2011 Samsung announced the 2nd-generation Super AMOLED Plus displays which offer more sub-pixels (they no longer use the PenTile matrix) and are also thinner, brighter and more efficient (by 18%) than the old Super AMOLED displays.
All OLED TV panels will actually be AMOLED TVs... Sony has been the first to make such a TV, the XEL-1 (back in 2007). Since then they have stopped production and marketing in Japan. The AMOLED TV was more of a technology demo than anything else. Even though it costs around $2500 for a 11" display, they were losing money on each set.
                                                   Sony XEL-1

LG are the second company to introduce an AMOLED TV, the EL9500 which is a 15" TV that is also very expensive at $2500, and currently sold only in Korea and Europe
                                              LG 15-inch OLED TVs

OLED technology
OLEDs are made from organic (carbon based) materials that emit light when electricity is applied. Because OLEDs do not require a backlight and filters (unlike LCD displays), they are more efficient, simpler to make, and much thinner. OLEDs have a great picture quality - brilliant colors, fast response rate and a wide viewing angle.
LG 15-inch OLED prototype

OLEDs can also be used to make OLED Lighting - thin, efficient and without any bad metals.
OLLA White Light Prototype

OLED materials have been discovered back in 1960, but only in the past 20 years or so have researchers started to actually work on the technology.
The basic structure of an OLED is a cathode (which injects electrons), an emissive layer and an anode (which removes electrons). Modern OLED devices use many more layers in order to make them more efficient, but the basic functionality remains the same.
Making an OLED involves several steps: taking a substrate, cleaning it, making the backplane (the switching and driving circuitry), depositing and patterning the organic layers and finally encapsulation the whole thing to prevent dust, oxygen and moisture damage.
There are several ways to deposit and pattern the organic layers. Currently all OLED displays are made using vacuum evaporation, using a Shadow Mask (FMM, Fine Metal Mask) to pattern. This is a relatively simple method but it is inefficient and very difficult to scale up to large substrates. There are several alternatives for next-gen deposition techniques, including laser annealing and inkjet printing. These methods will be scalable and more efficient than vacuum deposition.
There are several types of OLED materials. The most basic division is between small-molecule OLEDs and large molecule ones (called Polymer OLEDs, or P-OLEDs). Almost all OLEDs made today are SM-OLED based. These materials are evaporable and far more advanced than P-OLEDs. P-OLEDs had great promise and are solution processable (and so can be used in InkJet printing and spin-coating fabrication methods). Intensive research is being performed to develop efficient solution-processable SM-OLEDs.
Another interesting division is between Fluorescent and Phosphorescent materials. Fluorescent materials last longer (and were discovered first) but are much less efficient than Phosphorescent materials. Most people agree that the future of OLEDs (especially in large-area displays and lighting panels) lie with Phosphorescent materials, although there are still challenges in developing a long-lasing blue Phosphorescent OLED. It is possible to combine these materials though, and today Samsung for example use a red PHOLED together with Fluorescent green and blue. Universal Display Corporation is pioneering PHOLED research, holding basic patents in this area.
The two major challenges facing the OLED industry is the lifetime of the panels (OLED panels still lag behind plasma and LCD displays) and production scaling beyond Gen-5.5.
Today OLED displays are used mainly in small (2" to 5") displays for mobile devices such as phones, cameras and MP3 players. OLED displays carry a price premium over LCDs, but offer brighter pictures and better power efficiency - making it ideal for battery powered gadgets.
Making larger OLEDs is possible, but difficult and expensive. There are some OLED TVs available, but these are expensive. Sony has announced the XEL-1 11quot; OLED TV back in 2007 - at about $2,500 (they aren't producing it anymore and now focus on professional OLED monitors). LG is also offering an OLED TV (the 15" EL9500) which is also expensive and isn't being mass produced. Mass production of price-competitive OLED TV sets will probably begin towards the end of 2012 or early 2013.
In the OLED lighting market, several companies (such as Philips, OSRAM and Lumiotec) are already shipping OLED panels, but these are small and very expensive, mostly used in premium lighting fixtures and as experimental design kits.
In the future, companies will be able to produce flexible and transparent OLED panels. This will open up a whole world of exciting applications, such as:

ITRI 4.1 Flexible AMOLED prototype

Flexible OLEDs require that the entire device is flexible - including the electronics and the encapsulation layer. Several companies are working on this technology, using either plastic or metal based displays (it's also possible to use very thin flexible glass). Transparent OLEDs are also difficult to make, although these are already in production: since May 2011 TDK are mass producing transparent PMOLED displays for mobile phones and other applications.




Mixed Content: The page at xxx was loaded over HTTPS, but requested an insecure

 Mixed Content: The page at ' https ://www.test.com/signup.aspx' was loaded over HTTPS, but requested an insecure script ' http ...