Category Archives: Server

Phil 5.22.14

8:00 – 5:00 SR

  • Traffic was terrible today. Wonder what happened.
  • DB Backups
  • Updated viztool hours.
  • JavaScript
    • Moving dprint entirely to the WebGLCanvas
    • Extending WebGLCanvas to WebGLNetworkCanvas. Interesting. It turns out that you have to have the path to the module declared in the YUI({/*declare path to parent info here*/}).use(/*but parent doesn’t have to be here*/, function(Y){});  section of the root page. Done.
    • Extending WebGLComponent to WebGLNetworkComponent – done!
    • Changed the typestring to be a read-only attribute.
    • After changing the shapes in the extended WebGLNetworkComponent to spheres, I discovered that the reflections had been getting rendered wrong. I went back to the source material and found this example, and reworked the canvas and component base classes. THis means that we don’t get intra-object reflections, but that should speed up performance anyway. Since the skybox is actually rendered now in another THREE.Scene, I can now render reflections independently of the skybox.
    • Needed to get rid of the “skinnable” part of the WebGLNetworkCanvas and the associated css files to make it so that the 3D scene could be rendered over the HTML image background.

Phil 5.21.14

8:00 – 5:00 SR

  • get a new libeay32.dll for the servers. Actually, I fixed it from a newer version of xampp that failed to install correctly. Since we’re not using Apache anyway, this is kind of pro-forma.
  • Deployed new FA
  • Worked up the viztool task hours. So far with 3 of the 16 tasks complete, we spend 20% on-site, 35% directed to tasks not on the list, and 45% on listed tasks. No hours from don on several days though (and no log on 5-15), so this is tentative.
  • WebGL
    • Integrating lines into WebGLComponent – done. Can’t make dashed lines though…
    • Looking at the YUI ShapeManager module from before, and I just realized that things would probably be better if it could extend the current WebGLCanvas. So I’m adding the private local variables to the prototype. Done

Phil 5.15.14

8:00 – 4:00 SR

  • DB backups
  • Saving queries in query builder should be managed in roles. Publishing should only be Admin
  • Monthly status report dropdown should be disabled
  • financial status data in role management isn’t allowing people to open projects from “Project Management” panel
  • Wrote up a SR justification for Brad.
  • JavaScript
    • Add optional font, color and size for canvas2d labels, since they seem to be *way* faster. Done.
    • Fix registration on tooltips/html labels WRT parent div – done
    • Next is to do some varying lines so that we can connect the shapes. Come to think of it, it’s kind of nice that we have world position for everything….

Phil 5.14.14

8:00 – 4:30 SR

  • DB Backups
  • JavaScript/WebGL
    • Starting on tooltips.
    • Extended draw2D for each WebGLComponent that calculates the screenXY for the 3D object origin. Added a behavior2D to handle things like HUDS.
    • Got HTML overlays tracking as well, though they are not taking into accordance the parent’s position.
    • Overlay labels really chew up CPU. Use the Canvas2D labels by default, I think….

Phil 5.13.14

8:00 – 5:00 SR

  • site 8:00 –
  • DB backups
  • Fixed a post-process query by changing null to zero
  • re-ran the charts. 2014 data looks much better.
  • Fix Querybuilder –
    • obligation_goal_percent
    • dropdown is not showing current month.
  • Add RQ(?) rule to ignore obligations where the only difference is the date. Add appropriations to missing columns or data or so, um. we can map it later.
  • Javascript
    • Adding matrix (or maybe a whole object3d?) for the local geometric frame. Object would be easier if you don’t have to add it to the scene to get the correct matrix information structure.

Phil 5.12.14

