Wednesday, August 24, 2011

Using the HTML5 Filesystem API

Using the HTML5 Filesystem API - O'Reilly Media (Amazon.com link, Safari Books Online link, my review on Amazon.com, my review on O'Reilly.com)
4 stars

This is a short introduction to the HTML5 Filesystem API, but with an emphasis on the Google Chrome implementation. The author states that at the time of writing this book, only the Chrome browser implemented the API. Furthermore, the HTML5 spec itself is evolving, and is subject to change ("Take my word of caution and realize that until the spec is final, portions of the API could change." - pg 3). An ample number of code examples makes this a good read however. Even if you are not going to be doing programming where this information would be useful (as is the case with me), this is a short book that still provides you with a quick reckoner of what the API provides.

The topics covered in this short 58 page book are:

Storage and quota, including temporary, persistent, and unlimited storage.


"Local disk usage and IO bandwidth—this is mitigated in part through quota limitations.
Leakage or erasure of private data—this is mitigated by limiting the scope of the HTML5 filesystem to a chroot-like, origin-specific sandbox.
Storing malicious executables or illegal data on a user’s system—with any download there is a risk. The API mitigates against malicious executables by restricting file creation/rename to nonexecutable extensions..." 

Working with files and directories using the API, including what a file entry looks like, how to import, read, remove, create and append data to files. On the topic of directories, subdirectories and recursively removing a directory is also covered.

You can use the html input tag to import files - single or multiple:  <input type=“file”> or  <input type=“file” multiple> or <input type=“file” webkidirectory>.
Yet another way to import files is to use XMLHttpRequest or the new XMLHttpRequest specification that "now exposes responseType and response properties to inform the browser what format to return data in: xhr.responseType"


The Synchronous API is the last topic covered in the book.

While I do not write code in my job nowadays, this short book did provide me with some information on this important component of HTML5.

Product Details:

  • Title: Using the HTML5 Filesystem API
  • By: Eric Bidelman
  • Publisher: O'Reilly Media
  • Formats: Print, Ebook, Safari Books Online
  • Print: July 2011 (est.)
  • Ebook: July 2011
  • Pages: 74 (est.)
  • Print ISBN: 978-1-4493-0945-9
  • ISBN 10: 1-4493-0945-3
  • Ebook ISBN: 978-1-4493-0944-2
  • ISBN 10: 1-4493-0944-5


       





© 2011, Abhinav Agarwal. All rights reserved.

Monday, August 22, 2011

Fodor's Essential India

Fodor's Essential India, 1st Edition: with Delhi, Rajasthan, the Taj Mahal & Mumbai (Full-Color Gold Guides)
Fodor's Essential India, 1st Edition: with Delhi, Rajasthan, the Taj Mahal & Mumbai (Full-Color Gold Guides) (Flipkart.com link, my user review on Amazon.com)

A welcome break from the usual parade of travel books on India that, for the longest time, were a hideous mix of the cliched and the condescending.

These travel books would either target the hippie traveler who was looking to travel through the country on a dollar a day (drawn to the country no doubt due to the influence of the Beatles, Pt. Ravi Shankar, and transcendental meditation), or would write about the country as if it were one long, mystical place where you would find fakirs on elephants mingling with snake charmers on the ground.

Part of this paint-by-numbers approach was also because of India's anemic economic development, which meant that it was a poor country with poor infrastructure (you know which political party to thank for this largesse) - which meant most travelers were loathe to travel anywhere that required taking a train or the roads; its closed economy - which meant that few business travelers visited the country, and those who did stuck to the metros (primarily Delhi and Bombay); and the general tone of these books oscillated between a "I-told-you-these-natives-wouldn't-manage-without-us" and "oh-the-fakirs-and-natives-are-so-exotic". Things are a changing.

Based on an initial reading, this book does seem to break from the past. Information provided about the country and the places to visit actually reads relevant and accurate, and practical and common-sensical. Advice is generally geared towards the foreign traveler. For the Indian tourist, the Outlook Traveller series may be a better bet.

