Archives / 2016 / December
  • Observables in AngularJS 2

    Hello everybody,

    today I want to write a few words about totally new feature in AngularJS 2 which is entitled Observables. Observables to some degree feet to promises, but still have some differences. They are mentioned in following table:



    Single feature value

    Emits multiple values over time

    Not lazy


    Not cancelable


    supports map, filter, reduc and similar operators


  • What is service in AngularJS 2

    Hello everybody,

    today I want to write few words about AngularJS 2 services, or if to be more specific what is Service in angular at all? If to speak very very shortly: Service - it's a class with focused purpose independent from any particular component. It can be caching purpose, or logging purpose, or sending http requests purpose. 

    Lets say you need to build a service in AngularJS 2. You'll need to go through the following steps:

    Create class for service

    Define metadata with decorator

    Import what is needed for service

    import { Injectable } from '@angular/core'

    @Injectable() //needed if we have injected dependency or for consistency

    export class StudentsService{

            … more

  • Building a custom pipe in AngularJS 2

    Hello everybody,

    today I want to write few words about custom pipes in ... AngularJS 2. The first time when I've heard about custom pipes happened to be when I've learned powershell scripting. And recently I've discovered that there are some built in custom pipes in AngularJS 2 and we can make our own custom pipes. 

    What is needed for implementing custom pipes? Nothing special. Just import from AngularJS 2 PipeTransform and implement in it method transform. And one more is pipe decorator ( in my example something that starts from @Pipe and ends with first }) ). And what else? Of course import statements.

    It can look like this:

    import {Pipe, PipeTransform} from '@angular/core'

    @Pipe( … more

  • XAML simplification of usage INotifyPropertyChanged


    I want to share some code, wich can simplify usage of INotifyPropertyChanged in XAML.

    Take a loot at following fragments:


    namespace NotifyPropertyChanged


        public class BindableBase : INotifyPropertyChanged 


            public event PropertyChangedEventHandler PropertyChanged;

            public void RaisePropertyChanged(string propertyName)


                if(PropertyChanged != null)


                    PropertyChanged.Invoke(this, new PropertyChangedEventArgs(propertyName));





    Class BindableBase now can become as base class for those objects, which need to notify UI about changes in source code. Consider … more

  • Binding modes in XAML

    Hello everybody,

    today I want to write few words about binding in XAML.

    So there are four ways of binding in XAML.

    One way

    Two way

    One way to source

    One time

    If to speak about them more, then here it goes additional definitions:

    OneWay : source property updates target property

    TwoWay: source or target updates the other

    OneWayToSource: source is updated when target is updated

    OneTime: executed only once for initialization of target property

    What is important to notice for notification of UI, there is a need for implementing INotifyPropertyChanged interface. Without it changes in source properties will not become propogated to target.


  • Basic elements in XAML

    Hello everybody,

    today I want to write few words about basic elements in XAML.


    This class is next in inheritance level in XAML after object. DependencyObject gives needed properties for representing something that participates in dependency property system. Mostly needed for data binding. It is basic for UIElement, Geometry, FameworkTemplates, Tile, ResourceDictionary.


    This is base class for all objects that have visual representation. It supports basic manipulation, appereance, layout. Also it has code for responses for user input, routed events, some aspects of animation system.


    This class takes part in layout and obliged to have … more

  • Angular 2 data binding and pipes

    Hello everybody,

    today  I want to make short note about types of Data Binding in AngularJS 2.

    here they are:

    Interpolation. It looks like this in code: {{firstName}}

    Property binding. Sample in code: <img [src]=''>

    Event binding. Html code pattern: <button (click)='showMessage()'... />

    Two-way binding: <input [(ngModel)]='someProperty' />

    Important think to remember about usage of ngModel is the following:

    in your imports add importing of FormsModule.

    For example like this:


           imports: [



           declarations: [





    export class AppModule {


    If … more

  • What is AngularJS 2 component


    Here I want to write of how I grasped what is Angular 2 component building blocks

    Hello everybody,

    I don't know about you, but when I first opened AngularJS 2 component source code, I've become puzzled with question mark of what is AngularJS 2 component?

    Imagine, that you look at this sampe:

    import { Component } from '@angular/core';


    selector: 'my-app',

    template: `<h1>Hello {{name}}</h1>`


    export class AppComponent { name = 'Angular'; }

    and try to figure out what are consisting parts of compoment? After watching on that example and some others example here is conclusion that I've made:

    Do you remember previous fragment of code? … more

  • Setting up an Angular 2 application

    Hello everybody,

    today I want to make note about setting up Angular 2 application initial configuration. So, if you need to set up everything for Angular 2 application manually, then following steps will be needed ( according to ):

    Create application folder

    Create tsconfig.json file

    create package.json file

    create typings.json file

    install libraries and typings

    create host web page ( as usually index.html )

    create maint.s file 

    When I first time read those requirements, I've become intimidated. And as every energy saving person I wanted to know, is it possible to get some tool, that set up Angular 2 app instead of me. And the simplest way will be the following: … more

  • How to send email in C# windows forms application

    Hello everybody,

    sometime people ask me how to send email from C# windows forms application or even ask is it possible at all to accomplish in C#?

    I can reassure you that yes, it's possible. 

    For this purpose you can use following code sample:

    private void btnSendMessage_Click(object sender, EventArgs e)


    var from = new MailAddress(txtFrom.Text, "From Name");

    var toEmail = new MailAddress(txtTo.Text, "To Name");

    string passwordFromEmailOfSender = txtPassword.Text;

    string subject = "Subject";

    string body = txtMessage.Text;

    var smtp = new SmtpClient


    Host = "", … more

  • JWT structure and format

    Hello everybody,

    today I want to describe a bit structure and format of JWT or json web tokens.

    Here you can read official description.

    But in my post I'll describe little bit more general information.

    The two main ingredients of json web token are: header and claims.

    Then if to continue each part can have the following:



    algorithms and keys used


    Issuer (iss)

    Audience (aud)

    IssuedAt (iat)

    Expiration (exp)

    Subject ( sub )

    ... application defined claims

    for example it can look like this:

    Header {      "typ" : "JWT",       "alg" : "HS256"}

    Claims {       "iss" : "",       "exp" : "1451919380",       "aud" : "http:// … more

  • Security Tokens

    Hello everybody,

    today I want to write a few words about security tokens in OAuth2. 

    So, first of all I'd like to point that security tokens wasn't needed for corporate world. When I say corporate world, I mean networks like B2B, or B2E or something, that has strong system administration army.

    But if you need to provide B2C or something like this than you'll need tokens.

    As usually tokens has following features:

    Security tokens are protected data structures

    Also not prescribed in OAuth2 but quite often security tokens implemented as JSON web tokens

    has information about producer and topic ( claims )

    signed ( has some kind of identity proof )

    as usually contain expiry date time … more

  • How to avoid many if during programming for cAlgo

    Hello everybody,

    today I want to write few words about how to avoid nested ifs if you program for cAlgo.

    Recently I've got following request ( code is modified in order to protect privacy of customers idea ):

    buy in following case:

    price is above moving average 20

    price is above moving average 30

    stochastic is above 40

    each of indciators from 1 - 3 can be turned on/off

    As example consider following case:

    if( movingAverage30On && MarketSeries.Low[1] > longMa.Result[1])


    if(movingAverage20On && MarketSeries.Low[1] > shortMa.Result[1])


    if(stochasticOn && _stochastic.PercentD[1] > 40)






    if(movingAverage20 … more

  • Training neural network of deeplearning4j for price prediction


    I need to document my first implementation of learning algorithm for usage of neural networks for training

    package org.deeplearning4j.examples.recurrent;

    import org.deeplearning4j.datasets.iterator.impl.ListDataSetIterator;

    import org.deeplearning4j.nn.api.Layer;

    import org.deeplearning4j.nn.api.OptimizationAlgorithm;

    import org.deeplearning4j.nn.conf.BackpropType;

    import org.deeplearning4j.nn.conf.MultiLayerConfiguration;

    import org.deeplearning4j.nn.conf.NeuralNetConfiguration;

    import org.deeplearning4j.nn.conf.Updater;

    import org.deeplearning4j.nn.conf.layers.DenseLayer;

    import org.deeplearning4j.nn.conf.layers.GravesLSTM;

    import org.deeplearning4j.nn.conf.layers. … more

  • OAuth 2 parts

    Hello everybody,

    today  I want to describe for main components of OAuth 2, which should be implemented by any framework which claims to be programmer friendsly implementation of OAuth 2.

    We will start from left botton box, or from user. So, user as usually is something or more precise somebody who initiate actions on UI. Something can also be selenium web driver implementation or something similar. 

    Next goes client. Or if to add another key word client application. There are plenty of them: angularjs app, iOs app, iPhone app, Android app, Xamarin app, etc.

    Authorization server is intended to be somebody, who generates tokes for each separate user. Token will consist information about … more

  • Defining OAuth2

    Hello everybody,

    today I want to write few words about OAuth2.

    So, one of the defintions of OAuth2 is the following:

    OAuth 2.0 is an open protocol to allow secure authorization in a simple and standard method from web and desktop applications.

    It has two important parts:

    Authorization. It's not just about who is client, but what client is allowed to do.

    Client platform: web, mobile, desktop app

    So, OAuth 2.0 is protocol which defines permission of server, and give those permissions for any kind of platform.


  • question for UrkTransGaz

    Hello everybody,

    this is schema needed for participating in tender for UkrTransGaz more