Thursday 28 August 2008
Facebook StumbleUpon Twitter Google+ Pin It

Code Review: JavaScript, Gears, GeoLocation, Android, and more



Code Review is produced in a variety of formats, from text to audio (iTunes) and video.



The last several days have been exciting. We are seeing great new technology that can enable us to do new things, and have old things run a lot better.

Mozilla announced TraceMonkey, which promises large JavaScript performance improvements based on their trace based JIT technique. This, which backs on to the earlier SquirrelFish announcement from Apple and the WebKit team, and IE8 beta 2 arriving today with performance improvements too.

Running a new browser and seeing Gmail get a lot faster is just as good as buying a new computer to get a speed up!

Gears 0.4 has been released and people have picked up on the main points.

One side is Geolocation, and the two new ways to access location data through Gears and the Ajax APIs.

As an experiment, I wrote a shim that would bridge the W3C Geolocation API that Andrei Popescu of the Gears team is editing, and the other APIs. This is shown via a simple Where are you? sample application.

Giving you access to location information is fantastic, but this isn't all Gears 0.4 has to offer.

The new YouTube multi-file upload page gives you the ability to upload many files, with progress on the upload, and the ability to resume uploads after a connectivity problem. Brad Neuberg wrote a sample that ties together the new APIs (Blob, HTTPRequest improvements, Desktop API file system addition) and shows how you could create the experience too.

For more of this content, you can follow our two new series: Open Web Podcast, and the State of HTML 5.

Mobile News

A much awaited SDK update from Android that includes the new Home screen and many UI changes. New applications are also added (Alarm Clock, Calculator, Music player, etc) and new APIs and developer tools.

We also continue to add iPhone-friendly views of the Google world. THe latest is the Google Translate view.

Been playing with Google App Engine? If so, you should be aware of datastore updates that give you the ability to do batch updates, and discussions of indexing improvements. It is fascinating to watch cool new applications: from mini-services, to full applications, to platforms themselves, giving App Engine a go.

Open Source

The Google Summer of Code is moving along, and since we are now in August we get to see the progress that the students that have been flipping bits and not burgers this summer. One example is the work of 6 students working on the Git version control system.

Steve Weis has released Keyczar, a "toolkit that makes cryptography safer and easier to use". We all commonly make mistakes including the wrong cipher modes, bad algorithms, or working with keys incorrectly. Keyczar has got your back, is there to help keep your code secure.

Speaking of security, Thomas Duebendorfer of our Swiss office gave a talk titled Are internet users at risk? that delves into the practices of browsers and plugins, and how they update themselves. This just reaffirmed my desire to have silent updates getting pushed to me to keep me more secure!

Another video that we published that caught my eye was Where the hell is Matt?. Matt Harding is the guy who you may have seen on YouTube dancing badly around the world. We got him to the office and he chatted on his adventures. If you find yourself waiting for a compile (or a Map Reduce) this Friday, give it a watch while you wait.

Finally, registration opened up for the Google Developer Day events in India, Italy, the Czech Republic, and Russia. These join the first wave of events in the UK, France, Germany, and Spain. I really hope that we get to see you at one of those locations!

As always, thanks for reading, listening, or watching, and let us know if there is anything that you would like to see.

Wednesday 27 August 2008
Facebook StumbleUpon Twitter Google+ Pin It

October Google Developer Days Open Registration



We are excited to open registration for four more Google Developer Days in October in India, Italy, the Czech Republic, and Russia.(Please note we have moved Google Developer Day India to October 18th.)

As with the other 2008 Google Developer Days, we'll discuss the latest with our APIs and developer tools, diving into topics such as App Engine, OpenSocial, and Maps. We'll have some cool new topics in store, and there will be plenty of time to socialize with fellow developers and Google engineers.

If you are in western Europe, registration for the September Google Developer Days (UK, France, Germany, and Spain) is still open, though we expect to run out of space very soon. We hope you can join us for one of these upcoming eight events.

Update: We've also just opened registration for Google Developer Day Italy.

2008 U.S. Election Site: How did we do that?



Mark Lucovsky of the Google AJAX APIs team has written up a detailed article on how the 2008 U.S. Election site was created and implemented.

