KnowledgeBase

Azure Tips: Service Bus vs Azure Queue

September 20, 2016 Azure, Cloud Services, Windows Azure Development No comments

Azure Service bus is a queuing technology that supports advanced features and allows access by processes created using various technologies and running in different domains. It allows ability to publish a message to multiple subscribers.  read more

Azure Queue is another queuing technology. However, it does not support the ability to publish a message to multiple subscribers. When a message is picked up, it is made invisible until the visibility timeout elapses. read more

Redis Cache–Azure Plans

August 13, 2016 .NET, ASP.NET, Azure, Cloud Computing, Data Caching, Data Hubs, Emerging Technologies, KnowledgeBase, Microsoft, Performance, Redis Cache, Windows Azure Development No comments

redis-white

Azure Redis Cache, a secure data cache based on Open source Redis Cache, which will provide you a fully managed/serviced instance from Microsoft. Means you don’t have to bear the burden of managing the server/software patches etc..

What is Redis Cache?

Redis is an open source (BSD licensed), in-memory data structure store, used as a database, cache and message broker. It supports data structures such as strings, hashes, lists, sets, sorted sets with range queries, bitmaps, hyperloglogs and geospatial indexes with radius queries. Redis has built-in replication, Lua scripting, LRU eviction, transactions and different levels of on-disk persistence, and provides high availability via Redis Sentinel and automatic partitioning with Redis Cluster.

You can run atomic operations on these types, like appending to a string; incrementing the value in a hash; pushing an element to a list; computing set intersection, union and difference; or getting the member with highest ranking in a sorted set.

In order to achieve its outstanding performance, Redis works with an in-memory dataset. Depending on your use case, you can persist it either by dumping the dataset to disk every once in a while, or by appending each command to a log. Persistence can be optionally disabled, if you just need a feature-rich, networked, in-memory cache.

Redis also supports trivial-to-setup master-slave asynchronous replication, with very fast non-blocking first synchronization, auto-reconnection with partial resynchronization on net split.

5 High-level Use Cases of Redis Cache

1. Session Cache
One of the most apparent use cases for Redis is using it as a session cache. The advantages of using Redis over other session stores, such as Memcached, is that Redis offers persistence. You can maintain your applications user, role and authorization permission lists etc in Redis Cache for faster accessibility.

2. Full Page Cache (FPC)
Outside of your basic session tokens, Redis provides a very easy FPC platform to operate in. Going back to consistency, even across restarts of Redis instances, with disk persistence your users won’t see a decrease in speed for their page loads

3. Queues
Taking advantage of Redis’ in memory storage engine to do list and set operations makes it an amazing platform to use for a message queue. Interacting with Redis as a queue should feel native to anyone used to using push/pop operations with lists in programming languages such as C#, Python, Java, Php etc.

4. Leaderboards/Counting
Redis does an amazing job at increments and decrements since it’s in-memory. Sets and sorted sets also make our lives easier when trying to do these kinds of operations, and Redis just so happens to offer both of these data structures.

5. Pub/Sub
The use cases for Pub/Sub are truly boundless. You can use it for social network connections, for triggering scripts based on Pub/Sub events, and even a chat system built using Redis Pub/Sub!

[Courtesy: ObjectRocket]

Finally let us come to context of this blog to take you to essential pricing model from Microsoft:

Azure Redis Cache is available in three tiers:

  • Basic—Single node, multiple sizes, ideal for development/test and non-critical workloads. The Basic tier has no SLA.
  • Standard—A replicated cache in a two-node primary/secondary configuration managed by Microsoft, with a high-availability SLA.
  • Premium—All of the Standard tier features, including a high-availability SLA, as well as better performance over Basic and Standard-tier caches, bigger workloads, disaster recovery, redis persistence, redis cluster, enhanced security and isolation through Virtual Network Deployment.
  • ** Basic and Standard caches are available in sizes up to 53 GB(250 MB, 1 GB, 2.8 GB, 6 GB, 13 GB, 26 GB, 53 GB. )
  • ** Premium caches are available in sizes up to 530 GB with more on request.

[Courtesy: Microsoft]

Useful Links:

Visual Studio 2015 Update 3 – Download