8:00 – 5:30 SR

  • 8:00 – 11:00 on site
  • DB backups
  • Deployed new RQ
  • Went over the time estimates with Lenny. The upshot is that we will track actual hours worked on the line items.
  • Fix the requisition_id AS funded_budget in __view_monthly_obligations_by_req_id error.
  • I think I may have found the issue that’s keeping the new object from setting the values that are actually used to draw?
    • It’s possible that the matrix is being reset after the update function, with the setPosition calls overriding the matrix.
    • This thread shows how to get position and orientation from the 4×4: http://stackoverflow.com/questions/15079294/inverse-of-object3d-updatematrix-in-three-js
    • Finally figured out the problem. I have the matrix that is in GLOBAL space. I need a matrix that is in local space that I can then multiply by the parent’s matrix. That should work. And it did! Need to verify that stacked objects will behave.
    • They do – after a fashion. The scale information is embedded in the matrix and is applies to all children. Somehow, this is messing with the scale if it is mixed with a rotation. Is it possible matrix.decompose is broken?
    • Well, kind of. From Euler.js setFromRotationMatrix(): // assumes the upper 3×3 of m is a pure rotation matrix (i.e, unscaled). So don’t scale on the transform matrix. Instead, scale the position of the points that make up the object in the local space. This means I may have to look at immediate mode or at least see how the geometry is stored in the object. Or only scale the objects that are the leaf nodes in a tree. That should actually be OK for charts.
  • Starting tooltips and text overlays: http://stackoverflow.com/questions/11586527/converting-world-coordinates-to-screen-coordinates-in-three-js-using-projection. Also example 6-3 from the webgl book (pg 115).
  • Got Hello, World rendered over the two canvases, styled and everything :-).

Phil 5.9.14

7:30 – 5:00 SR

  • DB backups
  • Deploying new Reqonciler
  • Created svn-based stats on development for productivity discussions with Chris. Also generated stats for 2013 for review.
  • Look into picking and reflection map issues. I think the picking problem is that the search does not recurse down the sub-model branch, though the THREE model info is there (Also need to make sure that the model reference is added to user data and that it’s accessible). The reflection is hopefully tied to the recalculation of the reflection camera position that was commented out in the draw function while I was still chasing down the “too much recursion” error.
  • Nope, neither solution worked. I’m thinking that I can have parents/child relations based on just WebGLComponenets. Update sets the positions based on the parent’s model matrix, but the actual object3D hierarchy is flat. That should fix both problems.
    • WebGLCanvas.addModel will also set a WebGLCanvas reference attribute in the WebGLComponent. The component will then look to see if it has any children and also set their canvas if it’s not null. If the canvas is null, then the child will add its object3d to the canvas’ scene
    • Calling addModel on a WebGLComponent will cause the child to add its object3d to the canvas’ scene if the scene is not null.

Phil 5.8.14

