Sunday, April 30, 2017

difference between "==" and "==="

"==" will not check for type but when we use "===" it will check for type also and returns true when type of variables on both sides is same.

Example:

if(3=="3") will return true;

if(3 ==="3") will return false;

Thursday, April 27, 2017

AJAX

AJAX is acronym for Asynchronous JavaScript and XML. Ajax makes it possible to send and receive data asynchronously without reloading the web page. In general web applications the client(browser) is blocked when we refresh the page as it makes use of synchronous requests. But with Ajax the client is not blocked and works independently. Web applications like gmail, facebook etc make use of AJAX .

Wednesday, April 26, 2017

WSDL

WSDL means Web Services Description Language.It is written in XML and it is used to describe a web service. It provides details about location of service and methods of service.

Monday, April 24, 2017

Object Class

Object class supports all classes in .Net Framework class hierarchy and provides low level services to derived classes. This is the base class of all classes in the .NET framework .

Sunday, April 23, 2017

Continuous Integration

Continuous Integration is a development practice in which  the developers are required to commit changes to source code in a shared repository several times a day or more frequently.

Every commit made in the repository is then built. This allows the teams to detect problems early.


Saturday, April 22, 2017

p5.js

p5.js is a JavaScript library which can be used by artists,designers,educators and beginners who want to code. Using p5.js we have a full set of drawing functionality and this is not limited to canvas alone, we can make use of addon libraries from p5.js and easily interact with other html objects like text, input, video, webcam and sound.

Friday, April 21, 2017

Cloud Computing

Services and solutions that are delivered and consumed in real time over internet are cloud services.
Cloud computing is a delivery model of computing services over the internet .It enables real time development ,deployment and delivery of broad range of products, services and solutions.


Cloud cloud characteristics:

  • On demand self service
  • Ubiquitous network access:anywhere, anytime ,any device
  • location independent resource pooling
  • Rapid elasticity-Auto scaling
  • Pay as you go

Thursday, April 20, 2017

What is a Hypervisor?

hypervisor or virtual machine monitor (VMM) is computer software, firmware, or hardware, that creates and runs virtual machines. A computer on which a hypervisor runs one or more virtual machines is called a host machine, and each virtual machine is called a guest machine.

Hypervisor is a virtualization platform. A hypervisor is a computer software,firmware or hardware that will create and run virtual machines. On a computer with hypervisor we can run one or more virtual machines is called host machine and the virtual machines are called guest machines.

There are two types of hypervisors:

Type 1: Delivered as an integral part of Operating System

Type 2: Delivered as a process that runs within an Operating System 


Wednesday, April 19, 2017

Friendly Words:Friendly words can be defined as if a word is formed from characters of another word then those two words are friendly words.Example:listen,silent. Given an array of strings print group of friendly words in alphabetical order horizontal and vertically.

import java.util.*;
public class helloworld
{
public static void main(String []args){
String []a={"ivra","cheating","ravi","abc","cba","listen","teaching","dale","god","dog","lead","silent","deal"};
Arrays.sort(a);
String[] temp=new String[a.length];
for(int i=0;i<temp.length;i++){
temp[i]=a[i];
char[] chars = temp[i].toCharArray();
       Arrays.sort(chars);
       String sorted = new String(chars);
       temp[i]=sorted;  
}
String[] ans=new String[temp.length];
int kj=0;
Set<Integer> kh = new HashSet<>();
for(int i=0;i<temp.length;i++){
if(!kh.contains(i)){
String str=new String();
boolean matched=false;
for(int j=i+1;j<temp.length;j++){
if(temp[i].equals(temp[j])){
str=str+" "+a[j];
matched=true;
kh.add(j);
}
}
if(matched){
str=a[i]+str;
str.trim();
}
if(!str.isEmpty()&&str!=null)
ans[kj++]=str;
}
}
for(String word : ans){
if(word!=null)System.out.println(word);
}

}
}