To wit, sample these sections, spread over 75 pages, that cover the city and region of Delhi.
- Top Reasons to go
- Eating well in Delhi
- Delhi's holy sites
- Planning (when to go, airport transfers, emergencies, Internet, mail, and shopping)
- Exploring Delhi
- Old Delhi
- New Delhi
- South Delhi
- Where to stay
- Where to eat
- Nightlife and the arts
- Shopping

As you can gather, it is detailed. The section follow a consistent labeling and liberal use of icons for convenience.

You can find some inaccuracies nonetheless.
For example, on page 55, it erroneously states that Indira Gandhi declared a state of emergency in 1971. That actually happened in 1975, the infamous period in India's modern history where the fundamental rights of its citizens were suspended for more than a year

Note that the book covers only the states of Delhi and Rajasthan, with a little bit of Goa thrown in. The Taj Mahal, in the city of Agra (state of Uttar Pradesh), and the city of Mumbai are also covered. The temple town of Khajuraho and the holy city of Varanasi are also included, for reasons best unknown.
Delhi (or Mumbai) is the city where most tourists to North India fly into. The Taj Mahal, the palaces of Rajasthan, and Delhi form a triangle when plotted on a map, and are referred to as the "tourist triangle" or "golden triangle". This book then targets this most popular tourist circuit in India.

There are of course a dozen more books that could be brought out on travel within India, but this is a good start.

Yes, I like this book.






© 2011, Abhinav Agarwal. All rights reserved.

Sunday, August 21, 2011

Scenes from SH25, Tamil Nadu

If you need to drive from Bangalore to Trichy or Tanjore, you can take NH7 all the way down to Namakkal. From there you have two choices. You can either take SH25, down to Thottiyam, Musiri, and on to Trichy. You drive parallel to the Cauvery river, north of the river, and then cross over to enter Trichy. The second option is to continue to drive down to Karur, and then take NH67, that runs south of the Cauvery river. This highway is being four-laned, and once complete, will be a joy to drive on. The four-laning has been completed on the stretch between Trichy and Tanjore, but the process is not yet complete from Trichy to Karur.



So how is the state highway SH25? It is a mixed bag to be sure. From Namakkal to Thottiyam the road is good, with a few bad patches in-between. There is not much traffic, and you can do good time. From Thottiyam onwards the road starts to deteriorate, and near Musiri it is actually quite bad. There are no deep potholes as such, and this is a good thing, but the road has cracks all over. This is the result of the hundreds of trucks that ply on this road. All of them seem to be ferrying earth mined from the Cauvery river. As you drive on this stretch you come across tens of trucks lined behind each other, on both sides of the road. This makes overtaking pretty much impossible, and since this is a two-laned road, any vehicle parked along the side of the road can cause traffic to slow down to a crawl.

Since the highway runs parallel to the Cauvery river, you can see vast stretches of farmland with sugarcane and paddy plantations. The river bed evidently makes for supremely fertile soil, and during the monsoon months you can see a lot of activity in the fields.





View Larger Map


© 2011, Abhinav Agarwal. All rights reserved.

Monday, August 15, 2011

Idiots on Roads - 8

I shot this photo on NH67 (NHAI websiteWikipedia link), some 10 kms from the historic town of Thanjavur (Tanjore) in Tamil Nadu.
Look at this photo. This is a four-lane national highway. Beautiful road. Recently four-laned. Allows you to zip between the two towns of Tricy and Thanjavur in less than an hour.
Not much traffic on it. Breaks in the median to allow for traffic to cross over at short distances.
There is really no freaking reason for someone to drive on the freaking wrong side of the road. Not with his wife. And certainly not with a small baby riding pillion. And not in the freaking fast lane. Look at the truck on the OTHER side of the road, which is driving on the CORRECT side of the road. So why is this freaking idiot endangering his life, his wife's, his child's, and that of other people actually following the rules of the road?
The inescapable reason, I deduce Watson, is because he is an idiot.

This is a zoomed out shot of the photo above. Sigh. Sigh. Sigh.



View Larger Map



© 2011, Abhinav Agarwal. All rights reserved.

Sunday, August 14, 2011

Moonwalking with Einstein

