768x90 Getting Online Shouldn't be Tough- $7.49 .com Domains at Go Daddy

DateTime Range Helper In Rails View

There's some secret that you should know before you make time scaling in ruby on rails specially to the view. I have little smile when seeing helper from a developer that make time helper like in twitter or facebook, example a moment ago, or 3 minutes ago, or 1 hour ago. Why you hurt your brain if Rails already supports it. I think that he doesnt know the secret, now let me tell you the secret:

distance_of_time_in_words_to_now
Reports the approximate distance in time between from Time to time now. Set include_seconds to true if you want more detailed approximations when distance less than 1 min.  example :

<%=  distance_of_time_in_words_to_now(from_time, include_seconds =  false) %> 

distance_of_time_in_words
This is the same like above, but you can get range of time from 2 dateTimes, example :
<%=  distance_of_time_in_words_to_now(from_time, to_time = 0, include_seconds = false, options = {}) %>

below is table list from date range in many conditions:
0  - 29 secs # => less than a minute
30 secs to 1 min, 29 secs # => 1 minute
1 min, 30 secs to; 44 mins, 29 secs # => [2..44] minutes
44 mins, 30 secs to 89 mins, 29 secs # => about 1 hour
89 mins, 29 secs to 23 hrs, 59 mins, 29 secs # => about [2..24] hours
23 hrs, 59 mins, 29 secs to 47 hrs, 59 mins, 29 secs # => 1 day
47 hrs, 59 mins, 29 secs to 29 days, 23 hrs, 59 mins, 29 secs # => [2..29] days
29 days, 23 hrs, 59 mins, 30 secs to 59 days, 23 hrs, 59 mins, 29 secs # => about 1 month
59 days, 23 hrs, 59 mins, 30 secs to 1 yr minus 1 sec # => [2..12] months
1 yr to 1 yr, 3 months # => about 1 year
1 yr, 3 months to 1 yr, 9 months # => over 1 year
1 yr, 9 months to 2 yr minus 1 sec # => almost 2 years
2 yrs to max time or date # => (same rules as 1 yr)

Rainbow for Slow Rack Application

Rainbows! is an HTTP server for sleepy Rack applications. It is based on Unicorn, but designed to handle applications that expect long request/response times and/or slow clients. For Rack applications not heavily bound by slow external network dependencies, consider Unicorn instead as it simpler and easier to debug.

Rainbows is mainly designed for the odd things Unicorn sucks at:

  • Web Sockets (via Sunshowers)
  • 3rd-party APIs (to services outside your control/LAN)
  • OpenID consumers (to providers outside your control/LAN)
  • Reverse proxy implementations with editing/censoring (to upstreams outside your control/LAN)
  • Comet
  • BOSH (with slow clients)
  • HTTP server push
  • Long polling
  • Reverse AJAX
  • real-time upload processing (via upr)
    Rainbows can also be used to service slow clients directly even with fast applications. 

 You may also install it via RubyGems on RubyGems.org
gem install rainbows

for Rack applications

In APP_ROOT, run:
rainbows
 
PS: For more information about tunning you can read here  

How To Create List & Add User Twitter in Flex and Air

A moment ago i have a problem about how to get Home Line or status from a group users list in my Air Application and sort them by date ascending. My analyst is if an account has 20 tweets but the group has 10 users, it means that i have to sort 200 list. Why don't use SortOn for Array? If you try myArray.SortOn("date",[Array.CASE_SENSITIVE, Array.UNIQUE ]), it can't sort date (string type in twitter) very well, we have to convert them from string to millisecond, and it will take time, maybe crashed.

My idea is, unite them in a list in customer twitter account then get the list status, make sense, no ? For this case i use library from Sandro (Thanks Dude) , which is named tweetr, badly no more example about create list like my case. When i read the documentation, it seems simple, but the process is not like that. The list status, only can pull status of users which are public, so if it is protected you can't pull them.

Here is the sample of my work, you can try by clicking the demo link below (this sample not stores your twitter login ^_^), the demo is in flex version, but you can convert it to Air easily.

DEMO
SOURCE (Flex)

Develop SmartPhone Using RhoHub

