Programming · Interesting · Web Tech

Quirks mode & Standard mode

Quirk in general means peculiarity or characteristic. In order to maintain backward compatibility for web pages designed for older versions of some of the browsers which does not comply to standards of W3C(World Wide Web Consortium )and IETF(Internet Engineering Task Force). Its a non-standard mode.

The recent browser follow a standard mode which complies with W3C wherein the behaviour is as per HTML and CSS specifications. For HTML documents browsers use a DOCTYPE at the beginning of the document for handling the webpage in standard mode. <!DOCTYPE html> provides the purpose of activating the full standard mode.

Advertisements
Interesting · Poetics

Millennial

They are millennial

All in one phone is their breath

Undisruptive presence on social media platforms

Gives a dignity to their identity

The technology rebels, as they are

Their day begins posting, reading status than TV News

They show their care with a What’s up? on whatsapp

Post instant photos on instagram

Dopamine and oxytocine released with likes, follows and posts

Prefer talking over messages

rather than a telephonic conversation

Interesting · Memoirs · Poetics

The Nandanvan Park

There’s a park opposite my window
“Nandanvan” is its name

Standing still, changing its shades with seasons
From vivid green to dry yellow tan
Through the clouds of rain
Scorching sunny summer
And windy winter
Bushes of short shrubs, tall thick trees
Chirping birds calling each other, racing squirrels
Witnessing diversity all around

From lively kids to limping patients,
From gossiping women to debating men,
From a headphone stucked lonely stranger to couples in romance,
From casual strollers to disciplined joggers/runners

Selflessly, with no prejudice
Embraces warmly, one and all
Part of this park solaces them all

Haply, “Nandanvan” seems to be an apt name
After all

Composed by Vinit Desai

Interesting · Programming · Web Tech

Fun with JS array functions

If you are a JS programmer you must have used arrays quite often. While working with arrays, we somehow always tend to use for loop or Array.forEach() function followed by conditional if-else block checking. To bring into practice the use of already existing prototype array functions we have to understand when to use which functions. So, lets have some fun in understanding and KISS(Keep It Simple, Stupid!). Most of this function are self explanatory from their names itself.

Array.find() method returns the value of first element present in the array that satisfies the testing condition else returns undefined.
var arr = [35, 98, 78, 1, 8, 3];
var findEle = arr.find(function(ele){
return ele > 50;
});
console.log(findEle);

This will return 98 which is the first element that satisfies condition ele > 50.

Array.findIndex() method returns the index of the first element in the array that satisfies the provided testing function else returns -1.
var arr = [35, 98, 78, 1, 8, 3];
var findEleIndex = arr.findIndex(function(ele){
return ele < 10;
});
console.log(findEleIndex);

This will return 3 which is the index of first element that satisfies condition ele < 10.

Array.includes()method determines whether an element is present and returns boolean.
var arr = [35, 98, 78, 1, 8, 3];
var isPresent = arr.includes(98);
console.log(isPresent);

This will return true as 98 is present in the array arr.

Array.some() method determines whether atleast one element of the array satisfies the testing condition and returns boolean.
var arr = [35, 98, 78, 1, 8, 3];
var isPresent = arr.some(function(ele){
return ele > 50;
});
console.log(isPresent);

Array.every() method tests whether every array element passes the test and returns boolean.
var arr = [35, 98, 78, 1, 8, 3];
var test = arr.every(function(ele){
ele > 10;
});
console.log(test);

This will return false as 1 and 3 are less than 10 and test condition fails.

Array.map() creates a new array by applying some action on every element in the original array.
var arr = [35, 98, 78, 1, 8, 3];
var mapValue = arr.map(function(ele){
return ele * 2;
});
console.log(mapValue);

This will return an [70, 196, 156, 2, 16, 6].

Array.forEach() executes action(s) for every elemnt in the array. It is similar to for loop.

Array.filter() creates a new array depending on if the condition is satisfied or not.
var arr = [35, 98, 78, 1, 8, 3];
var mapValue = arr.filter(function(ele){
return ele > 50;
});
console.log(ele);

This returns [98, 78].

Interesting · Poetics

Invictus

Invictus means undefeated. A poem written by British poet, William Ernest Henley about how a human spirit overcomes challenges in the face of adversity.  There is a movie titled Invictus(wherein, this poem is recited masterfully) that narrates the true story of how a great leader like Nelson Mandela joined forces with the captain of South Africa’s rugby team, to help unite their country and won the world cup.

Out of the night that covers me,
Black as the pit from pole to pole,
I thank whatever gods may be
For my unconquerable soul.

In the fell clutch of circumstance
I have not winced nor cried aloud.
Under the bludgeonings of chance
My head is bloody, but unbowed.

Beyond this place of wrath and tears
Looms but the Horror of the shade,
And yet the menace of the years
Finds and shall find me unafraid.

It matters not how strait the gate,
How charged with punishments the scroll,
I am the master of my fate,
I am the captain of my soul.

Interesting · Programming · Web Tech

XML, XTHML and SGML

XML is eXtensible Markup Language is a markup language developed by W3C(World Wide Web Consortium).
It defines a set of rules that are self descriptive.
It is designed to store and transport information or data which is wrapped in non-predefined tags unlike HTML which has predefined tags. The author of XML has to define the tags and document structure.

XML separates data from presentation. That is, it carries the data but does not carry any information about how to display it. The formatting and displaying is taken care of by HTML. A typical XML document is tree structure that starts with a root and branches to leaves. XML has syntax rules and any XML document that conforms to these syntax rules is said to be “Well Formed” XML document.

XHTML stands for eXtensible HyperText Markup Language. It is almost similar to HTML but more stricter than HTML. XHTML is developed by combining HTML and XML. Where is it strict?

  • XHTML DOCTYPE is mandatory
  • XHTML document must have one root element
  • <html>, <head>, <title>, and <body> are mandatory
  • XHTML elements must be in lowercase, properly nested and closed

SGML stands for Standard Generalized Markup Language is a standard for specifying a document markup language or tag set. Such a specification is called Document Type Definition(DTD). Therefore, it is not considered language in itself but a metadata.

SGML was derived from GML (Generalized Markup Language), which allowed users to work on standardized formatting styles for electronic documents. Apparently HTML and XML use SGML principles. Meaning, SGML is a superset of HTML and XML.

Open Source · Programming · Web Tech

ECMAScript

What is ECMAScript ?

ECMA is a short form for European Computer Manufacturer’s Association. ECMAScript (ES) defines a standard and contains specifications for scripting languages such as JavaScript (Netscape /Mozilla browser implementation of the ECMA specification)and JScript (Microsoft’s Internet Explorer) developed by Brendan Eich in 1995. Therefore, one can also say that ES is a superset of JS and JScript.

That means it is used for client side scripting such as JavaScript and  for writing server side applications and services using Node.js.

Several editions with new feature support per edition have been published for ECMAScript. It should be noted that with each version release, there were support compatibility issues with some browser’s versions.