C#.NET

Static vs Singleton Classes

May 20, 2015 .NET, .NET Framework, C#.NET, Design Patterns, Interview Qns, KnowledgeBase, Microsoft No comments

Recently while I was attending an interview I came across a question Static vs Singleton. Though I know the differences I couldn’t answer it properly, as I was not refreshed my programming knowledge before the interview.

I would like to quote a reference to Jalpesh’s blog article (www.dotnetjalps.com) explaining the difference:

Difference between Static and Singleton classes:

  1. A singleton classes allowed to create a only single instance or particular class. That instance can be treated as normal object. You can pass that object to a method as parameter or you can call the class method with that Singleton object. While static class can have only static methods and you can not pass static class as parameter.
  2. We can implement the interfaces with the Singleton class while we can not implement the interfaces with static classes.
  3. We can clone the object of Singleton classes we can not clone the object of static classes.
  4. Singleton objects stored on heap while static class stored in stack.
  5. A Singleton class can extend the classes(support inheritance) while static class can not inherit classes.
  6. Singleton class can initialize lazy way while static class initialize when it loaded first
  7. Static classes are sealed class while Single ton classes are not sealed.

Credits to Jalpesh Vadgama  – “Computer Geek, Developer, Mentor, Life long learner, 10+ Years of Experience in Microsoft.NET Technologies, Awarded Microsoft Mvp(C#) for year 2010,11 and 2012.”

Microsoft Developer Program for IoT & Windows 10 IoT Core Insider Preview

May 3, 2015 .NET, .NET Framework, C#.NET, Cloud Computing, Embedded, Internet of Things, IoT, Microsoft, Tech-Trends, Virtualization, VisualStudio, VS2015, Windows, Windows 10, Windows 8.1 No comments

Microsoft has introduced a new developer program to enable the developers working on Internet of Things(IoT) based implementations.  As part of this program developers would be able to try out – Windows 10 IoT Core Insider Preview.

If you are an enthusiast working on IoT, you can signup @ https://www.windowsondevices.com/signup.aspx allows you to be early adopters of Windows on  Devices program.

Following Devices are currently supported by Windows 10 IoT Core Insider Preview.

<code>  &lt;p&gt;&lt;a href="http://go.microsoft.com/fwlink/p/?linkID=532948"&gt;Learn more about Windows IoT devices&lt;/a&gt;&lt;/p&gt; &lt;p&gt;&lt;a href="github.io/content/GetStarted.htm" target="_blank"&gt;Microsoft Github repository&lt;/a&gt; for IoT, where you can find lots of samples and documentation. &lt;a title="http://ms-iot.github.io/content/GetStarted.htm" href="http://ms-iot.github.io/content/GetStarted.htm"&gt;http://ms-iot.&lt;/a&gt;&lt;/p&gt; &lt;p&gt;&lt;strong&gt;What is Internet of Things?&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;&lt;a href="http://www.nitrix-reloaded.com/wp-content/uploads/2015/05/theinternetofthings.jpg"&gt;&lt;img title="Print" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="Print" src="http://www.nitrix-reloaded.com/wp-content/uploads/2015/05/theinternetofthings_thumb.jpg" width="386" height="235"/&gt;&lt;/a&gt;&lt;/p&gt; &lt;blockquote&gt; &lt;p&gt;Part of the &lt;a href="/wp-content/uploads/2015/05/Cloud-computing"&gt;Cloud computing&lt;/a&gt; glossary: 
</code>

The Internet of Things (IoT) is a scenario in which objects, animals or people are provided with unique identifiers and the ability to transfer data over a network without requiring human-to-human or human-to-computer interaction. IoT has evolved from the convergence of wireless technologies, micro-electromechanical systems (MEMS) and the Internet.

Below is a high level technology roadmap as per Wikipedia:

Visual Studio 2015 – ctp6

February 23, 2015 .NET, .NET Framework, ASP.NET, ASP.NET 4.5, Azure, Azure SDK, BCL(Base Class Library), C#.NET, IE, IIS, Microsoft SDKs, Portable Class Library, SQL Azure, SQL Server, Updates, Visual Studio SDK, VisualStudio, VS2015, WCF, Web API, Windows Phone SDK, Windowz Azure No comments

Microsoft today has released Visual Studio 2015 Community Technology Preview 6 (CTP 6), which includes some new features and improvements, such as new UI debugging tools for XAML, new Control Flow Guard security tool, and feature updates to ASP.NET framework.

For more information about what’s new in this release, please see the release notes.

Download Visual Studio 2015 Ultimate (web | iso)

 

Get – Visual Studio 2013 – Update 4

November 12, 2014 .NET, .NET Framework, .NET Framework 4.5.2, ASP.NET, ASP.NET 4.5, ASP.NET AJAX, ASP.NET MVC, Azure, Azure Tools, C#.NET, Microsoft, SignalR, SQL Azure, Updates, Visual Studio 2013, VisualStudio, VS2013, WCF, WCF Data Services, Web API, Windowz Azure No comments

Microsoft has released an update for Visual Studio 2013, this update is the latest in a cumulative series of feature additions and bug fixes for Visual Studio 2013.

Download VS2013.04.exe  (Online/Web Install)

Download VS2013.04.iso (Offline Install)

For more information,

For more information:

Also see Visual Studio Updates and the Visual Studio Update KB Article.

Watch Channel 9 Series on VS 2013 Update 4

Visual Studio 2012.4 RC 3 Available

September 12, 2013 .NET, .NET Framework, .NET Framework 4.5, ASP.NET, ASP.NET 4.5, ASP.NET MVC, C#.NET, HotFixes, Microsoft, Updates, VisualStudio, VS2012, Windows, Windows 8, Windows 8.1, Windows Phone No comments

Microsoft has released the Visual Studio 2012.4 RC3 Update for Visual studio 2012.  This update includes lots of bug fixes and improvements.

Here are some informative links for you:

WP8Dev– How to identify the sensors supported on your Windows Phone

August 12, 2013 C#.NET, Codes, KnowledgeBase, Microsoft, Microsoft SDKs, Mobile-Development, VisualStudio, VS2012, Windows, Windows Phone, Windows Phone 8, Windows Phone 8.0 SDK, Windows Phone Development, Windows Phone SDK, Windows Phone Store, XAML No comments

This post will give you an  overview on how to identify the sensors supported on your Windows Phone. As a developer when you are developing for Windows Phone – and your application would need to interact with certain sensors in windows phone to achieve a certain functionality, you would need to verify whether the sensors are supported in  targeted devices.

Windows Phone 8 platform has support for the following sensors

  • Motion sensor  
  • Accelerometer
  • Compass
  • Gyroscope

You can access these API’s through the below namespace:

Microsoft.Devices.Sensors

You can check for any of the sensor support through “IsSupported” boolean property of the class

  • Motion sensor   [ Microsoft.Devices.Sensors.Motion ]
  • Accelerometer  [ Microsoft.Devices.Sensors.Accelerometer ]
  • Compass [ Microsoft.Devices.Sensors.Compass ]
  • Gyroscope  [ Microsoft.Devices.Sensors.Gyroscope ]

Here is the sample code block:

  public static string GetSensors()
        {
               StringBuilder sensorsList = new StringBuilder();

                if (Microsoft.Devices.Sensors.Gyroscope.IsSupported)
                {
                    sensorsList.Append("Gyroscope, ");
                }

                if (Microsoft.Devices.Sensors.Compass.IsSupported)
                {
                    sensorsList.Append("Compass, ");
                }

                if (Microsoft.Devices.Sensors.Accelerometer.IsSupported)
                {
                    sensorsList.Append("Accelerometer, ");
                }

                if (Microsoft.Devices.Sensors.Motion.IsSupported)
                {
                    sensorsList.Append("Motion,");
                }

            return sensorsList.ToString();
        }

Note: Only Accelerometer is supported in Windows Phone 8 emulator. To test remaining capabilities, you would need to deploy the application on a real Windows Phone device.