Moonwalking with Einstein: The Art and Science of Remembering Everything

Moonwalking With Einstein Search Amazon.com for Moonwalking With Einstein 


 (KindleFlipkart.com link, my review on Amazon.com)
5 stars
The power of memory - I have confidence in confidence.
Notwithstanding the quite stunning story of the author's success itself, this book is quite an enjoyable read in itself on remembering - the history, personalities, and  more. This is not a handbook on memory-enhancing tricks and techniques though, be forewarned.

It is easy to forget. If it weren't, we would likely all have gone mad a long time ago. However, not being able to remember is also a curse. Remember where you kept the car keys? And then you have people, normal enough, who have stunning powers of memory that inspire awe among us. People who can perform feats of memory we would consider outside the bounds of humanly possibility. We consider such people to be savants, geniuses, different-from-us. However, that is not necessarily the case.

The advent of industrialization and the faux feelings of omnipotence that machines inspired among humans led to a devaluation of the powers of human memorization. The ability to develop one's memory was seen as a vestige of a less-developed era. The power of the internet is ensuring that such thoughts are  only being perpetuated further. This book then also serves as a timely reminder about the powerful mass of jelly that sits atop.
Once upon a time, every literate person was versed in the techniques Ed was about to teach me. Memory training was considered a centerpiece of classical education in the language arts, on par with grammar, logic, and rhetoric.
... 
The Book of Memory: A Study of Memory in Medieval Culture (Cambridge Studies in Medieval Literature)"Ancient and medieval people reserved their awe for memory. Their greatest geniuses they describe as people of superior memories," writes Mary Carruthers, the author of two books on the history of memory techniques.
... 
But then, in the fifteenth century, Gutenberg came along and turned books into mass-produced commodities, and eventually it was no longer all that important to remember what the printed page could remember for you. Memory techniques that had once been a staple of classical and medieval culture got wrapped up with the occult and esoteric Hermetic traditions of the Renaissance, and by the nineteenth century they had been relegated to carnival sideshows and tacky self-help books 
...
The externalization of memory not only changed how people think; it also led to a profound shift in the very notion of what it means to be intelligent. Internal memory became devalued.
The Medieval Craft of Memory: An Anthology of Texts and Pictures (Material Texts)I first saw and heard about the author on the The Colbert Report in March of this year (link to video). It was a fascinating story. They author, Joshua Foer, a journalist, went to cover the US Memory Championship in 2005, was intrigued, challenged, eventually trained by one of the competitors, and then went on to win the championship. One year later. Yes, he won the 2006 US Memory Championship. This book, then, is an account of his one year journey from regular journalist to memory freak.


So what kind of memory muscles does the memory championship test? Different kinds of tests seek to test different kinds of muscles, so to say. Can you memorize a deck of playing cards in a minute. No, make that under a minute. Memorize a sequence of random numbers - hundreds of them, in a few minutes. Memorize a number of random faces and then identify them by their names. Memorize an unpublished poem. And so on.

Talent Is Overrated: What Really Separates World-Class Performers from Everybody ElseRather than make this a linear narrative about the author's travails, what makes this book far more interesting than it otherwise may have been is that the author delves into the human brain. Specifically he seeks to understand how the brain remembers, forms memories, and then retrieves those memories. Since the topic covers how memories are formed, it is but natural that the book also cover the two extremes of the scale - people who had super-human memorization capabilities on the one end, and people who could not remember at the other end. The sufferers in this second category have been well documented and also made famous in such movies as Memento (DVDBlu-ray) and the Hindi (or 'Bollywood' if you please) blockbuster 'Ghajini' (DVDBlu Ray), and more recently in the book, Before I Go To Sleep.

