My studying notebook

Showing posts with label Google. Show all posts
Showing posts with label Google. Show all posts

2015/02/26

[notebook] Google Push Notification API

2/26/2015 10:06:00 AM Posted by Unknown , , , , 86 comments

Google Push Notification

The Google APIs provides push notification that let you watch for changes to resources

Google Drive Push Notification

Google APIs provides Push Notification

You can visit Google APIs Explorer - search watch. There are few APIs support push notification now. Not all of them.
calendar.settings.watchCalendar API v3Watch for changes to Settings resources.
calendar.acl.watchCalendar API v3Watch for changes to ACL resources.
calendar.calendarList.watchCalendar API v3Watch for changes to CalendarList resources.
calendar.events.watchCalendar API v3Watch for changes to Events resources.
storage.objects.watchAllCloud Storage API v1beta2Watch for changes on all objects in a bucket.
reports.activities.watchAdmin Reports API reports_v1Push changes to activities
directory.users.watchAdmin Directory API directory_v1Watch for changes in users list
directory.users.aliases.watchAdmin Directory API directory_v1Watch for changes in user aliases list
storage.objects.watchAllCloud Storage API v1Watch for changes on all objects in a bucket.
youtube.playlistItems.updateYouTube Data API v3Modifies a playlist item. For example, you could update the item’s position in the playlist.
drive.files.watchDrive API v2Subscribe to changes on a file
drive.changes.watchDrive API v2Subscribe to changes for a user.

2011/09/04

[Notebook] Using jQuery templates in Google AppEngine

9/04/2011 10:52:00 PM Posted by Unknown , , , , , , 344 comments
jQuery is a powerful javascript library that you can improve web browser experience just add some js codes. jQuery also has a lot of useful plugin you can add. lightbox, autocomplete etc.

jQuery supports Templates plugin now that you can render HTML code very simply. Here has very detail document and tutorial. Today, i will talk about how to use jQuery templates in Google AppEngine. What is the problem using jQuery templates in Google AppEngine web application.? Braces {}.

Templates syntax.
Google AppEngine Django template.
{% for item in objs %}
 {{item}},
{% endfor %}

jQuery Templates
<script id="doclistTmp" type="text/x-jquery-tmpl">
        {{each(i, o) obj}}
        <tr class="{{if i%2== 0}}odd{{else}}even{{/if}}">
            <td> ${title}</td>
            <td>${type}</td>
            <td>${folders}</td>
        </tr>
        {{/each}}
</script>

They both use brases is problem that you will meet it if you want to use jQuery templates via ajax in Google AppEngine. Then, how to setup jQuery templates in Google AppEngine.

Step1.
Register a tag in a py file called "verbatim_templatetag.py" {{if condition}} print something{{/if}}. Tell Django don't change anything within this tag.
"""
jQuery templates use constructs like:

    {{if condition}} print something{{/if}}

This, of course, completely screws up Django templates,
because Django thinks {{ and }} mean something.

Wrap {% verbatim %} and {% endverbatim %} around those
blocks of jQuery templates and this will try its best
to output the contents with no changes.
"""

from django import template

register = template.Library()

class VerbatimNode(template.Node):

    def __init__(self, text):
        self.text = text

    def render(self, context):
        return self.text

@register.tag
def verbatim(parser, token):
    text = []
    while 1:
        token = parser.tokens.pop(0)
        if token.contents == 'endverbatim':
            break
        if token.token_type == template.TOKEN_VAR:
            text.append('{{')
        elif token.token_type == template.TOKEN_BLOCK:
            text.append('{%')
        text.append(token.contents)
        if token.token_type == template.TOKEN_VAR:
            text.append('}}')
        elif token.token_type == template.TOKEN_BLOCK:
            text.append('%}')
    return VerbatimNode(''.join(text))

Step2.
Include custom tag in your py file that you use web template
 template.register_template_library('verbatim_templatetag') 

