Thursday, 18 May 2017

6 Reasons to learn AngularJS


Angular 2 was released in late 2016 and brought Angular into the modern web with its desktop and mobile applications. If you build Web applications, chances are you’ve heard of Angular, the popular JavaScript framework for building full-featured, client-side, browser-based applications. The recent release of Angular 2 (September 2016) brought Angular into the modern Web and expanded its reach into mobile and desktop applications.

So what’s all of the Angular 2 excitement about? How is it different from every other JavaScript framework out there? Is it worth learning? What’s there to love?

Here are six reasons to love Angular 2.

1. Enhanced developer productivity with Angular 2
The Web has changed significantly during these past five years. With ECMAScript (ES) 2015, we have modules, classes and arrow functions. Angular 2 leverages these features to make its coding patterns more consistent and easier to learn.

Add to that Typescript, a language that is a superset of JavaScript and provides static typing and interfaces. By leveraging TypeScript for Angular development, we get great tooling such as type checking, safer refactorings and inline code documentation.


These features enhance our development and editing experience and help us reason about, debug and better understand our code.

2. Consistent coding patterns
One of the best things a framework can do for developer productivity is have a consistent set of coding patterns, and Angular does just that. Let’s talk about three of them: classes, built-in dependency injection and the MVVM (model-view-view/model) pattern.

Angular 2 uses ES classes and a set of annotations, called decorators, to build all of the key Angular constructs. Want to build an Angular component? Create a class and add the appropriate decorator. Want to build a custom pipe filter? Create a class and add the appropriate decorator. Building an Angular module? Create a class and add the appropriate decorator. Building a service? Well, for a service we … build a class and add the appropriate decorator. You get the idea here. Angular 2 provides a very consistent coding pattern for building up the pieces of the application.

Another coding pattern Angular 2 leverages is the power of dependency injection (DI). To use any of the built in Angular services, such as HTTP or Router, we simply inject the service into any class that needs the service. Angular implements constructor-based dependency injection, so to inject a service we simply pass that service as an argument to the class constructor. That’s it. And when we build our own custom services, we inject them using the same technique.

Angular also takes advantage of common architectural patterns. When building client-side applications there are often three pieces to the puzzle: the user interface, the code that supports and controls that user interface and the model containing the data for that interface. Angular 2 clearly separates these three pieces using the model-view-view/model, or MVVM, pattern.
The view is defined in a template that contains the HTML for a specific component. The template can layout a page, any part of a page, or define a reusable set of user interface elements.

The model is defined as properties of the component class. For example, we define a hero property that models a superhero. We use an interface to define the details of that hero property, identifying the specific data elements associated with that hero such as hero name, alter ego and special powers.

The view/model is the class that manages both the view and the model. This is the code that calls services to retrieve data, reacts to user interactions on the view such as hiding or showing elements and calls services to save user entries.

By taking advantage of these common patterns, Angular 2 makes development easier and more productive.

3. Extensive binding with Angular 2
Many client-side Web applications work with data. The application retrieves data from a back-end server and displays that data in a view using a template. And if the user can change that data, the user’s entries must be read from the view and saved back to the back-end server. The code required for this process can be tedious and error prone.

Angular 2’s data binding makes this process easy. Simply bind HTML elements in the template to the model properties in the class and the data will automatically appear in the view. And if the user can change the values, Angular 2 supports two-way data binding. So any change the user makes to the data in the view automatically updates the model properties in the class.

In addition to data binding, Angular 2 supports property binding. This allows us to control the document object model (DOM) by binding HTML properties to component class properties. For example, we bind the HTML hidden property of an image element to a component class property such as hideImage. When the component class property is set to true, the image element is automatically hidden. When the component class property is set to false, the image element automatically appears.

And lastly, Angular 2 supports event binding. This means we can react to any event from the view, including HTML events such as click, third party component events or our own custom events. We simply bind the event to a method in the component class. When the event occurs, the method is executed.

These extensive binding features make it easy to display data, obtain user entries, control the DOM and react to events.