June 27, 2016 .NET, .NET Core 1.0, .NET Framework, .NET Framework 4.5, .NET Framework 4.5.2, .NET Framework 4.6, ASP.NET, ASP.NET 5.0, ASP.NET Core 1.0, ASP.NET MVC, C#.NET, Community, JavaScript, Microsoft, MSDN, Trial Downloads, Updates, Visual Studio 2015, Visual Studio Code, Visual Studio SDK, VisualStudio, VS2015, WCF, Web API v2.0, Windows, Windows 10, Windows 7, Windows 8, Windows 8.1, Windows Azure, Windows Azure Development, Windows Phone Development, Windows Phone SDK, Windows Store Development, WPF, WWF, XAML No comments

Today Microsoft has released Update 3 for Visual Studio 2015. Visual Studio 2015 Update 3 includes a variety of capability improvements and bug fixes. To find out what’s new, see the Visual Studio 2015 Update 3 Release Notes. For a list of fixed bugs and known issues, see the Visual Studio 2015 Update 3 MSDN Article.

Download:
Visual Studio Community 2015 with Update 3 – Web Installer –  ISO
Visual Studio Enterprise 2015 with Update 3 – Web Install –  ISO
Visual Studio Professional 2015 with Update 3 – Web Installer –  ISO
Visual Studio 2015 Update 3 – Web InstallerISO
Visual Studio Team Foundation Server 2015 with Update 3 – Web Installer –  ISO
Visual Studio Test Professional 2015 – Web InstallerISO
Visual Studio Express 2015 for Windows 10 – here
Visual Studio Express 2015 for Web – here
Visual Studio Express 2015 for Desktop – here

Installing Windows 10 Client Hyper-V in VMware Workstation/Fusion/ESX

July 10, 2015 Hyper-V, KnowledgeBase, Microsoft, OS Virtualization, Tips & Tricks, Virtual Machines, Virtualization, VMware, Windows, Windows 10 No comments , , , ,

As a Windows 10 Insider, I would always latest version of Windows on VMWare Player, Workstation or VirtualBox. Recently I was trying to set up a Windows Phone 10/UWP development environment inside a VMWare virtual machine.

I tried to enable Hyper-V platform components in my Windows 10 Preview Virtual machine. It shows an error.

Hyper-V cannot be installed: A hypervisor is already running

  • Unable to use Hyper-V platform inside a Windows 10 virtual machine
  • When trying to enable/install Hyper-V in a Windows 10 virtual machine, you will see the above error:

image

SOLUTION:

Solution for this problem is to edit your VMware Virtual Machine configuration(.vmx) file in your Windows 10 Virtual machine stored location.

  • Switch off/Shutdown your VMware virtual machine
  • Edit the corresponding .vmx file
  • Append the following entries to the vmx file (verify entry if already exists)
hypervisor.cpuid.v0 = "FALSE”
vhv.enable = "TRUE"
mce.enable = "TRUE"
  • Save the changes
  • Start your Windows 8 VMware Virtual machine
  • Now go to Control Panel –> ‘Programs and Features’ –> Turn windows features on or off
  • Viola!,  You can now enable ‘Hyper-V Platform’ . Now you can install Windows Phone SDK on your Windows 10 Virtual Machine

image

VMware Official Knowledgebase Reference Link:

http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=2044876

Hope that help you guys with similar problems.

Back to Basics : Singleton Design Pattern using System.Lazy type

June 25, 2015 .NET, .NET Framework, .NET Framework 4.5, .NET Framework 4.5.2, .NET Framework 4.6, Back-2-Bascis, BCL(Base Class Library), C#.NET, Codes, Design Patterns, KnowledgeBase, Microsoft, Portable Class Library, Visual Studio 2013, Visual Studio 2015, VisualStudio, VS2010, VS2012, VS2013, VS2015, Windows No comments

This article takes you to a simpler/alternative approach in making a Singleton Design Pattern implementation using System.Lazy class rather that using our traditional approach.

