Quality Reads

Wednesday, May 30, 2007

Google Closing Web-Desktop Gap

Right on the heels of my post concerning "Universal Search", Google just announced a new project bringing the web and the desktop closer together. Google Gears is a development platform where online applications can be made available offline or provide additional processing power to an online application. One of the major limitation of javascript is its single threaded processing. If you have a resource intensive operations occurring on a web page, the UI will often freeze until the operation is complete. Obviously, users don't understand what's going on in the bowels of the application so this can create a significant development barrier. Google Gears provides an API to hand off the resource intensive operation so the UI doesn't freeze up and users are none the wiser.

Here are the three main features of Google Gears (straight from Google):
LocalServer LocalServer
Cache and serve application resources (HTML, JavaScript, images, etc.) locally
Database Database
Store data locally in a fully-searchable relational database
WorkerPool WorkerPool
Make your web applications more responsive by performing resource-intensive operations asynchronously

From my brief inspection of the API, this makes me rethink my whole opinion of Apollo. You can develop one website with hooks into Gears that gracefully degrades if its not installed. With the Flex/AJAX bridge, you could even have a Flex website that communicates with the Database and WorkerPool. Whoa. Pretty sweet.

I'll post some more thoughts, once I get some time to digest the idea.

-Todd

Search in a Foreign Language


I happened upon this hidden gem in Google Translate. I know Google just announced their "Universal Search" concept but I hadn't actually noticed any new features to back up the claim. That is, until I ran into the aforementioned page.

As you can see from the screenshots, you can specify your native language and the language you want the results selected from.

Based on my search for "Silverlight" in Japanese, I'm not sure how relevant the results are yet. Here are a couple quick questions I've got running around:
  1. What's the time line to integrate this feature into Google search classic (or iGoogle)?
  2. What's the purpose behind serving both the translated and original version on the search page? If I'm using a translator, I obviously don't know the language very well. In what situation would I need the original next to the translated version? Besides learning the language.
  3. What type of search requires specifying a foreign language? Perhaps as someone English speaking, I am not Google's target audience for "Universal Search".
Like all things Google, Universal Search is still in Beta.

Cheers,
Todd

Thursday, May 24, 2007

OOP in Javascript

Ran across this great article by Ray Djajadinata (Microsoft Developer). Its a shame this wasn't around when I first started getting into advanced Javascript development two years ago. Could've saved me hours of trial and error.

If you still don't fully grok OO Javascript, check out the section explaining how prototyping works. Great stuff.

Cheers,
Todd

Tuesday, May 22, 2007

Prototype Custom Event System

Perhaps I have a little Flex envy but the DOM event model is woefully ill-suited to handle dynamic single page applications. To remedy the situation, I've written an extension for Prototype to provide a Custom Event messaging system. Its designed to work as a mediator between your AJAX controller and services. The concept works something like this:
  1. A user clicks a button (or interacts with any UI component) and a DOM event is triggered. Typically captured using Event.observe.
  2. The controller receives the DOM event, checks the state of the application, and gathers any data required by the model.
  3. Then using the Custom Event framework, a Custom Event is broadcasted with all the data the Model needs to perform its actions.
  4. The Model receives the Custom Event, processes its service call (or data storage etc.), and then uses its own Custom Event to broadcast data back to the controller.
  5. The controller then updates the view accordingly.

Custom Events are not a replacement for the Event object. Its really meant to aid in the loose coupling of the Model from the Controller in your client side code. Now that you've heard my spiel. Here's the code:



CustomEvent = {};
CustomEvent.Events = {};
CustomEvent.Events.Base = Class.create();
CustomEvent.Events.Base.prototype = {
initialize: function(){
this.listeners = new Array();
},
addEventListener: function(f){
this.listeners.push(f);
},
removeEventListener: function(f){
this.listeners = this.listeners.without(f);
},
dispatchEvent: function(n, d){
var data = this.setupData(d);
this.listeners.each(function(l){
l({name : n}, data);
});
},
setupData: function(d){
return $H(d);
}
}
CustomEvent.EventController = Class.create();
CustomEvent.EventController.prototype = {
initialize: function(){
this.events = new Hash();
},
create: function(n, t){
var args = arguments[2]?arguments[2]:null;
this.events[n] = new Event.CustomEvent[t](args);
},
addEventListener: function(n, f){
this.events[n].addEventListener(f);
},
removeEventListener: function(n, f){
this.events[n].removeEventListener(f);
},
dispatchEvent: function(){
var n = arguments[0];
var d = arguments[1] ? arguments[1] : {};
this.events[n].dispatchEvent(n, d);
},
destroy: function(n){
this.events.remove(n);
}
}
var EventController = new CustomEvent.EventController();


Here's how you would use it.


EventController.create("test", "Base");
EventController.addEventListener("test", myTest);

function myTest(evt){
alert('Event Name: '+evt.name);
}


Base is just the Basic custom event. Extend it to specify a unique data structure. Trigger the event with the following code:


EventController.dispatchEvent("test");


I still need to tweak the code little bit but so far its been very useful. Hope this helps someone else out.

Cheers,
Todd

Monday, May 21, 2007

RE: Tips on Life


I've been posting recently about other's superb writing and honestly when you can't out perform someone else in the short-run, acknowledge their efforts and learn what you can from them. It'll make you a more insightful individual in the long-run.