4. Full-featured routing
One view does not an application make. Most client-side Web applications provide many views to support all of their functionality. There may be a view for a welcome page, a hero list page, a hero detail page and a hero edit page. Then sets of views for villains or jobs. We need to display the correct view at the correct time. That is the purpose of routing.

Angular 2 provides full-featured routing. With Angular we define a route to each page of the application. Then we activate the appropriate route based on the user’s actions. We can pass data to routes, so we can tell the hero detail page to display the details for the hero with an id of 42.

We can guard routes so that a user cannot access a route without a login or only if they are an administrator. We can prevent leaving an edit page until the user confirms they want to save or cancel their changes. We can pre-load data before displaying a page.

Angular 2 supports child routes for navigating within a specific route. For example, we navigate to a detail page and from that page navigate to child routes for a technical specifications page or more information page. This is also useful when displaying tabs of information within a page.

We can even lazy load specific routes so the code for the route is not downloaded to the browser and loaded unless the user accesses the features associated with that route. So if we have admin features for example, those features are not loaded until the user requests to access the admin features.

Together, these many features make Angular 2 routing very flexible and powerful.

5. Minimized size and maximized performance
Size and performance are somewhat related when working with a Web-based application. A smaller component improves startup performance both on download time and compile time in the browser. One of the key goals for Angular 2 is to minimize size and maximize performance.

Minimizing the size of the download is achieved in several ways. First, we can make the size of each component as small as possible. Second, the components are organized into Angular modules in such a way that logical groupings can be downloaded together. And third, lazy loading of routes only downloads the Angular modules required to display the user-selected route. As the user moves to other routes, the needed content is downloaded, and routes the user never use are never downloaded unnecessarily.

Then there is the Ahead of Time (AoT) compiler. With AoT, the compiler runs once at build time. The browser then downloads the pre-compiled version of the application and renders the application immediately, without the need to compile it first in the browser. Plus there is no need to download the Angular compiler, dramatically reducing the application download size.

Angular 2 executes faster, has less work to do and has a low memory footprint.

6. Documentation and community
The documentation for Angular 2, at angular.io, is extensive and varied. It includes a quickstart guide for getting you up to speed quickly with Angular 2. It includes a user guide and an API reference. It provides documentation on more advanced features, and a cookbook with recipes for common tasks such as form validation and dependency injection.

But the best part for learning Angular 2 is the tutorial. It provides a step-by-step code-along experience introducing all of the basic features of Angular 2. Or, if you would prefer a live online classes or classroom training join myTectra : Angular 2

Read more in the post below, which was originally published here on CIO.com.

Will Python Replace Java?



According to the IT programming trend, Java is currently more popular than other programming languages in terms of number of jobs, number of existing Java developers and overall usage statics in IT compared to Python. According to the latest usage statistics posted on a popular Technology Survey site, Java is being used by 3.0% websites as a server-side programming language, whereas only 0.2% of websites use Python. However, all the recent reports have highlighted that the usage and popularity of Python is growing drastically compared to Java where the Java usage is coming down year on year.

At myTectra we have been monitoring the Trend of Python and Java since 2013 based on number of Jobs posted inNaurki for Bangalore region since 2013. In the below table we could able to see that Java requirement is coming down year on year whereas Python requirement has grown from 200 in 2014 to 6500+ in 2017.

Language
2014 April   
2015 April   
2016 April   
2017 April
Java Job Posting for Bangalore City
17000+
17000+
15000+
12000+
Python Job Posting for Bangalore City
200+
500+
3500+
6500+

Job Posting Statics from Indeed shows python is the only Programming language consistently growing compared to Java which is going down drastically.
So it becomes essential for programmers to understand some of the major differences between these two popular programming languages.

Understanding Important Differences between Java and Python

Both Java and Python are general purpose programming languages. While the former is a statically typed language wherein the programmers have to declare all variable names explicitly, the latter is looked upon as a dynamically typed language where developers are not required to declare variable names explicitly.

