Join me in the free webinar on CRUD operations in Angular 2

Infragistics brings you another webinar in India time zone. This time, we are hosting it on 8th September at 3 PM. In this webinar we will cover CRUD operations in Angular 2.

Free register to attend the webinar

In the webinar, we will cover following topics

  • Components
  • Routings
  • Services
  • Forms and Validations

We will use Visual Studio Code as IDE and TypeScript as language to develop the application.

Register here to join the webinar

Also in advance you can download the sample code of the application from the webinar here

https://github.com/debugmodedotnet/angular2basiccrud

Feel free to clone it and play around. Hope to see you in the webinar.

Git command is taking wrong user? To solve – check CredentialManager

Yes, this was a strange scenario for me. I created Angular 2 project in Visual Studio Code and wanted to push the project into a GitHub Repository. Sounds a simple requirement right? So to publish the project to a GitHub Repository, I ran following 5 commands in the order given below:

  1. git init
  2. git add –A
  3. git commit –m “commitmessage”
  4. git remote add origin “Url of GitHub Repo”
  5. git push origin master

For the push command, I got the error as shown in the image below. Focus on error message for user djinfragistics

image

Error message is very clear that user djinfragistics does not have access to the remote repository hence HTTP Error code 403 is returned from the GitHub server.

To check current user name for the project I ran the command

  1. git config user.name
  2. git config user.email

As shown in the image below, I found username and user email was set to the user which had access to remote repository.

image

I was confused and was not able to figure it out that why git command is not taking user from the current project and taking some random user djinfragistics. I thought might be global user is set to djinfragistics. So, to check that I ran the command as below

  1. git config –global user.name
  2. git config –global user.email

As shown in the image below, I found username and user email was set to the user which had access to remote repository.

image

It was strange, that global user is also set to the different user, however to publish project, git was taking some strange user djinfragistics from somewhere.

After bit of researching, I found that on windows when we install git 2, Credential Manager also gets installed. It runs as a daemon process and caches the git user credentials, such that each time we do not have to provide user information to push the changes to GitHub repository.

In my scenario, I might have used djinfragistics username earlier on the same system and that user got cached in Credential Manager. So even though user was set to debugmode, on running the command git was taking user djinfragistics from credential manager.

To check various options, run the command as shown below

  • git credential-manager

Above command will show us all options of credential manager. I was lazy and wanted to publish project as early as possible, so I ran

  • git credential-manager uninstall

image

The above command will uninstall credential manager and we will have to provide git user credential each time. I would recommend you to explore various options and edit the file rather uninstalling it.

It solved my problem and git command started taking correct user name. I hope it helps.

Recap of Angular 2 Road Trip–Gurgaon

 

Reacp of Angular 2 Road Trip Indore 

image

 

To start with, I thank my employer Infragistics for all support in making these community events successful. We have awesome set of controls for your AngularJS 2, MVC, jQuery etc. application. Please download free trial of Ignite UI here

image

On 27th Aug, I hosted second event of my Angular 2 Road Trip in Gurgaon.. Read more about AngularJS 2.0 here . This time, it was turn of city Gurgaon to show the love for Angular 2  and there were around 280-300 developers attended the event.

image

You might be wondering that why people are seating on the floor? because I had more attendees than expected. I thought there would be maximum 100- 130 people would join the event. But I was wrong, and around 300 people attended the event. There were no enough chairs for all 300 people, so we removed all the chairs from the hall such that everyone could be accommodated by seating on the floor. I must appreciate passion and learning attitude of each participants that they agreed to seat on the floor for 5-6 hrs. We all sat on the floor for the learning and love of AngularJS 2.0

image

In six hours I covered following topics,

  • Setting up development environment in VS Code
  • Understanding Bootstrapping
  • Understanding Modules
  • Understanding Components
  • Creating first component
  • Creating Service
  • Understanding Routing
  • Performing CRUD operations using http

I also covered basics of JavaScript functions, objects, and inheritance. Attendees were very much involved and fully participated. I used Dan Wahlin AngularJS 2.0 project from GitHub as the starter project and built application on top of that.

image

I was very motivated and aspired to do better seeing participations and passions of people, even though they were seating on the floor for whole days and many of them did not get lunch. I must each attendee for their support in successfully execution of the event.

image

I must also thank Microsoft India, specially Usha Rathnavel for her support in providing us hall, coffee/tea and lunch for the attendees on very short notice. Without her help this event was not possible.

image

Once again I thank each developer who came for the event. Since I am based out of Delhi, aspired to so more such event in Delhi.

image

Last but not least I would like to thank below mentioned people for their support in making AngularJS 2.0 multi city tour success.

Brad Green, Dan Wahlin, Geard Sans, Jaosn Beres , Todd Motto , Glenn Block

