Monday, September 7, 2009

Cloud Computing & Amazon -1

Sign up for Amazon Web Services and EC2
------------------------------
– Can use your regular Amazon account
– Create your secure X.509 certificate and create key pair
for command line access to EC2
• Using tools like SSH and PuTTY

Features

* Amazon CloudWatch – Amazon CloudWatch is a web service that provides monitoring for AWS cloud resources, starting with Amazon EC2. It provides you with visibility into resource utilization, operational performance, and overall demand patterns—including metrics such as CPU utilization, disk reads and writes, and network traffic. To use Amazon CloudWatch, simply select the Amazon EC2 instances that you’d like to monitor; within minutes, Amazon CloudWatch will begin aggregating and storing monitoring data that can be accessed using web service APIs or Command Line Tools .

* Amazon Virtual Private Cloud – Amazon VPC is a secure and seamless bridge between a company’s existing IT infrastructure and the AWS cloud. Amazon VPC enables enterprises to connect their existing infrastructure to a set of isolated AWS compute resources via a Virtual Private Network (VPN) connection, and to extend their existing management capabilities such as security services, firewalls, and intrusion detection systems to include their AWS resources.

* Elastic IP Addresses – Elastic IP addresses are static IP addresses designed for dynamic cloud computing. An Elastic IP address is associated with your account not a particular instance, and you control that address until you choose to explicitly release it. Unlike traditional static IP addresses, however, Elastic IP addresses allow you to mask instance or Availability Zone failures by programmatically remapping your public IP addresses to any instance in your account. Rather than waiting on a data technician to reconfigure or replace your host, or waiting for DNS to propagate to all of your customers, Amazon EC2 enables you to engineer around problems with your instance or software by quickly remapping your Elastic IP address to a replacement instance.

* Auto Scaling – Auto Scaling allows you to automatically scale your Amazon EC2 capacity up or down according to conditions you define. With Auto Scaling, you can ensure that the number of Amazon EC2 instances you’re using scales up seamlessly during demand spikes to maintain performance, and scales down automatically during demand lulls to minimize costs. Auto Scaling is particularly well suited for applications that experience hourly, daily, or weekly variability in usage. Auto Scaling is enabled by Amazon CloudWatch and available at no additional charge beyond Amazon CloudWatch fees

* Multiple Locations – Amazon EC2 provides the ability to place instances in multiple locations. Amazon EC2 locations are composed of Regions and Availability Zones. Availability Zones are distinct locations that are engineered to be insulated from failures in other Availability Zones and provide inexpensive, low latency network connectivity to other Availability Zones in the same Region. By launching instances in separate Availability Zones, you can protect your applications from failure of a single location. Regions consist of one or more Availability Zones, are geographically dispersed, and will be in separate geographic areas or countries. The Amazon EC2 Service Level Agreement commitment is 99.95% availability for each Amazon EC2 Region. Amazon EC2 is currently available in two regions: one in the US and one in Europe.

* Amazon Elastic Block Store – Amazon Elastic Block Store (EBS) offers persistent storage for Amazon EC2 instances.Amazon EBS volumes are highly available, highly reliable volumes that can be attached to a running Amazon EC2 instance and are exposed as standard block devices. Amazon EBS provides the ability to create point-in-time consistent snapshots of your volumes that are then stored in Amazon S3, and automatically replicated across multiple Availability Zones. These snapshots can be used as the starting point for new Amazon EBS volumes, and can protect your data for long term durability.

* Elastic Load Balancing – Elastic Load Balancing automatically distributes incoming application traffic across multiple Amazon EC2 instances. It enables you to achieve even greater fault tolerance in your applications, seamlessly providing the amount of load balancing capacity needed in response to incoming application traffic. Elastic Load Balancing detects unhealthy instances within a pool and automatically reroutes traffic to healthy instances until the unhealthy instances have been restored. You can enable Elastic Load Balancing within a single Availability Zone or across multiple zones for even more consistent application performance.

Cloud Computing & Amazon

Amazon Web Services (AWS) -- http://aws.amazon.com
------------------------------------------------------
• Amazon Data Center in the Cloud
• Fast, easy, inexpensive renting of servers / storage
– Elastic Compute Cloud (EC2) – Rent Linux virtual machines
• 10-80 cents/hour
– Simple Storage Service (S3) – Store files
• 15 cents/GB/month (US)
• 18 cents/GB/month (Europe)
– Bandwidth Costs
• 10 cents/GB incoming
• 10 – 17 cents/GB outgoing (based on volume)
• Customers demand for Oracle products to run on AWS
EC2

Amazon EC2 Features
------------------
• Elastic (Static) IP Addresses
– Pre-assigned static IP addresses that can be associated with any
EC2 instance
• Elastic Block Storage
– Persistent “NAS” style storage
– Allows users to create volumes and snapshots
– Default EC2 storage is ephemeral – you loose everything the
moment you shut down an instance
• Availability Zones
– Spread your instances across multiple locations for business
continuity
• Security
– Private/Public key pair based, SSH-only administrator access
– Ability to configure firewall and network port settings