Java requires developers to write longer lines of code to accomplish common programming tasks. They also have to put in additional time and effort to organize, maintain and update the Java code base. On the other hand, syntax of Python enables developers to express concepts without writing longer lines of code. It further emphasizes on reusable and readable code generation. Thus, it becomes easier for programmers to maintain and update the code base.
Both the languages have been updated on a regular basis. The programmers can use Java 8 to avail a number of new features including lambda expressions, a new date/time API and a new functional interface. They can further switch from version 7 to version 8 of the programming language without any hassle. But developers often find it daunting to choose between Python 2.x and Python 3.x. Both the versions are being maintained in parallel and hence switching from Python 2.x to Python 3.x is found to be challenging.

Java makes it easier for programmers to create portable cross-platform applications. These applications can run on any device on which Java virtual machine (JVM) is running. On the other hand, the developers have to use a Python compiler to convert the code written in Python into code understandable by the specific operating system. As JVM is installed on many devices, the developers can run Java applications on various devices without requiring any specialized tools and compilers.

The performance and speed of the two programming languages differ. Many programmers have proved that Java is faster than Python. While it cannot be used to accomplish CPU-intensive tasks, developers often have at their disposal, a number of options to enhance the execution speed of Python. They have to replace Python's default runtime with CPython, PyPy or Cython to increase the execution speed significantly. On the other hand, the performance of the Java application can be easily optimized without using any additional tools.

Along with being a popular web technology, Java is also used widely for developing apps for world's most popular mobile operating system, i.e., Android. The Android SDK includes a number of standard Java libraries. The developers can easily create Android apps by taking advantage of networking, data structure, graphics, and math libraries. They can even avail a number of tools and frameworks to speed up Android app development. But those into Python development know that it cannot be used for mobile app development directly and exclusively. The developers have to use additional frameworks and tools to use it for mobile app development. Many programmers prefer developing mobile apps with Java to save both time and effort.

The reason for Python is becoming more popular and huge surge in number of requirement year on year is Python become a language of choice for all the current trending Technologies in IT. Python adopted as a language of choice for almost all the domain in IT including Web Development, Cloud Computing (AWS, OpenStack, VMware, Google Cloud, Oracle Cloud, etc.. ), Infrastructure Automation , Software Testing, Mobile Testing, Big Data and Hadoop, Data Science, etc. If the current trends continues Python will become the most sought after language and overtake the number of jobs requirement in next 2-3 years.

Top 25 PowerShell Interview Questions Prepared by Experts


1)   Explain what is PowerShell?

Power shell is an extendable command shell and a scripting language for Windows.

2)   What are the key characteristics of PowerShell?

The key characteristics of PowerShell are
  • PowerShell is object-based and not text based
  • Commands in PowerShell are customizable
  • It is a command line interpreter and scripting environment

3)   In PowerShell what does variables holds?
In variables PowerShell contains strings, integers and objects.  It does not have special variables as it is pre-defined with PowerShell

4)   Explain what is the significance of brackets in PowerShell?
  • Parenthesis Brackets (): Curved parenthesis style brackets are used for compulsory arguments.
  • Braces Brackets {} : Curly brackets are employed in blocked statements
  • Square Brackets []: They define optional items, and they are not frequently used

5)   What does it mean cmdlet’s?
Cmdlet’s are simple build in commands written in .net language like C# or VB introduced by Windows PowerShell

6)    Explain what is PowerShell Loop?
Automating repetitive task with the help of PowerShell loop is known as PowerShell Loop.  Through PowerShell, you can execute  For each loop,  While loop  and Do While loop.

7)   Explain can you create PowerShell scripts for deploying components in SharePoint?
If you have created a web part using VS 2010 then, you can deploy it using cntrl+f5. However to activate the web part feature you can write a PowerShell script (.ps1) and execute it after deployment

