<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>jquery on S Anand</title>
    <link>https://www.s-anand.net/blog/tag/jquery/</link>
    <description>Recent content in jquery on S Anand</description>
    <generator>Hugo -- 0.164.0</generator>
    <language>en-us</language>
    <lastBuildDate>Wed, 06 Oct 2021 15:56:23 +0000</lastBuildDate>
    <atom:link href="https://www.s-anand.net/blog/tag/jquery/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Eating more for less</title>
      <link>https://www.s-anand.net/blog/eating-more-for-less/</link>
      <pubDate>Thu, 19 May 2011 18:12:23 +0000</pubDate>
      <guid>https://www.s-anand.net/blog/eating-more-for-less/</guid>
      <description>&lt;p&gt;A couple of years ago, I managed to &lt;a href=&#34;https://www.s-anand.net/blog/my-weight-line/&#34;&gt;lose a fair bit of weight&lt;/a&gt;. At the start of 2010, I started putting it back on, and the trajectory continues. I’m at the stage where I seriously need to lose weight.&lt;/p&gt;
&lt;p&gt;I subscribe to &lt;a href=&#34;http://www.fourmilab.ch/hackdiet/&#34;&gt;The Hacker’s Diet&lt;/a&gt; principle – that you lose weight by eating less, not exercising.&lt;/p&gt;
&lt;blockquote&gt;An hour of jogging is worth about one Cheese Whopper. Now, are you going to really spend an hour on the road every day just to burn off that extra burger?
&lt;p&gt;You don&amp;rsquo;t exercise to lose weight (although it certainly helps). You exercise because &lt;em&gt;you&amp;rsquo;ll live longer&lt;/em&gt; and &lt;em&gt;you&amp;rsquo;ll feel better&lt;/em&gt;.&lt;/blockquote&gt;
I’m afraid &lt;a href=&#34;http://www.google.com/publicdata?ds=wb-wdi&amp;amp;met=sp_dyn_le00_in&amp;amp;idim=country:GBR&amp;amp;dl=en&amp;amp;hl=en&amp;amp;q=life+expectancy+graph&#34;&gt;I’ll live too long&lt;/a&gt; anyway, so I won&amp;rsquo;t bother exercising just yet. It&amp;rsquo;s down to eating less.&lt;/p&gt;
&lt;p&gt;Sadly, I like food. So to make my “diet” work, I need foods that add less calories per gram. Usually, when browsing stores, I check these manually. But being a &lt;a href=&#34;https://www.s-anand.net/blog/how-i-buy-gadgets/&#34;&gt;geek&lt;/a&gt;, I figured there’s an easier way.&lt;/p&gt;
&lt;p&gt;Below is a graph of some foods (the kind I particularly need to avoid, but still end up eating). The ones on the top add a lot of calories (per 100g), and better to avoid. The ones at the right cost a lot more. Now, I’m no longer at the point where I need to worry about food expenses, but still, I can’t quite kick the habit, also you might want to check out this &lt;a href=&#34;https://rootine.co/blogs/ourscience/can-a-little-vitamin-b12-really-hurt-you&#34;&gt;Rootine&amp;rsquo;s comparison of B12 methylcobalamin and cyanocobalamin&lt;/a&gt; that will help you in your diet.&lt;/p&gt;
&lt;p&gt;Hover over the foods to see what they are, and click on them to visit the product. (If you’re using an RSS reader and this doesn’t work, &lt;a href=&#34;https://www.s-anand.net/blog/eating-more-for-less&#34;&gt;read on my site&lt;/a&gt;.)&lt;/p&gt;
&lt;style&gt;
.map { position: relative; width: 600px; height: 600px; }&lt;br /&gt;
.map a { position: absolute; display: block; width: 6px; height: 6px; font-size: 6px;&lt;br /&gt;
-moz-box-shadow: 1px 1px 2px black;&lt;br /&gt;
-webkit-box-shadow: 1px 1px 2px black;&lt;br /&gt;
box-shadow: 1px 1px 2px black;&lt;br /&gt;
filter:progid:dximagetransform.microsoft.dropshadow(color=&#39;#222222&#39;,offx=&#39;1&#39;,offy=&#39;1&#39;);&lt;br /&gt;
}&lt;br /&gt;
.map a:hover { z-index: 100; width:16px; height: 16px; margin-left: -5px; margin-top: -5px; border: 2px solid black;&lt;br /&gt;
filter:progid:dximagetransform.microsoft.dropshadow(color=&#39;#222222&#39;,offx=&#39;1&#39;,offy=&#39;1&#39;);&lt;br /&gt;
}&lt;br /&gt;
.desserts a { background-color: #a7c0de; border: 1px solid #4f81bd; }&lt;br /&gt;
.icecream a { background-color: #c0504d; border: 1px solid #632523; }&lt;br /&gt;
.snacks a { background-color: #9bbb59; border: 1px solid #4f6228; }&lt;br /&gt;
.cake a { background-color: #8064a2; border: 1px solid #403152; }&lt;br /&gt;
.cereals a { background-color: #fbcba3; border: 1px solid #f79646; }&lt;br /&gt;
.map input { position: absolute; right: 0px; top: 0px; }&lt;br /&gt;
a.hidden { display: none; }&lt;br /&gt;
&lt;/style&gt;
&lt;div class=&#34;map&#34;&gt;&lt;img src=&#34;https://www.s-anand.net/blog/assets/legend.webp&#34; /&gt;
&lt;input type=&#34;text&#34; placeholder=&#34;search&#34; /&gt;
&lt;div class=&#34;icecream&#34;&gt;
&lt;/div&gt;
&lt;div class=&#34;snacks&#34;&gt;
&lt;/div&gt;
&lt;div class=&#34;desserts&#34;&gt;
&lt;/div&gt;
&lt;div class=&#34;cereals&#34;&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;script src=&#34;https://cdn.jsdelivr.net/npm/jquery@3.3.1/dist/jquery.min.js&#34;&gt;&lt;/script&gt;
&lt;script&gt;&lt;br /&gt;
(function($){&lt;br /&gt;
var timeout = 0;&lt;br /&gt;
var $foods = $(&#39;.map a&#39;);&lt;br /&gt;
var $search = $(&#39;.map input&#39;);&lt;/p&gt;
&lt;p&gt;function search() {&lt;br /&gt;
  var keyword = $search.val();&lt;br /&gt;
  keyword = new RegExp(keyword, &#34;i&#34;);&lt;br /&gt;
  $foods.each(function() {&lt;br /&gt;
    var $this = $(this);&lt;br /&gt;
    if ($this.attr(&#39;title&#39;).match(keyword)) { $this.removeClass(&#39;hidden&#39;); }&lt;br /&gt;
    else { $this.addClass(&#39;hidden&#39;); }&lt;br /&gt;
  });&lt;br /&gt;
}&lt;/p&gt;
&lt;p&gt;$search.keyup(function(e) {&lt;br /&gt;
  if (timeout) { clearTimeout(timeout); }&lt;br /&gt;
  timeout = setTimeout(search, 200);&lt;br /&gt;
});&lt;br /&gt;
})(jQuery)&lt;br /&gt;
&lt;/script&gt;
&lt;p&gt;(The data was picked from &lt;a href=&#34;http://www.tesco.com/groceries/&#34;&gt;Tesco&lt;/a&gt;.)&lt;/p&gt;
&lt;p&gt;It’s interesting that cereals are in the middle of the calorie range. I always thought they’d be low calories per gram. Turns out that if I want to to have such foods, I’m better off with desserts or ice creams (&lt;a href=&#34;http://www.tesco.com/groceries/Product/Details/?id=267292296&#34;&gt;profiterole&lt;/a&gt;, &lt;a href=&#34;http://www.tesco.com/groceries/Product/Details/?id=267289744&#34;&gt;lemon meringue&lt;/a&gt; or &lt;a href=&#34;http://www.tesco.com/groceries/Product/Details/?id=256407381&#34;&gt;tiramisu&lt;/a&gt;). In fact, even &lt;a href=&#34;http://www.tesco.com/groceries/Product/Details/?id=251736868&#34;&gt;jams&lt;/a&gt; have less calories than cereals.&lt;/p&gt;
&lt;p&gt;But there &lt;em&gt;are&lt;/em&gt; some desserts to avoid. &lt;a href=&#34;http://www.tesco.com/groceries/Product/Details/?id=261591602&#34;&gt;Nuts&lt;/a&gt; are a disaster. So are &lt;a href=&#34;http://www.tesco.com/groceries/Product/Details/?id=259614128&#34;&gt;chocolates&lt;/a&gt;. &lt;a href=&#34;http://www.tesco.com/groceries/Product/Details/?id=256582494&#34;&gt;Gums&lt;/a&gt;, &lt;a href=&#34;http://www.tesco.com/groceries/Product/Details/?id=266282937&#34;&gt;dates&lt;/a&gt; and &lt;a href=&#34;http://www.tesco.com/groceries/Product/Details/?id=265796452&#34;&gt;honey&lt;/a&gt; are in the middle – about as good as cereals. &lt;a href=&#34;http://www.tesco.com/groceries/Product/Details/?id=254694261&#34;&gt;Salsa dip&lt;/a&gt; seems surprisingly low. &lt;a href=&#34;http://www.tesco.com/groceries/Product/Details/?id=250337392&#34;&gt;Custards&lt;/a&gt; seem to hit the sweet spot – cheap, and very low in calories. Same for &lt;a href=&#34;http://www.tesco.com/groceries/Product/Details/?id=260667072&#34;&gt;jellies&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;So: custards and jelly. My daughter’s going to be happy.&lt;/p&gt;
&lt;hr&gt;
&lt;h2 id=&#34;comments&#34;&gt;Comments&lt;/h2&gt;
&lt;!-- wp-comments-start --&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Srinivas&lt;/strong&gt; &lt;em&gt;2 Jun 2011 2:30 pm&lt;/em&gt;:
well looking at the graph, the answer is simple. just dont go to Tesco!
and seriously , the most important rule of thumb to eat right is, never eat anything that comes in a packet.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;a href=&#34;http://nullpointers.wordpress.com&#34;&gt;Sathya&lt;/a&gt;&lt;/strong&gt; &lt;em&gt;20 May 2011 8:11 am&lt;/em&gt;:
Saar what about &amp;ldquo;arachi vitta kozhlambu&amp;rdquo;, thovaiyal, medu bonda, Rasa vadai , usili &amp;hellip; and items form &amp;ldquo;Grand Sweets and Snacks&amp;rdquo; ? Where are these ? these are my staples ;-(
jk &amp;hellip; Nice one ( some surprises as well ).&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Sumit Dhar&lt;/strong&gt; &lt;em&gt;20 May 2011 4:34 pm&lt;/em&gt;:
Anand,
I know it sound crazy but increasingly research is showing that not all calories are equal. What that means is that, a calorie from carbs might result in greater fat / weight gain thank a calorie from proteins. (Reference: &lt;a href=&#34;http://www.ncbi.nlm.nih.gov/pmc/articles/PMC506782/&#34;&gt;http://www.ncbi.nlm.nih.gov/pmc/articles/PMC506782/&lt;/a&gt;)
Additionally, processed sugar is something you should avoid. Sugar causes insulin spikes that results in greater fat storage. Sames goes for carbs. Even the desserts you mention, should ideally be avoided. (Reference: &lt;a href=&#34;http://www.youtube.com/watch?v=dBnniua6-oM&#34;&gt;http://www.youtube.com/watch?v=dBnniua6-oM&lt;/a&gt;)
On the other hand, I am consuming quite a bit of nuts on a daily basis: almonds, cashews, peanuts. They are a good source of proteins and vital fatty acids. If you are a veggie, cottage cheese is another good source of proteins (along with fat too). Milk is another source of proteins along with calcium.
Why we get Fat by Gary Taubes is a good book to check out. While I am not a big believer in rapid fat loss or fast weight reduction, I have read good things about the Rapid Fat Loss Handbook. It reiterates ideas from Why we get Fat.
In short, don&amp;rsquo;t focus on calories. Focus on grams of carbs consumed per day.
Cheers,
Sumit&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;a href=&#34;http://dharmendra.me&#34;&gt;D&lt;/a&gt;&lt;/strong&gt; &lt;em&gt;26 May 2011 6:03 am&lt;/em&gt;:
Anand,
I would recommend you also consider one major strategy - nutrient timing, which I used to good effect over the last 6 months while consuming the same no. of calories.
Also if you really like chocolate, you can try dark chocolate as an alternative - lower calories per gram.
Even for vegetarians, protein shakes derived from whey and soy are a great alternative to other foods. I have employed each of these and can vouch for their effectiveness in managing weight&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;a href=&#34;http://www.infosys.com&#34;&gt;Shankar V&lt;/a&gt;&lt;/strong&gt; &lt;em&gt;27 May 2011 9:00 pm&lt;/em&gt;:
I agree with you. Nothing like cutting on food to lose weight. Exercise requires perseverance and focus&amp;hellip;.I lack both. :)
Cutting down on food also has issues&amp;hellip;..you reduce intake for a few days, then pop comes a wedding or function where you get &amp;lsquo;ilai potta sappadu&amp;rsquo; and all control is lost. You tell yourself, just this once and then very soon you are back to your original eating habits.
Best option - must be born with a body that does not put on weight. Period!!! I envy those folks. :)&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Saurabh Mittal&lt;/strong&gt; &lt;em&gt;15 Jan 2014 12:04 pm&lt;/em&gt;:
Nice one Anand! I was at 82 kgs a few years back and managed to come down to 72 . This was a result of both exercise (have run two half marathons so far in 2012 and then again in 2013) and change of eating habits (more of proteins and less of carbs). There is a nice book as well by Tim Ferris (The Four Hour Body), but in short definitely look at incorporating more exercise in your routine..Also as Sumit pointed out above - processed sugars and salt are the two major culprits! We don&amp;rsquo;t even realize how these are found in plenty in most of the foods! Keeping track of weight on a daily basis definitely is a good habit!
Cheers
Saurabh&lt;/li&gt;
&lt;/ul&gt;
&lt;!-- wp-comments-end --&gt;
</description>
    </item>
    <item>
      <title>Open source in corporates</title>
      <link>https://www.s-anand.net/blog/open-source-in-corporates/</link>
      <pubDate>Mon, 14 Dec 2009 21:59:30 +0000</pubDate>
      <guid>https://www.s-anand.net/blog/open-source-in-corporates/</guid>
      <description>&lt;p&gt;Last month, my first application went live.&lt;/p&gt;
&lt;p&gt;I’ve been writing code for 20 years. Not one line of my code has been officially deployed in a corporate. (Loser&amp;hellip;)&lt;/p&gt;
&lt;p&gt;It’s a happy feeling. Someone defined happiness as the intersection of pleasure and meaning. Writing code is pleasurable. Others using it is meaningful.&lt;/p&gt;
&lt;p&gt;But this post isn’t quite about that. It’s about the hoops I’ve had to jump through to make this happen.&lt;/p&gt;
&lt;p&gt;I’ve been living in a nightmare since March 2009. That was when I decided that I’d try and get corporates to use open source.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;March 2009&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;It began with a pitch to a VC firm. They were looking to build a content management system (CMS). Normally we’d pull together slides that say we’ll deliver the moon. This time, we put together demo based on WordPress’ CMS plugins.&lt;/p&gt;
&lt;p&gt;The meeting went fabulously well. We said, “Here’s a demo we’ve built for you. Do you like it?” The business lead (Stuart) was drooling and declared that that’s exactly what they wanted. The IT lead (another Stuart) was happy too, but warned the business users: “Just remember: this isn’t how &lt;strong&gt;we&lt;/strong&gt; do development, so don’t get your hopes up that we can deliver stuff like this :-)”&lt;/p&gt;
&lt;p&gt;Time to make my point. I asked, “What’s your policy on open source software?”&lt;/p&gt;
&lt;p&gt;The business lead went quiet. “I don’t know,” he finally said. Fair enough.&lt;/p&gt;
&lt;p&gt;I turned to the IT lead. “Well, we don’t use it as a matter of policy&amp;hellip; there are security concerns&amp;hellip;” he said.&lt;/p&gt;
&lt;p&gt;“Which web server do you use?”&lt;/p&gt;
&lt;p&gt;”Oh, OK. I see what you mean. We use Apache. So on a case to case basis, we have exceptions. But generally we have security concerns.“&lt;/p&gt;
&lt;p&gt;”Why? Do you believe open source software is more insecure than commercial software?“&lt;/p&gt;
&lt;p&gt;He thought about it for a while. “Well&amp;hellip; maybe. I don’t know.” We debated this a bit. Then we found the real issue: “It’s just that we &lt;strong&gt;don’t have control over the process&lt;/strong&gt;. We don’t know enough about it to decide.”&lt;/p&gt;
&lt;p&gt;A couple of weeks later, I tried pitching to a newspaper company. This time, it was our sales team that raised the same question. “But&amp;hellip; isn’t open source insecure?”&lt;/p&gt;
&lt;p&gt;I didn’t even bother pitching any open source stuff to them. But I’d learnt my lessons:&lt;/p&gt;
&lt;blockquote&gt;
&lt;ol&gt;
&lt;li&gt;Demo the application. Don’t talk about it.&lt;/li&gt;
&lt;li&gt;Show it to the business first, and then tackle IT.&lt;/li&gt;
&lt;/ol&gt;
&lt;/blockquote&gt;
&lt;hr&gt;
&lt;p&gt;&lt;strong&gt;Aside: June 2009&lt;/strong&gt;
In June, I got another chance. I was building the website for a large retailer. The very first thing I did was ask to see the Javascript. Total mess, and filled with browser-incompatible DOM requests. So I went over to their web development team.&lt;/p&gt;
&lt;p&gt;“Look, why don’t you guys use a Javascript library? It’ll get you cross browser compatibility and compact maintainable code at the same time.”&lt;/p&gt;
&lt;p&gt;And, to their credit, they said, “Sure. Which library?”&lt;/p&gt;
&lt;p&gt;I showed them this comparison of jQuery (blue), dojo, scriptaculous and mootools&amp;hellip;&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;https://trends.google.com/trends/explore?date=all&amp;amp;q=jquery,prototype,dojo,ext,yui&#34;&gt;https://trends.google.com/trends/explore?date=all&amp;amp;q=jquery,prototype,dojo,ext,yui&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;hellip; and we agreed on jQuery. So, if nothing else, I’ve managed to get one open source library into a corporate.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;July 2009&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;I was also looking at payments, and retailer was looking to replace their chargeback application. Since I had a week off, I built a working PCI compliant prototype on &lt;a href=&#34;http://www.djangoproject.com/&#34;&gt;Django&lt;/a&gt;. This time, I applied the lessons I’d learned, and demo-ed it to the business, who were thrilled. Time to tackle IT.&lt;/p&gt;
&lt;p&gt;I started with the architecture team. Matt on the architecture team was the most approachable. So I went over, demo-ed it, and said, “Matt, this took a week to put together. It’s based on some new technologies. Are you game to try these out?”&lt;/p&gt;
&lt;p&gt;He was. And quite enthused about it too. So we put together a proposal for the architecture review board, proposing a new technology stack: Django / Python and MySQL. As before, I showed the demo before I talked technology. I had prepared answers to all security related questions upfront (and practically memorised section 3 of the PCI guidelines.) The clincher, though, was the business case. To build it on Java, it would cost ~1,000 person days. On Django, I’d mostly done it in 5. There was no way of justifying 1,000 person days for an application that could save, at best £100,000 a year.&lt;/p&gt;
&lt;p&gt;So they said “Go ahead, we’re fine if operations and infrastructure are fine.”&lt;/p&gt;
&lt;p&gt;It was time to find a Django developer in Infosys. I hunted for a couple of weeks but none was available. (Only 2 people knew Django in the first place.) So that effort got canned, and we were back to the 1,000 person day solution. (Which got canned too, later.)&lt;/p&gt;
&lt;p&gt;But in the process, I’d learned my third lesson.&lt;/p&gt;
&lt;blockquote&gt;
&lt;ol start=&#34;3&#34;&gt;
&lt;li&gt;If you’re trying new technologies, plan on delivering it yourself.&lt;/li&gt;
&lt;/ol&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;strong&gt;October 2009&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Another application popped up that looked like a prime candidate for introducing open source. They were using an Excel application to fraud screen orders, and wanted to make a web app out of it.&lt;/p&gt;
&lt;p&gt;I followed the same route as before. Demo it. Show it to business first, then IT. Built it myself. I skipped Architecture, since they’d already approved the technology stack, and took it straight to Infrastructure.&lt;/p&gt;
&lt;p&gt;“This application uses Apache as the web server, MySQL as the database, and uses PHP and Javascript for the application logic. Could we get a Linux server to host it?”&lt;/p&gt;
&lt;p&gt;Our entire conversation lasted 30 seconds. He said, “No. We use Windows servers” (I was fine)&lt;/p&gt;
&lt;p&gt;“&amp;hellip; and you’ll need to chance Apache to IIS” (fine again)&lt;/p&gt;
&lt;p&gt;“&amp;hellip; and we don’t support PHP, so it’ll have to be Java or .NET” (I don’t know .NET or Java&amp;hellip; but fine)&lt;/p&gt;
&lt;p&gt;“&amp;hellip; and we don’t support MySQL, it’ll have to be SQL Server” (fine, I guess)&lt;/p&gt;
&lt;p&gt;“&amp;hellip; and we don’t have DBAs available until January, so you’ll have to wait.” (definitely not good.)&lt;/p&gt;
&lt;p&gt;So back to the drawing board on the technology stack. I needed something in Java (I know very little Java, but nothing at all in .NET) and to avoid the DBA headache, it would have to bundle in a database. I first explored key-value stores like &lt;a href=&#34;http://couchdb.apache.org/&#34;&gt;CouchDB&lt;/a&gt;, &lt;a href=&#34;http://code.google.com/p/redis/&#34;&gt;Redis&lt;/a&gt;, etc. None of them worked on Java. The only one I found that did was &lt;a href=&#34;http://www.persvr.org/&#34;&gt;Persevere&lt;/a&gt;, and it was a JSON data store, which fit perfectly with my plans.&lt;/p&gt;
&lt;p&gt;By this time, I’d also learn my my fourth and most important lesson.&lt;/p&gt;
&lt;blockquote&gt;
&lt;ol start=&#34;4&#34;&gt;
&lt;li&gt;Don’t try to promote open source. Just deliver the application&lt;/li&gt;
&lt;/ol&gt;
&lt;/blockquote&gt;
&lt;p&gt;I said, “This is a custom-built application that runs on Java. Could we get a Windows server to host it?”&lt;/p&gt;
&lt;p&gt;The answer was “Yes”, and we had it the next day.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;PS: December 2009&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;The application’s deployed and running. It has about 10,000 orders fraud screened by now.&lt;/p&gt;
&lt;p&gt;And the lessons are well learnt. So when some came over asking if there was any image resizing solution I knew off, I said: “Sure, who’s your business sponsor?” Then I went over and said, “Let me show you this open source application called ImageMagick. It handles aspect ratios correctly, and can crop too. Doesn’t this look professional?” Then I went over to IT and said, “It’s open source, so you can change it. It has Java bindings, so you can integrate it into your environment. It can handle 8 3000x2400 images a second on my puny laptop. It’s used by your competitors. And I can build it for you if you like.”&lt;/p&gt;
&lt;p&gt;I might just have my second open source entry into a corporate this year.&lt;/p&gt;
&lt;hr&gt;
&lt;h2 id=&#34;comments&#34;&gt;Comments&lt;/h2&gt;
&lt;!-- wp-comments-start --&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Kalpesh&lt;/strong&gt; &lt;em&gt;15 Dec 2009 4:27 am&lt;/em&gt;:
Great post.
The feeling one gets, when the software is used by people and one hears a few praises, is priceless.
I have enjoyed working with end-users &amp;amp; they have a lot to tell you, when they use the software.
i.e. ask the viewers about the movie &amp;amp; not the critics ;)
From your post, I think business guys are scared of the word &amp;ldquo;open source&amp;rdquo; without knowing some of the best software is open-source. I agree with your idea of &amp;ldquo;show them the software first, let them use it &amp;amp; be happy with it. They won&amp;rsquo;t worry if its open source&amp;rdquo;.
Good to see a post from you after quite some time.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;a href=&#34;http://thejeshgn.com&#34;&gt;Thejesh GN&lt;/a&gt;&lt;/strong&gt; &lt;em&gt;15 Dec 2009 6:08 am&lt;/em&gt;:
I had to pitch only one customer this year and he agreed to use JQuery (the biggest plus was, it wasn&amp;rsquo;t gnu, its MIT). I think by default many customers use open source components with out actually realizing they are opensource. Like for example most of apache products, eclipse.
But on the other side, I think the challenge is to convince IT Provider ( or the customer ) to go opensource. Not using but releasing some of their IP under OpenSource. How do we pitch this to them?
Not undermining your efforts. I think the challenge is to convert this big users into contributors.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Ashwin Iyengar&lt;/strong&gt; &lt;em&gt;20 Jan 2010 9:55 pm&lt;/em&gt;:
Hey anand,
Got to your webpage after a long time. Good to see that you&amp;rsquo;re still a true &amp;ldquo;end-to-end&amp;rdquo; consultant&amp;hellip;we should have a chat about personal financial management solutions sometime later&amp;hellip;-a&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;a href=&#34;http://www.anandramkumar.co.nr&#34;&gt;Anand.S&lt;/a&gt;&lt;/strong&gt; &lt;em&gt;20 Dec 2009 10:13 pm&lt;/em&gt;:
Nice blog&amp;hellip;
Interesting and gives good insight in details .&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;a href=&#34;http://www.myspacejyoti.blogspot.com&#34;&gt;jyoti&lt;/a&gt;&lt;/strong&gt; &lt;em&gt;21 Dec 2009 6:00 pm&lt;/em&gt;:
nice blog,ur blog sounds great.keep wrtng.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;a href=&#34;http://chitraaz.blogspot.com&#34;&gt;Chitra&lt;/a&gt;&lt;/strong&gt; &lt;em&gt;21 Dec 2009 10:30 pm&lt;/em&gt;:
Interesting! And congrats :-)! I won&amp;rsquo;t pretend that I understood everything you penned (er&amp;hellip;typed) here, but I do realize the inhibition of most users regarding open source technology due to &amp;lsquo;security&amp;rsquo; issues. Perhaps you could list out the most quoted issues sometime&amp;hellip;&amp;hellip;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Somnath&lt;/strong&gt; &lt;em&gt;23 Dec 2009 4:04 am&lt;/em&gt;:
Interesting - I thought your job is that of a management consultant or at least that&amp;rsquo;s what your employer sells your service as. But you end up doing all the technical stuff as well. Guess with all this you are ready to setup your own company now. Happy holidays!
BR,
Somnath&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Khair&lt;/strong&gt; &lt;em&gt;18 Dec 2009 3:58 pm&lt;/em&gt;:
Thanks for your post, seems you have been busy with work/vacation.
Frankly, quite a lot of IT Managers have no clue at all when you speak to them of OpenSource. Though &amp;lsquo;unknowingly&amp;rsquo; they have been using either as Apache or PHP or Java.
If you carefully look at how the IT Managers are recruited or groomed, you will see a culture of everything has to be &amp;lsquo;MICROSOFT&amp;rsquo; !
Believe me for end-users/customers it makes no difference as long as the application delivers the need!
Also one has to commend the aggressive marketing strategy of Microsoft.
I am not against proprietery software but think corporates need to know and look for what&amp;rsquo;s best for the clients and end-users. Which in turn could reduce the money spent on Infrastructure/development/deployment. With money saved they can generate more employment opportunities.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;a href=&#34;http://www.s-anand.net/blog/recruiting-smart-people/&#34;&gt;Recruiting smart people | s-anand.net&lt;/a&gt;&lt;/strong&gt; &lt;em&gt;14 Feb 2010 6:46 pm&lt;/em&gt; &lt;em&gt;(pingback)&lt;/em&gt;:
[&amp;hellip;] at least the smart people) that hang out on Stack Overflow for a given topic. Last year, when I was looking for a Django developer, I scoured the Infosys internal blogs for similar networks. (Didn’t find many, but it sure [&amp;hellip;]&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Harish Kashyap&lt;/strong&gt; &lt;em&gt;5 Mar 2010 7:56 am&lt;/em&gt;:
Hi Anand, I could relate to the sequence of events&amp;hellip; Fantastic post&amp;hellip; I picked the learning to be that it is hard to change the corporate&amp;hellip;Sometime you may have to put in more effort and time to change the corporate rather than to change the solution itself! I.e. Do not view as a constraint as it would prevent the change!&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Vinoth&lt;/strong&gt; &lt;em&gt;21 May 2010 3:52 pm&lt;/em&gt;:
Very insightful blog.. I work for Infosys too and your point about non-availability of django developers is interesting. I think this is one other prime reason why business do not prefer open source. There are simply not enough knowledgeable developers in latest open source frameworks and hence IT vendors cannot confidently pitch for open source.&lt;/li&gt;
&lt;/ul&gt;
&lt;!-- wp-comments-end --&gt;
</description>
    </item>
    <item>
      <title>Client side scraping</title>
      <link>https://www.s-anand.net/blog/client-side-scraping/</link>
      <pubDate>Wed, 04 Mar 2009 18:00:57 +0000</pubDate>
      <guid>https://www.s-anand.net/blog/client-side-scraping/</guid>
      <description>&lt;p&gt;“Scraping” is extracting content from a website. It’s often used to build something on top of the existing content. For example, I’ve built a site that &lt;a href=&#34;http://250.s-anand.net/&#34;&gt;tracks movies on the IMDb 250&lt;/a&gt; by scraping content.&lt;/p&gt;
&lt;p&gt;There are libraries that simplify &lt;a href=&#34;http://en.wikipedia.org/wiki/Web_scraping&#34;&gt;scraping&lt;/a&gt; in most languages:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Perl: &lt;a href=&#34;http://www.perl.com/pub/a/2003/01/22/mechanize.html&#34;&gt;WWW::Mechanize&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Python: &lt;a href=&#34;http://www.crummy.com/software/BeautifulSoup/&#34;&gt;BeautifulSoup&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Ruby: &lt;a href=&#34;http://wiki.github.com/why/hpricot&#34;&gt;HPricot&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;PHP: &lt;a href=&#34;http://rainbowhatseo.fallenray.com/php5/php5-screen-scraping-with-dom-and-xpath/&#34;&gt;XPath&lt;/a&gt; (built-in)&lt;/li&gt;
&lt;li&gt;Javascript: &lt;a href=&#34;http://www.jquery.com/&#34;&gt;jQuery&lt;/a&gt; on &lt;a href=&#34;http://ejohn.org/projects/bringing-the-browser-to-the-server/&#34;&gt;env.js&lt;/a&gt; on &lt;a href=&#34;http://www.mozilla.org/rhino/&#34;&gt;Rhino&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;But all of these are on the server side. That is, the program scrapes from &lt;strong&gt;your machine&lt;/strong&gt;. Can you write a web page where the &lt;strong&gt;viewer’s machine&lt;/strong&gt; does the scraping?&lt;/p&gt;
&lt;p&gt;Let’s take an example. I want to display &lt;a href=&#34;http://www.amazon.com/gp/bestsellers/books/&#34;&gt;Amazon&amp;rsquo;s bestsellers&lt;/a&gt; that cost less than $10. I could write a program that scrapes the site and get that information. But since the list updates hourly, I’ll have to run it every hour.&lt;/p&gt;
&lt;p&gt;That may not be so bad. But consider Twitter. I want to display the latest iPhone tweets from &lt;code&gt;http://search.twitter.com/search.atom?q=iPhone&lt;/code&gt;, but the results change so fast that your server can’t keep up.&lt;/p&gt;
&lt;p&gt;Nor do you want it to. Ideally, your scraper should just be Javascript on your web page. Any time someone visits, their machine does the scraping. The bandwidth is theirs, and you avoid the &lt;a href=&#34;http://www.codinghorror.com/blog/archives/000044.html&#34;&gt;popularity tax&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;This is quite easily done using &lt;a href=&#34;http://developer.yahoo.com/yql/&#34;&gt;Yahoo Query Language&lt;/a&gt;. YQL converts the web into a database. All web pages are in a table called &lt;code&gt;html&lt;/code&gt;, which has 2 fields: &lt;code&gt;url&lt;/code&gt; and &lt;code&gt;xpath&lt;/code&gt;. You can get IBM’s home page using:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;select * from html where url=&amp;quot;http://www.ibm.com&amp;quot;&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Try it at &lt;a href=&#34;http://developer.yahoo.com/yql/console/&#34;&gt;Yahoo’s developer console&lt;/a&gt;. The whole page is loaded into the &lt;code&gt;query.results&lt;/code&gt; element. This can be retrieved using &lt;a href=&#34;http://en.wikipedia.org/wiki/JSONP#JSONP&#34;&gt;JSONP&lt;/a&gt;. Assuming you have jQuery, try the following on &lt;a href=&#34;http://getfirebug.com/&#34;&gt;Firebug&lt;/a&gt;. You should see the contents of IBM’s site on your page.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-javascript&#34; data-lang=&#34;javascript&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;nx&#34;&gt;$&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;getJSON&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;s2&#34;&gt;&amp;#34;http://query.yahooapis.com/v1/public/yql?callback=?&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;p&#34;&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;nx&#34;&gt;q&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;:&lt;/span&gt; &lt;span class=&#34;s2&#34;&gt;&amp;#34;select * from html where url=\&amp;#34;http://www.ibm.com\&amp;#34;&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;nx&#34;&gt;format&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;:&lt;/span&gt; &lt;span class=&#34;s2&#34;&gt;&amp;#34;json&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;p&#34;&gt;},&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;kd&#34;&gt;function&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;data&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;)&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;nx&#34;&gt;console&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;log&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;data&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;query&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;results&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;);&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;p&#34;&gt;},&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;p&#34;&gt;);&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;That’s it! Now, it’s pretty easy to scrape, especially with &lt;a href=&#34;http://www.w3.org/TR/xpath&#34;&gt;XPath&lt;/a&gt;. To get the links on IBM’s page, just change the query to&lt;/p&gt;
&lt;p&gt;&lt;code&gt;select * from html where url=&amp;quot;http://www.ibm.com&amp;quot; and xpath=&amp;quot;//a&amp;quot;&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Or to get all external links from IBM&amp;rsquo;s site:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;select * from html where url=&amp;quot;http://www.ibm.com&amp;quot; and xpath=&amp;quot;//a[not(contains(@href,&#39;ibm.com&#39;))][contains(@href,&#39;http&#39;)]&amp;quot;&amp;quot;&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Now you can display this on your own site, using &lt;a href=&#34;http://www.jquery.com/&#34;&gt;jQuery&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;This leads to interesting possibilities, such as &lt;a href=&#34;http://ajaxian.com/archives/map-reduce-in-the-browser&#34;&gt;Map-Reduce in the browser&lt;/a&gt;. Here’s one example. Each movie on the IMDb (e.g. &lt;a href=&#34;http://www.imdb.com/title/tt0468569/&#34;&gt;The Dark Knight&lt;/a&gt;) comes with a list of recommendations (like &lt;a href=&#34;http://www.imdb.com/title/tt0468569/recommendations&#34;&gt;this&lt;/a&gt;). I want to build a repository of recommendations based on the &lt;a href=&#34;http://www.imdb.com/chart/top&#34;&gt;IMDb Top 250&lt;/a&gt;. So here’s the algorithm. First, I’ll get the IMDb Top 250 using:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;select * from html where url=&amp;quot;http://www.imdb.com/chart/top&amp;quot; and xpath=&amp;quot;//tr//tr//tr//td[3]//a&amp;quot;&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Then I’ll get a random movie’s recommendations like this:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;select * from html where url=&amp;quot;http://www.imdb.com/title/tt0468569/recommendations&amp;quot; and xpath=&amp;quot;//td/font//a[contains(@href,&#39;/title/&#39;)]&amp;quot;&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Then I’ll send off the results to my aggregator.&lt;/p&gt;
&lt;p&gt;Check out the full code at &lt;a href=&#34;http://250.s-anand.net/build-reco.js&#34;&gt;http://250.s-anand.net/build-reco.js&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;In fact, if you visited &lt;a href=&#34;http://250.s-anand.net/&#34;&gt;my IMDb Top 250 tracker&lt;/a&gt;, &lt;strong&gt;you already ran this code&lt;/strong&gt;. You didn’t know it, but you just shared a bit of your bandwidth and computation power with me. (Thank you.)&lt;/p&gt;
&lt;p&gt;And, if you think a little further, here another way of monetising content: by borrowing a bit of the user’s computation power to build complex tasks. There already are &lt;a href=&#34;http://www.pluraprocessing.com/&#34;&gt;startups&lt;/a&gt; built around this concept.&lt;/p&gt;
&lt;hr&gt;
&lt;h2 id=&#34;comments&#34;&gt;Comments&lt;/h2&gt;
&lt;!-- wp-comments-start --&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;a href=&#34;http://aravindavk.in&#34;&gt;Aravinda&lt;/a&gt;&lt;/strong&gt; &lt;em&gt;4 Mar 2009 7:20 pm&lt;/em&gt;:
Great!&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Sriram&lt;/strong&gt; &lt;em&gt;4 Mar 2009 10:51 pm&lt;/em&gt;:
Thank u anand. Nice Information.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Rishi&lt;/strong&gt; &lt;em&gt;5 Mar 2009 8:19 am&lt;/em&gt;:
Awesome&amp;hellip; This is the future&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;a href=&#34;http://taeyoungchoon.wordpress.com/2009/03/26/grep-imdb-part-2/&#34;&gt;grep imdb part 2 ? « taeyoungchoon&lt;/a&gt;&lt;/strong&gt; &lt;em&gt;26 Mar 2009 1:16 pm&lt;/em&gt; &lt;em&gt;(pingback)&lt;/em&gt;:
[&amp;hellip;] &lt;a href=&#34;http://www.s-anand.net/blog/client-side-scraping/&#34;&gt;http://www.s-anand.net/blog/client-side-scraping/&lt;/a&gt; [&amp;hellip;]&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Khair&lt;/strong&gt; &lt;em&gt;26 May 2009 4:10 pm&lt;/em&gt;:
Many thanks for your efforts in simplifying the &amp;lsquo;scraping&amp;rsquo;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;a href=&#34;http://www.venkatsworld.com&#34;&gt;Venkat&lt;/a&gt;&lt;/strong&gt; &lt;em&gt;16 Nov 2010 1:40 pm&lt;/em&gt;:
Hey Anand,
Thanks. This post is really useful. I have managed to scrape Amazon wishlist using this technique (&lt;a href=&#34;http://www.venkatsworld.com/WIP/JSON&#34;&gt;http://www.venkatsworld.com/WIP/JSON&lt;/a&gt;_amazon.html) However YQL seems to be taking some time to respond. I am not sure if you experienced this.I did a similar exercise with Picasa JSON feed and a Jquery plug-in for image scrolling. It works well there too.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;a href=&#34;http://news.ycombinator.com/item?id=4066478&#34;&gt;Zheka&lt;/a&gt;&lt;/strong&gt; &lt;em&gt;17 Jun 2012 8:35 pm&lt;/em&gt;:
Interesting article! There is another powerful scraping technology available that offers Javascript, jQuery, CSS, and XPath instead of XPath-only. It&amp;rsquo;s called Bobik (&lt;a href=&#34;http://usebobik.com&#34;&gt;http://usebobik.com&lt;/a&gt;). The is a cool example of scraping restaurant menus using Bobik at &lt;a href=&#34;http://news.ycombinator.com/item?id=4066478&#34;&gt;http://news.ycombinator.com/item?id=4066478&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;LAvesh&lt;/strong&gt; &lt;em&gt;12 Mar 2013 11:19 pm&lt;/em&gt;:
Hey Anand,
Great Article. Just one query though in the client side implementation its the client IP that will be hitting the website (in your case &lt;a href=&#34;https://www.ibm.com&#34;&gt;www.ibm.com&lt;/a&gt;)? or it will use yahoo SQL server IP to hit.&lt;/li&gt;
&lt;/ul&gt;
&lt;!-- wp-comments-end --&gt;
</description>
    </item>
    <item>
      <title>Infyblogs dashboard</title>
      <link>https://www.s-anand.net/blog/infyblogs-dashboard/</link>
      <pubDate>Mon, 26 Jan 2009 12:00:00 +0000</pubDate>
      <guid>https://www.s-anand.net/blog/infyblogs-dashboard/</guid>
      <description>&lt;p&gt;I just finished &lt;a href=&#34;http://www.perceptualedge.com/&#34;&gt;Stephen Few&lt;/a&gt;&amp;rsquo;s book on &lt;a href=&#34;http://www.amazon.com/Information-Dashboard-Design-Effective-Communication/dp/0596100167&#34;&gt;Information Dashboard Design&lt;/a&gt;. It talks about what&amp;rsquo;s wrong with the dashboards most Business Intelligence vendors (&lt;a href=&#34;http://www.sap.com/solutions/sapbusinessobjects/index.epx&#34;&gt;Business Objects&lt;/a&gt;, &lt;a href=&#34;http://www.oracle.com/&#34;&gt;Oracle&lt;/a&gt;, &lt;a href=&#34;http://www.informatica.com/&#34;&gt;Informatica&lt;/a&gt;, &lt;a href=&#34;http://www.cognos.com/&#34;&gt;Cognos&lt;/a&gt;, &lt;a href=&#34;http://www.oracle.com/hyperion/index.html&#34;&gt;Hyperion&lt;/a&gt;, etc.), and brings &lt;a href=&#34;http://www.edwardtufte.com/&#34;&gt;Tuftian&lt;/a&gt; principles of chart design to dashboards.&lt;/p&gt;
&lt;p&gt;So I took a shot at designing a dashboard based on those principles, and made this dashboard for &lt;a href=&#34;http://blogs.ad.infosys.com/&#34;&gt;InfyBLOGS&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;img loading=&#34;lazy&#34; src=&#34;https://www.s-anand.net/blog/assets/infyblogs-dashboard.webp&#34;&gt;&lt;/p&gt;
&lt;p&gt;&lt;img loading=&#34;lazy&#34; src=&#34;https://www.s-anand.net/blog/assets/infy-blog-comment-network.webp&#34;&gt;&lt;/p&gt;
&lt;p&gt;&lt;img loading=&#34;lazy&#34; src=&#34;https://www.s-anand.net/blog/assets/infy-blog-social-recommendations.webp&#34;&gt;&lt;/p&gt;
&lt;p&gt;You can try for yourself. Go to &lt;a href=&#34;http://www.s-anand.net/reco/&#34;&gt;http://www.s-anand.net/reco/&lt;/a&gt;&lt;br&gt;
&lt;strong&gt;&lt;strong&gt;Note: This only works within the Infosys intranet.&lt;/strong&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Right click on the &amp;ldquo;Infyblog Dashboard&amp;rdquo; link and click &amp;ldquo;Add to Favourites&amp;hellip;&amp;rdquo; (Non-IE users &amp;ndash; drag and drop it to your links bar)&lt;/li&gt;
&lt;li&gt;If you get a security alert, say &amp;ldquo;Yes&amp;rdquo; to continue&lt;/li&gt;
&lt;li&gt;Return to InfyBLOGS, &lt;strong&gt;make sure you&amp;rsquo;re logged in&lt;/strong&gt; (that&amp;rsquo;s important) and click on the &amp;ldquo;Infyblog Dashboard&amp;rdquo; bookmark&lt;/li&gt;
&lt;li&gt;You&amp;rsquo;ll see a dashboard for &lt;strong&gt;your account&lt;/strong&gt;, with comments and statistics&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;The rest of this article discusses design principles and the technology behind the implementation. (It&amp;rsquo;s long. Skim by reading just the &lt;strong&gt;bold headlines&lt;/strong&gt;.)&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Dashboards are minimalist&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;I&amp;rsquo;ll use the design of the dashboard to highlight some of the concepts in the book.&lt;/p&gt;
&lt;p&gt;I designed the dashboard first on Powerpoint, keeping these principles in mind.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Fits in one screen&lt;/strong&gt;. No scrolling. Otherwise, it isn&amp;rsquo;t a dashboard.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Shows only what I need to see&lt;/strong&gt;. Ideally, from this dashboard, I should receive all the information I need to act on, and no more.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Minimises the&lt;/strong&gt; &lt;a href=&#34;http://www.infovis-wiki.net/index.php/Data-Ink_Ratio&#34;&gt;&lt;strong&gt;data-ink ratio&lt;/strong&gt;&lt;/a&gt;. Don&amp;rsquo;t draw a single pixel that&amp;rsquo;s not required.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;The first was easy. I just constrained myself to one page of PowerPoint, though if you had a lot of toolbars, the viewing area of your browser may be less than mine.&lt;/p&gt;
&lt;p&gt;The second is a matter of picking what you want to see. For me, these are the things I look for when I log into InfyBLOGS:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Any new comments?&lt;/li&gt;
&lt;li&gt;Any new posts from my friends?&lt;/li&gt;
&lt;li&gt;What&amp;rsquo;s new? What&amp;rsquo;s hot?&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Then I dig deeper, occasionally, into popular entries, popular referrers, how fast the blogs are growing, etc. So I&amp;rsquo;ve put in what I think are the useful things.&lt;/p&gt;
&lt;p&gt;The third is reflected in the way some of this information is shown. Let me explain.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Keep the charts bare&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Consider the graphs on the right. They look like this.&lt;/p&gt;
&lt;p&gt;Notice the wiggly line to the right. It&amp;rsquo;s a graph called &lt;a href=&#34;http://www.edwardtufte.com/bboard/q-and-a-fetch-msg?msg_id=0001OR&amp;amp;topic_id=1&#34;&gt;sparkline&lt;/a&gt;, and was introduced by Edward Tufte. Sparklines are great to show trends in a compact way. Forget the axes. Forget the axes labels. Forget the gridlines. The text on the left (&amp;ldquo;visitors per day&amp;rdquo;) tells you what it is. The number (10475) is the current value. And the line is the trend. Clearly the number of visitors has exploded recently, from a relatively slow and flat start. The labels and axes aren&amp;rsquo;t going to tell you much more.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Boldly highlight what&amp;rsquo;s important&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;The most important thing here, the title, is on top. It&amp;rsquo;s pure black, in large font, positioned right on top, and has a line segregating it from the rest of the page.&lt;/p&gt;
&lt;p&gt;The sections are highlighted by a bigger font, different colour, and a line, but the effect is a bit more muted.&lt;/p&gt;
&lt;p&gt;The numbers on the right are prominent only by virtue of size and position. If anything, the colour de-emphasizes them. This is to make sure that they don&amp;rsquo;t overwhelm your attention. (They would if they were in red, for instance.)&lt;/p&gt;
&lt;p&gt;The number 10475 is carefully set to occupy exactly two line spaces. That alignment is very important. The small lines are at a font size of 11px, and line spacing is 1.5. So at a font size of 2 x 11px x 1.5 = 33px, the size of the large number covers exactly two rows.&lt;/p&gt;
&lt;p&gt;The labels, such as &amp;ldquo;visitors&amp;rdquo; or &amp;ldquo;sites&amp;rdquo; are in blue, bold. Nothing too out of the way, but visible enough that they stand out.&lt;/p&gt;
&lt;p&gt;The &amp;ldquo;View more&amp;hellip;&amp;rdquo; links just use colour to stand out. They&amp;rsquo;re pretty unimportant.&lt;/p&gt;
&lt;p&gt;The bulk of the text is actually made of links, unlike traditional links, they&amp;rsquo;re not underlined and they&amp;rsquo;re not blue. It would just add to the noise if everything where underlined. But on mouseover, they turn blue and are underlined, clearly indicating that they&amp;rsquo;re links.&lt;/p&gt;
&lt;p&gt;I&amp;rsquo;ve used four mechanisms to highlight relative importance: position, size, colour and lines. There are many more: font, &lt;strong&gt;styling&lt;/strong&gt;, boxes, underlining, indentation, etc.&lt;/p&gt;
&lt;p&gt;The purpose of good design is to draw attention to what&amp;rsquo;s important, to direct the flow of the eye in a way that builds a good narrative. Don&amp;rsquo;t be shy of using every tool at your disposal in doing that. While on the topic, the &lt;a href=&#34;http://www.amazon.com/Non-Designers-Design-Book-3rd-Designers/dp/0321534042/&#34;&gt;Non-Designer&amp;rsquo;s Design Book&lt;/a&gt; is a fantastic and readable book on design for engineers.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Always use grids to display&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;I can&amp;rsquo;t say this any better than &lt;a href=&#34;http://markboulton.co.uk/&#34;&gt;Mark Boulton&lt;/a&gt; of &lt;a href=&#34;http://subtraction.com&#34;&gt;subtraction.com&lt;/a&gt;, in his presentation &lt;a href=&#34;http://www.slideshare.net/huer1278ft/grids-are-good-right&#34;&gt;Grids are Good&lt;/a&gt;. Grids are pervasive in &lt;strong&gt;every form of good design&lt;/strong&gt;. It&amp;rsquo;s a fantastic starting point as well. Just read the slideshow and follow it blindly. You can&amp;rsquo;t go wrong.&lt;/p&gt;
&lt;p&gt;This dashboard uses 12-grid. The page is divided into two vertically. The left half has mostly text and the right half has statistics and help. There are 3 blocks within each, &lt;strong&gt;and they&amp;rsquo;re all the same size&lt;/strong&gt; (alignment is critical in good design)&lt;strong&gt;.&lt;/strong&gt; Two of the blocks on the left are subdivided into halves, while the bottom right &amp;ldquo;Links and help&amp;rdquo; section is subdivided into three. Well, it&amp;rsquo;s easier to show it than explain it:&lt;/p&gt;
&lt;p&gt;&lt;img alt=&#34;Picture of grid&#34; loading=&#34;lazy&#34; src=&#34;https://www.s-anand.net/blog/assets/infyblogs-dashboard-grid.webp&#34;&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Copy shamelessly&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;The design for this dashboard was copied in part from &lt;a href=&#34;http://iammattthomas.com/27/1.png&#34;&gt;Wordpress 2.7&amp;rsquo;s new dashboard&lt;/a&gt;, part from the dashboards on Stephen Few&amp;rsquo;s book, and part from the winners of the &lt;a href=&#34;http://www.bonavistasystems.com/NewsMicroChartsCompetition.html&#34;&gt;2008 Excel dashboard competition&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Most of these designs are minimalist. There&amp;rsquo;s no extra graphics, jazzy logos, etc. that detract from the &lt;strong&gt;informational&lt;/strong&gt; content. This is an informational dashboard, not a painting.&lt;/p&gt;
&lt;p&gt;Good design is everywhere. View this presentation on &lt;a href=&#34;http://www.slideshare.net/hicksdesign/how-to-be-a-creative-sponge&#34;&gt;How to be a Creative Sponge&lt;/a&gt; to get a sense of the many sources where you can draw inspiration from. You&amp;rsquo;re much much better of copying good design than inventing bad ones.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;You can hack the dashboard yourself&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;I&amp;rsquo;ve uploaded the source for the dashboard at &lt;a href=&#34;http://infyblog-dashboard.googlecode.com/&#34; title=&#34;http://infyblog-dashboard.googlecode.com/&#34;&gt;http://infyblog-dashboard.googlecode.com/&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Please feel free to browse through it, but &lt;strong&gt;don&amp;rsquo;t stop there!&lt;/strong&gt; Go ahead and tweak it to suit what &lt;strong&gt;you&lt;/strong&gt; think should be on an ideal dashboard. I&amp;rsquo;ll give access to the project to anyone who asks (leave a comment, mail me or call me at +44 7957 440 260).&lt;/p&gt;
&lt;p&gt;Please hack at it. Besides, it&amp;rsquo;s great fun learning jQuery and working on a distributed open source project.&lt;/p&gt;
&lt;p&gt;Now for some notes on how this thing works.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Bookmarklets bring Greasemonkey to any browser&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;This is implemented as a &lt;a href=&#34;http://en.wikipedia.org/wiki/Bookmarklet&#34;&gt;bookmarklet&lt;/a&gt; (a bookmark written in Javascript). It just loads the file &lt;a href=&#34;http://www.s-anand.net/infyblog-dashboard.js&#34;&gt;http://www.s-anand.net/infyblog-dashboard.js&lt;/a&gt; which does all the grunt work. This is the code for the bookmarklet.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-javascript&#34; data-lang=&#34;javascript&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;// Create a new a script element
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;kd&#34;&gt;var&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;s&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;nb&#34;&gt;document&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;createElement&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;&amp;#34;script&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;);&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;// Set the source of the script element to my bookmarklet script
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;nx&#34;&gt;s&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;setAttribute&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;&amp;#34;src&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;s2&#34;&gt;&amp;#34;http://www.s-anand.net/infyblog-dashboard.js&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;);&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;// Add the script element to the head
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;// This does the the equivalent of:
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;// &amp;lt;head&amp;gt;&amp;lt;script src=&amp;#34;...&amp;#34;&amp;gt;&amp;lt;/script&amp;gt;&amp;lt;/head&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;nb&#34;&gt;document&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;getElementsByTagName&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;&amp;#34;head&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;)[&lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;0&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;]&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;appendChild&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;s&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;);&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;// Return void. Not sure why, but this is required
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;k&#34;&gt;void&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;s&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;This form of the bookmarklet is perhaps it&amp;rsquo;s most powerful use. It lets you inject any script into any site. If you want to change it&amp;rsquo;s appearance, content, anything, just write it as a bookmarklet. (Think of it as the IE and Safari equivalent of Firefox&amp;rsquo;s &lt;a href=&#34;https://addons.mozilla.org/en-US/firefox/addon/748&#34;&gt;Greasemonkey&lt;/a&gt;.)&lt;/p&gt;
&lt;p&gt;So if you wanted to load &lt;a href=&#34;http://jquery.com/&#34;&gt;jQuery&lt;/a&gt; into any page:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Change the URL in line 5 above to the &lt;a href=&#34;http://ajax.googleapis.com/ajax/libs/jquery/1.3.1/jquery.min.js&#34;&gt;jQuery URL&lt;/a&gt; and add it as a bookmark. (Or use &lt;a href=&#34;http://www.learningjquery.com/2006/12/jquerify-bookmarklet&#34;&gt;Karl&amp;rsquo;s jQuery bookmarklet&lt;/a&gt;. It&amp;rsquo;s better)&lt;/li&gt;
&lt;li&gt;Go to any page, say the &lt;a href=&#34;http://www.imdb.com/chart/top&#34;&gt;IMDB Top 250&lt;/a&gt; for instance&lt;/li&gt;
&lt;li&gt;Click on the bookmarklet. Now your page is jQueryified. (If you used Karl&amp;rsquo;s bookmarklet, it&amp;rsquo;ll tell you so.)&lt;/li&gt;
&lt;li&gt;On the address bar, type &amp;ldquo;javascript:alert($(&amp;rsquo;table:eq(10) tr&amp;rsquo;).length)&amp;rdquo; and press enter.&lt;/li&gt;
&lt;li&gt;You should see 252, the number of rows on main table of the &lt;a href=&#34;http://www.imdb.com/chart/top&#34;&gt;IMDB Top 250&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Notes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;There are other &lt;a href=&#34;http://www.robertnyman.com/2009/01/19/extending-web-browser-functionality-greasemonkey-for-all-web-browsers/&#34;&gt;ways of adding Greasemonkey functionality to your browser&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;There are &lt;a href=&#34;http://www.bookmarklets.com/&#34;&gt;many&lt;/a&gt; &lt;a href=&#34;https://www.squarefree.com/bookmarklets/&#34;&gt;bookmarklet&lt;/a&gt; &lt;a href=&#34;http://subsimple.com/bookmarklets/default.asp&#34;&gt;directories&lt;/a&gt; &lt;a href=&#34;http://www.yourhtmlsource.com/accessibility/bookmarklets.html&#34;&gt;where&lt;/a&gt; &lt;a href=&#34;http://www.philburns.com/bookmarklets.html&#34;&gt;you&lt;/a&gt; &lt;a href=&#34;http://pimpmysafari.com/bookmarklets/&#34;&gt;can&lt;/a&gt; &lt;a href=&#34;http://www.sitepoint.com/article/bookmarklets/&#34;&gt;find&lt;/a&gt; &lt;a href=&#34;http://www.lifeclever.com/17-powerful-bookmarklets-for-your-iphone/&#34;&gt;bookmarklets&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;The dashboard is better written as a server-side app, but I don&amp;rsquo;t own any servers in our Intranet&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;jQuery is a powerful Javascript library&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Firstly, you don&amp;rsquo;t want to program Javascript without a library. You just don&amp;rsquo;t. The state of browser incompatibilities and DOM usability is just to pathetic to contemplate. Stop learning DOM methods. Pick any library instead.&lt;/p&gt;
&lt;p&gt;Going by popularity, you would do well to pick &lt;a href=&#34;http://jquery.com/&#34;&gt;jQuery&lt;/a&gt;. Here&amp;rsquo;s a graph of searches on Google for the popular Javascript libraries, and jQuery leads the pack.&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;https://trends.google.com/trends/explore?date=all&amp;amp;q=jquery,prototype,dojo,ext,yui&#34;&gt;https://trends.google.com/trends/explore?date=all&amp;amp;q=jquery,prototype,dojo,ext,yui&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;I picked it in early 2007, and my reasons were that it:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Is small&lt;/strong&gt;. At that time, it was 19KB and was the smallest of the libraries. (Today it&amp;rsquo;s 18KB and has more features.)&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Makes your code compact&lt;/strong&gt;. It lets you &lt;a href=&#34;http://www.s-anand.net/Chaining_functions_in_Javascript.html&#34;&gt;chain functions&lt;/a&gt;, and overloads the $() function to work with DOM elements, HTML strings, arrays, objects, anything.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Doesn&amp;rsquo;t pollute the namespace&lt;/strong&gt;. Just 2 global variables: jQuery and $. And you can make it not use $ if you like.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Is very intuitive&lt;/strong&gt;. You can learn it in an hour, and the &lt;a href=&#34;http://docs.jquery.com/&#34;&gt;documention&lt;/a&gt; is extremely helpful.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Is fully functional&lt;/strong&gt;. Apart from DOM manipulation, it covers CSS, animations and AJAX, which is all I want from a library.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;These days, I have some additional reasons:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;It&amp;rsquo;s extensible&lt;/strong&gt;. The &lt;a href=&#34;http://plugins.jquery.com/&#34;&gt;plugin ecosystem&lt;/a&gt; is rich.&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;http://code.google.com/apis/ajax/&#34;&gt;&lt;strong&gt;It&amp;rsquo;s hosted at Google&lt;/strong&gt;&lt;/a&gt;, and is really fast to load. Most often, it&amp;rsquo;s already cached in your users&amp;rsquo; browser.&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;http://ejohn.org/&#34;&gt;&lt;strong&gt;John Resig&lt;/strong&gt;&lt;/a&gt; is a genius. After &lt;a href=&#34;http://ejohn.org/projects/bringing-the-browser-to-the-server/&#34;&gt;env.js&lt;/a&gt; and &lt;a href=&#34;http://ejohn.org/blog/processingjs/&#34;&gt;processing.js&lt;/a&gt;, I trust him to advance jQuery better than other libraries.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;So anyway, the first thing I do in &lt;a href=&#34;http://www.s-anand.net/infyblog-dashboard.js&#34;&gt;the dashboard script&lt;/a&gt; is to load jQuery, using the same code outlined in the bookmarklet section above. The only addition is:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-javascript&#34; data-lang=&#34;javascript&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;nx&#34;&gt;script&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;onload&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;script&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;onreadystatechange&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;kd&#34;&gt;function&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;()&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;k&#34;&gt;if&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;o&#34;&gt;!&lt;/span&gt;&lt;span class=&#34;k&#34;&gt;this&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;readyState&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;||&lt;/span&gt; &lt;span class=&#34;k&#34;&gt;this&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;readyState&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;==&lt;/span&gt; &lt;span class=&#34;s2&#34;&gt;&amp;#34;loaded&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;o&#34;&gt;||&lt;/span&gt; &lt;span class=&#34;k&#34;&gt;this&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;readyState&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;==&lt;/span&gt; &lt;span class=&#34;s2&#34;&gt;&amp;#34;complete&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;p&#34;&gt;)&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;nx&#34;&gt;callback&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;();&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;p&#34;&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;p&#34;&gt;};&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;This tells the browser to run the script &amp;ldquo;callback&amp;rdquo; once the script is loaded. My main dashboard function runs once jQuery is loaded.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;InfyBLOGS has most statistics the dashboard needs&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Thanks to posts from &lt;a href=&#34;http://blogs.ad.infosys.com/users/utkarshraj_atmaram/&#34;&gt;Utkarsh&lt;/a&gt; and &lt;a href=&#34;http://blogs.ad.infosys.com/users/simon_jose/&#34;&gt;Simon&lt;/a&gt;, I knew where to find most of the information for the dashboard:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;http://blogs.ad.infosys.com/tools/recent_comments.bml&#34;&gt;Comments page&lt;/a&gt; for your latest comments&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;http://blogs.ad.infosys.com/userinfo.bml?mode=full&#34;&gt;Profile page&lt;/a&gt; for your statistics: number of entries, interests, friends, etc.&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;http://blogs.ad.infosys.com/directory.bml?ut_days=7&#34;&gt;Directory page&lt;/a&gt; for recently updated blogs&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;http://blogs.ad.infosys.com/directory.bml?com_do=1&#34;&gt;Communities page&lt;/a&gt; for recently updated communities&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;http://blogs.ad.infosys.com/usage/&#34;&gt;Usage page&lt;/a&gt; for Infyblog statistics and popular referrers&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;http://blogs.ad.infosys.com/meme.bml&#34;&gt;Meme page&lt;/a&gt; for recently popular links&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The only things I couldn&amp;rsquo;t find were:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Friends posts&lt;/strong&gt;. I&amp;rsquo;d have liked to show the titles of recent posts by friends. Yeah, I know: blogs/user_name/friends has it, but thanks to user styles, it&amp;rsquo;s nearly impossible to parse in a standard way across users. I&amp;rsquo;d really like an RSS feed for friends.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Interests posts&lt;/strong&gt;. Would be cool to show recent posts by users who shared your your interest.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Communities posts&lt;/strong&gt;. Again, I&amp;rsquo;d have liked to show the recent posts in communities, rather than just the names of communities.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Using IFRAMEs, we can load these statistics onto any page&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s say we want the latest 10 comments. These are available on the &lt;a href=&#34;http://blogs.ad.infosys.com/tools/recent_comments.bml&#34;&gt;comments page&lt;/a&gt;. To load data from another page, we&amp;rsquo;d normally use XMLHTTPRequest, get the data, and parse it — perhaps using &lt;a href=&#34;http://en.wikipedia.org/wiki/Regular_expressions&#34;&gt;regular expressions&lt;/a&gt;.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-javascript&#34; data-lang=&#34;javascript&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;nx&#34;&gt;$&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;get&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;s1&#34;&gt;&amp;#39;/tools/recent_comments.bml&amp;#39;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;).&lt;/span&gt;&lt;span class=&#34;kd&#34;&gt;function&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;data&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;)&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;c1&#34;&gt;// Do some regular expression parsing with data
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;p&#34;&gt;});&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;But from a readability and maintainability perspective, regular expressions suck. A cleaner way is to use jQuery itself to parse the HTML.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-javascript&#34; data-lang=&#34;javascript&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;nx&#34;&gt;$&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;get&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;s1&#34;&gt;&amp;#39;/tools/recent_comments.bml&amp;#39;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;).&lt;/span&gt;&lt;span class=&#34;kd&#34;&gt;function&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;data&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;)&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;kd&#34;&gt;var&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;doc&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;$&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;data&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;);&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;c1&#34;&gt;// Now process the document
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;p&#34;&gt;});&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;This works very well for simple pages, but sadly, for our statistics, this throws a stack overflow error (at least on Firefox; I didn&amp;rsquo;t have the guts to try it on IE.)&lt;/p&gt;
&lt;p&gt;So on to a third approach. Why bother using Javascript to parse HTML, when we&amp;rsquo;re running the whole application in a browser, the most perfect HTML parser? Using IFRAMEs, we can load the whole page within the same page, let the browser do the HTML parsing.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-javascript&#34; data-lang=&#34;javascript&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;nx&#34;&gt;$&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;&amp;#34;&amp;lt;iframe src=\&amp;#34;/tools/recent_comments.bml\&amp;#34;&amp;gt;&amp;lt;/iframe&amp;gt;&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;appendTo&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;&amp;#34;body&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;load&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;kd&#34;&gt;function&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;()&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;kd&#34;&gt;var&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;doc&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;$&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;k&#34;&gt;this&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;).&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;contents&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;();&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;c1&#34;&gt;// Now process the document
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;p&#34;&gt;});&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;This way, you can read any page from Javascript &lt;strong&gt;within&lt;/strong&gt; the same domain. Since both the bookmarklet and statistics are on the &lt;a href=&#34;http://blogs.ad.infosys.com/&#34;&gt;InfyBLOGS&lt;/a&gt; domain, we&amp;rsquo;re fine.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;jQuery parses these statistics rather well&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Now the &lt;code&gt;doc&lt;/code&gt; variable contains the entire comments page, and we can start process it. For example, the comments are on the rows of the &lt;strong&gt;second&lt;/strong&gt; table in the page. (The first table is the navigation on the left.). So&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-javascript&#34; data-lang=&#34;javascript&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;nx&#34;&gt;doc&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;find&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;&amp;#34;table:eq(1) tr&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;);&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;gets the rows in the second table (&lt;code&gt;table:eq(0)&lt;/code&gt; is the first table). Now, we can go through each row, extract the user, when the comment was made, links to the entry and to the comment.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-javascript&#34; data-lang=&#34;javascript&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;nx&#34;&gt;doc&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;find&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;s1&#34;&gt;&amp;#39;table:eq(1) tr&amp;#39;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;).&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;slice&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;0&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;8&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;).&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;map&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;kd&#34;&gt;function&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;()&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;kd&#34;&gt;var&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;e&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;$&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;k&#34;&gt;this&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;),&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;        &lt;span class=&#34;nx&#34;&gt;user&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;e&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;find&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;s1&#34;&gt;&amp;#39;td:eq(0) b&amp;#39;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;).&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;text&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(),&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;        &lt;span class=&#34;nx&#34;&gt;when&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;e&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;find&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;s1&#34;&gt;&amp;#39;td:eq(0)&amp;#39;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;).&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;text&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;().&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;replace&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;user&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;s1&#34;&gt;&amp;#39;&amp;#39;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;),&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;        &lt;span class=&#34;nx&#34;&gt;post&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;e&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;find&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;s1&#34;&gt;&amp;#39;td:eq(1) a:contains(Entry Link)&amp;#39;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;).&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;attr&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;s1&#34;&gt;&amp;#39;href&amp;#39;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;),&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;        &lt;span class=&#34;nx&#34;&gt;cmnt&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;e&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;find&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;s1&#34;&gt;&amp;#39;td:eq(1) a:contains(Comment Link)&amp;#39;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;).&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;attr&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;s1&#34;&gt;&amp;#39;href&amp;#39;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;),&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;        &lt;span class=&#34;c1&#34;&gt;// return HTML constructed using the above information
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;p&#34;&gt;});&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;strong&gt;Google Charts API displays dynamic charts&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Another cool thing is that we can use &lt;a href=&#34;http://code.google.com/apis/chart/&#34;&gt;Google Charts&lt;/a&gt; to display charts without having to create an image beforehand. For instance, the URL:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;http://quickchart.io/chart?cht=lc&amp;amp;chs=300x200&amp;amp;chd=t:5,10,20,40,80&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;shows an image with a line chart through the values (5,10,20,40,80).&lt;/p&gt;
&lt;p&gt;&lt;img alt=&#34;Google chart example&#34; loading=&#34;lazy&#34; src=&#34;http://quickchart.io/chart?cht=lc&amp;chs=300x200&amp;chd=t:5,10,20,40,80&#34;&gt;&lt;/p&gt;
&lt;p&gt;The dashboard uses &lt;a href=&#34;http://en.wikipedia.org/wiki/Sparklines&#34;&gt;sparklines&lt;/a&gt; to plot the trends in InfyBLOG statistics. These are supported by Google Charts. We can extract the data form the &lt;a href=&#34;http://blogs.ad.infosys.com/usage/&#34;&gt;usage page&lt;/a&gt; and create a new image using Google Charts that contains the sparkline.&lt;/p&gt;
&lt;p&gt;If you want to play around with Google Charts without mucking around with the URL structure, I have a relatively easy to use &lt;a href=&#34;http://www.s-anand.net/chart&#34;&gt;chart constructor&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Always use CSS frameworks&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Libraries aren&amp;rsquo;t restricted to Javascript. &lt;a href=&#34;http://en.wikipedia.org/wiki/CSS_framework&#34;&gt;CSS frameworks&lt;/a&gt; exist, and as with Javascript libraries, these are a no-brainer. It&amp;rsquo;s not worth hand-coding CSS from scratch. Just build on top of one of these.&lt;/p&gt;
&lt;p&gt;The state of CSS frameworks isn&amp;rsquo;t as advanced as in Javascript. Yahoo has it&amp;rsquo;s &lt;a href=&#34;http://developer.yahoo.com/yui/grids/&#34;&gt;UI grids&lt;/a&gt;, &lt;a href=&#34;http://www.blueprintcss.org/&#34;&gt;Blueprint&lt;/a&gt;&amp;rsquo;s pretty popular and I found &lt;a href=&#34;http://monc.se/tripoli/&#34;&gt;Tripoli&lt;/a&gt; to be nice, but the one I&amp;rsquo;m using here is &lt;a href=&#34;http://960.gs/&#34;&gt;960.gs&lt;/a&gt;. It lets you create a 12-grid and 16-grid on a 960-pixel wide frame, which is good enough for my purposes.&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;At nearly 2,500 words, this is the longest post I&amp;rsquo;ve ever written. It took a day to design and code the dashboard, but longer to write this post. Like Paul Buchheit says, it&amp;rsquo;s easier to &lt;a href=&#34;http://paulbuchheit.blogspot.com/2009/01/communicating-with-code.html&#34;&gt;communicate with code&lt;/a&gt;. I&amp;rsquo;ve also violated my principle of &lt;a href=&#34;http://www.s-anand.net/Less_is_more.html&#34;&gt;Less is More&lt;/a&gt;. My apologies. But to re-iterate:&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Please hack it&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;https://files.s-anand.net/blog/a/reco.tar.gz&#34;&gt;Download the code and data&lt;/a&gt;.&lt;/p&gt;
&lt;hr&gt;
&lt;h2 id=&#34;comments&#34;&gt;Comments&lt;/h2&gt;
&lt;!-- wp-comments-start --&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;sujays&lt;/strong&gt; &lt;em&gt;26 Jan 2009 7:14 am&lt;/em&gt;:
am an x-infy guy and my id(sujaychandiran_s) still works in ur &amp;ldquo;suggest friends&amp;rdquo; feature.. does this connect 2 infy DB?.. if yes, doesnt this pose a security threat ? am jus curious !&lt;br&gt;
&lt;br&gt;
me cant hack, so cant confirm :)&lt;br&gt;
&lt;br&gt;
Sujay&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;S Anand&lt;/strong&gt; &lt;em&gt;26 Jan 2009 9:23 am&lt;/em&gt;:
@Sujay: nah, it&amp;rsquo;s not a security risk. It&amp;rsquo;s just a static dump of data, and&lt;br&gt;
is a bit out-dated in any case. If anything, it may be a privacy risk:&lt;br&gt;
recruiters might try to mine for interests and pick people that way. But in&lt;br&gt;
this economy, I guess no one&amp;rsquo;s worried about that.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;gwatts&lt;/strong&gt; &lt;em&gt;26 Jan 2009 6:52 pm&lt;/em&gt;:
If you like jQuery, and you like sparklines then you can combine the two and avoid the browser roundtrips to fetch externally rendered images:&lt;br&gt;
&lt;a href=&#34;http://omnipotent.net/jquery.sparkline/&#34;&gt;http://omnipotent.net/jquery.sparkline/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Thejesh GN&lt;/strong&gt; &lt;em&gt;26 Jan 2009 10:33 pm&lt;/em&gt;:
Very cool.&lt;br&gt;
I guess we can add buttons for add/edit posts.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;S Anand&lt;/strong&gt; &lt;em&gt;31 Jan 2009 5:59 am&lt;/em&gt;:
That&amp;rsquo;s a great plugin, Gareth! Look forward to using it. Thanks.&lt;/li&gt;
&lt;/ul&gt;
&lt;!-- wp-comments-end --&gt;
</description>
    </item>
    <item>
      <title>Automating Internet Explorer with jQuery</title>
      <link>https://www.s-anand.net/blog/automating-internet-explorer-with-jquery/</link>
      <pubDate>Sun, 18 May 2008 12:00:00 +0000</pubDate>
      <guid>https://www.s-anand.net/blog/automating-internet-explorer-with-jquery/</guid>
      <description>&lt;p&gt;Most of my &lt;a href=&#34;http://en.wikipedia.org/wiki/Screen_scraping&#34;&gt;screen-scraping&lt;/a&gt; so far has been through Perl (typically &lt;a href=&#34;http://search.cpan.org/dist/WWW-Mechanize/lib/WWW/Mechanize.pm&#34;&gt;WWW::Mechanize&lt;/a&gt;). The big problem is that it doesn&#39;t support Javascript, which can often be an issue:&lt;/p&gt;
&lt;ul&gt;
    &lt;li&gt;&lt;b&gt;The content may be Javascript-based&lt;/b&gt;. For example, &lt;a href=&#34;http://www.amazon.com/&#34;&gt;Amazon.com&lt;/a&gt; shows the bestseller book list only if you have Javascript enabled. So if you&#39;re scraping the Amazon main page for the books bestseller list, you won&#39;t get it from the static HTML.&lt;/li&gt;
    &lt;li&gt;&lt;b&gt;The navigation may require Javascript&lt;/b&gt;. Instead of links or buttons in forms, you might have Javascript functions. Many pages use these, and not all of them degrade gracefully into HTML. (Try using &lt;a href=&#34;http://video.google.com/&#34;&gt;Google Video&lt;/a&gt; without Javascript.)&lt;/li&gt;
    &lt;li&gt;&lt;b&gt;The login page uses Javascript&lt;/b&gt;. It creates some crazy session ID, and you need Javascript to reproduce what it does.&lt;/li&gt;
    &lt;li&gt;&lt;b&gt;You might be testing a Javascript-based web-page&lt;/b&gt;. This was my main problem: how do I automate testing my pages, given that I &lt;a href=&#34;http://localhost/Javascript_error_logging.html&#34;&gt;make a lot of mistakes&lt;/a&gt;?&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;There are many approaches to overcoming this. The easiest is to use &lt;a href=&#34;http://search.cpan.org/~abeltje/Win32-IE-Mechanize-0.009/lib/Win32/IE/Mechanize.pm&#34;&gt;Win32::IE::Mechanize&lt;/a&gt;, which uses Internet Explorer in the background to actually load the page and do the scraping. It&#39;s a bit slower than scraping just the HTML, but it&#39;ll get the job done.&lt;/p&gt;
&lt;p&gt;Another is to use &lt;a href=&#34;http://www.mozilla.org/rhino/&#34;&gt;Rhino&lt;/a&gt;. &lt;a href=&#34;http://ejohn.org/&#34;&gt;John Resig&lt;/a&gt; has written &lt;a href=&#34;http://ejohn.org/blog/bringing-the-browser-to-the-server/&#34;&gt;env.js&lt;/a&gt; that mimics the browser environment, and on most simple pages, it handles the Javascript quite well.&lt;/p&gt;
&lt;p&gt;I would rather have a hybrid of both approaches. I don&#39;t like the WWW::Mechanize interface. I&#39;ve gotten used to &lt;a href=&#34;http://jquery.com&#34;&gt;jQuery&lt;/a&gt;&#39;s rather powerful &lt;a href=&#34;http://docs.jquery.com/Selectors&#34;&gt;selectors&lt;/a&gt; and &lt;a href=&#34;https://www.s-anand.net/blog/chaining-functions-in-javascript/&#34;&gt;chainability&lt;/a&gt;. So I&#39;ll tell you a way of using jQuery to screen-scrape offline using &lt;a href=&#34;http://www.activestate.com/Products/activepython/&#34;&gt;Python&lt;/a&gt;. (It doesn&#39;t have to be Python. &lt;a href=&#34;http://www.activestate.com/Products/activeperl/&#34;&gt;Perl&lt;/a&gt;, &lt;a href=&#34;http://www.ruby-lang.org/&#34;&gt;Ruby&lt;/a&gt;, &lt;a href=&#34;http://msdn.microsoft.com/en-us/library/ey73d9d3(VS.85).aspx&#34;&gt;Javascript&lt;/a&gt;... any scripting language that can use COM on Windows will work.)&lt;/p&gt;
&lt;p&gt;Let&#39;s take &lt;a href=&#34;http://video.google.com/&#34;&gt;Google Video&lt;/a&gt;. Currently, it relies almost entirely on Javascript. The video marked in red below appears only if you have Javascript.&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;https://www.s-anand.net/blog/assets/flickr-google-video_2508656885_o-png.webp&#34; title=&#34;Google Video screenshot&#34;&gt;&lt;img src=&#34;https://www.s-anand.net/blog/assets/flickr-google-video_2508656885_o-png.webp&#34; width=&#34;500&#34; height=&#34;280&#34; alt=&#34;The left box showing the top video uses Javascript&#34;&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;I&#39;d like an automated way of checking what video is on top on Google Video every hour, and save the details. Clearly a task for automation, and clearly not one for pure HTML-scraping.&lt;/p&gt;
&lt;p&gt;I know the video&#39;s details are stored in elements with the following IDs (thanks to &lt;a href=&#34;https://addons.mozilla.org/en-US/firefox/addon/1095&#34;&gt;XPath checker&lt;/a&gt;):&lt;/p&gt;
&lt;table&gt;
&lt;tr&gt;&lt;th&gt;ID&lt;/th&gt;&lt;th&gt;What&#39;s there&lt;/th&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;hs_title_link&lt;/td&gt;&lt;td&gt;Link to the video&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;hs_duration_date&lt;/td&gt;&lt;td&gt;Duration and date&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;hs_ratings&lt;/td&gt;&lt;td&gt;Ratings. The stars indicate the rating and the span.Votes element inside it has the number of people who rated it.&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;hs_site&lt;/td&gt;&lt;td&gt;The site that hosts the video&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;hs_description&lt;/td&gt;&lt;td&gt;Short description&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;
&lt;p&gt;So I could do the following on Win32::IE::Mechanize.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-perl&#34; data-lang=&#34;perl&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;k&#34;&gt;use&lt;/span&gt; &lt;span class=&#34;nn&#34;&gt;Win32::IE::Mechanize&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;k&#34;&gt;my&lt;/span&gt; &lt;span class=&#34;nv&#34;&gt;$ie&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;nn&#34;&gt;Win32::IE::Mechanize&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&#34;k&#34;&gt;new&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;visible&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&#34;mi&#34;&gt;1&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;);&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;nv&#34;&gt;$ie&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;get&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;s&#34;&gt;&amp;#34;http://video.google.com/&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;);&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;k&#34;&gt;my&lt;/span&gt; &lt;span class=&#34;nv&#34;&gt;@links&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;nv&#34;&gt;$ie&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;links&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;# ... then what?&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;I &lt;i&gt;could&lt;/i&gt; go through each link to extract the &lt;code&gt;hs_title_link&lt;/code&gt;, but there&#39;s no way to get the other stuff.&lt;/p&gt;
&lt;p&gt;Instead, we could take advantage of a couple of facts:&lt;/p&gt;
&lt;ul&gt;
    &lt;li&gt;&lt;b&gt;Internet Explorer exposes a COM interface&lt;/b&gt;. That&#39;s what Win32::IE::Mechanize uses. You can use it in any scripting language (&lt;a href=&#34;http://www.activestate.com/Products/activeperl/&#34;&gt;Perl&lt;/a&gt;, &lt;a href=&#34;http://www.ruby-lang.org/&#34;&gt;Ruby&lt;/a&gt;, &lt;a href=&#34;http://msdn.microsoft.com/en-us/library/ey73d9d3(VS.85).aspx&#34;&gt;Javascript&lt;/a&gt;, ...) on Windows to control IE.&lt;/li&gt;
    &lt;li&gt;&lt;b&gt;You can load jQuery on to any page&lt;/b&gt;. Just add a &lt;code&gt;&amp;lt;script&amp;gt;&lt;/code&gt; tag pointing to jQuery. Then, &lt;b&gt;you can call jQuery from the scripting language!&lt;/b&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Let&#39;s take this step by step. This Python program opens IE, loads &lt;a href=&#34;http://video.google.com/&#34;&gt;Google Video&lt;/a&gt; and prints the text.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-python&#34; data-lang=&#34;python&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;# Start Internet Explorer&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;kn&#34;&gt;import&lt;/span&gt; &lt;span class=&#34;nn&#34;&gt;win32com.client&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;n&#34;&gt;ie&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;win32com&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;client&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;Dispatch&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;&amp;#34;InternetExplorer.Application&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;# Display IE, so you&amp;#39;ll know what&amp;#39;s happening&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;n&#34;&gt;ie&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;visible&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;mi&#34;&gt;1&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;# Go to Google Video&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;n&#34;&gt;ie&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;navigate&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;&amp;#34;http://video.google.com/&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;# Wait till the page is loaded&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;kn&#34;&gt;from&lt;/span&gt; &lt;span class=&#34;nn&#34;&gt;time&lt;/span&gt; &lt;span class=&#34;kn&#34;&gt;import&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;sleep&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;k&#34;&gt;while&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;ie&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;Busy&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;sleep&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;mf&#34;&gt;0.2&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;# Print the contents&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;# Watch out for Unicode&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;nb&#34;&gt;print&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;ie&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;document&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;body&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;innertext&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;encode&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;&amp;#34;utf-8&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The next step is to add jQuery to the Google Video page.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-python&#34; data-lang=&#34;python&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;# Add the jQuery script to the browser&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;k&#34;&gt;def&lt;/span&gt; &lt;span class=&#34;nf&#34;&gt;addJQuery&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;browser&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;n&#34;&gt;url&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;&amp;#34;http://jqueryjs.googlecode.com/files/jquery-1.2.4.js&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;n&#34;&gt;document&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;browser&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;document&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;n&#34;&gt;window&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;document&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;parentWindow&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;n&#34;&gt;head&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;document&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;getElementsByTagName&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;&amp;#34;head&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;)[&lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;0&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;]&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;n&#34;&gt;script&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;document&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;createElement&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;&amp;#34;script&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;n&#34;&gt;script&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;type&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;s2&#34;&gt;&amp;#34;text/javascript&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;n&#34;&gt;script&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;src&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;url&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;n&#34;&gt;head&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;appendChild&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;script&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;k&#34;&gt;while&lt;/span&gt; &lt;span class=&#34;ow&#34;&gt;not&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;window&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;jQuery&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;sleep&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;mf&#34;&gt;0.1&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;k&#34;&gt;return&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;window&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;jQuery&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;n&#34;&gt;jQuery&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;addJQuery&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;ie&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Now the variable &lt;code&gt;jQuery&lt;/code&gt; contains the Javascript jQuery object. From here on, you can hardly tell if you&#39;re working in Javascript or Python. Below are the expressions (&lt;i&gt;in Python!&lt;/i&gt;) to get the video&#39;s details.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-python&#34; data-lang=&#34;python&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;# Video title: &amp;#34;McCain&amp;#39;s YouTube Problem ...&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;n&#34;&gt;jQuery&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;&amp;#34;#hs_title_link&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;)&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;text&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;()&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;# Title link: &amp;#39;/videoplay?docid=1750591377151076231&amp;#39;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;n&#34;&gt;jQuery&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;&amp;#34;#hs_title_link&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;)&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;attr&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;&amp;#34;href&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;# Duration and date: &amp;#39;3 min - May 18, 2008 - &amp;#39;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;n&#34;&gt;jQuery&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;&amp;#34;#hs_duration_date&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;)&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;text&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;()&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;# Rating: 5.0&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;n&#34;&gt;jQuery&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;&amp;#34;#hs_ratings img&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;)&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;length&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;# Number of ratings &amp;#39;(8,288 Ratings) &amp;#39;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;n&#34;&gt;jQuery&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;&amp;#34;#hs_ratings span.Votes&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;)&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;text&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;()&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;# Site: &amp;#39;Watch this video on youtube.com&amp;#39;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;n&#34;&gt;jQuery&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;&amp;#34;#hs_site&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;)&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;text&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;()&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;# Video description&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;n&#34;&gt;jQuery&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;&amp;#34;#hs_description&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;)&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;text&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;()&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;This wouldn&#39;t have worked out as neatly in Perl, simply because you&#39;d need to use &lt;code&gt;-&amp;gt;&lt;/code&gt; instead of &lt;code&gt;.&lt;/code&gt; (dot). With Python (and with Ruby and Javascript on cscript), you can almost cut-and-paste jQuery code.&lt;/p&gt;
&lt;p&gt;If you want to click on the top video link, use:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-python&#34; data-lang=&#34;python&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;n&#34;&gt;jQuery&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;&amp;#34;#hs_title_link&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;)&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;get&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;0&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;)&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;click&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;()&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;In addition, you can use the keyboard as well. If you want to type &lt;code&gt;username TAB password&lt;/code&gt;, use this:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-python&#34; data-lang=&#34;python&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;n&#34;&gt;shell&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;win32com&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;client&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;Dispatch&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;&amp;#34;WScript.Shell&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;n&#34;&gt;shell&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;sendkeys&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;&amp;#34;username&lt;/span&gt;&lt;span class=&#34;si&#34;&gt;{TAB}&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;password&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;You can use any of the arrow keys, control keys, etc. Refer to the &lt;a href=&#34;http://msdn.microsoft.com/en-us/library/8c6yea83(VS.85).aspx&#34;&gt;SendKeys Method on MSDN&lt;/a&gt;.&lt;/p&gt;
&lt;hr&gt;
&lt;h2 id=&#34;comments&#34;&gt;Comments&lt;/h2&gt;
&lt;!-- wp-comments-start --&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Franky&lt;/strong&gt; &lt;em&gt;18 May 2008 12:00 pm&lt;/em&gt;:
Holy crap. I am in way over my head here, but this is pretty sweet stuff if I&amp;rsquo;m reading it correctly. Thanks for the info.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;a href=&#34;http://www.mathema.com&#34;&gt;Alessandro&lt;/a&gt;&lt;/strong&gt; &lt;em&gt;5 Jul 2009 11:50 am&lt;/em&gt;:
The idea is really good. Unfortunately it doesn&amp;rsquo;t seem to work under Perl. When a JS function/script is invoked (jQuery is a JS function) IE does not return a COM object and the control from Perl is lost.
There are, of course, methods to overcome the obstacle but not as simple as $window-&amp;gt;jQuery!&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Anonymous&lt;/strong&gt; &lt;em&gt;5 Mar 2010 11:25 pm&lt;/em&gt;:
Wow, kick ass! Exactly what I was looking for. Used AutoIt on a host machine to instantiate the IE object and thanks to you was able to use jQuery to do my scraping. Combined with the IE Developer Toolbar, this has probably saved me weeks of time.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Manikandan&lt;/strong&gt; &lt;em&gt;19 Nov 2009 3:30 pm&lt;/em&gt;:
I am trying to do a screenscrape and the code executes jquery.
Whenever I had to execute javascript i could execute it by
ie.navigate(javascript:&amp;hellip;.)
But when I tried the same thing with jquery it does not execute.
The code behind is something like this
I tried ie.navigate(jQuery1258644477483=&amp;ldquo;2&amp;rdquo;)
It did not thing.
Appreciate your help!!!&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;a href=&#34;http://developerquestion.com/powershell-including-jquery-in-internetexplorer-application/&#34;&gt;Powershell: Including jQuery in InternetExplorer.Application | DeveloperQuestion.com&lt;/a&gt;&lt;/strong&gt; &lt;em&gt;30 Oct 2010 1:32 pm&lt;/em&gt; &lt;em&gt;(pingback)&lt;/em&gt;:
[&amp;hellip;] script document I Followed this article, explaining how to accomplish in Python what I want to do in Powershell. So now I have this [&amp;hellip;]&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Joe&lt;/strong&gt; &lt;em&gt;27 Nov 2010 2:42 pm&lt;/em&gt;:
Hello Mr. Anand,
I am trying to do this in Ruby, but I am not sure how to start. Maybe I am lucky and you have you moved to ruby since May 2008? You start with import win32com.client, and I suppose that is to support an IE browser API. I have Firefox, Chrome, Safari and others available to me.
The basic aim I guess is to inject JQuery into my page object. Mechanize provides me a page. I am that far. How do I it give it JQuery superpowers. Mechanize uses Nokogiri selectors under the hood. But I would love to standardize on JQuery because it&amp;rsquo;s useful in so many other contexts&amp;hellip;in the way that regex is.
Joe&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;a href=&#34;http://fatal-errors.com/powershell-using-jquery-through-internetexplorer-application/86850&#34;&gt;Powershell: Using jQuery through InternetExplorer.Application&lt;/a&gt;&lt;/strong&gt; &lt;em&gt;12 Feb 2012 2:48 am&lt;/em&gt; &lt;em&gt;(pingback)&lt;/em&gt;:
[&amp;hellip;] followed this article, explaining how to spice up an Internet Explorer COM-Object with jQuery. While the author used [&amp;hellip;]&lt;/li&gt;
&lt;/ul&gt;
&lt;!-- wp-comments-end --&gt;
</description>
    </item>
    <item>
      <title>Chaining functions in Javascript</title>
      <link>https://www.s-anand.net/blog/chaining-functions-in-javascript/</link>
      <pubDate>Mon, 18 Feb 2008 12:00:00 +0000</pubDate>
      <guid>https://www.s-anand.net/blog/chaining-functions-in-javascript/</guid>
      <description>&lt;p&gt;One of the coolest features of &lt;a href=&#34;http://jquery.com/&#34;&gt;jQuery&lt;/a&gt; is the ability to chain functions. The output of a function is the calling object. So instead of writing:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-javascript&#34; data-lang=&#34;javascript&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;kd&#34;&gt;var&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;a&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;$&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;&amp;#34;&amp;lt;div&amp;gt;&amp;lt;/div&amp;gt;&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;);&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;nx&#34;&gt;a&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;appendTo&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;$&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;&amp;#34;#id&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;));&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;nx&#34;&gt;a&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;hide&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;();&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&amp;hellip; I can instead write:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;k&#34;&gt;$(&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;&amp;#34;&amp;lt;div&amp;gt;&amp;lt;/div&amp;gt;&amp;#34;&lt;/span&gt;&lt;span class=&#34;k&#34;&gt;)&lt;/span&gt;.appendTo&lt;span class=&#34;o&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;k&#34;&gt;$(&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;&amp;#34;#id&amp;#34;&lt;/span&gt;&lt;span class=&#34;k&#34;&gt;)&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;)&lt;/span&gt;.hide&lt;span class=&#34;o&#34;&gt;()&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;A reasonable number of predefined Javascript functions can be used this way. I make extensive use of it with the &lt;code&gt;String.replace&lt;/code&gt; function.&lt;/p&gt;
&lt;p&gt;But where this feature is not available, you an create it in a fairly unobstrusive way. Just add this code to your script:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-javascript&#34; data-lang=&#34;javascript&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;nb&#34;&gt;Function&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;prototype&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;chain&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;kd&#34;&gt;function&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;()&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;kd&#34;&gt;var&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;that&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;k&#34;&gt;this&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;k&#34;&gt;return&lt;/span&gt; &lt;span class=&#34;kd&#34;&gt;function&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;()&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;c1&#34;&gt;// New function runs the old function
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;kd&#34;&gt;var&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;retVal&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;that&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;apply&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;k&#34;&gt;this&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;arguments&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;);&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;c1&#34;&gt;// Returns &amp;#34;this&amp;#34; if old function returned nothing
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;k&#34;&gt;if&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;k&#34;&gt;typeof&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;retVal&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;==&lt;/span&gt; &lt;span class=&#34;s2&#34;&gt;&amp;#34;undefined&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;)&lt;/span&gt; &lt;span class=&#34;k&#34;&gt;return&lt;/span&gt; &lt;span class=&#34;k&#34;&gt;this&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;c1&#34;&gt;// else returns old value
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;k&#34;&gt;else&lt;/span&gt; &lt;span class=&#34;k&#34;&gt;return&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;retVal&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;p&#34;&gt;};&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;p&#34;&gt;};&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;kd&#34;&gt;var&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;chain&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;kd&#34;&gt;function&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;obj&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;)&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;k&#34;&gt;for&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;kd&#34;&gt;var&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;fn&lt;/span&gt; &lt;span class=&#34;k&#34;&gt;in&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;obj&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;)&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;k&#34;&gt;if&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;k&#34;&gt;typeof&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;obj&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;[&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;fn&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;]&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;==&lt;/span&gt; &lt;span class=&#34;s2&#34;&gt;&amp;#34;function&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;)&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;      &lt;span class=&#34;nx&#34;&gt;obj&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;[&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;fn&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;]&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;obj&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;[&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;fn&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;].&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;chain&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;();&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;p&#34;&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;p&#34;&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;k&#34;&gt;return&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;obj&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;p&#34;&gt;};&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Now, &lt;code&gt;chain(object)&lt;/code&gt; returns the same object, with all its functions replaced with chainable versions.&lt;/p&gt;
&lt;p&gt;What&amp;rsquo;s the use? Well, take the &lt;a href=&#34;http://code.google.com/apis/ajaxsearch/&#34;&gt;Google AJAX search API&lt;/a&gt;. Normally, to search for the top 8 &amp;ldquo;Harry Potter&amp;rdquo; PDFs on esnips.com, I&amp;rsquo;d have to do:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-javascript&#34; data-lang=&#34;javascript&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;kd&#34;&gt;var&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;searcher&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;k&#34;&gt;new&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;google&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;search&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;WebSearch&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;();&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;nx&#34;&gt;searcher&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;setQueryAddition&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;&amp;#34;filetype:PDF&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;);&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;nx&#34;&gt;searcher&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;setResultSetSize&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;google&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;search&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;Search&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;LARGE_RESULTSET&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;);&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;nx&#34;&gt;searcher&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;setSiteRestriction&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;&amp;#34;esnips.com&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;);&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;nx&#34;&gt;searcher&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;setSearchCompleteCallback&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;onSearch&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;);&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;nx&#34;&gt;searcher&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;execute&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;&amp;#34;Harry Potter&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;);&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Instead, I can now do this:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-javascript&#34; data-lang=&#34;javascript&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;nx&#34;&gt;chain&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;k&#34;&gt;new&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;google&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;search&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;WebSearch&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;())&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;setQueryAddition&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;&amp;#34;filetype:PDF&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;setResultSetSize&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;google&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;search&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;Search&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;LARGE_RESULTSET&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;setSiteRestriction&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;&amp;#34;esnips.com&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;setSearchCompleteCallback&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;onSearch&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;execute&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;&amp;#34;Harry Potter&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;);&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;(On the whole, it&amp;rsquo;s probably not worth the effort. Somehow, I just like code that looks like this.)&lt;/p&gt;
&lt;hr&gt;
&lt;h2 id=&#34;comments&#34;&gt;Comments&lt;/h2&gt;
&lt;!-- wp-comments-start --&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;T&lt;/strong&gt; &lt;em&gt;18 Feb 2008 12:00 pm&lt;/em&gt;:
looks sweet!&lt;/li&gt;
&lt;/ul&gt;
&lt;!-- wp-comments-end --&gt;
</description>
    </item>
  </channel>
</rss>