RhoMobile is a first Development as a Service for Mobile, RhoHub or RhoMobile lets you quickly create native apps in Ruby and HTML for all major smartphones using the award-winning Rhodes framework. RhoHub provides a hosted RhoSync server to synchronize backend data with your users' smartphones.Writing an app on RhoHub consists of generating a set of objects, editing the client side (Rhodes framework) code, the server side (RhoSync) source adapter and building for your target smartphones. Below is an overview of RhoHub's rich IDE and other services.



  1. Debugging Console : Use the collapsible console to quickly view output from your RhoSync source adapters.
  2. File Manager : Navigate and modify your app's files in a simple view.
  3. Rich Editor : Use the powerful Ruby/HTML/CSS/Javascript editor right from your browser, or work locally and upload your app.
  4. Text Search :  Search for text in all files of your app.
  5. Toolbar & Quick Links :  Access all of RhoHub's productivity tools right from the editor.




What you can do in RhoHub ?

RhoHub provides you 3 packages, Free, Basic and Premium. You can start with free 50MB Disk Space.

List and read files and directories in a zip file

First of all you should download library here

And then short play with script below
<?xml version="1.0" encoding="utf-8"?>
<mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">


<mx:Script>
<![CDATA[
import mx.controls.Alert;
import nochump.util.zip.ZipEntry;
import mx.events.ListEvent;
import nochump.util.zip.ZipFile;
[Bindable]private var _zipFile:ZipFile;
[Bindable]private var _file:File;

private function browseFile():void{
var _file:File = new File();
_file.browseForOpen("Open.", getTypes());
_file.addEventListener(Event.SELECT, fileSelected);
}

private function getTypes():Array {
var allTypes:Array = new Array(getImageTypeFilter());
return allTypes;
}

private function getImageTypeFilter():FileFilter {
return new FileFilter("ZIP File", "*.zip");
}

private function setFileInfo(name:String, size:uint):void {
zipFileLabel.text = "Archive: " + name + " (" + sizeFormatter.format(size) + " bytes)";
}

private function fileSelected(event:Event):void {
_file = event.currentTarget as File;
var urlStream:URLStream = new URLStream();
urlStream.addEventListener(Event.COMPLETE, completeHandler);
urlStream.addEventListener(IOErrorEvent.IO_ERROR, errorHandler);
urlStream.addEventListener(SecurityErrorEvent.SECURITY_ERROR, errorHandler);
urlStream.load(new URLRequest(_file.nativePath));
}

private function completeHandler(event:Event):void {
var data:URLStream = URLStream(event.target);
setFileInfo(_file.name, data.bytesAvailable);
_zipFile = new ZipFile(data);
}

private function errorHandler(event:ErrorEvent):void {
Alert.show(event.text);
}

private function itemClickEvent(event:ListEvent):void {
var entry:ZipEntry = event.currentTarget.selectedItem as ZipEntry;
if(entry) taEntryData.text = String(_zipFile.getInput(entry));
}

private function labelSize(item:Object, column:DataGridColumn):String {
return sizeFormatter.format(item[column.dataField]);
}

private function labelModified(item:Object, column:DataGridColumn):String {
return dateFormatter.format(new Date(item.time));
}

private function labelCrc(item:Object, column:DataGridColumn):String {
return item.crc.toString(16).toUpperCase();
}

]]>
</mx:Script>

<mx:NumberFormatter id="sizeFormatter" useThousandsSeparator="true" />
<mx:DateFormatter id="dateFormatter" formatString="MM/DD/YYYY L:NN A" />

<mx:Panel title="Zip Demo" height="100%" width="100%">
<mx:Label id="zipFileLabel" />
<mx:VDividedBox width="100%" height="100%">
<mx:DataGrid id="dgEntries" width="100%" height="100%" dataProvider="{_zipFile.entries}" itemClick="itemClickEvent(event);">
<mx:columns>
<mx:DataGridColumn headerText="Name" dataField="name" width="300" />
<mx:DataGridColumn headerText="Size" dataField="size" labelFunction="labelSize" />
<mx:DataGridColumn headerText="Packed" dataField="compressedSize" labelFunction="labelSize" />
<mx:DataGridColumn headerText="Modified" labelFunction="labelModified" width="150" />
<mx:DataGridColumn headerText="CRC32" labelFunction="labelCrc" />
</mx:columns>
</mx:DataGrid>
<mx:TextArea id="taEntryData" width="100%" height="100%">
</mx:TextArea>
</mx:VDividedBox>
<mx:ControlBar>
<mx:Spacer width="100%"/>
<mx:HBox>
<mx:Form>
<mx:FormItem label="Open Zip File:" width="100%" styleName="lblForm" required="true">
<mx:Button id="btnBrowse" label="Browse" click="{browseFile()}"/>
</mx:FormItem>
</mx:Form>
</mx:HBox>
</mx:ControlBar>
</mx:Panel>