8)   Explain about the PowerShell’s comparison operators?
Comparison Operators compares value in PowerShell.  Four types of comparison operators are used equality, match, containment and replace.  In PowerShell, one of the key comparison operators is –eq that is used instead of “=” sign for declaring variables.  Likewise, there are other operators like –ne for “not equal” , -gt ( greater than ) or –lt (less than).

9)    Explain what is PowerShell pipeline is used for?
PowerShell pipeline is used for joining two statements such that the output of one statement becomes the input of the second.

10)   Explain what is PowerShell get-command?
Get command in PowerShell is used to fetch other cmdlets, for example you are looking for cmdlet between letter L and R then your PowerShell get-command will be like
# PowerShell Get – Command Range
Clear-Host
Get-Command [ L–R ]*

11)   Explain with an example how you can map a network drive in PowerShell?
To map a network drive in PowerShell you have to use the command like
# PowerShell Map Network Drive
$Net = $( New – Object – ComObject Wscript.Network )
$Net.MapNetworkDrive( “S:”, \\expert\myTectra )
In here the drive letter is “S:” and the Network share is called ‘expert’ on a computer called ‘myTectra.’

12)   Mention what are the three ways that PowerShell uses to ‘Select’?
  • The most common way is in a WMI Query Language (WQL) statement. In this technique Wmiobject uses ‘-query’ to introduce a classic ‘Select * from’ a phrase
  • The second context for ‘Select’ in PowerShell is Select-String. This cmdlet checks for a word, phrase or any pattern match
  • Another way is Select Object

13)   What is the function of Get-ServiceStatus in PowerShell?
The cmdlets of windows enable you to filter the window services.  PowerShell can list which services are ‘Running’ and which are ‘Stopped’ by scripting with windows.

14)    Explain what PowerShell Scripting is?
PowerShell file contains a series of PowerShell commands with each command appearing on a separate line. To use a text file as a PowerShell script, its filename should have.PS1 extension. To run a script you need
  • Type the commands in a text editor
  • Save the file with .ps1 extension
  • Execute the file in PowerShell

15)   What is the use of hash table in PowerShell?
A hash table is also referred as dictionary. It is an array that allows you to store data in a “key-value” pair association. The “key” and “value” can be of any data and length.  To declare a hash table you have to use @ followed by curly braces.

16)   Explain what is the use of Array in PowerShell?
The use of Array in PowerShell is to run a script against remote computers.  In order to create an array, you have to create a variable and assign the array.  Arrays are represented by “@”symbol, they are represented as hashtable but not followed by curly braces.
For example, $arrmachine = @ ( “machine1” , “machine2” , “machine3”)

17)   Mention what is the command that can be used to get all child folders in a specific folder?
To get all child folders in a specific folder, you have to use parameter recurse in the code.
Get-ChildItem C:\Scripts –recurse

18)   Explain how you can convert the object into HTML?
To convert the object into HTML
Get-Process l Sort-object – property CPU –descending l convert to – HTML l Out-file “process.html”

19)   Explain how you can rename a variable?
To rename a variable,
Rename-Item- Path Env: MyVariable –NewName MyRenamedVar

20)    Explain what is the function of $input variable?
The $input variable enables a function to access data coming from the pipeline

21)   What is the code to find the name of the installed application on the current computer?
Get-WmiObject-Class Win32_Product- ComputerName . l Format-wide-column1

22)   Explain how you can find in PowerShell that all the sql services are on one server?
There are two ways to do this
  • get-wmiobject win32_service l where-object {$_name-like “*sql*”}
  • get-service sql*

23)   What is the best way to find all the sql services on one server?
There are two ways to do this.
  • get-wmiobject win32_service | where-object {$_.name -like "*sql*"}
  • get-service sql*

24)   Which class can help us identify whether the m\c is 32 bit or 64?
win32_computersystem. This can be used as follows:
      PS C:\> $server = gwmi -cl win32_computersystem
      PS C:\> $server.SystemType X86-based PC

25)   What is Variable Interpolation?
When you add a variable to a double-quoted string, PowerShell replaces the variable name by its value. This feature is called variable interpolation.