How to free used ports on windows
“netstat” command is used to check which program is using which port.
Here are steps to forcefully free used ports.

Steps:


1) Search cmd and run it as Admin Mode by choosing “Run as administrator” on right click.

2) Type following command and hit enter 

    netstat –ano 

This will provide a list of ports, along with the PID (process ID) that has those ports open.



   (Shortcut: netstat -ano | findstr portNumber)

3) Now Check the process id corresponding to which you want to free port

    taskkill /PID XXX 


4) To forcefully kill

    taskkill /F /PID XXX


Virus : One line code to hang your friend’s PC
MS-DOS is very powerful Operating System that makes you able to create batch files the .bat file. Batch files are created to run instructions in a batch. So many pranks and the virus can be created using this. This post will guide you how to create a simple virus prank that will hang anyone’s PC. Try this on your friend’s PC to annoy them 😛 
 

Steps

 
1) Open any text editor (Notepad) and Type
 
%0|%0 

2) Save it as a batch file that is file extension must be .bat.

3) This step is optional to check what is going to happen. Open task manager by pressing Ctrl + Alt + Del and click on performance tab to view the changes those are going to happen.

4) Run the batch file.

5) Within the few seconds, the performance of your machine will be degraded and 100% memory will be full and within a minute your machine will be hanged.

Explanation  

In Windows, “%0” is the name of the currently executing Batch File. By executing %0|%0, we are recursively calling the Batch File, thereby creating many processes and utilizing CPU resources up to a point where CPU cannot offer more resources to the processes which will be created(forked) after a certain amount of time.

AngularJS Interview Questions
Here are AngularJS interview questions that will help you to crack AngularJS technical interview. 
 

1) What is AngularJS ?

2) Features of AngularJS ?

3) Difference between MVVM and MVC and MVP ?

4) What is single page application ?

5) How angular bootstrap ?

6) How to manual bootstrap angularjs ?

7) AngularJS Initialization & rendering process ?

8) Running order of

      Controller

      Filters

      Service

      Factory

      Config

      Run

9) jqLite vs jQuery ?

10) Types of binding ?

11) Two way data binding ?

12) ng-model directive ?

13) Why ng init is used ?

14) Difference Between expression{{}} and ng-bind ?

15) ng-repeat is used for ?

16) What if duplicate element in ng-rpeat ?

17) How to display unique element in ng-repeat ?

18) How to apply switch case in angular ?

19) Difference between service and factory ?

20) Is service and factory singleton object ?

21) How angular has implement singleton pattern in factory and service ?

22) One scanerio where services can’t be used ?

23)What is the meaning of # in the URL?

24) UI Routing ?

25) Abstract state in UI routing ?

26) ng routing vs ui routing ?

27) Authorizaion in ng-routing ?

28) Difference between scope and $scope ?

29) Benfit of controller As ?

30) Lazy loading of controllers ?

31) How to check current running controller ?

32) Communication between two controllers

33) What are the ajax calls?

34) What is asynchronous means?

35) What are promises ?

36) What are interceptors ?

37) What is dependency injection? How to add dependency in angularjs?

38) What is digest cycle and how you can stop it ?

39) How to check digest cycle is in progress ?

40) What is $destroy ?

41) What is ng-transclude ?

42) How you can all method of controller in directive ?

43) Different types of directives ?

44) Controller vs link in directive ?

45) Pre link vs Post Link vs Compile functions ?

46) What is best way to manipulate DOM and how can we do ?

47) Directive restrict type ?

48) Events in angularjs ?

49) Restrict types in angularjs ?

50) Custom exceptions in angularjs ?

51) Filters in angularjs ?

52) Custom filter in angularjs ?

53) What are decorators ?

54) Providers in angularjs ?

55) Session management in angularjs ?

56) Authentication and Authorization in angualrjs?

57) What is localization? How can we achieve the localization ?

58) What is local Storage?

59) What is session storage?

60) What is the difference between the local Storage and session Storage?

61) How to speed up rendering UI ?

62) Directory structure of angular js app ?

63) Best practices of angualrjs ?

64) How to remove ng-classes and directive information from DOM ?

65) What is angular 2 ?

66) Difference between angularjs 1.x and 2 ?

67) How angular 2 is rendering DOM ?

68) What is grunt? Why we use it?

69) Why we use grunt other than minification?

70) What is gulp?

71) What are the new things in available in html5?

 
So above are the AngularJS interview questions that were asked during the technical round for different companies. For more detail on AngularJS visit official website.
 

Further Reading

Play YouTube videos on VLC media player
If you want to play Youtube videos on your VLC media player installed on your desktop computer then this article will guide you through simple steps.

Steps