Step3.
Add you jQuery template to html page.
 {% verbatim %}
        <script id="movieTemplate" type="text/x-jquery-tmpl">
            <tr>
                <td>${posted}</td>
                <td><a href="${link}">${response_count}</a></td>
                <td>{{html content}}</td>
            </tr>
        </script>
 {% endverbatim %} 

Step.4
call jQuery templates.
  $("#movieList").html($("#movieTemplate").tmpl( plurks )); 


Reference

2010/05/01

[Chrome Extensions] QuietRead V2.1.0 Released

5/01/2010 04:49:00 PM Posted by Unknown , , , 2 comments


Chrome Extension - Quietread V2.1.0 Released

My last updated (v2.0.1) was one month ago. The biggest changed on Chrome extension Quietread V2.x was using Google OAuth for authorization. The Users don't type their Google Account and Password. It's more convenient and safe to access user's data on Google Spreadsheet.

Then, what's updated at version V2.1.0. The following list is simple summary.

  • Add Tags and Notes feature for each Item. Now, you could add tags or notes to help you find out specific item you haven't finished.
  • Search and tags support auto complete. You could use multiple keywords (ex: tags:jquery 2010). The results will highlight also.
  • Quietread supports auto fetch your data from Google Docs spreadsheet in background in specific period. Default setting is 300 secs. You also could update immediately by clicking refresh button.
  • You could share link what you read to your friend by email button.
  • Add page and remove page by keyboard short keys.
The summary above are new features. Then, what features are pull off at this version.
  • Sorting. I take searching instead of sorting.
  • Show list by keyboard short keys. This feature does not work very well because of some specific pages like Chrome Home page.
  • Automatic add page by clicking Quietread icon. It seems a little bit annoy.


Layout
Edit Notes
Edit Tags

Search box

Search for specific tag

Search for specific tag and keyword

Options


Notices

There may have problem when you update Quietread to version 2.1.0. You have to make sure "QuietreadQueue" that on your Google Docs has 7 columns at least.

Download Quietread V2.1.0

2009/12/24

[Chrome Extensions] QuietRead

12/24/2009 07:55:00 PM Posted by Unknown , , , No comments
Two weeks ago. I went to join Taipei GTUG (Google Technology User Group) Google Chrome Hackathon. At the Chrome Hackathon, the people who attended want to developed few useful, interesting, funny Google Chrome extensions.


In my team (although 2 members) want to develop a useful chrome extensions. Nowadays, it's very convenient to search anything on the internet. Shopping, documents, and news for instance.

You might browse a lot links in one day. How come you could remember all of that links. You might say that you can use bookmark to keep the URL you haven't read it but you interested in it. It's a good method. I use the bookmarks in different browsers too. But, i will keep the link to my bookmarks i thought it's helpful to me. So, i need to any way to keep the URL for a while. That's why QuieRead from.

What's QuietRread?

QuietRead is very simple concept. You might have used the similar service on the internet. What's different between they and QuietRead. I assume you already have a Google Account (If you haven't. Have one). Because QuietRead use Google Documnet List Data API & Google SpreadSheet Data API to save the URL in your Google Docs SpreadSheet.

What does QuietRead do?

Quick answer: Add and remove URL on Google Docs specific SpreadSheet.

How does QuietRead work?

Because QuietRead use Google Documnet List Data API & Google SpreadSheet Data API, you have to login your Google account first in QuietRead extensions Option page. Following are simple step.
  1. Login in your Google Account.
  2. If login is succeed. Then, QuietRead will try to get Google Document List Data API & Google SpreadSheet Data API authorization.
  3. Check "QuietreadQueue" spreadsheet file on your Google Docs.
  4. If "QuietreadQueue" is exist, loading data. If "QuietreadQueue" isn't exist. create new one.
  5. now, you can add and remove URL in Chrome QuietRead Extensions.





Google Chrome QuietRead Extensions

2009/11/04