The secret to building an Arnold-like memory physique, it turns out, is in training. In deliberate practice. In being focused. Simple as that. Anyone willing to put in the time, and that too not a huge amount of it at that, can improve their powers of memorization by an order of magnitude. Yes.
I was willing to believe Buzan when he said there were techniques that one could learn to marginally improve one's memory around the edges, but I didn't fully believe him (or Ed) when he said that any schmo off the street could learn to memorize entire decks of playing cards or thousands of binary digits. The alternate explanation just seemed a whole lot more plausible: that Ed and his colleagues had some freakish innate talent that was the mental equivalent of André the Giant's height or Usain Bolt's legs.
Brain Rules: 12 Principles for Surviving and Thriving at Work, Home, and SchoolThe interesting thing is that even as we have got to learn more about our brain and its incredible complexity, our respect for its abilities seems to have devalued. We keep comparing it to a computer, initially, and then to the connected web that is the internet, and the amazing vastness of the Internet causes us to believe that the human brain pales in size, complexity, and capability. Which is not the case... The number of connections that the neurons in our brains can make with each other is so vast a number that it truly approximates our notion of infinity. And this is not a static piece of jelly that we are talking about either. What we see, learn, and remember itself can change the brain. The brain, its actual physical structure, can change in response to our learnings and memories. This is truly an astounding insight that we do not fully comprehend.
The three-pound mass balanced atop our spines is made up of somewhere in the neighborhood of 100 billion neurons, each of which can make upwards of five to ten thousand synaptic connections with other neurons.
...
The brain is a mutable organ, capable--within limits--of reorganizing itself and readapting to new kinds of sensory input, a phenomenon known as neuroplasticity.

As I was combing the scientific literature, one name kept popping up in my research about memory improvement: K. Anders Ericsson. He was a psychology professor at Florida State University and the author of an article titled "Exceptional Memorizers: Made, Not Born."
In 1981, he and fellow psychologist Bill Chase conducted a now-classic experiment on a Carnegie Mellon undergraduate, who has been immortalized in the literature by his initials, SF. Chase and Ericsson paid SF to spend several hours a week in their lab taking a simple memory test over and over and over again. 
... 
At the outset, he could only hold about seven digits in his head at a time. By the time the experiment wrapped up--two years and 250 mind-numbing hours later--SF had expanded his ability to remember numbers by a factor of ten. The experiment shattered the old notions that our memory capacities are fixed.
Brain Rules for Baby: How to Raise a Smart and Happy Child from Zero to FiveThe narrative proceeds along basically two parallel tracks. One is an account of the author's efforts as he worked to improve his memory, his ability to memorize what would essentially be random sequences of numbers, or faces, or lists. The other track is what the author digs through and finds about memory. The history of it, the people who have studied it, and its extraordinary achievers and equally striking sufferers.

It turns out that we actually cannot remember more than a few items for more than a few seconds, unless, that is, we make a conscious effort to memorize those items. This effort can be byway of repetition, by association, or by some other means that allows this memory to become entrenched in our brain for a longer period of time. This magic number, of the number of items we can retain in our working memory, is seven. Give or take two.
In 1956, a Harvard psychologist named George Miller published what would become a classic paper in the history of memory research.
... 
His paper was titled "The Magical Number Seven, Plus or Minus Two: Some Limits on Our Capacity for Processing Information." Miller had discovered that our ability to process information and make decisions in the world is limited by a fundamental constraint: We can only think about roughly seven things at a time.
The Shallows: What the Internet Is Doing to Our BrainsSo what about chess players - grandmasters, for example, who can play twenty or more players at the same time, and usually end up beating all of them? And some even play these games blindfolded?! How on earth could they memorize the hundreds of positions on the chessboards, and then figure out what the situation is on each board, cogitate and calculate the next move to make? Fascinating? Yes.What is even more fascinating is the insight that the way these chess players approach these multi-player games is not by memorizing the position of each piece on the board, but by associating the chessboard with a similar board from their memory. They would have likely come across such a position of the pieces on the board at some time in their careers, and when they come across this same position again, they simply recall it from their long term memory and figure out the next move to make.
But the most striking finding of all from these early studies of chess experts was their astounding memories. The experts could memorize entire boards after just a brief glance. 
... 
Using magnetoencephalography, a technique that measures the weak magnetic fields given off by a thinking brain, researchers have found that higher-rated chess players are more likely to engage the frontal and parietal cortices of the brain when they look at the board, which suggests that they are recalling information from long-term memory. Lower-ranked players are more likely to engage the medial temporal lobes, which suggests that they are encoding new information. The experts are interpreting the present board in term of their massive knowledge of past ones. The lower-ranked players are seeing the board as something new.
People looking to read this book to get a how-to compendium of steps to follow and supersize their memories  will be disappointed, because this book is not it. What this book however is is a lucid dive into the structure that is the human brain. By understanding our brains, and how we form memories, we can perhaps learn to respect its capabilities, and then harness it in a positive manner. And perhaps, just perhaps, we will remember where we last placed the car keys. Maybe.

