Sunday, October 4, 2015

Consuming SOAP WebService - Ways to create Proxy

Code Snippet:

Web reference or Service reference.

In service reference we use the CalculatorSoapClient (Click on the service reference to view the interface & SOAP implementation classesclass to create the object.
In Web reference (add service reference --> advanced  --> Then you get the web reference option) we use the Calculator i.e the asmx service name to create the object.
webserferenceCal.Calculator ww = new webserferenceCal.Calculator();
Label1.Text = Convert.ToString(ww.add(10,10));

ServiceReferenceCal.CalculatorSoapClient bb = new ServiceReferenceCal.CalculatorSoapClient();
Label2.Text = Convert.ToString(bb.add(11, 12));


Friday, July 10, 2015

Using $timeout in AngularJS developed - Kids Alphabets Tutor

Previously we posted an article for Kids Alphabets Tutor in AngularJS and here is another way using $timeout function.

Code Snippet:
<html>
<head>
    <title>Angular.js Example</title>
    <script src="Scripts/angular.js"></script>
    <script>
        var nameApp = angular.module('NameApp', []);
        nameApp.controller('NameCtrl'function ($scope, $timeout) {
            // I initialized only till alphabet 'H'.. Add more if you are topper in LKG.
            $scope.letters = ['A-Apple''B-Ball''C-Cat''D-Dog''E-Elephant''F-Frog''G-Girafee''H-Horse'];
            var i = 0, lengthSize = $scope.letters.length;
            var testname = function () {
                $scope.test = $scope.letters[i];
                if (i < lengthSize - 1)
                    i = i + 1;
                else
                    i = 0;
                $timeout(testname, 2000);
            }
            $timeout(testname, 2000);
        });
    </script>
</head>
<body ng-app="NameApp" ng-controller="NameCtrl">
    <center>
        <h1>
            Kids Alphabet Tutor<br /><br />
            {{test}}
            <img src="Images/{{test}}.PNG" width="75px" height="75px" />
        </h1>
    </center>
</body>
</html>

Points to Note: 

  • Image file Name should be the array element names initialized in the $scope.letters.
  • Below is the folder structure:











This is how it looks:


Thursday, June 25, 2015

Palindrome in AngularJS

Code Snippet:
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>Check whether the given word is palindrome or not</title>
    <script src="Scripts/angular.js"></script>
    <script type="text/javascript">
        var app = angular.module('palindromeApp', []);
        app.controller('palindromeController', ['$scope'function ($scope) {
            $scope.palicheck = function (word) {
                var revword = word.split('').reverse().join('');
                return revword == word;
            };
        }]);
    </script>
</head>
<body ng-app="palindromeApp" ng-controller="palindromeController">
    <h3>Check whether the given word is palindrome or not</h3>
    <div>
        Enter Word: <input type="text" ng-model="word" />
    </div>
    <div ng-if="palicheck(word)">The Given word <b>{{word}}</b> is palindrome</div>
    <div ng-if="!palicheck(word)">The Given word <b>{{word}}</b> is not palindrome</div>
</body>
</html>

How it Looks:

Wednesday, June 24, 2015

Example showing difference between One-Time and One-Way data bindings in Angularjs

Code Snippet:
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>Difference between One-Time and One-Way Data Bindings</title>
    <script src="Scripts/angular.js"></script>
    <script type="text/javascript">
        var app = angular.module('OneTimeBinding', []);
        app.controller('OneTimeBindingController'function ($scope) {
            $scope.i = 0;
            $scope.places = ['Agartala''Agra''Amritsar''Bangalore''Chennai''Hyderabad''Visakhaptanam''Delhi''Kerala''Tamil Nadu'];
            $scope.ClickMe = function (clickEvent) {
                $scope.place = $scope.places[$scope.i];
                $scope.i++;
            };
        });
    </script>
</head>
<body ng-app="OneTimeBinding" ng-controller="OneTimeBindingController">
    <div>
        <button ng-click="ClickMe($event)">Click Me</button>
        <br />
        <br />
        <p>One-Time Data-Binding: {{::place}}</p>
        <p>One-Way Data-Binding:  {{place}}</p>
    </div>
</body>
</html>

How it Looks:


Monday, June 22, 2015

Download any youtube video in just a single click using this AngularJS program

Code Snippet:
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>Download Any Youtube Video in a single click</title>
    <script src="Scripts/angular.js"></script>
</head>
<body ng-app="">
    <div>
        <h2>Download Any Youtube Video in single click</h2>
        Enter video ID:<input type="text" ng-model="ID" /><br />
        For Example: link= youtube.com/watch?v=<b>0o0kNeOyH98</b>
        <br /> Here bolded text is ID
        <br />
        <div>
            <a ng-show="ID" ng-href="https://www.ssyoutube.com/watch?v={{ID}}" target="_blank">{{ID}}</a>
        </div>
    </div>
    <br />
    <div ng-init="IDS=['0o0kNeOyH98','ID2','ID3'];">
        <h2>Want to download multiple videos at once then store ids in array </h2>
        <div ng-repeat="ID in IDS">
            <a ng-show="ID" ng-href="https://www.ssyoutube.com/watch?v={{video}}" target="_blank">{{ID}}</a>
        </div>
    </div>
</body>
</html>

How it Looks: