jquery-introduction

jQuery Introduction

  • jQuery is an easy to learn JavaScript library which makes JavaScript programming very easy.
  • jQuery takes a lot of common tasks that require many lines of JavaScript code to accomplish, and wraps them into methods that you can call with a single line of code.
  • jQuery also simplifies complicated tasks like AJAX calls and DOM manipulation.
  • jQuery will run exactly the same and produce same output in all major browsers
  • jQuery is free and very easy to include in your projects: just download its latest version from the jQuery website, or use an online Content Delivery Network
  • jQuery is continuously upgraded, maintained and documented by a dedicated community of great developers. This ensures high quality and support on the internet.

Following are the major features supported by jQuery

  • HTML element selections
  • HTML element / DOM manipulation
  • CSS manipulation
  • HTML event functions
  • JavaScript Effects and animations
  • HTML DOM traversal and modification
  • AJAX
  • Utilities

Install and Use jQuery Library:

Two versions of jQuery are available for downloading:

Minified: ideal for using in production environment.

Uncompressed (for debugging or reading).

Download the latest version from http://jquery.com/download/

jQuery Versions:

jQuery 1.11.1

jQuery 2.1.1:

Note: jQuery 2.x has the same API as jQuery 1.x, but does not support Internet Explorer 6, 7, or 8.
Referencing jQuery in HTML Page:

<script src=”jquery-<version>.js”/>

CDN (content delivery network):
<script src=”//code.jquery.com/jquery-<version>.min.js”></script>
<script src=”http://ajax.googleapis.com/ajax/libs/jquery/<version>/jquery.min.js”></script>
<script src=”http://ajax.microsoft.com/ajax/jquery/jquery-<version>.min.js”></script>

Un-Obstructive JavaScript
<button type=”button” onclick=”doSomething()” >Click Me</button>
In the above example structure and behavior are mixed.
Now consider the same example written using Un-obstructive JavaScript strategy:
Script code can go in head.
<script >
$(function(){
$(‘#btnClickMe’).click(function() {
doSomething…….
});
});
</script>
Structure code now does not contain any behavior
<button type=”button” id=”btnClickMe” >Click Me</button>
First jQuery Example
<html>
<head>
<script src=”jquery-2.1.1.js”></script>
<script>
$(document).ready(function () {
$(“button”).click(function () {
$(“p”).hide();
});
});
</script>
</head>
<body>
<div>
<h2>This is a My First Example</h2>
<div>This is a span section.</div>
<p>This is a paragraph</p>
<button>Hide Paragraph</button>
</div>
</body>
</html>

jQuery Syntax

The jQuery syntax is tailor made for selecting HTML elements and performing some action on the element(s).
jQuery uses a combination of XPath and CSS selector syntax.
Basic syntax is: $(selector).action()

A dollar sign to define jQuery
A selector to query (or find) HTML elements
A jQuery action() to be performed on the element(s)

Examples:

$(this).hide() – hides current element
$(“p”).hide() – hides all paragraphs
$(“p.test”).hide() – hides all paragraphs with class=”test”
$(“#test”).hide() – hides the element with id=”test”
The document ready function:
$(document).ready(function () {
// jQuery code goes here…
});
This is to prevent any jQuery code from running before the document is finished loading (is ready).
Trying to hide an element that doesn’t exist
Trying to get the size of an image that is not loaded
Avoid $() conflict:
“$” is the alias to jQuery functions but if “$” conflicts with other frameworks
var foo = jQuery.noConflict();
// now foo() is the jQuery main function
foo(“div”).hide();
Example:

<script >
var foo=jQuery.noConflict();
foo(document).ready(function () {
foo(“#DemoDiv”).click(function () {
alert(“hi”);
});
});
</script>

Almost every function returns jQuery, which provides a fluent programming interface and chainability:

$(“div”).show()
.addClass(“main”)
.html(“Hello jQuery”);

How to escape a special character

// html code

<div id=”div.EscapeID” class=”demoBlock”>Text inside div element having id as “div.EscapeClass” </div>
<input type=”button” id=”btn.HideText” value=”Hide above text” />

// jQuery block

<script>
$(document).ready(function() {
$(“#btn\\.HideText”).click(function() {
$(“#div\\.EscapeID”).toggle();
})
})
</script>

Learn jQuery in your own pace 100% confidence get in to the subject.

C#-windows-Forms-part1

Windows Forms Agenda:

1. Basic Controls
2. Panels and Layouts
3. Drawing and GDI Devices
4. MenuStrip, ToolStrip and ContextMenuStrip
5. Model and Modeless Dialog boxes
6. Multiple Document Interface (MDI)
7. Form Inheritance
8. Building Login Form
9. Working with Resource Files and Settings
10. Notify Icon Controls
11. Using Components like Timer, FileSystemWatcher, Process, BackgroundWorker
12. Drag and Drop
13. Working with Advanced controls like TreeView and ListView