Next destination is Ahmedabad J see you there.   You can see more photos of the event on my FaceBook here  and in last group photo is here

image

Thanks everyone Smile

Recap of Angular 2 Road Trip–Indore

 

image

To start with, I thank my employer Infragistics for all support in making these community events successful. We have awesome set of controls for your AngularJS 2, MVC, jQuery etc. application. Please download free trial of Ignite UI here

image

You can see more photos of the event on my FaceBook here

On 20th Aug, I hosted first event of my Angular 2 road trip. Read more about AngularJS 2.0 here in Indian city Indore. Despite heavy rain around 150 –170 developers attended the event.

image

In six hours I covered following topics,

  • Setting up development environment in VS Code
  • Understanding Bootstrapping
  • Understanding Modules
  • Understanding Components
  • Creating first component
  • Creating Service
  • understanding Routing
  • Performing CRUD operations using http

I also covered basics of JavaScript functions, objects, and inheritance. Attendees were very much involved and fully participated. I used Dan Wahlin AngularJS 2.0 project from GitHub as the starter project and built application on top of that.

image

I was very motivated and aspired to do better seeing participations and passions of the people.  I must each attendee for their support in successfully execution of the event.

image

I would like to thank everyone who came to attend the event and each volunteers from campus connect.

image

Last but not least I would like to thank below mentioned people for their support in making AngularJS 2.0 multi city tour success.

Brad Green, Dan Wahlin, Geard Sans, Jaosn Beres , Todd Motto , Glenn Block

Next destination  in road trip is Delhi-NCR. See you there .

What are Closures in JavaScript?

Read full article on the Infragistics Blog

A JavaScript closure is a function which remembers the environment in which it was created. We can think of it as an object with one method and private variables. JavaScript closures are a special kind of object which contains the function and the local scope of the function with all the variables (environment) when the closure was created.

image

To understand closures, first we need to understand SCOPING in the JavaScript. We can create a variable or a function in three levels of scoping,

  1. Global Scope
  2. Function or local scope
  3. Lexical scope

I have written in details about scoping here, but let’s take a brief walkthrough of scoping before getting into closures.

Scopes in JavaScript

As soon as we create a variable, it is in a Global Scope. So, if we have created a variable which is not inside any function, it is in a global scope.

Read full article on the Infragistics Blog

Working with GitHub Repositories and Visual Studio 2015

Read full blog post on the Infragistics Blog

GitHub is one of the most popular code sharing platforms, following the GIT algorithm for version control. In this blog post, we will learn how to work with a GitHub repository and Visual Studio 2015, and will answer the following questions:

1. How to sync or share a project from Visual Studio to a GitHub Repository

2. How to clone a GitHub Repository in Visual Studio

Syncing or Sharing project from Visual Studio in GitHub Repository

To share the project, let’s take the following steps:

Step 1: Start with creating a Repository on GitHub. To do that navigate to https://github.com/ and click on the + sign to create a new repository. In this example, I am assuming that you have already created an account in GitHub.

image

Next you need to provide information including:

  • Name of the repository
  • Description of the repository
  • Whether repository is public or private
  • Whether to initialize the repository with a README.

image

Make sure not to initialize the repository with a README. If you do so, you will encounter errors while syncing the project to the repository. Once the repository is created, click on Clone or the Download dropdown and copy the web URL as shown in the image below. We’ll need the GitHub repository URL later in Visual Studio.

image

Step 2: Install Git for Windows on the machine. You can download this here: https://git-scm.com/download/win. After downloading, follow the screens to install completely.

Step 3: Open the Visual Studio solution you want to publish to this GitHub repository in Visual Studio. In the Visual Studio Solution Explorer, right click on the solution and click on Add Solution to Source Control.

image

 

Read full blog post on the Infragistics Blog

What is the Extension Method in C#?

Read full article on Infragistics blog

I often get questions about the Extension Method in C#. The Extension Method was introduced in C# Version 3.0. and allows us to add functionalities in an existing class without modifying it, extending it, or re-compiling it.

Essentially, the Extension Method allows us to add a new method to an existing class:

  • · Without modifying it or adding code
  • · Without extending it or creating a new derived type
  • · Without recompiling the class

image

Extension methods are a special kind of static method but can be called on objects like an instance method. So, an extension method can be used in the same way as normal instance methods.

Steps to create an Extension Method

Step 1: Define a static visible class which will contain the Extension Method or Extension Methods. Make sure the class is visible to the client code by applying the appropriate accede modifier.

Step 2: Create a static method with at least the same visibility level as the containing class.

Step 3: The first parameter of the Extension Method always specifies the type method operates on. Make sure the type name is preceded with the “this” modifier.

Step 4: In the calling code, add the namespace that contains Extension Method class.