Output:
abc cba
cheating teaching
dale deal lead
dog god
ivra ravi
listen silent

Tuesday, April 18, 2017

Ansible

Ansible is an IT Automation, Configuration Management and Provisioning tool.Provisioning is to install required softwares to make applications run. Configuration Management - manage software on top of hardware. IT automation is to offer cloud provisioning,automating entire IT.

Ansible uses 'playbooks' to deploy, manage, build, test and configure anything from full server environments to websites to custom source code for applications.

Features:
  • Agentless: There is no need for agent installation and management on host.
  • Built on top of python.
  • It uses SSH for secure connection.
  • It follows push based architecture for sending configurations
  • Very easy and fast to setup with minimal requirements.
Tools like puppet and chef are pull based and they require agents to be installed like chef client. Agents on the server periodically check for the configuration information from central server (Master). Ansible is pull based and central server pushes the configuration information on target servers. We also have control on when to apply changes made on the servers.


 Push based advantages:
  1. Full control
  2. Synchronous
  3. Simple and easy to learn
Push based disadvantages:
  1. Cannot achieve full automation
  2. Lack of Scalability(unless we make use of heavy threading)
Pull based advantages:
  1. Full automation
  2. Scaling up is very easy.
Pull based disadvantages:
  1. We cannot configure system whenever we want it.
  2.  Setting up initially will take a lot of time.
Depending on these pros and cons of both pull based and push based tools, when we have large infrastructure we opt for pull based and where configuration should be fast we use push based.

Ansible agent less architecture:
  • Ansible uses agent less architecture as mentioned. We first establish an SSH connection initially and later we connect to the host using SSH.
  • We make use of host file, which contains IP addresses of all the hosts. We can also group them and perform operations individually or on a group of hosts.

Ansible architecture:
  • The following image shows the Ansible architecture.It consists of host inventory, modules, plugins, connection plugins and playbooks.
  • Modules are pieces of code that get executed on host.
  • Plugins are special kind of modules that are executed before a module gets executed.
  • Connection plugins may be SSH plugin/ docker container plugin.
  • Host Inventory contains the list of hosts grouped together.






Monday, April 17, 2017

Explain Amazon Cloudfront


  • Amazon cloudfront offers a simple cost effective way to improve the performance, reliability and global reach of your entire website for static content, the dynamic portions of your site that changes for each end user and both live and on demand streaming.
  • With amazon cloudfront we store the original versions of our files on one or more origin servers and then create an amazon cloudfront distribution, which references that location of original files.
  • Amazon cloudfront delivers our content through a worldwide network of data centers called edge locations. When a user requests content that you are serving with Amazon Cloudfront the user is routed to the edge location that provides the lowest time delay, so that content is delivered with best performance.

  • Amazon Cloudfront works seamlessly with static content and dynamic web applications running in AWS origins such as amzon ec2, elastic load balancing or amazon s3 or your origin running outside of AWS without any custom coding or proprietary configuration.


  • It also provides optional detailed control over who is able to download our files to help ensure information is accessed by only authorized persons.
  • We can also make use of monitoring and alarms via Amazon cloudwatch to keep an eye on Amazon cloudfront distribution for any problems.
  • This can be useful for  business and application developers who need an easy and cost effective  way to distribute content with low latency and high data transfer speeds.

Sunday, April 16, 2017

Explain about Amazon Virtual Private Cloud?

Amazon Virtual Private Cloud(VPC) gives you the ability to create a logically isolated network in the AWS cloud from which we can launch resources such as EC2 based on the configuration .A VPC gives complete control over our virtual network starting with defining subnets, the IP addressing scheme,configuring routing tables and network gateways.

Its similar to data center (or) corporate network and by extending our corporate or home network we can create a hybrid cloud where we can launch resources in VPC and in corporate /home network.

