<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-3063939708578051703</id><updated>2026-06-25T12:11:49.560+05:30</updated><category term="C Graphics"/><category term="Computer Graphics Lab Program"/><category term="Javascript Tricks"/><category term="2D in C"/><category term="3D in C"/><category term="CSS Tricks"/><category term="JQuery Plugin"/><category term="AngularJs"/><category term="Animation using C"/><category term="PHP"/><category term="Line Clipping"/><category term="Mini Projects in C"/><category term="RGB in C"/><title type='text'>Own My Code - AngularJS, JS, JQuery, C,C++,C Graphics,Mini Project,Computer Programming</title><subtitle type='html'>Javascript tips and tricks, JQuery tips &amp;amp; tricks, JQuery Plugins, CSS Tricks and Tips, things you may not know about javascript, AngularJS tips and tricks, Laravel, PHP tips and tricks, computer programming, grapical user interface using c, c header files, computer graphics lab program, 2d translation, 3d translation, line drawing algorithm, circle drawing algorithm, DDA, Midpoint, 3D projection using c, Personal diary, Mini project using c, Graphical User Interface using C</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://ownmycode.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3063939708578051703/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://ownmycode.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/3063939708578051703/posts/default?start-index=26&amp;max-results=25&amp;redirect=false'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>39</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-3063939708578051703.post-8887573652900269716</id><published>2017-01-06T04:20:00.001+05:30</published><updated>2017-03-28T09:37:35.303+05:30</updated><title type='text'>Things you may not know about Javascript Objects</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;h2 style=&quot;text-align: left;&quot;&gt;
        &lt;span style=&quot;color: #0b5394; font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;Object Properties:&lt;/span&gt;
    &lt;/h2&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;span style=&quot;font-family: &#39;georgia&#39; , &#39;times new roman&#39; , serif;&quot;&gt;An Object is a non primitive data with collection of properties(key, value). Each property(key) of an Object has following configurable properties,&lt;/span&gt;
        &lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;color: black; font-family: Times;&quot;&gt;
&lt;ol style=&quot;font-size: large; line-height: 26px; margin: 15px 0; text-align: left;font-family:georgia;&quot;&gt;
&lt;li style=&quot;color: black;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: large;&quot;&gt;&lt;b&gt;value&lt;/b&gt;&amp;nbsp;- value of the property.&amp;nbsp;&lt;i&gt;&lt;span style=&quot;color: #666666;&quot;&gt;Default: undefined&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: large;&quot;&gt;&lt;b&gt;enumerable&lt;/b&gt; - if true, the property can be accessed using a &lt;span style=&quot;color: #6aa84f;&quot;&gt;&lt;i&gt;for..in&lt;/i&gt;&lt;/span&gt; loop and &lt;i&gt;&lt;span style=&quot;color: #6aa84f;&quot;&gt;Object.keys&lt;/span&gt;&lt;/i&gt;. &lt;i style=&quot;color: black; font-family: georgia, &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;&lt;span style=&quot;color: #666666;&quot;&gt;Default: false&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: large;&quot;&gt;&lt;b&gt;writable&lt;/b&gt; - if true, the property value can be modified. &lt;i&gt;&lt;span style=&quot;color: #666666;&quot;&gt;Default: false&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: large;&quot;&gt;&lt;b style=&quot;color: black; font-family: georgia, &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;&lt;a href=&quot;http://ownmycode.blogspot.com/2015/03/mutator-methods-in-javascript.html&quot; target=&quot;_blank&quot;&gt;get&lt;/a&gt;&amp;nbsp;&lt;/b&gt;- defines a getter function. &lt;i&gt;&lt;span style=&quot;color: #666666;&quot;&gt;Default: undefined&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: large;&quot;&gt;&lt;b style=&quot;color: #0b5394;&quot;&gt;&lt;a href=&quot;http://ownmycode.blogspot.com/2015/03/mutator-methods-in-javascript.html&quot; target=&quot;_blank&quot;&gt;set&lt;/a&gt;&lt;/b&gt; - defines a setter function&lt;i&gt;. &lt;span style=&quot;color: #666666;&quot;&gt;Default: undefined&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;b&gt;configurable&lt;/b&gt; - if true, all the properties can be modified and deleted. &lt;i style=&quot;font-family: Georgia, &amp;quot;Times New Roman&amp;quot;, serif;&quot;&gt;&lt;span style=&quot;color: #666666;&quot;&gt;Default: false&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;
                &lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;div style=&quot;color: black; font-family: Times;&quot;&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;With&amp;nbsp;&lt;span style=&quot;color: #6aa84f;&quot;&gt;&lt;a href=&quot;http://ownmycode.blogspot.com/2015/03/mutator-methods-in-javascript.html&quot; target=&quot;_blank&quot;&gt;Object.defineProperty&lt;/a&gt;&lt;/span&gt;&amp;nbsp;and&amp;nbsp;&lt;span style=&quot;color: #6aa84f;&quot;&gt;&lt;a href=&quot;http://ownmycode.blogspot.com/2015/03/mutator-methods-in-javascript.html&quot; target=&quot;_blank&quot;&gt;Object.defineProperties&lt;/a&gt;&amp;nbsp;&lt;/span&gt;we can set the above configurable properties for an Object property(key).&lt;/span&gt;&lt;/span&gt;
        &lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div style=&quot;color: black; font-family: Times;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: large; font-weight: normal;&quot;&gt;With&amp;nbsp;&lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getOwnPropertyDescriptor&quot; target=&quot;_blank&quot;&gt;Object.getOwnPropertyDescriptor&lt;/a&gt;&amp;nbsp;and &lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getOwnPropertyDescriptors&quot; target=&quot;_blank&quot;&gt;Object.getOwnPropertyDescriptors&lt;/a&gt; we can get the above configurable properties associated with an Object property(key).&lt;/span&gt;
        &lt;/div&gt;
&lt;h4 style=&quot;font-family: times;&quot;&gt;
            &lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;color: #333;&quot;&gt;example:&lt;/span&gt;&lt;/span&gt;&lt;/h4&gt;
&lt;pre&gt;&lt;code class=&quot;js&quot;&gt;var x = { a:1, b:2 };

