Cesium 3D model translation

If you’re using the primitive API rather than the entity API then you do not have easy access to the orientation parameters. It’s possible to do all this from scratch, but it’s hard work…. var getModelMatrix = function(lon, lat, rotationZ) { // 1) create a translation position matrix var posMat = Cesium.Transforms.eastNorthUpToFixedFrame(Cesium.Cartesian3.fromDegrees(lon, lat)); // 2)… Continue reading Cesium 3D model translation

Responsive 2D table

For WeatherSupermarket I need to layout a grid forecasts for five days for up to six providers, Met Office, AccuWeather etc. I have the providers vertically, each with the location, and a dropdown box to change the location. The days are laid out horizontally. This has always worked fine for Desktop browsers with plenty of… Continue reading Responsive 2D table

Assorted IE8 polyfills: forEach, trim, placeholders

I ended up using all of the following during recent development of weathersupermarket 2.0 and another site. Array.prototype.forEach() implemented using a for loop and fn.apply if (typeof Array.prototype.forEach !== ‘function’) { Array.prototype.forEach = function(callback, context) { for (var i = 0; i < this.length; i++) { callback.apply(context, [ this[i], i, this ]); } }; }… Continue reading Assorted IE8 polyfills: forEach, trim, placeholders

Jasmine 2.0 + RequireJS + Blanket + Backbone

Jasmine 2.0 provides a JavaScript unit test framework, RequireJS provides a dependency modelling/loading and Blanket provides native in-browser JavaScript code coverage – no need for a coverage server etc. So why not use all three together, well, it’s kind of tricky and kept me busy all evening. I’m going to provide a small but scalable… Continue reading Jasmine 2.0 + RequireJS + Blanket + Backbone

JavaScript debug with Chrome / Eclipse

/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome –user-data-dir=$(mktemp -d /tmp/chrome-profile-XXXXX) –remote-debugging-port=9222 Add this update site http://chromedevtools.googlecode.com/svn/update/dev/

Scrolling waterfalls in HTML5

A number of technical domains use scrolling data displays, like the COTS octopus-760 sonar system. A typical implementation would involve a cyclic buffer (BufferedImage, pixmap etc) and two paint operations for efficiency. The means data can be inserted cheaply without the need to move the existing data. For example, this is what a cyclic buffer… Continue reading Scrolling waterfalls in HTML5