Thursday, August 25, 2016

PHP for Server Emails



Last week I launched my first "Mobile First" website using Bootstrap3 at <Kai-PDQ.in>. And today I found myself diving deeper into the alphabet soup.

After I launched the website, I realised that there was one functionality that was beyond the magical powers of Bootstrap3: Email Forms that actually sent out emails.

Inside the Bootstrap3 framework, the responsive "containers" could help you create an entire website that would work across mobiles, smartphones, tabs and PCs, but to make them send emails you needed something more: PHP.

PHP is supposed to be the acronym for Hypertext Preprocessor (how is that?). It is apparently a super-popular script executed on the servers which lies at the heart of blogging sites like WorldPress, It is also used extensively by the social media behemoth with more than 1.5 billion users - FaceBook.

So how do you write a PHP script that enables forms on your website to send emails to your Yahoo or Gmail accounts?

As in the case of Bootstrap3, its best to start with a YouTube video tutorial. This is the one that worked for me:

TeachMeComputer: PHP for Beginners - https://www.youtube.com/watch?v=kY5P9sZqFas

Once you get a hang of the basics, its best to dive right in with the code for a basic email form, as described in this video by MushroomHeadBangers - https://www.youtube.com/watch?v=yW5cgqf6cNo



-----------------------
LINKS - Responsive Forms

  • PHP Download - http://php.net/downloads.php
  • W3School Tutorial - http://www.w3schools.com/php/php_intro.asp
  • XAMPP - PHP development environment - https://www.apachefriends.org/index.html
  • https://www.formget.com/how-to-make-simple-responsive-form-for-a-website/

Wednesday, August 24, 2016

The Ivory Throne



I was not too keen on picking another 500 page tome. Having just finished "The Gene", I was looking for something lighter, something which did not have its notes and index running into a hundred pages.

I had almost set the book aside when I decided to flip through the book one last time. I saw a map of South India in the 1920s and an old sepia print titled "The Matriarchs of Mavelikkara", and got hooked.

"The Ivory Throne" by Manu Pillai is more than just the "Chronicles of the House of Travancore". It is a refreshing new way of looking at the history of a kingdom that has, so far,  seen only the fawning eulogies of erstwhile aristocrats, or the dismissive narratives of Marxist historians.

Pillai's attention is focused on the life and times of Sethu Lakshmi Bayi. While this is, no doubt, quite interesting, I find myself drawn back to an earlier phase when Kerala saw, within the span of one century (1400-1500), the influence of foreign ships coming from two different directions.

From the East came came Admiral Zheng who sailed from China to Calicut no less than seven times to during the period 1405 to 1430. His fleets had as many as 250 ships manned by 28,000 soldiers. Even after the Ming emperors decided to isolate themselves, there remained in Kerala a fairly large community of Chinese-Malayali's called Chinna Kribala, with one of its stat sailors a pirate named Chinali!

A few decades later, in July 1497, King Manuel of Portugal sent Vasco da Gama to find the fabled spice gardens of India, with a "distinctly expendable crew of convicts and criminals". Ten months later, he was trying to peddle baubles and trinkets at the court of the Zamorin, Manavikrama. Unable to break the Arab monopoly over the spice trade in the first instance, King Manuel sent an armada led by Pedro Alvarez Cabral in 1500.

The Zamorins of Calicut were obviously nor prepared for Cabral's persuasive methods. Stymied by the Arab traders, he decided to let his guns do the talking. A single day of bombardment from the sea, killed nearly 600 people, and then he went about playing one kingdom in Kerala against another.

Once the dust settled, the natives had their fill of internecine wars of attrition ("Kudipaka") while the Europeans had ended up with a trade monopoly, and then some more. It was not until Marthanda Varma took charge of Travancore in 1729 that things started to look up in this part of India.

"The Ivory Throne" leaves me wondering - when will we have more historians piece together this real history of Kerala? What are the secrets that continues to be locked in genetic markers and mitochondrial DNA of the Mallus who come in all colors, shapes and sizes?


-------------------------------------------------
LINKS & REFERENCES

* Interview - The Hindu - http://www.thehindu.com/features/metroplus/society/manu-s-pillai-zooms-in-on-the-life-of-maharani-sethu-lakshmi-bayi-in-his-debut-book/article7900248.ece

* Book - The Ivory Throne - http://www.amazon.in/Ivory-Throne-Chronicles-House-Travancore/dp/9351776425

Friday, August 19, 2016

In Praise of Bootstrap3


In the world of web-design I am a bit like Rip van Winkle - a solitary rustic who once dabbled in ancient HTML; the oldie who goes off to sleep for 15 years and then wakes up to discover a digital world that has been completely transformed.

Nothing remained of the familiar landscape. Old HTML had become too primitive, too cumbersome and simply incapable of showing up on anything other than a clunky old PC. As webpage designing had moved from one version of HTML to another, the newer versions had teamed up with CSS and outsourced all the layout grunt work, Java and JScript had come in to add heft and magic to the amazing things that could be accomplished using smartphones, tablets, and laptops. A bewildering new world that would not reveal itself in "view page source".

