C++

What is C++ ?
  • C++ is a general purpose, case-sensitive, free-form programming language that supports object-oriented, procedural and generic programming.
  • It is a middle-level language, as it encapsulates both high and low level language features.

History of C++ :
  • It was developed in 1980 by Bjarne Stroustrup at bell laboratories of AT&T (American Telephone & Telegraph), located in U.S.A.
  • Bjarne Stroustrup is known as the founder of C++ language.
  • It was develop for adding a feature of OOP (Object Oriented Programming) in C without significantly changing the C component.
  • C++ programming is "relative" (called a super set) of C.

Features of C++ :
C vs C++ :

CC++
C follows the procedural style programming.C++ is multi-paradigm. It supports both procedural and object oriented.
Data is less secured in C.In C++, you can use modifiers for class members to make it inaccessible for outside users.
C follows the top-down approach.C++ follows the bottom-up approach.
C does not support function overloading.C++ supports function overloading.
In C, you can't use functions in structure.In C++, you can use functions in structure.
C does not support reference variables.C++ supports reference variables.
In C, scanf() and printf() are mainly used for input/output.C++ mainly uses stream cin and cout to perform input and output operations.
Operator overloading is not possible in C.Operator overloading is possible in C++.
C programs are divided into procedures and modulesC++ programs are divided into functions and classes.
C does not provide the feature of namespace.C++ supports the feature of namespace.

Pro's of C++ :
  • Wide support
  • Powerful
  • Speed
  • Small standard library

Con's of C++ :
  • Unsafe
  • Little memory management
  • Lack of custom operators
  • Complicated

Basic concepts in C++ :
Basic Input/Output :
  • C++ I/O operation is using the stream concept. Stream is the sequence of bytes or flow of data. It makes the performance fast.
  • If bytes flow from main memory to device like printer, display screen, or a network connection, etc, this is called as output operation.
  • If bytes flow from device like printer, display screen, or a network connection, etc to main memory, this is called as input operation.


Variable : 
  • A variable is a name of memory location. It is used to store data. It's value can be changed and it can be reused many times.
  • It is a way to represent memory location through symbol so that it can be easily identified.
  • Syntax : type variable_list;

Rules for defining variables : 
  • A variable can have alphabets, digits and underscore.
  • A variable name can start with alphabet and underscore only. It can't start with digit.
  • No white space is allowed within variable name.
  • A variable name must not be any reserved word or keyword e.g. char, float etc.

Data Types : 
A data type specifies the type of data that a variable can store such as integer, floating, character etc.

TypesData Types
Basic Data Typeint, char, float, double, etc
Derived Data Typearray, pointer, etc
Enumeration Data Typeenum
User Defined Data Typestructure
if-else : 
  • In C++ programming, if statement is used to test the condition. There are various types of if statements in C++.
    • if statement
    • if-else statement
    • nested if statement


switch :  switch statement executes one statement from multiple conditions.


For Loop :
  • The C++ for loop is used to iterate a part of the program several times. If the number of iteration is fixed, it is recommended to use for loop than while or do-while loops.
  • The C++ for loop is same as C/C#. We can initialize variable, check condition and increment/decrement value.
Syntax : for(initialization; condition; incr/decr){    
//code to be executed    
}

While loop :
while loop is used to iterate a part of the program several times. If the number of iteration is not fixed, it is recommended to use while loop than for loop.
Syntax : while(condition){    
//code to be executed    
}

Do-While Loop : 
  • do-while loop is used to iterate a part of the program several times. If the number of iteration is not fixed and you must have to execute the loop at least once, it is recommended to use do-while loop.
  • The C++ do-while loop is executed at least once because condition is checked after loop body.
Syntax : do{    
//code to be executed    
}while(condition);

Cold Fusion

What is Cold Fusion ?
  • ColdFusion is one of the easiest programming environments to use, and enables us to create powerful server-side web applications very quickly, with much less code than other technologies such as ASP, PHP etc.
  • ColdFusion integrates many Internet technologies such as XML, Java, web services etc, and as such, our applications can be as small or complex as required.

History of Cold Fusion ?
  • The software was created in 1995 by the Allaire Corporation, originally located in Minnesota.
  • Adobe acquired Macromedia in 2005 and is still actively developing ColdFusion.

What Can ColdFusion Do ?
  • Query a database
  • Allow users to upload files
  • Create/read files on the server
  • Present a customized experience 
  • Send emails 
  • Schedule tasks to run automatically 
  • FTP files to/from another server
  • Publish web services..etc.

