Understanding Facebook concepts: Part 1 – Open Graph

I work with Facebook SDK for .NET and recently presented at Facebook Mobile Dev Con in New York. To further the cause, I presented some of my learnings within Microsoft in front of some peers. Then I thought that I should record it as a screencast and put it out there for everyone, so that is what I did. What I learnt from this whole journey was that Facebook is a tremendous platform for presenting information and engaging users into deep, meaningful and personal experiences. This makes the users more engaged and at the same time drives more traffic to your product.

Once out of the realm of marketing, really, technically, the Facebook platform is built around a few simple concepts i.e. Open Graph objects and actions that combine in powerful ways to  convey your message, reach your audience and in general enrich user experiences. Once you understand these basic concepts, the rest of the Facebook platform becomes a lot easier to understand and interact with. Here is the first part explaining what Open Graph is and how the Vertices and Edges in the Open Graph look like.

On a side note, I have started using Camtasia Studio for recording – and what a difference – it has cut down the video sizes from 100s of MBs to 10s of MBs without any significant loss in quality. Hopefully,  you will be able to appreciate it too.

Single Sign On (SSO) on Windows 8

Single Sign On (SSO) is the ability in Windows 8 to sign into any OAuth provider such as Facebook, Twitter, Google etc from one account and never have to see the login dialog again. The OS manages the login from that point onwards and every time the user tries to logon to the OAuth provider from another app, the system automatically logs them on and the OAuth provider can then prompt the user for Authorization. I have been working with SSO for a while now and I realized that although Windows 8 SSO is quite easy to understand conceptually, the documentation does not make that clear and it is hard to get an end to end sample working with just the bare essentials that illustrate this.

The core problem is that to experiment with SSO, you need to setup a server. I would think that most people give up the ghost right where it asks one to setup a server. As if that is not enough, the SSO server needs to have HTTPS enabled. That makes the problem doubly complicated. Thus, to fix that issue, I spun up an Azure Website with Node.js that has already setup the server. The samples linked below run, by default against  that website, so you can play with SSO without needing to setup a server.

I also have created a small powerpoint brief showing how SSO works, that is linked below here too. The source code for the server as well as the client is provided here.

SingleSignOnE2ESample Actual Project Source code

Win8SSOArch PowerPoint with explanation of SSO

Lesson 11: Scope in JavaScript

In this lesson, I focus on the nitty gritty of Scope and Lifetime of variables in JavaScript Language. JavaScript has similar scoping model as most other C like languages with a minor difference in that it does not have block scope.

Here is the code:

55-scope

Lesson 10: Prototypes in JavaScript

Sorry for the long delay between the last lesson and this one. Lots of travel and work got in the way of this post. Without further ado, here is the lesson on Prototypes.

Prototype is much misused keyword in JavaScript. Prototype word in JavaScript is used interchangeably for two subtly different concepts. This has lead to much confusion. In this lesson, I demystify what these two concepts are and explain the difference between “prototype” the keyword and the concept called “prototype”. Prototypes in JavaScript allow for creation of rich constructor functions and also add the inheritance functionality to JavaScript.

The code file for this lesson is present at:

90-prototypes.js

Lesson 9: Constructor Functions

Constructor functions in JavaScript are special functions that allow you to create a factory function that can create many objects of the same type through code reuse. For Object Oriented programmers, constructor functions are a familiar concepts.

The code for this lesson is here:

 Constructor Functions

Lesson 8: JavaScript Functions

JavaScript functions are what gives Javascript its power. With JavaScript functions, you can break down your code into small modules which, helps with readability, debuggability and reusability of code. JavaScript functions double up as objects as well.

Here is the code file for this sample:

50-functions.js

 

 

 

Lesson 7: Assignment 1 – Etch-a-Sketch and CScript

Hello and Happy New Year!

I am back in the new year with the first blog entry that will exercise your mind and give you some hands on experience as you progress through it.

Reading input using node.js is not straightforward, and hence, in this assignment, I am having you guys use this tool called CScript. CScript is a Javascript engine that is built in into Windows. It has a very simple input reading mechanism, so you should use it for this assignment.

The code for this assignment is here:

35-reading_input_with_cscript.js

The assignment itself is here:

Assignment 1

 

 

Lesson 6: Arrays in JavaScript

Arrays are one of the built in DataTypes in JavaScript. They are on par, if not more useful than Objects. Arrays in JavaScript perform the function of Arrays and Lists/Vectors in other languages. Arrays allow you to traverse their contents in a serial manner using an index or allow random access to any element contained within them using array indices. Arrays in JavaScript can grow and shrink without the need to manually shift contents of the array.

The code for this lesson is present here:

40-Arrays.js

Lesson 5: Basics of Source Control with Git

In this lesson, I go over the basics of Source Control. Source Control is the way professional Software Developers maintain their code. Even though it is probably one of the most useful tools to learn when you start software development, for some reason, most colleges never teach this. Here, I am introducing you to Source Control using Git, an open source Source Control tool.

This is an introductory lesson on Git and provides sufficient details for you to be able to start managing code using source control. However, Git is way more powerful than what I have showcased in this lesson. That being said, a full excursion into the intricacies of Git is beyond the scope of this Course. This lesson is meant to get you started on using Source Control. As you go through with Software Development and use Git more and more, you will realize the benefits Source control provides and at that point you can look at the many tutorials present on the Internet for using Git.

You will need to install two pieces of Software to be able to follow this lesson. Install these in the given order i.e. Msysgit before TortoiseGit. Accept all default options and keep clicking the next button until the software installation is finished. After you are done, reboot the machine so that all changes have successfully applied.

  1. Msysgit
  2. TortoiseGit

Lesson 4: JavaScript Objects

Lesson 4 is about JavaScript Objects. JavaScript is an Object Oriented Language and objects in JavaScript are one of the foremost core concepts. Objects allow you to group data together and provide you with the flexibility and power of creating containers that help you make your programs Modular and Elegant.

The code for this lesson is present here:

30-objects.js