Sunday, July 6, 2008

US Government against radio ?

Although this is totally unrelated to JavaScript, in any way, I think the community as a whole will understand how important this is.

A few months ago, I received several emails stating that the new internet regulations may bring down internet radio sites such as pandora and others.  Today, I received an email that really disturbed me. The government was going to cut funding on the SETI@Home project.  Is the US Government opposed to radio waves?

Seriously, I thought it funny for a second, but the seriousness of the matter is at hand.

Please take a moment to help us SAVE ARECIBO.

http://setiathome.berkeley.edu/arecibo_letter.php

and generate letters to submit to Congress.  I am urging all who read this take the time to print out the letters it generates and mail them through snail mail. Electronic mail too often gets discarded, and physical letters make a bolder statement.

Thank you for caring about such an important project to save the Arecibo Observatory, the world's largest radio telescope at the Berkeley.
Blogged with the Flock Browser

Thursday, July 3, 2008

Google Gears, Prototype, and YUI

Recently I have had the chance to monkey around with Google Gears, Prototype, and YUI together. I created a nice data dashboard application which uses the local database in Gears to store data relevant to the user.

For example, when working within your corporate intranet, you can enable your users to enter in data chunks that pertain to the work they perform such as common account numbers, logins, or other information, perhaps a geo location.

The user can then associate this chunk to a location within the database. Specifying which fields and tables are associated with the chunk they wish to create a dashboard widget for. Using prototype you can build a data class that can access the local database or perform updates with Ajax. 

At this point I decided not to store the results back into the local database, but it could be possible to store that json and retrieve it if the user wanted to save off reports they have run.

A simplified/psuedocode version of the prototype class might look like:



var $args = {
label: 'Label',
db_table: 'myTable',
db_col: 'myCol',
fields: '*'
assoc: 'myOtherTable.myOtherCol'
}

var DataChunk = Class.create({
initialize: function($args){
this.args = { .. deafults .. };
Object.extend(this.args, $args || {});
},
get_params: function(){ .. return this.args toQueryParams ... }
// Other Methods
});

var DataManager = Class.create({
initialize: function($local_db, $table){
// Gears db init code here


// Object properties
this.ajax = '/url'
this.db = $local_db;
this.table = $table
},

get_chunk: function($label){
return this.db.execute('select * from ' + this.table);
},

load_chunk_data: function($chunk){
try {
var load_chunk = new Ajax.Request(this.url, {
method: 'get',
parameters: $chunk.get_params(),
onSuccess: this.got_chunk
.bindAsEventListener(this);
});
} catch ($err) { ... }
},

got_chunk: function($response) { ... }

});




Or, the coder could also strap the load_chunk_data to a YUI DataSource and DataTable, or Prototype Ajax.Updater for recurring updates.

Overall, as with most Google products, I am very impressed with the capabilities Gears gives me in creating exciting web applications.
Blogged with the Flock Browser

Wednesday, July 2, 2008

Google hosts prototype

Compressed versions of Prototype can now be served from Google


You can either link to the source code directly:

  <script type="text/javascript"
src="http://ajax.googleapis.com/ajax/libs/prototype/1.6.0.2/prototype.js"></script>

Or you can use Google’s API:

  <script type="text/javascript" src="http://www.google.com/jsapi"></script>
<script type="text/javascript">google.load("prototype", "1.6.0.2");</script>



The Expires is set for 1 year. Which means users on your site will only need to download one 30kb file, once. Or, if they have visited another site using this method, it will already be in the cache.

Kudos to the Google team!
Blogged with the Flock Browser