A myriad of the AJAX APIs are used here. The election news comes from:
  • A News Search:
    http://ajax.googleapis.com/ajax/services/search/news?v=1.0&q=Barack%20Obama%20unitedstates_uselections
  • A channel search for the YouTube tab:
    http://ajax.googleapis.com/ajax/services/search/video?v=1.0&q=ytchannel:barackobamadotcom
  • And, a Custom Search Engine was created for the blog search:
    http://ajax.googleapis.com/ajax/services/search/web?v=1.0&q=Barack%20Obama&cx=010222979794876194725:pqldevwuapa.
Take a look, and play with the control that he talks about here:

Tuesday 26 August 2008
Facebook StumbleUpon Twitter Google+ Pin It

Table Formatters make Visualization tables even nicer

By Hillel Maoz, Google Visualization Team

We often forget, but the simple table is a visualization too. In fact, all of our visualizations are based on the DataTable structure - a table itself.

In order to make this most basic visualization more appealing and useful, we added formatters to our JS table. Take a look at this arrow-format example, great for visualizing stock quotes or anything else that goes up and down. :-)

For example, to produce this result:



Use this code:

  <script type='text/javascript' src='http://www.google.com/jsapi'></script>

<script type='text/javascript'>
google.load('visualization', '1.0', {'packages': ['table']});
google.setOnLoadCallback(draw);
function draw() {
// Create a datatable with your data.
var dataTable = new google.visualization.DataTable();
dataTable.addColumn('string', 'Equity / Index');
dataTable.addColumn('number', '% Change');
dataTable.addRows(5);
var r = 0;
dataTable.setCell(r, 0, 'Acme.com');
dataTable.setCell(r, 1, 3.1, '3.1%');
r++;
dataTable.setCell(r, 0, 'Brick & Mortar Groceries Inc');
dataTable.setCell(r, 1, -2.43, '-2.43%');
r++;
dataTable.setCell(r, 0, 'S&P 500');
dataTable.setCell(r, 1, 0.94, '0.94%');
r++;
dataTable.setCell(r, 0, 'Dow Jones');
dataTable.setCell(r, 1, 1.2, '1.2%');
r++;
dataTable.setCell(r, 0, 'Nikkei');
dataTable.setCell(r, 1, -0.23, '-0.23%');
// Create a table visualization.
var container = document.getElementById('table');
table = new google.visualization.Table(container);
// Apply a number formatter to the 2nd column.
var options = {'allowHtml' : true};
var formatter = new google.visualization.TableArrowFormat();
formatter.format(dataTable, 1);
// Draw the table visualization with the applied formatting.
table.draw(dataTable, options);
}
</script>

Or this example of Number Formatters, good for accountants and whoever likes numbers:



Which can be generated by this code:

  <script type='text/javascript' src='http://www.google.com/jsapi'></script>

<script type='text/javascript'>
google.load('visualization', '1.0', {'packages': ['table']});
google.setOnLoadCallback(draw);
function draw() {
// Create a datatable with your data.
var dataTable = new google.visualization.DataTable();
dataTable.addColumn('string', 'Account', 'account');
dataTable.addColumn('number', 'Balance', 'balance');
dataTable.addRows(5);
var r = 0;
dataTable.setCell(r, 0, 'Electronics');
dataTable.setCell(r, 1, 12000);
r++;
dataTable.setCell(r, 0, 'Appliances');
dataTable.setCell(r, 1, -1000);
r++;
dataTable.setCell(r, 0, 'Gadgets');
dataTable.setCell(r, 1, -21000);
r++;
dataTable.setCell(r, 0, 'Accessories');
dataTable.setCell(r, 1, 5560);
r++;
dataTable.setCell(r, 0, 'Casings');
dataTable.setCell(r, 1, 13092);
// Create a table visualization.
var container = document.getElementById('table');
table = new google.visualization.Table(container);
// Apply an number formatter to the 2nd column.
var options = {'allowHtml' : true};
var formatter = new google.visualization.TableNumberFormat(
{prefix: '$', negativeColor: 'red', negativeParens: true});
formatter.format(dataTable, 1);
// Draw the table visualization with the applied formatting.
table.draw(dataTable, options);
}
</script>

