Topic: google

Lion Mail Deletes IMAP Emails without Notice (Gmail Important Label)

Today I ran across this issue. You open Mail on your Mac running Lion with any IMAP email accounts (Gmail, Yahoo, Thirdparty server) and Mac Mail randomly deletes the email messages after it fetches new mail. You can verify this issue by shutting down your Mail app and viewing that messages in fact exist on the IMAP server. Then you open Mail and the emails are deleted as soon as the check activity is complete. There are no filters or rules running behind the scenes.

A ton of people on this thread on the Apple website are discussing and running into the same issue.

There are apparently 2 ways to fix this issue:

The first one is to simply disable “Use IDLE command if the server supports it” from the Advanced settings for your Account, as shown above.

The second fix is to wipe out all your emails and accounts and start all over. This method is pretty risky and I don’t think you should try it unless you really know what you’re doing. To do this, quit Mail, then using Terminal, move all the files in ~/Library/Mail/V2/ out into another location. Then Open Mail and recreate all your accounts.

Side note regarding Gmail and Priority Inbox
Personally I ran into this disappearing mail issue with Lion when I realized that Gmail was assigning some emails the Important Label without me knowing it. These emails were also skipping the Inbox. So basically, anything the Google deemed “Important” was never being show to me in Mail. How ironic right? The fix was to go into the Inbox settings in Gmail and Set these options:

Inbox Type: Classic (The Priority Inbox drives me insane personally)
Importance Markers: Show Markers (I tried using the No Markers option but it was causing the emails not to appear in my Mac Mail Inbox)
Filtered Mail: Override Filters (Again this option is here to leave messages in your inbox)
And finally in Lion Mail make sure to disable the IDLE option for the account.

Having done all this, I still don’t fully trust that Gmail is not putting things in the Important folder, so I have turned on the Show in IMAP feature for that label in Gmail Settings and check that folder once in a while in Mail.

I am using Mail Version 5.1 (1251/1251.1) for your reference.

Let me know if you are having similar issues with either Gmail Importance mail disappearing or Lion Mail deleting emails automatically.

Optimizing the Google +1 button for speed

If you’re like most bloggers and site owners, you’ve probably already added or are planning to add the new Google +1 button to your website, to go along with the Twitter and Facebook buttons. Having implemented the +1 button I’ve found that the script takes a long time to load, and does not even load if you’re on an iPhone or iPad. This actually comes as a shock to me considering Google itself is a huge advocate of page speed improvements. The file (plusone.js) is 4 KB (before gzipping) and gets assigned a short expiration time of only 60 minutes by Google. Thankfully the script is gzipped and is only semi-minified, but it still takes a new uncached hit about 1.26 seconds to complete. Most of this time is spent in either the Blocking or Waiting stages, which might have something to do with it being served from a secure server. The decision to load the file over HTTPS by default is a bit baffling to me, especially since the handshake is historically slower. Unless sensitive information exists in the JS code which could be another interesting topic. Google has been doing some work on SSL FalseStart in Chrome to alleviate SSL latency and it seems their goal is to eventually serve all their services securely. Plusone.js then loads a second much larger js file from plusone.google.com also over SSL which comes in at about 57 KB (before gzipping). This file tacks on another 1.17 seconds to the completion time for the +1 button.

After seeing how slow the Google +1 button loads and how it can actually degrade your website’s overall pageload time, I started looking around for answers. First of all, I found that I’m not the only one complaining about the issue. Numerous others have started to point out the speed issues with the +1 button. My second thought was to perhaps remove the button from the site, although considering the effect the +1 button has on your website’s ranking that would mean less love from Google.

So what’s a developer to do? If we keep the button on our site, overall pageload times spike. But if we remove the button, or not add it, we might lose out on a potential piece of the social voting pie which most believe affects your search performance.

So here are my techniques for making Google +1 button load faster, or at least not slow down your site. Interestingly enough these techniques are the same set of tips and tricks that Google’s own Page Speed recommends for webmasters.

