Posted in Interesting, Open Source, Programming, Web Tech

Boilerplate code

What is a boilerplate code ? 

In computer programming is a section of code that has to be repetitively used with a little or no alteration . This term is interchangeably used with bookkeeping code.

Can we avoid the usage of boilerplate code ?

This seems to be debatable question. We can’t avoid the use of it all the time as not all the programming languages have the the non-verbosity. Other means to avoid its use is application of meta programming concepts, abstraction, inheritance, keeping the business logic in a separate globally accessible module and reusing it on need basis.

 

Advertisements
Posted in Interesting, Open Source, Softwares

Bar Code and QR Code

We see their usage on a day-to-day basis not only in air- conditioned retail stores but also with non-air-conditioned street vendors and hawkers. Yeah! I am talking about how bar code and QR code have digitized our societies, however large scale or small scale the business is. It doesn’t matter at all!

Bar code and QR code in general are digital form of information stored on a label of a product or services which provides the ease of tracking products in an inventory and payment of transactions. These are of great help as they minimize the process of typing to retrieve information.

Bar Code

Bar code visually appears as a combination of zebra stripped, multiple alternate black and white vertical lines which is readable by a machine. It follows a one-dimensional and two-dimensional pattern. The information of a bar code is stored in a simple numeric format with number ranging from 0 to 9, which can be retrieved when scanned by a bar code reader. In a store there are different product items. Each product has a bar code on in it. With this bar code information, the storekeeper can easily check how much stock is available. If an item is sold out, the scanner scans it and the item is deducted from stack and is added to the customer’s bill.

Bar code readers read the encoded information of bar code as input and decoding circuitry present outputs the information to the computer.

Bar code come in two varieties namely linear bar code, matrix(2D) bar code.

You might as well ask, what if the bar code sticker gets cut or blurred out. Yes, quite possible. The information of some part of the code might be lost and as the error correction mechanism is not good in case of bar code it may be difficult to recover the missing information. Additionally, the information that can be stored by bar code is limited when compared to QR code.

QR Code

QR abbreviated as Quick Response code is a pattern of black and white dots bounded on a square boundary. It follows a two-dimensional pattern. QR code can be read by imaging device typically a camera of smartphone and this process is called mobile tagging. The QR code typically detects three distinctive squares at the corners of the QR code image, using a smaller square near the fourth corner to normalize the image for size, orientation, and angle of viewing. The small dots throughout the QR code are then converted to binary numbers and validated with an error-correcting algorithm. This error correction mechanism gives QR code an advantage over barcode as information can be retrieved to some extent even if its spoiled or damaged.

QR codes have varieties namely Micro QR code, Secure QR code, Frame QR code.

QR code can be used to share information like business card, URL, social media profile etc which is also of benefit for lot of commercial markets for campaigning. With QR code one can track as to how many users have scanned your QR code. One disadvantage  a QR code can have is if you happen to scan a malicious QR code then a malicious ware might get into your phone which might hack your data or manipulate apps because we as a human won’t be aware if a correct QR code is being scanned or not.

In the near future, as a next level of evolution we will have 3D QR code. The height factor will give an advantage to store a little more information.

Posted in Interesting, Open Source, Softwares, Web Tech

Digital footprint

What is digital footprint?

So, you are an active internet user. You have atleast one social media account and in some point of time have uploaded a photo, shared a video, have liked/commented on friend’s post. Also, the likes on a post,  private chat messages, the online shopping search of your favourite brand etc. Aren’t these the activities we, as individual’s tend to do to be connected and engaged or in search of something online? In simple terms, all this content builds up what is called as digital footprint.

That means, digital footprint also referred as digital shadow is a content (text or audio or video) with a set of traceable digital activities of an individual on the digital devices or any internet platform. That is, the stuff  what you leave behind when you use online services for online shopping, social networking etc.

Why should you be concerned about digital footprint?

Once you are logged into any website be it for online shopping or listening to a trending song, remember that web is secretly tracking all your actions allowing the targeted marketers to advertise exactly what products you have been browsing in you recent past. Also social media platforms often introduce new policies of usage that we may tend to accept just by clicking Accept/Ok button without actually reading the policies. User privacy is a concern.

All this data can be leaked to make a profit out of it for research in terms of marketing products and building it better for human convenience where a set of customers habits and user experience can be traced.

Can we avoid not being eavesdropped?

As suggested by one of my friend you may say as well, if privacy is a concern browse without login into websites, use browser’s incognito mode, clear browser history. That doesn’t solve the problem at base level as there is this loophole: every device has a unique IP address and uniquely the browsed content can be easily traced.

 

