Quote for the Week

"Learn to enjoy every moment of your life"

Monday, November 21, 2016

Build Mobile Apps using Xamarin and C#

As we love C# to use for building web applications and windows apps as well, if it is case why can't  we use same language to build Mobile Apps with .net framework. Microsoft comes up with new framework called Xamarin Mobile App development.


What is Xamarin?


At its extreme basic, Xamarin is a platform which can be used to build and test native cross-platform mobile apps using C# & Visual Studio. It also has its own IDE named “Xamarin Studio” which can be used as an alternative to Visual Studio. Also, it provides seamless integration with Visual Studio, compatibility with most emulators in market (AVD, Xamarin Android Player, Genymotion, etc.) and also provides abundant set of components which one can use in their project depending on their requirement.

Features


Native UI


When we start with development on cross platform apps, there are two approaches which one could choose, first is using Xamarin Forms & the other is using Xamarin Platforms. Xamarin Forms provide a common UI classes & tags which we be used common between all platforms (Win Phone, iOS & android). Whereas, the other approach involves creation of Platform specific approaches which can be helpful if we want to make use of Platform Specific classes. For instance, if one would want to use iBeacon class which is exclusively available only on iOS, we can do it in Xamarin. IOS project by making use of the iBeacon class. There can be similar requirement in either of the 3 platforms, which can be done using the same method.

Native Performance


For iOS, when the program is compiled, it sends the request to a Mac and uses its own compiler for the code written by you and converts it into the package which can then be deployed on an emulator. For Android, when the program is compiled, it sends a request to “mono,” a framework built by Xamarin as an alternative to Dalvik to boost overall application performance.

Moreover, unlike other mobile development frameworks which run the app within web-view (browser), Xamarin programs run directly on the device, which enables the application to run seamlessly on the mobile device, with minimal performance overhead.

Same day support


This is the one of the most beautiful features of Xamarin. They have successfully proven in history that Xamarin provides same day support to all new releases on any mobile platforms. This will continue even in the future.

Xamarin Testcloud


With more than 30 unique devices in iOS & 24k devices in Android, it is practically impossible to test your app in each device on UI, performance & other factors. To make it possible, Xamarin provides a feature called “Test Cloud”, in which your app is tested for all such pre-defined factors using a robotic hand. Post which a detailed report is sent to you with screenshot and exact details of error, if any.


Xamarin Insights


Once an app is built and published in the store, it is essential for a publisher to know whether users are using the app, analytics of the users, and complete details of errors/crashes when it occurs on a user device. To make this happen automatically, Xamarin facilitates us with a feature named “insights” which sends you mail alerts on crashes and also provides in-depth report on the usage of the app in real sense.


Pricing -


Detailed pricing structure can be found on the Xamarin site, however, it is available in three main categories. Namely, Starter – Indi - Business. Business and Indi are chargeable on monthly/yearly basis respectively and starter edition is Free for all. The only catch here is that it limits the app size to 128KB for starter.

Conclusion -


In a nutshell, Xamarin is exceptionally helpful and easy framework for developers with dot net background and companies who are not willing to hire more resources with separate skill sets for separate mobile frameworks. I am sure that there are many more features in Xamarin apart from the ones listed above. 

The overall costs involved in licensing are little difficult for developers to buy it on an individual level. I only hope that they come with free license for developers or increase the app size limit in Starter editions soon to encourage a much larger portion of community.

Thursday, September 22, 2016

WCF vs ASP.NET Web API



I spent three months to learn the concepts of WCF and Web API,  what is difference between them and which one should to prefer for our application. Let's see :

WCF :


As we know WCF stands for Windows Communication Foundation which enables building services that supports multiple transport protocols (HTTP, TCP, UDP and custom transports) and allows switching between them where we can build secure, reliable service that can integrate across the platforms and inter operate smoothly.

Asp.net Web API  :


Well, it is also a framework that is used to make HTTP services. As you know, now a days we are using mobiles, tablets, apps and different types of services, so Web API is a simple and reliable platform to create HTTP enabled services that can reach wide range of clients. It is used to create complete REST services.

RESTful Services


REST stands for Representational State Transfer.  REST is an architectural pattern for creating services. REST architectural pattern specifies a set of constraints that a system should adhere some specific constraints like Client server communication , stateless, Cacheable, Uniform interface that will play GET, PUT,  POST, DELETE

By Default, Web API supports RESTful services and for WCF need to configure.You have an existing SOAP service, you must support but want to add REST to reach more client but it is more complicate to implement REST because WCF needs more configuration to set up and it is headache.

WCF over Web API


  • Choose WCF when you want to create a service that should support special scenarios such as one way messaging, message queues, duplex communication etc.
  • Choose WCF when you want to create a service that can use fast transport channels when available, such as TCP, Named Pipes, or maybe even UDP (in WCF 4.5), and you also want to support HTTP when all other transport channels are unavailable.
  • Choose Web API when you want to create a resource-oriented services over HTTP that can use the full features of HTTP (like URIs, request/response headers, caching, versioning, various content formats).
  • Choose Web API when you want to expose your service to a broad range of clients including browsers, mobiles, iphone and tablets.



Hope you got cleared with which is best one to choose for your application.

Feedback or queries?

mail to : dotnetcircle@gmail.com



Tuesday, March 8, 2016

How to get table names in given pattern in Sql Server

Many a times I come across a scenario where I will be remembering only part of the table name and need to find the complete table name. Traversing through hundreds of tables in the database and finding the exact table is boring, tedious time consuming job. In such scenarios we can use on of the below three approaches, I always use the first one as it is easy for me to remember. Let me know which approach which you use and reason for the same.

To demo this create a sample database with three tables by the below script:

CREATE DATABASE SqlHintsDemoDB
GO
USE SqlHintsDemoDB
GO
CREATE TABLE dbo.Customers (CustId INT, Name NVARCHAR(50))
CREATE TABLE dbo.CustomerOrders (OrderId INT, CustId INT)
CREATE TABLE dbo.Employee(EmpId INT, Name NVARCHAR(50))
GO


Approach 1: Using sp_tables


We can use sp_tables statement like below to find all the tables in the database whose name contains the word cust in it. Like

sp_tables '%cust%'

Result :



Approach 2: Using sys.Tables


We can use sys.tables catalog view like below to find all the tables in the database whose name contains the word cust in it.


SELECT * FROM sys.Tables
WHERE name LIKE '%cust%'


Result:

Table Name Like in Sql Server Using sys.tables


Approach 3: Using information_schema.tables


We can use information_schema.tables information schema view like below to find all the tables in the database whose name contains the word cust in it.


SELECT * FROM information_schema.tables
WHERE table_name  LIKE '%cust%'

Result : 

Table Name Like in Sql Server Using information_schema.tables