Book Review: Foods That Harm, Foods That Heal

It's comforting to know that food can also be preventive medicine. Foods That Harm, Foods That Heal - An A-Z Guide to Safe and Healthy Eating beautifully explains the benefits & drawbacks of various vegetables, fruits & food sources. Written by experts and full of relevant images, this colorful book makes for interesting reading. Common diseases and the effects of various types of food on them are also discussed. All the topics are arranged alphabetically. This makes it great to use for future reference.

The book has been written for an American audience. Although this does not diminish the value of the book's contents, I wish it was written in more general terms to suit a global audience.

Being a vegetarian & foodie, I did not know about the health value & drawbacks of the food I've been eating all these years. I loved reading this book for all the practical knowledge it contained and highly recommend it to others.
Read More
HOW TO access web pages faster on a slow Internet connection

HOW TO access web pages faster on a slow Internet connection

  • Disable IFRAME based ads
  • Disable Flash based ads. These ads suck up a lot of bandwidth. It's easy to enable/disable add-ons like the Flash plugin on newer versions of IE & Firefox. Note however that you will need Flash to be enabled to watch videos on YouTube or MyPopKorn.com (the site that gives you short summaries of long drawn Indian TV serials)
  • If you like watching Flash based videos like those on YouTube, don't play it immediately but allow them to load completely (i.e till you see light red line at the end in progress indicator of the player).
  • Disable images. This will take the fun out of browsing the Internet, so take this extreme step if pages download really slow. The Opera browser has a simple option to turn off images on a per page basis. From the menu, go to View > Images > No Images. For other browsers, you would have to look for the option typically under Tools > Options.Browse
  • Use a RSS Reader. Most content websites now provide RSS Feeds of site updates. Subscribe to these feeds using a free RSS Reader like Google Reader. This way you catch all the action without having to visit the website which may be bloated with ads and other bells & whistles.

Got any other tips?
Read More
State of Internet in India

State of Internet in India

As per stats released by The Internet Governance Forum, India has 81 million Internet users. These figures however don't tally with other estimates.

According to Akamai's quarterly State of the Internet report for Quarter 3 of 2008, India has 26% on narrowband (<256kbps), 5% on broadband (>2 Mbps) and just 0.6% on "high broadband" (>5 Mbps). In comparison, South Korea tops the list of countries with the largest number of high broadband users (58%). Asia has the highest number of Internet users with an estimated 568.7 million people followed by the Americas with 377.9 million.

Check these tips for accessing web pages faster on a slow Internet connections.

Also see: 6 Months of BSNL Broadband
Read More

HOW TO avoid the IE Information Bar during development

If you have ever tried opening a web page that contains JavaScript directly instead of from your web server in newer versions of IE, you may have noticed the message "To help protect your security, Internet Explorer has restricted this file from showing active content that could access your computer" displayed in the Information Bar in Windows XP & Vista.

There are three ways that I have found to avoid this -
1) You can turn off the Information Bar in Internet Explorer by lowering the default security settings.

2) In Internet Explorer, from the Tools menu, select Options and in the Internet Options dialog, select the Advanced tab. Scroll down until you see the Security options. Enable the checkbox option "Allow active content to run in files on My Computer".

3) Add the following Mark of the Web comment between the DOCTYPE and the HTML -
<!-- saved from url=(0014)about:internet -->

Read the excellent explanation on Mark on the Web on MSDN.

"..manually insert a MOTW when you are developing HTML pages that need to run in a different security zone from that of your development environment. With the MOTW inserted, you can preview active HTML documents in the appropriate security zone; typically this zone is the Internet zone, but Internet Explorer obeys your computer's security zone rules. This way you can make sure the active content functions as expected, and you can monitor any security issues with the content."

The phrase Mark of the Web is probably derived from Mark of Zorro. It brings back memories from my childhood comic book days of the masked Robin Hood-like hero Zorro, who scars the faces of evildoers with his mark, "Z"
Read More
Plain English Explanation for Non-Geeks

Plain English Explanation for Non-Geeks

Explaining Internet terms like Podcasting, Phishing Scams, Social Media, Twitter, Blogs, Social Bookmarking, Social Networking, Wikis, RSS to non-geeks is not a easy job. Typically if people find something intimidating they may form a bad opinion about it & keep away. That's what happened to me in school with mathematics. Finding the right learning resources is the key.