Object.getOwnPropertyDescriptor(x, &#39;a&#39;); 
// {value: 1, writable: true, enumerable: true, configurable: true} 
&lt;/code&gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;h2 style=&quot;text-align: left;&quot;&gt;
            &lt;span style=&quot;color: #0b5394; font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;Object.freeze()&lt;/span&gt;
        &lt;/h2&gt;
&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: large;&quot;&gt;This method prevents an Object from,&lt;/span&gt;&lt;br /&gt;
&lt;div&gt;
&lt;ol style=&quot;font-size: large; line-height: 26px; margin: 15px 0; text-align: left;font-family:georgia;&quot;&gt;
&lt;li&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;New Properties being added&lt;/span&gt;
                &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;Modify existing properties&lt;/span&gt;
                &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;Delete existing properties&lt;/span&gt;
                &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;Configuring the object properties&lt;/span&gt;
                &lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-weight: normal;&quot;&gt;But still the inner object properties can be modified. To deep freeze the whole object, we have to recursively freeze the non primitive values (Object).&lt;/span&gt;
            &lt;/span&gt;&lt;br /&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: large;&quot;&gt;So the property description for each property in an object will be,&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;
&lt;div style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-weight: normal;&quot;&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;span style=&quot;color: #0b5394;&quot;&gt;writable:&lt;/span&gt; &lt;i&gt;&lt;span style=&quot;color: #3d85c6;&quot;&gt;false&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;span style=&quot;color: #0b5394;&quot;&gt;enumerable:&lt;/span&gt; &lt;i&gt;&lt;span style=&quot;color: #3d85c6;&quot;&gt;true&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;span style=&quot;color: #0b5394;&quot;&gt;configurable: &lt;/span&gt;&lt;i&gt;&lt;span style=&quot;color: #3d85c6;&quot;&gt;false&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;
&lt;/div&gt;
            &lt;/div&gt;
&lt;h4 style=&quot;text-align: left;&quot;&gt;
                &lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;color: #333;&quot;&gt;example:&lt;/span&gt;&lt;/span&gt;&lt;/h4&gt;
&lt;pre&gt;&lt;code class=&quot;js&quot;&gt;var x = {
a:1, 
b:2, 
c:{
d:3
}
};

var y = Object.freeze(x);
    
    Object.getOwnPropertyDescriptor(x, &#39;a&#39;); //{value: 1, writable: false, enumerable: true, configurable: false}

x===y; //true

x.a; //1
x.a = 5; //silently fails. In strict mode - throws a TypeError
x.a; //1
x.m = 5; //silently fails. In strict mode - throws a TypeError
x.m; //undefined

x.c.d; //3
x.c.d = 5; //since it is not a primitive value, still it allows to modify internal properties of &#39;c&#39;
x.c.d; //5

Object.defineProperty(x, &#39;n&#39;, { value: 10 }); //throws a TypeError
Object.defineProperty(x, &#39;a&#39;, { value: 20 }); //throws a TypeError

Object.isFrozen(x); //true
Object.isExtensible(x); //false&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;h2 style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #0b5394; font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;Object.seal()&lt;/span&gt;&lt;/h2&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;This method prevents an Object from,&lt;/span&gt;
            &lt;/span&gt;&lt;br /&gt;
&lt;div&gt;
&lt;ol style=&quot;font-size: large; line-height: 26px; margin: 15px 0; text-align: left;font-family:georgia;&quot;&gt;
&lt;li&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;New Properties being added&lt;/span&gt;
                    &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;Delete existing properties&lt;/span&gt;&lt;/span&gt;
                    &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;Configuring the object properties&lt;/span&gt;
                    &lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;It allows the value of an existing properties to be modified.&lt;/span&gt;
                &lt;/span&gt;&lt;br /&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;So the property description for each property in an object will be,&lt;/span&gt;
                    &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;
&lt;div style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-weight: normal;&quot;&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;span style=&quot;color: #0b5394;&quot;&gt;writable:&lt;/span&gt;&amp;nbsp;&lt;i&gt;&lt;span style=&quot;color: #3d85c6;&quot;&gt;true&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;span style=&quot;color: #0b5394;&quot;&gt;enumerable:&lt;/span&gt;&amp;nbsp;&lt;i&gt;&lt;span style=&quot;color: #3d85c6;&quot;&gt;true&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;span style=&quot;color: #0b5394;&quot;&gt;configurable:&amp;nbsp;&lt;/span&gt;&lt;i&gt;&lt;span style=&quot;color: #3d85c6;&quot;&gt;false&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;h4 style=&quot;text-align: left;&quot;&gt;
                    &lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;color: #333;&quot;&gt;example:&lt;/span&gt;&lt;/span&gt;&lt;/h4&gt;
&lt;pre&gt;&lt;code class=&quot;js&quot;&gt;var x = {
a:1, 
b:2, 
c:{
d:3
}
};

var y = Object.seal(x);

Object.getOwnPropertyDescriptor(x, &#39;a&#39;); //{value: 1, writable: true, enumerable: true, configurable: false}

x===y; //true

x.a; //1
x.a = 5; //since it is writable. the value can be changed
x.a; //5

x.m = 5; //silently fails. In strict mode - throws a TypeError
x.m; //undefined

Object.defineProperty(x, &#39;n&#39;, { value: 10 }); //throws a TypeError
Object.defineProperty(x, &#39;a&#39;, { value: 20 }); //allows to modify value

x.a; //20

Object.isSealed(x); //true
Object.isExtensible(x); //false
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://ownmycode.blogspot.com/feeds/8887573652900269716/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ownmycode.blogspot.com/2017/01/things-you-may-not-know-about.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3063939708578051703/posts/default/8887573652900269716'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3063939708578051703/posts/default/8887573652900269716'/><link rel='alternate' type='text/html' href='http://ownmycode.blogspot.com/2017/01/things-you-may-not-know-about.html' title='Things you may not know about Javascript Objects'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3063939708578051703.post-3235110360952093520</id><published>2016-05-25T00:03:00.002+05:30</published><updated>2017-03-29T02:07:47.797+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="AngularJs"/><category scheme="http://www.blogger.com/atom/ns#" term="Javascript Tricks"/><title type='text'>AngularJs Interpolate Filter</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: georgia, &#39;times new roman&#39;, serif; font-size: large;&quot;&gt;This might be a simple angular filter, but more helpful to reduce ugly code in your controller.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: georgia, &#39;times new roman&#39;, serif; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: georgia, &#39;times new roman&#39;, serif; font-size: large;&quot;&gt;Angular provides &lt;/span&gt;&lt;b style=&quot;font-family: georgia, &#39;times new roman&#39;, serif; font-size: x-large;&quot;&gt;&#39;$interpolate&#39;&lt;/b&gt;&lt;span style=&quot;font-family: georgia, &#39;times new roman&#39;, serif; font-size: large;&quot;&gt; service to evaluate angular expressions.&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: large;&quot;&gt;Consider you have some constant template with some expression expecting a dynamic value - lets say userName.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;script async src=&quot;https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js&quot;&gt;&lt;/script&gt;
&lt;!-- In-Post-Ad - 1 --&gt;
&lt;ins class=&quot;adsbygoogle&quot;
     style=&quot;display:inline-block;width:320px;height:100px&quot;
     data-ad-client=&quot;ca-pub-0251842217053898&quot;
     data-ad-slot=&quot;2230369117&quot;&gt;&lt;/ins&gt;
&lt;script&gt;
(adsbygoogle = window.adsbygoogle || []).push({});
&lt;/script&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;Example:
&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;pre&gt;&lt;code class=&quot;javascript&quot;&gt;//example.js
angular.module(&#39;app.example&#39;,[])
.constant(&#39;TEMPLATE&#39;,{
   WELCOME_MSG: &#39;Hi {{userName}} Welcome to our Portal&#39;
})
.controller(&#39;sampleCtrl&#39;, function($scope, TEMPLATE, $interpolate){
   
   $scope.data = {
      userName:&#39;Ajai&#39;
   };

   $scope.MSG = $interpolate(TEMPLATE.WELCOME_MSG)($scope.data);
   
});
&lt;/code&gt;
&lt;/pre&gt;
&lt;pre&gt;&lt;code class=&quot;xml&quot;&gt;
&amp;lt;!--example.html--&amp;gt;
&amp;lt;div ng-app=&quot;app.example&quot; ng-controller=&quot;sampleCtrl&quot;&amp;gt;
&amp;lt;h1&amp;gt;{{MSG}}&amp;lt;/h1&amp;gt;
&amp;lt;/div&amp;gt;
&lt;/code&gt;
&lt;/pre&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;Instead you can simplify the above one with custom interpolate filter. Below example wont make much difference, but consider if you have some 100 template constants - it is not a good idea to evaluate each template expression in controller. Instead we can achieve the same in template expression with simple filter.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;pre&gt;&lt;code class=&quot;javascript&quot;&gt;angular.module(&#39;angular.filter.interpolate&#39;)
        .filter(&#39;interpolate&#39;, function ($interpolate) {
            return function (input, data) {
                return input?$interpolate(input)(data):&#39;&#39;;
            };
        });
&lt;/code&gt;
&lt;/pre&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;script async src=&quot;https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js&quot;&gt;&lt;/script&gt;
&lt;!-- In-Post-Ad - 1 --&gt;
&lt;ins class=&quot;adsbygoogle&quot;
     style=&quot;display:inline-block;width:320px;height:100px&quot;
     data-ad-client=&quot;ca-pub-0251842217053898&quot;
     data-ad-slot=&quot;2230369117&quot;&gt;&lt;/ins&gt;
&lt;script&gt;
(adsbygoogle = window.adsbygoogle || []).push({});
&lt;/script&gt;
&lt;/div&gt;
&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;Example:
&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;pre&gt;&lt;code class=&quot;javascript&quot;&gt;//example.js
angular.module(&#39;app.example&#39;,[&#39;angular.filter.interpolate&#39;])
.constant(&#39;TEMPLATE&#39;,{
   WELCOME_MSG: &#39;Hi {{userName}} Welcome to our Portal&#39;
})
.controller(&#39;sampleCtrl&#39;, function($scope, TEMPLATE, $interpolate){
   
   $scope.TEMPLATE = TEMPLATE;

   $scope.data = {
      userName:&#39;Ajai&#39;
   };
   
});
&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;
&lt;code class=&quot;xml&quot;&gt;&amp;lt;!--example.html--&amp;gt;
&amp;lt;div ng-app=&quot;app.example&quot; ng-controller=&quot;sampleCtrl&quot;&amp;gt;
    &amp;lt;!--Referring the model--&amp;gt;
    &amp;lt;h1&amp;gt;
      {{TEMPLATE.WELCOME_MSG | interpolate:data}}
    &amp;lt;/h1&amp;gt;
    &amp;lt;!--With hardcoded value--&amp;gt;
    &amp;lt;h1&amp;gt;
      {{TEMPLATE.WELCOME_MSG | interpolate:{userName:&#39;Ajai&#39;} }}
    &amp;lt;/h1&amp;gt;
&amp;lt;/div&amp;gt;
&lt;/code&gt;
&lt;/pre&gt;
&lt;br /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ownmycode.blogspot.com/feeds/3235110360952093520/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ownmycode.blogspot.com/2016/05/angularjs-interpolate-filter.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3063939708578051703/posts/default/3235110360952093520'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3063939708578051703/posts/default/3235110360952093520'/><link rel='alternate' type='text/html' href='http://ownmycode.blogspot.com/2016/05/angularjs-interpolate-filter.html' title='AngularJs Interpolate Filter'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3063939708578051703.post-1685520807023128583</id><published>2015-03-18T12:05:00.003+05:30</published><updated>2017-03-28T09:48:15.007+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Javascript Tricks"/><title type='text'>Mutator methods in Javascript</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;A Mutator&amp;nbsp;method is used to control changes to a variable, which is&amp;nbsp;formerly known as&lt;/span&gt;&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;i style=&quot;font-family: Georgia, &amp;quot;Times New Roman&amp;quot;, serif;&quot;&gt;&lt;b&gt;getter &lt;/b&gt;&lt;/i&gt;&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;and &lt;/span&gt;&lt;b style=&quot;font-family: Georgia, &amp;quot;Times New Roman&amp;quot;, serif;&quot;&gt;&lt;i&gt;setter&lt;/i&gt;&lt;/b&gt;&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt; methods. Several server side languages supports Mutator methods. Lets see how to achieve the same in JavaScript.&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;There are some restrictions to achieve it in obsolete browsers. Lets see the different ways to implement mutator methods in&amp;nbsp;JavaScript,&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b style=&quot;font-family: Georgia, &amp;quot;Times New Roman&amp;quot;, serif;&quot;&gt;Method 1: Exposing our own &lt;i&gt;getter&lt;/i&gt; and &lt;i&gt;setter &lt;/i&gt;methods&lt;/b&gt;&lt;br /&gt;
&lt;pre&gt;
&lt;code class=&quot;js&quot;&gt;function User(){
 this._name = &#39;&#39;;
 this.getName = function(){
  return &#39;Hey &#39; + this._name;
 }
 this.setName = function(name){
  this._name = name
 }
}

var u1 = new User();
u1.setName(&#39;Ajai&#39;)
console.log(u1.getName()) //Hey Ajai
&lt;/code&gt;
&lt;/pre&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;script async src=&quot;https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js&quot;&gt;&lt;/script&gt;
&lt;!-- In-Post-Ad - 1 --&gt;
&lt;ins class=&quot;adsbygoogle&quot;
     style=&quot;display:inline-block;width:320px;height:100px&quot;
     data-ad-client=&quot;ca-pub-0251842217053898&quot;
     data-ad-slot=&quot;2230369117&quot;&gt;&lt;/ins&gt;
&lt;script&gt;
(adsbygoogle = window.adsbygoogle || []).push({});
&lt;/script&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;&lt;b&gt;Method 2: Using ES5 Syntax (supported in all ES5 ready browsers)&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;pre&gt;
&lt;code class=&quot;js&quot;&gt;//with Prototype
function User(){
 this._name = &#39;&#39;;
}

User.prototype = {
 get name(){
  return &#39;Hey &#39; + this._name;
 },
 set name(name){
  this._name = name;
 }
}

var u1 = new User();
u1.name = &quot;Ajai&quot;
console.log(u1.name) //Hey Ajai

//without Prototype
var User ={
 _name: &#39;&#39;,
 get name(){
  return &#39;Hey &#39; + this._name;
 },
 set name(name){
  this._name = name;
 }
}

User.name = &quot;Ajai&quot;
console.log(User.name) //Hey Ajai

var u1 = Object.create(User);
u1.name = &quot;Ajai&quot;;
console.log(u1.name) //Hey Ajai
&lt;/code&gt;
&lt;/pre&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;script async src=&quot;https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js&quot;&gt;&lt;/script&gt;
&lt;!-- In-Post-Ad - 1 --&gt;
&lt;ins class=&quot;adsbygoogle&quot;
     style=&quot;display:inline-block;width:320px;height:100px&quot;
     data-ad-client=&quot;ca-pub-0251842217053898&quot;
     data-ad-slot=&quot;2230369117&quot;&gt;&lt;/ins&gt;
&lt;script&gt;
(adsbygoogle = window.adsbygoogle || []).push({});
&lt;/script&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;b style=&quot;font-family: Georgia, &amp;quot;Times New Roman&amp;quot;, serif;&quot;&gt;Method 3: Using Object.defineProperty &amp;amp; Object.defineProperties&lt;/b&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;&lt;i&gt;&lt;span style=&quot;color: #0b5394;&quot;&gt;Object.defineProperty&lt;/span&gt;&lt;/i&gt;&amp;nbsp;is supported from IE8+ browsers. Sadly&amp;nbsp;&lt;/span&gt;&lt;i style=&quot;font-family: Georgia, &amp;quot;Times New Roman&amp;quot;, serif;&quot;&gt;&lt;span style=&quot;color: #0b5394;&quot;&gt;Object.defineProperty&lt;/span&gt;&lt;/i&gt;&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;&amp;nbsp; in&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;IE8 only accepts DOM Object.&lt;/span&gt;&lt;br /&gt;
&lt;pre&gt;&lt;code class=&quot;js&quot;&gt;//with Object.defineProperty
var User = {
 _name: &#39;&#39;
}
Object.defineProperty(User, &#39;name&#39;, {
  get: function() {
    return &#39;Hey &#39; + this._name;
  },
  set: function(name){
 this._name = name;
  }
});

User.name = &#39;Ajai&#39;;
console.log(User.name); //Hey Ajai

//or

var u1 = Object.create(User);
u1.name = &quot;Ajai&quot;;
console.log(u1.name);
&lt;/code&gt;
&lt;/pre&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;&lt;i&gt;&lt;span style=&quot;color: #0b5394;&quot;&gt;Object.defineProperties &lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;&amp;nbsp;is&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;only supported in IE9+ browsers&lt;/span&gt;&lt;br /&gt;
&lt;pre&gt;
&lt;code class=&quot;js&quot;&gt;var User = {
 _name: &#39;&#39;,
 _age: 0
}
Object.defineProperties(User, {
  name: {
   get: function() {
  return &#39;Hey &#39; + this._name;
   },
   set: function(name){
  this._name = name;
   }
  },
  age: {
   get: function() {
  return &#39;Im &#39; + this._age;
   },
   set: function(age){
  this._age = age;
   }
  }
});

User.name = &#39;Ajai&#39;;
User.age = &#39;27&#39;;
console.log(User.name); //Hey Ajai
console.log(User.age); // Im 27
&lt;/code&gt;
&lt;/pre&gt;

&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;In IE8 you can create a fake DOM Element to achieve the same,&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;pre&gt;
&lt;code class=&quot;js&quot;&gt;var User = document.createElement(&#39;anytag&#39;);
document.body.appendChild(User);
User._name = &quot;&quot;;
Object.defineProperty(User, &#39;name&#39;, {
  get: function() {
    return &#39;Hey &#39; + this._name;
  },
  set: function(name){
 this._name = name;
  }
});

User.name = &#39;Ajai&#39;;
console.log(User.name); //Hey Ajai 
&lt;/code&gt;
&lt;/pre&gt;
&lt;b style=&quot;font-family: Georgia, &amp;quot;Times New Roman&amp;quot;, serif;&quot;&gt;&lt;br /&gt;&lt;/b&gt;
&lt;b style=&quot;font-family: Georgia, &amp;quot;Times New Roman&amp;quot;, serif;&quot;&gt;Non standard way :&lt;/b&gt;&lt;br /&gt;
&lt;b style=&quot;font-family: Georgia, &amp;quot;Times New Roman&amp;quot;, serif;&quot;&gt;&lt;br /&gt;&lt;/b&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif;&quot;&gt;This is&amp;nbsp;deprecated&amp;nbsp;from web standard. Please avoid this syntax in&amp;nbsp;real-time&amp;nbsp;applications.&lt;/span&gt;&lt;br /&gt;
&lt;div&gt;
&lt;pre&gt;
&lt;code class=&quot;js&quot;&gt;var User = {
 _name: &#39;&#39;
};

User.__defineGetter__(&#39;name&#39;, function(){
 return &#39;Hey &#39; + this._name;
});
User.__defineSetter__(&#39;name&#39;, function(name){
 this._name = name;
});

User.name = &#39;Ajai&#39;;
console.log(User.name); //Hey Ajai
&lt;/code&gt;
&lt;/pre&gt;
&lt;b style=&quot;font-family: Georgia, &amp;quot;Times New Roman&amp;quot;, serif;&quot;&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ownmycode.blogspot.com/feeds/1685520807023128583/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ownmycode.blogspot.com/2015/03/mutator-methods-in-javascript.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3063939708578051703/posts/default/1685520807023128583'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3063939708578051703/posts/default/1685520807023128583'/><link rel='alternate' type='text/html' href='http://ownmycode.blogspot.com/2015/03/mutator-methods-in-javascript.html' title='Mutator methods in Javascript'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3063939708578051703.post-122642048768656295</id><published>2014-06-22T16:14:00.001+05:30</published><updated>2017-03-28T11:14:58.620+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="CSS Tricks"/><title type='text'>Things you may not know about CSS</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;h2 id=&quot;docs-internal-guid-3cb6cb14-bb87-5794-0aa0-6d8ac550a78e&quot; style=&quot;line-height: 1.15; margin-bottom: 4pt; margin-top: 18pt; text-align: left;&quot;&gt;
&lt;/h2&gt;
&lt;h2 dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 4pt; margin-top: 18pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: &amp;quot;georgia&amp;quot;; font-size: 23px; font-style: normal; font-variant: normal; font-weight: bold; text-decoration: none; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;color: #990000;&quot;&gt;Grammatical error like style using CSS:&lt;/span&gt;&lt;/span&gt;&lt;/h2&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;br /&gt;
&lt;pre&gt;&lt;code class=&quot;css&quot;&gt;.grammar{ 
   -moz-text-decoration-color: green;
   -moz-text-decoration-line: underline;
   -moz-text-decoration-style: wavy;
   text-decoration-color: green;
   text-decoration-line: underline;
   text-decoration-style: wavy;
}
&lt;/code&gt;&lt;/pre&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: &amp;quot;arial&amp;quot;; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;&quot;&gt;&lt;u&gt;&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;b&gt;Output&lt;/b&gt;&lt;/span&gt;:&lt;/u&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 11pt; margin-right: 11pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: &amp;quot;arial&amp;quot;; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;&quot;&gt;&lt;img src=&quot;https://lh6.googleusercontent.com/B5034b2ddh2aNH3ct2evVL2tRx-B8KxiShEW4xUVjKE4Lccg5yksA4SV4E01u3OHIxQe7LEqh0HkcfyXy2wDwgHEB9wzxwAnSqgIos1NQHdipWXXLi60qRjaJ_NKMsQPVQ&quot; style=&quot;border: medium none; transform: rotate(0rad);&quot; /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;h2 dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 4pt; margin-top: 18pt;&quot;&gt;
&lt;span style=&quot;color: #990000;&quot;&gt;&lt;span style=&quot;background-color: transparent; font-family: &amp;quot;georgia&amp;quot;; font-size: 23px; font-style: normal; font-variant: normal; font-weight: bold; text-decoration: none; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: &amp;quot;georgia&amp;quot;; font-size: 23px; font-style: normal; font-variant: normal; font-weight: bold; text-decoration: none; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;color: #990000;&quot;&gt;CSS &#39;empty-cells&#39; Property&lt;/span&gt;&lt;/span&gt;&lt;/h2&gt;
&lt;h2 dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 4pt; margin-top: 18pt;&quot;&gt;
&lt;/h2&gt;
&lt;h2 dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 4pt; margin-top: 18pt;&quot;&gt;
&lt;/h2&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi1OLaavoM6wYYvagdlX2vCpJJqCIhE0izNYQGEu6FL_vX9-Xe_S3U0jX1B2VlFZ1lcJmIIETfUVphkXCnrn-6arhb10RKxmsPmnPWaG5DfuSTGPssZZfLnmB_mbTwEVaEtxyyfJ2wFiOFO/s1600/table.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi1OLaavoM6wYYvagdlX2vCpJJqCIhE0izNYQGEu6FL_vX9-Xe_S3U0jX1B2VlFZ1lcJmIIETfUVphkXCnrn-6arhb10RKxmsPmnPWaG5DfuSTGPssZZfLnmB_mbTwEVaEtxyyfJ2wFiOFO/s1600/table.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;pre&gt;&lt;code class=&quot;css&quot;&gt;table{
   empty-cells:hide;
}
&lt;/code&gt;&lt;/pre&gt;
&lt;h2 dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 4pt; margin-top: 18pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: &amp;quot;georgia&amp;quot;; font-size: 23px; font-style: normal; font-variant: normal; font-weight: bold; text-decoration: none; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;color: #3d85c6;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/h2&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;/div&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi5oDWMpTIA3luIpCa62Y2SOE6ZqDaErb2rTdy2wUDR9swg-9AcdyvD021wYy0Y-zWjyTPhzro10rNZy2avVC_Hws3YMOlEdXjfXxIUIY1nZD4ZBrTAcQbhMhidQat5l4hCOery8b9jQL7O/s1600/table+empty+cell+hide.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi5oDWMpTIA3luIpCa62Y2SOE6ZqDaErb2rTdy2wUDR9swg-9AcdyvD021wYy0Y-zWjyTPhzro10rNZy2avVC_Hws3YMOlEdXjfXxIUIY1nZD4ZBrTAcQbhMhidQat5l4hCOery8b9jQL7O/s1600/table+empty+cell+hide.png&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;script async=&quot;&quot; src=&quot;https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js&quot;&gt;&lt;/script&gt;
&lt;!-- In-Post-Ad - 1 --&gt;
&lt;br /&gt;
&lt;ins class=&quot;adsbygoogle&quot; data-ad-client=&quot;ca-pub-0251842217053898&quot; data-ad-slot=&quot;2230369117&quot; style=&quot;display: inline-block; height: 100px; width: 320px;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;
&lt;h2 style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;color: #990000;&quot;&gt;CSS @supports&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/h2&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;Usually we do CSS feature-test using JavaScript. Now it can be done in CSS with a new property&lt;i&gt; &#39;@supports&#39;&lt;/i&gt;. So for Firefox 22+ , Chrome 28+, Opera 12.1+ supports this feature. So we can look forward to using it soon!&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;u&gt;&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;b&gt;Example:&lt;/b&gt;&lt;/span&gt;&lt;/u&gt;&lt;br /&gt;
&lt;pre&gt;&lt;code class=&quot;css&quot;&gt;/* basic usage */
@supports(prop:value) {
    /* more styles */
}

/* real usage */
@supports (display: flex) {
    div { 
      display: flex;
    }
}

/* testing prefixes too */
@supports (display: -webkit-flex) or
          (display: -moz-flex) or
          (display: flex) {

    section {
      display: -webkit-flex;
      display: -moz-flex;
      display: flex;
      float: none;
    }
}
&lt;/code&gt;&lt;/pre&gt;
&lt;h2 style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;color: #990000;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/h2&gt;
&lt;h2 style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;color: #990000;&quot;&gt;CSS Filter Effects:&lt;/span&gt;&lt;/span&gt;&lt;/h2&gt;
&lt;h2 style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #3d85c6;&quot;&gt;&lt;/span&gt;&lt;/h2&gt;
&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;For an Image, we usually apply filters using Canvas. But CSS supports this filter operation via &#39;filter&#39; property. Note that this property is significantly different from and incompatible with Microsoft&#39;s older &quot;&lt;i&gt;filter&lt;/i&gt;&quot; property. So for only webkit browsers support this feature (Chrome 18+, Safari 7+, Opera 15+)&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;Supported filter properties:&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;ol style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;blur&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;grayscale&amp;nbsp;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;drop-shadow&amp;nbsp;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;sepia&amp;nbsp;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;brightness&amp;nbsp;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;contrast&amp;nbsp;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;hue-rotate&amp;nbsp;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;invert&amp;nbsp;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;saturate&amp;nbsp;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;opacity&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;color: #0b5394; font-size: medium;&quot;&gt;&lt;b&gt; &lt;a href=&quot;http://bennettfeely.com/filters/&quot;&gt;Click here for demo&lt;/a&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;u&gt;&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;b&gt;Example:&lt;/b&gt;&lt;/span&gt;&lt;/u&gt;&lt;br /&gt;
&lt;pre&gt;&lt;code class=&quot;css&quot;&gt;.blurFilter{
-webkit-filter: blur(2px);
} 
 .imageFilter{
     -webkit-filter: blur(5px) brightness(3.9) contrast(3.5) drop-shadow(72px 72px 20px black) grayscale(0.5) hue-rotate(120deg) invert(0.2) opacity(0.1) saturate(1.9) sepia(0.2);
}
&lt;/code&gt;&lt;/pre&gt;
&lt;h2 style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;color: #990000;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/h2&gt;
&lt;h2 style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;color: #990000;&quot;&gt;CSS &#39;pointer-events&#39;:&lt;/span&gt;&lt;/span&gt;&lt;/h2&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;This property is magical. Yes you can really disable a element using the power of CSS. You don&#39;t need JavaScript anymore to do the stuff.&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;i&gt;&#39;pointer-events&#39;&lt;/i&gt; CSS&lt;/span&gt; property actually disables the mouse events on an element.&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;u&gt;&lt;br /&gt;&lt;/u&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;u&gt;&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;b&gt;Example:&lt;/b&gt;&lt;/span&gt;&lt;/u&gt;&lt;/div&gt;
&lt;pre&gt;&lt;code class=&quot;css&quot;&gt;/*CSS:*/
.disabled{
     pointer-events:none;
}
&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code class=&quot;html&quot;&gt;&amp;lt;!--HTML:--&amp;gt;
&amp;lt;a href=&quot;http://www.google.com&quot; class=&quot;disabled&quot;&amp;gt;Google&amp;lt;/a&amp;gt;

&amp;lt;p onclick=&quot;alert(1)&quot; class=&quot;disabled&quot;&amp;gt;Pop an alert&amp;lt;/p&amp;gt;&lt;/code&gt;&lt;/pre&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;The above example wont fire any mouse events on the element.&lt;/span&gt;&lt;/div&gt;
&lt;h2 style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;color: #990000;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/h2&gt;
&lt;h2 style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;color: #990000;&quot;&gt;CSS Counters:&lt;/span&gt;&lt;span style=&quot;font-weight: normal;&quot;&gt;&lt;/span&gt;&amp;nbsp;&lt;/span&gt;&lt;/h2&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;CSS3 introduces the numbering of HTML elements using CSS Counters. For example, if we need to mention the chapter count with respect to h2 tag - usually we do some JavaScript stuffs to achieve it. But CSS counters done an awesome job to achieve the same.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;/span&gt;&lt;/div&gt;
&lt;i&gt;&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;/span&gt;&lt;/i&gt;&lt;br /&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;/span&gt;&lt;/div&gt;
&lt;h4 style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;b&gt;Initializing the CSS Counter:&lt;/b&gt;&lt;/span&gt;&lt;b&gt;&lt;/b&gt;&lt;/h4&gt;
&lt;b&gt;Syntax&lt;/b&gt;:
&lt;br /&gt;
&lt;pre&gt;&lt;code class=&quot;css&quot;&gt;counter-reset: none|identity [number]&lt;/code&gt;&lt;/pre&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;u&gt;&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;b&gt;Example:&lt;/b&gt;&lt;/span&gt;&lt;/u&gt;&lt;/div&gt;
&lt;pre&gt;&lt;code class=&quot;css&quot;&gt;section{
   counter-reset: chapter;
}&lt;/code&gt;&lt;/pre&gt;
&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;In the above example, &#39;chapter&#39; is a user defined identity that is used for the increment and display purpose. By default the identity is reset to &lt;i&gt;&#39;0&#39;. &#39;none&#39;&amp;nbsp; &lt;/i&gt;will disable the counter&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;h4 style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;b&gt;Incrementing the CSS Counter:&lt;/b&gt;&lt;/span&gt;&lt;/h4&gt;
&lt;b&gt;Syntax&lt;/b&gt;:
&lt;br /&gt;
&lt;pre&gt;&lt;code class=&quot;css&quot;&gt;counter-increment: none|identity [number]&lt;/code&gt;&lt;/pre&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;b&gt;&lt;u&gt;Example&lt;/u&gt;:&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;pre&gt;&lt;code class=&quot;css&quot;&gt;section &amp;gt; h1{
   counter-increment: chapter;
}&lt;/code&gt;&lt;/pre&gt;
&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;i&gt;counter-increment &lt;/i&gt;increments the counter identity by &#39;&lt;i&gt;1&#39; &lt;/i&gt;by default. The increment value can be specified next to the identity. Be aware that you must use &#39;&amp;gt;&#39; in your selector if you have nested lists so that your list numbering doesn&#39;t get incremented at the wrong points. &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;i&gt; &#39;none&#39;&amp;nbsp; &lt;/i&gt;will disable the counter.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;i&gt;&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;b&gt;Note:&lt;/b&gt; IE8 supports the counter-increment property only if a !DOCTYPE is specified. Also, an element that is not displayed (display:none) cannot increment or reset a counter.&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;h4 style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;b&gt;Using the Counter Value:&lt;/b&gt;&lt;/span&gt;&lt;/h4&gt;
&lt;h3&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;We use counter values with pseudo elements for display purpose. The in built &#39;&lt;i&gt;counter&lt;/i&gt;&#39; function will return the current elements increment value with respect to the chapter. The return value can be formatted by passing the following property values as parameter to the &lt;i&gt;counter&lt;/i&gt; function.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;color: #073763;&quot;&gt;decimal &lt;/span&gt;&lt;br /&gt;Decimal numbers, beginning with 1.&lt;/span&gt;&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;color: #073763;&quot;&gt;decimal-leading-zero &lt;/span&gt;&lt;br /&gt;Decimal numbers padded by initial zeros (e.g., 01, 02, 03, ..., 98, 99). &lt;br /&gt;&lt;span style=&quot;color: #073763;&quot;&gt;lower-roman &lt;/span&gt;&lt;br /&gt;Lowercase roman numerals (i, ii, iii, iv, v, etc.). &lt;br /&gt;&lt;span style=&quot;color: #073763;&quot;&gt;upper-roman &lt;/span&gt;&lt;br /&gt;Uppercase roman numerals (I, II, III, IV, V, etc.). &lt;br /&gt;&lt;span style=&quot;color: #073763;&quot;&gt;georgian &lt;/span&gt;&lt;br /&gt;Traditional Georgian numbering (an, ban, gan, ..., he, tan, in, in-an, ...). &lt;br /&gt;&lt;span style=&quot;color: #073763;&quot;&gt;armenian &lt;/span&gt;&lt;br /&gt;Traditional uppercase Armenian numbering.&lt;br /&gt;&lt;span style=&quot;color: #073763;&quot;&gt;lower-latin &lt;/span&gt;or &lt;span style=&quot;color: #073763;&quot;&gt;lower-alpha &lt;/span&gt;&lt;br /&gt;Lowercase ascii letters (a, b, c, ... z). &lt;br /&gt;&lt;span style=&quot;color: #073763;&quot;&gt;upper-latin&lt;/span&gt; or &lt;span style=&quot;color: #073763;&quot;&gt;upper-alpha &lt;/span&gt;&lt;br /&gt;Uppercase ascii letters (A, B, C, ... Z). &lt;br /&gt;&lt;span style=&quot;color: #073763;&quot;&gt;lower-greek &lt;/span&gt;&lt;br /&gt;Lowercase classical Greek alpha, beta, gamma, ... (α, β, γ, ...) &lt;/span&gt;&lt;/i&gt;&lt;br /&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;u&gt;&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;b&gt;Example:&lt;/b&gt;&lt;/span&gt;&lt;/u&gt; &lt;/div&gt;
&lt;pre&gt;&lt;code class=&quot;css&quot;&gt;section{
     counter-reset: chapter;
}
section &amp;gt; h1{
    counter-increment: chapter;
}
section h1:before{
    content:&quot;(Chapter &quot; counter(chapter, upper-roman) &quot;)&quot;
}

ul{
    counter-reset: list;
}
ul &amp;gt; li {
    counter-increment:list;
}
ul li:before{
    content: &quot;(Item &quot; counters(list, &quot;.&quot;) &quot;)&quot;;
}
&lt;/code&gt;&lt;/pre&gt;
&lt;b&gt;&lt;u&gt;&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;b&gt;Output:&lt;/b&gt;&lt;/span&gt;&lt;/u&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgcHoANZjOmH6PKmd-6yLw6fLi8zy4HAL8-j0ruJGxNzJ9vcBABCA71UPeGvqDqT24c-56fF5yzYpOr0WOhYDZhr_szuFfwNotgwl01bORgao2JVrmUJMp0eVApw4TbGya7XK4i1MtksWif/s1600/css+counter.png&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-left: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgcHoANZjOmH6PKmd-6yLw6fLi8zy4HAL8-j0ruJGxNzJ9vcBABCA71UPeGvqDqT24c-56fF5yzYpOr0WOhYDZhr_szuFfwNotgwl01bORgao2JVrmUJMp0eVApw4TbGya7XK4i1MtksWif/s1600/css+counter.png&quot; /&gt;&lt;/a&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt; &lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;font-size: medium;&quot;&gt;&lt;a href=&quot;http://jsfiddle.net/ajai/3vHcw/&quot; target=&quot;_blank&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: x-small;&quot;&gt;Click Here For Demo&lt;/span&gt;&lt;/b&gt;&lt;/a&gt;&lt;/span&gt; &lt;/div&gt;
&lt;h2 style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #990000; font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/h2&gt;
&lt;h2 style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #990000; font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;:empty Pseudo Selector:&lt;/span&gt;&lt;/h2&gt;
&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;The :empty pseudo selector will select empty elements or elements with only comments. This will be helpful in hiding empty elements. &lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;u&gt;&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;b&gt;Example:&lt;/b&gt;&lt;/span&gt;&lt;/u&gt;&lt;/div&gt;
&lt;pre&gt;&lt;code class=&quot;css&quot;&gt;/*CSS*/
div:empty { 
   display: none; 
}
&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code class=&quot;html&quot;&gt;&amp;lt;!--HTML--&amp;gt;
&amp;lt;div&amp;gt;&amp;lt;/div&amp;gt;
&amp;lt;div&amp;gt;&amp;lt;!-- test --&amp;gt;&amp;lt;/div&amp;gt;&lt;/code&gt;&lt;/pre&gt;
&lt;span style=&quot;color: #990000;&quot;&gt;&lt;span style=&quot;background-color: transparent; font-family: &amp;quot;georgia&amp;quot;; font-size: 23px; font-style: normal; font-variant: normal; font-weight: bold; text-decoration: none; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;color: #990000;&quot;&gt;&lt;span style=&quot;background-color: transparent; font-family: &amp;quot;georgia&amp;quot;; font-size: 23px; font-style: normal; font-variant: normal; font-weight: bold; text-decoration: none; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;color: #990000;&quot;&gt;&lt;span style=&quot;background-color: transparent; font-family: &amp;quot;georgia&amp;quot;; font-size: 23px; font-style: normal; font-variant: normal; font-weight: bold; text-decoration: none; vertical-align: baseline;&quot;&gt;&#39;will-change&#39; CSS Property - For Performance&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #990000;&quot;&gt;&lt;span style=&quot;background-color: transparent; font-family: &amp;quot;georgia&amp;quot;; font-size: 23px; font-style: normal; font-variant: normal; font-weight: bold; text-decoration: none; vertical-align: baseline;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;If you tried getting some complex animations and transforms via css3, you might noticed some flickers in the animation in most of the webkit based browsers. Here you might need to understand the term &#39;Hardware acceleration&#39;. &lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;i&gt;Hardware Acceleration&lt;/i&gt; means that the &lt;b&gt;Graphics Processing Unit&lt;/b&gt; (GPU) will assist your browser in rendering a page by doing some of the heavy lifting, instead of throwing it all onto the &lt;b&gt;Central Processing Unit&lt;/b&gt; (CPU) to do.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;a href=&quot;http://www.html5rocks.com/en/tutorials/speed/high-performance-animations/&quot; target=&quot;_blank&quot;&gt;&lt;b&gt;Click here to Read More....&lt;/b&gt;&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;color: #38761d; font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;translateZ() (or translate3d()) Hack:&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;pre&gt;&lt;code class=&quot;css&quot;&gt;transform: translate3d(0, 0, 0);&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;Generally the browser&#39;s 3d rendering is hardware accelerated. So, this hack informs the browser to hardware accelerate the element.&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;Hardware-accelerating an operation results in the creation of what is 
known as a compositor layer that is uploaded to and composited by the 
GPU. However, force-hacking layer creation may not always be the 
solution to certain performance bottlenecks on a page. Layer creation 
techniques can boost page speed, but they come with a cost: they take up
 memory in system RAM and on the GPU (particularly limited on mobile 
devices) and having lots of them can have a bad impact (especially on 
mobile devices), so they must be used wisely and you need to make sure 
that hardware-accelerating your operation will really help the 
performance of your page, and that a performance bottleneck is not being
 caused by another operation on your page.&amp;nbsp;&lt;/span&gt;&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt; &lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;In order to avoid such layer creation hacks, CSS introduces a new property &#39;will-change&#39;, which enables the browser to hardware accelerate the element while performing certain operation that we mention in the property.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;u&gt;&lt;b&gt;Example:&lt;/b&gt;&lt;/u&gt;&lt;/span&gt;&lt;br /&gt;
&lt;pre&gt;&lt;code class=&quot;css&quot;&gt;will-change: transform, opacity;&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;Note: &lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;Don’t Use &lt;i&gt;will-change&lt;/i&gt; to Declare Changes to Too Many Properties or Element, this may lead to browser crash. Example,&lt;/span&gt;&lt;br /&gt;
&lt;pre&gt;&lt;code class=&quot;css&quot;&gt;*,
*::before,
*::after {
 will-change: all;
}&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;h2 dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 4pt; margin-top: 18pt;&quot;&gt;
&lt;span style=&quot;color: #990000;&quot;&gt;&lt;span style=&quot;background-color: transparent; font-family: &amp;quot;georgia&amp;quot;; font-size: 23px; font-style: normal; font-variant: normal; font-weight: bold; text-decoration: none; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/h2&gt;
&lt;h2 dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 4pt; margin-top: 18pt;&quot;&gt;
&lt;span style=&quot;color: #990000;&quot;&gt;&lt;span style=&quot;background-color: transparent; font-family: &amp;quot;georgia&amp;quot;; font-size: 23px; font-style: normal; font-variant: normal; font-weight: bold; text-decoration: none; vertical-align: baseline;&quot;&gt;New CSS3 Cursors&lt;span style=&quot;background-color: transparent; color: black; font-family: &amp;quot;georgia&amp;quot;; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/h2&gt;
&lt;h2 dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 4pt; margin-top: 18pt;&quot;&gt;
&lt;span style=&quot;color: #990000;&quot;&gt;&lt;span style=&quot;background-color: transparent; font-family: &amp;quot;georgia&amp;quot;; font-size: 23px; font-style: normal; font-variant: normal; font-weight: bold; text-decoration: none; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: &amp;quot;georgia&amp;quot;; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;&quot;&gt;Mouse over the list to view cursors,&lt;/span&gt; &lt;/span&gt;&lt;/span&gt;&lt;/h2&gt;
&lt;ol style=&quot;margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;li dir=&quot;ltr&quot; style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; list-style-type: decimal; text-decoration: none; vertical-align: baseline;&quot;&gt;&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: #ffd966; color: blue; font-family: &amp;quot;courier new&amp;quot;; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;&quot;&gt;none&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li dir=&quot;ltr&quot; style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; list-style-type: decimal; text-decoration: none; vertical-align: baseline;&quot;&gt;&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: #ffd966; color: blue; font-family: &amp;quot;courier new&amp;quot;; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;&quot;&gt;context-menu&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li dir=&quot;ltr&quot; style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; list-style-type: decimal; text-decoration: none; vertical-align: baseline;&quot;&gt;&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: #ffd966; color: blue; font-family: &amp;quot;courier new&amp;quot;; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;&quot;&gt;cell&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li dir=&quot;ltr&quot; style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; list-style-type: decimal; text-decoration: none; vertical-align: baseline;&quot;&gt;&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: #ffd966; color: blue; cursor: vertical-text; font-family: &amp;quot;courier new&amp;quot;; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;&quot;&gt;vertical-text&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li dir=&quot;ltr&quot; style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; list-style-type: decimal; text-decoration: none; vertical-align: baseline;&quot;&gt;&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: #ffd966; color: blue; font-family: &amp;quot;courier new&amp;quot;; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;&quot;&gt;alias&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li dir=&quot;ltr&quot; style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; list-style-type: decimal; text-decoration: none; vertical-align: baseline;&quot;&gt;&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: #ffd966; color: blue; font-family: &amp;quot;courier new&amp;quot;; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;&quot;&gt;copy&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li dir=&quot;ltr&quot; style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; list-style-type: decimal; text-decoration: none; vertical-align: baseline;&quot;&gt;&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: #ffd966; color: blue; cursor: no-drop; font-family: &amp;quot;courier new&amp;quot;; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;&quot;&gt;no-drop&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li dir=&quot;ltr&quot; style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; list-style-type: decimal; text-decoration: none; vertical-align: baseline;&quot;&gt;&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: #ffd966; color: blue; cursor: not-allowed; font-family: &amp;quot;courier new&amp;quot;; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;&quot;&gt;not-allowed&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li dir=&quot;ltr&quot; style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; list-style-type: decimal; text-decoration: none; vertical-align: baseline;&quot;&gt;&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: #ffd966; color: blue; cursor: col-resize; font-family: &amp;quot;courier new&amp;quot;; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;&quot;&gt;col-resize&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li dir=&quot;ltr&quot; style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; list-style-type: decimal; text-decoration: none; vertical-align: baseline;&quot;&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: #ffd966; color: blue; cursor: row-resize; font-family: &amp;quot;courier new&amp;quot;; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;&quot;&gt;row-resize&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li dir=&quot;ltr&quot; style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; list-style-type: decimal; text-decoration: none; vertical-align: baseline;&quot;&gt;&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: #ffd966; color: blue; cursor: all-scroll; font-family: &amp;quot;courier new&amp;quot;; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;&quot;&gt;all-scroll&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li dir=&quot;ltr&quot; style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; list-style-type: decimal; text-decoration: none; vertical-align: baseline;&quot;&gt;&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: #ffd966; color: blue; font-family: &amp;quot;courier new&amp;quot;; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;&quot;&gt;zoom-in&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li dir=&quot;ltr&quot; style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; list-style-type: decimal; text-decoration: none; vertical-align: baseline;&quot;&gt;&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: #ffd966; color: blue; font-family: &amp;quot;courier new&amp;quot;; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;&quot;&gt;zoom-out&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;br /&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: &amp;quot;georgia&amp;quot;; font-size: 15px; font-style: normal; font-variant: normal; font-weight: bold; text-decoration: none; vertical-align: baseline;&quot;&gt;Browser support:&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #3d85c6; font-family: &amp;quot;georgia&amp;quot;; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;&quot;&gt;FIREFOX &lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: &amp;quot;georgia&amp;quot;; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;&quot;&gt;- All supported. &lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: &amp;quot;georgia&amp;quot;; font-size: 15px; font-style: italic; font-variant: normal; font-weight: bold; text-decoration: none; vertical-align: baseline;&quot;&gt;Issue:&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: &amp;quot;georgia&amp;quot;; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;&quot;&gt; no-drop same as not-allowed&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #3d85c6; font-family: &amp;quot;georgia&amp;quot;; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;&quot;&gt;IE &lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: &amp;quot;georgia&amp;quot;; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;&quot;&gt;- Doesn&#39;t support none, context-menu, cell, alias, copy, zoom-in/out.&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #3d85c6; font-family: &amp;quot;georgia&amp;quot;; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;&quot;&gt;OPERA &lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: &amp;quot;georgia&amp;quot;; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;&quot;&gt;- Only supports col-resize, row-resize, all-scroll and zoom-in/out on Windows&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #3d85c6; font-family: &amp;quot;georgia&amp;quot;; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;&quot;&gt;SAFARI &lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: &amp;quot;georgia&amp;quot;; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;&quot;&gt;- All supported&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #3d85c6; font-family: &amp;quot;georgia&amp;quot;; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;&quot;&gt;CHROME &lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: &amp;quot;georgia&amp;quot;; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;&quot;&gt;- All supported&lt;/span&gt;&lt;/div&gt;
&lt;h2 dir=&quot;ltr&quot; style=&quot;line-height: 1.15; margin-bottom: 4pt; margin-top: 18pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: &amp;quot;georgia&amp;quot;; font-size: 23px; font-style: normal; font-variant: normal; font-weight: bold; text-decoration: none; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;color: #990000;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/h2&gt;
&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;font-weight: normal;&quot;&gt; &lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://ownmycode.blogspot.com/feeds/122642048768656295/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ownmycode.blogspot.com/2014/06/things-you-may-not-know-about-css.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3063939708578051703/posts/default/122642048768656295'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3063939708578051703/posts/default/122642048768656295'/><link rel='alternate' type='text/html' href='http://ownmycode.blogspot.com/2014/06/things-you-may-not-know-about-css.html' title='Things you may not know about CSS'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://lh6.googleusercontent.com/B5034b2ddh2aNH3ct2evVL2tRx-B8KxiShEW4xUVjKE4Lccg5yksA4SV4E01u3OHIxQe7LEqh0HkcfyXy2wDwgHEB9wzxwAnSqgIos1NQHdipWXXLi60qRjaJ_NKMsQPVQ=s72-c" height="72" width="72"/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3063939708578051703.post-1587884266935331234</id><published>2014-06-11T20:35:00.000+05:30</published><updated>2017-03-28T11:49:19.650+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Javascript Tricks"/><title type='text'>Javascript - Some Useful Tips &amp; Tricks</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;h2 style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #990000;&quot;&gt;
Use window.name for simple session handling&lt;/span&gt;&lt;/h2&gt;
&lt;i style=&quot;font-family: georgia, &amp;quot;times new roman&amp;quot;, serif; font-size: medium;&quot;&gt;&lt;span style=&quot;color: #558ed5;&quot;&gt;window&lt;/span&gt;&lt;/i&gt;&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: small;&quot;&gt;
object has its own property &#39;name&#39;. The name of the window is used primarily for
setting targets for hyperlinks and forms. Windows do not need to have names.
With this property we can achieve simple session storage. Browser preserves the
property value (&lt;/span&gt;&lt;i style=&quot;font-family: georgia, &amp;quot;times new roman&amp;quot;, serif; font-size: medium;&quot;&gt;window.name&lt;/i&gt;&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: small;&quot;&gt;) until
the window/tab is closed.&lt;/span&gt;&lt;b style=&quot;font-family: georgia, &amp;quot;times new roman&amp;quot;, serif; font-size: medium;&quot;&gt;&lt;span style=&quot;line-height: 115%;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/b&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;h2 style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #990000;&quot;&gt;
Labels&lt;/span&gt;&lt;/h2&gt;
&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;You can use a label to identify a loop, and then use the &lt;/span&gt;&lt;i style=&quot;font-family: georgia, &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;&lt;span style=&quot;color: #558ed5;&quot;&gt;break&lt;/span&gt;&lt;/i&gt;&lt;span style=&quot;color: #558ed5; font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;or &lt;/span&gt;&lt;i style=&quot;font-family: georgia, &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;&lt;span style=&quot;color: #558ed5;&quot;&gt;continue&lt;/span&gt;&lt;/i&gt;&lt;span style=&quot;color: #558ed5; font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;statements
to indicate whether a program should interrupt the loop or continue its execution.&lt;/span&gt;&lt;/div&gt;
&lt;pre&gt;&lt;code class=&quot;js&quot;&gt;var i, j;

loop1:
for (i = 0; i &amp;lt; 3; i++) {      //The first for statement is labeled &quot;loop1&quot;
   loop2:
   for (j = 0; j &amp;lt; 3; j++) {   //The second for statement is labeled &quot;loop2&quot;
      if (i === 1 &amp;amp;&amp;amp; j === 1) {
         continue loop1;
      }
      console.log(&#39;i = &#39; + i + &#39;, j = &#39; + j);
   }
}

// Output is:
//   &quot;i = 0, j = 0&quot;
//   &quot;i = 0, j = 1&quot;
//   &quot;i = 0, j = 2&quot;
//   &quot;i = 1, j = 0&quot;
//   &quot;i = 2, j = 0&quot;
//   &quot;i = 2, j = 1&quot;
//   &quot;i = 2, j = 2&quot;
// Notice how it skips both &quot;i = 1, j = 1&quot; and &quot;i = 1, j = 2&quot;
&lt;/code&gt;&lt;/pre&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-attachment: scroll; background-clip: initial; background-image: none; background-origin: initial; background-position: 0% 0%; background-repeat: repeat; background-size: initial;&quot;&gt;
&lt;br /&gt;
&lt;h2 style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #990000;&quot;&gt;
Know more about typeof, instanceof and constructor:&lt;/span&gt;&lt;/h2&gt;
&lt;i style=&quot;background-color: transparent; font-family: georgia, &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;&lt;span style=&quot;color: #00b0f0;&quot;&gt;typeof:&lt;/span&gt;&lt;/i&gt;&lt;span style=&quot;background-color: transparent; font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt; An operator – returns a string
indicating the type of the unevaluated operand.&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: small;&quot;&gt;

&lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;MsoListParagraphCxSpLast&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: small;&quot;&gt;Note: &lt;i&gt;&lt;span style=&quot;color: #558ed5;&quot;&gt;typeof&lt;/span&gt;&lt;/i&gt;&lt;span style=&quot;color: #558ed5;&quot;&gt; &lt;/span&gt;&lt;i&gt;&lt;span style=&quot;color: #c0504d;&quot;&gt;null&lt;/span&gt;&lt;/i&gt;&lt;span style=&quot;color: #c0504d;&quot;&gt; &lt;/span&gt;will
return &lt;span style=&quot;color: #c0504d; line-height: 115%;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #c0504d;&quot;&gt;object&lt;/span&gt;&lt;span style=&quot;color: #c0504d; line-height: 115%;&quot;&gt;&quot;&lt;/span&gt;, and for most of the object
types (Array, Date, Number, Function, String …) will return &lt;span style=&quot;color: #c0504d;&quot;&gt;&quot;object&quot;&lt;/span&gt;. On IE
6, 7, and 8 a lot of host objects are objects and not functions. For example: &lt;i&gt;&lt;span style=&quot;color: #558ed5;&quot;&gt;typeof &lt;/span&gt;&lt;span style=&quot;color: #c0504d;&quot;&gt;alert === &#39;object&#39;&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraphCxSpLast&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: small;&quot;&gt;

&lt;/span&gt;&lt;br /&gt;
&lt;table border=&quot;1&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;MsoTableMediumGrid1Accent5&quot; style=&quot;border-collapse: collapse; border: medium none; margin-left: 40.85pt; width: 552px;&quot;&gt;
 &lt;tbody&gt;
&lt;tr style=&quot;height: 18.2pt;&quot;&gt;
  &lt;td style=&quot;background: none repeat scroll 0% 0% rgb(210, 234, 241); border: 1pt solid rgb(120, 192, 212); height: 18.2pt; padding: 0cm 5.4pt;&quot; valign=&quot;top&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 115%; margin-bottom: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: small;&quot;&gt;&lt;b&gt;&lt;span style=&quot;line-height: 115%;&quot;&gt;Type&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;background: none repeat scroll 0% 0% rgb(210, 234, 241); border: 1pt solid rgb(120, 192, 212); height: 18.2pt; padding: 0cm 5.4pt;&quot; valign=&quot;top&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 115%; margin-bottom: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: small;&quot;&gt;&lt;b&gt;&lt;span style=&quot;line-height: 115%;&quot;&gt;Result&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
 &lt;/tr&gt;
&lt;tr style=&quot;height: 18.2pt;&quot;&gt;
  &lt;td style=&quot;background: none repeat scroll 0% 0% rgb(165, 213, 226); border: 1pt solid rgb(120, 192, 212); height: 18.2pt; padding: 0cm 5.4pt;&quot; valign=&quot;top&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 115%; margin-bottom: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;i&gt;&lt;span style=&quot;line-height: 115%;&quot;&gt;Undefined&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;background: none repeat scroll 0% 0% rgb(165, 213, 226); border-color: -moz-use-text-color rgb(120, 192, 212) rgb(120, 192, 212) -moz-use-text-color; border-style: none solid solid none; border-width: medium 1pt 1pt medium; height: 18.2pt; padding: 0cm 5.4pt;&quot; valign=&quot;top&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 115%; margin-bottom: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;line-height: 115%;&quot;&gt;&quot;undefined&quot;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
 &lt;/tr&gt;
&lt;tr style=&quot;height: 18.2pt;&quot;&gt;
  &lt;td style=&quot;background: none repeat scroll 0% 0% rgb(210, 234, 241); border: 1pt solid rgb(120, 192, 212); height: 18.2pt; padding: 0cm 5.4pt;&quot; valign=&quot;top&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 115%; margin-bottom: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;i&gt;&lt;span style=&quot;line-height: 115%;&quot;&gt;Null&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;background: none repeat scroll 0% 0% rgb(210, 234, 241); border-color: -moz-use-text-color rgb(120, 192, 212) rgb(120, 192, 212) -moz-use-text-color; border-style: none solid solid none; border-width: medium 1pt 1pt medium; height: 18.2pt; padding: 0cm 5.4pt;&quot; valign=&quot;top&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 115%; margin-bottom: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;line-height: 115%;&quot;&gt;&quot;object&quot;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
 &lt;/tr&gt;
&lt;tr style=&quot;height: 18.2pt;&quot;&gt;
  &lt;td style=&quot;background: none repeat scroll 0% 0% rgb(165, 213, 226); border: 1pt solid rgb(120, 192, 212); height: 18.2pt; padding: 0cm 5.4pt;&quot; valign=&quot;top&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 115%; margin-bottom: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;i&gt;&lt;span style=&quot;line-height: 115%;&quot;&gt;Boolean&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;background: none repeat scroll 0% 0% rgb(165, 213, 226); border-color: -moz-use-text-color rgb(120, 192, 212) rgb(120, 192, 212) -moz-use-text-color; border-style: none solid solid none; border-width: medium 1pt 1pt medium; height: 18.2pt; padding: 0cm 5.4pt;&quot; valign=&quot;top&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 115%; margin-bottom: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;line-height: 115%;&quot;&gt;&quot;boolean&quot;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
 &lt;/tr&gt;
&lt;tr style=&quot;height: 18.2pt;&quot;&gt;
  &lt;td style=&quot;background: none repeat scroll 0% 0% rgb(210, 234, 241); border: 1pt solid rgb(120, 192, 212); height: 18.2pt; padding: 0cm 5.4pt;&quot; valign=&quot;top&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 115%; margin-bottom: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;i&gt;&lt;span style=&quot;line-height: 115%;&quot;&gt;Number&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;background: none repeat scroll 0% 0% rgb(210, 234, 241); border-color: -moz-use-text-color rgb(120, 192, 212) rgb(120, 192, 212) -moz-use-text-color; border-style: none solid solid none; border-width: medium 1pt 1pt medium; height: 18.2pt; padding: 0cm 5.4pt;&quot; valign=&quot;top&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 115%; margin-bottom: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;line-height: 115%;&quot;&gt;&quot;number&quot;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
 &lt;/tr&gt;
&lt;tr style=&quot;height: 18.2pt;&quot;&gt;
  &lt;td style=&quot;background: none repeat scroll 0% 0% rgb(165, 213, 226); border: 1pt solid rgb(120, 192, 212); height: 18.2pt; padding: 0cm 5.4pt;&quot; valign=&quot;top&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 115%; margin-bottom: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;i&gt;&lt;span style=&quot;line-height: 115%;&quot;&gt;String&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;background: none repeat scroll 0% 0% rgb(165, 213, 226); border-color: -moz-use-text-color rgb(120, 192, 212) rgb(120, 192, 212) -moz-use-text-color; border-style: none solid solid none; border-width: medium 1pt 1pt medium; height: 18.2pt; padding: 0cm 5.4pt;&quot; valign=&quot;top&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 115%; margin-bottom: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;line-height: 115%;&quot;&gt;&quot;string&quot;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
 &lt;/tr&gt;
&lt;tr style=&quot;height: 18.2pt;&quot;&gt;
  &lt;td style=&quot;background: none repeat scroll 0% 0% rgb(210, 234, 241); border: 1pt solid rgb(120, 192, 212); height: 18.2pt; padding: 0cm 5.4pt;&quot; valign=&quot;top&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 115%; margin-bottom: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;i&gt;&lt;span style=&quot;line-height: 115%;&quot;&gt;Host object (provided by the JS environment)&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;background: none repeat scroll 0% 0% rgb(210, 234, 241); border-color: -moz-use-text-color rgb(120, 192, 212) rgb(120, 192, 212) -moz-use-text-color; border-style: none solid solid none; border-width: medium 1pt 1pt medium; height: 18.2pt; padding: 0cm 5.4pt;&quot; valign=&quot;top&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 115%; margin-bottom: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;line-height: 115%;&quot;&gt;Implementation-dependent&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
 &lt;/tr&gt;
&lt;tr style=&quot;height: 18.2pt;&quot;&gt;
  &lt;td style=&quot;background: none repeat scroll 0% 0% rgb(165, 213, 226); border: 1pt solid rgb(120, 192, 212); height: 18.2pt; padding: 0cm 5.4pt;&quot; valign=&quot;top&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 115%; margin-bottom: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;i&gt;&lt;span style=&quot;line-height: 115%;&quot;&gt;Function object (implements [[Call]] in ECMA-262
  terms)&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;background: none repeat scroll 0% 0% rgb(165, 213, 226); border-color: -moz-use-text-color rgb(120, 192, 212) rgb(120, 192, 212) -moz-use-text-color; border-style: none solid solid none; border-width: medium 1pt 1pt medium; height: 18.2pt; padding: 0cm 5.4pt;&quot; valign=&quot;top&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 115%; margin-bottom: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;line-height: 115%;&quot;&gt;&quot;function&quot;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
 &lt;/tr&gt;
&lt;tr style=&quot;height: 18.2pt;&quot;&gt;
  &lt;td style=&quot;background: none repeat scroll 0% 0% rgb(210, 234, 241); border: 1pt solid rgb(120, 192, 212); height: 18.2pt; padding: 0cm 5.4pt;&quot; valign=&quot;top&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 115%; margin-bottom: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;i&gt;&lt;span style=&quot;line-height: 115%;&quot;&gt;Any other object&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;background: none repeat scroll 0% 0% rgb(210, 234, 241); border-color: -moz-use-text-color rgb(120, 192, 212) rgb(120, 192, 212) -moz-use-text-color; border-style: none solid solid none; border-width: medium 1pt 1pt medium; height: 18.2pt; padding: 0cm 5.4pt;&quot; valign=&quot;top&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 115%; margin-bottom: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;line-height: 115%;&quot;&gt;&quot;object&quot;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
 &lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: small;&quot;&gt;

&lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: 36pt;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: small;&quot;&gt;&lt;span style=&quot;color: #a6a6a6; line-height: 115%;&quot;&gt;&amp;nbsp;Ref: &lt;i&gt;https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/typeof&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: small;&quot;&gt;&lt;i&gt;&lt;span style=&quot;color: #00b0f0;&quot;&gt;&lt;b&gt;constructor:&lt;/b&gt;&lt;/span&gt;&lt;/i&gt; A reference to the function that
created an object. All objects inherit a constructor property from their
prototype and it can be changed programmatically&lt;i&gt;&lt;span style=&quot;color: #00b0f0;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;&lt;i&gt;&lt;span style=&quot;color: #00b0f0;&quot;&gt;instanceof:&lt;/span&gt;&lt;/i&gt; &lt;/b&gt;An operator - &amp;nbsp;which tests presence of constructor.prototype
in object prototype chain.&lt;span style=&quot;color: #a6a6a6;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;pre&gt;&lt;code class=&quot;js&quot;&gt;//EXAMPLE
var obj = {},
arr= [],
d = new Date(),
f1 = new Function(),
f2 = function(){},
s1 =&quot;a string&quot;,
s2 = new String(),
n1 = new Number(5),
n2 = 5,
n3 = 3.14;
typeof obj //return &quot;object&quot;
typeof arr //return &quot;object&quot;
typeof d //return &quot;object&quot;
typeof f1 //return &quot;function&quot;
typeof f2 //return &quot;function&quot;
typeof s1 //return &quot;string&quot;
typeof s2 //return &quot;object&quot;
typeof n1 //return &quot;object&quot;
typeof n2 //return &quot;number&quot;
typeof n3 //return &quot;number&quot;
obj instanceof Object //return true
arr instanceof Array //return true
arr instanceof Object //return true
d instanceof Object //return true
d instanceof Date //return true
f1 instanceof Object //return true
f1 instanceof Function //return true
f2 instanceof Function //return true
f2 instanceof Object //return true
s1 instanceof Object //return false
s1 instanceof String //return false
s2 instanceof Object //return true
s2 instanceof String //return true
n1 instanceof Object //return true
n1 instanceof Number //return true
n2 instanceof Object //return false
n2 instanceof Number //return false
n3 instanceof Object //return false
n3 instanceof Number //return false
obj.constructor()//return Object {}
arr.constructor()//return []
d.constructor()//return &quot;(current date)&quot;
f1.constructor()//return function anonymous() { }
f2.constructor()//return function anonymous() { }

s1.constructor()//return &quot;&quot;
s2.constructor()//return &quot;&quot;

n1.constructor()//return 0
n2.constructor()//return 0
n3.constructor()//return 0&lt;/code&gt;&lt;/pre&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;h2 style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #990000;&quot;&gt;
Shuffle an array&lt;/span&gt;&lt;/h2&gt;
&lt;pre&gt;&lt;code class=&quot;js&quot;&gt;var arr = [“a”, “b”, 1, 100, 5, 10, 200, 458, 98];
arr = arr.sort(function(){ return Math.random() - 0.5});&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;
&lt;h2 style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #990000;&quot;&gt;
Get a random item from an array&lt;/span&gt;&lt;/h2&gt;
&lt;pre&gt;&lt;code class=&quot;js&quot;&gt;var arr = [1,5,6,7,4,3,9,”a”,”xyz”];
var  randomItem = arr[Math.floor(Math.random() * arr.length)];&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;h2 style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #990000;&quot;&gt;
Max and Min values in an array of numbers&lt;br /&gt; &lt;/span&gt;&lt;/h2&gt;
&lt;pre&gt;&lt;code class=&quot;js&quot;&gt;var arr = [1, 100, 5, 10, 200, 458, 98];
var max = Math.max.apply(Math, arr); 
var min = Math.min.apply(Math, arr); &lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
&lt;h2 style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #990000;&quot;&gt;
Variable conversion shortcuts&lt;br /&gt; &lt;/span&gt;&lt;/h2&gt;
&lt;pre&gt;&lt;code class=&quot;js&quot;&gt;var x = &quot;1.592&quot;,
//to string
str = &quot;&quot;+ x,

//to integer
int = ~~x,  

//to float
float = 1*x,

//to boolean
bool = !!x,

//to array
array = [x]; &lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
&lt;h2 style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #990000;&quot;&gt;
‘yield’ Keyword:&lt;/span&gt;&lt;/h2&gt;
&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;JavaScript 1.7+ &lt;/span&gt;&lt;i style=&quot;font-family: georgia, &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;supports &lt;/i&gt;&lt;i style=&quot;font-family: georgia, &amp;quot;times new roman&amp;quot;, serif;&quot;&gt;&lt;span style=&quot;color: #558ed5; line-height: 115%;&quot;&gt;yield&lt;/span&gt;&lt;/i&gt;&lt;span style=&quot;color: #558ed5; font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; line-height: 115%;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; line-height: 115%;&quot;&gt;keyword, which is
used to suspend execution of a function. Only firefox supports this option for now.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;&lt;code class=&quot;js&quot;&gt;function currentLoop(){
  var i = 0;
  while(true){
    i++;
    yield i;
  }
}

var g= currentLoop();

g.next(); //return 1
g.next(); //return 2
g.next(); //return 3
g.next(); //return 4 &lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-size: x-large;&quot;&gt;&lt;span style=&quot;color: #93c47d;&quot;&gt;&lt;a href=&quot;http://ownmycode.blogspot.in/2012/12/base-conversion-in-javascript.html&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;b&gt;&lt;span style=&quot;line-height: 115%;&quot;&gt;Base conversion in javascript [...]&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://ownmycode.blogspot.com/feeds/1587884266935331234/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ownmycode.blogspot.com/2014/06/javascript-some-useful-tips-tricks.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3063939708578051703/posts/default/1587884266935331234'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3063939708578051703/posts/default/1587884266935331234'/><link rel='alternate' type='text/html' href='http://ownmycode.blogspot.com/2014/06/javascript-some-useful-tips-tricks.html' title='Javascript - Some Useful Tips &amp; Tricks'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3063939708578051703.post-8123169639301391930</id><published>2014-05-31T17:36:00.003+05:30</published><updated>2017-03-28T12:00:51.188+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="AngularJs"/><category scheme="http://www.blogger.com/atom/ns#" term="Javascript Tricks"/><category scheme="http://www.blogger.com/atom/ns#" term="PHP"/><title type='text'>Using Angular with Laravel / Conflict between Laravel Blade and Angular</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;h3 style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #990000; font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;The Conflict:&lt;/span&gt;&lt;/h3&gt;
&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;Peoples who are using Laravel and AngularJs may know, Laravel’s Blade templating engine and AngularJs uses the same markup when displaying variables &lt;/span&gt;&lt;br /&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;pre&gt;&lt;code class=&quot;js&quot;&gt;{{ variableName }}&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;
&lt;h3&gt;
&lt;span style=&quot;color: #990000; font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;Solution 1 (Laravel):&lt;/span&gt;&lt;/h3&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;Laravel Blade template engine comes with an option to change the literal tags. so if you want to keep the angular syntax, then include the following code in&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: #eeeeee; color: #f4645f; font-family: , monospace; font-size: 13px; line-height: 21px;&quot;&gt;app/routes.php&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;background-color: #eeeeee; color: #f4645f; font-family: , monospace; font-size: 13px; line-height: 21px;&quot;&gt;&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;pre&gt;&lt;code class=&quot;js&quot;&gt;//general syntax
Blade::setContentTags(&#39;&amp;lt;%&#39;, &#39;%&amp;gt;&#39;); 

//for escaped data: 
Blade::setEscapedContentTags(&#39;&amp;lt;%%&#39;, &#39;%%&amp;gt;&#39;);&lt;/code&gt;&lt;/pre&gt;
&lt;div&gt;
&lt;h3&gt;
&lt;span style=&quot;color: #990000; font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;Solution 2 (AngularJs):&lt;/span&gt;&lt;/h3&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;AngularJs comes with an option to change the literal tags using &lt;/span&gt;&lt;span style=&quot;background-color: #eeeeee; color: #f4645f; font-family: , monospace; font-size: 13px; line-height: 21px;&quot;&gt;$interpolateProvider&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;It should be declared within your module.&lt;/span&gt;&lt;br /&gt;
&lt;pre&gt;&lt;code class=&quot;js&quot;&gt;angular.module(&#39;MyApp&#39;, [], function($interpolateProvider) {
        $interpolateProvider.startSymbol(&#39;&lt;%&#39;);
        $interpolateProvider.endSymbol(&#39;%&gt;&#39;);
});&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://ownmycode.blogspot.com/feeds/8123169639301391930/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ownmycode.blogspot.com/2014/05/using-angular-with-laravel-conflict.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3063939708578051703/posts/default/8123169639301391930'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3063939708578051703/posts/default/8123169639301391930'/><link rel='alternate' type='text/html' href='http://ownmycode.blogspot.com/2014/05/using-angular-with-laravel-conflict.html' title='Using Angular with Laravel / Conflict between Laravel Blade and Angular'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3063939708578051703.post-7300102910963784020</id><published>2014-02-22T02:08:00.002+05:30</published><updated>2017-03-28T11:53:11.111+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Javascript Tricks"/><title type='text'>A fair play with Maths and JQuery Animation</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
This is a new try with the simple maths that we already know. I have used basic trigonometric equations and JQuery animation for the play.&lt;br /&gt;
&lt;br /&gt;
&lt;h3 style=&quot;text-align: left;&quot;&gt;
&lt;a href=&quot;http://jsfiddle.net/ajai/6ehse/&quot; target=&quot;_blank&quot;&gt;DEMO&lt;/a&gt;&lt;/h3&gt;
&lt;div&gt;
&lt;b&gt;Demo Explained:&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;ol style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;Create set of div and append it to the body&lt;br /&gt;
&lt;pre&gt;&lt;code class=&quot;js&quot;&gt;for (var i = 0; i &amp;lt; 360; i++) {
    //random color
    var color = &#39;#&#39;+parseInt(Math.random()*0xccccc);
    //create and append DOM
    $(&#39;&amp;lt;div/&amp;gt;&#39;).appendTo(&#39;body&#39;).css(&#39;background&#39;,color);
}
&lt;/code&gt;
&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;For random positioning use &lt;i&gt;&lt;span style=&quot;color: #0b5394;&quot;&gt;Math.random()&lt;/span&gt;&lt;/i&gt; to generate random x,y values&lt;br /&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjMMkttc2DqHtqNh1IEmFMZ76O759ON9ckh0VQArYmqvLjCTMd6j66HyKZg1RQSZmUQ17Tizm9iDZBp4dXeB4g8JbP4M3Mxd1IP6uFSy0rrmjEWVUTqBRleR7RBgCCSMw1WAtybBLih0Jel/s1600/random.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em; text-align: center;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;310&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjMMkttc2DqHtqNh1IEmFMZ76O759ON9ckh0VQArYmqvLjCTMd6j66HyKZg1RQSZmUQ17Tizm9iDZBp4dXeB4g8JbP4M3Mxd1IP6uFSy0rrmjEWVUTqBRleR7RBgCCSMw1WAtybBLih0Jel/s1600/random.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;
&lt;pre&gt;&lt;code class=&quot;js&quot;&gt;for (var i = 0; i &amp;lt; 360; i++) {
        var left = 100 + Math.random() * 300 + &#39;px&#39;;
        var top = 100 + Math.random() * 300 + &#39;px&#39;;
        $(&#39;div&#39;).eq(i).animate({left:left,top:top},1000);
}
&lt;/code&gt;
&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;To draw &lt;i&gt;circle&lt;/i&gt;,&lt;br /&gt;&lt;span style=&quot;color: #0b5394;&quot;&gt;&lt;i&gt;x = tx &lt;/i&gt;&lt;/span&gt;&lt;complete id=&quot;goog_1037483407&quot; style=&quot;color: #0b5394; font-style: italic;&quot;&gt;+&lt;/complete&gt;&lt;span style=&quot;color: #0b5394;&quot;&gt;&lt;i&gt;&amp;nbsp;r cos(t)&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #0b5394;&quot;&gt;&lt;i&gt;y = ty&amp;nbsp;+ r sin(t)&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;so looping through &lt;span style=&quot;color: #0b5394; font-style: italic;&quot;&gt;t &lt;/span&gt;value from 0 to 360 will generate &lt;i&gt;circle&lt;/i&gt;
&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjGgQBVniPi-p856OzAHJB0sss8dkJnfSMAcibJ3et1H-aR79Jsz0sWdiXpNeU1wQj9YgY96izyWvFzClRtzSefJUldfwr0Mon6XIjD1i2nnV5usfZf6mVstYMPff10XG_5-Ah3CSYpc5gK/s1600/circle.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em; text-align: center;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;311&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjGgQBVniPi-p856OzAHJB0sss8dkJnfSMAcibJ3et1H-aR79Jsz0sWdiXpNeU1wQj9YgY96izyWvFzClRtzSefJUldfwr0Mon6XIjD1i2nnV5usfZf6mVstYMPff10XG_5-Ah3CSYpc5gK/s1600/circle.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;pre&gt;&lt;code class=&quot;js&quot;&gt;for (var i = 0; i &amp;lt; 360; i++) {
        r = 150;
        var left = 400 + r*Math.cos(i);
        var top = 200 + r*Math.sin(i);
        $(&#39;div&#39;).eq(i).animate({left:left,top:top},1000);              
    }
&lt;/code&gt;
&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;To draw &lt;i&gt;sine wave,&lt;br /&gt;&lt;span style=&quot;color: #0b5394;&quot;&gt;y = constant&lt;br /&gt;x = tx&amp;nbsp;+ r sin(t)&lt;br /&gt;&lt;span style=&quot;color: black; font-style: normal;&quot;&gt;so looping through&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #0b5394;&quot;&gt;t&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black; font-style: normal;&quot;&gt;value from 0 to 360 will generate&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; sine wave&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;
&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj2D_wnCwwDpq1lOVH2ptlQ4JbLd_4NHJmvbdFbkKpTf5ybheKAOrVgt48HQCPSrFdtY6DItvt1JQ1UxEKwxsO9Ica4EQAFKoYW-cJuxuMva9y8xxa-EFX2NYMq_ncba6Vt8BQ-3gtq2xeI/s1600/sinwave.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em; text-align: center;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;26&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj2D_wnCwwDpq1lOVH2ptlQ4JbLd_4NHJmvbdFbkKpTf5ybheKAOrVgt48HQCPSrFdtY6DItvt1JQ1UxEKwxsO9Ica4EQAFKoYW-cJuxuMva9y8xxa-EFX2NYMq_ncba6Vt8BQ-3gtq2xeI/s1600/sinwave.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;
&lt;pre&gt;&lt;code class=&quot;js&quot;&gt;for (var i = 0; i &amp;lt; 360; i++) {
        r = 100;
        var left = i*10;
        var top = 300 + 10 * Math.sin(i);
        $(&#39;div&#39;).eq(i).animate({left:left,top:top},1000);              
    }
&lt;/code&gt;
&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;To draw&amp;nbsp;&lt;i&gt;cos wave,&lt;br /&gt;&lt;span style=&quot;color: #0b5394;&quot;&gt;y = constant&lt;br /&gt;x = tx&amp;nbsp;+ r cos(t)&lt;br /&gt;&lt;span style=&quot;color: black; font-style: normal;&quot;&gt;so looping through&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #0b5394;&quot;&gt;t&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black; font-style: normal;&quot;&gt;value from 0 to 360 will generate&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;cos wave&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;
&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiRfjAjkPI_NE9Sd1kkhVai0i-14dQ7xskUJAoGwdN1hoR3irup7F46nDGC5hTV6fmUlzY5Dkb9aRndDLCQ9hyphenhyphenf2sDlk9MJkmLDiFVgsq45fFpziQRdsfb4zJ5VaajMJMqFsHLu0OgG9o7o/s1600/coswave.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em; text-align: center;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;39&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiRfjAjkPI_NE9Sd1kkhVai0i-14dQ7xskUJAoGwdN1hoR3irup7F46nDGC5hTV6fmUlzY5Dkb9aRndDLCQ9hyphenhyphenf2sDlk9MJkmLDiFVgsq45fFpziQRdsfb4zJ5VaajMJMqFsHLu0OgG9o7o/s1600/coswave.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;
&lt;pre&gt;&lt;code class=&quot;js&quot;&gt;for (var i = 0; i &amp;lt; 360; i++) {
        var left = i*10;
        var top = 300 + 10 * Math.cos(i);
        $(&#39;div&#39;).eq(i).animate({left:left,top:top},1000);              
}
&lt;/code&gt;
&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;For animating DOM elements to a single point (mouse click over document), get x,y position using mouse click event and animate each element towards the point with &lt;i&gt;&lt;span style=&quot;color: #0b5394;&quot;&gt;setTimeout &lt;/span&gt;&lt;/i&gt;function
&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgzJGZ2184jNSPz7KqhVqF14M8ZAgco99g_WxHQwGUDIqRuBiehObpwEAP_OLHAiplUlSe5jsqIk9R3XpG5Ll6RSqyRlyFWtRnjsyl5Sljs72i6eFCoFoIHTVYCv_SZR6cIfwe1I2YIDLhX/s1600/animation+to+point.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em; text-align: center;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;302&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgzJGZ2184jNSPz7KqhVqF14M8ZAgco99g_WxHQwGUDIqRuBiehObpwEAP_OLHAiplUlSe5jsqIk9R3XpG5Ll6RSqyRlyFWtRnjsyl5Sljs72i6eFCoFoIHTVYCv_SZR6cIfwe1I2YIDLhX/s1600/animation+to+point.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;
&lt;pre&gt;&lt;code class=&quot;js&quot;&gt;$(document).on(&#39;click&#39;,function(e){
    for (var i = 0; i &amp;lt; 360; i++) {
        var left = e.clientX + &#39;px&#39;;
        var top = e.clientY + &#39;px&#39;;
        var f = (function(i){
            return function(){
                $(&#39;div&#39;).eq(i).animate({left:left,top:top},500);
            };
        })(i);
        setTimeout(f,i*5);
    }
});
&lt;/code&gt;
&lt;/pre&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;h3&gt;
&lt;a href=&quot;http://jsfiddle.net/ajai/6ehse/&quot; target=&quot;_blank&quot;&gt;DEMO&lt;/a&gt;&lt;/h3&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://ownmycode.blogspot.com/feeds/7300102910963784020/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ownmycode.blogspot.com/2014/02/a-fair-play-with-maths-and-jquery.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3063939708578051703/posts/default/7300102910963784020'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3063939708578051703/posts/default/7300102910963784020'/><link rel='alternate' type='text/html' href='http://ownmycode.blogspot.com/2014/02/a-fair-play-with-maths-and-jquery.html' title='A fair play with Maths and JQuery Animation'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjMMkttc2DqHtqNh1IEmFMZ76O759ON9ckh0VQArYmqvLjCTMd6j66HyKZg1RQSZmUQ17Tizm9iDZBp4dXeB4g8JbP4M3Mxd1IP6uFSy0rrmjEWVUTqBRleR7RBgCCSMw1WAtybBLih0Jel/s72-c/random.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3063939708578051703.post-2212415679882125246</id><published>2014-02-21T01:47:00.001+05:30</published><updated>2017-03-28T12:17:50.344+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Javascript Tricks"/><category scheme="http://www.blogger.com/atom/ns#" term="JQuery Plugin"/><title type='text'>Custom Select Box with new approach</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhGCSa3HyOVAsdR1Gql7RyCigLiFIN6976ldNi7-xqTDfnWLa-2OSSis8CeiTb6lyMgoVXCmLr6tR2LFFcSrukrl9rLrFY35CQnFX8F97QfkPctaIW83jDgiH55uJ3dBNW1OAZ3_EHxQyFt/s1600/customselectbox.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhGCSa3HyOVAsdR1Gql7RyCigLiFIN6976ldNi7-xqTDfnWLa-2OSSis8CeiTb6lyMgoVXCmLr6tR2LFFcSrukrl9rLrFY35CQnFX8F97QfkPctaIW83jDgiH55uJ3dBNW1OAZ3_EHxQyFt/s1600/customselectbox.png&quot; height=&quot;210&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
This is my new JQuery plugin for replacing select box. I have tried to implement some cool features which makes it easy to implement and you can play with it as like the native one.&lt;br /&gt;
&lt;br /&gt;
Your suggestions, issues are welcome, so that I can improve this plugin&lt;br /&gt;
&lt;br /&gt;
&lt;h3 style=&quot;text-align: left;&quot;&gt;
&lt;a href=&quot;http://jsfiddle.net/ajai/nNXmH/&quot; target=&quot;_blank&quot;&gt;DEMO&lt;/a&gt;&lt;/h3&gt;
&lt;h3 style=&quot;text-align: left;&quot;&gt;
&lt;a href=&quot;https://github.com/ajaijothi/Custom-Select-box&quot; target=&quot;_blank&quot;&gt;Fork this on GitHub&lt;/a&gt;&lt;/h3&gt;
&lt;h3 style=&quot;text-align: left;&quot;&gt;
Implementation: &lt;/h3&gt;
&lt;h4 style=&quot;text-align: left;&quot;&gt;
Step 1: include css and scripts in head section&lt;/h4&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;pre&gt;&lt;code class=&quot;html&quot;&gt;&amp;lt;link href=&quot;customselectbox.css&quot; rel=&quot;stylesheet&quot; type=&quot;text/css&quot;&amp;gt;&amp;lt;/link&amp;gt;
&amp;lt;script src=&quot;http://code.jquery.com/jquery-1.9.0.js&quot;&amp;gt;&amp;lt;/script&amp;gt;
&amp;lt;script src=&quot;customselectbox.js&quot;&amp;gt;&amp;lt;/script&amp;gt;
&lt;/code&gt;
&lt;/pre&gt;
&lt;h4 style=&quot;text-align: left;&quot;&gt;
Step 2: initialize customselect box&lt;/h4&gt;
&lt;pre&gt;&lt;code class=&quot;js&quot;&gt;$(document).ready(function(){
  $(&#39;select&#39;).customSelect();
});
&lt;/code&gt;
&lt;/pre&gt;
&lt;h3 style=&quot;text-align: left;&quot;&gt;
Features:&lt;/h3&gt;
&lt;ol style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;Support thumbnails within &lt;i&gt;option&lt;/i&gt;&lt;/li&gt;
&lt;li&gt;Search option&lt;/li&gt;
&lt;li&gt;&lt;i&gt;Set &lt;/i&gt;and &lt;i&gt;Get &lt;/i&gt;value with normal JQuery method. No need 
to process or query the generated new select box, you can use the ref of
 the native select box. &lt;br /&gt;&lt;b&gt;eg: &lt;/b&gt;&lt;br /&gt;
&lt;pre&gt;&lt;code class=&quot;js&quot;&gt;//set value
$(&#39;#myselect&#39;).val(value);
//get value
$(&#39;#myselect&#39;).val();
&lt;/code&gt;
&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;Support native reset within the form - i.e) when form gets reset the value of the select box gets reset to its default value&lt;/li&gt;
&lt;li&gt;supported browsers: IE8+, firefox, safari, chrome&lt;/li&gt;
&lt;li&gt;attaching events,&lt;br /&gt;
&lt;pre&gt;&lt;code class=&quot;js&quot;&gt;$(&#39;select&#39;).change(function () {
   alert(&#39;Change Event Fired&#39;);
});

$(&#39;select&#39;).click(function () {
  alert(&#39;Click Event Fired&#39;);
});
&lt;/code&gt;
&lt;/pre&gt;
 &lt;/li&gt;
&lt;/ol&gt;

&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://ownmycode.blogspot.com/feeds/2212415679882125246/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ownmycode.blogspot.com/2014/02/custom-select-box-with-new-approach.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3063939708578051703/posts/default/2212415679882125246'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3063939708578051703/posts/default/2212415679882125246'/><link rel='alternate' type='text/html' href='http://ownmycode.blogspot.com/2014/02/custom-select-box-with-new-approach.html' title='Custom Select Box with new approach'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhGCSa3HyOVAsdR1Gql7RyCigLiFIN6976ldNi7-xqTDfnWLa-2OSSis8CeiTb6lyMgoVXCmLr6tR2LFFcSrukrl9rLrFY35CQnFX8F97QfkPctaIW83jDgiH55uJ3dBNW1OAZ3_EHxQyFt/s72-c/customselectbox.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3063939708578051703.post-3098967153657250753</id><published>2013-08-29T19:06:00.002+05:30</published><updated>2017-03-28T12:21:07.980+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Javascript Tricks"/><category scheme="http://www.blogger.com/atom/ns#" term="JQuery Plugin"/><title type='text'>Android Pattern locker plugin - Javascript</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
This is my new JavaScript plugin for generating Android like Pattern locker for web applications.&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
This is fully customizable plugin. Don&#39;t know where it can be used.... Just developed in my own interest.... please suggest some improvements for the same..... I think the captcha can be replaced with this plugin.&lt;br /&gt;
&lt;br /&gt;
I have created the plugin using &lt;a href=&quot;http://raphaeljs.com/&quot; target=&quot;_blank&quot;&gt;raphaeljs.&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiwhPzXMKYHa4117ZCSwz_wt6iRN_yL8FADJVVkDd65JDK7Yvqc5Pse2WuT6jjOJWtgjQoyTJO5ZuuveE5s_IaPERCjZHSY5S7pZTJPkp_LIuWO3JfLnHRYAlMVmoaENJujPkC1h2U-f1mI/s1600/pattern.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiwhPzXMKYHa4117ZCSwz_wt6iRN_yL8FADJVVkDd65JDK7Yvqc5Pse2WuT6jjOJWtgjQoyTJO5ZuuveE5s_IaPERCjZHSY5S7pZTJPkp_LIuWO3JfLnHRYAlMVmoaENJujPkC1h2U-f1mI/s1600/pattern.png&quot; height=&quot;311&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;//1.bp.blogspot.com/-azJvh3Qhfq0/Uh9VjARfjXI/AAAAAAAAANs/uNTVgNcfJxs/s1600/pattern.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;/a&gt;&lt;/div&gt;
&lt;h3 style=&quot;text-align: left;&quot;&gt;
&lt;a href=&quot;http://jsfiddle.net/ajai/TbuE6/&quot; target=&quot;_blank&quot;&gt;DEMO&lt;/a&gt;&lt;/h3&gt;
&lt;h3 style=&quot;text-align: left;&quot;&gt;
&lt;a href=&quot;https://github.com/ajaijothi/jsPatternLock&quot; target=&quot;_blank&quot;&gt;Fork this on GitHub &lt;/a&gt;&lt;/h3&gt;
&lt;/div&gt;
&lt;h3 style=&quot;text-align: left;&quot;&gt;
How to use?&amp;nbsp;&lt;/h3&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;b&gt;Step 1:&lt;/b&gt; Include the&amp;nbsp; following scripts in your head section (&lt;a href=&quot;http://cdnjs.cloudflare.com/ajax/libs/raphael/2.1.0/raphael-min.js&quot; target=&quot;_blank&quot;&gt;click here to download raphaeljs&lt;/a&gt; , &lt;a href=&quot;https://docs.google.com/file/d/0B1qnUITImQbhR2hkVHBRT3pLM0U/edit?usp=sharing&quot; target=&quot;_blank&quot;&gt;click here to download pattern.js&lt;/a&gt;)&lt;/div&gt;
&lt;pre&gt;&lt;code class=&quot;html&quot;&gt;&amp;lt;script src=&quot;raphael-min.js&quot; type=&quot;text/javascript&quot;&amp;gt;&amp;lt;/script&gt;
&amp;lt;script src=&quot;pattern.js&quot; type=&quot;text/javascript&quot;&amp;gt;&amp;lt;/script&amp;gt;
&lt;/pre&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;b&gt;Step 2:&lt;/b&gt; Create an instance for the pattern with your custom properties and draw the pattern within the container with instance.draw(container).&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;pre&gt;&lt;code class=&quot;js&quot;&gt;var s = new Pattern(properties);
s.draw(container); &lt;/code&gt;&lt;/pre&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;
&lt;h4 style=&quot;text-align: left;&quot;&gt;
Properties&lt;/h4&gt;
&lt;table border=&quot;1&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot;&gt;
    &lt;tbody&gt;
&lt;tr style=&quot;background: #ddd;&quot;&gt;
            &lt;td valign=&quot;top&quot; width=&quot;205&quot;&gt;&lt;b&gt;Property
                &lt;/b&gt;&lt;/td&gt;
            &lt;td valign=&quot;top&quot; width=&quot;205&quot;&gt;&lt;b&gt;Description&lt;/b&gt;
                &lt;/td&gt;
            &lt;td valign=&quot;top&quot; width=&quot;205&quot;&gt;&lt;b&gt;Default Value&lt;/b&gt;
                &lt;/td&gt;
        &lt;/tr&gt;
&lt;tr&gt;
            &lt;td valign=&quot;top&quot; width=&quot;205&quot;&gt;dimension
                &lt;/td&gt;
            &lt;td valign=&quot;top&quot; width=&quot;205&quot;&gt;Dimension of the patern
                &lt;br /&gt;
&lt;i&gt;No. of rows&lt;/i&gt;
                    x &lt;i&gt;No. of columns&lt;/i&gt;
                &lt;br /&gt;
Eg:
                &lt;br /&gt;
dimension:‘5x5’
                &lt;/td&gt;
            &lt;td valign=&quot;top&quot; width=&quot;205&quot;&gt;3x3
                &lt;/td&gt;
        &lt;/tr&gt;
&lt;tr&gt;
            &lt;td valign=&quot;top&quot; width=&quot;205&quot;&gt;patternRadius
                &lt;/td&gt;
            &lt;td valign=&quot;top&quot; width=&quot;205&quot;&gt;Radius of the pattern circle
                &lt;br /&gt;
Eg:
                &lt;br /&gt;
patternRadius:25
                &lt;/td&gt;
            &lt;td valign=&quot;top&quot; width=&quot;205&quot;&gt;20
                &lt;/td&gt;
        &lt;/tr&gt;
&lt;tr&gt;
            &lt;td valign=&quot;top&quot; width=&quot;205&quot;&gt;patternGap
                &lt;/td&gt;
            &lt;td valign=&quot;top&quot; width=&quot;205&quot;&gt;Gap between each Pattern Circle
                &lt;br /&gt;
Eg:
                &lt;br /&gt;
patternGap:70
                &lt;/td&gt;
            &lt;td valign=&quot;top&quot; width=&quot;205&quot;&gt;50
                &lt;/td&gt;
        &lt;/tr&gt;
&lt;tr&gt;
            &lt;td valign=&quot;top&quot; width=&quot;205&quot;&gt;outerColor
                &lt;/td&gt;
            &lt;td valign=&quot;top&quot; width=&quot;205&quot;&gt;Color of the Pattern Circle. The color value can be either hex color or hex gradient color
                &lt;br /&gt;
Eg:&lt;b&gt; &lt;/b&gt;
                &lt;br /&gt;
outerColor:’#FC0000’
                &lt;br /&gt;
outerColor :‘90-#239EE0:5-#1951A0:95’
                &lt;/td&gt;
            &lt;td valign=&quot;top&quot; width=&quot;205&quot;&gt;#333333
                &lt;/td&gt;
        &lt;/tr&gt;
&lt;tr&gt;
            &lt;td valign=&quot;top&quot; width=&quot;205&quot;&gt;innerColor
                &lt;/td&gt;
            &lt;td valign=&quot;top&quot; width=&quot;205&quot;&gt;Color of the inner circle within the Pattern Circle
                &lt;br /&gt;
Eg:
                &lt;br /&gt;
innerColor:’#FC0000’
                &lt;br /&gt;
innerColor :‘90-#239EE0:5-#1951A0:95’
                &lt;/td&gt;
            &lt;td valign=&quot;top&quot; width=&quot;205&quot;&gt;90-#239EE0:5-#1951A0:95
                &lt;/td&gt;
        &lt;/tr&gt;
&lt;tr&gt;
            &lt;td valign=&quot;top&quot; width=&quot;205&quot;&gt;background
                &lt;/td&gt;
            &lt;td valign=&quot;top&quot; width=&quot;205&quot;&gt;Pattern box background color
                &lt;br /&gt;
Eg:
                &lt;br /&gt;
background:’#FF00F0’
                &lt;/td&gt;
            &lt;td valign=&quot;top&quot; width=&quot;205&quot;&gt;#000000
                &lt;/td&gt;
        &lt;/tr&gt;
&lt;tr&gt;
            &lt;td valign=&quot;top&quot; width=&quot;205&quot;&gt;backgroundOpacity
                &lt;/td&gt;
            &lt;td valign=&quot;top&quot; width=&quot;205&quot;&gt;Pattern box background opacity
                &lt;br /&gt;
Eg:
                &lt;br /&gt;
background:0.5
                &lt;/td&gt;
            &lt;td valign=&quot;top&quot; width=&quot;205&quot;&gt;1
                &lt;/td&gt;
        &lt;/tr&gt;
&lt;tr&gt;
            &lt;td valign=&quot;top&quot; width=&quot;205&quot;&gt;hoverColor
                &lt;/td&gt;
            &lt;td valign=&quot;top&quot; width=&quot;205&quot;&gt;Stroke color of Pattern Circle when mouse over
                &lt;br /&gt;
Eg:
                &lt;br /&gt;
hoverColor:’#FF00F0’
                &lt;/td&gt;
            &lt;td valign=&quot;top&quot; width=&quot;205&quot;&gt;#c8ee17
                &lt;/td&gt;
        &lt;/tr&gt;
&lt;tr&gt;
            &lt;td valign=&quot;top&quot; width=&quot;205&quot;&gt;errorColor
                &lt;/td&gt;
            &lt;td valign=&quot;top&quot; width=&quot;205&quot;&gt;Stroke color of Pattern Circle for Invalid Pattern
                &lt;br /&gt;
Eg:
                &lt;br /&gt;
errorColor:’#FF00F0’
                &lt;/td&gt;
            &lt;td valign=&quot;top&quot; width=&quot;205&quot;&gt;#FF0000
                &lt;/td&gt;
        &lt;/tr&gt;
&lt;tr&gt;
            &lt;td valign=&quot;top&quot; width=&quot;205&quot;&gt;padding
                &lt;/td&gt;
            &lt;td valign=&quot;top&quot; width=&quot;205&quot;&gt;Pattern Box padding
                &lt;br /&gt;
Eg:
                &lt;br /&gt;
padding:25
                &lt;/td&gt;
            &lt;td valign=&quot;top&quot; width=&quot;205&quot;&gt;Value of pattern radius
                &lt;/td&gt;
        &lt;/tr&gt;
&lt;tr&gt;
            &lt;td valign=&quot;top&quot; width=&quot;205&quot;&gt;onFinish
                &lt;/td&gt;
            &lt;td valign=&quot;top&quot; width=&quot;205&quot;&gt;Handler to be executed when the user completes the pattern
                &lt;br /&gt;
Eg:
                &lt;br /&gt;
onFinish:function(value){
                &lt;br /&gt;
}
                &lt;br /&gt;
&lt;i&gt;value&lt;/i&gt;
                    – value of the pattern drawn passed to the handler
                &lt;/td&gt;
            &lt;td valign=&quot;top&quot; width=&quot;205&quot;&gt;null
                &lt;/td&gt;
        &lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;br /&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;also you can set the property values externally with the created pattern Object&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;h4 style=&quot;text-align: left;&quot;&gt;
Functions&lt;/h4&gt;
&lt;table border=&quot;1&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot;&gt;
    &lt;tbody&gt;
&lt;tr style=&quot;background: #ddd;&quot;&gt;
            &lt;td valign=&quot;top&quot; width=&quot;163&quot;&gt;&lt;b&gt;Function&lt;/b&gt;
                &lt;/td&gt;
            &lt;td valign=&quot;top&quot; width=&quot;311&quot;&gt;&lt;b&gt;Description&lt;/b&gt;
                &lt;/td&gt;
            &lt;td valign=&quot;top&quot; width=&quot;130&quot;&gt;&lt;b&gt;Return value&lt;/b&gt;
                &lt;/td&gt;
        &lt;/tr&gt;
&lt;tr&gt;
            &lt;td valign=&quot;top&quot; width=&quot;163&quot;&gt;draw (container)
                &lt;/td&gt;
            &lt;td valign=&quot;top&quot; width=&quot;311&quot;&gt;Draw the pattern within the container. Should be called with pattern instance.
                &lt;br /&gt;
Eg:
                    &lt;br /&gt;
&lt;i&gt;
                        s.draw(‘mydiv’);
                        &lt;br /&gt;
                    &lt;/i&gt;
                    Here ‘mydiv’ represents containerId
                &lt;br /&gt;
s.draw(document.getElementById(‘mydiv’));
                &lt;/td&gt;
            &lt;td valign=&quot;top&quot; width=&quot;130&quot;&gt;Return Pattern Object
                &lt;/td&gt;
        &lt;/tr&gt;
&lt;tr&gt;
            &lt;td valign=&quot;top&quot; width=&quot;163&quot;&gt;clear()
                &lt;/td&gt;
            &lt;td valign=&quot;top&quot; width=&quot;311&quot;&gt;Resets the pattern.
                &lt;br /&gt;
Eg:
                    &lt;br /&gt;
&lt;i&gt;s.clear();&lt;/i&gt;
                &lt;/td&gt;
            &lt;td valign=&quot;top&quot; width=&quot;130&quot;&gt;Return Pattern Object
                &lt;/td&gt;
        &lt;/tr&gt;
&lt;tr&gt;
            &lt;td valign=&quot;top&quot; width=&quot;163&quot;&gt;error()
                &lt;/td&gt;
            &lt;td valign=&quot;top&quot; width=&quot;311&quot;&gt;Used to mark the drawn pattern as error
                &lt;br /&gt;
Eg:
                    &lt;br /&gt;
&lt;i&gt;s.error();&lt;/i&gt;
                &lt;/td&gt;
            &lt;td valign=&quot;top&quot; width=&quot;130&quot;&gt;Return Pattern Object
                &lt;/td&gt;
        &lt;/tr&gt;
&lt;tr&gt;
            &lt;td valign=&quot;top&quot; width=&quot;163&quot;&gt;val()
                &lt;/td&gt;
            &lt;td valign=&quot;top&quot; width=&quot;311&quot;&gt;Used to get the value of drawn pattern
                &lt;br /&gt;
Eg:
                    &lt;br /&gt;
&lt;i&gt;s.val();&lt;/i&gt;
                    &lt;br /&gt;
for the image attached in this post, the value returned will be ‘&lt;i&gt;3-4-5-10-15&lt;/i&gt;&lt;i&gt;’&lt;/i&gt;
                &lt;/td&gt;
            &lt;td valign=&quot;top&quot; width=&quot;130&quot;&gt;Return pattern value
                &lt;/td&gt;
        &lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;eg:&lt;/span&gt; &lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;pre&gt;&lt;code class=&quot;js&quot;&gt;var samplePattern = &quot;3-4-5-10-15&quot;;
var s = new Pattern({
    dimension: &#39;5x5&#39;,
    outerColor: &#39;#000&#39;,
    patternRadius: 20,
    patternGap: 30,
    padding: 20,
    background: &#39;#333&#39;,
    backgroundOpacity: 0.5
});
s.onFinish = function (v) {
    if (v == samplePattern) alert(&#39;success&#39;);
    else this.error();
};
s.draw(&#39;mypattern&#39;);
&lt;/code&gt;&lt;/pre&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h3 style=&quot;text-align: left;&quot;&gt;
Plugin &lt;/h3&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;pre&gt;&lt;code class=&quot;js&quot;&gt;var Pattern = function (options) {
    this.dimension = options.dimension &amp;amp;&amp;amp; options.dimension.indexOf(&#39;x&#39;) !== -1 ? options.dimension.split(&#39;x&#39;) : [3, 3];

    this.patternRadius = options.patternRadius || 20;
    this.patternGap = options.patternGap || 50;
    this.innerColor = options.innerColor || &#39;90-#239EE0:5-#1951A0:95&#39;;
    this.outerColor = options.outerColor || &#39;#333333&#39;;
    this.background = options.background || &#39;#000000&#39;;
    this.backgroundOpacity = options.backgroundOpacity || 1;
    this.hoverColor = options.hoverColor || &#39;#c8ee17&#39;;

    this.errorColor = options.errorColor || &#39;#FF0000&#39;;

    this.padding = options.padding || this.patternRadius;

    this.onFinish = options.onFinish || function (v) {};

    this.width = this.dimension[0] * (2 * this.patternRadius + this.patternGap) + (this.padding * 4) - this.patternGap;
    this.height = this.dimension[1] * (2 * this.patternRadius + this.patternGap) + (this.padding * 4) - this.patternGap;

    this.paper = null;
    this.patternCircle = [];
    this.value = [];
    this.blocker = null;

    var patternObj = this;
    this.isMouseDown = false;
    this.lineX = 0;
    this.lineY = 0;
    this.currentPath = null;
    this.currentTarget = null;


    //styes
    this.paperStyle = {
        fill: patternObj.background,
            &#39;stroke-width&#39;: 0,
        opacity: patternObj.backgroundOpacity
    };
    this.selectedStyle = {
        &#39;fill&#39;: &#39;#CCC&#39;,
            &#39;fill-opacity&#39;: 0.3,
            &#39;stroke-width&#39;: 3,
            &#39;stroke&#39;: &#39;#C8E02A&#39;
    };
    this.innerStyle = {
        &#39;fill&#39;: patternObj.innerColor,
            &#39;stroke-width&#39;: 0
    };
    this.outerStyle = {
        &#39;fill&#39;: patternObj.outerColor,
            &#39;stroke-width&#39;: 0,
            &#39;fill-opacity&#39;: 1,
    };
    this.hoverStyle = {
        &#39;stroke-width&#39;: 3,
            &#39;stroke&#39;: patternObj.hoverColor,
            &#39;stroke-opacity&#39;: 1
    };
    this.pathStyle = {
        stroke: &#39;#FFF&#39;,
            &#39;stroke-width&#39;: &#39;5&#39;,
            &#39;stroke-linecap&#39;: &#39;round&#39;,
            &#39;opacity&#39;: 0.3
    };
    this.errorStyle = {
        &#39;stroke-width&#39;: 3,
            &#39;stroke&#39;: patternObj.errorColor,
            &#39;stroke-opacity&#39;: 0.75
    };

    //common handlers
    var paperMouseUpHandler = function () {
        patternObj.isMouseDown = false;
        if (patternObj.currentPath) {
            patternObj.currentPath.remove();
        }
        if (patternObj.currentTarget.length &amp;amp;&amp;amp; patternObj.currentTarget[0].data(&#39;connection&#39;) == 1) {
            patternObj.blocker = patternObj.paper.rect(0, 0, patternObj.width, patternObj.height, patternObj.patternRadius).attr({
                fill: &#39;#000&#39;,
                    &#39;stroke-width&#39;: 0,
                    &#39;fill-opacity&#39;: 0
            });
        }
        patternObj.currentPath = [];
        patternObj.currentTarget = [];

        if (typeof (patternObj.onFinish)) {
            patternObj.onFinish(patternObj.val());
        }
    };

    var drawPathHandler = function (e) {
        e = e || window.event;

        var pX = e.pageX;
        var pY = e.pageY;
        if (pX === undefined) {
            pX = e.clientX;
            pY = e.clientY;
        }
        pX = pX - ((window.pageXOffset || document.body.scrollLeft) + patternObj.paper.canvas.getBoundingClientRect().left);
        pY = pY - ((window.pageYOffset || document.body.scrollTop) + patternObj.paper.canvas.getBoundingClientRect().top);

        e.stopPropagation();
        if (patternObj.isMouseDown &amp;amp;&amp;amp; patternObj.currentPath) {
            patternObj.currentPath.attr(&#39;path&#39;, &quot;M&quot; + patternObj.lineX + &quot; &quot; + patternObj.lineY + &quot;L&quot; + pX + &quot; &quot; + pY);
        }
    };

    this.disableSelection = function (target) {
        if (typeof target.onselectstart != &quot;undefined&quot;) {
            target.onselectstart = function () {
                return false
            };
        } else if (typeof target.style.MozUserSelect != &quot;undefined&quot;) {
            target.style.MozUserSelect = &quot;none&quot;;
        } else {
            target.onmousedown = function () {
                return false
            };
        }
    };

    this.createPattern = function (paperObj) {
        var x = 0,
            y = 0,
            i, j, elm = null;
        for (i = 0; i &amp;lt; patternObj.dimension[0]; i++) {
            x = i * (patternObj.patternGap + patternObj.patternRadius * 2) + patternObj.padding + patternObj.patternRadius;
            for (j = 0; j &amp;lt; patternObj.dimension[1]; j++) {
                y = j * (patternObj.patternGap + patternObj.patternRadius * 2) + patternObj.patternRadius + patternObj.padding;
                elm = patternObj.drawPatternPoint(paperObj, x, y, i, j);
                patternObj.patternCircle.push(elm);
                elm[0].data({
                    x: i,
                    y: j
                });
            }
        }
        patternObj.sort();
    };

    this.sort = function () {
        var i, j, tmpAry = [],
            elm, cnt = 1;
        for (i = 0; i &amp;lt; patternObj.dimension[1]; i++) {
            for (j = 0; j &amp;lt; patternObj.dimension[0]; j++) {
                elm = patternObj.getByXY(j, i);
                elm[0].data({
                    &#39;value&#39;: cnt
                });
                elm[1].data({
                    &#39;value&#39;: cnt
                });
                tmpAry.push(elm);
                cnt++;
            }
        }
        patternObj.patternCircle = tmpAry;
    };

    this.drawConnection = function (oCircle, iCircle, currentTarget) {
        patternObj.currentPath.attr(&#39;path&#39;, &quot;M&quot; + patternObj.lineX + &quot; &quot; + patternObj.lineY + &quot;L&quot; + (oCircle.getBBox().x + oCircle.getBBox().width / 2) + &quot; &quot; + (oCircle.getBBox().y + oCircle.getBBox().height / 2));
        patternObj.lineX = (oCircle.getBBox().x + oCircle.getBBox().width / 2);
        patternObj.lineY = (oCircle.getBBox().y + oCircle.getBBox().height / 2);

        patternObj.currentPath = patternObj.paper.path(&quot;M&quot; + patternObj.lineX + &quot; &quot; + patternObj.lineY + &quot;L&quot; + patternObj.lineX - 2 + &quot; &quot; + patternObj.lineY - 2).attr(patternObj.pathStyle);
        patternObj.currentPath.mouseup(paperMouseUpHandler);
        currentTarget.data({
            &#39;connection&#39;: 1
        }).attr(patternObj.selectedStyle);
        iCircle.data({
            &#39;connection&#39;: 1
        });
        oCircle.data({
            &#39;connection&#39;: 1
        }).attr(patternObj.selectedStyle);
        patternObj.value.push(oCircle.data(&#39;value&#39;));
    };

    this.getByXY = function (x, y) {
        for (var i = 0; i &amp;lt; this.patternCircle.length; i++) {
            if (this.patternCircle[i][0].data(&#39;x&#39;) == x &amp;amp;&amp;amp; this.patternCircle[i][0].data(&#39;y&#39;) == y) {
                return this.patternCircle[i];
            }
        }
        return null;
    };

    this.drawPatternPoint = function (paperObj, x, y, xi, yi) {
        var patternElm = paperObj.set();
        var oCircle = paperObj.circle(patternObj.padding + x, patternObj.padding + y, patternObj.patternRadius).attr(patternObj.outerStyle);
        var iCircle = paperObj.circle(patternObj.padding + x, patternObj.padding + y, patternObj.patternRadius / 3).attr(patternObj.innerStyle);
        iCircle.data({
            &#39;connection&#39;: 0,
                &#39;x&#39;: xi,
                &#39;y&#39;: yi
        });
        oCircle.data({
            &#39;connection&#39;: 0,
                &#39;x&#39;: xi,
                &#39;y&#39;: yi
        });

        patternElm.push(oCircle, iCircle);

        var patternMousemoveHandler = function (e) {
            oCircle.attr(patternObj.hoverStyle);

            if (patternObj.currentPath &amp;amp;&amp;amp; (patternObj.currentTarget[0] !== oCircle[0] &amp;amp;&amp;amp; patternObj.currentTarget[1] !== iCircle[0]) &amp;amp;&amp;amp; (iCircle.data(&#39;connection&#39;) == 0)) {

                var x1 = patternObj.currentTarget[0].data(&#39;x&#39;);
                var y1 = patternObj.currentTarget[0].data(&#39;y&#39;);
                var x2 = oCircle.data(&#39;x&#39;);
                var y2 = oCircle.data(&#39;y&#39;);

                var xs = x1 &amp;gt; x2 ? x2 : x1;
                var xe = x1 &amp;gt; x2 ? x1 : x2;
                var ys = y1 &amp;gt; y2 ? y2 : y1;
                var ye = y1 &amp;gt; y2 ? y1 : y2;

                var i, j;
                var telm = null;
                var connect = function (a, b) {
                    telm = patternObj.getByXY(a, b);
                    if (telm[0].data(&#39;connection&#39;) == 0) {
                        patternObj.drawConnection(telm[0], telm[1], telm[0]);
                    }
                };
                if (x1 == x2 &amp;amp;&amp;amp; y1 !== y2) {
                    if (y1 &amp;lt; y2) {
                        for (i = ys; i &amp;lt;= ye; i++) {
                            connect(xs, i);
                        }
                    } else {
                        for (i = ye; i &amp;gt;= ys; i--) {
                            connect(xs, i);
                        }
                    }
                } else if (y1 == y2 &amp;amp;&amp;amp; x1 !== x2) {
                    if (x1 &amp;gt; x2) {
                        for (i = xe; i &amp;gt;= xs; i--) {
                            connect(i, ys);
                        }
                    } else {
                        for (i = xs; i &amp;lt;= xe; i++) {
                            connect(i, ys);
                        }
                    }
                } else if (Math.abs(x1 - x2) == Math.abs(y1 - y2)) {
                    for (i = 0; i &amp;lt;= Math.abs(ys - ye); i++) {
                        if (y1 &amp;lt; y2 &amp;amp;&amp;amp; x1 &amp;gt; x2) {
                            connect(x1 - i, y1 + i);
                        } else if (y1 &amp;gt; y2 &amp;amp;&amp;amp; x1 &amp;lt; x2) {
                            connect(x1 + i, y1 - i);
                        } else if (y1 &amp;lt; y2) {
                            connect(x1 + i, y1 + i);
                        } else {
                            connect(x1 - i, y1 - i);
                        }
                    }
                }
                patternObj.currentTarget.pop();
                patternObj.currentTarget = [oCircle, iCircle];
            }

        };

        var patternMouseoutHandler = function () {
            if (oCircle.data(&#39;connection&#39;) == 0) {
                oCircle.attr({
                    &#39;stroke-width&#39;: 0
                });
            }
        };

        var patternMouseDownHandler = function (e) {
            patternObj.isMouseDown = true;
            patternObj.currentTarget = [oCircle, iCircle];
            patternObj.lineX = patternElm.getBBox().x + patternElm.getBBox().width / 2;
            patternObj.lineY = patternElm.getBBox().y + patternElm.getBBox().height / 2;
            patternObj.currentPath = patternObj.paper.path(&quot;M&quot; + patternObj.lineX + &quot; &quot; + patternObj.lineY + &quot;L&quot; + patternObj.lineX - 2 + &quot; &quot; + patternObj.lineY - 2).attr(patternObj.pathStyle);
            patternObj.currentPath.touchend(paperMouseUpHandler);
            patternObj.currentPath.mouseup(paperMouseUpHandler);
        };

        patternElm.mousemove(patternMousemoveHandler);
        patternElm.mouseout(patternMouseoutHandler);
        patternElm.mousedown(patternMouseDownHandler);
        patternElm.mouseup(paperMouseUpHandler);
        return [oCircle, iCircle];
    };

    this.drawPaper = function (elm) {
        var paper = Raphael(elm, patternObj.width, patternObj.height);
        var rect = paper.rect(0, 0, patternObj.width, patternObj.height, patternObj.patternRadius).attr(patternObj.paperStyle);
        rect.mousemove(drawPathHandler);
        rect.mouseup(paperMouseUpHandler);
        return paper;
    };

    this.draw = function (elm) {
        patternObj.paper = patternObj.drawPaper(elm);
        patternObj.createPattern(this.paper);
        patternObj.disableSelection(patternObj.paper.canvas);
        return this;
    };

    this.clear = function () {
        var paths = patternObj.paper.canvas.getElementsByTagName(&#39;path&#39;);
        var cnt = paths.length;
        for (var i = 0; i &amp;lt; cnt; i++) {
            paths[0].parentNode.removeChild(paths[0]);
        }
        patternObj.paper.forEach(function (el) {
            if (el[0].tagName.toLowerCase() == &#39;circle&#39;) {
                el.data({
                    &#39;connection&#39;: 0
                });
                if (patternObj.patternRadius == el.attr(&#39;r&#39;)) {
                    el.attr(patternObj.outerStyle);
                }
            }
        });
        if (patternObj.blocker) {
            patternObj.blocker.remove();
        }
        patternObj.blocker = null;
        patternObj.currentPath = null;
        patternObj.currentTarget = [];
        patternObj.value = [];
        
        return this;
    };

    this.error = function () {
        for (var i = 0; i &amp;lt; patternObj.patternCircle.length; i++) {
            if (patternObj.patternCircle[i][0].data(&#39;connection&#39;) == 1) {
                patternObj.patternCircle[i][0].attr(patternObj.errorStyle);
            }
        }
        
        return this;
    };

    this.val = function () {
        return patternObj.value.toString().replace(/,/g, &#39;-&#39;);
    };
};
&lt;/code&gt;
&lt;/pre&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://ownmycode.blogspot.com/feeds/3098967153657250753/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ownmycode.blogspot.com/2013/08/android-pattern-locker-plugin-desktop.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3063939708578051703/posts/default/3098967153657250753'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3063939708578051703/posts/default/3098967153657250753'/><link rel='alternate' type='text/html' href='http://ownmycode.blogspot.com/2013/08/android-pattern-locker-plugin-desktop.html' title='Android Pattern locker plugin - Javascript'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiwhPzXMKYHa4117ZCSwz_wt6iRN_yL8FADJVVkDd65JDK7Yvqc5Pse2WuT6jjOJWtgjQoyTJO5ZuuveE5s_IaPERCjZHSY5S7pZTJPkp_LIuWO3JfLnHRYAlMVmoaENJujPkC1h2U-f1mI/s72-c/pattern.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3063939708578051703.post-8695568426822975806</id><published>2013-08-29T18:37:00.005+05:30</published><updated>2017-03-28T12:23:35.868+05:30</updated><title type='text'>How to change the URL without Page Reload</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Before start, you have to understand the HTML5 History API,&lt;br /&gt;
&lt;br /&gt;
Following code is used to change the url without page load,&lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;&lt;code class=&quot;js&quot;&gt;window.history.popstate(state,title,url);&lt;/code&gt;
&lt;/pre&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&lt;code&gt;state&lt;/code&gt; &lt;/span&gt;can be any &lt;abbr&gt;JSON&lt;/abbr&gt; data structure. It is passed back to the &lt;code&gt;popstate&lt;/code&gt; event hander, which you’ll learn about in just a moment. We don’t need to track any state in this demo, so I’ve left it as &lt;code&gt;null&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&lt;code&gt;title&lt;/code&gt; &lt;/span&gt;can be any string. This parameter is 
currently unused by major browsers. If you want to set the page title, 
you should store it in the &lt;code&gt;state&lt;/code&gt; argument and set it manually in your &lt;span style=&quot;color: #38761d;&quot;&gt;&lt;code&gt;popstate&lt;/code&gt; &lt;/span&gt;callback.
&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&lt;code&gt;url&lt;/code&gt; &lt;/span&gt;can be, well, any &lt;abbr&gt;URL&lt;/abbr&gt;. This is the &lt;abbr&gt;URL&lt;/abbr&gt; you want to appear in the browser’s location bar.&lt;/li&gt;
&lt;/ul&gt;
&lt;ol style=&quot;text-align: left;&quot;&gt;
&lt;/ol&gt;
&lt;br /&gt;
Change Event Handler,&lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;&lt;code class=&quot;js&quot;&gt;window.addEventListener(&quot;popstate&quot;, function(e) {
   //your code
});&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
The basic methods of &lt;span style=&quot;color: #38761d;&quot;&gt;&lt;code&gt;history&lt;/code&gt;&lt;/span&gt; object are:
    
    &lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&lt;code&gt;window.history.length&lt;/code&gt;&lt;/span&gt;: Returns the number of entries in the joint session history.&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&lt;code&gt;window.history.state&lt;/code&gt;&lt;/span&gt;: Returns the current state object.&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&lt;code&gt;window.history.go(n)&lt;/code&gt;&lt;/span&gt;: Goes backwards or forwards 
by the specified number of steps in the joint session history. If the 
value you specify is zero, it will reload the current page. If it would 
cause the target position to be outside the available range of the 
session history, then nothing happens.&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&lt;code&gt;window.history.back()&lt;/code&gt;&lt;/span&gt;: Goes backwards by one step in the joint session history. If there is no previous page to go to, it does nothing.&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&lt;code&gt;window.history.forward()&lt;/code&gt;&lt;/span&gt;: Goes forwards by one step in the joint session history. If there is no next page to go to, it does nothing.&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&lt;code&gt;window.history.pushState(data, title [, url])&lt;/code&gt;&lt;/span&gt;: Pushes the data specified in the arguments onto the session history, with the given title and URL (the URL is optional).&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&lt;code&gt;window.history.replaceState(data, title [, url])&lt;/code&gt;&lt;/span&gt;: Updates the current entry in the session history, with the given data, title and URL (the URL is optional).&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
&lt;ol&gt;
&amp;nbsp;&lt;/ol&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;ol&gt;&amp;nbsp;&lt;/ol&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://ownmycode.blogspot.com/feeds/8695568426822975806/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ownmycode.blogspot.com/2013/08/how-to-change-url-without-page-reload.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3063939708578051703/posts/default/8695568426822975806'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3063939708578051703/posts/default/8695568426822975806'/><link rel='alternate' type='text/html' href='http://ownmycode.blogspot.com/2013/08/how-to-change-url-without-page-reload.html' title='How to change the URL without Page Reload'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3063939708578051703.post-8121843188482732930</id><published>2013-08-09T18:39:00.004+05:30</published><updated>2017-03-28T12:33:34.443+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Javascript Tricks"/><category scheme="http://www.blogger.com/atom/ns#" term="JQuery Plugin"/><title type='text'>Clear Lens - JQuery Plugin</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjaOn1EEzAV8Jwrq0U1YqDm3WlS5OCVx78sJv_xj_wtWINVbmbunLc7PHmP-oEP8vT19T8jB22mjxTfwh7tbPtzzXsCo-2Hv_Q5rBqjmby1shj-wSXMpWyzYiARLarQGUpLFSRP_w0T93ap/s1600/clear+lens.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;221&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjaOn1EEzAV8Jwrq0U1YqDm3WlS5OCVx78sJv_xj_wtWINVbmbunLc7PHmP-oEP8vT19T8jB22mjxTfwh7tbPtzzXsCo-2Hv_Q5rBqjmby1shj-wSXMpWyzYiARLarQGUpLFSRP_w0T93ap/s1600/clear+lens.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;http://1.bp.blogspot.com/-4V-3iOU9OdQ/UgTp5gSYrqI/AAAAAAAAAMk/MViTmxOIPSA/s1600/clear+lens.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;br /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
This is my New jQuery Plugin.&amp;nbsp; You can find the working example at&lt;a href=&quot;http://jsfiddle.net/ajai/k8Ube/&quot; target=&quot;_blank&quot;&gt; http://jsfiddle.net/ajai/k8Ube/&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
Hope it will be useful to some one....&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
I have used &quot;&lt;a href=&quot;http://www.pixastic.com/&quot; target=&quot;_blank&quot;&gt;pixastic&lt;/a&gt;&quot; for image processing.&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
To implement the plugin you have to include the &lt;a href=&quot;http://www.pixastic.com/lib/download/build.php?everything=true&quot; target=&quot;_blank&quot;&gt;&lt;i&gt;pixastic library&lt;/i&gt;&lt;/a&gt;. and call the plugin in &lt;i&gt;$(window).load&lt;/i&gt; event, Beacuse for image processing first the image should be loaded. Hope you all know &lt;i&gt;$(window).load&lt;/i&gt; will be triggered after all the assets are loaded.&lt;br /&gt;
&lt;br /&gt;
&lt;h3 style=&quot;text-align: left;&quot;&gt;
&lt;a href=&quot;http://jsfiddle.net/ajai/k8Ube/&quot; target=&quot;_blank&quot;&gt;DEMO&lt;/a&gt;&lt;/h3&gt;
&lt;h3 style=&quot;text-align: left;&quot;&gt;
&lt;a href=&quot;https://github.com/ajaijothi/ClearLens&quot; target=&quot;_blank&quot;&gt;Fork this on GitHub&lt;/a&gt;&lt;/h3&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;/div&gt;
&lt;h3 style=&quot;text-align: left;&quot;&gt;
How to use?&lt;/h3&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
It is very simple to implement the plugin&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
1. include you jQuery&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
2. include Pixastic Library &lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
3. include the plugin code&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
4. Add attribute &lt;span style=&quot;color: #3d85c6;&quot;&gt;&lt;i&gt;fitler=&quot;blur&quot;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;/i&gt;&lt;span style=&quot;color: black;&quot;&gt;for images that you want to apply&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #3d85c6;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;5. on $(window).load Event call the following code&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;pre&gt;&lt;code class=&quot;js&quot;&gt;$(&#39;img&#39;).blurLens();&lt;/code&gt;&lt;/pre&gt;
or
&lt;br /&gt;
&lt;pre&gt;&lt;code class=&quot;js&quot;&gt;$(&#39;img&#39;).blurLens({
    width: 200,
    height: 200,
    blur: 5
});
&lt;/code&gt;
&lt;/pre&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;i&gt;width&lt;/i&gt; - Width of lens&lt;br /&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;i&gt;height&lt;/i&gt; - Height of lens&lt;br /&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;i&gt;blur&lt;/i&gt; - Blur Amount&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h3 style=&quot;text-align: left;&quot;&gt;
JQuery&amp;nbsp;&lt;/h3&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;/div&gt;
&lt;pre&gt;&lt;code class=&quot;js&quot;&gt;(function ($) {
    $.fn.blurLens = function (lensproperty) {

        return $(this).each(function (ind, elm) {
            if ($(elm).attr(&#39;filter&#39;) == &#39;blur&#39;) {
                var w = 50;
                var h = 50;
                var blur = 2;

                if (lensproperty &amp;amp;&amp;amp; lensproperty.width) w = lensproperty.width;
                if (lensproperty &amp;amp;&amp;amp; lensproperty.height) h = lensproperty.height;
                if (lensproperty &amp;amp;&amp;amp; lensproperty.blur) blur = lensproperty.blur;

                $(elm).wrap(&#39;&lt;div class=&quot;blur&quot;&gt;
&#39;);

                var wrapper = $(&#39;&lt;br /&gt;
&lt;div class=&quot;lens-wrap&quot;&gt;
&#39;).width($(elm).width()).height($(elm).height());
                wrapper.appendTo($(elm).parent());


                var lens = $(&#39;&lt;br /&gt;
&lt;div class=&quot;lens&quot;&gt;
&#39;).css(&#39;background&#39;, &#39;url(&#39; + $(elm).attr(&#39;src&#39;) + &#39;) no-repeat 0 0&#39;).width(w).height(h);
                lens.appendTo(wrapper);

                var endL = $(wrapper).width() - w;
                var endT = $(wrapper).height() - h - 3;

                $(wrapper).on(&#39;mousemove&#39;, function (e) {
                    lens.show();
                    var l = e.pageX - $(this).offset().left;
                    var t = e.pageY - $(this).offset().top;
                    lens.css({
                        left: l + &#39;px&#39;,
                        top: t + &#39;px&#39;,
                            &#39;background-position&#39;: &#39;-&#39; + l + &#39;px -&#39; + t + &#39;px&#39;
                    });
                });

                $(wrapper).on(&#39;mouseout&#39;, function (e) {
                    lens.hide();
                });

                $(elm).parent().css(&#39;visibility&#39;, &#39;visible&#39;);

                $(elm).pixastic(&quot;blurfast&quot;, {
                    amount: blur
                });
            }
        });
    }
})(jQuery);
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/code&gt;
&lt;/pre&gt;
&lt;div&gt;
&lt;h3 style=&quot;text-align: left;&quot;&gt;
&lt;b&gt;CSS&lt;/b&gt;&lt;/h3&gt;
&lt;/div&gt;
&lt;pre&gt;&lt;code class=&quot;css&quot;&gt;.blur {
    visibility: hidden;
    position:relative;
}
.blur .lens-wrap {
    position:absolute;
    top:0;
    left:0;
    width:100%;
    height:100%;
    z-index:200;
    overflow:hidden;
}
.blur .lens {
    display:none;
    width:50px;
    height: 50px;
    border:1px solid rgba(0, 0, 0, 0.5);
    box-shadow:0px 0px 10px #333;
    position:absolute;
    top:0;
    left:0;
    /*border-radius:100%;*/
    z-index:100;
    box-sizing:border-box;
    -moz-box-sizing:border-box;
    -webkit-box-sizing:border-box;
}
[filter=&quot;blur&quot;] {
    visibility:hidden;
}&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://ownmycode.blogspot.com/feeds/8121843188482732930/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ownmycode.blogspot.com/2013/08/clear-lens-jquery-plugin.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3063939708578051703/posts/default/8121843188482732930'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3063939708578051703/posts/default/8121843188482732930'/><link rel='alternate' type='text/html' href='http://ownmycode.blogspot.com/2013/08/clear-lens-jquery-plugin.html' title='Clear Lens - JQuery Plugin'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjaOn1EEzAV8Jwrq0U1YqDm3WlS5OCVx78sJv_xj_wtWINVbmbunLc7PHmP-oEP8vT19T8jB22mjxTfwh7tbPtzzXsCo-2Hv_Q5rBqjmby1shj-wSXMpWyzYiARLarQGUpLFSRP_w0T93ap/s72-c/clear+lens.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3063939708578051703.post-1911216939281354860</id><published>2012-12-12T12:59:00.003+05:30</published><updated>2017-03-28T12:30:54.212+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Javascript Tricks"/><title type='text'>Base Conversion in Javascript</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;You might think how base conversion worked out in JavaScript. Here the solution,&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #990000; font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;Number to Base Value&lt;/b&gt;&lt;/span&gt;&amp;nbsp; &lt;/span&gt;
&lt;pre&gt;&lt;code class=&quot;js&quot;&gt;Number.toString([radix]);&lt;/code&gt;&lt;/pre&gt;
&lt;i&gt;Number -&lt;/i&gt;  Integer number that is to be converted
&lt;i&gt;radix&lt;/i&gt; - base value either 2, 8, 16 (optional parameter)
&lt;br /&gt;&lt;br /&gt;
&lt;span style=&quot;color: #0b5394;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;b&gt;Example:&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;pre&gt;&lt;code class=&quot;js&quot;&gt;&amp;lt;script&amp;gt;&amp;nbsp;
//INTEGER TO BASE VALUE
var n = 42;
document.write(n.toString(2));
document.write(n.toString(8));
document.write(n.toString(16));

//HEX TO base
var h = 0xa;
document.write(n.toString(2));
document.write(n.toString(8));
&amp;lt;/script&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;span style=&quot;color: #0b5394;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;b&gt;Output:&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;pre&gt;&lt;code class=&quot;js&quot;&gt;101010
52
2a

1010
12
&lt;/code&gt;
&lt;/pre&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;color: #990000; font-size: large;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;Any &lt;span style=&quot;font-size: large;&quot;&gt;Base&lt;/span&gt; value &lt;/span&gt;to &lt;span style=&quot;font-size: large;&quot;&gt;In&lt;span style=&quot;font-size: large;&quot;&gt;tege&lt;span style=&quot;font-size: large;&quot;&gt;r value&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;pre&gt;&lt;code class=&quot;js&quot;&gt;parseInt(string, [radix]);&amp;nbsp;&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
&lt;i&gt;string &lt;/i&gt;- string that is to be converted. The string can be binary value, octal value or hexadecimal value
&lt;i&gt;&amp;nbsp;&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;radix&lt;/i&gt; - base value either 2, 8, 16 (optional parameter)&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #0b5394;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;b&gt;Example:&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;pre&gt;&lt;code class=&quot;js&quot;&gt;&amp;lt;script&amp;gt;&amp;nbsp;
//Binary to integer
document.write(parseInt(&#39;111&#39;,2));

//Octal to integer
document.write(parseInt(&#39;12&#39;,8));

//Hex to integer
document.write(parseInt(&#39;0xc&#39;,16));
&amp;lt;/script&amp;gt;
&lt;/code&gt;
&lt;/pre&gt;
&lt;span style=&quot;color: #0b5394;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;b&gt;Output:&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;pre&gt;&lt;code class=&quot;js&quot;&gt;7
10
12
&lt;/code&gt;
&lt;/pre&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://ownmycode.blogspot.com/feeds/1911216939281354860/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ownmycode.blogspot.com/2012/12/base-conversion-in-javascript.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3063939708578051703/posts/default/1911216939281354860'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3063939708578051703/posts/default/1911216939281354860'/><link rel='alternate' type='text/html' href='http://ownmycode.blogspot.com/2012/12/base-conversion-in-javascript.html' title='Base Conversion in Javascript'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3063939708578051703.post-7290755974965637055</id><published>2012-12-11T21:00:00.002+05:30</published><updated>2017-03-28T12:35:15.330+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="PHP"/><title type='text'>Exception Handling in PHP</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: black;&quot;&gt;Notices:&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;color: black;&quot;&gt;
&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;These
are trivial, non-critical errors that PHP encounters while executing a script&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;i&gt;&lt;span style=&quot;color: black;&quot;&gt;Example&lt;/span&gt;&lt;/i&gt;&lt;span style=&quot;color: black;&quot;&gt;:&amp;nbsp; Accessing a variable that has not yet been
defined. By default, such errors are not displayed to the user at all - although
you can change this default &lt;span style=&quot;font-size: small;&quot;&gt;behavior&lt;/span&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: black;&quot;&gt;Warnings:&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;These
are more serious errors&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;i&gt;&lt;span style=&quot;color: black;&quot;&gt;Example:&lt;/span&gt;&lt;/i&gt;&lt;span style=&quot;color: black;&quot;&gt;
attempting to include() a file which does not exist. By default, these errors
are displayed to the user, but they do not result in script termination.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: black;&quot;&gt;Fatal errors:&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;color: black;&quot;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;These
are critical errors&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;i&gt;&lt;span style=&quot;color: black;&quot;&gt;Example: &lt;/span&gt;&lt;/i&gt;&lt;span style=&quot;color: black;&quot;&gt;Instantiating
an object of a non-existent class, or calling a non-existent function. These
errors cause the immediate termination of the script, and PHP’s default &lt;span style=&quot;font-size: small;&quot;&gt;behavior&lt;/span&gt;
is to display them to the user when they take place.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: black;&quot;&gt;Parse Error:&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;color: black;&quot;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;When
we make mistake in PHP code like, missing semicolon or any unexpected symbol in
code&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;&lt;span style=&quot;line-height: 150%;&quot;&gt;What are Exceptions?&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;Exceptions are
the PHP 5 way of flagging up an unexpected event. They contain an information
message, and can be extended just like any other object. Exceptions are thrown
rather than warnings in newer PHP extensions, although you do still see
extensions returning errors.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;
When an exception is thrown, we either catch it where it happens, or it causes
the code to return to its calling context. If it isn’t caught there, it returns
again, and so on. As usual it is easier to explain with examples than
words!&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;Here is an
example in which&amp;nbsp;DateTimeZone&amp;nbsp;objects are created, first with a valid
timezone string of ‘Europe/Amsterdam’, then another with an invalid timezone
‘nonsense’:&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;color: #0070c0;&quot;&gt;$timezone = new DateTimeZone(&#39;Europe/Amsterdam&#39;);&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;

&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;color: #0070c0;&quot;&gt;var_dump($timezone);&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;

&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;

&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;color: #0070c0;&quot;&gt;$timezone2 = new DateTimeZone(&#39;nonsense&#39;);&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;As the&amp;nbsp;&lt;a href=&quot;http://www.php.net/manual/en/datetimezone.construct.php&quot;&gt;documentation
explains&lt;/a&gt;,&amp;nbsp;DateTimeZone&amp;nbsp;throws an exception when called with
unexpected data. This indeed happens if you run the above script, and the
exception appears as an error message from PHP, looking something like this:&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #0070c0;&quot;&gt;Exception:&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;color: #0070c0;&quot;&gt; DateTimeZone::__construct(): Unknown or bad timezone
(nonsense)&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;

&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;color: #0070c0;&quot;&gt;in /...../exception1.php on line 6&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;
We don’t want our entire application to stop and spit out errors over a
nonsense timezone, and working with exceptions means we can do so much more
with these situations than we can with errors. We “catch” exceptions and can
use the information in the exception itself and in the context of the current
scope to decide how best to react. This is a great improvement on the previous
situation of having a few different error levels and only being able to choose
whether to display, log or ignore each level as was the situation before PHP 5.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;&lt;span style=&quot;line-height: 150%;&quot;&gt;Handling Exceptions&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;We handle
exceptions with a try/catch block like this:&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;color: #0070c0;&quot;&gt;try {&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;

&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;color: #0070c0;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; $timezone2 =
new DateTimeZone(&#39;nonsense&#39;);&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;

&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;color: #0070c0;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; echo
&quot;time!&quot;;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;

&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;color: #0070c0;&quot;&gt;} catch(Exception $e) {&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;

&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;color: #0070c0;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; echo
&quot;Oops!&amp;nbsp; Something bad
happened!&quot;;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;

&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;color: #0070c0;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; print_r($e);&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;

&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;color: #0070c0;&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;The “try” bit
goes around the code that you would normally write, but which contains
operations which can cause an exception. The “catch” bit states what kind of
exception to catch, and contains the code to execute if we do catch anything.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;If you ran this
script with a valid timezone as the argument to
the&amp;nbsp;DateTimeZone&amp;nbsp;constructor, you would see the “time!” output and
never enter the code inside the “catch” block. However in our example, an
exception will be caused and so we jump straight into this block, without
echoing “time!”. This is a fairly key concept – the code in the try block
actually stops and we jump into the catch block and start executing from there.
Any code after the point at which the exception is throw simply isn’t run.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;&lt;span style=&quot;line-height: 150%;&quot;&gt;Inside an Exception&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;Exceptions can
hold all sorts of information. If we inspect our Exception thrown by
DateTimeZone’s constructor using&amp;nbsp;print_r, we’d see something like this:&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;color: #0070c0;&quot;&gt;Exception Object&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;

&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;color: #0070c0;&quot;&gt;(&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;

&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;color: #0070c0;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;
[message:protected] =&amp;gt; DateTimeZone::__construct(): Unknown or bad
timezone (nonsense)&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;

&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;color: #0070c0;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;
[string:private] =&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;

&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;color: #0070c0;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;
[code:protected] =&amp;gt; 0&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;

&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;color: #0070c0;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;
[file:protected] =&amp;gt;
/home/lorna/data/personal/publish/thinkvitamin/exceptions/exceptions2.php&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;

&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;color: #0070c0;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; [line:protected]
=&amp;gt; 4&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;

&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;color: #0070c0;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; [trace:private]
=&amp;gt; Array&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;

&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;color: #0070c0;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;

&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;color: #0070c0;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [0]
=&amp;gt; Array&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;

&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;color: #0070c0;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;

&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;color: #0070c0;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
[file] =&amp;gt;
/home/lorna/data/personal/publish/thinkvitamin/exceptions/exceptions2.php&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;

&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;color: #0070c0;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
[line] =&amp;gt; 4&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;

&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;color: #0070c0;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
[function] =&amp;gt; __construct&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;

&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;color: #0070c0;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
[class] =&amp;gt; DateTimeZone&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;

&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;color: #0070c0;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
[type] =&amp;gt; -&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;

&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;color: #0070c0;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
[args] =&amp;gt; Array&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;

&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;color: #0070c0;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
(&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;

&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;color: #0070c0;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [0] =&amp;gt; nonsense&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;

&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;color: #0070c0;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
)&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;

&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;

&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;color: #0070c0;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; )&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;

&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;

&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;color: #0070c0;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; )&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;

&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;

&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;color: #0070c0;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; [severity]
=&amp;gt; 2&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;

&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;color: #0070c0;&quot;&gt;)&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;Walking through
the object, there are many useful elements here:&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;&lt;i&gt;message&amp;nbsp;&lt;/i&gt;&lt;/b&gt;This
contains a useful and relevant information message&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;&lt;i&gt;code&amp;nbsp;&lt;/i&gt;&lt;/b&gt;By
default this is zero but we can use this to include a numeric error code with
our exception&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;&lt;i&gt;file&lt;/i&gt;&lt;/b&gt;&amp;nbsp;Path
to the file where this exception was thrown&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;&lt;i&gt;line&lt;/i&gt;&lt;/b&gt;&amp;nbsp;Line
number where the exception was thrown&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;&lt;i&gt;trace&lt;/i&gt;&lt;/b&gt;&amp;nbsp;This
is the stack trace, so you can see the stack of calls which were made before
this exception was thrown&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;This is all
valuable information and we can use it to inform how we handle errors in the
catch block in our code. In addition we’ll take a look at how we can set these
ourselves by making our own exceptions a little later on.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;&lt;span style=&quot;line-height: 150%;&quot;&gt;Throwing Exceptions&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;It isn’t only
PHP itself that can throw exceptions, we can use exactly the same functionality
in our own code. Here is a really simple example, taken directly from&amp;nbsp;&lt;a href=&quot;http://php.net/manual/en/language.exceptions.php&quot;&gt;the PHP manual&lt;/a&gt;&amp;nbsp;itself,
of how to throw an exception manually.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;color: #0070c0;&quot;&gt;function inverse($x) {&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;

&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;color: #0070c0;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (!$x) {&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;

&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;color: #0070c0;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; throw new
Exception(&#39;Division by zero.&#39;);&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;

&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;color: #0070c0;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;

&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;color: #0070c0;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; else return
1/$x;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;

&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;color: #0070c0;&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;We simply throw
a new&amp;nbsp;Exception&amp;nbsp;object that we create as we need it. The string
passed into the constructor becomes the object’s message property, and we can
also pass a second argument to the constructor if we want to set the code
property as well. It is usual to throw exceptions in functions or methods, and
then catch them from the location they are called – this lets the calling code
decide what to do in the context of what it intended and is much more flexible
than simple errors or having your methods return false and set an error string
somewhere, which I’m sure is how I solved this before exceptions were
introduced in PHP 5.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;&lt;span style=&quot;line-height: 150%;&quot;&gt;Extending Exceptions&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;The Exception
object by itself is great, but we can extend it so that we can return
additional information and different types of exceptions – so if one of a
number of different scenarios actually happens, we can respond differently.
Consider this script and in particular the&amp;nbsp;&lt;i&gt;takeTwoNumbers&lt;/i&gt;&amp;nbsp;function:&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;color: #0070c0;&quot;&gt;class BigNumberException extends Exception { }&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;

&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;color: #0070c0;&quot;&gt;class FavouriteNumberException extends Exception { }&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;

&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;

&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;color: #0070c0;&quot;&gt;function takeTwoNumbers($a, $b) {&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;

&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;color: #0070c0;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if($a &amp;gt; 15
|| $b &amp;gt; 15 || ($a + $b) &amp;gt; 20) {&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;

&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;color: #0070c0;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; throw new
BigNumberException(&#39;Keep it simple with smaller numbers&#39;);&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;

&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;color: #0070c0;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; } elseif($a !=
3 &amp;amp;&amp;amp; $b != 3) {&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;

&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;color: #0070c0;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; throw new
FavouriteNumberException(&#39;But three is my favourite number!&#39;);&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;

&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;color: #0070c0;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; } else {&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;

&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;color: #0070c0;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return $a +
$b;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;

&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;color: #0070c0;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;

&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;color: #0070c0;&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;

&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;

&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;color: #0070c0;&quot;&gt;try {&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;

&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;color: #0070c0;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; echo
takeTwoNumbers(3,9) . &quot;\n&quot;;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;

&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;color: #0070c0;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; echo
takeTwoNumbers(4,16) . &quot;\n&quot;;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;

&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;color: #0070c0;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; echo
takeTwoNumbers(7,5) . &quot;\n&quot;;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;

&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;color: #0070c0;&quot;&gt;} catch(Exception $e) {&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;

&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;color: #0070c0;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; echo
$e-&amp;gt;getMessage() . &quot;\n&quot;;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;

&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;color: #0070c0;&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;The function accepts
two numbers, checks the values, and if there are any problems, throws a
relevant exception. If the values are OK (and yes, this is a totally contrived
example, in an effort to illustrate the concept without any complicating
factors like the real world getting involved!) then the function simply adds
them together and returns them. Our calling script calls the function 3 times,
with different number sets. The first one executes fine and the numbers get
added together. However the second includes a large number and so an error is
thrown, causing our code to jump to the “catch” block, and so the third
function call is never made.&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;Although we
declared empty classes to extend&amp;nbsp;Exception&amp;nbsp;here and so only the class
name changed, you can do all sorts of things to help record the information you
need. We would set custom error messages here (remember the helpful error
message returned by&amp;nbsp;DateTimeZone?), set error codes, or even set new
properties of our own. It depends on your application which of these is helpful
but having the custom exception classes makes it very nice and tidy to do so.
The differing class names let us detect what *kind* of a problem occured and
what we want to do in response. When we catch an exception, we can state what
kind of an exception we wanted to catch – so we can narrow ourselves down to
only dealing with a known situation. We can also use multiple catch blocks,
like this:&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;color: #0070c0;&quot;&gt;try {&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;

&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;color: #0070c0;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; echo
takeTwoNumbers(3,9) . &quot;\n&quot;;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;

&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;color: #0070c0;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; echo
takeTwoNumbers(4,16) . &quot;\n&quot;;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;

&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;color: #0070c0;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; echo
takeTwoNumbers(7,5) . &quot;\n&quot;;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;

&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;color: #0070c0;&quot;&gt;} catch(BigNumberException $e) {&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;

&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;color: #0070c0;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; echo &quot;Big
Number: &quot; . $e-&amp;gt;getMessage() . &quot;\n&quot;;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;

&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;color: #0070c0;&quot;&gt;} catch(FavouriteNumberException $e) {&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;

&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;color: #0070c0;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; echo
&quot;Favourite Number: &quot; . $e-&amp;gt;getMessage() . &quot;\n&quot;;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;

&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;color: #0070c0;&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;In this example,
we can handle the two types of exception differently. If any other type of
exception were to occur, it wouldn’t be caught here, but instead would “bubble”
up the stack, getting returned from the end of the second catch block to
wherever this code was called from – in this very simple example we are in a simple
PHP file but if we were nested in functions, the code would keep on returning
until PHP caught the exception, or until it reached the top at which point it
would show an error like the one we saw at the start of this post.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;&lt;span style=&quot;line-height: 150%;&quot;&gt;Uncaught Exceptions&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;So if an
exception is thrown in a method, and not caught, it returns from the function
to where that function is called from. If it isn’t caught here, it returns to
where this code was called from, and so on until it reaches the top of the
stack. If it gets to the top of the stack, uncaught, we’ll see the error we saw
at the beginning of the post. We can also give PHP instructions about how to
handle any exceptions that get this far, using&lt;a href=&quot;http://www.php.net/manual/en/function.set-exception-handler.php&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #fabf8f;&quot;&gt; &lt;/span&gt;&lt;/b&gt;&lt;/span&gt;set_exception_handler&lt;/a&gt;.
Many frameworks will do this and return nicely formatted messages, often
logging the detail of the error so that users do not see it but developers can
do so. &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;Here’s an
example of a catch-all exception handling function:&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;color: #0070c0;&quot;&gt;function my_exception_handler($exception) {&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;

&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;color: #0070c0;&quot;&gt;&amp;nbsp;
error_log(&quot;Uncaught &quot; . get_class($exception) . &quot; exception:
&quot; . $exception-&amp;gt;getMessage() . &quot;\n&quot;);&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;

&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;color: #0070c0;&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;

&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;color: #0070c0;&quot;&gt;set_exception_handler(&#39;my_exception_handler&#39;);&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;

&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;color: #0070c0;&quot;&gt;throw new Exception(&#39;Oooops!&#39;);&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;All we need to
do is declare our exception handling function and then tell PHP to use it for
uncaught exceptions. This simple example simply passes a string to&amp;nbsp;&lt;a href=&quot;http://www.php.net/manual/en/function.error-log.php&quot;&gt;error_log&lt;/a&gt;&amp;nbsp;function,
which you can configure to behave however you need it to for your system. In a
real-world application you might want to notify administrators of the problem
or perhaps provide some nice feedback to the user in addition to logging the
error.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;&lt;span style=&quot;line-height: 150%;&quot;&gt;Exceptions in Your Applications&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;Hopefully this
has given some insight into what you can do with exceptions and how they
interact with the rest of your object-oriented application. Even functional
code needs awareness of exceptions since some core language elements now throw
them, so it is worth making sure you have the exception handler declared
alongside your existing error handler even if you don’t need to be extending or
throwing exceptions yourself.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 150%; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://ownmycode.blogspot.com/feeds/7290755974965637055/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ownmycode.blogspot.com/2012/12/exception-handling-in-php.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3063939708578051703/posts/default/7290755974965637055'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3063939708578051703/posts/default/7290755974965637055'/><link rel='alternate' type='text/html' href='http://ownmycode.blogspot.com/2012/12/exception-handling-in-php.html' title='Exception Handling in PHP'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3063939708578051703.post-95376887647324631</id><published>2012-12-11T20:38:00.001+05:30</published><updated>2017-03-28T22:01:18.504+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Animation using C"/><category scheme="http://www.blogger.com/atom/ns#" term="C Graphics"/><title type='text'>Random Bouncing Ball Animation</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Simple animation of random balls that bounces within the screen&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;color: #0b5394; font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;Source:&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;&lt;code class=&quot;cpp&quot;&gt;#include&amp;lt;stdio.h&amp;gt;
#include&amp;lt;graphics.h&amp;gt;
#include&amp;lt;conio.h&amp;gt;
#include&amp;lt;dos.h&amp;gt;
#include&amp;lt;math.h&amp;gt;

void drawBall(struct ball *b, int color);

struct ball{
int x, y;
int dx, dy;
int radius;
};

void main()
{
  int gd=0, gm=VGAHI;
  int i;
  struct ball b[10];
  initgraph(&amp;amp;gd, &amp;amp;gm, &quot;&quot;);

  for(i=1;i&amp;lt;=15;i++){
 b[i].radius = rand()%20;
 b[i].x=rand()%getmaxx();
 b[i].y=rand()%getmaxy();
 b[i].dx=2;
 b[i].dy=4;
  }

  while(!kbhit())
  {
 delay(5);
 cleardevice();
 for(i=1;i&amp;lt;=15;i++)
 drawBall(&amp;amp;b[i],i);
  }
closegraph();

}

void drawBall(struct ball *b, int color){
 setfillstyle(1,color);
 setcolor(color);
 fillellipse(b-&amp;gt;x, b-&amp;gt;y, b-&amp;gt;radius, b-&amp;gt;radius);
 if(b-&amp;gt;x+b-&amp;gt;radius &amp;gt; getmaxx() || b-&amp;gt;x-b-&amp;gt;radius&amp;lt;0)
 b-&amp;gt;dx = -b-&amp;gt;dx;
 if(b-&amp;gt;y+b-&amp;gt;radius &amp;gt; getmaxy() || b-&amp;gt;y-b-&amp;gt;radius&amp;lt;0)
 b-&amp;gt;dy = -b-&amp;gt;dy;

 b-&amp;gt;x+=b-&amp;gt;dx;
 b-&amp;gt;y+=b-&amp;gt;dy;
}
&lt;/code&gt;
&lt;/pre&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;color: #0b5394; font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;Output:&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgPVU1HzHwRqszdvVpXrpV86A7x6XReMqlxIYlx5dRRUDBZRjDDUIi3xO0qfLJLdTWHq85NVTt8buAg6ZMPshu5fz7doZ-VocV3Uer95qu8eX9qa_QthpZ-gFYuAOHPTCLbCrFTUM5wbPPO/s1600/BALLANIMATION.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;239&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgPVU1HzHwRqszdvVpXrpV86A7x6XReMqlxIYlx5dRRUDBZRjDDUIi3xO0qfLJLdTWHq85NVTt8buAg6ZMPshu5fz7doZ-VocV3Uer95qu8eX9qa_QthpZ-gFYuAOHPTCLbCrFTUM5wbPPO/s1600/BALLANIMATION.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://ownmycode.blogspot.com/feeds/95376887647324631/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ownmycode.blogspot.com/2012/12/random-bouncing-ball-animation.html#comment-form' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3063939708578051703/posts/default/95376887647324631'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3063939708578051703/posts/default/95376887647324631'/><link rel='alternate' type='text/html' href='http://ownmycode.blogspot.com/2012/12/random-bouncing-ball-animation.html' title='Random Bouncing Ball Animation'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgPVU1HzHwRqszdvVpXrpV86A7x6XReMqlxIYlx5dRRUDBZRjDDUIi3xO0qfLJLdTWHq85NVTt8buAg6ZMPshu5fz7doZ-VocV3Uer95qu8eX9qa_QthpZ-gFYuAOHPTCLbCrFTUM5wbPPO/s72-c/BALLANIMATION.png" height="72" width="72"/><thr:total>6</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3063939708578051703.post-4785056494004664786</id><published>2012-10-06T03:01:00.000+05:30</published><updated>2017-03-28T22:06:14.284+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="C Graphics"/><category scheme="http://www.blogger.com/atom/ns#" term="RGB in C"/><title type='text'>RGB in C</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div&gt;
Default palette size for normal graphics driver is 16 i.e) the color number rages from 0 to 15&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
To use rgb color modes we have to choose VGA or&amp;nbsp;IBM 8514&amp;nbsp;as a graphics driver&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
For VGA, Palette size is 16 i.e) color number ranges from 0-16&lt;/div&gt;
&lt;div&gt;
For IBM 8514, Palette size is 256 i.e) color number ranges from 0-255, we can also say it as VGA with 256 palette size&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
By using &lt;i&gt;&lt;b&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;setrgbpalette &lt;/span&gt;&lt;/b&gt;&lt;/i&gt;function we can generate RGB colors, we can generate colors with respect to Palette size. This function replaces the default palette colors with the generated Palette colors.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b style=&quot;color: #0b5394; font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;Syntax:&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;pre&gt;&lt;code class=&quot;cpp&quot;&gt;void setrgbpalette(int colornum, int red, int green, int blue);
/*
colornum - color number in palette (0-15 or 0-255 depens on graphics driver)
red - color value for red (0-255)
green - color value for green (0-255)
blue - color value for blue (0-255)
*/
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b style=&quot;color: #0b5394; font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;Example:&lt;/b&gt;&lt;br /&gt;&lt;/div&gt;
&lt;pre&gt;&lt;code class=&quot;cpp&quot;&gt;#include&amp;lt;graphics.h&amp;gt;
#include&amp;lt;stdio.h&amp;gt;
#include&amp;lt;conio.h&amp;gt;
#include&amp;lt;stdlib.h&amp;gt;
#include&amp;lt;time.h&amp;gt;
void main(){
int gd=VGA, gm=VGAHI, i, r, g, b , x, y, w ,h;
char *msg;
initgraph(&amp;amp;gd,&amp;amp;gm,&quot;&quot;);
w = getmaxx()/4;
h = getmaxy()/4;
randomize();
for(i=0;i&amp;lt;16;i++){
&amp;nbsp; x = w * (i % 4);
&amp;nbsp; y = h * (i / 4);
&amp;nbsp; r = random(255);
&amp;nbsp; g = random(255);
&amp;nbsp; b = random(255);

&amp;nbsp; setrgbpalette(i,r,g,b);
&amp;nbsp; setfillstyle(SOLID_FILL,i);
&amp;nbsp; bar(x , y , x+w, y+h);
&amp;nbsp; sprintf(msg, &quot;R:%d G:%d B:%d&quot;, r,g,b);
&amp;nbsp; outtextxy(x+10, y+10, msg);
}
getch();
}
&lt;/code&gt;
&lt;/pre&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #0b5394; font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;b&gt;Output:&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgR_a2T_Lw3kA4Rg5fJlmB4jrwh7_bnpdYZ49i-RlWZbHtqSPqcdkGPACDpZGsW2rCBaHgKyIiVHvbkUIhFEBjGb7KKqrXfWVda3VZVaXj4ZJHdeRRhfx9tqWFN217ol_3l1AUF-WfJH8kk/s1600/rgb+in+c.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;239&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgR_a2T_Lw3kA4Rg5fJlmB4jrwh7_bnpdYZ49i-RlWZbHtqSPqcdkGPACDpZGsW2rCBaHgKyIiVHvbkUIhFEBjGb7KKqrXfWVda3VZVaXj4ZJHdeRRhfx9tqWFN217ol_3l1AUF-WfJH8kk/s320/rgb+in+c.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://ownmycode.blogspot.com/feeds/4785056494004664786/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ownmycode.blogspot.com/2012/10/rgb-in-c.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3063939708578051703/posts/default/4785056494004664786'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3063939708578051703/posts/default/4785056494004664786'/><link rel='alternate' type='text/html' href='http://ownmycode.blogspot.com/2012/10/rgb-in-c.html' title='RGB in C'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgR_a2T_Lw3kA4Rg5fJlmB4jrwh7_bnpdYZ49i-RlWZbHtqSPqcdkGPACDpZGsW2rCBaHgKyIiVHvbkUIhFEBjGb7KKqrXfWVda3VZVaXj4ZJHdeRRhfx9tqWFN217ol_3l1AUF-WfJH8kk/s72-c/rgb+in+c.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3063939708578051703.post-3506152950874822970</id><published>2012-09-26T18:07:00.001+05:30</published><updated>2012-10-05T23:33:50.306+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="CSS Tricks"/><title type='text'>CSS Selectors</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;table border=&quot;1&quot; cellpadding=&quot;7&quot; cellspacing=&quot;0&quot; style=&quot;border-color: #333; width: 98%px;&quot;&gt;
  &lt;thead&gt;
&lt;tr&gt;
      &lt;th bgcolor=&quot;#0099CC&quot;&gt;&lt;span style=&quot;color: #eeeeee; font-family: Arial, Helvetica, sans-serif;&quot;&gt;Pattern&lt;/span&gt;&lt;/th&gt;
      &lt;th bgcolor=&quot;#0099CC&quot;&gt;&lt;span style=&quot;color: #eeeeee; font-family: Arial, Helvetica, sans-serif;&quot;&gt;Meaning&lt;/span&gt;&lt;/th&gt;
      &lt;th bgcolor=&quot;#0099CC&quot;&gt;&lt;span style=&quot;color: #eeeeee; font-family: Arial, Helvetica, sans-serif;&quot;&gt;Described in section&lt;/span&gt;&lt;/th&gt;
      &lt;th bgcolor=&quot;#0099CC&quot;&gt;&lt;span style=&quot;color: #eeeeee; font-family: Arial, Helvetica, sans-serif;&quot;&gt;First defined in CSS level&lt;/span&gt;&lt;/th&gt;
    &lt;/tr&gt;
&lt;/thead&gt;
  &lt;tbody&gt;
&lt;tr&gt;
      &lt;td&gt;&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;*&lt;/span&gt;&lt;/td&gt;
      &lt;td&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;any element&lt;/span&gt;&lt;/td&gt;
      &lt;td&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;Universal selector&lt;/span&gt;&lt;/td&gt;
      &lt;td&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;2&lt;/span&gt;&lt;/td&gt;
    &lt;/tr&gt;
&lt;tr&gt;
      &lt;td&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;E&lt;/span&gt;&lt;/td&gt;
      &lt;td&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;an element of type E&lt;/span&gt;&lt;/td&gt;
      &lt;td&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;Type selector&lt;/span&gt;&lt;/td&gt;
      &lt;td&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;1&lt;/span&gt;&lt;/td&gt;
    &lt;/tr&gt;
&lt;tr&gt;
      &lt;td&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;E[foo]&lt;/span&gt;&lt;/td&gt;
      &lt;td&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;an E element with a &quot;foo&quot; attribute&lt;/span&gt;&lt;/td&gt;
      &lt;td&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;Attribute selectors&lt;/span&gt;&lt;/td&gt;
      &lt;td&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;2&lt;/span&gt;&lt;/td&gt;
    &lt;/tr&gt;
&lt;tr&gt;
      &lt;td&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;E[foo=&quot;bar&quot;]&lt;/span&gt;&lt;/td&gt;
      &lt;td&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;an E element whose &quot;foo&quot; attribute value is exactly equal to &quot;bar&quot;&lt;/span&gt;&lt;/td&gt;
      &lt;td&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;Attribute selectors&lt;/span&gt;&lt;/td&gt;
      &lt;td&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;2&lt;/span&gt;&lt;/td&gt;
    &lt;/tr&gt;
&lt;tr&gt;
      &lt;td&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;E[foo~=&quot;bar&quot;]&lt;/span&gt;&lt;/td&gt;
      &lt;td&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;an E element whose &quot;foo&quot; attribute value is a list of whitespace-separated values, one of which is exactly equal to &quot;bar&quot;&lt;/span&gt;&lt;/td&gt;
      &lt;td&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;Attribute selectors&lt;/span&gt;&lt;/td&gt;
      &lt;td&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;2&lt;/span&gt;&lt;/td&gt;
    &lt;/tr&gt;
&lt;tr&gt;
      &lt;td&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;E[foo^=&quot;bar&quot;]&lt;/span&gt;&lt;/td&gt;
      &lt;td&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;an E element whose &quot;foo&quot; attribute value begins exactly with the string &quot;bar&quot;&lt;/span&gt;&lt;/td&gt;
      &lt;td&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;Attribute selectors&lt;/span&gt;&lt;/td&gt;
      &lt;td&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;3&lt;/span&gt;&lt;/td&gt;
    &lt;/tr&gt;
&lt;tr&gt;
      &lt;td&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;E[foo$=&quot;bar&quot;]&lt;/span&gt;&lt;/td&gt;
      &lt;td&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;an E element whose &quot;foo&quot; attribute value ends exactly with the string &quot;bar&quot;&lt;/span&gt;&lt;/td&gt;
      &lt;td&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;Attribute selectors&lt;/span&gt;&lt;/td&gt;
      &lt;td&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;3&lt;/span&gt;&lt;/td&gt;
    &lt;/tr&gt;
&lt;tr&gt;
      &lt;td&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;E[foo*=&quot;bar&quot;]&lt;/span&gt;&lt;/td&gt;
      &lt;td&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;an E element whose &quot;foo&quot; attribute value contains the substring &quot;bar&quot;&lt;/span&gt;&lt;/td&gt;
      &lt;td&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;Attribute selectors&lt;/span&gt;&lt;/td&gt;
      &lt;td&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;3&lt;/span&gt;&lt;/td&gt;
    &lt;/tr&gt;
&lt;tr&gt;
      &lt;td&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;E[foo|=&quot;en&quot;]&lt;/span&gt;&lt;/td&gt;
      &lt;td&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;an E element whose &quot;foo&quot; attribute has a hyphen-separated list of values beginning (from the left) with &quot;en&quot;&lt;/span&gt;&lt;/td&gt;
      &lt;td&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;Attribute selectors&lt;/span&gt;&lt;/td&gt;
      &lt;td&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;2&lt;/span&gt;&lt;/td&gt;
    &lt;/tr&gt;
&lt;tr&gt;
      &lt;td&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;E:root&lt;/span&gt;&lt;/td&gt;
      &lt;td&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;an E element, root of the document&lt;/span&gt;&lt;/td&gt;
      &lt;td&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;Structural pseudo-classes&lt;/span&gt;&lt;/td&gt;
      &lt;td&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;3&lt;/span&gt;&lt;/td&gt;
    &lt;/tr&gt;
&lt;tr&gt;
      &lt;td&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;E:nth-child(n)&lt;/span&gt;&lt;/td&gt;
      &lt;td&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;an E element, the n-th child of its parent&lt;/span&gt;&lt;/td&gt;
      &lt;td&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;Structural pseudo-classes&lt;/span&gt;&lt;/td&gt;
      &lt;td&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;3&lt;/span&gt;&lt;/td&gt;
    &lt;/tr&gt;
&lt;tr&gt;
      &lt;td&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;E:nth-last-child(n)&lt;/span&gt;&lt;/td&gt;
      &lt;td&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;an E element, the n-th child of its parent, counting from the last one&lt;/span&gt;&lt;/td&gt;
      &lt;td&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;Structural pseudo-classes&lt;/span&gt;&lt;/td&gt;
      &lt;td&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;3&lt;/span&gt;&lt;/td&gt;
    &lt;/tr&gt;
&lt;tr&gt;
      &lt;td&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;E:nth-of-type(n)&lt;/span&gt;&lt;/td&gt;
      &lt;td&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;an E element, the n-th sibling of its type&lt;/span&gt;&lt;/td&gt;
      &lt;td&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;Structural pseudo-classes&lt;/span&gt;&lt;/td&gt;
      &lt;td&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;3&lt;/span&gt;&lt;/td&gt;
    &lt;/tr&gt;
&lt;tr&gt;
      &lt;td&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;E:nth-last-of-type(n)&lt;/span&gt;&lt;/td&gt;
      &lt;td&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;an E element, the n-th sibling of its type, counting from the last one&lt;/span&gt;&lt;/td&gt;
      &lt;td&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;Structural pseudo-classes&lt;/span&gt;&lt;/td&gt;
      &lt;td&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;3&lt;/span&gt;&lt;/td&gt;
    &lt;/tr&gt;
&lt;tr&gt;
      &lt;td&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;E:first-child&lt;/span&gt;&lt;/td&gt;
      &lt;td&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;an E element, first child of its parent&lt;/span&gt;&lt;/td&gt;
      &lt;td&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;Structural pseudo-classes&lt;/span&gt;&lt;/td&gt;
      &lt;td&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;2&lt;/span&gt;&lt;/td&gt;
    &lt;/tr&gt;
&lt;tr&gt;
      &lt;td&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;E:last-child&lt;/span&gt;&lt;/td&gt;
      &lt;td&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;an E element, last child of its parent&lt;/span&gt;&lt;/td&gt;
      &lt;td&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;Structural pseudo-classes&lt;/span&gt;&lt;/td&gt;
      &lt;td&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;3&lt;/span&gt;&lt;/td&gt;
    &lt;/tr&gt;
&lt;tr&gt;
      &lt;td&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;E:first-of-type&lt;/span&gt;&lt;/td&gt;
      &lt;td&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;an E element, first sibling of its type&lt;/span&gt;&lt;/td&gt;
      &lt;td&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;Structural pseudo-classes&lt;/span&gt;&lt;/td&gt;
      &lt;td&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;3&lt;/span&gt;&lt;/td&gt;
    &lt;/tr&gt;
&lt;tr&gt;
      &lt;td&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;E:last-of-type&lt;/span&gt;&lt;/td&gt;
      &lt;td&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;an E element, last sibling of its type&lt;/span&gt;&lt;/td&gt;
      &lt;td&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;Structural pseudo-classes&lt;/span&gt;&lt;/td&gt;
      &lt;td&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;3&lt;/span&gt;&lt;/td&gt;
    &lt;/tr&gt;
&lt;tr&gt;
      &lt;td&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;E:only-child&lt;/span&gt;&lt;/td&gt;
      &lt;td&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;an E element, only child of its parent&lt;/span&gt;&lt;/td&gt;
      &lt;td&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;Structural pseudo-classes&lt;/span&gt;&lt;/td&gt;
      &lt;td&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;3&lt;/span&gt;&lt;/td&gt;
    &lt;/tr&gt;
&lt;tr&gt;
      &lt;td&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;E:only-of-type&lt;/span&gt;&lt;/td&gt;
      &lt;td&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;an E element, only sibling of its type&lt;/span&gt;&lt;/td&gt;
      &lt;td&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;Structural pseudo-classes&lt;/span&gt;&lt;/td&gt;
      &lt;td&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;3&lt;/span&gt;&lt;/td&gt;
    &lt;/tr&gt;
&lt;tr&gt;
      &lt;td&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;E:empty&lt;/span&gt;&lt;/td&gt;
      &lt;td&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;an E element that has no children (including text nodes)&lt;/span&gt;&lt;/td&gt;
      &lt;td&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;Structural pseudo-classes&lt;/span&gt;&lt;/td&gt;
      &lt;td&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;3&lt;/span&gt;&lt;/td&gt;
    &lt;/tr&gt;
&lt;tr&gt;
      &lt;td&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;E:link&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;E:visited&lt;/span&gt;&lt;/td&gt;
      &lt;td&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;an E element being the source anchor of a hyperlink of which the target is not yet visited (:link) or already visited (:visited)&lt;/span&gt;&lt;/td&gt;
      &lt;td&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;The link pseudo-classes&lt;/span&gt;&lt;/td&gt;
      &lt;td&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;1&lt;/span&gt;&lt;/td&gt;
    &lt;/tr&gt;
&lt;tr&gt;
      &lt;td&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;E:active&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;E:hover&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;E:focus&lt;/span&gt;&lt;/td&gt;
      &lt;td&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;an E element during certain user actions&lt;/span&gt;&lt;/td&gt;
      &lt;td&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;The user action pseudo-classes&lt;/span&gt;&lt;/td&gt;
      &lt;td&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;1 and 2&lt;/span&gt;&lt;/td&gt;
    &lt;/tr&gt;
&lt;tr&gt;
      &lt;td&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;E:target&lt;/span&gt;&lt;/td&gt;
      &lt;td&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;an E element being the target of the referring URI&lt;/span&gt;&lt;/td&gt;
      &lt;td&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;The target pseudo-class&lt;/span&gt;&lt;/td&gt;
      &lt;td&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;3&lt;/span&gt;&lt;/td&gt;
    &lt;/tr&gt;
&lt;tr&gt;
      &lt;td&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;E:lang(fr)&lt;/span&gt;&lt;/td&gt;
      &lt;td&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;an element of type E in language &quot;fr&quot; (the document language specifies how language is determined)&lt;/span&gt;&lt;/td&gt;
      &lt;td&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;The :lang() pseudo-class&lt;/span&gt;&lt;/td&gt;
      &lt;td&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;2&lt;/span&gt;&lt;/td&gt;
    &lt;/tr&gt;
&lt;tr&gt;
      &lt;td&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;E:enabled&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;E:disabled&lt;/span&gt;&lt;/td&gt;
      &lt;td&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;a user interface element E which is enabled or disabled&lt;/span&gt;&lt;/td&gt;
      &lt;td&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;The UI element states pseudo-classes&lt;/span&gt;&lt;/td&gt;
      &lt;td&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;3&lt;/span&gt;&lt;/td&gt;
    &lt;/tr&gt;
&lt;tr&gt;
      &lt;td&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;E:checked&lt;/span&gt;&lt;/td&gt;
      &lt;td&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;a user interface element E which is checked&amp;nbsp;(for instance a radio-button or checkbox)&lt;/span&gt;&lt;/td&gt;
      &lt;td&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;The UI element states pseudo-classes&lt;/span&gt;&lt;/td&gt;
      &lt;td&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;3&lt;/span&gt;&lt;/td&gt;
    &lt;/tr&gt;
&lt;tr&gt;
      &lt;td&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;E::first-line&lt;/span&gt;&lt;/td&gt;
      &lt;td&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;the first formatted line of an E element&lt;/span&gt;&lt;/td&gt;
      &lt;td&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;The ::first-line pseudo-element&lt;/span&gt;&lt;/td&gt;
      &lt;td&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;1&lt;/span&gt;&lt;/td&gt;
    &lt;/tr&gt;
&lt;tr&gt;
      &lt;td&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;E::first-letter&lt;/span&gt;&lt;/td&gt;
      &lt;td&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;the first formatted letter of an E element&lt;/span&gt;&lt;/td&gt;
      &lt;td&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;The ::first-letter pseudo-element&lt;/span&gt;&lt;/td&gt;
      &lt;td&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;1&lt;/span&gt;&lt;/td&gt;
    &lt;/tr&gt;
&lt;tr&gt;
      &lt;td&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;E::before&lt;/span&gt;&lt;/td&gt;
      &lt;td&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;generated content before an E element&lt;/span&gt;&lt;/td&gt;
      &lt;td&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;The ::before pseudo-element&lt;/span&gt;&lt;/td&gt;
      &lt;td&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;2&lt;/span&gt;&lt;/td&gt;
    &lt;/tr&gt;
&lt;tr&gt;
      &lt;td&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;E::after&lt;/span&gt;&lt;/td&gt;
      &lt;td&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;generated content after an E element&lt;/span&gt;&lt;/td&gt;
      &lt;td&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;The ::after pseudo-element&lt;/span&gt;&lt;/td&gt;
      &lt;td&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;2&lt;/span&gt;&lt;/td&gt;
    &lt;/tr&gt;
&lt;tr&gt;
      &lt;td&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;E.warning&lt;/span&gt;&lt;/td&gt;
      &lt;td&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;an E element whose class is &quot;warning&quot; (the document language specifies how class is determined).&lt;/span&gt;&lt;/td&gt;
      &lt;td&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;Class selectors&lt;/span&gt;&lt;/td&gt;
      &lt;td&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;1&lt;/span&gt;&lt;/td&gt;
    &lt;/tr&gt;
&lt;tr&gt;
      &lt;td&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;E#myid&lt;/span&gt;&lt;/td&gt;
      &lt;td&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;an E element with ID equal to &quot;myid&quot;.&lt;/span&gt;&lt;/td&gt;
      &lt;td&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;ID selectors&lt;/span&gt;&lt;/td&gt;
      &lt;td&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;1&lt;/span&gt;&lt;/td&gt;
    &lt;/tr&gt;
&lt;tr&gt;
      &lt;td&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;E:not(s)&lt;/span&gt;&lt;/td&gt;
      &lt;td&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;an E element that does not match simple selector s&lt;/span&gt;&lt;/td&gt;
      &lt;td&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;Negation pseudo-class&lt;/span&gt;&lt;/td&gt;
      &lt;td&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;3&lt;/span&gt;&lt;/td&gt;
    &lt;/tr&gt;
&lt;tr&gt;
      &lt;td&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;E F&lt;/span&gt;&lt;/td&gt;
      &lt;td&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;an F element descendant of an E element&lt;/span&gt;&lt;/td&gt;
      &lt;td&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;Descendant combinator&lt;/span&gt;&lt;/td&gt;
      &lt;td&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;1&lt;/span&gt;&lt;/td&gt;
    &lt;/tr&gt;
&lt;tr&gt;
      &lt;td&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;E &amp;gt; F&lt;/span&gt;&lt;/td&gt;
      &lt;td&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;an F element child of an E element&lt;/span&gt;&lt;/td&gt;
      &lt;td&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;Child combinator&lt;/span&gt;&lt;/td&gt;
      &lt;td&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;2&lt;/span&gt;&lt;/td&gt;
    &lt;/tr&gt;
&lt;tr&gt;
      &lt;td&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;E + F&lt;/span&gt;&lt;/td&gt;
      &lt;td&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;an F element immediately preceded by an E element&lt;/span&gt;&lt;/td&gt;
      &lt;td&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;Adjacent sibling combinator&lt;/span&gt;&lt;/td&gt;
      &lt;td&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;2&lt;/span&gt;&lt;/td&gt;
    &lt;/tr&gt;
&lt;tr&gt;
      &lt;td&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;E ~ F&lt;/span&gt;&lt;/td&gt;
      &lt;td&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;an F element preceded by an E element&lt;/span&gt;&lt;/td&gt;
      &lt;td&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;General sibling combinator&lt;/span&gt;&lt;/td&gt;
      &lt;td&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;3&lt;/span&gt;&lt;/td&gt;
    &lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://ownmycode.blogspot.com/feeds/3506152950874822970/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ownmycode.blogspot.com/2012/09/css.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3063939708578051703/posts/default/3506152950874822970'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3063939708578051703/posts/default/3506152950874822970'/><link rel='alternate' type='text/html' href='http://ownmycode.blogspot.com/2012/09/css.html' title='CSS Selectors'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3063939708578051703.post-5941226676231553499</id><published>2012-09-22T19:18:00.001+05:30</published><updated>2017-04-05T03:12:35.899+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="CSS Tricks"/><title type='text'>Creating arrow edges using CSS</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;Before we start, we have to understand the concept behind &amp;nbsp;&quot;&lt;b&gt;border&lt;/b&gt;&quot;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;Basically, borders render like this:&lt;/span&gt;&lt;br /&gt;
&lt;pre class=&quot;css&quot;&gt;&lt;code&gt;#sampleStyle{
   border-top   : 25px solid #a71d95;
   border-right : 25px solid #1da2a7;
   border-bottom: 25px solid #70a71d;
   border-left  : 25px solid #c10902;
   width :60px;
   heigth:60px;
}&lt;/code&gt;
&lt;/pre&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEii4lFPr41ZIQeEKPjC0aLeLGMyRaDED0drXg8OzNtcuJ0JRK1tJnzm1plkKERYzD9Q9ypTacPAzuvbJu_8XBWM92PApSMMObTGQxSFCjVs2UE1UTdnHdAAMeEth_P8uochNcbQYkwygpe0/s1600/arrow-css.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEii4lFPr41ZIQeEKPjC0aLeLGMyRaDED0drXg8OzNtcuJ0JRK1tJnzm1plkKERYzD9Q9ypTacPAzuvbJu_8XBWM92PApSMMObTGQxSFCjVs2UE1UTdnHdAAMeEth_P8uochNcbQYkwygpe0/s1600/arrow-css.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;span style=&quot;color: blue; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;If we compress the content area, i.e) make&lt;/span&gt; &lt;span style=&quot;color: blue; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;width&lt;/span&gt; &lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;and &lt;/span&gt;&lt;span style=&quot;color: blue; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;height&lt;/span&gt; &lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;values to&lt;/span&gt; &lt;span style=&quot;color: blue; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&quot;0px&quot;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;css&quot;&gt;&lt;code&gt;#sampleStyle{
     border-top   : 25px solid #a71d95;
     border-right : 25px solid #1da2a7;
     border-bottom: 25px solid #70a71d;
     border-left  : 25px solid #c10902;
     width :0px;
     heigth:0px;
}
&lt;/code&gt;
&lt;/pre&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgdczmW1OCZVgUC999gWmQ74J7uaR7SgfSrKXD2_wT7huG6p83s22vth-Orh9bdshgIbk7zgxW3FtADCm1gY_fIAOSbds8wB-m9QiMY0YIg55ojWcl5NToQDqxdz35Mz_Pfy4y8RSj9BQvx/s1600/arrow-css2.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgdczmW1OCZVgUC999gWmQ74J7uaR7SgfSrKXD2_wT7huG6p83s22vth-Orh9bdshgIbk7zgxW3FtADCm1gY_fIAOSbds8wB-m9QiMY0YIg55ojWcl5NToQDqxdz35Mz_Pfy4y8RSj9BQvx/s1600/arrow-css2.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;span style=&quot;color: blue; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;If we want right arrow , make all&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp;border-color&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;except&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp;border-left-color&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;to&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp;transparent&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;pre class=&quot;css&quot;&gt;&lt;code&gt;#sampleStyle{
     border-top   : 25px solid #a71d95;
     border-right : 25px solid #1da2a7;
     border-bottom: 25px solid #70a71d;
     border-left  : 25px solid #c10902;
     width :0px;
     heigth:0px;
}&lt;/code&gt;&lt;/pre&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhPl0FlWoIvWE3uaMI58WWEPfreDKN5eMrMG7HtX3MritcojTUAFOUmIMDjF5WeX3e7i0QkLht-suruefygVCM9lQcW020cCy06p5T6onIXqH4bXWPpBPTQPTkH74Y3X27BTwJ_WBKe48iH/s1600/arrow-css3.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhPl0FlWoIvWE3uaMI58WWEPfreDKN5eMrMG7HtX3MritcojTUAFOUmIMDjF5WeX3e7i0QkLht-suruefygVCM9lQcW020cCy06p5T6onIXqH4bXWPpBPTQPTkH74Y3X27BTwJ_WBKe48iH/s1600/arrow-css3.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;span style=&quot;color: blue; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: blue; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #666666; font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;b&gt;Example:&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;pre class=&quot;css&quot;&gt;&lt;code&gt;.arrow_box { 
  position: relative;
  background: #182126; 
  border: 1px solid #000000; 
  padding: 40px;
  width: 280px;
  height: 100px;
  border-radius: 6px;
  font-family:&quot;Arial&quot;;
  font-size:46px;
} 

.arrow_box:after, .arrow_box:before { 
  top: 100%; 
  border: solid transparent; 
  content: &quot; &quot;; 
  height: 0; 
  width: 0; 
  position: absolute; 
  pointer-events: none;
} 

.arrow_box:after { 
  border-color: rgba(24, 33, 38, 0); 
  border-top-color: #182126; 
  border-width: 30px; 
  left: 50%; 
  margin-left: -30px; 
}

.arrow_box:before { 
  border-color: rgba(0, 0, 0, 0); 
  border-top-color: #000000; 
  border-width: 31px; 
  left: 50%; 
  margin-left: -31px; 
}&lt;/code&gt;&lt;/pre&gt;
&lt;b style=&quot;color: #cc0000; font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;&lt;i&gt;HTML&lt;/i&gt;&lt;/b&gt;&lt;br /&gt;
&lt;pre class=&quot;html&quot;&gt;&lt;code&gt;&amp;lt;div class=&quot;arrow_box&quot;&amp;gt;CSS ARROW EXAMPLE&amp;lt;/div&amp;gt;&lt;/code&gt;&lt;/pre&gt;
&lt;b style=&quot;color: #cc0000; font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;/b&gt;
&lt;b style=&quot;color: #cc0000; font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;&lt;i&gt;OUTPUT&lt;/i&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhCEDE_AOw6lS00n0USG5dOKDrTijUWYlJkPvqbbOMT40R0HgMJPelsmgkK-XzJ7Q4ePf4FXci4KLpzxBF_APWQjnpGDksyGLOuYGLH-3hvT327ZpAxCDdvcLO0PCwQ8iNMyJLohObvywYS/s1600/arrow-css4.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;186&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhCEDE_AOw6lS00n0USG5dOKDrTijUWYlJkPvqbbOMT40R0HgMJPelsmgkK-XzJ7Q4ePf4FXci4KLpzxBF_APWQjnpGDksyGLOuYGLH-3hvT327ZpAxCDdvcLO0PCwQ8iNMyJLohObvywYS/s320/arrow-css4.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;b style=&quot;color: #cc0000; font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;/b&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://ownmycode.blogspot.com/feeds/5941226676231553499/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ownmycode.blogspot.com/2012/09/creating-arrow-edges-using-css.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3063939708578051703/posts/default/5941226676231553499'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3063939708578051703/posts/default/5941226676231553499'/><link rel='alternate' type='text/html' href='http://ownmycode.blogspot.com/2012/09/creating-arrow-edges-using-css.html' title='Creating arrow edges using CSS'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEii4lFPr41ZIQeEKPjC0aLeLGMyRaDED0drXg8OzNtcuJ0JRK1tJnzm1plkKERYzD9Q9ypTacPAzuvbJu_8XBWM92PApSMMObTGQxSFCjVs2UE1UTdnHdAAMeEth_P8uochNcbQYkwygpe0/s72-c/arrow-css.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3063939708578051703.post-2942117159991265362</id><published>2012-09-13T15:13:00.001+05:30</published><updated>2016-06-03T20:59:55.008+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="C Graphics"/><category scheme="http://www.blogger.com/atom/ns#" term="Mini Projects in C"/><title type='text'>Personal Diary - A Mini Project Written in Turbo C With Graphical Interface</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
&lt;br /&gt;
A Simple Personal Diary written in Turbo C with Graphical User Interface&lt;br /&gt;
&lt;br /&gt;
Features,&lt;br /&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;Birthday Reminder&lt;/li&gt;
&lt;li&gt;Notes&lt;/li&gt;
&lt;li&gt;Address Book &lt;/li&gt;
&lt;/ul&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;script async src=&quot;https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js&quot;&gt;&lt;/script&gt;
&lt;!-- In-Post-Ad - 1 --&gt;
&lt;ins class=&quot;adsbygoogle&quot;
     style=&quot;display:inline-block;width:320px;height:100px&quot;
     data-ad-client=&quot;ca-pub-0251842217053898&quot;
     data-ad-slot=&quot;2230369117&quot;&gt;&lt;/ins&gt;
&lt;script&gt;
(adsbygoogle = window.adsbygoogle || []).push({});
&lt;/script&gt;
&lt;/div&gt;
The main part of the project is UI&lt;br /&gt;
&lt;br /&gt;
&#39;GUI.h&#39; header file includes texbox, message-box and more custom graphical functions&amp;nbsp; &lt;br /&gt;
&#39; Dairy.h&#39; header file includes functionality of Personal Dairy&lt;br /&gt;
&#39; Dairyload.c&#39; includes loadingscreen, login screen, installation check etc&lt;br /&gt;
&#39;Dairy.c&#39; - execution stats here&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;img border=&quot;0&quot; height=&quot;239&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg3Ot58XnzzsMSTM-AAa3LOLxlo8mCnrbUuAjlA3hFIdGrXBWQai9BlOZLplj4e80p2bzX8IDJRJ9aJltZGs1njZJUKvBXj-5CkVaSACLn96TJgO-UWo8cQGUAbLeD2Yux5_uslO9urWOsm/s320/SCREEN+SHOT.png&quot; width=&quot;320&quot; /&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;a href=&quot;https://docs.google.com/file/d/0B1qnUITImQbhWHR2MnJHb0NnZVU/edit?usp=sharing&quot; target=&quot;_blank&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhvW0VjQlsaryx_3SxZjInJdtqs-SF4i86Ep0mcipabV_7x2HyGZnQGLtQc1Pi8ewe95FYfZPUxWEOLjML3wEFSPf4oMCPZ347T5ROf3Hx82KGZp6FmzzHdVGkbWxsYzvmQftRpXlLvo3gH/s200/download.jpg&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;script async src=&quot;https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js&quot;&gt;&lt;/script&gt;
&lt;!-- In-Post-Ad - 1 --&gt;
&lt;ins class=&quot;adsbygoogle&quot;
     style=&quot;display:inline-block;width:320px;height:100px&quot;
     data-ad-client=&quot;ca-pub-0251842217053898&quot;
     data-ad-slot=&quot;2230369117&quot;&gt;&lt;/ins&gt;
&lt;script&gt;
(adsbygoogle = window.adsbygoogle || []).push({});
&lt;/script&gt;
&lt;/div&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ownmycode.blogspot.com/feeds/2942117159991265362/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ownmycode.blogspot.com/2012/09/Pesonal-Diary-A-Mini-Project-In-Written-in-Turbo-C.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3063939708578051703/posts/default/2942117159991265362'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3063939708578051703/posts/default/2942117159991265362'/><link rel='alternate' type='text/html' href='http://ownmycode.blogspot.com/2012/09/Pesonal-Diary-A-Mini-Project-In-Written-in-Turbo-C.html' title='Personal Diary - A Mini Project Written in Turbo C With Graphical Interface'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg3Ot58XnzzsMSTM-AAa3LOLxlo8mCnrbUuAjlA3hFIdGrXBWQai9BlOZLplj4e80p2bzX8IDJRJ9aJltZGs1njZJUKvBXj-5CkVaSACLn96TJgO-UWo8cQGUAbLeD2Yux5_uslO9urWOsm/s72-c/SCREEN+SHOT.png" height="72" width="72"/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3063939708578051703.post-8431145038988646205</id><published>2012-09-07T14:18:00.001+05:30</published><updated>2017-04-05T03:25:26.242+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="3D in C"/><category scheme="http://www.blogger.com/atom/ns#" term="C Graphics"/><category scheme="http://www.blogger.com/atom/ns#" term="Computer Graphics Lab Program"/><title type='text'>3D Projection</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;I hope you will remember&amp;nbsp;&lt;i&gt;engineering graphics&lt;/i&gt; in your first year of engineering, This basic idea will be useful in understanding the concept. &amp;nbsp;Usually projection is nothing but the representation of a 3D object in a 2D form with the angle we view. Basically we represent a 3D object in a 2D form with three basic views&lt;/span&gt;&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;Front View&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;Top View&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;Side View&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;In the following code, the user is asked to enter the co-ordinates for a 2D object and with the depth we enter it will generate a 3D object. For example , consider a cube - the view you see without a depth will be a square.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;&lt;b&gt;Note: &lt;/b&gt;&lt;i&gt;In computer graphics the co-ordinates start from top-left (0,0) of your screen&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;script async=&quot;&quot; src=&quot;https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js&quot;&gt;&lt;/script&gt;
&lt;!-- In-Post-Ad - 1 --&gt;
&lt;br /&gt;
&lt;ins class=&quot;adsbygoogle&quot; data-ad-client=&quot;ca-pub-0251842217053898&quot; data-ad-slot=&quot;2230369117&quot; style=&quot;display: inline-block; height: 100px; width: 320px;&quot;&gt;&lt;/ins&gt;&lt;script&gt;
(adsbygoogle = window.adsbygoogle || []).push({});
&lt;/script&gt;
&lt;/div&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif; font-size: x-small;&quot;&gt;&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;/span&gt;
&lt;span style=&quot;color: #0b5394; font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;b&gt;CODE :&lt;/b&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;pre class=&quot;cpp&quot;&gt;
&lt;code&gt;
#include &amp;lt;stdio.h&amp;gt;
#include &amp;lt;stdlib.h&amp;gt;
#include &amp;lt;graphics.h&amp;gt;
#include &amp;lt;conio.h&amp;gt;

int ARRAY_SIZE;

int array_max(int *arr, int returnIndex);
int array_min(int *arr, int returnIndex);
void draw3d(int sides, int *x, int *y, int depth);
void drawFrontView(int sides, int *x, int *y);
void drawSideView(int sides, int *x, int *y, int depth);
void drawTopView(int sides,int *x,int *y, int depth);
void drawAxis(int *x, int *y, int depth);

int array_max(int *arr, int returnIndex){
  int i, max = arr[0], index=0;
  for(i=1;i&amp;lt;ARRAY_SIZE;i++){
      if(arr[i]&amp;gt;max)
      {
       max=arr[i];
       index=i;
      }
  }
  return returnIndex?index:max;
}

int array_min(int *arr, int returnIndex){
  int i, min = arr[0], index=0;
  for(i=1;i&amp;lt;ARRAY_SIZE;i++){
      if(arr[i]&amp;lt;min)
      {
  min=arr[i];
  index=i;
      }
  }
  return returnIndex?index:min;
}

void drawAxis(int *x, int *y, int depth){
  int maxy, minx;
  maxy = array_max(y,0);
  minx = array_min(x,0);

  setcolor(BLUE);
  //z-axis
  line(minx+depth, maxy-depth, -depth, getmaxy());
  //x-axis
  line(minx+depth, maxy-depth, getmaxx(), maxy-depth);
  //y-axis
  line(minx+depth, maxy-depth, minx+depth, 0);
  setlinestyle(0,1,2);
  setfillstyle(CLOSE_DOT_FILL, WHITE);
  floodfill(0,0,BLUE);
  setfillstyle(CLOSE_DOT_FILL, BROWN);
  floodfill(getmaxx(),0,BLUE);
  setfillstyle(CLOSE_DOT_FILL, DARKGRAY);
  floodfill(getmaxx(),getmaxy(),BLUE);
}

void draw3d(int sides,int *x,int *y,int depth)
{
  int i,j,k=0;
  setlinestyle(0,1,1);
  drawAxis(x, y, depth);
  setcolor(YELLOW);
  for(j=0;j&amp;lt;2;j++)
  {
    for(i=0;i&amp;lt;sides;i++)
    {
      if(i!=sides-1)
      line(x[i]+k,y[i]-k,x[i+1]+k,y[i+1]-k);
      else
      line(x[i]+k,y[i]-k,x[0]+k,y[0]-k);

      if(j==0)
      line(x[i],y[i],x[i]+depth,y[i]-depth);
    }
    k=depth;
  }
}

void drawFrontView(int sides,int *x,int *y)
{
    int i;
    setlinestyle(0,1,1);
    setcolor(LIGHTGREEN);
    for(i=0;i&amp;lt;sides;i++)
    {
       if(i!=sides-1)
       line(x[i],y[i],x[i+1],y[i+1]);
       else
       line(x[i],y[i],x[0],y[0]);
    }
}

void drawSideView(int sides,int *x,int *y, int depth)
{
    int i, maxyIndex, minyIndex, maxxIndex;
    maxxIndex=array_max(x,1);
    maxyIndex=array_max(y,1);
    minyIndex=array_min(y,1);

    setcolor(LIGHTGREEN);
    for(i=0;i&amp;lt;sides-1;i++)
    {
 if(y[i]&amp;lt;y[maxyIndex] &amp;&amp; y[i]&amp;gt;y[minyIndex] &amp;&amp; x[i]&amp;lt;x[maxxIndex])
 setlinestyle(3,1,1);
 else
 setlinestyle(0,1,1);

 line(x[0],y[i],x[0],y[i+1]);
 line(x[0]+depth*2,y[i],x[0]+depth*2,y[i+1]);
 line(x[0],y[i],x[0]+depth*2,y[i]);
 line(x[0],y[i+1],x[0]+depth*2,y[i+1]);
    }
}

void drawTopView(int sides, int *x, int *y, int depth)
{
    int i, minyIndex, maxxIndex, minxIndex;
    maxxIndex=array_max(x,1);
    minxIndex=array_min(x,1);
    minyIndex=array_min(y,1);
    setcolor(LIGHTGREEN);
    for(i=0;i&amp;lt;sides-1;i++)
    {
 if(x[i]&amp;lt;x[maxxIndex] &amp;&amp; x[i]&amp;gt;x[minxIndex] &amp;&amp; y[i]&amp;gt;y[minyIndex])
 setlinestyle(3,1,1);
 else
 setlinestyle(0,1,1);

 line(x[i],y[0],x[i+1],y[0]);
 line(x[i],y[0]+depth * 2,x[i+1],y[0]+depth*2);
 line(x[i],y[0],x[i],y[0]+depth*2);
 line(x[i+1],y[0],x[i+1],y[0]+depth*2);
    }
}

void main(){
int gd=0,gm;
int x[20],y[20],i,sides,depth,key;
initgraph(&amp;gd,&amp;gm,&quot;&quot;);
printf(&quot;No of sides(front view only) : &quot;);
scanf(&quot;%d&quot;,&amp;sides);
printf(&quot;Co-ordinates : &quot;);
for(i=0;i&amp;lt;sides;i++)
{
printf(&quot;(x%d,y%d)&quot;,i,i);
scanf(&quot;%d%d&quot;,&amp;x[i],&amp;y[i]);
}
printf(&quot;Depth :&quot;);
scanf(&quot;%d&quot;,&amp;depth);
ARRAY_SIZE=sides;
while(1){
key=getche();
clrscr();
cleardevice();
printf(&quot;LEFT ARROW -&amp;gt; 3D View\nUP ARROW - &amp;gt; Front View\nDOWN ARROW -&amp;gt; Top View\nRIGHT ARROW -&amp;gt; Side View\nESC -&amp;gt; Exit&quot;);
switch(key){
 case 75: //left arrow
 draw3d(sides,x,y,depth);
 break;
 case 72: //up arrow
 drawFrontView(sides,x,y);
 break;
 case 77: //right arrow
 drawSideView(sides,x,y,depth);
 break;
 case 80: //down arrow
 drawTopView(sides,x,y,depth);
 break;
 case 27: //esc
 exit(0);
 break;
}
}
}
&lt;/code&gt;
&lt;/pre&gt;
&lt;b&gt;&lt;span style=&quot;color: #0b5394;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;
&lt;b&gt;&lt;span style=&quot;color: #0b5394;&quot;&gt;OUTPUT:&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhlJJ7IUKc0ekARJhn6OCORmmE5oZhhp5VMGrYafmwfwGRS_Rfaeg3uKxPKnBXt0ONhpG3ir3hlUXRIW-ZCcmp0YJKzLhS9b1m6vWGm3Kf_raSGA_M5ojzWlJIQ5NZA75nmdaeV5Bf2v1So/s1600/3DProjection+6.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;297&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhlJJ7IUKc0ekARJhn6OCORmmE5oZhhp5VMGrYafmwfwGRS_Rfaeg3uKxPKnBXt0ONhpG3ir3hlUXRIW-ZCcmp0YJKzLhS9b1m6vWGm3Kf_raSGA_M5ojzWlJIQ5NZA75nmdaeV5Bf2v1So/s1600/3DProjection+6.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhvnVuzlJkN9fiEsfNaihvgeJhm1uO_Jux7M5768vBRhqVIaomyJVJpy64YAZ55cAipTymoOCOlRkdRO8oeYCk7gTc_br9GMYl7hyphenhyphenL1jXx1nZQNzVM80snPOxXHLePkHla_ZKbt6pN1TcTm/s1600/3DProjection+5.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;298&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhvnVuzlJkN9fiEsfNaihvgeJhm1uO_Jux7M5768vBRhqVIaomyJVJpy64YAZ55cAipTymoOCOlRkdRO8oeYCk7gTc_br9GMYl7hyphenhyphenL1jXx1nZQNzVM80snPOxXHLePkHla_ZKbt6pN1TcTm/s1600/3DProjection+5.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;b&gt;&lt;span style=&quot;color: #0b5394;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg_rdPM54lERFWeo9Zt7KY4EVN6CAn2f9oUmcZGQQSRXmoVl8nBFb3TF9TxhYZXqOXuAJRWZROrykm5UUepzgQXySXHnNzmJl75bOyK0gYfjnKJETNTzE_baLDhzdRefFVkE1n2FUHOrNb0/s1600/3DProjection+1.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;296&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg_rdPM54lERFWeo9Zt7KY4EVN6CAn2f9oUmcZGQQSRXmoVl8nBFb3TF9TxhYZXqOXuAJRWZROrykm5UUepzgQXySXHnNzmJl75bOyK0gYfjnKJETNTzE_baLDhzdRefFVkE1n2FUHOrNb0/s1600/3DProjection+1.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEisgpgu-SgaWiub_n-oad4zWrUjg9Djjgota3IbnazwjOuXaMIlYiOVZHM90IHpGaLga3QxDFEf93M8vlUawqtyRo1Am2K7U1d773XzEljX7sguMqPk_s8ALqsOgsXPS1DdBjggjlTbeLiz/s1600/3DProjection+4.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;297&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEisgpgu-SgaWiub_n-oad4zWrUjg9Djjgota3IbnazwjOuXaMIlYiOVZHM90IHpGaLga3QxDFEf93M8vlUawqtyRo1Am2K7U1d773XzEljX7sguMqPk_s8ALqsOgsXPS1DdBjggjlTbeLiz/s1600/3DProjection+4.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEikKWWasUlaZGPeTYJ8Xwzluv6h2UdT4NMvo8HY1w4uZ4U1XXNprTTFK1pcVXa17w9MSmDGfuQSZ8u4fYxZY976oINF1FSbL5fvmnpdRiuAzkrhyD4iXZrt82mp-YGhEDyx5pVvMKZX4Fvz/s1600/3DProjection+2.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;300&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEikKWWasUlaZGPeTYJ8Xwzluv6h2UdT4NMvo8HY1w4uZ4U1XXNprTTFK1pcVXa17w9MSmDGfuQSZ8u4fYxZY976oINF1FSbL5fvmnpdRiuAzkrhyD4iXZrt82mp-YGhEDyx5pVvMKZX4Fvz/s1600/3DProjection+2.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgTMxE3di9gZjFceTzvKqoK2aUPP2tcod2ONjqAyAv73sG-Xiha3wpaqmknG0wRGcj3Fpu3CW5lXcQgiiavZunamExdbvGNY7huhl91FPlGntmJ_Wf4teFWnJaVGMtwpQhTJIzdyMGgaBJK/s1600/3DProjection+3.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;300&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgTMxE3di9gZjFceTzvKqoK2aUPP2tcod2ONjqAyAv73sG-Xiha3wpaqmknG0wRGcj3Fpu3CW5lXcQgiiavZunamExdbvGNY7huhl91FPlGntmJ_Wf4teFWnJaVGMtwpQhTJIzdyMGgaBJK/s1600/3DProjection+3.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;b&gt;&lt;span style=&quot;color: #0b5394;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://ownmycode.blogspot.com/feeds/8431145038988646205/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ownmycode.blogspot.com/2012/09/3d-projection.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3063939708578051703/posts/default/8431145038988646205'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3063939708578051703/posts/default/8431145038988646205'/><link rel='alternate' type='text/html' href='http://ownmycode.blogspot.com/2012/09/3d-projection.html' title='3D Projection'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhlJJ7IUKc0ekARJhn6OCORmmE5oZhhp5VMGrYafmwfwGRS_Rfaeg3uKxPKnBXt0ONhpG3ir3hlUXRIW-ZCcmp0YJKzLhS9b1m6vWGm3Kf_raSGA_M5ojzWlJIQ5NZA75nmdaeV5Bf2v1So/s72-c/3DProjection+6.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3063939708578051703.post-870039928984566328</id><published>2012-09-07T14:16:00.001+05:30</published><updated>2017-04-05T03:27:21.324+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="3D in C"/><category scheme="http://www.blogger.com/atom/ns#" term="C Graphics"/><category scheme="http://www.blogger.com/atom/ns#" term="Computer Graphics Lab Program"/><title type='text'>3D Rotation</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;

&lt;br /&gt;
&lt;pre class=&quot;cpp&quot;&gt;&lt;code&gt;#include &amp;lt;stdio.h&amp;gt;
#include &amp;lt;stdlib.h&amp;gt;
#include&amp;lt;graphics.h&amp;gt;
#include&amp;lt;conio.h&amp;gt;
#include&amp;lt;math.h&amp;gt;
void draw3d(int fs,int x[20],int y[20],int tx,int ty,int d);
void draw3d(int fs,int x[20],int y[20],int tx,int ty,int d)
{
int i,j,k=0;
for(j=0;j&amp;lt;2;j++)
{
for(i=0;i&amp;lt;fs;i++)
{
if(i!=fs-1)
{
line(x[i]+tx+k,y[i]+ty-k,x[i+1]+tx+k,y[i+1]+ty-k);
}
else
line(x[i]+tx+k,y[i]+ty-k,x[0]+tx+k,y[0]+ty-k);
}
k=d;
}
for(i=0;i&amp;lt;fs;i++)
{
line(x[i]+tx,y[i]+ty,x[i]+tx+d,y[i]+ty-d);
}
}

void main()
{
int gd=DETECT,gm;
int x[20],y[20],x1[20],y1[20],tx=0,ty=0,i,j,k,fs,temp,d,a;
float theta;
initgraph(&amp;amp;gd,&amp;amp;gm,&quot;&quot;);
printf(&quot;No of sides (front view only) : &quot;);
scanf(&quot;%d&quot;,&amp;amp;fs);
printf(&quot;Co-ordinates : &quot;);
for(i=0;i&amp;lt;fs;i++)
{
printf(&quot;(x%d,y%d)&quot;,i,i);
scanf(&quot;%d%d&quot;,&amp;amp;x[i],&amp;amp;y[i]);
}
printf(&quot;Depth :&quot;);
scanf(&quot;%d&quot;,&amp;amp;d);
draw3d(fs,x,y,tx,ty,d);
printf(&quot;translation (x,y),rotate(a)&quot;);
scanf(&quot;%d%d%d&quot;,&amp;amp;tx,&amp;amp;ty,&amp;amp;a);
theta=(float)(a*(3.14/180));
for(i=0;i&amp;lt;fs;i++)
{
x1[i]=tx+((x[i]-tx)*cos(theta))-((y[i]-ty)*sin(theta));
y1[i]=ty+((y[i]-ty)*cos(theta))+((x[i]-tx)*sin(theta));
}
draw3d(fs,x1,y1,tx,ty,d);
getch();
closegraph();
}
&lt;/code&gt;
&lt;/pre&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://ownmycode.blogspot.com/feeds/870039928984566328/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ownmycode.blogspot.com/2012/09/3d-rotation.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3063939708578051703/posts/default/870039928984566328'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3063939708578051703/posts/default/870039928984566328'/><link rel='alternate' type='text/html' href='http://ownmycode.blogspot.com/2012/09/3d-rotation.html' title='3D Rotation'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3063939708578051703.post-2354301636517306759</id><published>2012-09-07T14:15:00.000+05:30</published><updated>2017-04-05T03:30:05.309+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="3D in C"/><category scheme="http://www.blogger.com/atom/ns#" term="C Graphics"/><category scheme="http://www.blogger.com/atom/ns#" term="Computer Graphics Lab Program"/><title type='text'>3D Scaling</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;pre class=&quot;cpp&quot;&gt;&lt;code&gt;
#include &amp;lt;stdio.h&amp;gt;
#include &amp;lt;stdlib.h&amp;gt;
#include&amp;lt;graphics.h&amp;gt;
#include&amp;lt;conio.h&amp;gt;
#include&amp;lt;math.h&amp;gt;
void draw3d(int fs,int x[20],int y[20],int tx,int ty,int d);
void draw3d(int fs,int x[20],int y[20],int tx,int ty,int d)
{
int i,j,k=0;
for(j=0;j&amp;lt;2;j++)
{
for(i=0;i&amp;lt;fs;i++)
{
if(i!=fs-1)
line(x[i]+tx+k,y[i]+ty-k,x[i+1]+tx+k,y[i+1]+ty-k);
else
line(x[i]+tx+k,y[i]+ty-k,x[0]+tx+k,y[0]+ty-k);
}
k=d;
}
setfillstyle(1,15);
for(i=0;i&amp;lt;fs;i++)
{
line(x[i]+tx,y[i]+ty,x[i]+tx+d,y[i]+ty-d);
}
}

void main()
{
int gd=DETECT,gm;
int x[20],y[20],x1[20],y1[20],tx=0,ty=0,i,j,k,fs,temp,d,xm,ym;
float theta;
initgraph(&amp;amp;gd,&amp;amp;gm,&quot;&quot;);
printf(&quot;no of sides (front view only) : &quot;);
scanf(&quot;%d&quot;,&amp;amp;fs);
printf(&quot;co-ordinates : &quot;);
for(i=0;i&amp;lt;fs;i++)
{
printf(&quot;(x%d,y%d)&quot;,i,i);
scanf(&quot;%d%d&quot;,&amp;amp;x[i],&amp;amp;y[i]);
}
printf(&quot;Depth :&quot;);
scanf(&quot;%d&quot;,&amp;amp;d);
draw3d(fs,x,y,tx,ty,d);
printf(&quot;magnification (x,y,xmag,ymag)&quot;);
scanf(&quot;%d%d%d%d&quot;,&amp;amp;tx,&amp;amp;ty,&amp;amp;xm,&amp;amp;ym);
for(i=0;i&amp;lt;fs;i++)
{
x1[i]=(x[i]*xm);
y1[i]=(y[i]*ym);
}
d=d*(ym+xm)/2;
draw3d(fs,x1,y1,tx,ty,d);
getch();
}&lt;/code&gt;
&lt;/pre&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://ownmycode.blogspot.com/feeds/2354301636517306759/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ownmycode.blogspot.com/2012/09/3d-scaling.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3063939708578051703/posts/default/2354301636517306759'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3063939708578051703/posts/default/2354301636517306759'/><link rel='alternate' type='text/html' href='http://ownmycode.blogspot.com/2012/09/3d-scaling.html' title='3D Scaling'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3063939708578051703.post-2865045628869994767</id><published>2012-09-07T14:13:00.001+05:30</published><updated>2017-04-05T03:30:38.756+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="3D in C"/><category scheme="http://www.blogger.com/atom/ns#" term="C Graphics"/><category scheme="http://www.blogger.com/atom/ns#" term="Computer Graphics Lab Program"/><title type='text'>3D Translation</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;pre class=&quot;cpp&quot;&gt;&lt;code&gt;
#include &amp;lt;stdio.h&amp;gt;
#include &amp;lt;stdlib.h&amp;gt;
#include&amp;lt;graphics.h&amp;gt;
#include&amp;lt;conio.h&amp;gt;
void draw3d(int fs,int x[20],int y[20],int tx,int ty,int d);
void draw3d(int fs,int x[20],int y[20],int tx,int ty,int d)
{
int i,j,k=0;
for(j=0;j&amp;lt;2;j++)
{
for(i=0;i&amp;lt;fs;i++)
{
if(i!=fs-1)
line(x[i]+tx+k,y[i]+ty-k,x[i+1]+tx+k,y[i+1]+ty-k);
else
line(x[i]+tx+k,y[i]+ty-k,x[0]+tx+k,y[0]+ty-k);
}
k=d;
}
for(i=0;i&amp;lt;fs;i++)
{
line(x[i]+tx,y[i]+ty,x[i]+tx+d,y[i]+ty-d);
}
}

void main()
{
int gd=DETECT,gm;
int x[20],y[20],tx=0,ty=0,i,fs,d;
initgraph(&amp;amp;gd,&amp;amp;gm,&quot;&quot;);
printf(&quot;no of sides (front view only) : &quot;);
scanf(&quot;%d&quot;,&amp;amp;fs);
printf(&quot;co-ordinates : &quot;);
for(i=0;i&amp;lt;fs;i++)
{
printf(&quot;(x%d,y%d)&quot;,i,i);
scanf(&quot;%d%d&quot;,&amp;amp;x[i],&amp;amp;y[i]);
}
printf(&quot;Depth :&quot;);
scanf(&quot;%d&quot;,&amp;amp;d);
draw3d(fs,x,y,tx,ty,d);
printf(&quot;translation (x,y)&quot;);
scanf(&quot;%d%d&quot;,&amp;amp;tx,&amp;amp;ty);
draw3d(fs,x,y,tx,ty,d);
getch();
}&lt;/code&gt;
&lt;/pre&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://ownmycode.blogspot.com/feeds/2865045628869994767/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ownmycode.blogspot.com/2012/09/3d-translation.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3063939708578051703/posts/default/2865045628869994767'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3063939708578051703/posts/default/2865045628869994767'/><link rel='alternate' type='text/html' href='http://ownmycode.blogspot.com/2012/09/3d-translation.html' title='3D Translation'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3063939708578051703.post-4738439026312212041</id><published>2012-09-07T14:12:00.000+05:30</published><updated>2017-04-19T21:09:22.249+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="2D in C"/><category scheme="http://www.blogger.com/atom/ns#" term="C Graphics"/><category scheme="http://www.blogger.com/atom/ns#" term="Computer Graphics Lab Program"/><title type='text'>2D Shearing</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;pre class=&quot;cpp&quot;&gt;&lt;code&gt;
#include &amp;lt;stdio.h&amp;gt;
#include &amp;lt;stdlib.h&amp;gt;
#include&amp;lt;graphics.h&amp;gt;
#include&amp;lt;conio.h&amp;gt;
#include&amp;lt;math.h&amp;gt;
void draw2d(int,int [],int [],int,int);
void main()
{
int gd=DETECT,gm;
int x[20],y[20],x1[20],y1[20],tx=0,ty=0,i,fs,a;
initgraph(&amp;amp;gd,&amp;amp;gm,&quot;&quot;);
printf(&quot;No of sides : &quot;);
scanf(&quot;%d&quot;,&amp;amp;fs);
printf(&quot;Co-ordinates : &quot;);
for(i=0;i&amp;lt;fs;i++)
{
printf(&quot;(x%d,y%d)&quot;,i,i);
scanf(&quot;%d%d&quot;,&amp;amp;x[i],&amp;amp;y[i]);
}
draw2d(fs,x,y,tx,ty);
printf(&quot;translation (x,y) : &quot;);
scanf(&quot;%d%d&quot;,&amp;amp;tx,&amp;amp;ty);
while(1)
{
clrscr();
cleardevice();
printf(&quot;1. X Shear\n\n2. Y Shear\n\n3. Exit\n\n&quot;);
draw2d(fs,x,y,0,0);
switch(getche())
{
case &#39;1&#39;:
printf(&quot;X Shear Value : &quot;);
scanf(&quot;%d&quot;,&amp;amp;a);
for(i=0;i&amp;lt;fs;i++)
{
x1[i]=x[i]+(a*(y[i]-ty));
y1[i]=y[i];
}
break;
case &#39;2&#39;:
printf(&quot;Y Shear Value : &quot;);
scanf(&quot;%d&quot;,&amp;amp;a);
for(i=0;i&amp;lt;fs;i++)
{
x1[i]=y[i];
y1[i]=y[i]+(a*(x[i]-tx));
}
break;
case &#39;3&#39;:
closegraph();
exit(0);
}
draw2d(fs,x1,y1,tx,ty);
getch();
}
}
void draw2d(int fs,int x[20],int y[20],int tx,int ty)
{
int i;
for(i=0;i&amp;lt;fs;i++)
{
if(i!=(fs-1))
line(x[i]+tx,y[i]+ty,x[i+1]+tx,y[i+1]+ty);
else
line(x[i]+tx,y[i]+ty,x[0]+tx,y[0]+ty);
}
}&lt;/code&gt;
&lt;/pre&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://ownmycode.blogspot.com/feeds/4738439026312212041/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ownmycode.blogspot.com/2012/09/2d-shearing.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3063939708578051703/posts/default/4738439026312212041'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3063939708578051703/posts/default/4738439026312212041'/><link rel='alternate' type='text/html' href='http://ownmycode.blogspot.com/2012/09/2d-shearing.html' title='2D Shearing'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3063939708578051703.post-460181179957420690</id><published>2012-09-07T14:10:00.000+05:30</published><updated>2017-04-19T21:09:22.243+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="2D in C"/><category scheme="http://www.blogger.com/atom/ns#" term="C Graphics"/><category scheme="http://www.blogger.com/atom/ns#" term="Computer Graphics Lab Program"/><title type='text'>2D Scaling</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;pre class=&quot;cpp&quot;&gt;&lt;code&gt;
#include&amp;lt;stdio.h&amp;gt;
#include &amp;lt;stdlib.h&amp;gt;
#include&amp;lt;graphics.h&amp;gt;
#include&amp;lt;conio.h&amp;gt;
#include&amp;lt;math.h&amp;gt;
void draw2d(int,int [],int [],int,int);
void main()
{
int gd=DETECT,gm;
int x[20],y[20],tx=0,ty=0,i,fs;
int mx,my;
initgraph(&amp;amp;gd,&amp;amp;gm,&quot;&quot;);
printf(&quot;No of sides : &quot;);
scanf(&quot;%d&quot;,&amp;amp;fs);
printf(&quot;Co-ordinates : &quot;);
for(i=0;i&amp;lt;fs;i++)
{
printf(&quot;(x%d,y%d)&quot;,i,i);
scanf(&quot;%d%d&quot;,&amp;amp;x[i],&amp;amp;y[i]);
}
draw2d(fs,x,y,tx,ty);
printf(&quot;magnification (x,y) : &quot;);
scanf(&quot;%d%d&quot;,&amp;amp;mx,&amp;amp;my);
for(i=0;i&amp;lt;fs;i++)
{
x[i]=x[i]*mx;
y[i]=y[i]*my;
}
draw2d(fs,x,y,tx,ty);
getch();
}
void draw2d(int fs,int x[20],int y[20],int tx,int ty)
{
int i;
for(i=0;i&amp;lt;fs;i++)
{
if(i!=(fs-1))
line(x[i]+tx,y[i]+ty,x[i+1]+tx,y[i+1]+ty);
else
line(x[i]+tx,y[i]+ty,x[0]+tx,y[0]+ty);
}
}&lt;/code&gt;
&lt;/pre&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://ownmycode.blogspot.com/feeds/460181179957420690/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ownmycode.blogspot.com/2012/09/blog-post.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3063939708578051703/posts/default/460181179957420690'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3063939708578051703/posts/default/460181179957420690'/><link rel='alternate' type='text/html' href='http://ownmycode.blogspot.com/2012/09/blog-post.html' title='2D Scaling'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3063939708578051703.post-6238775083718417500</id><published>2012-09-07T14:08:00.000+05:30</published><updated>2017-04-19T21:09:22.266+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="2D in C"/><category scheme="http://www.blogger.com/atom/ns#" term="C Graphics"/><category scheme="http://www.blogger.com/atom/ns#" term="Computer Graphics Lab Program"/><title type='text'>2D Rotation</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;pre class=&quot;cpp&quot;&gt;&lt;code&gt;#include &amp;lt;stdio.h&amp;gt;
#include &amp;lt;stdlib.h&amp;gt;
#include&amp;lt;graphics.h&amp;gt;
#include&amp;lt;conio.h&amp;gt;
#include&amp;lt;math.h&amp;gt;
void draw2d(int,int [],int [],int,int);
void main()
{
int gd=DETECT,gm;
int x[20],y[20],x1[20],y1[20],tx=0,ty=0,i,fs,a;
float theta;
initgraph(&amp;amp;gd,&amp;amp;gm,&quot;&quot;);
printf(&quot;No of sides : &quot;);
scanf(&quot;%d&quot;,&amp;amp;fs);
printf(&quot;Co-ordinates : &quot;);
for(i=0;i&amp;lt;fs;i++)
{
printf(&quot;(x%d,y%d)&quot;,i,i);
scanf(&quot;%d%d&quot;,&amp;amp;x[i],&amp;amp;y[i]);
}
draw2d(fs,x,y,tx,ty);
printf(&quot;translation (x,y), Angle : &quot;);
scanf(&quot;%d%d%d&quot;,&amp;amp;tx,&amp;amp;ty,&amp;amp;a);
theta=(float)(a*(3.14/180));
for(i=0;i&amp;lt;fs;i++)
{
x1[i]=tx+((x[i]-tx)*cos(theta))-((y[i]-ty)*sin(theta));
y1[i]=ty+((y[i]-ty)*cos(theta))+((x[i]-tx)*sin(theta));
}
draw2d(fs,x1,y1,tx,ty);
getch();
}
void draw2d(int fs,int x[20],int y[20],int tx,int ty)
{
int i;
for(i=0;i&amp;lt;fs;i++)
{
if(i!=(fs-1))
line(x[i]+tx,y[i]+ty,x[i+1]+tx,y[i+1]+ty);
else
line(x[i]+tx,y[i]+ty,x[0]+tx,y[0]+ty);
}
}&lt;/code&gt;
&lt;/pre&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://ownmycode.blogspot.com/feeds/6238775083718417500/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ownmycode.blogspot.com/2012/09/2d-rotation.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3063939708578051703/posts/default/6238775083718417500'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3063939708578051703/posts/default/6238775083718417500'/><link rel='alternate' type='text/html' href='http://ownmycode.blogspot.com/2012/09/2d-rotation.html' title='2D Rotation'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>