It is while wandering through this maze that I stumbled upon the answer to all my problems - Bootstrap3. It was built on whatever little I knew of HTML and CSS, and then, with a few online stylesheets helped me create websites that worked beautifully across platforms and devices. Magic!

Here are links to the sites that were a big help:

* GetBootstrap (Currently at v.3.3.7) - Home - http://getbootstrap.com/
Repository of all the latest download files, Content Delivery Networks (CDNs) and sample pages

* YouTube - Lalit Bassi's Bootstrap3 Tutorial (1:40 hrs) - https://www.youtube.com/watch?v=gqOEoUR5RHg
Even after downloading Bootstrap, I was quite lost until I stumbled upon this much-viewed tutorial. Starting with a simple HTML layout, this video takes you through a wide range of functionalities that can help you launch a fully functional website is a few hours. It also introduced me to the joys of using SublimeText - an editor infinitely better than MS-Text!
Caveat: The Dilliwala Yankee accent can be tough...but remember: no pain, no gain! ;)

* YouTube - Bucky Robert's TheNewsBoston (14 short clips)- https://www.youtube.com/watch?v=qIULMnbH2-o
Unlike Bassi's package this one tells you about various different tools in short, easy-to-understand videos.

* YouTube - Bootstrap tutorial by Derek Banas (1:04 hrs) - https://www.youtube.com/watch?v=gqOEoUR5RHg
More like a catalogue presentation of the various things you can do with Bootstrap3. Derek keeps adding and deleting code so you might be disappointed to find many components missing in his final "cheat-sheet".

----------------------------------------
LINKS & REFERENCES

* Bootstrap - https://en.wikipedia.org/wiki/Bootstrap_(front-end_framework)
* Tutorial Sites
  • W3Schools - http://www.w3schools.com/bootstrap/

* DevelopMentor YouTube - Easygoing pace but the guy seems unsure of many functionalities - https://www.youtube.com/watch?v=ZGotwBWGL7A&spfreload=5

Tuesday, August 16, 2016

Our Genes




In the Mahabharata epic, there is a poignant exchange that takes place after the Great War, between the eldest of the Pandava princes, Yudhistira, and a forest spirit. A quiz in metaphysics is the price demanded by the Spirit for reviving Yudhistira's siblings who have died of thirst and poisoning.

One of the questions is: 'What is the greatest wonder in the world?'
And Yudhistira's reply is : "People die everyday and those who are alive go on as though they will live for ever!"

Siddhartha Mukherjee's books seems to capture this profound irony in his first book, "Emperor of All Maladies" and then again, in his latest book, "The Gene". A 'normal' healthy body and mind is something most of us take for granted - even as an entitlement - until something happens to us, or to our own close friends or relatives that brings us face to face with the fragility of life itself.

The great advances in science & technology lull us into a false sense of security - until raconteurs like Mukherjee tell us about the heroic efforts, pain and serendipity that underpin each and every invention that mark our progress, as well as the huge lacunae in our own understanding of the world around us, and within us.

Here are a couple of shockers that hit me while reading "The Gene"

There are more than 2500 different genetic defects that have been recorded to date. Most of them are like simple spelling mistakes that end up destroying lives, across generations.

Take the case of Sickle Cell Anemia. It is the result of a single change in one triplet in our DNA. The sequence GAG gets changed to GTG. This results in the substitution of one amino acid for another: glutamate gets switched to valine, thus altering the folding of the hemoglobin protein chain. As a result protein debris gets accumulated in string like clumps in our red cells; they are unable to glide smoothly through our blood capillaries, and get jammed into microscopic clots throughout the body, interrupting the flow of blood, and resulting in excruciating pain, like corkscrews being drilled into our bones.

Then there is Huntington's Chorea. It is the "opposite of a dance, a joyless pathological caricature, the ominous manifestation of dysregulated brain function".

In 1992 researchers tracked the disease down to one gene called “interesting transcript 15” (IT15). This gene was found to encode an enormous protein - a biochemical behemoth containing 3,144 amino acids, larger than any protein in the human body (insulin has a mere 51 amino acids). And yet, beyond the fact that this protein is found is our neurons and testicular tissue, we know nothing about its actual role in our bodies, let alone why it causes a debilitating disease...

The Gene puts the Spirit's question and Yudhistira's answer into completely new perspectives.


Saturday, August 06, 2016

Nikon's Sticky Monarch



