Friday, March 7, 2008

Adding Page Numbers to Google Documents

Google finally realized that the headers and footers from Google Docs have almost no real use, as you can't add dynamic information like page numbers or the current date. Until Google adds these options in the interface, you can edit the document's HTML code to use them. To add a header that displays "Page (current page number) of (total number of pages)" , click on "Edit HTML" and add this code at the beginning of the document:

<div style="text-align: right;" class="google_header">Page <span class="google_pagenumber">1</span> of <span class="google_pagecount">1</span></div>

When you save the document as a PDF, the header will look like this:


For footers, you should add this at the bottom of the document, in HTML view:

<div style="text-align: right;" class="google_footer" id="google_footer">Page <span class="google_pagenumber">1</span> of <span class="google_pagecount">1</span></div>

It's a good idea to go back to the rich text editor quickly if you don't want to see the horrible code generated by Google Docs. The "dynamic" headers and footers are visible only if you export the document to PDF, for example to print it.

Simpler Gmail Queries


There's an easy way to use logical disjunction in a Gmail query. Instead of typing OR after each term, you can just use curly brackets and separate the terms with spaces. Here's the official way:

dan OR "brian clouse" OR teja

and here's a simpler way to write the same query:

{dan "brian clouse" teja}

Note that you need to use quotes for multiple words and you can combine the expression with other Gmail operators. To find all the messages sent by Dan, Brian Clouse or Teja, search for:

from:{dan "brian clouse" teja}

To find the messages that have one of the following labels: unread, starred and work (the first two labels are built in), use:

label:{unread starred work} (or: l:{unread starred work})

By default, Gmail uses the logical conjunction between your terms, so if you search for:

dan "brian clouse" teja

Gmail will display all the messages that contain Dan, "Brian Clouse" and Teja. To group these terms, use parenthesis:

from:(dan "brian clouse" teja)

Some useful queries:
label:(unread inbox) - the unread messages from your inbox
label:(starred chats) - your favorite Google Talk conversations
label:(unread muted) - the conversations you've muted that have unread messages
filename:{pdf doc xls ppt} - messages that have attached a PDF file or a Microsoft Office document
label:unread subject:{important urgent} - unread messages that include "important" or "urgent" in the subject.

{ credit for the magical-curly-brackets tip: Paul Buchheit }

Thursday, March 6, 2008

Google Redesigns the Advanced Search Page

Google's advanced search page contrasts with the simplicity of the homepage and the search results pages. Most people don't even notice the small link placed next to the search box and those who click on it find the page too confusing. Google's Daniel Russell said that 50% of the people who open the advanced search page leave it without completing the search. This is not surprising if you look at the page: you can choose the language of the search results, the formats, the usage rights, but also add numeric ranges and negative keywords to a query. The most useful features can also be accessed using operators, while the others aren't grouped intuitively. Other issues with Google's advanced search page: the search button is not placed at the bottom and the generated URL is unnecessarily long as it contains all the parameters.


According to some reports, the page has been redesigned and it now hides some of the obscure features inside a plusbox, while offering tips and a preview of the query:


The update is still being tested and it's likely you don't see it yet at: google.com/advanced_search.

For the time being, I suggest to use the advanced search for the option hidden in the expandable box (date, keyword location), while using the search operators for the other options. Some example of queries that use operators:

* paris -hilton site:edu (all the pages that contain Paris, but not Hilton and are from .edu sites)
* "women's rights" site:en.wikipedia.org (all the pages from Wikipedia that contain the exact text "women's rights")
* shakespeare inurl:hamlet filetype:pdf (all PDF results that contain Shakespeare and have Hamlet in the URL)

For the average user, the new page is more approachable, but Google's challenge is to provide good results even if you don't refine the query using operators and advanced operators.

{ The second screenshot has been licensed as Creative Commons by Barry Schwartz. }

Wednesday, March 5, 2008

Google Releases an API for Contacts

Google wants to make everyone happy today. After releasing a calendar sync tool, Google makes it possible to sync other valuable data: your contacts. The new Contacts Data API "allows client applications to view and update Contacts content in the form of Google Data API feeds. Your client application can request a list of a user's contacts, edit or delete content in an existing contact, and query the content in an existing contact."

What's interesting is that the contacts are tied to a Google Account, not necessarily to a Gmail account, so Google could release a separate address book for those who don't use Gmail.

Hopefully, social applications will use this API instead of asking for your Gmail credentials and we'll see synchronization utilities for mobile devices, Outlook etc. "The Google Contacts Data API allows you to own your own contact data. We expect the API to be useful for a big range of applications," notes Google's Sebastian Kanthak.