Window Forms:

WinForms = Controls + Graphics Used for Developing Rich GUI Application.
 Important Properties of Controls:
  • Control Properties: Dock, Anchor
  • Label Properties: Text, Image, AutoSize, UseMnemonic
  • PictureBox Properties: Image, SizeMode (Normal / StretchImage / AutoSize / CenterImage / Zoom)
  • LinkLabel Properties: Text, LinkVisited, LinkColor, VisitedLinkColor, ActiveLinkColor, DisableLinkColor

Using Link Label :

Private Sub linkLabel1_Click(. . .)

Handles linkLabel1.Click System.Diagnostics.Process.Start(“c:\demo.html”)
End Sub 

Using Link Label:

private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) 
                { 
               system.Diagnostics.Process.Start(“c:\\demo.html“);
       } 
 
TextBox :

Properties: Text, PasswordChar, Multiline, Readonly, AutoCompleteMode, AutoCompleteSource, AutoCompleteCustomSource
Events: KeyPress, KeyDown, TextChanged, Validating

AutoComplete Example:

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)
Dim names() As String = New String() {“deccan”, “deccansoft”, “deccan chronical”, “testing”, “demo”} Dim sc As AutoCompleteStringCollection = New AutoCompleteStringCollection
For Each name As String In names
sc.Add(name)
Next
txtDemo.AutoCompleteCustomSource = sc
txtDemo.AutoCompleteSource = AutoCompleteSource.CustomSource
End Sub

AutoComplete Example:

private void Form1_Load(object sender, EventArgs e)
{
 string[] names = { “deccan”, “deccansoft”, “deccan chronical”, “testing”, “demo” }; AutoCompleteStringCollection sc = new AutoCompleteStringCollection();
 foreach (string name in names)
sc.Add(name);
txtDemo.AutoCompleteCustomSource = sc;
txtDemo.AutoCompleteSource = AutoCompleteSource.CustomSource;
}

Note:

  • In KeyDown we cannot distinguish upper and lower case characters.
  • KeyPress event fires only for keys with ASCII value where as KeyDown event fires for all keys on the keyboard.

Using KeyPress:

Private Sub TextBox1_KeyPress