Inner Google Docs Quickly View Alternate URL by Chrome Extensions

11/04/2009 11:43:00 PM Posted by Unknown , , 2 comments

If you paid your attention at Google Docs service, you will found Google Docs team announce few new feature like View online files using Google Doc Viewer, Shared folders and more in Google Docs, Taking charge of your document sharing etc. One of my favorite new feature is Google Docs Viewer. Google Docs Viewer let you quickly view documents online without leaving your browser. You don't need to download it if you just want quick it.

Google Docs Viewer is a very convenience tool let you increase browser experience. But, it's still have few restrained. It's just support three file format: PDF documents, PowerPoint presentations, and TIFF files now. Beside file type part, you need put documents on the internet.

I like search documents on the internet when i don't know somethings. I type keyword in search engine and combine search file type. Google search engine started support QuickView new feature few weeks ago. It does work very well. But, there isn't every pdf or ppt item has QuickView button on the list. It's a easy way to solve this problem. Copy target doucment URL and paste it in Google Docs Quickly View. Then, Done!! It sounds great, right? Not at all, how could we do this job more convenience. I choose Chorme Extensions.

What's Chrome Extensions?

Extensions are small software programs that can modify and enhance the functionality of Google Chrome.

You write them using web technologies like HTML, JavaScript, and CSS. So if you know how to write web pages, you already know most of what you need to know to write extensions." - Defintion in Google Chrome Extension: Development Documentation

The Basic of Chrome Extentsion

"An extension is a zipped bundle of files — HTML, CSS, JavaScript, images, and anything else you need — that adds functionality to the Google Chrome browser. Extensions are essentially web pages, and they can use all the APIs that the browser provides to web pages, from XMLHttpRequest to JSON to HTML5 local storage.

Many extensions add UI to Google Chrome, in the form of toolstrips (toolbar additions) or page actions (clickable badges in the address bar). Extensions can also interact programmatically with browser features such as bookmarks and tabs. To interact with web pages or servers, extensions can use content scripts or cross-origin XMLHttpRequests." - OverView

As you can see above paragraph. We can almost do anythng you want from add Google Chrome UI to use content script to manipulate DOM tree. How do we slove problem we told in Chrome extension? The scenario is very simple. Using content script manipulate DOM tree and innert Google Docs Quick View URL in each target document.

Content Script

Content scripts are JavaScript files that run in the context of web pages. By using the standard Document Object Model (DOM)," - Content Script

At my last post. There has a new search engine let you can search PDF file type ebooks. So, i holp content script can execute in two part. "Google Search Engine" and "PDFBooks search engine". First, we need to get target documnet url in DOM tree. There are few tools can help me to inspect current location in DOM Tree. I chose Google Chrome Developr tools (Ctrl+Shift+J).

PDFBooks


