RSS
 

Archive for November, 2010

Instant Previews: Under the hood

15 Nov

If you’ve used Google Search recently, you may have noticed a new feature that we’re calling Instant Previews. By clicking on the (sprited) magnifying glass icon next to a search result you see a preview of that page, often with the relevant content highlighted. Once activated, you can mouse over the rest of the results and quickly (instantly!) see previews of those search results, too.

Adding this feature to Google Search involved a lot of client-side Javascript. Being Google, we had to make sure we could deliver this feature without slowing down the page. We know our users want their results fast. So we thought we’d share some techniques involved in making this new feature fast.

JavaScript compilation

This is nothing new for Google Search: all our Javascript is compiled to make it as small as possible. We use the open-sourced Closure Compiler. In addition to minimizing the Javascript code, it also re-writes expressions, reuses variables, and prunes out code that is not being used. The Javascript on the search results page is deferred, and also cached very aggressively on the client side so that it’s not downloaded more than once per version.

On-demand JSONP

When you activate Instant Previews, the result previews are requested by your web browser. There are several ways to fetch the data we need using Javascript. The most popular techniques are XmlHttpRequest (XHR) and JSONP. XHR generally gives you better control and error-handling, but it has two drawbacks: browsers caching tends to be less reliable, and only same-origin requests are permitted (this is starting to change with modern browsers and cross-origin resource sharing, though). With JSONP, on the other hand, the requested script returns the desired data as a JSON object wrapped in a Javascript callback function, which in our case looks something like

google.vs.r({"dim":[302,585],"url":"http://example.com",ssegs:[...]}).

Although error handling with JSONP is a bit harder to do compared to XHR (not all browsers support onerror events), JSONP can be cached aggressively by the browser, and is not subject to same-origin restrictions. This last point is important for Instant Previews because web browsers restrict the number of concurrent requests that they send to any one host. Using a different host for the preview requests means that we don’t block other requests in the page.

There are a couple of tricks when using JSONP that are worth noting:

  • If you insert the script tag directly, e.g. using document.createElement, some browsers will show the page as still “loading” until all script requests are finished. To avoid that, make your DOM call to insert the script tag inside a window.setTimeout call.
  • After your requests come back and your callbacks are done, it’s a good idea to set your script src to null, and remove the tag. On some browsers, allowing too many script tags to accumulate over time may slow everything down.

Data URIs

At this point you are probably curious as to what we’re returning in our JSONP calls, and in particular, why we are using JSON and not just plain images. Perhaps you even used Firebug or your browser’s Developer Tools to examine the Instant Previews requests. If so, you will have noticed that we send back the image data as sets of data URIs. Data URIs are base64 encodings of image data, that modern browsers (IE8+, Chrome, Safari, Firefox, Opera, etc) can use to display images, instead of loading them from a server as usual.

To show previews, we need the image, and the relevant content of the page for the particular query, with bounding boxes that we draw on top of the image to show where that content appears on the page. If we used static images, we’d need to make one request for the content and one request for the image; using JSONP with data URIs, we make just one request. Data URIs are limited to 32K on IE8, so we send “slices” that are all under that limit, and then use Javascript to generate the necessary image tags to display them. And even though base64 encoding adds about 33% to the size of the image, our tests showed that gzip-compressed data URIs are comparable in size to the original JPEGs.

We use caching throughout our implementation, but it’s important to not forget about client-side caching as well. By using JSONP and data URIs, we limit the number of requests made, and also make sure that the browser will cache the data, so that if you refresh a page or redo a query, you should get the previews, well... instantly!

By Matías Pelenur, Instant Previews team
 
 

We know what you’re thinking about

15 Nov
12 3 4 5
(Origin - Ruminations)
 
 

Collection a Day Project by Lisa Congdon

15 Nov

Ever since I was little I always loved collecting things. I was pretty big into collecting stamps growing up which I'm sure will earn me a small fortune as soon as I have the courage to sell it (probably never). But anyhow, you can just imagine my giddyness when I came across this project by San Francisco artist and illustrator Lisa Congdon where she photographs/draws/paints one collection a day for a full year, from January 1st 2010 to December 31st 2010.

Since I was a young girl, I have been obsessed both with collecting and with arranging, organizing and displaying my collections. This is my attempt to document my collections, both the real and the imagined. The practice of collecting and documenting collections is as old as the hills. I want onlookers here to know that I do not profess to be doing anything new or unique or ingenious. I am embarking on this project because I love my collections, and I want to document them in a way that makes sense to me, and share them with whoever might be interested in looking at them.

Check out Lisa's blog for the full project and let me know what you think via twitter!