What has gone wrong with my Monarch? It has gone sweaty, sticky and seems to just crumble away! :(

Its nearly six years since I purchased my first pair of 'serious' binoculars - a Nikon Monarch from Yodobashi Camera, Akihabara, Japan. It was a handy companion while ascending Mt. Fuji, and subsequently brought me within 'touching distance' of numerous birds across India.

Then, one day, I took it out of its packaging to find its rubber grip covered with a kind of fine, white fungus. Wiping with a dry cloth made it appear clean but the rubber continued to be sticky and crumbly. The Nikon Service Centre at Noida took a look at the device and simply said that they could do nothing. The rubber components could neither be repaired nor replaced.

I tried looking for a solution at the online forums where it is called the "sticky armor problem". One user was able to partially solve this be rubbing the armor with isopropanol.

Still, what irks me is Nikon's care-a-damn approach to this problem. For a company that has build it reputation on sturdy outdoor optical equipment, surely this is not a one-off problem of mouldy rubber jackets!

--------------------------------------------------

Postscript (20 Aug 2016): One thing that does seem to work in the hot, humid Indian climate is Neem (Azadirachta indica) powder. A well known natural germicide in India, Neem extracts are now available as prickly heat powder. I used a product from Hesh Pharma and it seems to work perfectly fine on the sticky Nikon binoculars!

--------------------------------------------------

LINKS & REFERENCES

* Bird Forum - http://www.birdforum.net/showthread.php?t=266061

* Rubber coating breakdown - http://www.fixya.com/support/t116476-rubber_coating_breaking_down

Sunday, July 31, 2016

Textiles and Terror



Last month a terror strike at the Holey Artisan Cafe in Dhaka, Bangladesh, left 21 people dead, along with two police officers and four terrorists. Among them were nine Italians, seven Japanese, one Indian, three Bangladeshi's and one US citizen.

More than half the number of victims were closely linked to an industry that is critical to the country's economy: Textiles.

What has been the impact of this terror attack on Bangladesh's textile sector?

The textile sector constitutes around 80% of Bangladesh’s total exports providing direct employment to 4 million people. This $19 billion-a-year, export-oriented ready-made garment (RMG) industry accounted for 45% of all industrial employment in the country, and yet, only contributed 5% of the Bangladesh's total national income.

Over the past few years, Bangladesh had surpassed India in the export of RMGs - thanks to cheaper labour, better support from the government and a favourable global trade-quota system. In India around 12 percent of exports are from the textile sector and it employs more than 38 million people. Since there are nearly 10x more people in India dependant on the textile sector any change in trends was bound to have a cross-border impact.

This point hit home when I ran into a neighbour who works with an RMG export firm. He was unusually upbeat. "Things are now looking up", he said, grinning happily, "Our industry is not getting the attention it deserves!" INR 6,000 had been allocated in the latest Budget for financial incentives, along with a move towards flexible labour laws. "Now, with the Europeans and Americans getting wary about Bangladesh, we sure to bounce back!"

It seems the global textile-RMG market is not very different from the local subzi-mandi's (vegetable markets). Frequent meetings and the perception of safety, and the assurance of having a glass of chai in peace and quiet, are all confidence builders for both buyers and sellers...

--------------------------------------------------------------
LINKS & REFERENCES

- Dhaka - The Attack Victims (CNN - 6 July 2016) - http://edition.cnn.com/2016/07/02/asia/bangladesh-dhaka-attack-victims/
- http://www.iipnetwork.org/CaseStudy_Compendium.pdf2

- ET, 23 Jun., 2016) - http://economictimes.indiatimes.com/news/economy/finance/cabinet-clears-rs-6000crore-package-for-textile-sector/articleshow/52876601.cms

- (IBT 23 June 2016) - http://www.ibtimes.co.in/cotton-production-holds-key-textile-policys-multi-billion-dollar-export-push-684011#6FoGIRr5mbh5L9mf.97

Tuesday, July 12, 2016

Let There Be Light


Are high pressure sodium vapour lamps more efficient than LEDs?

The key to answering this question is "Luminous Efficacy", a measure of how well a light source a Watt of electricity into Lumens, a measure of light intensity visible to the human eye.

Today, while clearing some litter at a nearby park, I came across this box -


It was lying on the grass, right below a high-mast lamp. Even though I knew that these sodium vapor lamps consumed a lot of electricity, what struck me was the quantum of light produced by these bulbs. A 400W bulb produces more than 44,000 lumens!

If this makes little sense, just compare it to the standard LED lamps being distributed by the government, in its efforts to being down household electricity  consumption -


In terms of luminous efficacy, one would have thought that the LED lamps are a lot more efficient that any incandescent, power-guzzling bulb. However, in terms of light output (lumens), the sodium vapour lamp produces 110 lumens/W while the LED lights prouduce 114 lumens/W, which is hardly any difference.

If there is not much difference in the efficiency of LED bulbs and sodium-vapour lamps, is there a big difference in cost? The sodium-vapour lamp costs INR 675 per unit while an (unsubsidized) LED lamp costs anywhere between INR 150 and 250. This means that the cost of luminous efficacy is INR 0.16 lm/W/INR for the sodium-vapour lamp and 0.57 lm/W/INR for LEDs.  

This simply means that you are getting 3.5 times more bang for your buck with LEDs, compared to sodium-vapour lamps. So it does make sense to switch to LEDs.

Now, what is the difference is cost between LEDs meantand SVs for high-mast lamps? That would berhaps perhaps be a better comparison of oranges with oranges!

-----------------------------------------
LINKS

* Energy efficiency of LEDs - http://apps1.eere.energy.gov/buildings/publications/pdfs/ssl/led_energy_efficiency.pdf

* https://en.wikipedia.org/wiki/Luminous_efficacy

* 2009 - Toshiba releases 93 lm/W bulbs - http://ledsreview.com/news/367/