Amazon Elastic Compute Cloud (Amazon EC2) is a web service that provides resizable compute capacity in the cloud. It is designed to make web-scale computing easier for developers.


To use Amazon EC2, you simply:


* Create an Amazon Machine Image (AMI) containing your applications, libraries, data & associated configuration settings.Or use pre-configured, templated images to get up & running immediately.
* Upload the AMI into Amazon S3.Amazon EC2 provides tools that make storing the AMI simple.Amazon S3 provides a safe,reliable & fast repository to store your images.
* Use Amazon EC2 web service to configure security and network access.
* Choose which instance type(s) and operating system you want, then start, terminate, and monitor as many instances of your AMI as needed, using the web service APIs or the variety of management tools provided.
* Determine whether you want to run in multiple locations, utilize static IP endpoints, or attach persistent block storage to your instances.

Service Highlights

Elastic – Amazon EC2 enables you to increase or decrease capacity within minutes, not hours or days. You can commission one, hundreds or even thousands of server instances simultaneously. Of course, because this is all controlled with web service APIs, your application can automatically scale itself up and down depending on its needs.

Completely Controlled
Flexible
Designed for use with other Amazon Web Services
Reliable
Secure
Inexpensive

Cloud Computing

Cloud Computing has emerged as the new industry buzzword.Cloud Computing allows users to tap into a

virtually unlimited pool of computing resources over the Internet (the Cloud).
Unlike traditional IT, Cloud users have little insight or control over the underlying
infrastructure, and they must interact with the Cloud via an API provided by the
Cloud vendors. The most exciting part of the Cloud, however, is its elasticity and
utility-style pricing. Users can provision resources dynamically in a self-service
manner and pay only for what they use – much like how we use utilities like
electricity or water.

CLOUD ANTI VIRUS IS LATEST TREND IN CLOUD COMPUTING

What Is Cloud Computing?

• Computing resources residing on
Internet (‘the cloud’)
• Underlying physical resources not
exposed
– Abstracted at various levels (virtual
machines, database as a service, etc.)
– No direct hardware control
• Infinitely scalable
• Billed by consumption
– Per hour, per GB, etc.
• Typical Interface: Web Services
– REST, SOAP

• Quick, Self-Service Provisioning
– Developers no longer waiting on IT to respond
– Eases and Speeds Up Application Development
• Elastic
– Scale up and down rapidly





Different Levels of Cloud Computing
---------------------------------
Cloud computing is typically divided into three levels of service offerings:
Software as a Service(SaaS),
Platform as a Service (PaaS), and
Infrastructure as a service (IaaS).
These levels support
virtualization and management of differing levels of the solution stack.

Software as a Service
---------------------
A SaaS provider typically hosts and manages a given application in their own data center and makes it available to multiple tenants and users over the Web. Some SaaS providers run on another cloud provider’s PaaS or IaaS service offerings. Oracle CRM On Demand,Salesforce.com, and Netsuite are some of the well known SaaS examples.

Platform as a Service
---------------------
Platform as a Service (PaaS) is an application development and deployment platform delivered as a service to developers over the Web. It facilitates development and deployment of applications without the cost and complexity of buying and managing the underlying infrastructure, providing all of the facilities required to support the complete life cycle of building and delivering web applications
and services entirely available from the Internet. This platform consists of infrastructure software, and typically includes a database, middleware and development tools. A virtualized and clustered grid computing architecture is often the basis for this infrastructure software. Some PaaS offerings have a specific programming language or API. For example,Google AppEngine is a PaaS offering where developers write in Python or Java. EngineYard is Ruby on Rails. And sometimes PaaS providers have proprietary languages like force.com from Salesforce.com and Coghead, now owned by SAP.

Infrastructure as a Service
---------------------------
Infrastructure as a Service (IaaS) is the delivery of hardware (server, storage and network), and associated software (operating systems virtualization technology, file system), as a service. It is an evolution of traditional hosting that does not require any long term commitment and allows users to provision resources on demand. Unlike PaaS services, the IaaS provider does very little management other than keep the data center operational and users must deploy and manage the software services
themselves – just the way they would in their own data center. Amazon Web Services Elastic Compute Cloud (EC2) and Secure Storage Service (S3) are examples of IaaS offerings.

TDMA & CDMA

TDMA
----
According to TDMA in each signaling station Bandwidth is used in different time slots.In TDMA technology When a particular signaling station is using a certain timeslot say T1 it cannot be used by another signalling station T1 can be only used by the latter after first station is used.In satellite technology and For GSM mobiles mainlt TDMA technology is used .

CDMA
-----
For CDMa signalling station (mobile tower) there is no limitation for timeslot and bandwidth.It can transmit signals at any time at any frequency.For each station it have its own unique chip-code sequnce with binary logic 0 and 1 .For each clock chipcode will change .Chipcode sequence of paricular station will not be repeated for another station.Signals are secure in this technology.This is also known as Spread spectrum Multiple acess.For CDMA main parts are CDMA decoder & encoder .In CDMA logic 1 is respresented as +1 and logic 0 is represented as -1.