Seattle based Lee & Sachi LeFever of Common Craft have been producing roughly 3-minute videos that make complex ideas easy to understand. The videos on general topics are hosted on YouTube. Transcripts are also available. Their format of presentation is snappy, entertaining & so effective that they have been commissioned by companies like Microsoft & Google to develop custom educational videos for their products.

Also see:
Free ASP.NET & related videos
Read More
Learning Resources for Building High Performance Websites

Learning Resources for Building High Performance Websites

I have high regard for Steve Souders & Peter-Paul Koch. Their knowledge and contributions to the Web Development community are exemplary. Steve is the man behind YSlow, a nifty tool that analyzes web pages and tells you why they're slow based on the rules for high performance web sites.

Steve recently finished teaching a course on High Performance Web Sites at Stanford. He has graciously shared the material from the class on the class web site & also interesting guest lectures. All these resources are great fodder for web developers.

As part of their course, the students studied popular websites to identify performance issues in them. Their findings confirm that websites that follow Performance best practices have a high YSlow Grade and load the fastest. Craigslist.org (YSlow Grade:96) & Windows Live (YSlow Grade:94) top their charts while Fox News Channel (YSlow Grade:24) & ESPN (YSlow Grade:28) are at the bottom.

The Q&A from the Midterm Exam & Final Exam are good brain teasers. Sample this -
How many connections per hostname is suggested in the HTTP spec? Do the five most popular browsers follow this recommendation?
2
no, Firefox 3, IE8, Safari 3.1+, Opera 9.60, and Chrome all support 4 or more. IE6 & 7 are still 2.

What are the two request headers that can be used to determine if a cached resource is valid (i.e., used as part of a Conditional GET request)? If the resource is valid, what status code does the web server return?
If-Modified-Since, If-None-Match
304 Not Modified ("304" and "Not Modified" are also valid answers)

Name three potential drawbacks to using a CDN, and a way to mitigate these drawbacks.
your performance can be affected by your competitors, you don't have direct control, if the CDN's performance degrades so does yours
you can use two CDNs to hedge your bets

Name two browsers (including major version #) that support parallel script loading?
IE8, Safari 4 are the biggies. Also Android 1, iPhone 2, Konqueror 4, Opera 9, and some Blackberries.

How much does gzip compression typically reduce transfer sizes?
70%

Which trigger busy indicators?
script in iframe
script DOM element
script defer
document.write script tag

What's the benefit of splitting resource downloads across multiple domains? In general, how many domains should you shard across?
You can get more parallel downloads by splitting resources across multiple domains. The ideal number of domains is 2-4.

List two pros and two cons of using iframes.
pros:
embedding content from another web site
sandboxing 3rd party JavaScript
asynchronous loading of external scripts

cons:
most expensive DOM element
blocks parent's onload

List the seven types of CSS selectors and give an example of each.
ID: #navbar {}
class: .navbar {}
type: A {}
descendant: UL LI {}
child: UL > LI {}
adjacent sibling: UL + P {}
universal: [color: red] {}

Also see:
HOW TO improve the front-end performance of a website - II
Read More
What is Stemming?

What is Stemming?

Stemming means matching on the "stem" (or root) of the word rather than the exact word.

Many of the popular search engines support Stemming. For instance if you search for pet lemur dietary needs, search engines like Google & Live Search will also search for pet lemur diet needs, and other related variations of your terms. 

Live Search now has a new feature that I think is a form of visual stemming. You can use images to find other images.

Search in SharePoint also supports Stemming.
Read More
HOW TO find if your site is indexed by search engines

HOW TO find if your site is indexed by search engines

For most websites, much of their traffic is driven by search engines. To see if your site is listed on popular search engines like Google, Live Search and Yahoo Search, type site: followed by (without space) your website domain URL. Ofcourse, this technique can also be useful to search within a specific domain.

All the above mentioned search engines provide tools for Webmasters to inform & manage the interaction:

On a personal note, about 71% of visitors to my blog come through search engines. In this year it has garnered a modest 16,000 hits with about 35% of the visitors from US. 

Related:
Read More
Large ASP.NET websites - 1

Large ASP.NET websites - 1

Anything that represents customer hand-holding represents a failure of site design - Jim Buckmaster, Craigslist

What does it take to run a large ASP.NET website that can have 30+ million hits a day (500 - 600 pages per second)? You would have to ask Markus Frind who single handedly runs PlentyOfFish, a hugely popular on-line dating website. 

The stats & lessons (via High Scalability) about his site can be insightful to ASP.NET developers.

Tech Stats:
  • PlentyOfFish (POF) runs on ASP.NET, IIS, Akamai CDN, Foundry ServerIron Load Balancer
  • PlentyOfFish gets 1.2 billion page views/month, and 500,000 average unique logins per day. 
  • 2 load balanced web servers with 2 Quad Core Intel Xeon X5355 @ 2.66Ghz), 8 Gigs of RAM (using about 800 MBs), 2 hard drives, runs Windows x64 Server 2003.
  • 3 DB servers. No data on their configuration.
  • Approaching 64,000 simultaneous connections and 2 million page views per hour.
  • Internet connection is a 1Gbps line of which 200Mbps is used.
  • 1 TB/day serving 171 million images through Akamai.
  • 6TB storage array to handle millions of full sized images being uploaded every month to the site.