Posted in Interesting, Open Source, Programming, Web Tech

Pug.js

What is pug.js?

Pug.js a HTML template engine for Node.js. You can write a simple pug code which the compiler will compile it to HTML code and later on browser will render it.

How does pug code differ from html code?

Pug code is a crisp piece of code which looks like a paragraph which helps in readability. Pug supports JavaScript, so using JavaScript expressions, we can format HTML code. HTML code is consists of tags and Pug also uses same tags. But pug doesn’t have closing tags.

Some thoughts…

Since pug comes as a npm package we can run using browser or on node.js using cli. One should take care of white space while writing pug code, because it can cost a big time.

 

Posted in Interesting, Poetics

Shah-Jahan

You knew, the Emperor of India, Shah-Jahan
That life, youth, wealth, renown
All float away down the stream of time
Your only dream
Was to preserve forever your heart’s pain
The harsh thunder of imperial power
Would fade into sleep
Like a sunset’s crimson splendour
But it was your hope
That atleast a single, eternally-heaved sigh would stay
To grieve the sky
Though emeralds, rubies, pearls are all
But as the glitter of a rainbow tricking out empty air
And must pass away
Yet still one solitary tear
Would hang on the cheek of time
In the form
Of this white and gleaming Taj Mahal
O human heart,
You have no time
To look back at anyone again 
No time
You are driven by life’s quick spate
On and on from landing to landing,
Loading cargo here,
Unloading there
In your garden the south wind’s murmurs
May enchant spring ‘madhabi’ creepers
Into suddenly filling your quivering lap with flowers
Their petals are scattered in the dust come twilight
You have no time
You raise from the dew of another night
New blossom in your groves, in jasmine
To dress with tearful gladness the votive tray
Of a later season
O human heart
All that you gather is thrown 
To the edge of the path by the end of each night and day
You have no time to look back again
No time, no time
Thus, Emperor, you wished,
Fearing your own heart’s forgetfulness
To conquer time’s heart
Through beauty
How wonderful the deathless clothing
With which you invested
Formless death – how it was garlanded!
You could not maintain
Your grief forever, and so you enmeshed
Your restless weeping
In bonds of silent perpetuity
The names you softly
Whispered to your love
On moonlit nights in secret chambers live on
Here
As whispers in the ear of eternity
The poignant gentleness of love
Flowered into the beauty of serene stone
Poet – Emperor
This is your heart’s picture
Your new ‘Meghaduta’ 
Soaring with marvellous, unprecedented melody and line
Towards the unseen plane
On which your loverless beloved
And the first glow of sunrise
And the last sigh of sunset
And the disembodied beauty of moonlit ‘cameli’ flower
And the gateway on the edge of language
That turns away man’s wistful gaze again and again
Are all blended
This beauty is your messenger,
Skirting time’s sentries
To carry the wordless message
“I have not forgotten you, my love, I have not forgotten you”
You are gone, now, Emperor
Your empire has dissolved like a dream
Your throne is shattered
Your armies whose marching
Shook the earth
Today have no more weight than the windblown dust on the Delhi road
Your singers no longer sing for you
Your musicians no longer mingle their tunes
With the lapping Jumna
The jingle of the anklets of your women
Has died from your palaces
The night sky moans
With the throb
Of crickets in their crumbling corners
But your tireless, incorruptible, messenger
Speaks to us with sombre melody
“Stare no matter how distantly
That traveller is no longer here, no longer here
His beloved kept him not
His realms released him
Neither sea nor mountain could bar him
Today his chariot
Travels at the beck of the night
To the song of the stars
Towards the gate of dawn
I remain here weighted with memory
He is free of burdens; he is no longer here
-Rabindranath Tagore
Posted in Interesting

Ubuntu and Africa

Ubuntu unlike the operating system as we computer techies know it, is a African traditional concept which comes from Zulu and Xhola languages. It is often translated as “I am because we are,” and also “humanity towards others”, but is often used in a more philosophical sense to mean “the belief in a universal bond of sharing that connects all humanity”.

The values accepted in ubuntu emphasize caring, sharing, reciprocity, co-operation, compassion and empathy in recognition that for human beings to develop, flourish and reach their full potential, they need to conduct their relationships in a manner that promotes the well-being of others.

From the beginning of time the divine principles of ubuntu have guided African societies. It is extremely important in Africa and the world at large – as the world needs a common guiding principle of human values.

Posted in Interesting, Programming, 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.