The problem is that your Google contacts aren't always your contacts: they're mostly a bunch of people automatically added by Gmail because you replied to their messages. And this is going to be a problem difficult to solve unless Gmail changes the way contacts are created.

Google Calendar Sync for Microsoft Outlook

One of the most popular requests for Google Calendar was synchronization with mobile devices and Outlook. After launching a sync tool for Blackberries, Google Calendar now offers a small utility for synchronizing events with Outlook.

By default the synchronization is bi-directional, but you can change this when you install the utility or from the options dialog. The only significant drawback is that you can only synchronize your main Google Calendar, but a future update should remove this limitation.


Google installs a small program that loads at start-up and sits on your system tray, while waiting for the next synchronization (the default sync interval is 2 hours). After synchronizing your calendar with Outlook, you can access it offline and synchronize it with your mobile phone.


It's worth noting that Google's new tool works with Google Apps accounts and it's another step towards making Google Apps more business-friendly.

{ spotted by Google Blogoscoped }

Tuesday, March 4, 2008

Navigational Site Search Boxes

For navigational searches, the top result is the only result that matters. If you search for [NASA], it's clear that you want to go to NASA's website. Google realized that people sometimes want to go to a specific section of a site, so it started to include sitelinks, an automatically-generated list of popular places from a site. The links are not always the best, but they might save you a click and some time spent on sites that are difficult to navigate.

Some sites include a lot of content and their search box is more important than a navigational menu. For these sites, Google has just added a site search box below the sitelinks that allows you to restrict your query to the first search result. The search box shows up for a small number of sites like: Flickr, YouTube, Metacafe, Amazon, Craigslist, SourceForge, Microsoft.com, which have been automatically selected.


In the last two years, Google experimented with a lot of ways to enhance the information about search results and it will be interesting to see what features proved to be useful.

{ via Search Engine Land }

Update: It's worth mentioning that Yahoo also shows a site search box, but only if you search for [YouTube]. If you dare to search for [Google], Yahoo is there to mislead you.


Update 2. Google explains: "Through experimentation, we found that presenting users with a search box as part of the result increases their likelihood of finding the exact page they are looking for. So over the past few days we have been testing, and today we have fully rolled out, a search box that appears within some of the search results themselves. This feature will now occur when we detect a high probability that a user wants more refined search results within a specific site. Like the rest of our snippets, the sites that display the site search box are chosen algorithmically based on metrics that measure how useful the search box is to users."

Top Commentators for a Blogger Blog

While Blogger doesn't encourage comments and communities, it's still interesting to see who comments on your blog more frequently. This information can be obtained from Blogger's comment feeds, but you need a tool for processing feeds.

Yahoo Pipes is probably the best way to combine, sort, filter and modify feeds. Inspired by this Yahoo Pipe, I created a pipe that shows the top 50 commentators from a Blogger blog, based on the most recent 5,000 comments. You can enter the URL of your blog and the number of top commentators, but the list is not generated instantaneously since Yahoo Pipe must fetch and process at most 10 GData feeds (Blogger's API doesn't include more than 500 comments in a single feed). The pipe could also be used to add the list of top commentators to the blog, using the JSON code generated by Yahoo.

Depending on the number of comments from your blog, the list may not be very meaningful. For example, if your posts get an average of 500 comments, this list will only reflect the hierarchy for the last 10 posts. To see the total number of comments from your blog, open this feed: http://BLOGNAME.blogspot.com/feeds/comments/default (replace BLOGNAME with the proper subdomain), view the page's source and search for "openSearch:totalResults". Google Operating System has 15,217 comments and the most recent 5,000 comments corresponding to the last 5 months.

Update. Here's some JavaScript code that uses Yahoo's JSON output. This could be easily added in a HTML/JavaScript page element from Blogger.

<script type="text/javascript">
function pipeCallback(obj) {
document.write("<ol>");
var i;
for (i = 0; i < obj.count ; i++)
{
var href = "'" + obj.value.items[i].link + "'";
var item = "<li>" + "<a href=" + href + ">" + obj.value.items[i].title + "</a> </li>";
document.write(item);
}
document.write("</ol>");
}
</script>
<script src= "http://pipes.yahoo.com/pipes/pipe.run?_render=json&_callback=pipeCallback&
_id=c92ac21897d8b56e61cfa85930dd89a1&url=http%3A%2F%2FBLOGNAME.blogspot.com&num=10" type="text/javascript"></script>

(merge the last two lines and replace BLOGNAME with your blog's subdomain name).