Archives

Archives / 2015 / October
  • What the difference between programmer and software developer?

    Hello everybody,

    today just short glimpse about difference between programmer and software developer.

    So, try to picture following scenario, you ask for program.

    As result programmer will give you a code. 

    But Software developer will give you "some questions" ( and this list is not complete )

    How does it fit in the business process. Are the requirements thought out?

    Are you sure you understand what it will cost?

    What kind of documentation will it need?

    How might it interact with other code?

    What platform will it run on. Are the scalability issues?

    How might it impact future development? How might it be enhanced in the future?

    Can you find/buy/reuse other software instead? … more

  • ZenCoding in Web Essentials

    Hello everybody,

    today I want to point to some useful features of ZenCoding in web essentials.

    Quick reference of ZenCoding shortcuts:

        # use it for creating id    . use it for creating a class attribute    [ ] use it for creating a custom attribute    > use it for creating a child element    + use it for creating a sibling element    ^ use it for creating climbing up    * is element multiplication. This creates the same thing n number of times    $ is replaced with an incremental number    $$ is used for numbers with padding    { } creates text in an element

    So, if you decide to install in your Visual Studio Web essentials, then among options which you'll get will be ZenCoding. What … more

  • Notes about AngularJS webinar

    Hello everybody,

    few notes about some details of AngularJS.

    1. What is $scope?

    $scope is something where we can store information which is needed for page. Also data for changes of which we need to track.

    2. How can we react on some changes in $scope? In other words if something at page modified something in model, how can we react on it? Or in another words, how to track changes in some member? 

    Imagine following scenario. Inside of your scope there is a member message like this:

    $scope.message = "Your message";

    You can track it like this:

    $scope.$watch("message", function(newValue, oldValue) {

        //here you can do something

    });

    newValue as you probaly guessed is new value, … more

  • $http Service and promises

    Hello everybody,

    today another glimpse from the AngularJS world which I can name of how to get something from server.

    So, imagine that you see following code in your controller:

    var OrderController = function($scope, $http) {

        $scope.order = $http.get("/orders/1563");

    }

    and now is question, what's wrong with this? Just one very important issue, $http.get returns a promise, not the response itself. So in order to make it work correctly another approach will be more correct:

    var OrderController = function($scope, $http) {

        var promise = $http.get("/orders/1563");

        promise.then(function(response){

          $scope.order = response.data;

              });

    }

    Why second approach … more

  • How to define properties in javascript

    Hello everybody,

    here is short notice of how to define properties in javascript:

    So, lets say you want to have class Dog, with "private" field alias and public property Alias. you can achieve it in the following way:

    function Dog(nameOfDog) {

        var alias = nameOfDog;

        Object.defineProperty(this, "Alias", {

                get: function() {

                    return alias;

                },

                set: function(value) {

                    alias = value;

                }

            }

        });

    }

    Later in code you can write the following:

    var rex = new Dog("Rex");

    var name = rex.Name;   // name will be equal to "Rex"

    Also you can set name of the dog to other name. 

    more

  • Hierarchy for CTE in MS SQL

    Hello everybdoy,

    today I want to write some notes about hierarchy research in ms sql database. 

    Imagine you have following structure in your table 

    TableWithParentChild:

    id               |           rootID   |     some additional fields

    1                |            1          |      ----

    2                |            1          |      ----

    3                |            2          |      ----

    4                |            2          |      ----

    5                |            2          |      ----

    and image that you need to get info like who is below 1. 

    for this purpose following sql can be useful:

    -- wrap up tree selection into tvf

    create function HierarchyFunction(@ … more

  • How to clean plan query cache

    Hello everybody,

    some sql notes:

    dbcc freeproccache; this one will clean plan of cached of sql.

    Another note of how to find Sql code and plan by id from dm_exec_cached_plans

    create function SqlAndPlan(@handle varbinary(max))

    returns table

    as

    return select sql.text, cp.usecounts,cp.cacheobjtype,

    cp.objtype, cp.size_in_bytes,

    qp.query_plan

     from

     sys.dm_exec_sql_text(@handle) as sql cross join

     sys.dm_exec_query_plan(@handle) as qp

     join sys.dm_exec_cached_plans as cp

     on cp.plan_handle = @handle;

    then you can use it in the following way:

     select * from SqlAndPlan(0x06650D007852A00B40613C82000000000000000000000032)

    And in order to see sql and plan simultanously you can use … more

  • Query plan in MS SQL

    Hello everybody,

    some MS SQL internals.

    Imagine, you want to see what MS SQL cached. How you can do it? One of the ways is to look into sys.dm_exec_cached_plans. 

    For example like this:

    select * from sys.dm_exec_cached_plans

    this code will return to you all what is cached in your MS-SQL database. Most probably result will puzzle you. What to do with all of it?

    Take look at the screenshot :

    the area of interest for us is column plan_handle. 

    You can use it for another sql request. Like this:

    select * from sys.dm_exec_query_plan(0x06000C002D51D1304021F8AE000000000000000000000000);

    if you click at column with xml you'll see the following picture:

    How to interpret those … more

  • Moq and unit test

    Hello everybody,

    today I want to write few words about Moq and unit testing. 

    First of all you can have a question, why do I need Moq at all?

    Moq is especially useful for cases if we don't have desire to code interface, then code implementation of interface, and then code fake implementation. As usually those simple implementation are relatively simple so somebody ( as Moq team ) can organize code generation for your simple interface implementations.

    So, unit test is something that should follow 3 A:

    Arrange

    Act

    Assert

    General schema of Unit test implementation can be like this:

    [Test]

    public void SomeTest()

    {

    //Arrange

    var … more

  • Some bootstrap fundamentals

    Hello everybody,

    today I want to write some moments about bootstrap.

    If to speak in general bootstrap is beast which has some javascript and css code. 

    One of the ways to modify behaviour of bootstrap is to add reference to bootstrap style, and then add reference to your customization of css in which you can change boostrap settings with overriding basic bootstrap code. For example you can achieve it in the following way:

    <link rel="stylesheet" href="css/bootstrap.min.css">

    <link rel="stylesheet" href="css/yourCustomized.css">One more interested features of bootstrap is grid layout of something. If in your html you'll write something like this:

    <section id="body" class="container"> … more