And, lastly, this example of a bar-formatter, which can be used to visually show relative distances from an anchor-point:



Using this code:

  <script type='text/javascript' src='http://www.google.com/jsapi'></script>

<script type='text/javascript'>
google.load('visualization', '1.0', {'packages': ['table']});
google.setOnLoadCallback(draw);
function draw() {
// Create a datatable with your data.
var dataTable = new google.visualization.DataTable();
dataTable.addColumn('string', 'Place', 'place');
dataTable.addColumn('number', 'Altitude', 'altitude');
dataTable.addRows(5);
var r = 0;
dataTable.setCell(r, 0, 'Dead Sea');
dataTable.setCell(r, 1, -420);
r++;
dataTable.setCell(r, 0, 'Death Valley');
dataTable.setCell(r, 1, -86);
r++;
dataTable.setCell(r, 0, 'Mt. Everest');
dataTable.setCell(r, 1, 8848);
r++;
dataTable.setCell(r, 0, 'Mt. Kilimangaro');
dataTable.setCell(r, 1, 5895);
r++;
dataTable.setCell(r, 0, 'Marianas Trench');
dataTable.setCell(r, 1, -10924);
// Create a table visualization.
var container = document.getElementById('table');
table = new google.visualization.Table(container);
// Apply an arrow formatter to the 2nd column.
var options = {'allowHtml' : true};
var formatter = new google.visualization.TableBarFormat(
{base: 0, showValue: true, min: 12000, max: 12000});
formatter.format(dataTable, 1);
// Draw the table visualization with the applied formatting.
table.draw(dataTable, options);
}
</script>

For the complete list of currently available formatters, see our Table documentation with included examples. We're working on more formatters, which we will announce on our discussion group when we make them available.

For more info on using and creating visualizations, visit our documentation pages.

Thursday 21 August 2008
Facebook StumbleUpon Twitter Google+ Pin It

Two new ways to location-enable your web apps



We just launched two new ways to give your web apps free and secure access to a user's location, without requiring that user to enter it manually.

First, there's the AJAX API property that provides a simple way to get an approximate, region-level estimate of a user's location based on their IP address. It's as simple as referencing google.loader.ClientLocation, which is made available using the Google AJAX API Loader. This API does not require users to install any client-side software. You can see this new AJAX API in action as part of the 2008 US Election gadget -- the "News by State" will show local news for the state associated with the user's IP.

Second, the Gears Geolocation API provides a way to get a more precise estimate of a user's location. On mobile devices with Gears installed, the Geolocation API can use the cell-ID of nearby cell towers or on-board GPS (if either is available) to improve the postion fix. In the near future, we'll be adding data from your WiFi connection to improve accuracy even further, on both desktop and mobile. In all cases, Gears takes care of assimilating the results from each source and returning the best available position estimate.

The Geolocation API has two JavaScript methods: getCurrentPosition() makes a single, one-off attempt to get a position fix, while watchPosition() watches the user's position over time, and provides an update whenever the position changes. Both methods allow you to configure which sources of location information are used. Gears also keeps track of the best position fix obtained from these calls and makes it available as the lastPosition property. This is a simple way to get an approximate position fix with low cost in terms of both network and battery resources.

The privacy of users' location information is extremely important. The first time your site calls the Geolocation API to request a user's location, that user will be shown a permissions dialog where they can choose to allow or deny your site access. Users can change that decision at any time via the "Gears settings" dialog in the browser menu. Google does not keep location information about users when your site uses the Geolocation API.

To use the Geolocation API your users may need to install the Gears browser plugin, a simple process on both desktop and mobile. The Geolocation API is available on platforms currently supported by Gears, including Internet Explorer, Firefox and IE Mobile (selected devices only). For users to be able to use location-enabled features on mobile they will need a Windows Mobile device that supports GPS or cell-ID lookup (for example the Samsung BlackJack II and the HTC Touch Dual, see list of supported device models in our FAQ). We are working hard to bring Gears to more mobile platforms soon. You can download and install Gears at gears.google.com. Or try out some of the first location-enabled mobile web apps using Gears.