</mx:WindowedApplication>

Anti Distorted resolution picture when resizing

If you resize picture by defining new width or height from normal size, you will get the picture resolution's distorted or broken quality. There's a method how to make the picture keeps soft and smooth.

Create a utility class


package com.jackBite.utils
{
import mx.controls.Image;
import flash.display.Bitmap;

public class CleanImage extends Image
{
/*public function CleanImage()
{
}*/

override protected function updateDisplayList(unscaledWidth:Number,unscaledHeight:Number):void
{
super.updateDisplayList(unscaledWidth, unscaledHeight);
if(content is Bitmap)
{
var bmp:Bitmap = Bitmap(content);
if(bmp && bmp.smoothing == false)
bmp.smoothing = true;
}
}

}
}



In MXML Component, You Put this

<utils:CleanImage id="feedLogo" height="30" source="{_imageRss}"/>

How To add image into any Textinput

You maybe want to add image or icon like magnifiying icon in textInput of your flex, Here i have some method how you can do that :

Create AS Component



package nebula.utils
{
import mx.controls.Image;
import mx.controls.TextInput;

public class SearchTextInput extends TextInput
{
public function SearchTextInput()
{
}

override protected function createChildren():void
{
super.createChildren();
var searchImg:Image = new Image();
searchImg.source = Images.search_icon;
searchImg.width=12;
searchImg.height=12;
searchImg.x = 2;
searchImg.y = 3;
setStyle("paddingLeft",searchImg.width+2);
addChild(searchImg);
}

}
}



in mxml component you put this:


<utils:SearchTextInput text="enter professional name ..." id="searchPro" click="{searchPro.text = ''}" width="200"/>




Another Alternative (sometime not work)


<mx:HBox>
<mx:TextInput id="myTextInput" />
<mx:Images source="{your_image_url}" paddingLeft="6" />
</mx:HBox>

Hacking Zindus (ThunderBird Add-On)

Zindus is a thunderbird add-on to import your google contact to thunderbird. The problem of zindus is not shown the first_name and last_name, address and organization if you use google data V.3

Let's see how it works:

1. Download Zindus from your ThunderBird.


2. Open the xpi file using winRar/7zip and extract the file.

3. Go to folder 'chrome' and then extract zindus.jar using WinRar/7zip

4. After you extract the JAR, go to folder content/zindus/

5. Open const.js and find 'const GD_API_VERSION ' and then change the value tobe "3"

6. Open contactgoogle.js and after that replace all with my script from this url: http://pastie.org/879955

7. archive the changes file to zindus.jar and archive back zindus.jar to xpi using 7zip or WinRar(drag and drop the xpi root folder to opened xpi in winRar)

8. Install it into your thunderbird and start import the google document

9. Binggo ^o^ address now display well and also organization and your first & last name.

Import contact information in Google Spreadsheet To Google Contact Using Rake

This March, I had a sexy task to import all employees and departments contacts information which were stored in Google Spreadsheet into Google contact.

A dummy people will think to pay data entry for entering them through google contact form. Whoa.. if i were a data entry, i would have had broken fingers after entering all data. Any way, I found a shortcut to import all data in only seconds or minutes, that is; make a robot to enter all data when we have a lunch.

Now, let's prepare the tools :

1. Installed Ruby on Rails Application
2. gem install gdata
3. gem install google-spreadsheet-ruby
4. open any text editor

Create Basic Rake Frame


namespace :db do

desc "GS2C: Google spreadsheet to Google contact"
task :gs2c => :environment do
require 'gdata'
require 'google_spreadsheet'

#Here will be some sexy scripts

end

end



Here it is, The Robot

namespace :db do

desc "GS2C: Google spreadsheet to Google contact"
task :gs2c => :environment do
require 'fastercsv'
require 'gdata'
require 'google_spreadsheet'

#sample spreadsheet URL
#https://spreadsheets.google.com/a/kiranatama.com/ccc?key=0AlQZq7IIjE6UdF92SkhRazlYaVFUWFNYZGxxLWpoT0E&hl=en

#settings
@spreadsheet_key = "0AlQZq7IIjE6UdF92SkhRazlYaVFUWFNYZGxxLWpoT0E"
login_config = YAML.load_file("#{RAILS_ROOT}/config/google_login.yml")[RAILS_ENV]
login_config["google"].each { |key, value| instance_variable_set("@#{key}", value) }

