"Black Swan Ponds" that represent
where ≥3σ Events Occur Link to Viz
One of the things I had wanted to do with this was to somehow incorporate Nassim Taleb's "Black Swan"
notion. Specifically, convey the regions in which Black Swans "could occur." In the narrow context used here, Black Swans have to do with events that - relative to Gaussian/"standard" assumptions at least - are at some number of standard deviations away from the mean. I don't know if there is an agreed upon number of standard deviations away that represents a Black Swan, but I came across a few
notes that indicated that three standard deviations seemed to be about where this starts.
So, for the purpose of this effort, I used three standard deviations from the stock price's mean to be the boundary of the Black Swan regions. Each of these regions is referred to here as a "Black Swan Pond." The distribution of stock price is assumed to be based on geometric Brownian motion, with parameters from the initial stock price, the volatility, and time-to-expiration.
Success! Perhaps naïve and a bit crude, but it is something that seems to work so far.
As part of playing with StrongLoop's Loopback framework, I am also beginning to learn about Angular via Loopback's examples. Today, I ran into needing to do something pretty basic in Angular, and it seems to be a bit harder to do than I expected... at least to someone very new to it.
The feature in question is the ability to pass parameters/info into a modal popup. The scenario is when you have a list of stuff, and you want to show a popup when the user clicks on one of the elements in the list, say for a confirm delete or something.
Anyone who has a list of stuff the user will interact with will need this feature, and so that's why it surprised me that it wasn't quite as straightforward as I anticipated.
Well, not straightforward to someone as new to Angular as myself.
UI Bootstrap - Bootstrap components from the AngularUI Team
You have an html list where each row has some attributes unique for a row (id, etc.); here is a snippet in Jade syntax (N.B. The diminished clutter of writing and reading Jade for html is a pleasure, imo):
We want a styled popup specific to the row clicked
In your html file, define a script defining a template for the modal popup - here is a stripped-down one (yes, that's "raw" html inside the script tag):
Referencing the UI Bootstrap stuff so it can be used
In the controller javascript (and I am assuming this is in definition of the controller that is used for the list), define the controller for the popup:
var PopUpController = function($scope, $modalInstance, name,id) {
$scope.name = name;
$scope.doDelete = function() { // this is the function called when the user
// user clicks the "Yes Delete File" button
$modalInstance.close({doDelete:true, id:id}); //this gets passed back to
// the code that created the popup
};
$scope.cancel = function () {
$modalInstance.dismiss('cancel');
};
};
Defining the controller for the modal confirmation popup
In the relevant controller for the list, define the function openConfirmDelete that will make use of both the script template and the PopUpController:
...).controller('FilesController',
function ($scope, $http, $modal) {
$scope.openConfirmDelete = function (name,id) {
var modalInstance = $modal.open({
templateUrl: 'myModalContent',
controller: PopUpController,
resolve: {
name: function() {return name;}
id: function () {return id;}
}
});
});
modalInstance.result.then(function (opts) {
if (opts.doDelete === true) {
//you are now free to deal with the file/whatever,
// as you will be able to get the id from opts.id
// e.g, delete(opts.id);
// Note: as "id" is in a closure, I'm not sure it
// is necessary to pass it back here, but
// this shows how to pass anything back
}
},
function () {console.log('Modal dismissed at: ' + new Date());}
}); // modalInstance.result
}; // openConfirmDelete
...
...
}); //FilesController...
The final piece: creating the popup when
the user clicks the "Delete" button on an item in the list
I have been experimenting with different ways to appreciate the simple but ubiquitous
Quicksort algorithm.
My first project dealt with visualizing how the "divide-and-conquer" process works,
as described here.
The one here delves a little into the partitioning process of the algorithm, in an experiment by which
the web audio api is used to sound notes/chords at certain times in the partitioning process. It is a work-in-progress, and apparently sounds different on different browsers. Chrome on the desktop works OK, but Chrome on my Nexus 7 plays the C chord with an odd buzz, as does Safari on the desktop.