Archives / 2016 / February
  • How to call method of AngularJS controller outside of AngularJS in javascript

    Hello everybody,

    today I want to write few words about AngularJS and js integration.

    Recently I had opportunity to cowork with one guy, which is great in knowing javascript, but absolutely hates to learn and apply AngularJS. So, I had task in front of me, to give him sone kind of JS object, which he can use in order to execute some method of AngularJS controller.

    So I had some AngularJS controller. 

    here is the fragment of it:

    'use strict';

    var controller = 'toolBoxController';



        .controller(controller, TbController);//register

    Then I've added class ( in terms of javascript ):

    (function (window, undefined) {

        function toolBoxObject() … more

  • Pearsons corelation

    Hello everybody,

    today I want to write how to calculate Pearson correlation, or r.

    here is the formula:


  • Trivial implementation of File uploader

    Hello everybody,

    today I want to share with you fragment of code of html extension.

    Imagine that you edit your cshtml file, and see following code:

    @Html.EditorFor(model => model.SomeField

    Then you need to add some file upload and notice, that there is not file upload! 

    How can you fix this situation?

    I propose to use HtmlExtension code. For example like this:

    public static MvcHtmlString FileUpload(this HtmlHelper htmlHelper, string cssClass, object htmlAttrs = null) {

    var tb = new TagBuilder("input");

    tb.MergeAttribute("type", "file");


    if (!string.IsNullOrWhiteSpace(cssClass)) {

    tb. … more

  • Usage of Factor in R

    Hello everybody,

    today I want to make post about usage of factor in R.

    So, first of all, what is factor at all? 

    I was surprised to see that factor is very overloaded term and can have a lot of meanings in many areas.  So, for what factors can be used in R?

    First of all they can be used for storing categorical or nominal values. For example it can be convenient for saving gender, blood group, car type, etc. 

    So, let's say you wrote something like this: 

    cars.classes <- c("Coupe", "Cabriolet", "Sport", "Hatchback")

    For now cars.classes is not a factor, but just character vector. 

    If you execute this code in RStudio, and then execute in RStudio following line:

    cars.classes … more

  • Coercion in programming

    Hello everybody,

    just one short notice. Sometime in programming you can read word coercion. 

    You may be wondering what it means. 

    If to put simply, it is converting of one type into the other. 

    In C# coercion can be of two types: 

    implicit and explicit. 

    double a,b;

    a = 25; // implicit coercion

    b = (double) 7; //explicit coercion ( casting)