Like the rest of Gears, this new Geolocation API is open source. We're also doing our best to work with existing and emerging standards. Gears now implements the current editor's draft of the W3C Geolocation specification, which we've helped to define in collaboration with Microsoft, Mozilla, and others. We're committed to continued collaboration around the emerging HTML5 standard and the APIs specified by the W3C Web Applications Working Group. The goal for Gears is to advance browser capabilities, and part of that is helping define future web standards.

If you're interested in providing feedback or contributing to Gears, there's more info on the project website. There's also an AJAX APIs discussion group -- we're anxious to hear what you think.

Tuesday 19 August 2008
Facebook StumbleUpon Twitter Google+ Pin It

Google Visualization API now in PHP

By Nir Bar-Lev, Product Management

Here at the Google Visualization HQ we focus hard on making the Visualization API the easiest and simplest platform for visualizing and reporting data on the web.  We're always excited to see the community uptake and develop our product, making it even more useful and accessible to other developers. One such initiative is the PHP wrapper class that Thomas Schaefer wrote for the Visualization API.

The class wraps the API and enables PHP application developers to quickly integrate visualizations into their code. Thomas even published reference applications that enable you to  get started even quicker.

We love your work Thomas, keep it up!

Thursday 14 August 2008
Facebook StumbleUpon Twitter Google+ Pin It

More materials on Google Code University



With the fall semester rapidly approaching at universities all over, we're happy to share that we've recently made more content available on Google Code University. In case you're not familiar, Google Code University is a repository of educational material including tutorials, lecture slides, and videos focused entirely on computer science. Not only is it a collection of high-quality educational materials, but most of the course materials are Creative Commons licensed, to enable reuse and modification by educators and students alike.

This recent update includes materials covering:

We hope you find these new materials interesting and useful. If you have suggestions or materials you'd like to share, please discuss on the forum.

Sunday 10 August 2008
Facebook StumbleUpon Twitter Google+ Pin It

Actual Model implementation in MVC Architecture

Frameworks like Ruby on Rails have made MVC (Model View Controller) architecture more popular and easier. Most of the PHP frameworks like CakePHP, Symfony, PHP on Trax, Zend Framework have followed similar patterns as Ruby on Rails for MVC. By using these frameworks, MVC in design is no longer painful.

But do all people maintain MVC in real manner??? The major misconception the people have is about the role of Model in MVC. I read many tutorials of Ruby on Rails, Zend Framework, CakePHP and Symfony. Many of the tutorials explain the role of Model as to access data from database. That means Model would be responsible for providing and updating of data into the database!!! All the business logic would be handled by the Controller!!!

It is a simple way, but would be fare only for small scale applications which do only CRUD (Create, Read, Update, Delete) operations. Then, what about large applications where business logic is much complex? Is it a good idea to encapsulate all business logic in Controller?

Bill Karwin and Dave Marshall explains actual implimentation of Model. The Model is a business logic of your application not only the database access layer. Active Record (in RoR, Cake, Symfony) or Table/Row Data Gateway (in Zend Framework) should be used as a part of model not as a model. Your all business logic should be encapsulated in Models only.