Lessons:
  • Creating simple things is the result of years of practical experience.
  • There isn't a single site in the top 100 that doesn’t use a CDN. 
  • "The bigger you get as a free site the less money you make per visit and the more it costs to service a visit."
  • You can't always listen to user responses. Some users will always love new features and others will hate it. Only a fraction will complain. Instead, look at what features people are actually using by watching your site.
Also see:
Read More

HOW TO implement AutoComplete with jQuery & ASP.NET

Auto-completion of search terms is an AJAX feature popularized by Google that reduces typing by listing possible keywords as the user types. ASP.NET developers typically use the AutoComplete Extender that is the part of the ASP.NET AJAX Control Toolkit to plug it to a text box to implement auto-completion. There are other alternatives but one of the best options I've found is jQuery AutoComplete Plugin.

jQuery is a lightweight JavaScript library that simplifies HTML document traversing, event handling, animating, and Ajax interactions for rapid web development. It was released in January 2006 by John Resig, a JavaScript Evangelist for the Mozilla Corporation.

Using the plugin is a no-brainer as the code sample will show. All the grunt work is done by the jQuery Autocomplete Plugin. Building & deploying an Autocomplete solution takes just a few minutes and hardly any lines of code. There are a various specialized jQuery Autocomplete Plugins that offer additional features than the official jQuery Autocomplete Plugin from which they are extended.

Talking of jQuery deployment, Dave Ward recommends having the jQuery's external JavaScript files referenced from the copy at Google AJAX Libraries CDN rather than hosting jQuery on your own server. This has the advantage of providing decreased latency, increased parallelism, and better caching.

Read More

HOW TO avoid Spam Filters while emailing programmatically

Spam filters are generally built into email clients, can be installed seperately or implemented on the server. Many popular spam filters utilize Bayesian spam filtering besides other techniques to distinguish illegitimate spam email from legitimate email. 

The process involves training the spam filter to identify spam words. 
After training, the word probabilities (also known as likelihood functions) are used to compute the probability that an email with a particular set of words in it belongs to either category. Each word in the email contributes to the email's spam probability. This contribution is called the posterior probability and is computed using Bayes' theorem. Then, the email's spam probability is computed over all words in the email, and if the total exceeds a certain threshold (say 95%), the filter will mark the email as a spam.

To prevent a programmatically sent email from landing in the Junk folder, we have to understand how spam filters operate.

Using SpamAssassin (an open-source spam filter) as an example, Andreas points out that avoiding "spammy" text in the email, fewer images, a good well formed layout and having both HTML  and plain text views of the message can prevent an email from being marked as spam. His article includes a nice analysis of SpamAssassin & a C# code sample on creating an AlternateView that will please the spam filter.

Related:
Read More
HOW TO conditionally format entire row/s based on a cell's text value in Excel 2007

HOW TO conditionally format entire row/s based on a cell's text value in Excel 2007