1) Save a step, Use Https

Make sure you use the HTTPS protocol in the URL for the JavaScript source, as the original version of the button snippets given out by Google included the HTTP version http://apis.google.com/js/plusone.js which just does a redirect to https://apis.google.com/js/plusone.js This issue has since been corrected by Google when you use Google’s +1 button generator site.

2) Don’t load the script on Mobile devices

As stated by Google, currently the Google +1 button does not support mobile devices like the iPhone, iPod touch, iPad, or Android. This means if you have the button code on a mobile site you’re basically wasting HTTP connections and adding extra weight to your site’s throughput. To get around this fact you need to write a little utility function in JavaScript that sniffs the userAgent for unsupported devices, and only makes a call to the script if your client is not one of those devices.
For example in the case of an iPhone and iPad website, you would do something like this:

function isMobileUser(){
  return (/iphone|ipod|ipad|android|blackberry|mini|windows\sce|palm/i.test(navigator.userAgent.toLowerCase()));  
}
if(!isMobileUser()){
	//include the plusone.js code here
}

3) Load the plusone.js script asynchronously

HTML 5 has introduced the ability to load scripts asynchronously allowing the rest of the page to load independently of potential bottlenecks. This feature is actually already in use for the Google Analytics code. Keep in mind that only Chrome and Firefox 3.6 and above support the async feature at this time. But it does not hurt your non-supporting browsers in any way so it’s safe to use. Here’s the code that combines the check for unsupported mobile browsers from before to load the +1 button script asynchronously. Note that since this code is loaded asynchronously it doesn’t matter if you put the call in the footer or header.

function isMobileUser(){
  return (/iphone|ipod|ipad|android|blackberry|mini|windows\sce|palm/i.test(navigator.userAgent.toLowerCase()));  
}
if(!isMobileUser()){
// create a new script element in the DOM
var gp1script = document.createElement('script');
// set it's type attribute, not really needed in HTML 5 but just to be safe
gp1script.type = 'text/javascript';
// set the HTML 5 attribute of async to true for the script tag
gp1script.async = true;
// set the source attribute to the https version of the google pluseone code
// change this to your own server path if you are cosidering using option 4 below
gp1script.src = 'https://apis.google.com/js/plusone.js';
// add the new script tag to the head or body of the page
(document.getElementsByTagName('head')[0]||document.getElementsByTagName('body')[0]).appendChild(gp1script);
}

You would then place the tag where you want the +1 button to render, which since it is a proprietry tag will just be ignored if the script is not present on your page.

<g:plusone></g:plusone>

If you’re not comfortable with the tag, you can also use an HTML 5 version to render the +1 button on your site, which uses a css class of g-plusone and sets attributes as needed. For example you can display a standard +1 button with counts using this HTML 5 tag.

<div class="g-plusone" data-size="standard" data-count="true"></div>

Note that you can also place multiple +1 buttons on a single page. For example you might have a +1 button that directs its vote to your main parent homepage like so:

<g:plusone href="http://www.your_tld.com/></g:plusone>

4) Host the plusone.js file yourself

This option has been suggested by some users, although I personally argue against it just because you’ll be responsible for continuously monitoring changes and updating your version. The big benefit here is avoiding that dreaded HTTPS server, but keep in mind the script still will make that second call to load the plusone library so you’re still not home free. Only go this route if you’re seriously considering a site improvement and are willing and capable of pushing out updates to your version of the script. I’m sure the Google +1 team is making lots of changes and adding bug fixes which you will miss out on if you forget to update the script on a daily basis. In the extreme case you could perhaps write a program that downloads the latest version of the script from Google’s servers and updates your version on a daily basis, but then again this becomes a new task to keep an eye on.

Hope this helps and let me know if you have other tips and or feedback regarding these ideas. For more details be sure to read the +1 button API page.

