Base64 encoder and decoder

We have just released the first tool in our new Tools section. It’s a unicode compatible base64 encoder/decoder, which uses HTML, AngularJs and Bootstrap.

Base64 Encoder/Decoder

If you have any questions or suggestions feel free post a comment or Contact Us via Email.

Top 10 reads of July 2015

These are our Top 10 reads of July 2015.

  • How to match strings using wildcards in C# and VB.NET
  • IsSmallerThan generic extension method for C# and VB.NET
  • How to prevent your IOS app from going into sleeping mode using Objective-C
  • How to convert Color to Hex and Hex to Color using C# and VB.NET
  • How to read a embedded resource to String in C# and VB.NET
  • How to convert a Securestring to String using C# and VB.NET
  • How to change the encoding of a String using C# and VB.NET
  • How to get focusedrow cell value using Devexpress XtraGrid in C# and VB.NET
  • How to get the selected row index in Devexpress Xtragrid Control using C# and VB.NET
  • thanks to all visitors, bookmark us, share us, talk about us, Follow us!, Like us! let’s grow bigger! You can even participate in our Github Projects!

    How to set the HTTP Header for a request using AngularJs

    To set the HTTP Header for a request using AngularJs you can use the following snippet.

    $http({method: 'GET', url: 'www.fesslersoftexample.com/api', headers: {
        'Authorization': 'Basic YmVlcDpib29w'}
    });
    

    Use the headers parameter in the config object you pass to $http.

    For more informations see the AngularJs API Reference

    How to define global Variables in AngularJs

    To define global Variables in AngularJs you can use one of the following ways.

    WAY1: Using $rootScope (see this JsFiddle)

    HTML:

    <div ng-controller="Testfct2">
        <div ng-controller="Testfct">This Website URL is {{name}}!</div>
    </div>
    

    Javascript:

    var myApp = angular.module('myFesslersoftSampleApp',[]);
    
    function Testfct2($scope, $rootScope) {
        $rootScope.name = 'http://codesnippets.fesslersoft.de';
    }
    
    function Testfct($scope, $rootScope) {
        $scope.name = $rootScope.name;
    }
    

    WAY2: Using a Service (see this JsFiddle)

    HTML:

    <div ng-controller="Testfct">
      This Website URL is {{name}}!
    </div>
    

    Javascript:

    var myApp = angular.module('myFesslersoftSampleApp',[]);
    myApp.factory('GlobalVarsService', function() {
        return {
            name : 'http://codesnippets.fesslersoft.de'
        };
    });
    
    function Testfct($scope, GlobalVarsService) {
        $scope.name = GlobalVarsService.name;
    }
    

    The AngularFAQ is saying:

    $rootScope exists, but it can be used for evil
    Scopes in Angular form a hierarchy, prototypally inheriting from a root scope at the top of the tree. Usually this can be ignored, since most views have a controller, and therefore a scope, of their own.

    Occasionally there are pieces of data that you want to make global to the whole app. For these, you can inject $rootScope and set values on it like any other scope. Since the scopes inherit from the root scope, these values will be available to the expressions attached to directives like ng-show just like values on your local $scope.

    Of course, global state sucks and you should use $rootScope sparingly, like you would (hopefully) use with global variables in any language. In particular, don’t use it for code, only data. If you’re tempted to put a function on $rootScope, it’s almost always better to put it in a service that can be injected where it’s needed, and more easily tested.

    Conversely, don’t create a service whose only purpose in life is to store and return bits of data.

    FOR MORE INFORMATIONS SEE Services, $rootScope