Benefits:
  1. Variety of options to address the needs of business and applications such as public and private subnets connecting to our data center, vpc peering, vpn connections or just connecting to internet.
  2. It provides us an ability to define our own custom subnet and IP addressing scheme, control routing through use of custom routing tables and also able to assign multiple IP addresses to our instances.
  3. Amazon VPC provides advanced security features such as security groups, network access control lists to enable inbound and outbound filtering at the instance level and subnet level.
  4. Single tenant hardware.
  5. Scalable and reliable: It has all the same benefits as the rest of AWS platform like we can instantly scale resources up or down.

Saturday, April 15, 2017

Handling "Cannot read configuration file due to insufficient permissions" error while hosting a website using IIS

When you are hosting a website using IIS you may get an error like this.


This is because of not providing required permissions to the folder which contains our website and its supporting documents. This error is resolved by modifying permissions given to the folder.

Right click the folder and go to properties.


Go to Security tab and add user "Everyone" and give all permissions.


Now refresh the page in browser. Your problem is solved.




Friday, April 14, 2017

Establishing ssh connection between two hosts in Linux

Consider two hosts A and B with user a on host A and user b on  host B. We are establishing a secure connection between these two hosts A and B for user a to login automatically without password to user b account on host B.

We first login on A as user a and we should generate a pair of authentication keys i.e, public and private keys. This is done as follows:

a@A: ssh-keygen -t rsa

Now we should create a directory .ssh as user b on host B.

a@A: ssh b@B mkdir-p .ssh

here it asks for b@B's password.Enter the password.

Now we should copy the a's public key to b@B:.ssh/authorized_keys.

a@A:cat .ssh/id_rsa.pub | ssh b@B 'cat >> .ssh/authorized_keys

It will again ask for b@B's password.Enter the password.

After this you can log into B as user b from A as user a without a password.

a@A: ssh b@B






How to pass a number with leading zero as decimal value to a function in JavaScript?

In JavaScript a number with leading zeros is considered to be in Octal system and it is read as octal value.

Ex:"0025" is read as "21".

In order to have its value preserved we should pass it as string.

Ex: myfunction(x){
   
alert(x);
}

we should call function as myfunction("0026")

Monday, April 10, 2017

Explain about JIT

In .Net framework we have just in time compiler present in Common Language Runtime which converts MSIL code into native code.

Different types of  Jit are:

  • Pre-Jit -Compiles complete source code into native code at the time of deployment
  • Ecno-Jit -Compiles the code associated with required item like loading form or button click etc
  • Normal Jit -Compiles the code required and stores in cache, whenever the same thing is required it loads from cache.
By default we have normal Jit in CLR. To use pre jit we make use ngen.exe. In theory it seems that Pre-Jit is useful but when you look at realty Jit compiles and generates native code specific to machine depending on the various properties of the run time environment ,so it is beneficial to go with normal jit.

Sunday, April 9, 2017

what is MSIL

MSIL is Microsoft intermediate language. When we compile a program in .net, the source code is converted into an intermediate language called Microsoft Intermediate Language. At this point the code is partially compiled and it cannot be run on the operating system. When we run the application this partially compiled code is compiled to machine specific  by the Just In Time compiler present in Common Language Runtime using the operating system  environment properties like CPU,OS etc

Saturday, April 8, 2017

difference between "IS" and "AS"

"IS" keyword can be used to check whether two variables are of same type.

Ex:
object obj="narendra";
object obj1=1234;

if(obj is string)
{
Console.WriteLine("Success");//this statement executes as obj is string
}

if(obj1 is string){
Console.WriteLine("Success");//this statement is not executed as obj1 is not string
}

"AS" keyword is used to convert variables from one type to another and if conversion is not successful then null is stored.

string str=obj as string;//here it succeeds and str has value of "narendra"

string str1=obj1 as string;// here it fails and str1 has null value

Thursday, April 6, 2017

Explain about WPF?