def create_spreadsheet_connector
@google_spreadsheet = GoogleSpreadsheet.login(@email_contact, @password_contact)
create_contact_connector
end

def create_contact_connector
@google_contact = GData::Client::Contacts.new({
:authsub_scope => 'http://www.google.com/m8/feeds/',
:source => 'google-DocListManager-v1.1',
:version => '3.0'})
@google_contact.clientlogin(@email_contact, @password_contact)
create_contact_entry
end

def create_contact_entry
@contact_entry = <<-EOF
<atom:entry xmlns:atom='http://www.w3.org/2005/Atom'
xmlns:gd='http://schemas.google.com/g/2005'>
<atom:category scheme='http://schemas.google.com/g/2005#kind'
term='http://schemas.google.com/contact/2008#contact' />
EOF
start_load_csv
end

def start_load_csv
@spreadsheet = @google_spreadsheet.spreadsheet_by_key(@spreadsheet_key)
#Sample Row Header / First Row
#First Name | Last Name | Email | Work Phone | Home Phone | Address | City | State | Country | ZIP
#You have to skip first row and blank row
i = 0
@spreadsheet.worksheets do |row|
if i < 1
i++
return
end
@google_contact.post( 'http://www.google.com/m8/feeds/' + 'contacts/default/base?v=3', create_google_contact(row,i))
i++
end
end

def create_address(address,city,state,country,zip)
address = <<-EOF
<gd:postalAddress rel='http://schemas.google.com/g/2005#home' primary='true'>
#{address}
#{city}
#{state}, #{zip}
#{country}
</gd:postalAddress>
EOF
return address
end

def create_google_contact(row,i)
first_name = row[i, 1].blank? ? "---" : row[i, 1]
last_name = row[i, 1].blank? ? "---" : row[i, 2]
email = row[i, 3].blank? ? "---" : row[i, 3]
work_phone = row[i, 4].blank? ? "---" : row[i, 4]
home_phone = row[i, 5].blank? ? "---" : row[i, 5]
address = row[i, 6].blank? ? "---" : row[i, 6]
city = row[i, 7].blank? ? "---" : row[i, 7]
state = row[i, 8].blank? ? "---" : row[i, 8]
country = row[i, 9].blank? ? "---" : row[i, 9]
zip = row[i, 10].blank? ? "---" : row[i, 10]
full_name = first_name + last_name

data = <<-EOF
#{@contact_entry}
<title>#{full_name}</title>
<atom:content type='text'>#{contact.note}</atom:content>
<gd:name>
<gd:fullName>#{full_name}</gd:fullName>
<gd:givenName>#{first_name}</gd:givenName>
<gd:familyName>#{last_name}</gd:familyName>
</gd:name>

<gd:email primary='true' rel='http://schemas.google.com/g/2005#home' address='#{email}'/>
<gd:phoneNumber rel='http://schemas.google.com/g/2005#home'>#{home_phone}</gd:phoneNumber>
<gd:phoneNumber rel='http://schemas.google.com/g/2005#work'>#{work_phone}</gd:phoneNumber>

#{create_address(address,city,state,country,zip)}

</atom:entry>
EOF
return data
end

create_spreadsheet_connector

end

end


Command Line : rake db:gs2c or rake -T

Create and Update Google Contact from Ruby without Batch

There's less information about ruby on rails method in google contact. I would like to share you about how to export new google contact / create new google contact from our table contacts through Ruby.

in my contacts_controller.rb, i wrote this script


class ContactsController < ApplicationController
require 'yaml'
require 'cgi'
before_filter :prepare_google_contact, :expect => [:create, :update]
CONTACTS_SCOPE = 'http://www.google.com/m8/feeds/'

def create
@contact = Contact.new(params[:contact])

respond_to do |format|
if @contact.save
feed = @google_contact.post( CONTACTS_SCOPE + 'contacts/default/base', google_contact(@contact)).to_xml
@contact.update_attribute(:google_contact_id, feed.elements['id'].text)
flash[:notice] = 'Contact was successfully created.'
format.html { redirect_to(@contact) }
format.xml { render :xml => @contact, :status => :created, :location => @contact }
format.fxml { render :fxml => @contact }
else
format.html { render :action => "new" }
format.xml { render :xml => @contact.errors, :status => :unprocessable_entity }
format.fxml { render :fxml => @contact.errors }
end
end
end