Keeping with that philosophy, here's a great read from lifehack.org (not to be confused with Lifehacker): http://www.lifehack.org/articles/lifehack/10-simple-ways-to-save-yourself-from-messing-up-your-life.html

Very solid read.

Cheers,

Todd

Sunday, May 20, 2007

High Performance MySQL

Quick post.

Two former/current Google Yahoo! Engineers, Derek J. Balling & Jeremy D. Zawodny respectively, released some great tips for performance enhancing your MySQL database. This was actually published back in 2004 but I just got around to reading it over the weekend. It breaks down the basics of Enterprise/Scalable MySQL development, below are some of the topics:
  • replication
  • load balancing
  • data backup
  • security
FYI, you can check out a preview here.

Web Development in Iraqi?



I ran across this job posting and HAD to make a comment. Remote web development is common place due to great applications like Basecamp, Vyew, AIM/GTalk, etc. With that in mind, why would you possibly need to send some to Iraqi for web development?!? I understand that certain circumstances require a physical presence but I'm sorry I don't think the risks equal the rewards for this one.

Hmmm... I wonder what the hazard pay is like. I'll update this post if I find out.

No, I'm not going to Iraqi. Well... not unless the pay is insane. jk.

Review: Advanced Actionscript 3 with Design Patterns by Joey Lott and Danny Patterson



Just finished up the aforementioned book. Great stuff! They cover topics such as OOP in Actionscript, RIA MVC implementations, and a myriad of design patterns (such as Iterator, Command, Decorator, State, etc etc etc). Most of the first half of the book acts as a refresher course but the design patterns from page 103 on are an absolute must use!

The only thing I found strange was after all the "advanced" design patterns were over, they cover Regular Expressions!?! I didn't realize my RegEx chops made me so l33t. Anyway, if you want to make your code more extensible/reusable give it a look.

Cheers,
Todd

Thursday, May 10, 2007

RE: Mmm! I love raisins made with SELECT * FROM [Equipment Table]! (pic)

Awesome error. Could someone sue for false advertising!?!
I re-posted the picture from here.
Not trying to steal the credit but their server is really slow (front page of digg).

Tuesday, May 08, 2007

AS3 MySQL Driver


I'm posting at work so I don't have much time to expound on why this is awesome. If you don't "get it", think Apollo Flex apps (Yes it works in Apollo).
Time to beef up on Embedded Systems

Sunday, May 06, 2007

Make Your Own Browser w/ Apollo

I had a couple minutes on Sunday to play around with Flex/Apollo. In less than an hour, I had this mini-browser working nicely. Check out the source code below for an example of databinding and the Apollo mx:HTML tag.



My blogger application is shaping up nicely. Expect to see the source code for that within a week or so. Yay, yay, I keep pushing it back but it'll be really sweet once its finished.


<?xml version="1.0" encoding="utf-8"?>

<mx:ApolloApplication xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">

<mx:Style>

.main{

top:0;

left:0;

bottom:0;

right:0;

}

.address{

top:0;

left:0;

}

.content{

top:50;

left: 30;

right: 30;

bottom: 10;

}

</mx:Style>



<mx:Model id="browserObj">

<root>

<location></location>

</root>

</mx:Model>



<mx:Script>

<![CDATA[

private function updateLocation(_loc:String):void{

trace('Address: ' + _loc);

browserObj.location = _loc;

trace('HTML Page Location: ' + htmlPage.location);

}

]]>

</mx:Script>

<mx:Panel styleName="main" label="Apollo Browser">



<mx:HBox>

<mx:ComboBox id="protocol">

<mx:dataProvider>

<mx:Array>

<mx:String>http:// </mx:String>

<mx:String>https:// </mx:String>

<mx:String>ftp:// &lt;/mx:String>

&lt;/mx:Array>

&lt;/mx:dataProvider>

&lt;/mx:ComboBox>

&lt;mx:TextInput id="address" styleName="address" text="http://www.google.com/" />

&lt;mx:Button label="Go!" click="updateLocation(protocol.selectedItem + address.text)" />

&lt;/mx:HBox>



&lt;mx:HTML height="{this.height - 100}" id="htmlPage" styleName="content" location="{browserObj.location}" />



&lt;/mx:Panel>

&lt;/mx:ApolloApplication>



**disclaimer
This is not my concept of a well-coded/designed application, it is simply a test app. Take it for what it is.

Cheers.

Friday, May 04, 2007

Can We Say Irony?


I was evaluating Railo for a new application I'm developing at work when I saw this. Evaluation Complete :(

Thursday, May 03, 2007

Blogger API Updated!

Google just updated their Blogger API docs. Very exciting news for me since I'm working on an Apollo application that can manage a blogger account from the desktop.

Eventually, it will be able to post, update, and delete posts. Plus, with the API additions, you'll be able to review & approve comments. Pretty sweet.

I guess I'll have the jump on my competition!

Check it out.

Yahoo! Messenger built using Flex



Yahoo! Messenger was released today. All in all, its a great Flex 2 application but my computer definitely hung for ~ a minute the first time it loaded. It might have something to do with the fact that I'm rocking IE7 today. Vista and Firefox haven't been playing nice.

If you use Yahoo! Messenger, in any form, this is worth checking out.

Ted (Flex Evangelist) has further coverage.

Tuesday, May 01, 2007

Fun with Javascript & Images



If you've got a couple free minutes to play around, check out this amazing javascript library: Loupe.js .

**Warning
all you IE people out there will feel excluded/dejected after clicking link.