Singleton Design Pattern implementation without lazy initialization:

  • This code is thread safe enabled
 /// <summary>
    /// Singleton class 
    /// </summary>
    public class AppConfig
    {

        private AppConfig()
        {

        }

        /// <summary>
        /// Gets the current date time.
        /// </summary>
        /// <value>
        /// The current date time.
        /// </value>
        public DateTime CurrentDateTime
        {
            get
            {
                return DateTime.Now;
            }
        }
        /// <summary>
        /// The _config
        /// </summary>
        private static AppConfig _config;

        /// <summary>
        /// The pad lock for maintaining a thread lock.
        /// </summary>
        private static readonly Object padLock = new object();

        /// <summary>
        /// Gets the instance.
        /// </summary>
        /// <value>
        /// The instance.
        /// </value>
        public static AppConfig Instance
        {
            get
            {

                if (_config == null)
                {
                    lock (padLock) // making thread-safe
                    {
                        //{
                        if (_config == null) //second level check to make sure, within the short span, another concurent thread didnt initialize the object. 
                        {
                            _config = new AppConfig();
                        }
                    }
                }
                //}

                return _config;
            }
        }
    }

This approach ensures that only one instance is created and only when the instance is needed. Also, the variable is declared to be volatile to ensure that assignment to the instance variable completes before the instance variable can be accessed. Lastly, this approach uses a padLock instance to lock on, rather than locking on the type itself, to avoid deadlocks.

Another variant using Lazy initialization using static constructor and thread safe since initialization is handled during runtime within readonly variable declaration.  This will be thread-safe any ways.

 /// <summary>
    /// a Simpler version of Singleton class with lazy initialization.
    /// </summary>
    public class AppConfigLazy1
    {
        // static holder for instance, will not get initialized until first use, due to static contructor.
        private static readonly AppConfigLazy1 _instance = new AppConfigLazy1();

        /// <summary>
        /// Prevents a default instance of the <see cref=&quot;AppConfigLazy1&quot;/> class from being created.
        /// </summary>
        private AppConfigLazy1()
        {

        }

        /// <summary>
        /// for Lazy Initializes the <see cref=&quot;AppConfigLazy1&quot;/> class.
        /// </summary>
        static AppConfigLazy1()
        {

        }


        public static AppConfigLazy1 Instance
        {
            get
            {
                return _instance;
            }
        }
    }

Now with .NET 4.0 onwards there is a better way of doing this using .NET Runtime methods using System.Lazy type. System.Lazy type is mainly used in Entity Framework context, but we can use the same in implementing lazy loading where ever we have to deal with memory intensive object or collection of objects.

System.Lazy type  guarantees thread-safe lazy-construction. (By default, all public and protected members of the Lazy class are thread safe and may be used concurrently from multiple threads.)

.NET Framework Support in: 4.6, 4.5, 4
/// <summary>
    /// a Simpler version of Singleton class with lazy initialization.
    /// </summary>
    public class AppConfigLazy2
    {
        // static holder for instance, need to use lambda to construct since constructor private
        private static readonly Lazy<AppConfigLazy2> _instance = new Lazy<AppConfigLazy2>(() => new AppConfigLazy2());

        /// <summary>
        /// Prevents a default instance of the <see cref=&quot;AppConfigLazy2&quot;/> class from being created.
        /// </summary>
        private AppConfigLazy2()
        {

        }
        
        public static AppConfigLazy2 Instance
        {
            get
            {
                return _instance.Value;
            }
        }


        /// <summary>
        /// Gets the current date time.
        /// </summary>
        /// <value>
        /// The current date time.
        /// </value>
        public DateTime CurrentDateTime
        {
            get
            {
                return DateTime.Now;
            }
        }
    }
    

That’s more than one way doing Singleton Pattern Implementation right?, hope that was helpful to you  Some reference links are given below:

New Certification – MCSD – Azure Solution Architect

May 25, 2015 .NET, .NET Framework, AppFabric, Azure, Azure Tools, Certification, Cloud Services, KnowledgeBase, MCSD, Microsoft, SQL Azure, Visual Studio 2013, VisualStudio, VS2013, Windows Azure Development, Windowz Azure No comments

Microsoft has made availability of new MCSD certification called as “MCSD – Azure Solutions Architect“.

Required Exams:
070-532: Developing Microsoft Azure Solutions
070-533: Implementing Microsoft Azure Infrastructure Solutions
070-534: Architecting Microsoft Azure Solutions

Once you complete the above required exams you will be awarded MCSD – Azure Solutions Architect certificate valid for 2 years.

PS: You will have to retake the renewal exam every two years to stay on as an MSDN Azure Solutions Architect.

For more details on the certification: https://www.microsoft.com/learning/en-us/mcsd-azure-architect-certification.aspx