Monday, September 7, 2009

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
}

Visual Basic

Shell function to call executable files from your application.In this function two arguments are accepted one is program name and other is window state of program (1- for normal mode ie: VbNormal ; VbMaximized,VbMinimized)

Private Sub Form_Load( )
Dim r as variant
r =Shell ("Calc.exe,1);
End Sub


AppActivate Statement


Send Keys

Values to submitted in sendkeys

Shift ------ +
Control ----- ^
Alt ------ %
Backspace ---- {BACKSPACE}
Break ---- {BREAK}
Caps ---- {CAPSLOCK}
Clear -------- {CLEAR}
Del --------- {DELETE}
DownArrow ---- {DOWN}
End ---- {END}
Enter -------- {ENTER}
Esc ---------- {ESCAPE}
Help --------- {HELP}
etc.................................

Five arguments for MessageBox

MessageBox(Message,style,heading,helpfile,helpcontextid);

C Sharp

Web.cs
--------
using System;
class webclass
{ public static void Main ()
{
Console.WriteLine("Content_Type :text/html|\n");
Console.WriteLine("First web program ");
}
}

After compiling this web.exe file will be generated .Copy this file into apache\cgi-bin named folder.


Then create a html file

web1.html
----------






<html>
<form action =http://127.0.0.1/cgi-bin/web.exe>
<input type=submit value=Display>
</form>
</html>


then after starting apache

cmd>apache (command to start apache web server)

Then in browser type this hht://127.0.0.1/web1.html and press enter your first C# program got executed.


Thread synchronization
----------------------

Thread synchronization is attained by lock .In common language Runtime (CLR) there are three different types Thread synchronization .

Inter Lock class, Monitor class, Lock statement

In Inter lock class there are there are two threads Increment and Decrement

Interlocked.Increment( )