# PUT /contacts/1
# PUT /contacts/1.xml
# PUT /contacts/1.fxml
def update
@contact = Contact.find(params[:id])
@saved = @contact.update_attributes(params[:contact])

respond_to do |format|
if @saved
@google_contact.headers = {'If-Match'=>'*'}
feed = @google_contact.put(@contact.google_contact_id,
create_google_contact(@contact.reload())).to_xml
flash[:notice] = 'Contact was successfully updated.'
format.html { redirect_to(@contact) }
format.xml { head :ok }
format.fxml { render :fxml => @contact }
else
format.html { render :action => "edit" }
format.xml { render :xml => @contact.errors, :status => :unprocessable_entity }
format.fxml { render :fxml => @contact.errors }
end
end
end

private

def prepare_google_contact
contact_setup = YAML.load_file("#{RAILS_ROOT}/config/contact.yml")
contact_setup["google"].each { |key, value| instance_variable_set("@#{key}", value) }
@google_contact = GData::Client::Contacts.new({
:authsub_scope => 'http://www.google.com/m8/feeds/',
:source => 'google-DocListManager-v1.1',
:version => '3.0'})
session[:token_contact] = @google_contact.clientlogin(@email_contact, @password_contact)
@contact_entry = <<-EOF
<entry xmlns="http://www.w3.org/2005/Atom"
xmlns:contact="http://schemas.google.com/contact/2008"
xmlns:gd="http://schemas.google.com/g/2005">

<category term='http://schemas.google.com/contact/2008#contact'
scheme='http://schemas.google.com/g/2005#kind'/>
EOF

session[:token_contact] = @google_contact.clientlogin(@email_contact, @password_contact)
end

def google_contact(contact)
data = <<-EOF
#{@contact_entry}
<title>#{contact.first_name}</title>
<content>#{contact.note}</content>
<gd:name>
<gd:fullName>#{contact.first_name}</gd:fullName>
</gd:name>
<gContact:birthday when='#{contact.birth_day}'/>
<gd:email primary='true' rel='http://schemas.google.com/g/2005#home' address='#{contact.email}'/>
<gd:phoneNumber rel='http://schemas.google.com/g/2005#mobile'>#{contact.mobile}</gd:phoneNumber>
<gd:phoneNumber rel='http://schemas.google.com/g/2005#work'>#{contact.phone}</gd:phoneNumber>
<gd:structuredPostalAddress rel='http://schemas.google.com/g/2005#home'>
<gd:formattedAddress>#{contact.street}
#{contact.city}
#{contact.province}, #{contact.zipcode}
#{contact.country}
</gd:formattedAddress>
</gd:structuredPostalAddress>
</entry>
EOF
return data
end

end


in this study case I put my login google information in config/contact.yml file like this :


google:
email_contact: yacobus.r@kiranatama.com
password_contact: dec.07.1982


and here is my contact migration script lines :

class CreateContacts < ActiveRecord::Migration
def self.up
create_table :contacts do |t|
t.string :first_name
t.string :middle_name
t.string :last_name
t.string :phone
t.string :mobile
t.string :email
t.string :street
t.string :province
t.string :zipcode
t.string :city
t.string :country
t.string :note
t.string :type
t.string :google_contact_id
t.timestamps
end
end

def self.down
drop_table :contacts
end
end


and of course you have to install gem install gdata

Do not confuse about "format.fxml" this is respond data type for Restfulx (Flex/Air Framework).

Simple right !! but when this written's published, google still not release how to create and update trough ruby on rails. And many developer stucked because google provided create and update contact trough Batch method.

Basic Authentication in Flex or Air

After discussing about AuthSub and ClientLogin in Google in Flex or Air, now I would like to step forward about Basic authentication in Flex or Air. To know more about Basic Authentication please browse to this link https://mail.google.com/mail/feed/atom/all , you will be asked by pop up window to enter your login information right? now let we see how to handle it :



<mx:VBox
xmlns:mx = "http://www.adobe.com/2006/mxml"
width = "100%"
height = "100%"
verticalAlign = "middle"
horizontalAlign = "center"
backgroundColor = "#364a59"
creationComplete= "{creationHandler()}"
>