I found that Conditionally Formatting an entire row/s rather than a single cell and that too  based on a text value in a cell rather than a numeric value in Excel 2007 is not straight forward. After a bit of monkeying around I learnt you can also actually have multiple Formulas while specifying a Rule for Conditional Formatting.

I jotted down the steps to do this with screen shots and posted them on my Code Gallery.

If you know of a simpler or alternative way to Conditionally Format an entire row in Excel 2007, please let me know.

Also see:
Read More
SEO simplified

SEO simplified

Undermining the exagerrated fears of some SEO consultants about all the changes happening at Google Search in recent times, randfish over at SEOmoz Blog says -
SEO remains, at its core, remarkably similar to what it was in 2002:
Make pages accessible
Target with keywords that searchers employ
Build content that users will find useful and valuable
Earn editorial links from good sources

The Search Engine Optimization Starter Guide from Google has another nice advice -
..you should base your optimization decisions first and foremost on what's best for the visitors of your site.

Also see -
Read More

How To Copy Files between Virtual PC and Host PC

With Virtual PC 2007, you can run multiple operating systems (Guest OS - Windows 98/Me/2000/XP/Vista/2008, OS/2) on the same physical computer (Host OS - Windows Vista Business/Enterprise/Ultimate, Windows XP Pro/Tablet PC). 

The biggest advantage of using Virtual PC 2007 is that you can test an application on multiple virtual machines instead of actual physical computers. You can even set up a test network, by installing VPC and then creating VMs for each server and workstation that you want on your test network.

While working on a Virtual PC, you may sometimes need to access files from the host PC. Copying files from Virtual PC to the Host PC or vice versa is a cinch. Click on the Edit option in the menu & select Settings. A dialog box showing various settings & their current values. Choose Shared Folders in that list & in it's accompanying panel, click on the Share Folder... button. This opens another dialog box that lets you browse through the folders in the physical computer. Select a folder and this can be used to share files between the Virtual PC and Host PC.

(click on image to enlarge)

Related posts:
Read More

India Stats

India Today published a special issue titled "Transforming India Great Ideas.Great Minds" in October. It has thought provoking articles by India's best minds on ideas than can transform India and how they can be implemented.

The articles contained some statistics about India - some interesting, some extremely shocking. Sample this -
  • 72 was India’s rank in the 2007 transparency international’s global corruption perception index.
  • Rs 883 cr - the amount of bribes paid by poor families in 2007 to access 11 public services, says a TII-CMS report.
  • 69 per cent is the reservation in educational institutions in Tamil Nadu, the highest among all Indian states.
  • 120 MPs in the Lok Sabha face criminal charges, though the law says that anyone sentenced to two years or more in jail is disqualified from contesting elections.
  • 126 policemen per 1 lakh population. That is India’s manpower deficit compared to western ratios of 250-500 per 1 lakh.
  • 8 - is the number of communal riots independent India has seen in which more than 500 people have been killed.
  • 2 per cent of the country’s population is covered under pension benefits, compared to 21.1 per cent in China.
  • 25% of the world's total skilled work force will be Indians by 2020.
  • 9.1 is the percentage of women national legislators in India; compared to a global average of 18 per cent.
  • $45 billion is what India spends on research and development, a patch of China's expenditure of $216 billion.
  • 302 - number of individual and team gold medals on offer at the Beijing Olympics. India won just one.
  • 300 mn the number of Indians who don’t have access to safe drinking water. Yet an average of 1,000 cubic metres is used by every Indian per year.
  • 1.6 per cent of Indian wage earners invest in mutual funds, while less then 10 per cent of households have insurance.
  • India has 4600 large dams built across the country. But not more than 6 to 15 per cent of agricultural land in each state is irrigated by any of these projects.
  • 1.2 million  - the number of NGOs in India, though less than 1 per cent of them have professional fund-raisers
  • 31,000 graduates are produced every year by India’s 271 medical institutions.
  • 19 per cent of the gross budgetary expenditure has been earmarked for education in the 11th five year plan, up from 7.7% in the 10th plan.
  • 39,600 vehicles have gone off the road after phase one of the Delhi metro, saving Rs 288 cr on maintaining roads and managing traffic.
Numbers tell a story.
Read More