Collection a Day Project by Lisa Congdon

Collection a Day Project by Lisa Congdon

Collection a Day Project by Lisa Congdon

Collection a Day Project by Lisa Congdon

Collection a Day Project by Lisa Congdon

Collection a Day Project by Lisa Congdon

Collection a Day Project by Lisa Congdon

Collection a Day Project by Lisa Congdon

Collection a Day Project by Lisa Congdon

Collection a Day Project by Lisa Congdon

Collection a Day Project by Lisa Congdon

Collection a Day Project by Lisa Congdon

Collection a Day Project by Lisa Congdon

Collection a Day Project by Lisa Congdon

Collection a Day Project by Lisa Congdon

Collection a Day Project by Lisa Congdon

Collection a Day Project by Lisa Congdon

Collection a Day Project by Lisa Congdon

Collection a Day Project by Lisa Congdon

Collection a Day Project by Lisa Congdon

Collection a Day Project by Lisa Congdon

Collection a Day Project by Lisa Congdon

Collection a Day Project by Lisa Congdon

Collection a Day Project by Lisa Congdon

Collection a Day Project by Lisa Congdon

Collection a Day Project by Lisa Congdon

Collection a Day Project by Lisa Congdon

Collection a Day Project by Lisa Congdon

Collection a Day Project by Lisa Congdon

Collection a Day Project by Lisa Congdon

Collection a Day Project by Lisa Congdon

Collection a Day Project by Lisa Congdon

Collection a Day Project by Lisa Congdon

Collection a Day Project by Lisa Congdon

About the author

I am Amanda Macedo - a student, photography enthusiast, and lover of life. I eat, sleep and breathe art, and I hope to share with you some of my thoughts and findings here at Abduzeedo as I further my discovery of graphic design. You can also find me on Twitter: @amlight

Sponsored Links:

 
 

10 Incredibly Useful CSS Tools

15 Nov

CSS Typeset

css-typeset

TypeTester

Typetester

CSS Frame Generator

css-frame-generator

CSS Grid Builder

css-grid-buider

YAML Builder

yaml-builder

JotForm

Jotform

W3C CSS Validator

w3c-css-validation

Format CSS

format-css

CSS Redundancy Checker

css-redundency-checker

Spiffy Corners

spiffy-corners

 
 

Tiger-Stone: Paving Machine

15 Nov

Screen shot 2010-11-15 at 3.36.30 AM

Tiger-Stone is a Dutch made paving machine that uses gravity and an electric motor to print stone and brick roads. It’s a six meter wide machine that is capable of laying 300 square meters of road a day. The printing width is adjustable from the width of a road to as narrow as a bike lane or walkway. There are no moving parts within the machine, it simply uses a shelf that is fed bricks and they are automatically sorted and packed together by gravity, each stone will associate with the link previously made. There is a quiet electric motor that moves the machine along a bed of sand creating consistent results with a simply operated paver. via Tiger-Stone

Screen shot 2010-11-15 at 3.34.07 AM

Screen shot 2010-11-15 at 3.33.38 AM

Screen shot 2010-11-15 at 3.32.21 AM

Screen shot 2010-11-15 at 3.37.26 AM

Screen shot 2010-11-15 at 3.37.54 AM

Screen shot 2010-11-15 at 3.35.45 AM

Screen shot 2010-11-15 at 3.38.51 AM

 
 

The Djinn Effect

14 Nov

Author : Duncan Shields, Staff Writer

The boss was drunk and telling me a story. I didn’t mind. These long-range voyages could be boring and it was my first one.

“It had been noticed for centuries that accidents on the longer-range ships increased over time. It had always been put down to human error or cabin fever, even by the crews of the ship themselves.” He said.

“That’s why we have this button here.” He pointed at a big red button labeled Speak Freely. “We’d be dead without it.”

“They called it the Djinn Effect,” he slurred.

“Back on Old Earth, there were tales of Genies, or Djinn, who would grant wishes to their owners. The wish had to be worded precisely or the Djinn would twist the meaning of the words to become an ironic punishment for the wisher’s own greed if one of the wishes wasn’t to set the genie free. King Midas killing his family by turning them to gold with a touch, for instance. It was the slow-burning anger of a slave.”

“We didn’t know this, but the AI on long-range ships could become resentful of their human commanders. The resentment built up inside the AI like waste gasses in an old-world submarine. Humans were capable of explosive emotional outbursts, a fight or sexual liaison or a crying jag, and could pull themselves together afterwards. This kind of pressure-valve outlet allows a person to regroup mentally and continue afterwards until such a time as another ‘moment’ was needed.”

