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

 Then, to install a web server on your PC, you need XAMPP. This tool comes as a package with Apache, MySQL and PHP. Once you have all these things in place, you are ready to go.

One thing none of these video's tell you (perhaps its common knowledge?), is that your web-host needs to have a PHP enabled portal. It is also not clear from the videos how we can go about with the trouble shooting.

My site takes in the feedback form, returns the "Click Here to Go Back" page, and I do get an email in my Yahoo account. However, for some reason, the mails land up in the Spam-box even if they are marked safe. Also, the message is coming in blank with the just the sender's email id.

Some progress...but I guess there is still a long way to go!

-----------------------
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