Hello Everyone
In this tutorial you are going to learn about angularjs with a basic program.
Angularjs works on SPA framework which means single page application. To run the following
program all you need is to download angular.min.js and save it in the folder which contains
the following file. Following programs itself explains through comments how angularjs is
working, It displays a textbox and whatever being entered in the textbox will be displayed
on the right of the textbox.
<!DOCTYPE html> <html data-ng-app=""> <!-- Here data-ng-app is a directives which tells thehtml new tricks-->
<head> <title>Learn Angularjs</title> </head> <body > Name : <input type="text" data-ng-model="name"/>{{name}} <!-- this defines a textbox with variable name - 'name' and {{name}} output the text of the textbox being entered in it by the user. data-ng-model is a directive and {{name}} is a data binding expression --> <div data-ng-init="names=['ajeet','ankit','bihar','rahul','sunny','chitrank']"> <!-- This div initialises the array 'names'--> <br> <ul> <li ng-repeat="dcmember in names">{{dcmember}}</li> <!-- ng-repeat directives repeats the elements of the array to be listed by the variable dcmember in the array names--> </ul> </div> <br> <div data-ng-init="customers=[{name:'ajeet',city : 'Mhow'},{name :'ankit',city : 'Dewas'}]"> <!-- Here customers is an array which consist of name and city of the customer--> <input type="text" data-ng-model="nametext">{{nametext}} <ul> <!--filter will display the result according to the text being entered in the textbox, orderBy will display the list in alphabetical order according to city--> <li ng-repeat="cust in customers | filter: nametext | orderBy : 'city'" >{{cust.name}} - {{cust.city}}</li> </ul> </div> <script type="text/javascript" src="angular.min.js"></script> </body> </html>
Monday, 30 December 2013
Angularjs Simple example
Monday, 23 December 2013
Introduction to javascript
Introduction to javascript : 1
Javascript is a very easy to learn language.
1. Printing text to console:
write the text in double quote which you want to print to console
ex. "This text will be printed on console";
2. Counting length of the string:
use length function to count the length of the string
ex. "sample".length;
3. Data types in javascript:
There are data types in many languages like numbers, string etc.
In JavaScript also there are data types like numbers and string.
The numbers written without double quotes are number ex. 43, 78.9.
The text written within double quotes are considered as string ex. "43", "javascript"
4. confirm function :
Confirm function is used to take response from the user for a particular action.
A confirm box appears on the screen with some display text, ok and cancel button.
ex. confirm("try again?");
5.Prompt function :
Prompt function provides interaction with user. It provides a input box to take input from the user.
ex. Prompt("What is your name?");
Javascript is a very easy to learn language.
1. Printing text to console:
write the text in double quote which you want to print to console
ex. "This text will be printed on console";
2. Counting length of the string:
use length function to count the length of the string
ex. "sample".length;
3. Data types in javascript:
There are data types in many languages like numbers, string etc.
In JavaScript also there are data types like numbers and string.
The numbers written without double quotes are number ex. 43, 78.9.
The text written within double quotes are considered as string ex. "43", "javascript"
4. confirm function :
Confirm function is used to take response from the user for a particular action.
A confirm box appears on the screen with some display text, ok and cancel button.
ex. confirm("try again?");
5.Prompt function :
Prompt function provides interaction with user. It provides a input box to take input from the user.
ex. Prompt("What is your name?");
Saturday, 15 June 2013
Coding to Send Email on a Button Click With and Without attachment
Private Sub sendbutton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles sendbutton.Click If con.State = ConnectionState.Open Then con.Close() End If Try Dim mail, atchmail As New MailMessage mail.Subject = subjecttextbox.Text mail.To.Add(totextbox.Text) mail.From = New MailAddress(usernametextbox.Text) mail.Body = bodytextbox.Text If attachmenttextbox.Text <> "" Then 'If attachment is there than this code will be executed Dim attachment As System.Net.Mail.Attachment attachment = New System.Net.Mail.Attachment(attachmenttextbox.Text) mail.Attachments.Add(attachment) Dim smtp As New SmtpClient("smtp.gmail.com") smtp.EnableSsl = True smtp.Credentials = New System.Net.NetworkCredential(usernametextbox.Text, passwordtextbox.Text) smtp.Port = "587" smtp.Send(mail) Else 'If there is no attachment than this code is executed Dim smtp As New SmtpClient("smtp.gmail.com") smtp.EnableSsl = True smtp.Credentials = New System.Net.NetworkCredential(usernametextbox.Text, passwordtextbox.Text) smtp.Port = "587" smtp.Send(mail) End If MsgBox("Message Sent Successfully", MsgBoxStyle.Information) totextbox.Clear() subjecttextbox.Clear() bodytextbox.Clear() attachmenttextbox.Clear() usernametextbox.Text = "sample_email@gmail.com" passwordtextbox.Clear() Catch ex As Exception MsgBox(ex.ToString) End Try End Sub
Crystal Report Chart Expert showing Count instead of Sum
Sometimes in crystal report while showing a bar chart if we want to show the sum or average of some values other than count, the chart expert may not show you all the summary option like average, sum, mode etc. Though the coding is correct and no error is displayed its just that the chart expert doesn't show the summary option other than count or distinct count. This is because the value for which you want to display average or sum is not of desired data-type, for example, if we want to display marks on the change of roll no. than marks should be of data-type like integer or double rather than choosing the data-type like string. So just check the data-type to get rid of this problem.
Happy coding :)
Happy coding :)
Tuesday, 28 May 2013
Inheritance And Its Types
As described in the previous post, Inheritance is the mechanism of deriving a new class from an existing class. It is also known as derivation. The derived class is also known as subclass and the class from which it is derived is known as super-class or base class.There are basically five types of inheritance which are as follows :
- Single Inheritance - If only one class is derived directly from the existing class than the inheritance is known as single inheritance. In this there is only one base class and only one derived class or base class. For example : class 'B' is derived from class 'A' than A is super class and B is derived class.
- Multilevel Inheritance - If a class is derived from another class which itself is derived from some other class than this type of inheritance is known as multilevel inheritance. In this there are two base class and two derived class. For example : class 'C' is derived from class 'B' and 'B' itself is derived from class 'A'.
- Multiple Inheritance - If a class is derived directly from two or more classes than this type of inheritance is known as multilevel inheritance. In this there is only one derived class and two or more base classes are there. For example : class 'D' is derived directly from class 'A' , 'B' and 'C'.
- Hierarchical Inheritance - If the derivation of class is in the form of hierarchy in which two classes are derived from one class and the two derived classes are the base class of some other classes too, than this type of inheritance is known as hierarchical inheritance.
- Hybrid Inheritance - If a class derived by two class via multilevel inheritance and it is also derived from some other class which are different from those two class, than this type of inheritance is known as hybrid inheritance. For example : 'C' is a class derived from 'B' and 'D' and 'B' is derived from class 'A'.
Saturday, 25 May 2013
Concept of Object Oriented Programming languages
Object oriented programming languages uses some concept extensively which are as follows :
- Object - An object is a real world entity that have some characteristics and behavior. Objects are run-time entities. Object represents instance of its class. An objects can be defined as the collection of data members and member function of its class. A class can have more than one instance that means a class can have more than one object which may hold their relevant information or data. If a class name is declared than the object of that class must exist to access its properties. For example: A class "Vehicle" can have some properties like vehicle name, registration number etc., these properties are only accessible by the objects of the class vehicle.
- Class - A class is a data-type according to which objects are created or a class can be defined as a collection of objects which possesses same characteristics or properties. A class contain data members and member function which are accessible by its objects. For example : Person is a class which have some characteristics like two eyes two legs etc. and Rohan can be considered as its objects who possesses these characteristics.
- Abstraction/Encapsulation - Abstraction means hiding the unnecessary details and showing the essential details and encapsulation means wrapping up of data into a single unit called class. In a class all the data and methods of that class are wrapped up into a single unit called class and only the objects of that can class can access private data and the methods which operate on that data. For example : In a car only essential things are visible to the user like steering, gear, clutch etc and not the details like how the steering is moving the wheels internally or how the gear is changing internally.
- Inheritance - It is the process of making new class from an existing class or it is the process of transforming the properties from one class to another class. The new class formed is known as derived class and the class from which the class is derived is known as super class or base class. Inheritance are of types : single level, multilevel, hybrid, hierarchical. These are explained in the next post.
- Polymorphism - Polymorphism means single name multiple forms. It allows methods or variables to have different meaning for different objects. According to greek terminology it is the ability to take more than one form. overloading is an example of polymorphism.
- Dynamic Binding - It is the the ability to of the objects to recognize its class/method at runtime. Dynamic binding is explained in upcoming post with example program.
- Message passing - It is the ability of objects to communicate with each other. It is one of the important features of the object oriented programming languages which allows communication from one place to another in a program.
Thursday, 23 May 2013
Object Oriented Programming Language
Object oriented paradigm can be describes the concept as 'objects', a real world entity which have some characteristics and behavior. characteristics are some attributes possessed by an object and behavior means the procedure associated with that object. An object oriented program consist of interacting objects which can interact amongst themselves to process the data. Objects are composed of nouns and verbs. Object oriented programming language follows bottom-up approach. In this, objects may be are of different types and number of objects of a particular type are known as instance of that type. Now days there are number of languages that are object oriented in nature but the first object oriented was SIMULA which was developed in 1960.
Some features of object oriented programming paradigm are :
1. Programs are divided into objects.
2. It focuses on data rather than procedure.
3. Data structures are designed to characterize objects.
4. Methods that operate on data are tied together in the data structure.
5. Data can't be accessed by external methods.
6. Follows bottom-up approach.
7. Objects can communicate with each other.
8. New data and methods can be added.
Object oriented programming language uses some concepts which are as follows :
1. Objects
2. Classes
3. Abstraction
4. Inheritence
5. Polymorphism
6. Dynamic binding
7. Message passing
These concepts are described in the next post.
Some features of object oriented programming paradigm are :
1. Programs are divided into objects.
2. It focuses on data rather than procedure.
3. Data structures are designed to characterize objects.
4. Methods that operate on data are tied together in the data structure.
5. Data can't be accessed by external methods.
6. Follows bottom-up approach.
7. Objects can communicate with each other.
8. New data and methods can be added.
Object oriented programming language uses some concepts which are as follows :
1. Objects
2. Classes
3. Abstraction
4. Inheritence
5. Polymorphism
6. Dynamic binding
7. Message passing
These concepts are described in the next post.
Subscribe to:
Posts (Atom)