Some other excerpts from the book:
Some details about what exactly is the World Memory Championship.
Unlike the U.S. championship, which has just five events, none lasting longer than fifteen minutes, the World Memory Championship is frequently referred to as a "mental decathlon." Its ten events, called "disciplines," span three grueling days, and each tests the competitors' memories in a slightly different way. Contestants have to memorize a previously unpublished poem spanning several pages, pages of random words (record: 280 in fifteen minutes), lists of binary digits (record: 4,140 in thirty minutes), shuffled decks of playing cards, a list of historical dates, and names and faces. Some disciplines, called "speed events," test how much the contestants can memorize in five minutes (record: 405 digits). Two marathon disciplines test how many decks of cards and random digits they can memorize in an hour (records: 2,080 digits and 27 decks of cards).
A point that John Medina makes in his book(s) too...- Brain Rules (Kindle), Brain Rules for Baby (Kindle)
The brain is a costly organ. Though it accounts for only 2 percent of the body's mass, it uses up a fifth of all the oxygen we breathe, and it's where a quarter of all our glucose gets burned.
Ancient philosophers had strong thoughts about the written word, especially when it came to knowing versus reading (something that Nicholas Carr also writes about in The Shallows: What the Internet Is Doing to Our Brains (Kindle edition))
Socrates goes on to disparage the idea of passing on his own knowledge through writing, saying it would be "singularly simple-minded to believe that written words can do anything more than remind one of what one already knows."
Oh yes, what about some tricks and techniques to build up your memorization skills? Well, there is some mention of it, to be sure.

I used a technique known as the "Major System," invented around 1648 by Johann Winkelmann, which is nothing more than a simple code to convert numbers into phonetic sounds. Those sounds can then be turned into words, which can in turn become images for a memory palace.
...
... most mental athletes use a more complex technique that is known on the Worldwide Brain Club (the online forum for memory junkies, Rubik's cubers, and mathletes) as "person-action-object," or, simply, PAO. It traces its lineage directly back to the loopy combinatorial mnemonics of Giordano Bruno and Ramon Llull. In the PAO system, every two-digit number from 00 to 99 is represented by a single image of a person performing an action on an object.
And here is a little bit more on memorization, the "bad" word in academics and education...
"I don't use the word `memory' in my class because it's a bad word in education," says Matthews. "You make monkeys memorize, whereas education is the ability to retrieve information at will and analyze it. But you can't have higher-level learning--you can't analyze--without retrieving information." And you can't retrieve information without putting the information in there in the first place. The dichotomy between "learning" and "memorizing" is false, Matthews contends. You can't learn without memorizing, and if done right, you can't memorize without learning.
This below is a point that Nicholas Carr makes time and again in his book: that knowing makes you capable of knowing what more to know, so to say. Meta-cognition.
...you can't have understanding without facts. And crucially, the more you know, the easier it is to know more. Memory is like a spiderweb that catches new information. The more it catches, the bigger it grows. And the bigger it grows, the more it catches.
In closing, the best summary of the book is written by the author himself. A cliched expression perhaps, when he says "practice makes perfect", but one that has to be qualified by research that has demonstrated again and again that practice needs to be "concentrated, self-conscious, and deliberate."
My experience had validated the old saw that practice makes perfect. But only if it's the right kind of concentrated, self-conscious, deliberate practice. I'd learned firsthand that with focus, motivation, and, above all, time, the mind can be trained to do extraordinary things. This was a tremendously empowering discovery.



      









Kindle Excerpt


-->
© 2011, Abhinav Agarwal. All rights reserved.