Google Chrome First Impressions

Yet another browser? Well here we go again. Let’s take a look at Chrome and see what it has to offer. The download page is located here. The installer for Windows XP is only 474KB! You can watch the press conference video about Google Chrome or read the Google Chrome Book in the meantime.

What we knew so far about Chrome

  • Uses V8 JavaScript engine which supports Classes and compilation. There is a V8 JavaScript benchmark suite that gives FireFox 3 a score of 83, while giving Chrome a score of 1213! Safari 3 gets a score of 128. Judging by this alone, V8 blows away the competition.
  • Uses Webkit rendering engine.
  • Tabs run as independent processes which can be managed.
  • Lots of other features.

First Impressions

  • Installation was a breeze and imported FireFox settings.
  • No status bar, You only see the status bar when you hover over a hyperlink.
  • The Task Manager (Shift + Escape) updates in real time and shows memory, CPU and network usage for each tab, each plugin, and the main Chrome process separately. There is also a link to Stats for Nerds with lots more gritty info.
  • The Flash plugin is extremely CPU usage intensive and causes sluggishness when scrolling. I just loaded a popular flash website and noticed my machine came down to a near halt. It seems to happen more with Flash files that contain infinite loops, using as much as 70% of the CPU.
  • The built in JavaScript console looks like a combination of FireBug and Web Inspector.
  • There is a built in JavaScript Debugger (Alt + `)
  • Passes the Acid 2 test.
  • Chrome gets a score of 78 on the Acid 3 test, which is higher than FireFox 3 at 57, Safari at 72, and Opera at 45.
  • Omnibar – this is the URL/location bar in Chrome that has some fuzzy logic built in to suggest “smart” autocompletes. This is the current order of the drop down in the auto complete list. There seems to be no way of changing this ordering as of now. Would be nice to be able to customize them.
     

     

    1. Search Google for FOOBAR
    2. FOOBAR/ (I’m not sure how useful this one is really)
    3. Link to the FOOBAR Wikipedia page
    4. Link to I’m Feeling Lucky URL for term FOOBAR. This item gives you the ability to search within the URL. For example if you type in Amazon in the Omnibar and select the amazon.com option using the down arrows, you will see “Press Tab to Search Amazon”. See below instruction on implementing this search functionality for your website.
    5. Search Google for FOOBAR ANOTHER TERM
    6. Search Google for FOOBAR ANOTHER TERM
    7. A page in your history pertaining to FOOBAR
    8. Link to history search for pages about FOOBAR

Cool Developer related stuff in Chrome

Google Chrome User Agent String:

Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/525.13 (KHTML, like Gecko) Chrome/0.X.Y.Z Safari/525.13.

Chrome has a menu option called “Create application shortcuts…” that uses Google Gears to create a shortcut to your webapp. Users can choose to place the shortcut to your webapp on their Desktop, on the Start menu and even the Quick launch bar in Windows. This is a pretty powerful feature. When a user clicks this icon, Chrome opens up without the Omnibar, and your website will appear in an “Application” format. You can customize how Chrome creates these shortcuts using meta tags. These tags are named: application-name, description, application-url, and shortcut icons in both 32×32 or 48×48 formats. The favicon is used if not specified. For example you can use the following HTML code in the head of your document. Note that with the Mozilla added support which is used in Chrome, you can use any supported graphic format as your favicon, and not just the old school favicon.ico file.

<head>
  <meta name="application-name" content="Gmail"/>
  <meta name="description" content="Google's approach to email"/>
  <meta name="application-url" content="http://www.gmail.com"/>
  <link rel="icon" href=gmail_32x32.png sizes="32x32"/>
  <link rel="icon" href=gmail_48x48.png sizes="48x48"/>
</head>

To open a new tab from your webapp in a separate process using JavaScript you can do this in Chrome.

var w = window.open();
w.opener = null;
w.document.location = "http://differentsite.com/index.html";

Chrome lets users search your website from its ominbar. To enable and include your website’s search in Chrome you have to create an OpenSearch description document (OSDD).
For example you can create something like this:

<?xml version="1.0" encoding="UTF-8"?>
 <OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/">
   <ShortName>Web Search</ShortName>
   <Description>Use Example.com to search the Web.</Description>
   <Tags>example web</Tags>
   <Contact>admin@example.com</Contact>
   <Url type="application/atom+xml"
        template="http://example.com/?q={searchTerms}&amp;pw={startPage?}&amp;format=atom"/>
   <Url type="application/rss+xml"
        template="http://example.com/?q={searchTerms}&amp;pw={startPage?}&amp;format=rss"/>
   <Url type="text/html" 
        template="http://example.com/?q={searchTerms}&amp;pw={startPage?}"/>
   <LongName>Example.com Web Search</LongName>
   <Image height="64" width="64" type="image/png">http://example.com/websearch.png</Image>
   <Image height="16" width="16" type="image/vnd.microsoft.icon">http://example.com/websearch.ico</Image>
   <Query role="example" searchTerms="cat" />
   <Developer>Example.com Development Team</Developer>
   <Attribution>
     Search data Copyright 2005, Example.com, Inc., All Rights Reserved
   </Attribution>
   <SyndicationRight>open</SyndicationRight>
   <AdultContent>false</AdultContent>
   <Language>en-us</Language>
   <OutputEncoding>UTF-8</OutputEncoding>
   <InputEncoding>UTF-8</InputEncoding>
 </OpenSearchDescription>

Fore more tips read the Google Chrome FAQ for web developers page.

ps. Don’t use the Google gears Chrome download page which gives a JavaScript error!

_GU_SetupOneClick is not defined
onload(load )

Microsoft Buys Google for $200 Billion

Microsoft Buys Google for $200 Billion
The number one search engine on the planet has just announced the biggest deal to hit the internet since its YouTube buy. Microsoft has just made an offer for Google for the amount of $200,000,000,000 which is about $638 per share of the 137 million outstanding shares.

Google shares have plummeted to all time low of $41 per share on the news of the buyout, while Microsoft shares opened trading at an all time high of $121 this morning. Google is shipping its PageRank and search index which contains 1.34 Petabytes of data stored in over 550,000 tape drives over to Microsoft using 3,000 Armored Trucks, driving up north from Mountain View to Redmond. The 848 mile road trip will be overseen by law enforcement agencies both on the ground and in the air.

There is yet no official announcement as to what Microsoft plans to do with the new Google acquisition, but rumors are flying around that Microsoft plans to start selling a new search based operating system with a new built in software called Windows Internet Search that will perform web searches at an alarming fast rate using Google search. The new upgrade will cost around $149 for existing Windows Vista users. Microsoft has no plans of providing search functionality to Apple users.

Microsoft will also be offering a subscription based search to its customers starting next year that is said to incorporate the new Google logic. The search feature will provide subscribers with 10 Google searches per day starting at 0.99c.

In related news, Google announced that it is experiencing unusually high traffic today, as users of the search engine giant around the world are are frantically trying to back up the entire search engine’s database before Microsoft officially shuts it down in the coming weeks.

Google employees have made a pact to never give up and are voicing their disapproval of the announcement by forming their own Open Source startup search engine company called AprilFools that is expected to be a noteworthy replacement for the many fooled Google users worldwide.

How Google Analytics determines Connection Speeds

Today I was looking for an unobtrusive method of determining a user’s connection speed using JavaScript. A quick search on Google returned an array of tricks mostly having to do with using Ajax to make a call behind the scenes, and track the payload time for the small file. In most cases people use an image with a random variable at the end to avoid caching, like image.jpg?foo=1Rt2X21. This is all good but adds an HTTP connection which could potentially interfere with the user’s experience, especially if they are already on a slow connection to begin with. Continue »