Step 5: Use the Extension Method on the type in the same instance method can be used. Keep in mind that we do not need to pass the first parameter because that denotes the type, however we should pass the second parameter onwards to call the extension method.

Read full article on Infragistics blog

Simplifying Objects, Inheritance and prototype in JavaScript

Although JavaScript is a Class-Free language, it supports objects creation, overriding properties/methods and inheritance. In this post, we will explore the concepts of object creation and inheritance.

In JavaScript, Objects can be created in three possible ways:

  1. An object as literal
  2. Using the function constructor
  3. Using the Object.Create method

Object as literal

A simple object Student – as an object literal – can be created as shown in the listing below:


var Student = {

    name: "dj",
    age: 32,
    Father: {
        'name': 'Ram',
        'occupation': 'service'
    },
    Subjects: [{

        name: "Physics",
        marks: 89
    },
	{

	    name: "Chemistry",
	    marks: 95
	}]
};

Above we have created an object called Student. There are three types of properties attached to Student: simple properties like name and age, complex properties like “Father”, and an array property called Subjects. We can read properties as shown in the listing below:


console.log(Student.Father.name);

for (var i in Student.Subjects) {
    console.log(Student.Subjects[i].name);
}

We can also have a function serve as the property of an object, which is known as the method. So let’s say we want to attach a method “Speak” to the Student object.  We can add the Speak method as shown in the listing below.


var Student = {

    name: "dj",
    age: 32,

};

Student.Speak = function (message) {

    var finalMessage = this.name + " has said :" + message;
    console.log(finalMessage);
};

Student.Speak("I am the best");

On calling Speak function as method, we will get output as shown in the image below:

There are some important points about the Speak method to remember:

  1. Properties can be added to an object at any time; a property can be added to an object after its creation too. For example, we added the Speak property later to Student object, rather than at the time of object creation.
  2. In the object’s method, the object is defined by value “this”. That is why we are able to print the name of the Student using this.name in the method.
  3. Calling a function as method is known as “Method Invocation Pattern”

In the above example, we are calling the Speak method on the object “Student”. So the value ofthis inside the Speak method is the Student object.

If we want to pass some other object as the value of “this” in the method, we can use the apply or call function. For example, we have one more object called Parents and,

  1. We are calling the Speak method of the Student object directly and the value of “this” in the Speak method would be Student.
  2. We are passing Parent as the value of “this” in the Student object’s Speak method. We are using the apply function to call the Student object’s Speak method and passing the Parent object as the value of this.

Read full article on the Infragistics Blog

Got Microsoft Most Valuable Professional Award 7th times

 

Thank you Microsoft, once again for recognizing me and my contributions

clip_image002

I am very excited and happy to share that, once again I have got Microsoft Most Valuable Professional (MVP) Award. Microsoft has been awarding me this prestigious MVP Award for last 7 consecutive years. Even though, I have got it many times, I feel same happiness as I felt when I got it first time. I carry this award with pride and below mail from Microsoft gives me motivation to work harder and smarter.

clip_image004

First time I got Microsoft MVP award in 2010 and getting it each year after that. I have been getting it different expertise.

image

Note: WCF also knows as Connected System Developer (CSD)

Since 2010 technology has been changed lot, it has changed so much that now you have bash shell in windows and android emulator in Visual Studio. It’s tough to be relevant in continuous changing eco system. However, I will try to keep contributing as speaker, blogger, and a developer evangelist.

In year 2015 stats of my contribution was as follows:

image

Thanks Note

These contribution were never possible without constant help and motivation from my employer Infragistics and my boss Jason Beres. I love my job as developer evangelist here, and I will forward culture of Infragistics to create more awareness about technology in developer community.

I would also like to thank C-SharpCorner community and Mahesh Chand for giving me opportunity to contribute to their chapters and conference.

I would also like to thank Microsoft India evangelism team, India MVP Lead Biplab Paul , and Gandharv Rawat for their continuous support.

Once again thank you so much for everyone for being part of this journey.

Happy Coding

Objects and Inheritance in JavaScript – Free Webinar on 31st March

We at Infragistics are excited to bring another webinar in India time zone. On 31st March at 3 PM IST, we are hosting a webinar on Objects and Inheritance in JavaScript.

Register for free to attend the webinar here

In the webinar we will cover following topics

  • Object as literal
  • Function constructor
  • Object.Create
  • __proto__ property of object
  • Prototype property of function
  • Prototype based inheritance

We will code something like below :

image

You expect less slides and more codes in the webinar. We will use sublime text for all the demos.

Register free for the webinar here

Feel free to share about the webinar using the hashtag #igwebinar and you may have chance to win some cool goodies from us.

You have chance to win more goodies if you learn about our jQuery library Ignite UI before coming to webinar.

Excited to see you on 31st March at 3 PM IST in the webinar.

Register free for the webinar here