Google Gears goes prime-time on YouTube

Gears might now gain some traction, with the people I try to persuade into using it, as it’s install base grows.

Components

There are several major API components to Gears:

  • A Database module (powered by SQLite) that stores the data offline.[3]
  • A WorkerPool module that provides parallel execution of JavaScript code.[4]
  • A LocalServer module that caches and serves application resources (HTML, JavaScript, images, etc).[5]
  • A Desktop module that lets web applications interact more naturally with the desktop.[6]
  • A Geolocation module that lets web applications detect the geographical location of their users. [7]

No related posts.

read more

IE8: CSS Expressions are no longer supported in Standards Mode

In case you don’t know, CSS expressions were actual bits of JavaScript that you could run from CSS rules; this was commonly used to simulate the CSS max-width property for IE:

 
CSS:
  1.  
  2. div.someClass {
  3. /* Internet Explorer */
  4. width: expression(document.body.clientWidth> 600) ? "600px" : "auto";
  5. /* Standards-compliant browsers */
  6. max-width: 600px;
  7. } 

No related posts.

read more

dojo.connect, dojo.byId and dijit.byId

When connecting events to simple DOM elements you use standard w3c event handlers. Here is a list of the DOM events implemented in gecko based browsers.

example 1:

   1:  dojo.connect(dojo.byId('htmlElement'), ‘onclick’, myFunction);

example 2:

   1:  dojo.connect(dojo.byId('htmlElement'),'onclick',function(){
   2:      dijit.byId('myDigit').show();
   3:  });

Doing the same thing with Dijits you need to use the available methods..they have the same name but are in camel case.

onClick

onBlur

onChance

Here is a link to the dijit.form.Button for example: dijit.form.Button

example:

   1:  dojo.connect(dijit.byId('myDijit'), 'onClick', doSomething);

Related posts:

  1. Html.DropDownList and dojo.byId
  2. disable escape key in dijit.Dialog / dojo dialog
  3. dijit.form.ValidationTextBox and ASP.NET AJAX

read more

jQuery show/hide/toggle syntax in dojo

Ok, so yesterday I spent a good deal of the day trying to figure out how to manage the display of DOM elements. I searched Google, the dojo forums, the tests on archive.dojotoolkit.org with no simple answer. Coming from a heavy jQuery background I just could not believe that you had to bring in additional classes and/or write your own functions.

But dojo is a powerful beast, sometimes referred to as an elephant, so I guess I just have to “use the force…er um…power”

Desired Functions

dojo.query(‘#hide’).hide();

dojo.query(.’show’).show();

dojo.query(‘.toggle’).toggle();

WARNING: The code below is incredibly crude, it does not take into account for inline elements, there are no advanced arguments like fade or animation, and the toggle method is not fully implemented.

   1:  dojo.extend(dojo.NodeList, {
   2:      show: function(){
   3:          console.log(this);
   4:          this.forEach( item.style.display = 'block' );
   5:          return this;
   6:      },
   7:      hide: function(){
   8:          this.forEach(function(item){
   9:              console.log(item);
  10:              item.style.display = 'none';
  11:          });
  12:          return this;
  13:      },
  14:      toggle: function(){
  15:          this.forEach(function(item){
  16:              if(item.style.display == 'none'){
  17:                  //this.show();
  18:                  item.style.display = 'block';
  19:              } else {
  20:                  item.style.display = 'none';
  21:              }
  22:          });
  23:          return this;
  24:      }
  25:  });

 

PS: thanks Jayant for giving me the put to use the true power of dojo.

No related posts.

read more

Poor DOM manipulation in Dojo

In jQuery DOM manipulation is incredibly easy:

$("#dealer-toggle").toggle();

One would assume the same can be accomplished in dojo via:

dojo.query('node').toggle();

but you would be DAMN WRONG!

dojo.query will work fine but hide/show/toggle have been moved to the dojo.fx and renamed fadeOut for .hide() and wipeIn for .show()…what about toggle? no sir. There is no dojo function to toggle nods. You have to write your own.

 

ESRI

For anyone using the ESRI JavaScript Library for ArcGIS Server (a JavaScript Lib based on Dojo): ESRI created their own namespace in the API.

The ESRI namespace consists of 7 methods. I bet you can guess 3 of them.

hide

show

and of course

toggle

http://resources.esri.com/help/9.3/arcgisserver/apis/javascript/arcgis/help/jsapi/namespace_esri.htm

Wish

  1. Dojo “fixes” their query interface by using common function names. even if they are alias.
  2. Dojo adds toggle to the functions that can be acted on node lists (a node list if what is returned from dojo.query)
  3. The ESRI namespace used the same constructors as Dojo. ie: hide should be dojo.query(‘node’).hide();

Related posts:

  1. Dojo and ASP.NET AJAX Compatibility

read more

ProjectV – Enter the dojo

I’ve come to be unhappy with the jquery plugin system. I seem to be in a perpetual cycle of “lookup-download-install-initialized-use” and based on the recent milestone slippage I just don’t have the time required when the only payoff (vs. other JS libs) seems to be streamlined JavaScript package……then again aren’t all the plugins adding crazy overhead? Whatever…I’m going to use the dojotoolkit.

I love me some dojo!

No related posts.

read more

ArcGIS Server 9.3, REST and Cache

After publishing a service if you make changes to the .MXD you need to clear the REST cache. There are a few ways to clear the REST cache:

  1. Restart IIS – Super Easy
  2. From the ArcGIS 9.3 REST admin page

Until you restart IIS the updates to the MXD will not be reflected in the REST service endpoint.

No related posts.

read more

LINQ – Update Row – Primary Key

LINQ requires all tables that you work with to have a PK. If you don’t have a PK on a table you can use the designer to set a PK on the generated code. This won’t effect your database.

  • In Visual Studio open the LINQ Designer.
  • Select a row you would like as your PK and select properties.
  • Update the “Primary Key” Property.

No related posts.

read more

dijit.form.ValidationTextBox and ASP.NET AJAX

Don’t seem to play nice.

It seems that both call create a function called … Number.function and error out when used together.

Error:

[Exception... "'Sys.ParameterCountException: Sys.ParameterCountException: Parameter count mismatch.' when calling method: [nsIDOMEventListener::handleEvent]" nsresult: "0×8057001c (NS_ERROR_XPC_JS_THREW_JS_OBJECT)" location: "<unknown>" data: no]

 

Solution:

Don’t use ASP.NET AJAX if your using the vastly superior Dojo Toolkit :)

Related posts:

  1. Dojo and ASP.NET AJAX Compatibility

read more