WPF(Windows Presentation Foundation) is a graphical subsystem to display user interfaces. One should be wondering we have win forms for this then what is need for WPF. WPF has the following advantages over win forms.

Anywhere execution

We use XAML in wpf which makes it possible to use the same code for various types of applications like windows, web or silver light etc.

Binding

Binding objects is very easy in WPF. Without writing single code we can bind two objects.

Common Look and Feel

We can make use of styles and the same style is applied to our entire application as and when required.

Declarative Programming(XAML)

We describe abstractly what need to be done and visual studio will do the directive programming for us in the back end.

Express Blend and animation

WPF internally uses Directx, directx is used for animation, so WPF can do animation as well. Express Blend is a tool which is used to create animation and reuse it.

Fast Execution

WPF uses directx and supports software, partial, hardware rendering depending on requirement, whereas win forms uses software rendering only.

Graphic Independent

WPF uses DIP(device independent pixel) 1 dip =1/96 of an inch and it adjusts itself to any screen based on this .



Wednesday, April 5, 2017

What is Sharding?

Sharding can be considered as a horizontal partitioning in which a large database is partitioned into smaller, faster, more easily managed parts called data shards.


The basic idea is as the size of database and number of transactions increase linearly, the response time to query the database increases exponentially. And maintaining large database is also costly as it requires high-end computers. Contrast to this data shards can be distributed across a number of less expensive servers.

What is impedance mismatch?

The misalignment of application layer objects to tables and rows is called impedance mismatch. Developers usually want a database which is easy to use. Relational databases save data in tables and rows, but our application hardly ever does.

class A{int x,string[] tags

--------------------------------------------------------------------------------------















In the above example we have an object that contains a field x and tags, which contains a bunch of strings, or tags .If we want to save this data in a database we would need three tables one for main object, another for tags, and another to map tags to main object. This forces the developer to write a mapping layer or use an ORM to translate between object in our memory and what is saved in the database.


Tell about MongoDB?

MongoDB is a document-oriented database, not a relational one. Non relational means it does not store data in tables but in the form of JSON document.  Here in MongoDB row is replaced with document and table is replaced with collection. Collection can be considered as a group of documents.

Document is the basic unit of data for MongoDB, roughly equivalent to a row. It is a data structure composed of field and value pairs. MongoDB documents are similar to JSON objects. The values maybe documents, arrays, and arrays of documents.

Tell about RethinkDb ?

RethinkDb is a NoSQL, distributed document based database. It is free and open sourced, we write queries in ReQL query language. The interface also looks amazing, and we can view our results in a tree , a table, or a JSONView. RethinkDb is fast, its very scalable and easy to administer as it ships with a web based interface that comes online immediately. Using this we can do many things, from creating databases and tables to sharding, or replicating a selected table.

RethinkDb is considered as MongoDb done right. RethinkDb uses all the best features of MongoDb and corrects the things gone wrong. RethinkDb stands between Riak,Cassandra and CouchDb, MongoDb. RethinkDb supports "joins" which is not there in many document based databases.


Monday, April 3, 2017

What is Linq ?

LINQ stands for Language Integrated Query. We can use Linq to query various types of data stores like SQL Server, XML etc. With use of Linq we can work with different data sources using similar coding style and there is no need to learn syntax of the data store. Linq also provides intellisense support and compile time error checking.

Linq was introduced in 2008 with .net framework 3.5. LINQ offers a compact, expressive, and intelligible syntax for manipulating data.

Sunday, April 2, 2017

Explain about SqlConnection object

SqlConnection object is used to establish a connection with the database using database connection string. The database connection string consists of the location of database and type of authentication like windows or SQL server.

Saturday, April 1, 2017

Explain about SqlCommand object

SqlCommand object is used along with Sqlconnection object to send or receive data from database.
The SqlCommand object carries the SQL statement we need to execute on the database.

Call a function in child component from parent component in React

Consider the following parent component class Parent extends React.Component { constructor(props) { super(props);         thi...