Saturday 23 May 2015

Create New Partition in Windows 8 or 8.1 without Formatting hard disk or Reinstalling Operating System

In this post we are going to see how to create a new partitions in the systems with out formatting and re-installing operating systems. Now day's Laptop are configured with one partition in Hard disk . which is fully occupied including the free space, i.e primary partition, so users can't able to manage the files and directories separately from OS drive like shown in below image.



Today that kind of scenario, i faced in a system, where my friend received a New Laptop which have only one partition c, In which windows 8.1 Operating Systems is installed, now he got a one  problem he needs additional partition in hard drive to manage files, He don't need to format the hard disk or re-installing the Operating Systems, To do that we need to do following steps.

Following are the configuration and model of a Laptop.





Steps to do partition with out formatting 
*********************************************
1. Windows + R , type diskmgmt.msc



2. Press Enter.Now disk management screen will appear, where you manage hard disk partition's.



3. In the above image you can see that OS (C:) have  921 GB, where we didn't have any other partitions to manage files and folders







4. Now select the partition and Right click it, Then select the menu Shrink Volume.Which makes the following screen to appear.








5.In this screen , it will ask you to enter the amount of space need to shrink for partition. enter that in MB. It will also let you to display the available free space to shrink.








6.Enter the amount of space to shrink in MB i mention it as 450000.and press shrink.It will create a newly un-allocated space for create partitions. like mention in below image.







7.Now right click the un-allocated space which is newly created.And select the New Simple Volume. This will pop up a new Window, where we have to mention the size of each drive to create and left the remain as un-allocated free space in disk.













8. Now New simple Wizard will launches , Click Next. and specifies the new volume size in MB for create the Drive , in this example i specified it as 150000.Then Click Next.

9.Now another window will appears, Here we have to mention the drive letter for that partition. click Next.

10. Sometimes you will face a popup like below which will let you that drive letter is already mapped to a network share or a local path, If you face this screen , then click "No", it will reach you press window where you can assign a different drive letter like i specified.










11. Now newly created partition will be there available for you with NTFS format, along with some un-allocated space, if you want more drives then repeat the following steps 7 - 10 , to create more partitions. In the below image you can see the newly created partitions. F:/



12. After repeating the steps we are trying to create many drive with different volume letter. 








 Finally we create the three partitions









From this post you can learn how to do partition with out formatting hard disk or re-installing Operating systems. 

Friday 22 May 2015

Watch the change for a value in a Variable or Array or property in a array using Angular JS

In Angular js we have lot of things to make notify the data changes, because in MVVM or MVC pattern, view have to update automatically whenever there is a change in the data. so we take a scenario that if there is a change in the variable or array collection we have to re render the view based on some logic, Then now we see how to handle that kind of scenario in code.

Angular have $watch in the Scope where we can monitor the changes of the variable value. In $watch  we have three kind of different behaviours. value changes, new value add changes, deep value changes.

Value changes: 
****************
In this where we can get notify for variable whenever the value is changed, that includes a variables and array.


mainApp.controller('TestController', ['$scope','$timeout',function ($scope,$timeout) {

    $scope.Exams = [{ id: 1, marks: 80, name: 'ramu' },
{ id: 2, marks: 94, name: 'shiny' },
{ id: 3, marks: 56, name: 'raj' }];

    $scope.FirstRank = $scope.Exams[1];

}]);



consider the above controller where we have two kind of variable one is object and other is array.
Now we want to get notify whenever there is a change in the value i.e like

    $scope.FirstRank = { id: 3, marks: 56, name: 'rajesh' }
     $scope.Exams =    [{ id: 4, marks: 80, name: 'ram' },
  { id: 5, marks: 94, name: 'Sis' },
   { id: 6, marks: 56, name: 'FGH' }];

so i.e here the whole value for a variable is changed ,for this we have to create a watch variable with two ways ,

 First way is add a variable as string as a first parameter , second parameter as callback . Now this string is converted to a function internally.

     
  $scope.$watch('FirstRank', function (newval, oldval) {      

        /* any logic you want to do */
        $timeout(function () { $scope.$apply(); }, 0);


    });


    $scope.$watch('Exams', function (newval, oldval) {

        /* any logic you want to do */
        $timeout(function () { $scope.$apply(); }, 0);


    });

Second way is adding a function as a first parameter, callback as second parameter.

    $scope.$watch(function () { return $scope.FirstRank; }, function (newval, oldval) {
       
        /* any logic you want to do */
        $timeout(function () { $scope.$apply(); }, 0);


    });

Both are doing the job, but the way of declaration is same, If there is a scenario where we want to get the notify when new item is added in collection then above $watch is failed to notify. For this we have to specify the another one i.e


New value add changes
**********************

Ex:      $scope.Exams.push({ id: 3, marks: 56, name: 'raju' });

For  this we have to make another way.


    $scope.$watchCollection('Exams', function (newval,oldval) {

        /* any logic you want to do */
        $timeout(function () { $scope.$apply(); }, 0);


    });



From the code you can unde'rstand the change in the collection can be found out $watchCollection, but we cant found out using $watch.

Deep Value Changes
*******************
If we want to get the notify for a property value change of a object inside a collection, then we have to monitor the each and every property change for this we have to pass a additional flag to the $watchCollection , as true that will take care remaining things.

    Ex:  $scope.Exams[0].Id = 10;

    $scope.$watchCollection('Exams', function (newval, oldval) {

        /* any logic you want to do */
        $timeout(function () { $scope.$apply(); }, 0);


    }, true);








mainApp.controller('TestController', ['$scope','$timeout',function ($scope,$timeout) {

    $scope.Exams = [{ id: 1, marks: 80, name: 'ramu' }, { id: 2, marks: 94, name: 'shiny' }, { id: 3, marks: 56, name: 'raj' }];

    $scope.FirstRank = $scope.Exams[1];


    $scope.$watch('FirstRank', function (newval, oldval) {      

        /* any logic you want to do */
        $timeout(function () { $scope.$apply(); }, 0);

    });

    $scope.$watch(function () { return $scope.FirstRank; }, function (newval, oldval) {
       
        /* any logic you want to do */
        $timeout(function () { $scope.$apply(); }, 0);

    });

    $scope.$watch('Exams', function (newval, oldval) {

        /* any logic you want to do */
        $timeout(function () { $scope.$apply(); }, 0);


    });

    $scope.$watchCollection('Exams', function (newval,oldval) {

        /* any logic you want to do */
        $timeout(function () { $scope.$apply(); }, 0);


    });

    $scope.$watchCollection('Exams', function (newval, oldval) {

        /* any logic you want to do */
        $timeout(function () { $scope.$apply(); }, 0);

    }, true);


}]);


From this post you can learn the whole thing about the $watch a variable value changes and deep changes