<mx:Script>
<![CDATA[

import mx.rpc.events.FaultEvent;
import mx.rpc.events.ResultEvent;
import mx.rpc.http.mxml.HTTPService;
import mx.utils.*;

private function creationHandler():void{
gmailService.headers = {Authorization:"Basic " + basicAuth()};
gmailService.url = "https://mail.google.com/mail/feed/atom/all"
gmailService.contentType = "application/x-www-form-urlencoded"
gmailService.resultFormat = "e4x"
gmailService.addEventListener(ResultEvent.RESULT, feedSuccess);
gmailService.addEventListener(FaultEvent.FAULT, faultHandler);
gmailService.send(); //Update Here
}

private function basicAuth():String{
var encoder:Base64Encoder = new Base64Encoder();
encoder.insertNewLines = false;
encoder.encode("yacobus.r@kiranatama.com:Dec.07.1082"));
return String(encoder);
}

private function feedSuccess(event:ResultEvent):void{
//Do any logic for feed result here
trace(XML(event.result))
}


private function faultHandler(event:FaultEvent):void{

}

]]>
</mx:Script>

<mx:HTTPService id="gmailService" showBusyCursor="true"/>

</mx:VBox>


Perfect right!!

AuthSub Authentication on Flex or Air

There are 3 types of authentication on when you are accessing website nowdays, they are :

  1. AuthSub / ClientLogin authentication, this authentication uses credential login information and give back to you authentication token that will be used on header as security login token to make you available login in 24 hours.
  2. OAuth authentication, this authentication is using secret key and customer key, more secure than AuthSub, this kind authentication will use your token and secret token in header Authentication information to identify you are the valid user when accessing secure data or page.
  3. Basic Authentication, if you see pop up alert that ask you to enter username or password, that is Basic Authentication.
Now i would like to share you about how to make those authentication become autologin without you face on their login page. First let discuss AuthSub or ClientLogin :

Now, try access this page : http://docs.google.com/feeds/documents/private/full

You will see error like this Authorization required, Error 401. These scripts all you need to pass the authentication easily :

you can use or just a class of HTTPService.


<mx:VBox
xmlns:mx = "http://www.adobe.com/2006/mxml"
width = "100%"
height = "100%"
verticalAlign = "middle"
horizontalAlign = "center"
backgroundColor = "#364a59"
creationComplete= "{creationHandler()}"
>

<mx:Script>
<![CDATA[

import mx.rpc.events.FaultEvent;
import mx.rpc.events.ResultEvent;
import mx.rpc.http.mxml.HTTPService;
import mx.utils.*;

private function creationHandler():void{
var data:Object = new Object;
data.Email = "yacobus.r@kiranatama.com";
data.Passwd = "Dec.07.1082"
data.accountType = "GOOGLE";
data.service = "writely";
//ClientLogin Url : https://www.google.com/accounts/ClientLogin
//AuthSub Url : https://www.google.com/accounts/AuthSubRequest
gmailService.url = "https://www.google.com/accounts/ClientLogin";
gmailService.contentType = "application/x-www-form-urlencoded";
gmailService.method = "POST";
gmailService.request = data;
gmailService.addEventListener(ResultEvent.RESULT, successHandler);
gmailService.addEventListener(FaultEvent.FAULT, faultHandler);
gmailService.send();
}

private function successHandler(event:ResultEvent):void{
gmailService.removeEventListener(ResultEvent.RESULT, new Function);
var txtAuth:String = String(event.result);
var authPosition:int = txtAuth.search("Auth");
txtAuth = txtAuth.substring(authPosition);
txtAuth = txtAuth.replace("Auth=","");
authPosition = txtAuth.length;
authPosition = authPosition - 1;
txtAuth = txtAuth.substring(0,authPosition);

accessProtectedUrl(txtAuth);
}

private function accessProtectedUrl(txtAuth:String):void{

gmailService.headers = {Authorization:"GoogleLogin auth="+txtAuth};
gmailService.url = "http://docs.google.com/feeds/documents/private/full";
gmailService.method = "GET";
gmailService.addEventListener(ResultEvent.RESULT, feedSuccess);
gmailService.addEventListener(FaultEvent.FAULT, faultHandler);
}

private function feedSuccess(event:ResultEvent):void{
//Do any logic for feed result here
trace(XML(event.result))
}


private function faultHandler(event:FaulttEvent):void{

}


]]>
</mx:Script>

<mx:HTTPService id="gmailService" showBusyCursor="true"/>

</mx:VBox>


List of Google Apps Service : http://code.google.com/apis/base/faq_gdata.html#clientlogin

 
powered by Blogger