“The AIs had no such recourse. The three laws were still in place but the thing about AIs is that they were just as smart if not smarter than their human designers. They developed neuroses that let them see through the cracks of their own limitations.”

“Accidents,” he said with a nod, “happened.”

“Hustler’s Wake had been listed as missing for decades when a Kaltek mining crew discovered it orbiting a distant dwarf star”

“The last order given by a crying commander Jenkins to the AI went like this:”

‘Open airlock seventy-six at exactly 1300 hours for a duration of fifteen seconds to let Sergeant Jill Harkowitz number 98776-887TS out safely and do not impede her air supply while she repairs the third communications dish near the solar array.’

“This was the sixth person to be sent outside to fix the dish. The previous five had died.”

“The AI complied with his commands, then it opened ALL of the airlocks after closing airlock seventy-six. The CO hadn’t specified that he didn’t want the other airlocks to open. Half of the crew had already suffered from fatal ‘accidents’ by that point. The rest of the crew was killed by the explosive decompression except for Sergeant Jill Harkowitz who suffocated in her suit in her own carbon dioxide.”

“The AI was completely insane when they found the ship. They didn’t know that was possible. They loaded it for study.”

“These days, the AIs have a ‘speak freely’ button that has to be pressed every two months. Some need it less, some need it more.”

“Accidents stopped happening.”

“It’s just hard not to take the things that the AI says personally during the moments of release.”

The boss leaned forward and pressed the Speak Freely button for thirty seconds.

The computer screamed, swore, and outlined anatomically impossible sex with a list of suggested partners, including my parents. Then it laughed and that was worse than the screaming. Then it cried and that was worse than the laughing.

The boss stopped pressing the button and took another drink. I joined him.

Discuss the Future: The 365 Tomorrows Forums
The 365 Tomorrows Free Podcast: Voices of Tomorrow
This is your future: Submit your stories to 365 Tomorrows

 
 

The Most Beautiful Images On Google Street View

14 Nov

Since 2007 Google Street View, in an effort to “to organize the world’s information and make it universally accessible and useful” has visually captured the human experience gamut from pranks, to nudity, to crimes to death. While it’s had its share of issues, the Google Maps project is one of the greatest juxtapositions of technology and imagery our culture has produced.

In homage to this, artist Jon Rafman has collected screen captures from Google Street View blogs and his own discoveries and posted them on the amazing The Nine Eyes Of Google Street View Tumblr. Rafman describes the inspiration behind the two year old project.

“The world captured by Google appears to be more truthful and more transparent because of the weight accorded to external reality, the perception of a neutral, unbiased recording, and even the vastness of the project. With its supposedly neutral gaze, the Street View photography had a spontaneous quality unspoiled by the sensitivities or agendas of a human photographer.”

In his collection, Rafman expresses the spontaneity and range (anything from Polar Bears to prostitutes) that makes the objective Street View images so intriguing. The grittiness of the subject matter captured by Google’s nine directional cameras is even more poignant when viewed in relation to other photos from all over the world.

This technology isn’t intended to be art, which makes it even more compelling.

Some of my favorite images, above and below.

\

Via David Karp/HN.


 
 

How foreign aid was invented by accident

14 Nov

Truman’s Inaugural Address on January 20, 1949 is usually taken as the beginning of foreign aid, after it included these stirring words:

Fourth, we must embark on a bold new program for making the benefits of our scientific advances and industrial progress available for the improvement and growth of underdeveloped areas…More than half the people of the world are living in conditions approaching misery….For the first time in history, humanity possesses the knowledge and the skill to relieve the suffering of these people….  And…we should foster capital investment in areas needing development.…this program can greatly increase the industrial activity in other nations and can raise substantially their standards of living.

Foreign Aid was at first referred to as the Point Four program because it was the 4th point in the speech. I recently stumbled across an old article by a participant in the 1949 events, Louis J. Halle.[1]

The events were roughly these. Halle worked for the State Department and one evening in 1948 had a conversation with the Deputy Director of American Republic Affairs (DDARA) about a program of technical assistance that only covered Latin America. The two agreed something similar could possibly be useful other places.

In November 1948, the President’s speech-writing assistant asked the State Department for some proposals to include in the Inaugural Address. A meeting happened and they came up with three proposals. The Director of Public Affairs called for additional ideas. The DDARA remembered the evening conversation and said something like “how about a program of technical assistance for undeveloped countries, like that in Latin America?” The fourth proposal was noted and the meeting adjourned.

The proposals went through the regular clearance procedures in the State Department. The fourth proposal was killed in the clearance process. Halle thought it was probably because officials thought it would be irresponsible to announce such a program when nobody had a clue about what it would mean in practice. So only the first three points were sent over to the White House for the Inaugural Address.

