Saturday, January 31, 2015

Install Go Language and Lite IDE on Ubuntu

Note: I’m not moving to Another world. Still C# and ASP.NET is my bread and butter.
Recently I have installed Ubuntu as Virtual OS in Oracle Virtual Box. This was one of first exposure I got Linux base operating system.  Earlier I have used Linux when I was doing my masters as part of their curriculum.  So far I am having fun Ubuntu and other Linux base operating system has come far.

After installing Linux, I thought why should I try some other language which is completely different then which I am working right now. This make me Polyglot  programmer and I could learn something from trying a new language and so I gone through various language and choose Go language.

Why Go Language?

Here are the reasons why I have choose to learn GO programming language.
  • It’s backed by Google so will not go away near future.
  • High performance :  Makers of Go language claims that it will perform as fast C and C++ language.
  • Fairly easy language to run.
  • Statically typed just like C#.
  • It has Garbase collection so I don’t have to worry about memory management like C and C++
  • Concurrency is in built
To know more about go language you can visit following site. It has got ton of resources.
http://golang.org/
Share:
Monday, January 26, 2015

Setting up development environment for ASP.NET 5(vNext) on Ubuntu

I am really enjoying working on Ubuntu. In previous post, We have learn how to install Sublime Text and in this blog post we are going to learn how we can setup development environment for ASP.NET 5(vNext). So what we are waiting for let’s go.

Note: First thing you need to make sure that Python 3.0 or higher version is installed. I have installed latest version of Ubuntu which already has Python preinstalled.

Setting up package manager control:

The first thing you need to is to install/setup package manager control. To Install package control, We need to go from View- > Show console menu. It will load package control. You need to run following command from the console. It will install the package manager control.
import urllib.request,os,hashlib;
h = '2deb499853c4371624f5a07e27c334aa' + 'bf8c4e67d14fb0525ba4f89698a6d7e1';
pf = 'Package Control.sublime-package'; 
ipp = sublime.installed_packages_path();
urllib.request.install_opener( urllib.request.build_opener( urllib.request.ProxyHandler()) );
by = urllib.request.urlopen( 'http://packagecontrol.io/' + pf.replace(' ', '%20')).read(); dh = hashlib.sha256(by).hexdigest(); print('Error validating download (got %s instead of %s),
please try manual install' % (dh, h)) if dh != h else open(os.path.join( ipp, pf), 'wb' ).write(by)
You can also copy this command from the this url- https://packagecontrol.io/installation

Share:
Sunday, January 25, 2015

How to install Sublime Text 3 in Ubuntu

I am quite having fun with Ubuntu on Oracle virtual box.In last blog post, I have already shown you how you can run ASP.NET 5 (vNext) app in Ubuntu. Now we are going to setup development environment for ASP.NET 5(vNext) and my preferred choice of editor is sublime text. If you have not heard about Sublime Text you should visit following link.

http://www.sublimetext.com/3

As we all know Sublime Text is a popular editor and  now Sublime Text3 is available with beta version for both registered users and general public. The Webupd8 team created a Personal Package repository containing the installer for Ubuntu and Linux. So we can install it very easily on Ubuntu.

So first thing we need to do is add PPA repository to Ubuntu via running following command.
sudo add-apt-repository ppa:webupd8team/sublime-text-3
It will load PPA repository into Ubuntu like below.

ppa-webupdate8-team

Share:

ASP.NET 5(vNext) on Ubuntu 14.4(Linux)

As we all know Microsoft has recently launched ASP.NET 5 and Microsoft has made announcement that it will work on any version of Linux and OSx. So in this post we are going to learn how we can use ASP.NET 5 on Ubuntu.

Installing Ubuntu on Oracle Virtual Box:

As I don’t have spare computer where I can install Ubuntu so that I’m going to install it on Oracle Virtual Box. If you don’t know about Virtual Box then it it a powerful x86 and AMD/Intel 64  virtualization product for enterprise or home box. It is freely available as GNU Licence.

You can find more about  Oracle Virtual Box here- https://www.virtualbox.org/

There are few things you to consider before going this route.
  • You need to first make sure that your computer supports virtualization or not. There are some utilities available for that like Intel processor identification utility – You can download from the here- https://downloadcenter.intel.com/Detail_Desc.aspx?DwnldID=7838. It will tell you whether your processor supports Virtualization or not.
intel-processor-utility
  • After checking whether your processor supports virtualization, you need to enable virtualization from Bios. That is different as per your Processor and you can learn how you can enable virtualization on your pc via searching on internet.
  • Make sure you have at least 4 GB ram to run this virtual OS smoothly. If you less RAM then it will work but thing will be slow.
Share:
Saturday, January 24, 2015

Recent updates to C# 6.0 syntax with new version of Visual Studio 2015 CTP

This blog post is part of C# 6.0 Features Series.
Recently, Microsoft has announced new version of Visual Studio 2015 and I have downloaded it. At the same time I was checking what’s new in Visual Studio 2015 CTP newer version and and I have found that suddenly my c# 6.0 new features solutions  stopped working.

The first problem it got is with static class using features. Following was my code.
using System.Console;

namespace StaticClassUsing
{
    class Program
    {
        static void Main(string[] args)
        {
            WriteLine("With using statement");
        }
    }
}

Now when you run this it was giving error like following.

Share:
Tuesday, January 13, 2015

Intellisense for Bower and NPM in Visual Studio 2015


Microsoft has recently launched the Visual Studio 2015 Preview with ASP.NET 5(vNext) and it’s got ton of features. In this blog post we are going to learn about Intellisense feature for Bower and NPM.

What is Bower and NPM:

 

Bower: Bower is a package manager for JavaScript libraries that allow you to define, version and retrieve your dependencies. It works on top of NPM. You can find more about that at following link.

http://bower.io/
https://egghead.io/lessons/bower-introduction-and-setup

NPM: NPM stands for Node Package Manager- It’s a kind of package manager for the installing node.js packages just like NuGet packages.  You can find more information about following location.

https://docs.nodejitsu.com/articles/getting-started/npm/what-is-npm
http://en.wikipedia.org/wiki/Npm_(software)

Share:
Sunday, January 11, 2015

Dependency Injection Series–DotNetJalps

I have written couple of blog post about dependency injection. So I thought it will be a good idea to write a summary blog post where it contains all the post about dependency injection.

Implementing dependency injection pattern in .NET
StructureMap–Getting Started
Dependency Injection with Simple Injector
Dependency Injection with ASP.NET MVC and Simple Injector

Hope you like it. Stay tuned for more.
Share:
Thursday, January 8, 2015

C# 6.0–Dictionary Initializers

This blog post is part of C# 6.0 Features Series.
As we know c# 6.0 provides some cool new features and syntax sugar. Dictionary Initializers is one of them.  Till C# 5.0 we used to have collection initializers for collections but now C# 6.0 provides new way of initializing dictionary . This initialization features is available for there collections which supports index.

Following is a code for new way of initializing dictionary.
using System;
using System.Collections.Generic;

namespace DictionaryInitializer
{
    class Program
    {
        static void Main(string[] args)
        {
            Dictionary<int, string> Person = new Dictionary<int, string>()
            {
                [1] = "Jalpesh Vadgama",
                [2] = "Vishal Vadgama"
            };
            foreach (var person in Person)
            {
                Console.WriteLine("Key:{person.Key}, Value={person.Value} ");
            }
        }
    }
}

Share:
Wednesday, January 7, 2015

Continuous Integration Series–DotNetJalps

I have written couple of point related to Continuous Integration and this post will server as a list of posts related to continuous integration.

Why continuous integration is your friend?
Continuous integration with visualstudio.com and TFS
Continuous Integration with visualstudio.com,Unit Test(Test Driven Development) and TFS

Hope you like it. Stay tuned for lots more about Continuous Integration and Continuous Deployment related post.
Share:

C# 6.0–Expression Bodied Members

This blog post is part of C# 6.0 Features Series.
There are lots of great features added to C# 6.0 and Expression bodied members are one of them. It’s provide great syntax sugar which will help you make your code more beautiful and readable.  In earlier versions of C# type definitions were always been tedious and we need to provide a curly braces and return type even if that function contains one single line. Expression bodied function will help you in such scenarios.

Let’s take a example to understand it. Following is a code to understand it.
using System;

namespace ExpressionBodiedMemebers
{
    class Program
    {
        static void Main(string[] args)
        {
            Person person = new Person
            {
                FirstName = "Jalpesh",
                LastName = "Vadgama"
            };
            Console.WriteLine(person.GetFullName());
        }
    }

    public class Person
    {
        public string FirstName { get; set; }
        public string LastName { get; set; }

        public string GetFullName()
        {
            return string.Format("{FirstName} {LastName}");
        }
    }
}

Share:
Sunday, January 4, 2015

Understanding KRE,KVM,KLR and KPM in ASP.NET 5(vNext)

ASP.NET 5(vNext) is a new upcoming version of ASP.NET that Microsoft has redesigned from the scratch. Recently Microsoft has released Visual Studio 2015 Preview and with that they have released ASP.NET VNext.  In ASP.NET 5 (vNext) it comes with new runtime environment called KRE(K Runtime Environment) . With this version you can also run your application through command prompt using various commands. In this blog post we are going to learn about all terms related K Runtime Environment.

KVM(K Version Manager):

K version manager is one of the first thing you need to run command . KVM is responsible for installing and updating different version of KRE. It’s a PowerShell script used to get and manage multiple version of KRE being it on same time on same machine. So one application can now have one version of KRE and another application can have another version of KRE on same time. You can find more information at https://github.com/aspnet/Home/wiki/version-manager
Share:

Assembly Neutral Interface in ASP.NET 5(vNext)


Recently Microsoft has open sourced it’s entire ASP.NET next version stack on GitHub and I have been closely watching this for a quite a some time to understand how they have created architecture of it and how they organize everything in such a large stack.

I have seen  [AssemblyNeutral] attribute in few of interfaces and I was curious why it was required. So I dig into it and learned about it.

Why we need Assembly Neutral Interfaces?

In earlier version of ASP.NET and Microsoft.NET Interfaces are bind to a assembly where it is declared. Let’s say I have written a interface under DotNetJalps namespace for my framework.
namespace DotNetJalps
{
    public interface ILogger
    {
        DoAmazingStuff();
    }
}
Now after some time this framework is super popular and everybody loves abstraction I have created and now they wants same abstraction so there are two ways we can do this.

  1. Convenience me to write this abstraction.
  2. Write implementation themself and maintain that.
Share:

C# 6.0–New feature series

This post will be aggregator post for all C# 6.0 feature series. Here you can find all of my blog posts about what’s new in C# 6.0.

Till now, I have written following blog posts.

C# 6.0–nameof Operator
C# 6.0–Auto implemented property initializer
C# 6.0–Static class using statement
C# 6.0–String Interpolation
C# 6.0- Null Conditional Operator
C# 6.0–Exception Filters
C# 6.0–String Interpolation
C# 6.0–Expression Bodied Members
C# 6.0–Dictionary Initializers
Recent updates to C# 6.0 syntax with new version of Visual Studio 2015 CTP

Hope you like it. Stay tuned for lot more about new Microsoft.NET technologies!!
Share:
Saturday, January 3, 2015

C# 6.0–String Interpolation

This blog post is part of C# 6.0 Features Series.
As we all know, C# 6.0 provides lots of small enhancements to the language and string interpolation is one of them. In this blog post we are going to learn how this small new feature can help us for string concatenation.

So let’s take small example, Where I have created a new example of string concatenation. Following is a code for that.
using System;
namespace StringInterpolation
{
    class Program
    {
        static void Main(string[] args)
        {
            string name = "Jalpesh Vadgama";

            //Old way of string concentaionation 
            Console.WriteLine("My name is" + name);
            Console.WriteLine("My name is {0}", name);

            //New way of doing this
            Console.WriteLine("My name is {name}");
        }
    }
}
Share:
Friday, January 2, 2015

Happy New year 2015

New year passed so fast and that I have not feel as its a big time. On this occasion I would like to thank you all my readers for reading my blog and encourage me via putting lots of comments. I promise I will keep writing this blog whenever I get a chance.

Wishing every one a happy new year!!
Share:
Thursday, January 1, 2015

C# 6.0–Exception Filters

This blog post is part of C# 6.0 Features Series.
C# 6.0 contains lots of small features and one of them is Exception filters. It is already there with VB.NET earlier but now it is available in C# also. In exception filters now if exception is combined with Exception statement and If condition of if satisfy then it will execute that block.

Let’s take a simple example to understand it better. Following is a code for a simple console application. Before exception filters we were able to write a code like following.
using System;

namespace ExceptionFilters
{
    class Program
    {
        static void Main(string[] args)
        {
            try
            {
                throw new Exception("Jalpesh");
            }

            catch (Exception ex)
            {
                if(ex.Message =="Jalpesh")
                    Console.WriteLine("Exception with Message Jalpesh is executed");
                else
                    Console.WriteLine("Exception with Message DotNetJalps executed");
            }
        }
    }
}
In above example, I have thrown a exception in try block and in catch block I have written if-else block to check message and based on that it will print some method.

Share:

Support this blog-Buy me a coffee

Buy me a coffeeBuy me a coffee
Search This Blog
Subscribe to my blog

  

My Mvp Profile
Follow us on facebook
Blog Archive
Total Pageviews