Friday, March 19, 2010

Create A Digital Contents Store Under Google Sites with PayPal Shopping Cart

Google Apps has become one of the most popular (Cloud Computing) IT solution for the businesses, the built-in Google Sites is a very powerful tool for publishing the web contents. The Google Sites uses the Gadget concept to create the pages, it does offer all kind of gadgets for you to choose, however, for the shopping cart gadget beside the Google Checkout Store Gadget I didn't find any gadget can offer a simple shopping cart with PayPal checkout function and Google Checkout Store Gadget only accepts Google Checkout payments.

Quite a few my customers are using PayPal as their internet merchandise service, in order to help them to accept Credit card and PayPal payments, I have developed some Gadgets for them to embed into their Google sites. The shopping Cart concept is the same as Google Shopping Cart Wizard, a Google Spreadsheet is used to maintain the store items.

When creating the Gadget, the administrator needs to decide to use PayPal BuyNow or PayPal Shopping Cart feature, and add the correct Paypal email address, the final step to to decide which Google Spreadsheet to use. Once finish, a simple layout shopping store will be generated right away! Anything you change on the spreadsheet will be updated on the web site too.
The demo case is a photo gallery store which customers need to download the photo right afetr they pay. Therefore, the PayPal Web Site Payment Standard API has been implemented to process the real time transactions. Once the server receive the payment confirmation from PayPal, an email will send to the buyer with a digital link which points to the download site of the digital content (photo image). All the contents are stored in the Google Docs without public access, the server agent needs to find out  the link and make it accessable for the new customer and generate the email with the link to specified customers.

Meetup Gadget

After finished the Meetups Coming To Town, I was asked to see if I can convert it into a Google Gadget which is much easier for users to integrate into their browser. I didn't have time until last weekend, with two days testing and tuning, the new "Meetups Coming To Town" gadget finally born.
I have to removed the auto location detect function from the web-based version since I still could not find a reliable and free geo location API and the Google Gears is still not a standard for most of the users. Therefore, users need to manually type into their state and city to get correct display. A "topic" field allow users to filter the meetups by keyword.
The background engine to talk to the Meetup API is a PHP script under Apache, I will change it to a Google App Engine application in the near future. The Google Gadgets API is very easy to use, most of the codes in the program no need to change, the Ajax part is the place I spent a lot of time to redo and tune the codes.
Give it a try and give me the comment, no matter you like it or hate it! However, the Meetup API search function is not that friendly, for example, if you search "single" you might get nothing, if change to "singles" you will get plenty of meetups.

Thursday, March 11, 2010

No API? No Problem! A Data-Entry Robot Comes To Rescue!

One of my client has average one hundred transactions on PayPal per day, I have written a program which takes advantage of PayPal API to improve the shipment process for their warehouse. However, the biggest headache for them is to enter the tracking information into PayPal for each transaction. Ever since PayPal released their first API, the developers have been asking the shipment tracking info API, and even on PayPal web site there is a name for it - AddTrackingInfo. The truth is the API item never existed!

Roughly one month ago, I read the news about a MIT student developed a graphic-based program called sikuli. I didn't pay much attention then, however, I was thinking about it might be a good replacement for the tooling I used on screen scraping and keyboard automation in some applications.

While customer keep asking, and as usual I searched entire PayPal developer site and made sure the tracking API won't be available anytime soon, I have decided to give it a try. The sikuli is a Jython-based language, it can take parameters from file, so what I need is to generate a file from the database with the PayPal transaction ID and the shipping tracking number daily, and a sikuli script file to do the data entry. The sikuli file will emulate the whole PayPal order tracking data entry process.
After two-hour trials and errors, the script finally works like a champ, since I want it to run stable rather than fast, I have added more dealy than usual, it takes around 20 seconds to finish each order update. Now I need is a compiler to make the script a executable file. Thank you sikuli, you saved my life! KowTow __/\__
Above is part of the sikuli script.

Tuesday, March 9, 2010

Google Apps Marketplace Goes Live!

Google launched its Google Apps Marketplace tonight! After released so many APIs, Google finally opens a door for developers to integrate their applications more tightly with Google Apps.
 I think this is a very important mile-stone for Google Apps which has been trying to take on IBM Lotus Notes and MS Sharepoint, and this is the only way for Cloud-based Google Apps make its way into the corporations IT door - ONE CONTROL PANEL!
My company - Auctions411 so far only offers two services under this new Marketplace, our new applications for Google Apps still under developing should be ready by April.

Anyway! Congratulations to the grand opening of Google Apps Marketplace! Hope it will bring some good businesses for cloud-based IT solution providers.

Monday, March 8, 2010

Meetups Coming To Town - A Mashup of Meetup, Google Gears, & Google Map APIs is one of the social network site that facilitates offline group meetings in various locations around the world. I have been attending some of the groups' meetups since 2009 and found they were very helpful, most important of all - all the meetups I went to were FREE!

The API is very easy to use and everybody received one API key when registering with the site. I decided to utilize the API by integrating it with Google Gears and Map APIs to come out a mashup for people can easy to find out what meetups happening in his(her) own town.

To automatically find out the locations that users are in, the Google Gears API is used to retrieve Geolocation. Users will need to install Google Gears to use the feature, otherwise, they have to manually keyin the location information.

The very first time you run the mashup it will ask your authorization -


A PHP file is running at back-end to communicate with Meetup API and the main program - mymu.html, I need to modifiy the header of the json output from Meetup in order for Dojo to accept it as a datastore to feed the spreadsheet displayed on top.

$state = urlencode($_GET["state"]);
$city = urlencode($_GET["city"]);

if (isset($_GET["page"]))
$page = $_GET["page"];
$page = "50";

if (isset($_GET["topic"]))
$topic = $_GET["topic"];

if (! isset($_GET["type"]))

switch($type) {
 case "0":
 case "1":
  $curl = curl_init();
  $req = "" . $state .  "&city=" . $city . "&key=YourMeetupApiKey";
  if ($topic != "") {
  $req .= "&topic=" . $topic;
  if ($page != "") {
  $req .= "&page=" . $page;
  curl_setopt($curl, CURLOPT_URL, $req );
  curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
  $result = curl_exec($curl);

  $result=str_replace("\"results\":", "identifier:\"id\", items:", $result);
  echo $result;
You can test the program by going to and see the detail javaScript and HTML codes from there. Beside the "State" and "City" filters, a optional "Topic" field is also available for you the limit the results. A Dojo speradsheet on upper page will show all the future meetups coming to your city, and a Google Map on the lower page will display where they will be held. Click at the row of the spreadsheet or the Google map marker, a more detail window will pop-out.
The main JavaScript function - init() will try to find the user geolocation first, then retrieve data from Meetup API and populate the information on Dojo spreadsheet and a Google Map.(init2)
function init() {
  if (! || !google.gears) {
    alert('Gears is not installed, please get it at ');
  function successCallback(p) {
 if ( == "United States") {
  function errorCallback(err) {
    var msg = 'Error retrieving your location: ' + err.message;
  try {
    var geolocation = google.gears.factory.create('beta.geolocation');
                                   { enableHighAccuracy: true,
                                     gearsRequestAddress: true });
  } catch (e) {
    alert('Error using Geolocation API: ' + e.message);

function init2() {
  gridView();  //create spreadsheet
 loadMap(dijit.byId('city').value + ", " + dijit.byId('state').value); // load the city map
 drawMap(store); // draw the markers