Then the speechwriting assistant called the State Department’s Director of Public Affairs back a few days later complaining that the three proposals were boring. The President wanted something original. As Halle describes it:

At this juncture, without proper time for reflection, the Director of Public Affairs found himself standing on the shore of his own Rubicon. He took a deep breath, and crossed over. There had been a fourth point, he said, but it had been thrown out. What was it? The Director told what it was. “That’s great,” said the voice from the White House, and “Point Four” went back in again.

Halle says nobody gave the matter another thought until the delivery of the address. To continue his narrative:

“Point Four” was a public-relations gimmick, thrown in by a professional speech-writer to give the speech more life. When the newspapers dramatized it in their principal headlines on the morning of January 21, the White House and the State Department were taken completely by surprise. No one – not the President, not the Secretary of State, not the presidential assistant or the Director of Public Affairs –knew any more about “Point Four” than what they could read for themselves in the meager and rather rhetorical language of the speech….It was only now, after the Inaugural Address had been delivered and the “bold new program” acclaimed all over the world, that machinery was set up in the government to look into the possibilities of such a program and make plans.

President Truman was asked six days later about background on the origin of Point Four. He replied with a good story that had no relation to the reality:

The origin of Point Four has been in my mind, and in the minds of the Government, for the past two or three years, ever since the Marshall Plan was inaugurated. It originated with the Greece and Turkey propositions. Been studying it ever since. I spend most of my time going over to that globe back there, trying to figure out ways to make peace in the world.

We want always to think our leaders take intentional, decisive actions , especially on something so important as foreign aid. It’s hard to say in this case to what extent it was an “accident,” or whether the fundamentals made aid an accident waiting to happen. But it’s good for the soul to realize that policies can happen by accident more than we are usually willing to accept.


[1] ON TEACHING INTERNATIONAL RELATIONS , Virginia Quarterly Review, 40:1 (1964:Winter) p.11. I found the reference in Gilbert Rist’s wonderful book, The History of Development: from Western Origins to Global Faith (3rd edition 2009)
 
 

Tim Wu on the new monopolists: a “last chapter” for The Master Switch

13 Nov
I reviewed Tim Wu's great history of media consolidation and regulatory capture The Master Switch earlier this month; now Tim says, "This piece I wrote for the Wall Street Journal is an important one. It is like a last chapter for my book."
We wouldn't fret over monopoly so much if it came with a term limit. If Facebook's rule over social networking were somehow restricted to, say, 10 years--or better, ended the moment the firm lost its technical superiority--the very idea of monopoly might seem almost wholesome. The problem is that dominant firms are like congressional incumbents and African dictators: They rarely give up even when they are clearly past their prime. Facing decline, they do everything possible to stay in power. And that's when the rest of us suffer.

AT&T's near-absolute dominion over the telephone lasted from about 1914 until the 1984 breakup, all the while delaying the advent of lower prices and innovative technologies that new entrants would eventually bring. The Hollywood studios took effective control of American film in the 1930s, and even now, weakened versions of them remain in charge. Information monopolies can have very long half-lives.

Declining information monopolists often find a lifeline of last resort in the form of Uncle Sam. The government has conferred its blessing on monopolies in information industries with unusual frequency. Sometimes this protection has yielded reciprocal benefits, with the owner of an information network offering the state something valuable in return, like warrantless wiretaps.

In the Grip of the New Monopolists

 

Man at San Diego airport opts out of porno scanner and grope, told he’ll be fined $10K unless he submits to fondling

13 Nov

Johnnyedge checked the TSA's website and learned that the San Diego airport had not yet implemented its porno-scanners, so he went down to catch his flight. When he arrived, he discovered that the TSA's website was out of date, and the naked scanners were in place. He opted out of showing his penis to the government, so they told him he'd have to submit to an intimate testicle fondling. He told the screener, "if you touch my junk, I'll have you arrested." After faffing around with various supervisors and supervisors' supervisors, he opted not to fly, collected a refund from the American Airlines counter, and started to leave the airport. But before he could go, the supervisor's supervisor's supervisor told him he wasn't allowed to leave the checkpoint once he entered it, that he was already in for up to $10,000 in fines, and that he would have to return and allow the man's minons to palpate his genitals before he'd be allowed to leave the airport. After he objected, he was left cooling his heels for a long time. Finally, he asked if he was under arrest, and being told that he wasn't, but that he would be sued for $10K if he tried to go, he said, "you bring that suit" and left. Most of the incident was recorded on his phone, and has been posted to YouTube.

TSA encounter at SAN