Friday, 9 January 2015

How to stop parsing the HTML tags?

How to stop parsing the HTML tags?

There are couples Method to avoid the parsing of HTML tags, I used following two ways.


How to use XMP Tag for avoid HTML parsing, See Example
Method No 1

<img src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjOZoBT5-0tL8iOdoHHiqqLgQxwtOtbtLHJp2MaanGJK2BhQOSjIh1FyTgN9uYuCam5kOfUN3NixaLcT7sf46MKGEn7p1PKXJpKG79jMtCZHH4xroHX9AzlQqC97Jbu54Q8pN_H4DLHE9jL/s1600/wordpress.jpg" />

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js" type="text/javascript"></script>



How to use script Tag for avoid HTML parsing, See Example
Method No 2

<script type="text/plain">
<img src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjOZoBT5-0tL8iOdoHHiqqLgQxwtOtbtLHJp2MaanGJK2BhQOSjIh1FyTgN9uYuCam5kOfUN3NixaLcT7sf46MKGEn7p1PKXJpKG79jMtCZHH4xroHX9AzlQqC97Jbu54Q8pN_H4DLHE9jL/s1600/wordpress.jpg" />
<meta content='jX6W4C5R1HdrWqp91JMBxHzxqBM' name='alexaVerifyID'/>
<script src='http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js' type='text/javascript'></script>



Thursday, 8 January 2015

SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 2269548 for key PRIMARY

SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 2269548 for key PRIMARY

Following are few reasons with solutions:

Reason 1:
ID is auto-increment and primary key. id is auto filed when an record is insert.
When we try to insert record with same id which is already exist in table, then such type of error comes.
SOLUTION:
So, write SQL in following ways.
INSERT INTO users (name) VALUES ('name1'); //skip the id field which is auto-increment


Reason 2:
When table is used to frequent insertion of records, like we are storing db logs for each action. Sometimes, it have thousand of thousands records, and field(like id) limit cross the limit. SOLUTION: Increase the limit of id field.
ALTER TABLE `users` CHANGE `id` `id` BIGINT(10) UNSIGNED NOT NULL AUTO_INCREMENT; 
Reason 3:
When table is used to frequent insertion of records, like we are storing db logs for each action.Sometimes, it have thousand of thousands records, and table goes to overhead.
SOLUTION: Execute following query
OPTIMIZE TABLE `users`