Google Search Engine
if (doc.URL.toString().match(/^http:\/\/www.google.com/)) {
links = doc.querySelectorAll('h3 > a.l');
}
if (doc.URL.toString().match(/^http://pdfbook-s.com/)) {
links = doc.querySelectorAll('div#menu + a');
}

We inspect target documents url by querySelectorAll.

for (var i = 0, len = links.length; i < len; i++) {
var link = links[i];
if (link.toString().match(/pdf$/) || link.toString().match(/ppt$/)) {
var docViewer = document.createElement('a');
docViewer.setAttribute('href', 'http://docs.google.com/viewer?url=' + link);
docViewer.setAttribute('target', 'blank');

var favicon = document.createElement('img');
favicon.src = 'http://docs.google.com/favicon.ico';

docViewer.appendChild(favicon);
link.parentNode.insertBefore(docViewer, link);
}
}
Then, we can parse each hyperlink to insert alternate Google Docs Quick View URL if hyperlink has "PDF" or "PPT" keyword in a simple loop.

Registered your content script

Content script needs to register in a extension's manifest.json file. like so:

{
"name": "Insert Google Doc Quickly View URL",
"version": "0.1",
"description": "Insert Google Docs Quickly View for PDF & PPT file format link",
"content_scripts": [
{
"matches": [
"http://www.google.com/search*",
"http://www.google.com.tw/search*",
"http://pdfbook-s.com/*"
],
"js": ["insert_docs_quickly_view_url.js"]
}
]
}

Everything you done. What's different after using this extension.



Reference
  1. Google Chrome Extensions: Developer Documentation
  2. pdfBooks - Pdf Books search engine

Download: insert_docs_quickly_view_url.js

Download: insert_docs_quickly_view_url.crx

2009/11/02

JSONC Of Picasa Web Ablum

11/02/2009 11:14:00 PM Posted by Unknown , , , 2 comments
What is JSON and JSONC?

JSON, short for JavaScript Object Notation, is a lightweight computer data interchange format. It is a text-based, human-readable format for representing simple data structures and associative arrays (called objects). - wiki

JSONC: Clean, Compact, and Customizable. Minimize the number of JavaScript objects

You guys might have used a lot of JSON data in your web page, web application etc. If you are familiar with Blogger template, you might ever received your Picasa web album JSON format data by calling Javascript function in your blogger by using this URL
http://picasaweb.google.com/data/feed/api/user/userID?alt=json&callback=?

Whatever you receive JSON data by Javascript callback function or jQuery Ajax callback funtion. You need to parse callback json data and get the data what you need. There are too many objects in that data. It's a little complicate to get current fields you need.

Google Data Protocol support JSONC data format return in Google Web Album. That let you guys can receive data from Google Web Album more easy than before. What do we receive the JSONC format data. Changing feed URL to
http://picasaweb.google.com/data/feed/api/user/userID?v=2&alt=jsonc&callback=?

Conclusion

It's a easy way to receive your Google Web Album data by modify feed URL arguments. The simple object data means you can decrease callback response time and increase the web page performance. If you are interested in performance articles, you should read following link

Reference

2009/10/12

Few New Google Chrome Video From GoogleJapan

10/12/2009 07:22:00 PM Posted by Unknown , 2 comments
Have you seen the so~~~~~o cute Google Street View Video by Google Japan. If you haven't seen that video. Click here to see that. I very recommend you guys to have a look even you just a end user. The video can give you a skeleton concept of Google Street View.


As you can see. It's a good introduction video from Google Japan. It's show time again but the main character change to new super star "Chrome". I think that "Speed" will be one of the good browser experience of Chrome for you guys. You guys may have few browsers in the computers like me. That mean you are pay attention in browser developing. If you should be. Following has few new Chrome video by Google Japan. Have a look!!!



速い + SUPER MONKEY BALL: Google Chrome アーティストテーマ




Google Chrome アーティスト テーマ スライドショー




速い + NINTEA: Google Chrome アーティストテーマ




速い + ART: Google Chrome アーティストテーマ




Reference

2009/10/09

Quickly view formatted PDFs in your search results

10/09/2009 10:33:00 PM Posted by Unknown , 1 comment
Two weeks ago. Google announced Google Doc Viewer. You can embed formatted PDFs in your web page more easily. Just Go Google Doc Viewer and fill it up and copy paste the link to your web page. Done!! (Just pay attention in one thing. you must let your PDFs can access on the internet)


If you often search information in google search engine and assign filetype as "pdf" like me. The new Quick view function is very convenience for us. You don't download that PDF file anymore before you sure it's you want.


Until now, Google Doc Viewer support three types(PDF document, PowerPoint presenetation and TIFF files). Only two of three can match search filetype filter(PDF & PPT). But new Quick view function just support PDFs now. I think Google may announce Quick view PPT file too.

2009/06/02

Google Docs Support .xlsx and .docx Now

6/02/2009 10:10:00 PM Posted by Unknown , 1 comment
Until now, i start use Google Docs more and more. It's easy to collect information by Google Docs Form. You can build a Simple Form, Edit, Share and Send it to anybody of your Gamil contacts.

I will upload few documents to Google Docs like PDF, doc etcs sometimes. Beacuse i can accept these files when i logon Google Docs by computer or mobile device. Now, it'a good news for Microsoft Office 2007 users. Google Docs support user can upload .xlsx and .docx now. But not including .pptx.



2009/05/08

App Engine TemplateSyntaxError

5/08/2009 06:17:00 AM Posted by Unknown , 1 comment
from google.appengine.ext.webapp import template

def HtmlRender(self, template_file, template_values):
temp = os.path.join(os.path.dirname(__file__),
'templates/'+template_file)
self.response.out.write( template.render(temp, template_values) )


template_values ={
'url' : self.request.url,
'my_dictionary' : { 'item1' : 1, 'item2' : 2}
}


url: {{ url }}
{% for key, value in my_dictionary.items %}
{{ item.key }} : {{ item.value }}
{% endfor %}


As you can see above code. you can app engine template to generate HTML than before generate code from within strings in the Python..

"TemplateSyntaxError: 'for' statements with five words should end in 'reversed': for key, value in my_dictionary.items".

Yes, you will get one error message. What? It looks as normal python code and seems does work. Because Google App Engine now support Django 0.96 version. If you want to receive a dictionary data type from python. You must modify Django template in HTML page.


more detail information:

2009/02/23

Google Calendar Primary Calendar Change

2/23/2009 11:44:00 PM Posted by Unknown , 1 comment
Problem

when i add new calendar event in iPhone. There isn't another calendar that you choose. Default setting is primary calendar(the first calendar of your calendar lists). I often review the schedule and want to add in my wall street calendar in the Wall Street. How to Change the Google Calendar primary calendar.



Solution

When you log in your google calendar. you can see the calendar lists of Calendar Settings/Calendars. The first one (show in list is enable) is your primary calendar. You can't delete primary calendar or unsubscribe it. Maybe you had added some events in these two calendar. How to change your primary? 
  1. backup your calendar (export these calendars).
  2. delete the calendar that you want to change to primary calendar.
  3. delete the primary calendar (you can't delete this calendar truly. just clear events).
  4. this stage. you have two empty calendars.
  5. change the primary calendar name what you want. (ex: Wall Street).
  6. import backup calendars to your primary calendar

  7. create new calendar(your original primary calendar)
  8. import backup
  9. done

Conclusion

In fact, you can add new event in your different google calendars use computer easily. But when you use mobile device and this way can solve the requirement of add new event outdoor.

2008/12/09

Gmail Labs New feature: Tasks

12/09/2008 11:15:00 PM Posted by Unknown , 1 comment
Now, Gmail has new experimental feature called Tasks. It's a way to help you can keep track events or something what you need to do. You can add new tasks in tasks panel directly or choose email item what you want by click "Add to Tasks" top of email lists.


In tasks panel(It has a default panel and you can add panle by new list). You can build your tree view by indent(Tab) and Un-indent(Shift-Tab) and you can drape and drop items where you want to display too.

Then, you can edit detail for every item.  There's support user custom Due Date and Note item. Due Date just let user select day time (i hope that it can support select date time like google calendar)


Summary
It's using a lightway let you can keep track what you need to do.  But, i hope this tasks can improve more features. for example: due date support date time. Those feature we talk about are similar The Remember The Milk for Gamil Tasks. It's need to install FireFox extension for Remember The Milk for Gmail if you want to use it. So, i hope Gmail Tasks can keep improve and make it more friendly.


2008/12/05

The Google funtions of Google Docs Spreadsheets

12/05/2008 09:23:00 PM Posted by Unknown , 1 comment



Yesterday, i found a vidoe called Google Docs for feed that talk about google document load feed in Youtube-GoogleDocsCommunity. That's Goolge functions of Google Doc Spreadsheet function list

Function

Syntax

Google Finance information

GoogleFinance(symbol, attribute)

Google Lookup information

GoogleLookup(entity, attribute)

Import data from external source

ImportData(URL)

Import data from external source

ImportFeed(URL, query, headers, numItems)

Import data from external source

ImportHtml(URL, query, index)

Cross-workbook reference

ImportRange(spreadsheet_key, [sheet!]range)

Import data from external source

ImportXML(URL, query)


Google function support functions given above and you can get those function detail explain in Google Docs help center. Then fllowing is my live demo of import feed from picasa web album

2008/08/15

Your HTML either contains unsafe tags

8/15/2008 10:18:00 PM Posted by Unknown , 2 comments
上一篇文章提到Google即將停止Page Create的服務。而以Google Sites來取代其功能。

因此想說就試一下Google Sites有沒有比較彈性的功能。在頁面編輯的時候加了一最簡單的Javascript語法,如果成功的話,就可以在Google Sites中試一些Google API來玩玩。

document.alert('alert popup message');


不過卻得到以下的訊息


又回去把Google announce的文章看一篇. !!!! 居然沒有看到..

I'm not sure if Google Sites is a good replacement for Page Creator, since the interface is more complicated and there are many limitations: you can't add JavaScript code, embedded objects or iframes, it's more difficult to upload files and to setup a simple site.

URI: Google Page Creator to Be Closed(Google).

2008/07/02

Google AJAX Feed API - AJAX Slide Show Rolling

7/02/2008 07:00:00 PM Posted by Unknown , , , , , 4 comments
AJAX Slide Show 為利用Google AJAX Feed API作出來簡單的應用。允許使用者把 PhotoBucketFlickrPicasa Web Albums的網路相簿以幻燈片的方式嵌在自己的Blog、網站等中。在Slide Show 中Picasa Web Album Feed URL無法動態更改,利用Picasa Web Albums Data API 與 jQurey JSON的操作,即可完成Picasa Web Albums的輪播。


Live Demo
| Download


AJAX Slide Show
<script type="text/javascript">
function load() {
var samples = "http://dlc0421.googlepages.com/gfss.rss";
var options = {
displayTime: 2000,
transistionTime: 600,
linkTarget: google.feeds.LINK_TARGET_BLANK
};
new GFslideShow(samples, "slideshow", options);
}
google.load("feeds", "1");
google.setOnLoadCallback(load);
</script>

var samples 為載入相關的Rss,在Picasa Web Album中都可以訂閱任何一個相簿的Feed。例如訂閱第七屆拼圖馬拉松的Feed(http://picasaweb.google.com/data/feed/base/user/cage.chung/albumid
/5217479087123706369?kind=photo&alt=rss&hl=en_US
)即可將此相簿以Slide Show的方式展示在網頁中。


AJAX Slide Show Advance

scenario
上述的方式,Side Show相簿的Feed為固定的,如果想要展示不同的相簿就必需更改程式碼,這是一件滿煩麻的事情。即然Google公開了Picasa Web Albums Data API,所以我們應該可以使用API搜尋特定user的相簿,以亂數組出Slide Show所需的Feed,達到相簿輪播的效果。

待解決的問題:
  • 選擇Ablum Feed Url
  • 決定Picasa Web Albums Data API回傳資料的格式及接收方式
  • Parser回傳的資料,找出組出Feed最主的資料(Picase Web Album ID)
  • 將亂數選出的Ablum ID帶入AJAX Slide Show

Step1
我們可以要求幾種來自Picase Web Ablum的不同的Feed。依照我們的需求,是搜尋特定user所有公開的相簿,在Picasa Web Albums 搜尋的參數[1]中會使用到kind與access2種參數
  • Kinds指特定類別的參數(ablum、photo、comment、tag、user)在此使用, user
  • Access指定相簿屬性(all、public、private)在此指定user所有公開的相簿, publick
因此,我們Ablum Feed Url則為http://picasaweb.google.com/data/feed/api/user/userID?kind=kinds&Access=publick

Step2
由於 AJAX 程式中的 XMLHttpRequest 只能呼叫同一個 domain 下的 URL,所以呼叫遠端並回傳XML資料型態的資料會以安全性考量被拒絕存取。又因為Picasa Web Albums資料格式提供另一種輕量級的資料交換格式(JSON),只有在Feed Url中指定alt=json即可將XML資料格式轉換成JSON格式並回傳。

選定遠端資料回傳格式為JSON,剩下的就是本機端該如何接收JSON型態資料。在此使用了一個新形態的 JavaScript程式庫(jQuery),程式庫中可以直接使用 jQuery.getJSON( url, [data], [callback][2] 操作JSON並進行AJAX回呼。此時的Ablum Feed Url更改為http://picasaweb.google.com/data/feed/api/user/cage.chung?kind=album&access=public
&alt=json&callback=?


Step3
剩下的部份就是Parser回傳的JSON資料
var numentries = json.feed.entry.length; //每一個相簿都是單獨的entry,numentries則為相簿的數量
var rNum = Math.floor(Math.random() * numentries); //以Random選擇相簿
var item = json.feed.entry[rNum];

var title = item.title.$t; //相簿的標題
var summary = item.summary.$t; //相簿的說明
var id = item.gphoto$id.$t; //最主要的相簿ID


Step4
將亂數選出的Ablum ID帶入AJAX Slide Show var samples 字串中即可




整合之後的Script 如下
<script type="text/javascript">
function load() {
$.getJSON("http://picasaweb.google.com/data/feed/api/user/<span style="
font - weight: bold;
">USERID</span>?kind=album&access=public&alt=json&callback=?", function(json) {

var numentries = json.feed.entry.length;
var rNum = Math.floor(Math.random() * numentries);
var item = json.feed.entry[rNum];

var title = item.title.$t;
var summary = item.summary.$t;
var id = item.gphoto$id.$t;

if (summary.length > 0) $("#msg").html("<h4>" + title + "</h4><p>" + summary + "</p>");
else $("#msg").html("<h4>" + title + "</h4>");

var samples = "http://picasaweb.google.com/data/feed/api/user/<span style="
font - weight: bold;
">USERID</span>/albumid/" + id + "?kind=photo&alt=rss&hl=en_US";

var options = {
displayTime: 2000,
transistionTime: 600,
linkTarget: google.feeds.LINK_TARGET_BLANK,
scaleImages: true
};
new GFslideShow(samples, "slideshow", options);
});
}
google.load("feeds", "1");
google.setOnLoadCallback(load);
</script>




Reference
  1. Interacting with Picasa Web Albums
  2. you can load JSON data located on another domain if you specify a JSONP callback, which can be done like so: "myurl?callback=?". jQuery automatically replaces the ? with the correct method name to call, calling your specified callback. Or, if you set the dataType to "jsonp" a callback will be automatically added to your Ajax request.
  3. Projection values: Feed URL "api" 與 "base"的差別,api參數提供了gphoto相關元素(包括我們需要的album id)
base
api

2008/06/18

Search Read Items in Google Reader

6/18/2008 07:41:00 PM Posted by Unknown , 1 comment
最近剛剛把Rss的閱讀器由FeedReader3換成了Google Reader。之前覺得Google Reader不怎麼好用,所以找了滿多的Rss 閱讀器,那時候就選擇了ReedReader3,介面還算不是錯,不過在預覽的時候沒有辦法顯示中文,其中我覺得很不錯的一個地方SmartFeeds,它可以讓使用在閱讀器中眾多Fees中篩選出特定條件的文章


這個功能是挺方便的,由其是在為數不少的內容中,可以找到自己有興趣的項目來閱讀也是很重要的事。不過Feedreader3現在使用的是本機的資料庫,所以使用者如果有2台電腦以上的話,就無法進行自動更新及同步的動作,也因此後來我還是決定把Rss閱讀器換回到Google Reaer。

Google Reader現在可以讓使用訂閱自己在Google Reader中所讀過的文章,給尋找時間太久的內容提供了一個方便的選擇。作法如下:

1.找出自己的User ID。在網止列輸入下列Javascript,會彈跳出一個窗視,1連串的數字即為UserID
javascript:prompt("User ID", _USER_ID);void(0);
2.在Google Reader中訂閱自己閱讀過的文章
http://www.google.com/reader/atom/user/USERID/state/com.google/read

完成之後,會出現一個新的選項(cage's read items)。打完收工!!!

2008/06/10

Dynamic Feed Control Wizard - Put feeds on Your Web Page

6/10/2008 10:09:00 AM Posted by Unknown , , , , 1 comment

Google 現在推出了讓使用者可以在自己的網頁中加上 dynamic RSS AJAX feeds。在Blogger Draft中新增了可以嵌入Feeds的小裝置,但是一次只能載入一個Feed。而在Dynamic Rss AJAX Feeds中可讓使用者一次載入多個Feeds而達到連播的效果,並提供3種樣式選擇(Vertical、Vertical Stacked、Horizontal):


再輸入完Feeds Expression(Feeds搜尋的條件),可以搜尋多筆,中間以","相隔開,按下Preview之後便會產生Dynamic Feed,Dynamic Feed 左側顯示為搜尋的關鍵字(可在產出的代碼中修改)


最後一個動作,Generate Code。


//Skip...
function LoadDynamicFeedControl() {
var feeds = [{
title: '竹誌',
url: 'http://cage1016.blogspot.com/feeds/posts/default'
},
{
title: 'bamboobig',
// 在此可自訂顯示的Feed
url: 'http://bamboobig.blogspot.com/feeds/posts/default'
}];
var options = {
stacked: true,
horizontal: false,
title: "Hollywood News"
}

new GFdynamicFeedControl(feeds, 'feed-control', options);
}
// Load the feeds API and set the onload callback.
google.load('feeds', '1');
google.setOnLoadCallback(LoadDynamicFeedControl);
//Skip...

LiveDemo (Event News)

2008/05/29

Embedding Google Earth in Your Web Page

5/29/2008 09:16:00 PM Posted by Unknown , , 1 comment
Google Earth 於5/28 釋出 Google Earth Browser Plugin
所以現在想要使用Google Earth多了一種選擇
不一定要下載Google Earth

donwloading plugin

並於幾個小時之後也公開了Google Earth plug API
讓使用者可以把Google Earth直接嵌入到自己的網頁中


<html>
<head>
<title>Google</title>
<script src="http://maps.google.com/maps?file=api&v=2&key=YourGoogleMapKey" type="text/javascript"></script>
<script src="http://www.google.com/jsapi?key=YourGoogleMapKey"></script>
<script type="text/javascript">
google.load("earth", "1");
google.load("maps", "2.99"); // For JS geocoder

var ge = null;
var geocoder;

function init() {
geocoder = new GClientGeocoder();
google.earth.createInstance("map3d", initCB, failureCB);
}

function initCB(object) {
ge = object;
ge.getWindow().setVisibility(true);
}

function failureCB(object) {
alert('load failed');
}

function submitLocation() {
var address = document.getElementById('address').value;
geocoder.getLatLng(
address,
function(point) {
if (point && ge != null) {
var la = ge.createLookAt('');
la.set(point.y, point.x, 100, ge.ALTITUDE_RELATIVE_TO_GROUND,
0, 0, 4000);
ge.getView().setAbstractView(la);
}
}
);
}

</script>
</head>
<body onload='init()' id='body'>
<div id='map3d_container' style='border: 1px solid silver; height: 500px;'>
<div id='map3d' style='height: 100%;'></div>
</div>
</body>
</html>


Live Demo簡單展示把Google Earth 嵌入到自己的網頁中

參考資料: