Nov 15

I've been playing around with GData for the last couple months. And i must agree with Jeremy when he said that GData is the realization of the future that Adam Bosworth talked about.

Adam gave us a different view of how to deal with huge amount of data. Until now, we can't talk about data without talking about conventional database management system with complex architecture. Apperently, it's not always about finding a simple solution to a complex problem, sometimes all you have to do is to simplify the problem.

Web was something that sounds almost impossible to build. But Tim Barners Lee simplified it, and by using HTML (and HTTP) almost everyone now can build the web. Why not do the same way with managing data. That's when he talked about ATOM Publishing Protocol (APP), a simple way to manage data on the web. As you might know, GData is the improvement of this publishing protocol.

Adam should know this very well because he works for the company that has managed to deal with huge amount of data. Adam is VP, Engineering at Google, and was one of the top Engineers at Microsoft.

Just listen to his talk and you'll find so many GData things in it.

Play now:

Download MP3 | Help with Listening

So it was only a matter of time until many applications adopt GData or protocol like GData. Today it's announced that Windows Mobile has also used GData.

Nov 10

As written in Google Code blog (err, yesterday), Ngeblog now supports AuthSub authentication. And it uses Zend Framework (Zend_Gdata) for abstracting the whole authentication process, including ClientLogin authentication.

Since Ngeblog 0.2 now uses the modified version of Zend_Gdata, the files is getting larger and it is hard for me to put Ngeblog 0.2 to phpclasses. So for now on you can download the source here or you can use svn to get the latest files on Google Code project hosting here.

Try out the demo here for ClientLogin authentication and here for AuthSub authentication. You can see the source code here and here for both demo respectively.

Alright, now let’s look what is new with Ngeblog.

Continue reading »

Nov 08

I’ve just found out this morning that Ngeblog has been chosen as one of Google Code Featured Project.

Although it’s not really accurate, since i haven’t used Zend GData yet, and it hasn’t supported AuthSub, but thanks anyway. I take that as a suggestion.

:)

Nov 04

As i mentioned in my previous post, i was going to add AuthSub authentication for Ngeblog when people at Google Code team announced that Zend framework now has GData support.

After played around with it for hours, i finally got into a decision to use Zend Gdata for abstracting Ngeblog connection to Blogger. Unfortunately, Zend GData class library only supports AuthSub authentication, while Ngeblog already uses ClientLogin authentication and works fine so far.

So, to make it available for both type of authentication, i finally sat down and wrote some codes myself to add ClientLogin support for Zend GData. You can download the bundle in .zip here or in .tgz here which contains both original Zend_Gdata bundle and my Zend_Gdata_ClientLogin class for ClientLogin authentication.

How it works

To understand how this class works, you must first understand how Google account authentication works. Please read the manual for that. But i try to explain it anyway.

Authentication is required to access any of Google Services such as Google Calendar, Google Base or Blogger. To do that, first you must provide username and password to log into your Google account. And then once your login is authorized, Google will give you a token to identify yourself for accessing the desired Google Service.

Currently there are two kind of authentication that Google uses. AuthSub authentication and ClientLogin authentication. As the manual said, AuthSub is used for web application that offers a service to access Google Service. While ClientLogin is used for installed application, such as desktop or handheld application.

But that doesn’t mean you can’t use ClientLogin for web application. It’s just that with ClientLogin authentication you must handle the authentication programmatically yourself to get the token. While with AuthSub you only need to redirect your web users to log into Google Account web site and grab the token as the result once they authorized.

Now, let’s get to the business. To use this class, you must first include Zend.php and load Zend_Gdata_ClientLogin class, like this:


  require_once 'Zend.php';
  Zend::loadClass('Zend_Gdata_ClientLogin');

Then use getClientLoginAuth method to get the token (authorization code), like this:

  $username     = 'yourusername';
  $password     = 'yourpassword';
  $service      = 'blogger';
  $source       = 'Ngoprekweb-Zend_Gdata-0.1.1'; // companyName-applicationName-versionID

  try {
    $resp = Zend_Gdata_ClientLogin::getClientLoginAuth($username,$password,$service,$source);
    print_r($resp);
  } catch ( Exception $e )  {
    echo $e->getMessage();
  }

As you can see, there are four parameters required for this method: username, password, service and source. You can read about these parameters here.

The results of this method will be in three possibilities:

First, if the authentication is success (authorized by Google), the output will be something like this,

Array
(
    [response] => authorized
    [auth] => DQAAAGgA...dk3fA5N
)

Second, if the authentication is failed for some reasons, it throws exception. About the reason of this failure, the manual said:

Please note that ClientLogin does not differentiate between a failure due to an incorrect password or one due to an unrecognized user name (for example, if the user has not yet signed up for an account).

Third, if Google requires you to solve CAPTCHA challenge, the output will be something like this,

Array
(
    [response] => captcha
    [captchatoken] => DQAAAGgA...dkI1LK9
    [captchaurl] => http://www.google.com/login/captchaALD$ALSJ4.png
)

About CAPTCHA challenge, the manual said,

ClientLogin uses standard security measures to protect user account information. To block bots and other entities from breaking user passwords, Google Accounts may add a visual CAPTCHA� to the authentication process when the server suspects an illegal intrusion, such as after too many incorrect login attempts. A CAPTCHA ensures that a real person is attempting login, and not a computer trying random strings (a dictionary attack).

Handling CAPTCHA Challenge

As i mentioned above, when Google requires you to answer CAPTCHA challenge (when she suspects you as an intruder :)), you’ll get both captchatoken for identifying which CAPTCHA image you received, and captchaurl that shows you the location of the image you have to answer (to tell miss Google you are human, not bot).

To answer that challenge, you use the same getClientLoginAuth method, only now with two additional parameters: captchatoken and captchaanswer.

  $username     = 'yourusername';
  $password     = 'yourpassword';
  $service      = 'blogger';
  $source       = 'Ngoprekweb-Zend_Gdata-0.1.1'; // companyName-applicationName-versionID
  $captchatoken = 'DQAAAGgA...dkI1LK9';
  $captchaanswer= 'brinmar';

  try {
    $resp = Zend_Gdata_ClientLogin::getClientLoginAuth($username,$password,$service,$source,$captchatoken,$captchaanswer);
    print_r($resp);
  } catch ( Exception $e )  {
    echo $e->getMessage();
  }

If you ARE really human, then most likely you’ll get something like this as the result,

Array
(
    [response] => authorized
    [auth] => DQAAAGgA...dk3fA5N
)

which means you’re now authorized to use Google Service you requested, in this case is Blogger. Use $resp['auth'] as your token (authorization code) to do the rest of operation (query, add, edit or delete posts in your Blogger).

In Action: Reading Blogger

This far, some of you might said, “what in Google Earth is this guy talking about?!”. :)

Alright kids, grab your emacs or UltraEdit, here comes the example. What we’re going to do here is to get the entries of your Blogger, for comparing purpose with what Zend does using AuthSub (see my previous post here).