(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress ‘MessageBox.Show(((int)e.KeyChar).ToString());
If (CType(e.KeyChar, Integer) = 8) Then
 Return 
End If 
If ((e.KeyChar < Microsoft.VisualBasic.ChrW(48)) _
OrElse (e.KeyChar > Microsoft.VisualBasic.ChrW(57))) Then
e.Handled = True
End If 
‘Don_t display the char in textbox.
End Sub
Private Sub

TextBox1_KeyDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles TextBox1.KeyDown

If (e.Control AndAlso (e.KeyCode = Keys.A)) Then 
MessageBox.Show(“Control + A is Clicked”)
End If 
End Sub
Private Sub TextBox1_Validating(ByVal sender As System.Object, ByVale As System.ComponentModel.CancelEventArgs) Handles TextBox1.Validating
If (txtDemo.Text = “”) Then
errorProvider1.SetError(txtDemo, “The value cannot be empty”)
e.Cancel = True 
‘Doesn_t allow the textbox to lose focus. 
Else
errorProvider1.SetError(txtDemo, “”)
End If
 End Sub

Using KeyPress:

private void txtDemo_KeyPress(object sender, KeyPressEventArgs e)
{
//MessageBox.Show(((int)e.KeyChar).ToString());
if ((int)e.KeyChar == 8) //for backspace
return;
 if (e.KeyChar < ‘0’ || e.KeyChar > ‘9’) //If the Char is in range of 48 to 57.
e.Handled = true; //Don’t display the char in textbox.
}
private void textBox1_KeyDown(object sender, KeyEventArgs e)
{
 if (e.Control && e.KeyCode == Keys.A)
MessageBox.Show(“Control + A is Clicked”);
}
//To validate the content of the textbox before the focus is lost from it: 
private void txtDemo_Validating(object sender, CancelEventArgs e)
{
if (txtDemo.Text == “”)
{
errorProvider1.SetError(txtDemo, “The value cannot be empty”);
e.Cancel = true; //Doesn’t allow the textbox to lose focus.
}
else 
errorProvider1.SetError(txtDemo, “”);
}

Note: ErrorProvider is in ComponentsTab in Toolbox

Button:
Button Properties: CausesValidation

Form Properties: AcceptButton, CancelButton (to be used in context of button)

CheckBox:

Properties: Text, Checked, ThreeState, CheckState (Checked/UnChecked/Intermediate)
Events: CheckedChanged.

RadioButton:
To group we have to use a common container which can be either Form or Group Box or Panel.
ComboBox
Properties: Items, DropDownStyle (Simple/DropDownList/DropDown), Text, SelectedIndex, SelectedItem
Events: SelectedIndexChanged

Combobox Example

Class Student
Public Id As Integer
Public Name As String
Public Sub New(ByVal id As Integer, ByVal name As String)
MyBase.New()
id = id
name = name
End Sub 
Public Overrides Function ToString() As String
Return Name
End Function
End Class
Private Sub DemoForm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
cmbStudent.Items.Add(new Student(1, “S1”));
cmbStudent.Items.Add(new Student(2, “S2”));
cmbStudent.Items.Add(new Student(3, “S3”));
cmbStudent.Items.Add(new Student(4, “S4”));
End Sub 
Private Sub cmbStudent_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmbStudent.SelectedIndexChanged
Dim s As Student = CType(cmbStudent.SelectedItem, Student)
MessageBox.Show(s.Id.ToString)
End Sub

 Combobox Example
 class Student //Write outside the Form Class. 

public int Id; 
public string Name; 
public Student(int id, string name)
 {
Id = id; 
Name = name; 

public override string ToString() 

return Name;
 } 

private void DemoForm_Load(object sender, EventArgs e) 

cmbStudent.Items.Add(new Student(1, “S1”));
cmbStudent.Items.Add(new Student(2, “S2”));
cmbStudent.Items.Add(new Student(3, “S3”));
cmbStudent.Items.Add(new Student(4, “S4”)); 

private void cmbStudent_SelectedIndexChanged (object sender, EventArgs e) 

Student s = (Student)cmbStudent.SelectedItem; 
MessageBox.Show(s.Id.ToString()); 

Note: To a ComboBox any type of object can be added. The ToString() implementation of that objects will be displayed as the Items text in the ComboBox.

DateTimePicker:
Properties: Value, MinDate, MaxDate, ShowCheckBox, Checked, ShowUpDown, Format,
CustomFormat (dd/MM/yyyy hh:mm:ss tt) – Only if Format = “Custom”


Events: ValueChanged

MonthCalander:
Properties: CalanderDimension.Width / Height, SelectionRange.Start /.End, ShowWeekNumbers
Events: DateChanged

MaskedTextBox:
Properties: Text, Mask, PromptChar

Containers

  • Panel
  • GroupBox
  • FlowLayoutPanel
  • TableLayoutPanel
  • TabControl
  • SplitContainer

Click here for: Free C# Essential training videos for beginners | Online C# training with project

 



 

 

Terminology used for building Microsoft Azure Virtual Networks

1. IP addresses:

There are two types of IP addresses assigned to resources in Azure: public and private.

Public IP Addresses allow Azure resources to communicate with Internet and other Azure public-facing services like Azure Redis Cache.

Private IP Addresses allows communication between resources in a virtual network, along with those connected through a VPN, without using an Internet-routable IP addresses.

Preferred IP Series for Intranets:

Small Network1: 192.168.0.X – for 28 Systems – IP Address Range = 198.168.0.0/24 (Only last byte changes)

Small Network2: 192.168.1.X –for 28 Systems – IP Address Range = 198.168.1.0/24 (Only last byte changes)

Large Network: 172.16.X.X – for 216 Systems – IP Address Range = https://www.linkedin.com/redir/invalid-link-page?url=172%2e16%2e0%2e0%2F16 (last 2 bytes change)

Very Large Network: 10.X.X.X – for 224 Systems – IP Address Range = https://www.linkedin.com/redir/invalid-link-page?url=10%2e0%2e0%2e0%2F8 (last 3 bytes change)

Classless Inter-Domain Routing (CIDR) notation is a compact representation of an IP address and its associated routing prefix. The notation is constructed from an IP address, a slash (‘/’) character, and a decimal number. The number is the count of leading 1 bits in the routing mask, traditionally called the network mask.

Public IP Addresses

There are two methods in which an IP address is allocated to a public IP resource – dynamic or static.

  1. o In the dynamic allocation method the IP address is not allocated at the time of its creation. Instead, the public IP address is allocated when you start (or create) the associated resource (like a VM or load balancer). The IP address is released when you stop (or delete) the resource. This means the IP address can change.
  2. o In the static allocation method the IP address for the associated resource does not change. In this case an IP address is assigned immediately. It is released only when you delete the resource or change its allocation method to dynamic.

Public IP addresses allow Azure resources to communicate with Internet and Azure public-facing services such as Azure Redis Cache, Azure Event Hubs, SQL databases and Azure storage.

In Azure Resource Manager, a public IP address is a resource that has its own properties. You can associate a public IP address resource with any of the following resources:

    • Virtual machines (VM)
    • Internet-facing load balancers
    • VPN gateways
    • Application gateways

Note: The first 5 “static” public IP addresses in a region are free. This is applicable irrespective of the type of resource (VM or Load-balancer) to which the IP address is associated. All others are charged at $0.004/hr.

Private IP Addresses

  • IP address is allocated from the address range of the subnet to which the resource is attached.
  • The default allocation method is dynamic, where the IP address is automatically allocated from the resource’s subnet (using DHCP). This IP address can change when you stop and start the resource.
  • You can set the allocation method to static to ensure the IP address remains the same. In this case, you also need to provide a valid IP address that is part of the resource’s subnet.
  • Private IP addresses allow Azure resources to communicate with other resources in a virtual network or an on-premises network through a VPN gateway or ExpressRoute circuit, without using an Internet-reachable IP address.
  • In the Azure Resource Manager deployment model, a private IP address is associated to the following types of Azure resources:
    • VMs
    • Internal load balancers (ILBs)
    • Application gateways

2.Subnets:

Subnet is a range of IP addresses in the VNet, you can divide a VNet into multiple subnets for organization and security. VMs and PaaS role instances deployed to subnets (same or different) within a VNet can communicate with each other without any extra configuration. You can also configure route tables and NSGs to a subnet.

Based on number of system in a network, Subnet Mask is set.

https://www.linkedin.com/redir/invalid-link-page?url=255%2e255%2e255%2e0 – 28 Systems

https://www.linkedin.com/redir/invalid-link-page?url=255%2e255%2e0%2e0 – 216 Systems

https://www.linkedin.com/redir/invalid-link-page?url=255%2e0%2e0%2e0 – 224 Systems

3.Network Interface Card (NIC):

VMs communicate with other VMs and other resources on the network by using virtual network interface card (NIC). Virtual NICs configure VMs with private and optional public IP address. VMs can have more than one NIC for different network configurations.

Note: VMs can have more than one NIC adapter that links the VM with the virtual network. The number of NICs you can attach to a VM depends on its size. For example, a VM that is based on a D2 size can have 2 NICs, and a D4-based VM can have a maximum of 8 NICs. Multiple NICs configuration is common for virtual appliances that provide additional control of traffic in virtual networks.

4.Network Security Group (NSG):

You can create NSGs to control inbound and outbound access to network interfaces (NICs), VMs, and subnets. Each NSG contains one or more rules specifying whether or not traffic is approved or denied based on source IP address, source port, destination IP address, and destination port.

Some important things to keep in mind while implementing network security groups include:

  • By default you can create 100 NSGs per region per subscription. You can raise this limit to 400 by contacting Azure support.
  • You can apply only one NSG to a VNet, subnet, or NIC.
  • By default, you can have up to 200 rules in a single NSG. You can raise this limit to 500 by contacting Azure support.
  • You can apply an NSG to multiple resources.

5.Azure load balancers:

The Azure Load Balancer delivers high availability and network performance to your applications. It is a Layer 4 (TCP, UDP) load balancer that distributes incoming traffic among healthy service instances in cloud services or virtual machines defined in a load-balanced set.

6. Application Gateways:

Azure Application Gateway is a layer-7 load balancer. It provides failover, performance-routing HTTP requests between different servers, whether they are on the cloud or on-premises. Application Gateway provides many Application Delivery Controller (ADC) features including HTTP load balancing, cookie-based session affinity, Secure Sockets Layer (SSL) offload, custom health probes, support for multi-site, and many others.

7. Traffic Manager:

Microsoft Azure Traffic Manager allows you to control the distribution of user traffic for service endpoints in different datacenters. Service endpoints supported by Traffic Manager include Azure VMs, Web Apps, and cloud services. You can also use Traffic Manager with external, non-Azure endpoints.

Traffic Manager uses the Domain Name System (DNS) to direct client requests to the most appropriate endpoint

8. VPN Gateways:

It is used to connect an Azure virtual network (VNet) to other Azure VNets or to an on-premises network. You need to assign a public IP address to its IP configuration to enable it to communicate with the remote network. Currently, you can only assign a dynamic public IP address to a VPN gateway.

9. Azure DNS:

The Domain Name System (DNS) enables clients to resolve user-friendly fully qualified domain names (FQDNs), such as www.adatum.com, to IP addresses. Azure Domain Name System (DNS) allows you to host your domains with your Azure apps. By hosting your domains in Azure, you can manage your DNS records by using your existing Azure subscription.