Posts

Showing posts from April, 2016

Preparing for CSS grids

Image
I was just listening to "The Web Ahead" podcast where they were talking about the upcoming CSS grid system. If you can spare the time, go and take a listen (episode 114). Upcoming in the sense that there is a spec, but it's not yet mainstream - you can enable it through a flag in WebKit based browsers; use Firefox nightly (e.g I'm on Chrome 51 and it seems to be available). So you can't use it in your production applications just yet - soon'ish. So, to get started (if using Chrome), you will want to enable experimental web platform features: You can see the current working draft here -  https://www.w3.org/TR/css-grid-1/ It's worth taking note of the motivation behind this. If you look for CSS layouts, you will see a bunch of solutions (probably involving floats) but using techniques not really designed for a full page layout. Let's get started making a grid. The containing element should have a display property of either grid or inline-grid.

Understanding variable scope

Image
In APEX, we have two primarily languages we would tend to work with: PL/SQL JavaScript So, it's worth being aware of how variable scoping works in any program units you are developing. If you don't already know it, JavaScript has function level scope, rather than block level scope. If you come from C-based language, and declare a variable inside a for loop, for instance, you would not expect that variable to live on outside of the loop. This is not the behaviour of JavaScript, so let's give this a test to see: When the variable i is declared, it is actually hoisted up to the to the top of the function. If you added a statement to the top of the function referencing i, i would have the value of undefined rather than a ReferenceError about using an undeclared variable. No matter where a variable is declared in JavaScript, it is hoisted to the top of the containing function - something to be aware of. That's why you will often see JavaScript pr

The making of my APEX competition dashboard map

Image
The other day, I submitted my entry into the APEX dashboard competition. It was interesting, as I had never done any projects with map visualisations so gave me the opportunity to learn a little on the topic - now that I've submitted my entry and my demo is set up, I think it's time to share what I learnt along the way. First of all, GovHack (Australia) has this article on all things maps -  http://govhack-toolkit.readthedocs.org/technical/making-maps/ . So, having read that, I decided D3JS was the way forward. I managed to find a sample of a German map set up using this library (D3JS and topoJSON) -  http://bl.ocks.org/oscar6echo/4423770 . It uses a JSON file that contains all the data points to render all the data, but I had no clue how this data was obtained/generated just from that example - so I kept digging. Which led me onto this great article, which pretty much takes you step by step on drawing the map components:  https://bost.ocks.org/mike/map/ - and importantly