8:00 – 2:00 SR

  • DB backups
  • Walked through the outlay problem with Dong and Lenny
  • Worked out estimates for new VizTool requirements. It comes up to 500-1,000 hours of work.
  • Showed dong the new YUI architecture. The switch to direct function declaration seems to have had a good effect on how I expect closure to work, so I’m happy.
  • Adding hierarchical model capability to WebGLComponent. Nope, picking isn’t working in 2D. Need to fix that first. Ok, fixed.
  • Added hierarchy. There is some funny stuff that’s going on WRT data being shared across instances. Local variables (inside the  YUI.add({}) scope are definitely shared. I was expecting that. But it also appears that variables created in the Y.Base.create() scope are also shared. I ran into this problem when I was adding the models array to WebGLComponent. The way around it was to add to the ATTRS: {} object. That’s ok, but I’m still confused…
  • Also, picking and reflection maps don’t work on sub-objects.
  • Oh yeah, and for reference, this is the kind of charts I want to start trying to draw next week:

Phil 5.7.14

8:00 – 5:00 SR

  • DB Backups
  • Fix __view_monthly_obligations_by_contract so that requisition_id’s with different po_reference show up in “unclaimed”
  • Fix funded_budget to requisition id on two views.
  • Refactoring!
  • Change the this.set() functions (or at least the strings) to variables (i.e _ATTR_FOO = ‘foo’); possibly using a factory pattern? (from https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Closures). Yep, that worked just fine.
function makeAdder(x) {
  return function(y) {
    return x + y;
  };
}

var add5 = makeAdder(5);
var add10 = makeAdder(10);

console.log(add5(2));  // 7
console.log(add10(2)); // 12
  • Try moving function declarations below prototype and removing predefinitions.
  • Add skybox argument
  • Everything is pretty much completely refactored. I think this is more clear and less error-prone. It looks exactly the same, but is remarkably different under the skin.
  • Next is hierarchical models.

Phil 5.6.14

9:00 – 5:00 SR

  • Db backups
  • Updated Java on the servers
  • Installed Dong’s new views. Lenny’s testing. There are some issues that he’s noting in an email. It appears that all the old data that were deleted are back, but none of the new data is visible.
  • Edit task list to provide hours.
  • More picking
    • Unitizing the mouse position worked
    • Changing userData to a pointer to the model and using the name field.
    • Done. That was not too bad!
  • Adding reflection maps
    • Added skybox to canvas
    • Added reflections. Going to try for a shiny textured earth tomorrow, then maybe some dragging?

yuiWebGl

Today’s progress.

Phil 5.5.14

8:00 – 10:00, 12:00-4:00 SR

  • DB backups
  • Major debugging deployment
  • 2D and 3D picking. Slow-ish going. The first ‘naive’ attempt didn’t work. Making the mouse x,y unit values that go from -1.0 – 1.0, which I think it the problem. Hit detect does work as expected for 0, 0 – which makes this seem reasonable.

Phil 5.1.14

8:00 – 5:00 SR

  • DB backups
  • Deployed the rest of RQ
  • Status Report!
  • Some weird problem where Dong’s code is (possibly) throwing an exception while reading properties. Maybe put some command-line diagnostics in the main?
  • JavaScript
    • Show/hide stage – done
    • Ortho2 – done
    • Reflection maps
    • Simple physics
    • Model loading

yuiWebGl

Today’s fun

Phil 4.30.14

8:00 – 5:00 SR

  • DB backups
  • Deploy new RQ – or at least most of it…
  • Got the list of desired enhancements. Need to assign hours.
  • JavaScript
    • Threejs examples
    • Work on making a YUI module that extends WebGLComponent – Done!
    • Added three.js loading capability. Easy!
YUI({
        groups:{
            threejs:{
                base: './libs/',
                async: false,
                modules: {
                    'threejs': {
                        path: 'three.js'
                    }
                }
            },
            localModules:{
                base: './BasicBaseElements/',
                modules: {
                    'WebGLCanvas': {
                        path: 'WebGLCanvas/js/WebGLCanvas.js',
                        skinnable: true
                    },
                    'WebGLComponent': {
                        path: 'WebGLComponent/js/WebGLComponent.js',
                        skinnable: false
                    }
                }
            }
        }
    }).use('threejs', 'WebGLCanvas', 'WebGLComponent', 'panel', 'dd-plugin', function (Y) {...});
  • Ok, now to inheritance
  • To inherit in YUI, it looks like all you have to do(?) is to use Y.Base.create, and specify the component that you are extending. Here’s how it looks:
YUI.add('WebGLSphere', function (Y) {
    "use strict";

    // handy constants and shortcuts used in the module
    var _LANG = Y.Lang;
    var _NAME = 'WebGLSphere';



    // publish the global prototype
    Y.WebGLSphere = Y.Base.create(
        _NAME, // the name of this module (for debugging
        Y.WebGLComponent, // the class we are extending (can be Widget too)
        [], // any extensions that we want to properties or methods (e.g. ArrayList)

        // Instance members are the properties and methods that go into the class prototype, those that
        // each instance will get a copy and usually need to be references by 'this'
        {
            // prototype variables

            // prototype methods

        },
        //  Attributes - accessed through this.get('attrName') and this.set('attrName', value).
        // Note that we can do "type" checking here with validators
        {
            ATTRS: {
		myValue:{
			value: 1.0
		}
            }
        }
    );

}, '0.1', {
    requires: ['WebGLComponent'],
    skinnable: false
});

In this case, the module I’m creating is Y.WebGLSphere. I am extending it from Y.WebGLComponent. In the code above, it does nothing. Next, I’m going to override the initModel function to create a sphere and the initializer to take a jpg to use as a texture.

yuiWebGl

Phil 4.29.14

8:00 – 4:00 SR

  • DB Backups
  • Breaking out models from the scene. Figuring out what parts of THREE.js were needed to work took a bit of time but the results are good.
  • Had a lot of trouble with “this” today. The lesson learned is that when a locally declared function is called from outside the class, there is no “this”. To get that to work you have to have the function AND the variable referenced in the prototype. If the variable is a reference, then it appears that you can get away with declaring it locally, but what really seems to be happening is that the same reference is being shared “globally” across all instances. If the variable is declared in the prototype, it’s unique. Here’s all of WebGLComponent. Note that mesh and dprintArray are declared in the prototype:
YUI.add('WebGLComponent', function (Y) {
     "use strict";

     // handy constants and shortcuts used in the module
     var _LANG = Y.Lang;
     var _NAME = 'WebGLComponent';

     // private variables



     // private function predefinitions. We can "publish" them at the end of this object
     var _initializer;
     var _initModel;
     var _setPosition;
     var _setScale;
     var _update;
     var _dprint;
     var _dshow;

      // private function definitions

      /* The initializer method has several tasks. First, it should set any properties that need to be
      initialized to objects or arrays. Then it will publish all the events this class will produce.
      the cfg object is an arbitrary object such as {myValue:321, foo:'bar'} */
     _initializer = function (cfg) {
         //Y.log("--->The following config object was passed into the RemoteDataChart initializer.'"+cfg.myValue+"'");
          this.dprintArray = new Array(100);
          this.dprintArray.length = 0;
          if (cfg.hasOwnProperty('objName')) {
              this.set('objName', cfg.objName);
     }
     if (cfg.hasOwnProperty('timeScalar')) {
          this.set('timeScalar', cfg.timeScalar);
     }
     this.initModel();

     };


     _initModel = function () {
          var geometry = new THREE.CubeGeometry(1, 1, 1);
          var material = new THREE.MeshPhongMaterial({color: 0xFFFFFF});

          var mesh = new THREE.Mesh(geometry, material);

          this.set('object3d', mesh);
          this.mesh = mesh;
     };

     // setPosition - move the object to a new position
     _setPosition = function (x, y, z) {
          if (this.mesh) {
             this.mesh.position.set(x, y, z);
          }
     };

    //setScale - scale the object
     _setScale = function (x, y, z) {
     if (this.mesh) {
         this.mesh.scale.set(x, y, z);
     }
     };


 _update = function (elapsed) {
          var rate = this.get('timeScalar');
          var angle;
          if (this.mesh) {
              this.mesh.rotation.x += rate * elapsed;
              this.mesh.rotation.y += rate * elapsed;
              this.mesh.rotation.z += rate * elapsed;
              angle = this.mesh.rotation.x;
              this.dprint("angle = "+angle.toFixed(2));
          }
 };


 _dprint = function(str) {
          this.dprintArray.push(this.get('objName')+": "+str);
 };

 _dshow = function(dpa) {
          var i;
          for(i =0; i < this.dprintArray.length; i++){
              dpa.push(this.dprintArray.shift());
          }
          this.dprintArray.length = 0;
 };

 // publish the global prototype
 Y.WebGLComponent = Y.Base.create(
      _NAME, // the name of this module (for debugging
      Y.Base, // the class we are extending (can be Widget too)
      [], // any extensions that we want to properties or methods (e.g. ArrayList)

          // Instance members are the properties and methods that go into the class prototype, those that
          // each instance will get a copy and usually need to be references by 'this'
      {
         // prototype variables
          mesh: null,
          dprintArray: null,

          // prototype methods
          initializer: _initializer,
          initModel: _initModel,
          update: _update,
          setPosition: _setPosition,
          setScale: _setScale,
          dprint: _dprint,
          dshow: _dshow
 },
 // Attributes - accessed through this.get('attrName') and this.set('attrName', value).
 // Note that we can do "type" checking here with validators
 {
          ATTRS: {
              timeScalar:{
                  value: 1.0
              },
              objName:{
                  value: "unset"
              },
              object3d:{
                  value: null
              }
          }
     }
 );

}, '0.1', {
 requires: ['base-build', 'node', 'event'],
 skinnable: false
});

Phil 4.28.14

8:00 – 5:00 SR

  • DB backups
  • Lenny’s making progress in as our new security guy
  • Need to fix the appropriation year calculations in the fake data generator. Done
  • Need to build a YUI template and store it off as a complete project. Done, but I spent a while running in circles trying to get resize to work on the YUI panel. It turns out that you have to enable resize on the node the panel points at. So the code kind of looks like this:
 // If we want to make the panel resize, we have to manipulate the srcNode.
 // This must be done before the Panel is created
 var n = Y.one("#topNode");
 n.plug(Y.Plugin.Resize);

 var panel = new Y.Panel({
     srcNode : n,
     x :200,
     y :100,
     headerContent : 'A Panel containing a widget',
     plugins : [Y.Plugin.Drag]
 });
 panel.render();
  • This also requires that the style for the div have the position: relative property set. Here’s how it’s done in this example:
.topNode{
     position: relative;
     width:800px;
     height:640px;
     background: #bcbcbc;
     overflow: hidden;
}
  • I then spent a while seeing if typescript could be integrated, but it and YUI are really two very different patterns.
  • Working on the WebGL container
    • Set for 2D/3D
    • use defaults (ambient/directional light, perspectives, etc)
    • Show/hide stage
    • Add models. Looking at the code, the cube is currently added as a mesh to a scene. Need to look into how to break that apart. Going to start with the “interaction-simple.html” code from the webgl book and try adding the cube in as a model first.