Tuesday, August 25, 2009

Visual c++

Mouse Programming

Handler functions are mainly used for handling messages .Messages are of two types Client and non-client messages .When double clciking ,draging from windows title bar Non Client message is generated.

Client message
---------------
Message Handler Sent When
-------------------------------------------------------------
WM_LBUTTONDOWN OnLButtonDown Left button is pressed
WM_LBUTTONUP OnLButtonUp Left button is released
WM_LBUTTONDBCLCICK OnLButtonDblClk Left button double clicked

WM_MBUTTONDOWN OnMButtonDown Middle button is pressed
WM_MBUTTONUP OnMButtonUp Middle button is released
WM_MBUTTONDBCLICK OnMButtonDblClk Middle button double clicked

WM_RBUTTONDOWN OnRButtonDown Right button is pressed
WM_RBUTTONUP OnRButtonUp Right button is released
WM_RBUTTONDBCLCICK OnRButtonDblClk Right button double clicked

WM_MUSEMOVE OnMouseMove Mouse is Moved Over Window's client area


Non-Client message
---------------
Message Handler Sent When
-------------------------------------------------------------
WM_NCLBUTTONDOWN OnNcLButtonDown Left button is pressed
WM_NCLBUTTONUP OnNcLButtonUp Left button is released
WM_NCLBUTTONDBCLCICK OnNcLButtonDblClk Left button double clicked

WM_NCMBUTTONDOWN OnNcMButtonDown Middle button is pressed
WM_NCMBUTTONUP OnNcMButtonUp Middle button is released
WM_NCMBUTTONDBCLICK OnNcMButtonDblClk Middle button double clicked

WM_NCRBUTTONDOWN OnNcRButtonDown Right button is pressed
WM_NCRBUTTONUP OnNcRButtonUp Right button is released
WM_NCRBUTTONDBCLCICK OnNcRButtonDblClk Right button double clicked

WM_NCMUSEMOVE OnNcMouseMove Mouse is Moved Over Window's client area


Code to check wether mouse is present or not ,if present display the count of buttons.


#include
class mousestatus:public CFrameWnd
{
public:
mousestatus()
{
Create (0,"Mouse status");
}
void checkmouse()
{
int status,count;
char message;
status=::GetSystemMetric(SM_MOUSEPRESENT);
if (status==1)
{
MessageBox("Mouse present","User");
Count=::GetSystemMetric(SM_CMMOUSEBUTTONS);
Sprintf(Message,"%d",Count);
MessageBox(message,"Number of buttons");
}
else
{
MessageBox("Mouse absent","User");
}
}//end of checkmouse
};

class MS : public CWinApp
{
public:
int InitInstance()
{
mousestatus *ptrms =new mousestatus ( );
ptrms -> ShowWindow(1);
ptrms -> checkmouse();
m_pMainWnd =ptrms;
return(1);
}
};
MS myobject;


Program to swap mouse buttons


#include
class Swapmouse:public CFrameWnd
{
public:
Swapmouse()
{
Create (0,"Swapping Mouse button");
}
void swap()
{
int status;
status=::GetSystemMetric(SM_SWAPBUTTON);
if (status==1)
{
MessageBox("Mouse Buttons are swapped","User");
}
else
{
MessageBox("Mouse Not Swapped","User");
}
}//end of checkmouse
};

class Swpms : public CWinApp
{
public:
int InitInstance()
{
Swpms *ptrms =new swpms ( );
ptrms -> ShowWindow(1);
ptrms -> Swap();
m_pMainWnd =ptrswpms;
return(1);
}
};
Swpms myobject;


File Programming
-----------------
Storing of application data into computer drives is called Serialisation and viceversa is known as deserialisation.

For serialisation there are two MFC class CArchive and CFile


CArchive is given in Serialize named function as argument .In CArchive class there are two functions for read and write ; IsLoading and IsStoring.

Eg : Void CFileDemo :: Serialize ( CArchive &obj)

For object Serialization what all steps are followed
----------------------------------------------------
Macro statements like DECLARE_SERIAL and IMPLEMENT_SERAIL are to be defined in class declaration and class implementation.In DECLARE_SERAIL macro one argument should be passed ;the agrument is the name of the class for which serialization should be attained.
In IMPLEMENT_SERAIL macro three arguments should be passed ,first one is same we used in DECLARE_SERAIL macro second one is super base class of our class and third one is version number of our file.

//Class declaration


class CFileClass::public CObject
{
DECLARE_SERIAL(CFileclass)
public :
Virtual void Serialize (CArchive obj);
CFileClass();
virtual `CFileClass();
};

// class implementation

#include "stdafx.h"
#include "FileClass.h"
#ifdef_DEBUG
#undef THIS_FILE
static char THIS_FILE[]=FILE_;
#define new DEBUG_NEW
#end if;
IMPLEMENT_SERAIL(CFileClass,CObject,1)


// Construction

CFileClass:: CFileClass()
{

//add code
}

// distruction

CFileClass::`CFileClass()
{
//add code
}