vendredi 29 juillet 2011

[Official Gmail Blog] Gmail Snooze with Apps Script

Editor’s Note: For a more technical description, see the Google Apps Developer Blog

At Google, we all use email very heavily -- for communicating with other Googlers, for task management, and to mail around funny pictures of kittens. Because of the volume of email we all deal with, a lot of Googlers subscribe to the “
inbox zero” philosophy where we try to keep our inboxes empty except for the messages we currently need to deal with.

What is Gmail Snooze?
One feature that some of us really wanted was for Gmail to let you “snooze” an email. Snoozing means archiving an email for now, but having it automatically reappear in the inbox at some specified time in the future. With
Apps Script you can extend Gmail to add this functionality and a lot more yourself.



How to set it up
Even if you don't know how to write a script, it's pretty simple. Go to Google Docs and create a new spreadsheet, then choose "Script Editor" from the "Tools" menu. Paste in the following code:

 
var MARK_UNREAD = false;
var ADD_UNSNOOZED_LABEL = false;
 
function getLabelName(i) {
  return "Snooze/Snooze " + i + " days";
}
 
function setup() {
  // Create the labels we’ll need for snoozing
  GmailApp.createLabel("Snooze");
  for (var i = 1; i <= 7; ++i) {
    GmailApp.createLabel(getLabelName(i));
  }
  if (ADD_UNSNOOZED_LABEL) {
    GmailApp.createLabel("Unsnoozed");
  }
}
 
function moveSnoozes() {
  var oldLabel, newLabel, page;
  for (var i = 1; i <= 7; ++i) {
    newLabel = oldLabel;
    oldLabel = GmailApp.getUserLabelByName(getLabelName(i));
    page = null;
    // Get threads in "pages" of 100 at a time
    while(!page || page.length == 100) {
      page = oldLabel.getThreads(0, 100);
      if (page.length > 0) {
        if (newLabel) {
          // Move the threads into "today’s" label
          newLabel.addToThreads(page);
        } else {
          // Unless it’s time to unsnooze it
          GmailApp.moveThreadsToInbox(page);
          if (MARK_UNREAD) {
            GmailApp.markThreadsUnread(page);
          }
          if (ADD_UNSNOOZED_LABEL) {
            GmailApp.getUserLabelByName("Unsnoozed")
              .addToThreads(page);
          }          
        }     
        // Move the threads out of "yesterday’s" label
        oldLabel.removeFromThreads(page);
      }  
    }
  }
}

Then click the “Save” button and give it a name. In the dropdown labeled "Select a function to run," choose "setup" and click the blue run arrow to the left of it. This will ask you to authorize the script, and will create the necessary labels in your Gmail. Then go to the "Triggers" menu and choose "current script's triggers." Click the link to set up a new trigger, choosing the "moveSnoozes" function, a "time-driven" event, "day timer," and then "midnight to 1am." Click save and you’re done.

Using the Snooze Label in Gmail
To "snooze" a thread, use Gmail’s “Move To” button to move the thread into the "Snooze for X days" label and archive it. Every night, threads will move up through one day of the queue, and at the appointed number of days they will reappear in your inbox, unarchived.

Because this is an Apps Script, you can edit the code any way you like. If you’d like different snooze times or for unsnoozed messages to get starred, you can easily change the code. And if you have an even better idea for how to use Apps Script to improve Gmail, you can post it to our Gallery (Script Editor > Share > Publish Project) to share with the world.

vendredi 22 juillet 2011

MVC and the HTML5 Application Cache

“HTML5 has loads of awesome features and recently I have been playing around with a feature called the Application Cache. The Application Cache is designed to allow you to run your web application offline - that is, without a network connection.”

“So...what if we could use the benefits of the Application Cache with an online application? The user could access all the resources that they need from the Application Cache instead of the server, and in turn the page would load a lot faster.”

 

LINK : http://deanhume.com/Home/BlogPost/mvc-and-the-html5-application-cache/59

 

mercredi 20 juillet 2011

ASP MVC 4 RoadMap

ASP MVC 4 RoadMap

http://aspnet.codeplex.com/wikipage?title=ASP.NET%20MVC%204%20RoadMap

mardi 12 juillet 2011

WebGrid in ASP.NET MVC

“… release included a number of productivity helpers to simplify tasks such as rendering charts and tabular data. One of these helpers, WebGrid, lets you render tabular data in a very simple manner with support for custom formatting of columns, paging, sorting and asynchronous updates via AJAX.”

 

http://msdn.microsoft.com/en-gb/magazine/hh288075.aspx

 

vendredi 8 juillet 2011

ASP.NET MVC 3: Layouts and Sections with Razor

“In today’s post I’m going to go into more details about how Layout pages work with Razor.  In particular, I’m going to cover how you can have multiple, non-contiguous, replaceable “sections” within a layout file – and enable views based on layouts to optionally “fill in” these different sections at runtime.  The Razor syntax for doing this is clean and concise.

I’ll also show how you can dynamically check at runtime whether a particular layout section has been defined, and how you can provide alternate content (or even an alternate layout) in the event that a section isn’t specified within a view template.  This provides a powerful and easy way to customize the UI of your site and make it clean and DRY from an implementation perspective”

http://weblogs.asp.net/scottgu/archive/2010/12/30/asp-net-mvc-3-layouts-and-sections-with-razor.aspx

 

jeudi 7 juillet 2011

Managing data in web applications with HTML5 Web Storage

“Before the advent of Web Storage, developers have had to juggle between cookies, session, query strings, and HTML forms to manage data across stateless HTTP requests - with cookies being the only client-side, data storage mechanism. Working with all these different ways to get data from here to there is often tedious at best, but unavoidable, as most web applications do need to preserve state somewhere. At the same time, you also need to consider users who have turned off features like cookies, either knocking both cookies and session objects out of the question or making them harder to work with than they should be.”

 

http://www.rachelappel.com/managing-data-in-web-applications-with-html5-web-storage

 

Understanding ASP.NET MVC Model Binding

"ASP.NET MVC model binding allows you to map HTTP request data with a model. This article discusses how model binding works for various types of models (simple types, complex types, collections etc.). It also shows how to create a custom model binder if situation calls for it"


What’s the Difference Between a Value Provider and Model Binder?

"ASP.NET MVC 3 introduced the ability to bind an incoming JSON request to an action method parameter, which is something I wrote about before."