1) Copy the Youtube video URL. Right-click on the video and click on ‘Copy video URL’ link. It will copy the URL to your clipboard.
 
2) Open VLC player and select File > ‘Open Network’ menu option.
 
 
3) Paste the link in the URL textbox and click on ‘Open’ button.
4) Tada !!! The youtube video starts playing in your VLC player directly.
Now you can increase the volume up to 200% and enjoy the video. No need to grab those headphones. 

Here is video tutorial

Javascript Interview Questions

After javascript can be executed on the server side, it has become very popular. So for better understanding and quality code, there are few concepts that a developer must know. So here are javascript interview questions generally asked in the interviews

1) What is event bubbling and capturing?

2) Best practices in javascript?

3) How to reduce the loading time of web page without concerning too much refactoring?

4) If two div on the page has the same id(“mydiv”) then getelementbyid(“mydiv”) will refer to ?

5) How to handle large JSON on UI if rendering is slow?

6) The result of accessing undeclared variable?

7) Parent/Child communication in javascript ?

8) How to make Ajax call?

9) What is setTimeout?

10) What are closures?

11) What is a prototype in javascript?

12) Scope in javascript?

13) How to define the class in javascript?

14) How can promises be implemented in javascript?

15) # and ! in URL?

16) What are callbacks?

17) Suppose we have an error in production which is not producible on Local and we don’t have access to the production and we have only minified file the production then how you can track the error?

18) What is async and defer?

19) How to find the inner classes of a div by using javascript?

20) What is the difference between promise and callback?

21) What is view engine?

22) What are bind filters and reduce map in js?

23) Difference between primitive and non-primitives data types?

24) How javascript interpret DOM that is rendering order or control flow?

25) What is the hoisting?

26) Difference between following two snippets 

console.log(abc());
function abc(){
  return “Sunil”
}
 and
 
console.log(abc());
var abc = function(){
   return “Sunil”;
}
27) Inheritance in javascript?
 
28) Local scope and block level scope in javascript?
 

29) What is lexical scope?

 

Further Reading

 
 
Channel API (Server to client communication)
Original web design allowed only one-way client-server communication. But there are some cases in which server need to communicate with browser.

One way is to communicate from client to server after a fixed interval that is polling mechanism. But this is not the effective way even it is costly method to hit server again and again.

Google provides Channel API to do the same.

Channel API creates a connection between your application and Google servers, allowing your application to send messages to JavaScript clients in real time without the use of polling.

This is useful for applications designed to update users about new information immediately. Some example use-cases include multi-player games, or chat rooms.

Key Components : Channel API


  • JavaScript client that connects to the channel  using the channel’s unique token generated on the server.
  • Socket/Channel is created between server and client and listens on this channel

2) Server :-
  • Creats a unique channel and send to each JavaScript client so they can connect and listen to their channel.
  • Send data/messages to clients via their channels.

3) Client Id :-

  • Identifies individual JavaScript clients on the server.
  • Server sends a particular message to particular client using the client ID.


4) Tokens :-
  • Allowing the JavaScript client to connect and listen to the channel created for it.
  • The server creates one token for each client using information such as the client’s Client ID and expiration time.
  • Tokens expire after two hours and should also be treated as secret.

5) The channel
  • A channel is a one-way communication path through which the server sends updates to a specific JavaScript client identified by its Client ID.
  • The server receives updates from clients via HTTP requests, then sends the messages to relevant clients via their channels.


The message/data :-
  • Messages are sent via HTTP requests from one client to the server.
  • When a message is received, the server passes the message to the designated client via the correct channel identified by the client ID.
  • Messages are limited to 32K.

Socket
  • The JavaScript client opens a socket using the token provided by the server. It uses the socket to listen for updates on the channel.

Presence
  • The server can register to receive a notification when a client connects to or disconnects from a channel.


For more information


Code Example :


Python (Server Side)

1) Import channel api

       from google.appengine.api import channel

2) Create channel bassed on some parameter 

userId = user_id
channelId = channel.create_channel(userId)


JavaScript (Client Side)

1) Inculde Channel.js to project


<script type=“text/javascript” src=“https://talkgadget.google.com/talkgadget/channel.js”></script>


2) Get channel based on channelId created on server side

   
    var  channel = new goog.appengine.Channel(channelId);

3) Open channel

    var socket = channel.open();

4) Attach methods to sockets

       socket.onopen = function () {
           console.log(“Channel Opened.”);
       };
       socket.onmessage = function (responseData) {
         alert(‘Server Messge : ‘ + responseData.data);

       };
       socket.onerror = function () {
           console.log(‘Channel Error’);
       };
       socket.onclose = function () {
           console.log(‘Channel Close’);
       };
   };


5) Done

en_USEnglish
en_USEnglish