Sunday, March 21, 2010

Fast Apex XML DOM updated with 3 new Node APIs

Today I was done with coding the 3 important missing API’s in Fast Apex XML DOM’s TODO list. The latest code is checked into Google Code SVN. Following are the newly added API’s to TG_XmlNode.cls

  • appendChild()     Adds a new child node to the end of the list of children of a node
  • cloneNode()      Clones a node 
  • getElementsByTagNameNS() Returns element for node’s local name and namespace

    Regarding TODO’s, moving forward my prime motive is to write quality docs to best use this API. Even I am planning to add docs for the Spring 10 Apex DOM classes, as the salesforce documentation is not having good samples and clear descriptions of the APIs.

    For more details on Fast Apex XML DOM’s TODO check this page. Its updated for these recent changes.

  • References:

    Wednesday, March 17, 2010

    Secure yui combo service (Over HTTPS)

    YUI Dependency Configurator is a great tool for getting a single unified JS or CSS instead of several css/js files. Only problem with that is it doesn't works over "HTTPS". Browser's like Internet Explorer fail to load a web page delivered over HTTPS containing JS/CSS delivered over un-secure(HTTP) URLs.

    The good news is that YUI team left a great possibility to change the combo base for service. “Combo base”  is basically YUI combo service base dir. Ex: “http://yui.yahooapis.com/combo?”.

    New Secure YUI Combo Service

    So I decided to use this possibility and I created a  Secure YUI Combo Service. This service is a secure wrapper over the existing YUI combo service i.e. for every combo service request it delegates the call to original YUI combo service and returns the response back.

    Following are some highlights of this service:

    1. It uses the high speed internet provided by Google, its hosted over “Google App Engine”.
    2. Its Open source on “New BSD License” and is hosted Google Code, here.
    3. Its support 3 HTTP METHODS i.e. GET OPTIONS HEAD. It also returns the same response headers as of Original YUI Combo Service. So browsers might make use of intelligent caching.
    4. The same service works with both YUI 2 & 3.

    Service Environment

    • Service Combo Endpoint :  https://yuicombo.appspot.com/combo?
    • Service Implementation : Its a J2EE Servlet.
    • Service Hosting : Hosted @ Google App Engine.
    • Service Dependencies: Apart from being a Servlet, its pure Core Java Code. So no dependencies on any jar or library, not even Apache Http Client.

    Developers - Getting Started Guide

    All the details regarding setup and testing this service over HTTPS are available in this here.

    Note for force.com developers

    Force.com developers creating visualforce pages using YUI v2/3 face the same problem in Internet explorer i.e. force.com servers deliver content over HTTPS and YUI combo service is not available yet on HTTPS. Rest all browsers are pretty nice with unsecure YUI Combo Service. So this service can be useful for all visualforce developers using YUI. Internet Explorer is a huge pain but we can’t avoid it :-)

    References

    Tuesday, March 16, 2010

    Secure YUI Combo Usage Guide

    This post explains how to transit from unsecure (HTTP) based YUI combo service to Secured(HTTPS) based Combo Service. Making this transit to this secure YUI Combo service is pretty simple. This process requires you to just do 2-3 string replacements in your existing yui application, these replacements are:

    1. Load YUI minimal JavaScript? file via this secure service.
      <-- Change following script include -->
      <script src="http://yui.yahooapis.com/3.0.0/build/yui/yui-min.js"></script> 
      <-- replace it with this one -->
      <script src="https://yuicombo.appspot.com/combo?3.0.0/build/yui/yui-min.js"></script> 
    2. Change the configuration options for YUI Loader, to specify “comboBase” attribute pointing to this service.
      <script type="text/javascript"> 
      YUI({combine: true, timeout: 10000, comboBase : 'https://yuicombo.appspot.com/combo?'}).use("overlay", function(Y) {
      // ... your same post YUI modules load code
      // ... will go here
      }
      </script> 
    3. Load any additional YUI CSS via this service.
      <link type="text/css" rel="stylesheet" href="https://yuicombo.appspot.com/combo?3.0.0/build/cssfonts/fonts-min.css" /> 

    Live Code Samples

    Some of YUI-3 live samples are copied and updated to use this secure service. Here are the links to these samples

    USAGE NOTE !

    The secure YUI Combo Service URL (https://yuicombo.appspot.com/combo?) is hosted over Google App Engine. It uses the free quota of app engine, so this is not production ready for you, its just for demo !

    So feel free to test if it works for you using this service, Google app engine has decent limits on free quota. So I am sure I can at least demo it from there :-)

    Production Usage: All the code for this service is available on this googlecode project. To use it in production environment, check out the code for this Java web-app and feel free to host it on your own app engine instance or existing java servers. The code is purely Core Java Implementation + Servlets. 

    In case of queries regarding hosting or deploying this code to your App Engine or Java Server instance please let me know.

    Thursday, March 11, 2010

    Force.com Spring 10 IDE not available till now ?

    Force.com IDE was supporting upto Eclipse Ganymede(3.4) only. Spring 10 announced enhancement to Force.com IDE with plug-in for Eclipse Galileo. That was an exciting news to me, because I have to use two eclipse versions right now, Ganymede for force.com and Galileo for rest of Java stuff. Once this Galileo plug-in for Force.com is out, I can seamlessly move to single eclipse version.

    But I am surprised to see the delay in releasing this new Force.com IDE for general use. The website says it will be available by 15th Feb.

    Its 11 March today. Almost a month late, Force.com release team where are you stuck ??  Spring is about to end, summer has already started, please hurry up guys !