One of the strongest reasons for following MVC is reusability. Think about the case when you want to port your PHP web application to desktop application using PHP-GTK. If you have followed correct MVC architecture then you can easily reuse the same Models of web based application into GTK based application. If you have encapsulated your business logic in controller, then you have to rewrite all the code again for GTK!!! It would simply kill DRY (Don't Repeat Yourself) principle!!!

I am using Zend Framework since its 1.0 release. At the beginning I read lots of tutorials about it and I was in the same misconceptions about the Models. Then I had taken a look around the code base of Magento Commerce. As I told in my previous post, Magento is built on Zend Framework and follows MVC architecture. (I noticed that Magento uses many ZF components but does not use Zend_Controller and Zend_View for its MVC because of its own custom patterns. But the implementation is quite similar to Zend Framework.) I'd noticed that MVC is followed in really nice way and provides very much flexibility for customization. It is very good example for enterprise application design.
-By Parthiv Patel
Parthiv Patel
Bhaishri Info Solution
Sr. PHP Developer
Limdi Chowk, AT PO. Nar, Di. Anand
Nar, Gujarat
388150
India
pparthiv2412@gmail.com
7383343029
DOB: 12/24/1986

Friday 8 August 2008
Facebook StumbleUpon Twitter Google+ Pin It

Two new Open Web series: Open Web Podcast and This Week In HTML 5



This week has seen two new series to cover Open Web technology. One of the messages from Google I/O was explaining how Google believes in, and is frankly betting on the Web as its platform. You should expect to see increasing examples of how we are putting our money (and effort) where our mouth is on this.

Since the Web is so decentralized, we have a deep need to communicate and discuss where we, as a collective are heading.

I have the pleasure to be joined by Alex Russell, notably of the Dojo Foundation, and John Resig, both creator of jQuery and employee of Mozilla Corp, for a new Open Web Podcast that focuses on news, events, and opinion on the state of the Open Web.

In the first episode, which you can either download directly or subscribe to, we delve into a lot of topics including new APIs and specifications, the new charge behind Firebug, the Open Web Foundation, and much more.

The early part of the podcast actually discusses the other series that started this week. Mark Pilgrim, a team-mate of mine at Google, kicked off This Week in HTML 5. Mark is taking the time to keep track of the myriad of changes to the specification, and will keep us abreast of the important features and decisions that are made by the group, head by our own Ian Hickson.

Mark discusses the big additions of Web Workers (Gears Workers standardized), and the clarification of alt tag usage in the img tag to have you using alt="{diagram}" and the like.

If you are interested in keeping up to date on HTML 5, you can subscribe to the WHATWG feed which is where Mark is doing his work.

If there is anything else that you would like to see from us, please drop us a comment below!

Friday 1 August 2008
Facebook StumbleUpon Twitter Google+ Pin It

Google Code Review: OWF, Content Licenses, Secure Ajax APIs, CalDAV and more



How do you like your Code Review? Choose from text to audio (iTunes) and video.



We have had a varied couple of weeks, so I decided to turn on the camera, even though I am in Eldora, Colorado, up in the mountains.

First up, the Open Web Foundation. I discuss the new foundation and what it is trying to accomplish (not another standards org!).

Then we stay on the topic of the Open Web and browsers, and how Vladimir Vukićević has an promising implementation of Canvas in IE. excanvas has done this for awhile by first emulating VML, and more recently with a Silverlight bridge. Vladimir is a Mozilla hacker, and he managed to shoehorn the Firefox Canvas code in via an <object>.

We have worked out how to license our code, but what about the other stuff that a project has? What about the documentation, the samples, the protocols? The Google Code team now allows you to choose a content license to cover those bases. Just a simple drop down away in your project hosting area.

Elsewhere, in Google Code land, the code review tool that we talked about early has now made its way to Google Code. Now you can say "Looks Good To Me" to your buddies source code as he puts in a new commit on your new opensource project.

One of the most requested features on Google Code is more RSS feeds, and we have obliged with support for issues, downloads, subversion changes, and wiki updates.

Now you have the new tools, how about searching over that large amount of code that we are putting out there? Code Search just got a lot better with rich outlines showing you meta data on the file that you are in, and hyperlinking includes and such.

Moving to Ajax and the Web for a second. One of the common requests that we have had since we launched the AJAX Libraries API, is to be able to access the Google hosted popular opensource libraries on https as well. And, now we do. If your application is on https and you don't want users to see any "mixed content" messages, go ahead and use https on us too!
Google XML Pages (GXP) is a templating system we use at Google. Its main focus is markup: we mostly use it for generating HTML and XHTML, but it can work with other flavors of XML, like Atom, KML, and RSS. It also has some support for a few non-markup languages (JavaScript, CSS and plain text), though mostly for embedding them within markup.
Check it out and see how some of the Google products do the view side of MVC on the Web.

I didn't even know that Google Health was built using GWT, so it was interesting to read a retrospective on the decision.

What else has been going on?

Here are a few random things:
  • Google Calendar supports CalDAV: This is experimental, but means that you can kick up iCal and have bi-directional sync.
  • QR Code in Charts API: QR codes are 2D bar codes. You can store anything you want, but commonly people put URLs and contact information in there, that mobile phones can quickly scan.
Finally, Google Developer Day is coming to Europe, so if you are in that neck of the woods in September and October, please stop by!