Pro's of Cold Fusion : 
  • Rapid Application Development
  • Easy to understand syntax
  • Tons of built in features
  • Cross-platform.

Con's of Cold Fusion : 
  • Expensive
  • Limited career prospects
  • Very few applications written in it.
  • Has overwhelming competition it can never hope to rival.

Setup & Installation : 
  • Go to official website of adobe cold fusion and click on download for trial version.


  • Double click on the downloaded setup file.


  • Click on next.


  • Accepts the terms and choose the server configuration and click on next.


  • Select the sub components and click on next.


  • Enter the username and password for remote administration.


  • Choose the path, web server and click on next.


  • Enter the port number, username and password. 


  • Click on install.


  • Click on done.


  • Program to print hello coldfusion.

Basic concepts in ColdFusion : 
Variables : 
  • A variable can be visualised as a container that stores a value. 
  • To set a ColdFusion variable, use the <cfset> tag. To output the variable, you need to surround the variable name with hash (#) symbols and enclose it within <cfoutput> tags.

If Statement :
  • A conditional statement is a piece of code that does one thing based on one condition, and another based on another condition. 
  • With If statements, we can tell the ColdFusion server to execute a piece of code only if a given condition is true.


ColdFusion Loops (cfloop) :
  • A ColdFusion loop is a block of code that executes continuously either a specified number of times, once for each element in an object, or while a condition is true.
  • In ColdFusion, we use the <cfloop> tag to perform a loop. The <cfloop> tag has a number of different attributes. The attributes used depends on the type of loop we're performing.


ColdFusion Lists : 
A ColdFusion list is simply a string. The thing that makes this string different (to any other string) is that it contains delimiters. Delimiters (sometimes referred to as separators) are used to separate each item in the list.

FunctionsDescription
listLen(coldfusion_list)To find out the list length
listAppend(coldfusion_list, "ColdFusion Functions")Add an item to the end of the list
listPrepend(coldfusion_list, "ColdFusion Functions")Add an item to the beginning of the list
listInsertAt(coldfusion_list, "2", "ColdFusion Functions")Add an item somewhere in the middle of the list
listContains(coldfusion_list, "ColdFusion")Find out if the list contains a given string
ListToArray(coldfusion_list)Convert a list into an array
ArrayToList(array_name)Convert an array into a list

ColdFusion Arrays : 
An array is simply an ordered stack of data items with the same data type. Using an array, you can store multiple values under a single name. Instead of using a separate variable for each item, you can use one array to hold all of them.

Function : 
  • A function is a self contained block of code that performs a given 'function', then returns a value. Often, a function will require that you pass it one or more arguments. 
  • The purpose of an argument is to provide the function with further info that it needs in order to process. This info could be different depending on the context in which the function is being called.
  • We can either build your own functions, or use one of ColdFusion's built-in functions. ColdFusion has over 250 built-in functions ranging from string-manipulation functions, date functions, array functions, mathematical functions and many more.
  • To use a ColdFusion function, we write the function name, followed by opening/closing brackets. Any arguments that we pass to the function goes between the brackets.
  • Syntax : functionname(parameter1, parameter2,...).

Ruby on Rails

What is Ruby on Rails ?
  • Ruby on Rails is a server-side web application development framework written in Ruby language by David Heinemeier Hansson. 
  • It allows us to write less code than other languages and frameworks. It includes everything needed to create database-backed web applications according to MVC pattern.

What is Ruby ?
  • Ruby is a dynamic, open source, object oriented programming language. It runs on all types of platforms like Windows, Mac OS and all versions of UNIX.
  • It is fully object oriented programming language. Everything is an object in Ruby. Each and every code has their properties and actions. Here properties refer to variables and actions refer to methods.

History of Ruby :
  • Ruby is designed and developed by Yukihiro "Martz" Matsumoto in mid 1990's in Japan.
  • The name "Ruby" originated during a chat session between Matsumoto and Keiju Ishitsuka. Two names were selected, "Coral" and "Ruby". Matsumoto chose the later one as it was the birthstone of one of his colleagues.
  • The first public release of Ruby 0.95 was announced on Japanese newspaper on December 21, 1995.

Features of Ruby : 
  • Object-oriented
  • Flexibility
  • Visual appearance
  • Dynamic typing
  • Exception handling
  • Garbage collector
  • Portable
  • Keywords
  • Variable constants
  • Naming conventions
  • Keyword arguments
  • Method names
  • Singleton methods
  • Case Sensitive

Pro's of Ruby :
  • Highly readable
  • Ruby is fast to write
  • Everything is an object
  • Maintainability
  • Simple debugging
  • Great application performance
  • Built-in data structures
  • Comes with dependency management

Con's of Ruby :
  • Runtime Speed
  • Boot Speed
  • Documentation
  • Scalability

Setup & Installation : 
  • Go to official website of ruby on rails and click on download.

  • Accept the licence.
  • Choose the installation path and click on install.
  • Select the components and click on next.
  • Click on finish.
  • Program to print hello ruby.


Basic concepts in Ruby : 
Variable : 
  • Variables are locations which hold data to be used in the programs. Each variable has a different name. Unlike other programming languages, there is no need to declare a variable in Ruby. A prefix is needed to indicate it.
  • There are four types of variables.
    • Local variables
    • Class variables
    • Instance variables
    • Global variables


LocalGlobalInstanceClass
Scope  Limited within the block of initialization.Its scope is globally.It belongs to one instance of a class.Limited to the whole class in which they are created.
NamingStarts with a lowercase letter or underscore (_).Starts with a $ sign.Starts with an @ sign.Starts with an @@ sign.
Initialization                     
No need to initialize. An uninitialized local variable is interpreted as methods with no arguments.No need to initialize. An uninitialized global variable will have a nil value.No need to initialize. An uninitialized instance variable will have a nil value.They need to be initialized before use. An uninitialized global variable results in an error.
Data types :
  • Data types represents a type of data such as text, string, numbers, etc. 
  • There are different data types.
    • Numbers
    • Strings
    • Symbols
    • Hashes
    • Arrays
    • Boolean

Numbers : Integers and floating point numbers come in the category of numbers. Integers are held internally in binary form. Integer numbers are numbers without a fraction. 


Strings : A string is a group of letters that represent a sentence or a word. Strings are defined by enclosing a text within single (') or double (") quote.


Symbols : 
  • Symbols are like strings. A symbol is preceded by a colon (:).
  • They do not contain spaces. Symbols containing multiple words are written with (_).
  • One difference between string and symbol is that, if text is a data then it is a string but if it is a code it is a symbol.
  • Symbols are unique identifiers and represent static values, while string represent values that change.

Control Statements : 
Until Loop : 
  • The until loop runs until the given condition evaluates to true. It exits the loop when condition becomes true. 
  • It is just opposite of the while loop which runs until the given condition evaluates to false.
  • The until loop allows you to write code which is more readable and logical.


Break Statement : 
  • The break statement is used to terminate a loop. It is mostly used in while loop where value is printed till the condition is true, then break statement terminates the loop.
  • The break statement is called from inside the loop.


Next Statement :
  • The next statement is used to skip loop's next iteration. Once the next statement is executed, no further iteration will be performed.
  • The next statement in Ruby is equivalent to continue statement in other languages.


Redo Statement :
  • Ruby redo statement is used to repeat the current iteration of the loop. 
  • The redo statement is executed without evaluating the loop's condition.
  • It is used inside a loop.


Methods :
  • Methods prevent us from writing the same code in a program again and again. It is a set of expression that returns a value.
  • Ruby methods are similar to the functions in other languages. They unite one or more repeatable statements into one single bundle.
  • To use a method, we need to first define it. Ruby method is defined with the def keyword followed by method name. At the end we need to use end keyword to denote that method has been defined.
  • Methods name should always start with a lowercase letter. Otherwise, it may be misunderstood as a constant.
  • Syntax : def methodName.....code...  end.

Strings :
  • string object holds and manipulates an arbitary sequence of bytes, typically representing characters. They are created using String::new or as literals.
  • string literals are enclosed within single and double quotes.
  • Ex : puts 'Hello everyone'  ( or ) puts "Hello everyone". 
  • In Ruby, by default strings are not immutable. To make them immutable, freeze method can be used.

Arrays :
  • Ruby arrays are ordered collections of objects. They can hold objects like integer, number, hash, string, symbol or any other array.
  • It's indexing starts with 0. The negative index starts with -1 from the end of the array. For example, -1 indicates last element of the array and 0 indicates first element of the array.
  • A Ruby array is created in many ways.
    • Using literal constructor [] (EX : exm = [4, 4.0, "Jose")
    • Using new class method (EX : arrayName = Array.new(10))

Hashes : 
  • A Ruby hash is a collection of unique keys and their values. They are similar to arrays but array use integer as an index and hash use any object type.
  • If a hash is accessed with a key that does not exist, the method will return nil.
  • EX : 1) name = {"key1" => "value1", "key2" => "value2", "key3" => "value3"...}  2) name = {key1:  'value1', key2:  'value2', key3:  'value3'...}.