Sunday, August 24, 2014

The potential of Enterprise Service Busses: First Impressions

In the past month or so I had my first real exposure to an Enterprise Service Bus (ESB), and I decided to write down my experiences in order to get my thoughts lined up.

First of all we may ask ourselves what an ESB is. From what I could tell, it is a piece of software that is used to connect various systems that have been developed in isolation in such a way that they form a product that is greater than the sum of their parts. So, for example, it would be possible to connect an accounting system to a stock tracking system in such a way that new stock is automatically ordered when stock runs low.

Neither the stock tracking nor the accounting system needs to know about each other, they must just implement some commonly acknowledged standards that allows them to communicate with external systems.

This is what sets ESB based integration apart from normal systems integration. In normal systems integration, the systems integrating with each other must know each other and in most cases are designed for each other, or at least one system is designed for the other.

It seems that there is a lot of potential for Enterprise Service Busses to move into a space that was previously occupied by traditional client/server technology. It is, for example, possible to hit a REST interface exposed in an ESB from a website. Therefore the ESB takes over the traditional role of the server in the client/server architecture. It should be possible to create entire systems by just writing stored procedures on a database for the back-end and HTML/JavaScript/CSS for the front-end. These systems will have not necessarily have Java or C# components.

Saturday, July 12, 2014

Interesting Times

Usually I keep away from political and economic topics on my blog, however I think the time has come to make an exception. I need to mention, that for the record, in the past 6 months to a year, something has gone wrong in this country, and I do not know what it is.

Suddenly, consumer products have become a lot more expensive. They have not become more expensive in the normal sense of inflation, but in the sense of hyper-inflation. And this is a bad thing. A very large percentage of the population lives in poverty: The world bank puts the figure at around 23% (see http://data.worldbank.org/country/south-africa) I do not know how these people will cope with this increase in prices.

As to what caused this, I can only speculate. In the last year, the following notable things happened:
  • We had an election
  • The e-Toll system was activated
  • There was general strikes in our mining industry
What I don't understand is how these factors could have such a huge impact on prices. Other countries also have elections and toll systems but do not undergo hikes in prices. We had strikes in South Africa for years, but not price increases on the scale what we are seeing them now. 

So I am out of ideas. If I have to speculate, I would have to guess that some large organization somewhere has made a decision that had a massive impact on our economy.

Sunday, May 25, 2014

Loading and displaying a Blender model in Three JS

I recently had this strange urge to create a web based strategy game. So I decided to check out Three JS and scrape together some code from all over the Internet to render a 3D box. (Yes, the one you see right after installing blender ... :-)

I uploaded the results of my efforts here: http://www.coffee-smudge.com/strategy1/

The end result looks like this:

End result of my rendering efforts. Not quite a strategy game yet ... 

In order to make this I had to follow these steps: (after browsing the references and examples ... see code sample)
  1. Download Blender version 2.67
  2. Get the Three JS git repository. It is here: https://github.com/mrdoob/three.js/
  3. The git repository contains a Blender Exporter with some installation instructions. Get it here: https://github.com/mrdoob/three.js/tree/master/utils/exporters/blender
  4. Export the 3D model. This will give you a JSON file that can be loaded using Three JS. As far as I can tell it must be hosted to be loadable.
  5. Load it: I used this JavaScipt Code:
    //References:
    // $(Github)\three.js\three.js-master\three.js-master\examples\misc_controls_orbit.html
    // http://math.hws.edu/eck/cs424/notes2013/threejs/json-loader-demo.html
    
    var container, stats;
    var camera, controls, scene, renderer;
    
    
    var render = function render() {
    
      // NB: Uncommenting this makes it slow
      //requestAnimationFrame(render);
    
      renderer.render(scene, camera);
      stats.update(); 
    }
    
    var resize = function () {
      camera.aspect = window.innerWidth / window.innerHeight;
      camera.updateProjectionMatrix();
      renderer.setSize(window.innerWidth, window.innerHeight);
      render();
    }
    
    var modelLoadedCallback = function (geometry, materials) {
      try {
        for (var x = -20; x < 20; x++) {
          for (var z = -20; z < 20; z++) {
            var object = new THREE.Mesh(geometry, new THREE.MeshFaceMaterial(materials));
            object.position.set(x * 5, -5, z * 5);
            scene.add(object);
          }
        }
        render();
      }
      catch (err) {
        alert(err);
      }
    }
    
    var loadModel = function () {
      var loader = new THREE.JSONLoader();
      loader.load("model/cube.js", modelLoadedCallback);
    }
    
    var loadLight = function () {
      // Specular + diffuse
      light = new THREE.DirectionalLight(0xffffff);
      light.position.set(0, 5, 0);
      scene.add(light);
      // Ambient
      light = new THREE.AmbientLight(0x222222);
      scene.add(light);
    }
    
    var init = function () {
      if (!Detector.webgl) {
        Detector.addGetWebGLMessage();
        throw "No WebGL detected!"
      }
    
      renderer = new THREE.WebGLRenderer({ antialias: true });
      renderer.setClearColor(0x000022, 1);
      renderer.setSize(window.innerWidth, window.innerHeight);
    
      // Load content
      scene = new THREE.Scene();
      loadLight();
      loadModel();
    
      container = document.getElementById( 'container' );
      container.appendChild( renderer.domElement );
        
      camera = new THREE.PerspectiveCamera(60, window.innerWidth / window.innerHeight, 1, 1000);
      camera.position.z = 5;
    
      controls = new THREE.OrbitControls(camera);
      controls.addEventListener('change', render);
    
      stats = new Stats();
      stats.domElement.style.position = 'absolute';
      stats.domElement.style.top = '0px';
      stats.domElement.style.zIndex = 100;
      container.appendChild(stats.domElement);
    
      window.addEventListener('resize', resize, false);
      window.addEventListener('error', function () {
        alert("error!");
      }, false);
    
      render();
    }
    
    window.addEventListener('load', init, false);