<?php
/**
 * Testing Zend_Gdata_ClientLogin for getting list of Blogger entries
 *
 * written by: Eris Ristemena (http://www.ngoprekweb.com/tags/php)
 *
 */

  set_include_path(dirname(__FILE__) . '/Zend_Gdata');
  require_once 'Zend.php';
  Zend::loadClass('Zend_Gdata_ClientLogin');
  Zend::loadClass('Zend_Gdata');
  Zend::loadClass('Zend_Feed');

  $username     = 'yourusername';
  $password     = 'yourpassword';
  $service      = 'blogger';
  $source       = 'Ngoprekweb-Zend_Gdata-0.1.1'; // companyName-applicationName-versionID
  $logintoken   = $_GET['captchatoken'];
  $logincaptcha = $_GET['captchaanswer'];

  try {
    $resp = Zend_Gdata_ClientLogin::getClientLoginAuth($username,$password,$service,$source,$logintoken,$logincaptcha);

    if ( $resp['response']=='authorized' )
    {
      $client = Zend_Gdata_ClientLogin::getHttpClient($resp['auth']);
      $gdata = new Zend_Gdata($client);
      $feed = $gdata->getFeed("http://www.blogger.com/feeds/default/blogs");

      foreach ($feed as $item) {
        echo '<h3><a href="'.$item->link("alternate").'">' . $item->title() . '</a></h3>';
        $_id = explode("/",(string) $item->id());
        $blogid = $_id[count($_id)-1];
        $feed1 = $gdata->getFeed("http://www.blogger.com/feeds/$blogid/posts/summary");

        echo "<ul>";
        foreach ($feed1 as $item1) {
          echo "<li>";
          echo "<a href=\"{$item1->link('alternate')}\">{$item1->title()}</a><br />";
          echo "{$item1->summary()}<br />";
          echo "</li>";
        }
        echo "</ul>";
      }
    }
    elseif ( $resp['response']=='captcha' )
    {
      echo 'Google requires you to solve this CAPTCHA image <br />';
      echo '<img src="'.$resp['captchaurl'].'" /><br />';
      echo '<form action="'.$_SERVER['PHP_SELF'].'" method="GET">';
      echo 'Answer : <input type="text" name="captchaanswer" size="10" />';
      echo '<input type="hidden" name="captchatoken" value="'.$resp['captchatoken'].'" />';
      echo '<input type="submit" />';
      echo '</form>';
      exit;
    }
    else
    {
      // there is no way you can go here, some exceptions must have been thrown
    }

  } catch ( Exception $e )  {
    echo $e->getMessage();
  }

?>

Have fun. And please be kind to drop some comments below or report any bugs you find to my email (eristemena at ngoprekweb dot you know what).

Oct 14

263414390 68305408d5 o

After acquiring YouTube, speculations rise about what will Google do next. Robert Scoble noted in his blogs that Google seems to reboot its master plan. What is Google planning to do?

Guess what, here is the new rumor,

Yonkers, NY. FakeCrunch is reporting on a rumor that Google is in secret talks with your wife for possible acquisition. Reportedly valued at over $2 US, the deal is rumored to be an all-cash acqusition.

You wife has been steadily climbing in the Alexa ranking recently due to her social-networking and video-pirating services she offers to closed community of college students with nothing better to do.

While your wife couldn’t be reached for comment, FakeCrunch was able to track you down for your thoughts whom simply said “Ka-Ching!”

Source: Fake Crunch

Tags: , ,

Continue reading »

Oct 14

If you were like me, you wanted to be able to access Blogger using your own interface. Unfortunately, many Blogger API’s out there still using Atom API, which will be deprecated soon. Google plans to change it using Blogger GData API.

What is Blogger GData API? This is what the guidelines said,

The Blogger data API allows client applications to view and update Blogger content in the form of Google data API (”GData”) feeds. Your client application can use GData to create new blog posts, edit or delete existing posts, and query for posts that match particular criteria.

I will show you how to do that with PHP, using curl and simpleXML functions. So, make sure you have them installed in your PHP.

Continue reading »

Oct 11

If there was something missing in all the buzz about Google Code Search, i think it’s the fact that it’s not new at all. There were Koders and Krugle who played on the same field long before Google jumped in. But somehow they’re just disappearing from any count, including alexa. Just check their traffic for the past few days,

koders

krugle

Yep, they’re down elevator. No wonder if Darren Rush, CEO and co-founder of Koders, got a little pissed off,

“My advice to any entrant into this space is to focus on the unique structure of code, because indexing and searching code requires specialized algorithms and tools that Koders has already developed and refined.”

About the dangers of exposing security flaws as Google code blog said,

Since Google Code Search launched a few days ago, we’ve received a lot of great feedback, including some about the dangers of exposing security flaws.

it’s also not new. Just ask Johnny, he knows well about it long before there was Google code search.

Obviously, Google plays really well as a leader. Everything comes out from Google cage will make people turn their eyes from whatever they’re looking at.

But then again, Google knows well how to make good software. That’s what makes them so superior.

Oct 11

I don’t know when it started, but i’ve just found out someone has cute custom logo generator here. From its subdomain (tst4php) i guess he used PHP for this. I wouldn’t surprise.

Cute isn’t it?

ngoprekYahoo

ngoprekwebGoogie