Nothing Special   »   [go: up one dir, main page]

Question Paper Solutions: Unit 1 Introduction, Web Services

Download as pdf or txt
Download as pdf or txt
You are on page 1of 24

Web 2.

0 10CS666

Question Paper solutions


Unit 1

Introduction,Web Services
1. Write short notes on :
a. Software as services (Soas)
b. Social networking
c. Folksonomies (June/July 11)(9 marks)

Ans :

SOAs : Software as a service (SaaS), sometimes referred to as "software on demand," is


software that is deployed over the internet and/or is deployed to run behind a firewall on a
local area network or personal computer. With SaaS, a provider licenses an application to
customers either as a service on demand, through a subscription, in a "pay-as-you-go" model,
or (increasingly) at no charge.

 This approach to application delivery is part of the utility computing model where all of
the technology is in the "cloud" accessed over the Internet as a service.

Advantages

 Anytime, anywhere accessibility


 Pay as you go
 Instant scalability
 Security
 Reliability
 APIs
 SaaS was initially widely deployed for sales force automation and Customer Relationship
Management (CRM). Now it has become commonplace for many business tasks,
including accounting software, computerized billing, ERP software, invoicing, human
resource management, financials, content management, collaboration, document
management, and service desk management.

Folksonomies : A folksonomy is a system of classification derived from the practice and


method of collaboratively creating and managing tags to annotate and categorize content; this
practice is also known as collaborative tagging, social classification, social indexing, and
social tagging.

 Folksonomy, a term coined by Thomas Vander Wal, is a portmanteau of folks and


taxonomy.

Dept of CSE, SJBIT 1


Web 2.0 10CS666

 Folksonomies became popular on the Web around 2004 as part of social software
applications such as social bookmarking and photograph annotation. Tagging, which is
one of the defining characteristics of Web 2.0 services, allows users to collectively
classify and find information. Some websites include tag clouds as a way to visualize tags
in a folksonomy.

2. Define web services. What are the building blocks of a SOAP message ? (June/July
11) (5 marks)

Ans : SOAP, originally defined as Simple Object Access Protocol, is a protocol


specification for exchanging structured information in the implementation of Web Services
in computer networks.

 It relies on Extensible Markup Language (XML) for its message format, and usually
relies on other Application Layer protocols, most notably Remote Procedure Call (RPC)
and Hypertext Transfer Protocol (HTTP), for message negotiation and transmission.

 SOAP can form the foundation layer of a web services protocol stack, providing a basic
messaging framework upon which web services can be built.

 This XML based protocol consists of three parts: an envelope, which defines what is in
the message and how to process it, a set of encoding rules for expressing instances of
application-defined datatypes, and a convention for representing procedure calls and
responses.

 As an example of how SOAP procedures can be used, a SOAP message could be sent to a
web-service-enabled web site, for example, a real-estate price database, with the
parameters needed for a search.

 The site would then return an XML-formatted document with the resulting data, e.g.,
prices, location, features. Because the data is returned in a standardized machine-
parseable format, it could then be integrated directly into a third-party web site or
application.

 The SOAP architecture consists of several layers of specifications: for message format,
Message Exchange Patterns (MEP), underlying transport protocol bindings, message
processing models, and protocol extensibility.

 SOAP is the successor of XML-RPC, though it borrows its transport and interaction
neutrality and the envelope/header/body from elsewhere (probably from WDDX).

Dept of CSE, SJBIT 2


Web 2.0 10CS666

3. What is JSON? How do you convert a string to JSON object? Consider the
following information about a student in an engineering college affiliated to vtu. The
information includes USN, name of the college, branch, year of joining and email id.
a. Create an object literal
b. Write a JSON code for the above information. (June/July 11) (6 marks)

Ans : JSON (JavaScript Object Notation) is a lightweight data-interchange format. It is easy


for humans to read and write. It is easy for machines to parse and generate.

 JSON is built on two structures:

 A collection of name/value pairs. In various languages, this is realized as an object,


record, struct, dictionary, hash table, keyed list, or associative array.
 An ordered list of values. In most languages, this is realized as an array, vector, list, or
sequence.
a) Object literal :
var Beatles = {
"USN" : "123",
"Name" : “abc”,
"Branch" : "CSE"
"Year" : 2
"email" : "abc"
}
b) JSON code :
{
"USN" : "123",
"Name" : “abc”,
"Branch" : "CSE"
"Year" : 2
"email" : "abc"
}

Dept of CSE, SJBIT 3


Web 2.0 10CS666

UNIT 2

BUILDING RICH INTERNET APPLICATIONS WITH AJAX-1:


1. Briefly explain the AJAX principles. (June/July 11) (7 marks)

Ans :

 Minimal traffic: Ajax applications should send and receive as little


information as possible to and from the server. In short, Ajax can minimize
the amount of traffic between the client and the server. Making sure that your
Ajax application doesn't send and receive unnecessary information adds to its
robustness.

 No surprises: Ajax applications typically introduce different user interaction


models than traditional web applications. As opposed to the web standard of
click-and-wait, some Ajax applications use other user interface paradigms
such as drag-and-drop or double-clicking. No matter what user interaction
model you choose, be consistent so that the user knows what to do next.

 Established conventions: Don't waste time inventing new user interaction


models that your users will be unfamiliar with. Borrow heavily from
traditional web applications and desktop applications so there is a minimal
learning curve.

 No distractions: Avoid unnecessary and distracting page elements such as


looping animations, and blinking page sections. Such gimmicks distract the
user from what he or she is trying to accomplish.

 Accessibility: Consider who your primary and secondary users will be and
how they most likely will access your Ajax application. Don't program
yourself into a corner so that an unexpected new audience will be completely
locked out. Will your users be using older browsers or special software? Make
sure you know ahead of time and plan for it.

 Avoid entire page downloads: All server communication after the initial
page download should be managed by the Ajax engine. Don't ruin the user
experience by downloading small amounts of data in one place, but reloading
the entire page in others.

Dept of CSE, SJBIT 4


Web 2.0 10CS666

 User first: Design the Ajax application with the users in mind before anything
else. Try to make the common use cases easy to accomplish and don't be
caught up with how you're going to fit in advertising or cool effects.

2. Draw the diagram for AJAX application model and traditional web application
model and compare them. (June/July 11) (8 marks)

Ans :

 The classic web application model works like this: Most user actions in the interface
trigger an HTTP request back to a web server.
 The server does some processing —retrieving data, crunching numbers, talking to various
legacy systems —and then returns an HTML page to the client.
 It’s a model adapted from the Web’s original use as a hypertext medium, but as fans of
The Elements of User Experience know, what makes the Web good for hypertext doesn’t
necessarily make it good for software applications.

Dept of CSE, SJBIT 5


Web 2.0 10CS666

 This approach makes a lot of technical sense, but it doesn’t make for a great user
experience. While the server is doing its thing, what’s the user doing? That’s right,
waiting.
 And at every step in a task, the user waits some more. Obviously, if we were designing
the Web from scratch for applications, we wouldn’t make users wait around.
 Once an interface is loaded, why should the user interaction come to a halt every time
the application needs something from the server? In fact, why should the user see the
application go to the server at all?

3. Describe the hidden frame technique in AJAX. (June/July 11) (5 marks)

Ans :

 HiddenFrameGET
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Get Customer Data</title>
<?php

//customer ID
$sID = $_GET["id"];

//variable to hold customer info


$sInfo = "";

//database information
$sDBServer = "localhost";
$sDBName = "ajax";
$sDBUsername = "root";
$sDBPassword = "";

//create the SQL query string


$sQuery = "Select * from Customers where CustomerId=".$sID;

//make the database connection


$oLink = mysql_connect($sDBServer,$sDBUsername,$sDBPassword);
@mysql_select_db($sDBName) or $sInfo = "Unable to open database";

if($sInfo == '') {
if($oResult = mysql_query($sQuery) and mysql_num_rows($oResult) > 0) {

Dept of CSE, SJBIT 6


Web 2.0 10CS666

$aValues = mysql_fetch_array($oResult,MYSQL_ASSOC);
$sInfo = $aValues['Name']."<br />".$aValues['Address']."<br />".
$aValues['City']."<br />".$aValues['State']."<br />".
$aValues['Zip']."<br /><br />Phone: ".$aValues['Phone']."<br />".
"<a href=\"mailto:".$aValues['E-mail']."\">".$aValues['E-mail']."</a>";
} else {
$sInfo = "Customer with ID $sID doesn't exist.";
}
}

mysql_close($oLink);

?>

<script type="text/javascript">
window. () {
var divInfoToReturn = document.getElementById("divInfoToReturn");
top.frames["displayFrame"].displayCustomerInfo(divInfoToReturn.innerHTML);
};

</script>

</head>
<body>
<div id="divInfoToReturn"><?php echo $sInfo ?></div>
</body>
</html>

Dept of CSE, SJBIT 7


Web 2.0 10CS666

UNIT - 3

BUILDING RICH INTERNET APPLICATIONS WITH AJAX-2

1. Explain the following AJAX patterns with one example


a. Submission throttling
b. Predictive fetch
c. Fallback patterns (June/July 11) (12 marks)

Ans :

a) Submission throttling :
 If retrieving data from the server is one part of the problem sending data to server
is another.
 Seince in AJAX page refreshes needs to be avoided, it is important to know when
to send user data to the server.
 One approach that could be taken is to send data to server on every user
interaction. But this results in a lot of requests submitted to the server is a short
period.
 In case of submission throttling, the data to be send to the server is buffered on the
client.
 This data is then sent to the server at predefined times.
 The delay from typing to sending data is fine tuned such that it doent seem lika a
delay to the user.
 Then a client side function is invoked that begins buffering the data.
 Then a client side function is invoked that begins buffering the data.
 It can be sent at a predefined time interval.
 This determination depends on the usecase being used.
 After the data is sent, the application continous to gather data.

b) Predictive fetch :
 In case of traditional web applications, the application reacts only when there is
an interaction.
 This is called “fetch on demand”. The user action tells the server what data should
be retrieved.

Dept of CSE, SJBIT 8


Web 2.0 10CS666

 In the predictive fetch algorithm, the application guesses what the user is going to
do next and retrieves the appropriate data.
 Determining the future action of the user is just or guess based on the users
intentions.
 For eg: say a user is reading an online article of 3 pages. It can be assumed here
that if the user is reading the 1st page for few seconds, the person will also be
interested in reading the 2nd page.
 Hence the 2nd page can be downloaded at the background before the user
explicitly clicks on the ‘Next’.
 Therefore when the user clicks on next the n2d page instantaneously appears
reducing the response time.
 Similarly the 3rd page can be downloaded when the user reads 2nd page for a few
seconds.
 This extra data being downloaded is cached on the client.
 Some approach can be applied in emails. If a person starts composing a mail, it is
logical to anticipate that the mail would be sent to someone in the address book so
this can be preloaded and kept.
 By using ajax to fetch information related to any possible next step, can overload
the server.
 Therefore this algorithm has to be implemented only when it is logical to assume
that information will be requisite to completing the user’s next request

c) Fallback patterns
 All the above methods work fine when there is no problem at the server side.
 The following problems can occur:
The request might never make it to the server.
An error might occur at the server.

Cancel Pending Requests

 If error occurs on the server like a file not fount or an internal server error , then it
doesn’t make sense to trying again after a few minutes.
 Such problems needs an administrator to fix it.
 In such a situation all the pending requests are simply cancelled.
 This can be done by setting a flag somewhere in the code that says “don’t send
any more request”.
 This solution has maximum impact on the periodic refresh pattern.

Dept of CSE, SJBIT 9


Web 2.0 10CS666

Try Again

 Another option is to silently keep trying for either a specified amount of time or a
particular number of files.
 This problem is handled behind the scenes without generally notifying the user.
 Unless the ajax functionality is key to the user’s experience, it is not needed to
notify her about the failures.

2. Write down any four XML http request methods along with their parameters
(June/July 11) (4 marks)

Ans :

createRequest() – Creates a cross browser XMLHttp object

getResponseHeader(“Content-Type”) – A response header can be accessed by passing


the header name as parameter.

getAllResponseHeaders() – Returns an array of all the response headers

setRequestHeader(“myheader”, “myvalue”) – Sets a request header by accepting the


header name and value

3. Write a short note on


a. Iframes
b. Cache control (June/July 11)(4 marks)

Ans :

Iframes – An IFrame (Inline Frame) is an HTML document embedded inside another

HTML document on a website. The IFrame HTML element is often used


to insert content from another source, such as an advertisement, into a Web page.
Although an IFrame behaves like an inline image, it can be configured with its
own scrollbar independent of the surrounding page's scrollbar.

A Web designer can change an IFrame's content without requiring the user to
reload the surrounding page. This capacity is enabled through JavaScript or the
target attribute of an HTML anchor. Web designers use IFrames to embed

Dept of CSE, SJBIT 10


Web 2.0 10CS666

interactive applications in Web pages, including those that employ Ajax


(Asynchronous JavaScript and XML), like Google Maps or ecommerce
applications.

Cache control - Whenever repeated calls to the same page all dealt with browser
caching needs to be considered.
 Web browsers tend to cache certain resources to improve the speed
with which sites are downloaded and displayed.
 This increases the speed on frequently visited web sites.
 Caching can be dealt with by including a header with caching
information on any data being sent from the server to the browser.
Cache_Control : no_cache
Expires : Fri, 30 Oct 1998 14:19:41 GMT
 This tells the browser not to cache the data coming from the
specific URL. Instead the browser always calls a new version from
the server instead of a saved version from its own cache.

Dept of CSE, SJBIT 11


Web 2.0 10CS666

Unit 4

BUILDING RICH INTERNET APPLICATIONS WITH FLEX - 1:

1. Explain factors that influence the flash player (June/July 11) (6 marks)

Ans : Flex is part of the Adobe Flash Platform, which is a set of technologies with Flash
Player at the core.
 Flex applications are intended to be deployed to Flash Player, meaning Flash Player
runs all Flex applications.
 Flash Player is one of the most ubiquitous pieces of software anywhere. Because all the
computers that have internet will be having some version of Flash Player installed and
some of the mobile devices being Flash – enabled.
 The Flex framework is synonymous with the Flex class library and is a collection of
ActionScript classes used by Flex applications.
 The Flex framework is written entirely in ActionScript classes, and defines controls,
containers, and managers designed to simplify building rich Internet applications.
 The Flex class library.

2. Differentiate between HTML and flex application (June/July 11) (4 marks)

Ans :
 What works for HTML may or may not work for Flex.
 Both traditional and Flex applications are n-tiered.
 The traditional applications have, at a minimum, a data tier , a business tier and a
presentation tier. Data tier – databases or similar resources.
 Business tier – The core business logic. Eg: accept request from client or presentation tier,
query the data tier.Presentation tier – HTML, CSS, JavaScript, JSP or similar documents.
 A new tier called Client tier. Client tier – enables clients to offload computation from the
server. It helps in network latency and making for responsive and highly interactive user
interfaces. In case of Traditional web app client tier is state less and non responsive.
 The flex app client is stateful, which means that it can make changes to view without
having to make a request to the server.

3. With a neat diagram explain how flex application works.[5]

Ans :

 Flex applications deployed on the web works differently than html applications.

Dept of CSE, SJBIT 12


Web 2.0 10CS666

 Every Flex app deployed on the web utilizes Flash Player as the deployment platform.
Should understand Flash Player to understand Flex. All Flex app use the Flex Frame
work at a minimum to compile the app.
 It is Imp to understand the relationship between the Source code files, the complier and
Flash player All Flex App require MXML or Action script class files or both.

 Flash Player does not how to interpret MXML or uncompiled Action script class files.
 It is necessary to compile the source code files to the .swf format, which flash player can
interpret. A typical Flex application compiles to just one .swf file. Deploy this .swf file to
server and when a requested, it plays back in flash player. Assets can be embedded within
a .swf file or they can be loaded at runtime.
 Embedding makes less streamlined downloading experience and
less dynamic app.
 The assets are loaded into flash player when requested by the .swf
at runtime.
 In this case asset file must be deployed to a valid URL.

4. What is meant by flex framework? Explain any four frameworks. (June/July 11) (5
marks)

Ans : The Flex framework is synonymous with the Flex class library and is a collection of ActionScript
classes used by Flex applications.
 The Flex framework is written entirely in ActionScript classes, and defines controls, containers,
and managers designed to simplify building rich Internet applications.
 The Flex class library.

Dept of CSE, SJBIT 13


Web 2.0 10CS666

UNIT 5

BUILDING RICH INTERNET APPLICATIONS WITH FLEX - 2:

1. Define action script. What are all the ways to include Action script within flex with
examples? (June/July 11) (6 marks)

Ans :
ActionScript is an object-oriented language originally developed by Macromedia
Inc. used primarily for the development of websites and software targeting the Adobe Flash
Player platform, used on Web pages in the form of embedded SWF files.
 When you use an MXML tag to create a component instance, it is the equivalent to calling
the component class’s constructor as part of a new statement. For example, the following
MXML tag creates a new button:
<mx:Button id="button" />
That is equivalent to the following piece of ActionScript code:
var button:Button = new Button();
 If you assign property values using MXML tag attributes, that’s equivalent to
setting the object properties via ActionScript. For example, the following creates
abuttonand sets thelabel:
<mx:Button id="button" label="Click" />
The following code is the ActionScript equivalent:

Var button:Button = new Button();


button.label = "Click";

For example, the following creates a new class that extendsmx.core.Applicationand creates one
property calledButtonof typemx.controls.Button:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
<mx:Button id="Button" />
/mx:Application>

Dept of CSE, SJBIT 14


Web 2.0 10CS666

The preceding example is essentially the same as the following ActionScript class:
package {
import mx.core.Application;
import mx.controls.Button;
public class Example extends Application {
internal var button:Button;
public function Example() {
super();
button = new Button();
addChild(button);
}
}
}

2. Create a button with the is as button and change the label of button as click, using
MXML and action script. (June/July 11) (4 marks)

Ans :

<?xml version="1.0"?>
<!-- controls\swfloader\FlexApp.mxml -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
height="200" width="200">

<mx:Script>
<![CDATA[
[Bindable]
public var varOne:String = "This is a public variable.";

public function changeName (newText:String):void {


button.label=”Click”;
}
]]>
</mx:Script>

<mx:Button id=”button” label=" Button" click="changeName();"/>

</mx:Application>

Dept of CSE, SJBIT 15


Web 2.0 10CS666

3. Defines interfaces. List the differences between interfaces and classes. (June/July 11)
(5 marks)

Ans :

An interface is a collection of method declarations that allows unrelated objects to


communicate with one another. For example, ActionScript 3.0 defines the IEventDispatcher
interface, which contains method declarations that a class can use to handle event objects.
The IEventDispatcher interface establishes a standard way for objects to pass event objects to
one another. The following code shows the definition of the IEventDispatcher interface:

public interface IEventDispatcher


{
function addEventListener(type:String, listener:Function,
useCapture:Boolean=false, priority:int=0,
useWeakReference:Boolean = false):void;
function removeEventListener(type:String, listener:Function,
useCapture:Boolean=false):void;
function dispatchEvent(event:Event):Boolean;
function hasEventListener(type:String):Boolean;
function willTrigger(type:String):Boolean;
}

4. Explain how action script handles runtime errors. (June/July 11) (5 marks)

Ans : ActionScript 3.0 includes many tools for error handling, including:

 Error classes. ActionScript 3.0 includes a broad range of Error classes to expand
the scope of situations that may produce error objects. Each Error class helps
applications handle and respond to specific error conditions, whether they are
related to system errors (like a MemoryError condition), coding errors (like an
ArgumentError condition), networking and communication errors (like a URIError
condition), or other situations. For more information on each class, see Comparing
the Error classes.
 Fewer silent failures. In earlier versions of Flash Player, errors were generated and
reported only if you explicitly used the throw statement. For Flash Player 9 and

Dept of CSE, SJBIT 16


Web 2.0 10CS666

later and Adobe AIR, native ActionScript methods and properties throw run-time
errors that allow you to handle these exceptions more effectively when they occur,
and then individually react to each exception.
 Clear error messages displayed during debugging. When you are using the
debugger version of Flash Player or Adobe AIR, problematic code or situations
will generate robust error messages, which help you easily identify reasons why a
particular block of code fails. This makes fixing errors more efficient. For more
information, seeWorking with the debugger versions of Flash Player and AIR.
 Precise errors allow for clear error messages displayed to users at run time. In
previous versions of Flash Player, the FileReference.upload() method returned a
Boolean value of false if the upload() call was unsuccessful, indicating one of five
possible errors. If an error occurs when you call the upload() method in
ActionScript 3.0, you can throw one of four specific errors, which helps you
display more accurate error messages to end users.
 Refined error handling. Distinct errors are thrown for many common situations.
For example, in ActionScript 2.0, before a FileReference object has been
populated, the name property has the value null (so, before you can use or display
the name property, you need to ensure that the value is set and not null). In
ActionScript 3.0, if you attempt to access the name property before it has been
populated, Flash Player or AIR throws an IllegalOperationError, which informs
you that the value has not been set, and you can usetry..catch..finally blocks to
handle the error. For more information see Using try..catch..finally statements.

Dept of CSE, SJBIT 17


Web 2.0 10CS666

UNIT 6

BUILDING RICH INTERNET APPLICATIONS WITH FLEX - 3:


1. Explain the flex application life cycle. (June/July 11) (6 marks)

Ans : The following flow diagram represents the process that is abstracted within the Flex framework
when the addChild() command is made to create and make a visual component visible on the stage, or
when the properties of the component and/or it parent change

2. Differentiate between flash player and flex framework. (June/July 11) (4 marks)

Dept of CSE, SJBIT 18


Web 2.0 10CS666

Ans : Flex provides the ability to create a SWF file (flash player files) that runs on the Adobe
Flash Player in any web browser.

 Just like the Flash was created to enable animators and illustrators to provide visually
appealing experiences on the web, Flex was design for the same purpose, but Flex is Flash’s
“big brother”, it’s the same “technology” but the way applications are built is different and
allow much more complicated applications to be built by software engineers instead of
animators.
 Flex is not a new language (it does use MXML, but that is converted to Actionscript and
most of the hard work is done in Actionscript), it uses Actionscript just like flash does, but it
comes with a lot of extra features, to make more intelligent applications.

3. Write the syntax for the following : (June/July 11) (4 marks)


a. Assume the current flex application name as VTU. From this application
load another application anme as “application.swf” file.
b. Create a text box and add this textbox to the current application container
using MXML, action script.

Ans : a ) <?xml version="1.0"?>


<!-- controls\swfloader\SWFLoaderSimple.mxml-->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">

<mx:SWFLoader id="loader1" source=" application.swf "/>


</mx:Application>

b ) <?xml version="1.0"?>
<!-- containers\intro\Panel3Children.mxml -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">

<mx:Panel title="My Application"


layout="vertical" horizontalAlign="center"
paddingLeft="10" paddingRight="10"
paddingTop="10" paddingBottom="10">
<mx:TextInput id="myinput" text="enter zip code"/>
<mx:Button id="mybutton" label="GetWeather"/>
<mx:TextArea id="mytext" height="20"/>
</mx:Panel>
</mx:Application>

4. Draw the class diagram of container components. Explain any three of it. (June/July 11)
(6 marks)

Dept of CSE, SJBIT 19


Web 2.0 10CS666

Ans : Flex containers are implemented as a hierarchy in an ActionScript class library, as the
following image shows:

 Containers provide a hierarchical structure that lets you control the layout characteristics of
child components.
 . There are two types of containers: layout and navigator.
 Containers have predefined navigation and layout rules, so you do not have to spend time
defining these. Instead, you can concentrate on the information that you deliver, and the
options that you provide for your users, and not worry about implementing all the details of
user action and application response.
 Predefined layout rules also offer the advantage that your users soon grow accustomed to
them. That is, by standardizing the rules of user interaction, your users do not have to think
about how to navigate the application, but can instead concentrate on the content that the
application offers.

Dept of CSE, SJBIT 20


Web 2.0 10CS666

UNIT 7

BUILDING RICH INTERNET APPLICATIONS WITH FLEX – 4:


1. Describe the user interface components and the inheritance relationship. (June/July
11) (5 marks)

Ans : Flex includes a component-based development model that you use to develop your
application and its user interface. You can use the prebuilt visual components included with
Flex, extend components to add new properties and methods, and create components as
required by your application.

 Visual components are extremely flexible and provide you with a great deal of control over
the component's appearance, how the component responds to user interactions, the font and
size of any text included in the component, the size of the component in the application, and
many other characteristics.
 The characteristics of visual components include the following:
 Size - Height and width of a component. All visual components have a default size. You
can use the default size, specify your own size, or let Flex resize a component as part of
laying out your application.
 Events - Application or user actions that require a component response. Events include
component creation, mouse actions such as moving the mouse over a component, and
button clicks.
 Styles - Characteristics such as font, font size, and text alignment. These are the same
styles that you define and use with Cascading Style Sheets (CSS).
 Behaviors - Visible or audible changes to the component triggered by an application or
user action. Examples of behaviors are moving or resizing a component based on a
mouse click.
 Skins - Classes that control a visual component's appearance.

2. What is meant by an event ? Write a function call named as display, which display
the message “VTU belgaum” when you click the button using click event of MXML
and Action script. (June/July 11) (5 marks)

Ans :

 Event handling in ActionScript 3.0 depends heavily on the EventDispatcher class.


 Although this class isn't entirely new to ActionScript, it is the first time it has been
included as a core part of the ActionScript language

Dept of CSE, SJBIT 21


Web 2.0 10CS666

 ActionScript 2.0, you define the event handler within the object receiving the event—
giving the function the name of the event being received. For example, to react to an
"onPress" event for a button named submitButton in ActionScript 2.0, you would use:

<?xml version="1.0"?>
<!-- controls\button\ButtonLabel.mxml -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:Script>
function display ()
{
mx.controls.Alert.show(“VTU Belgaum”)
}

</mx:Script>
<mx:Button id="button1" label="Hello world!" click=”display();” width="100"/>
</mx:Application>

3. What is meant by data models? Explain with one example, what are the ways you
can do it. (June/July 11) (5 marks)

Ans :

 Data binding is the process of tying the data in one object to another object. It
provides a convenient way to pass data between the different layers of the
application.
 Data binding requires a source property, a destination property, and a triggering
event that indicates when to copy the data from the source to the destination.
 An object dispatches the triggering event when the source property changes.
 Adobe Flex provides three ways to specify data binding: the curly braces ({})
syntax in MXML, the <mx:Binding> tag in MXML, and the BindingUtils methods
in ActionScript.
 The following example uses the curly braces ({}) syntax to show a Text control
that gets its data from a TextInput control's text property:

<?xml version="1.0"?>
<!-- binding/BasicBinding.mxml -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">

<mx:TextInput id="myTI" text="Enter text here"/>


<mx:Text id="myText" text="{myTI.text}"/>
</mx:Application>

Dept of CSE, SJBIT 22


Web 2.0 10CS666

UNIT 8

BUILDING ADVANCED WEB 2.0 APPLICATIONS


1. Explain the flex application remote data communication. (June/July 11) (6 marks)

Ans :

 Remote data communication occurs at runtime.


 Flex applications support a variety of remote data communication techniques built
on standards.
 There are three basic categories of Flex application remote data communication:

HTTP request/response-style communication

 This category consists of several overlapping techniques. Utilizing the Flex


framework HTTPService component or the Flash Player API URLLoader class,
you can send and load uncompressed data such as text blocks, URL encoded data,
and XML packets Each technique achieves
the similar goal of sending requests and receiving responses using HTTP or
HTTPS.
Real-time communication

 This category consists of persistent socket connections. Flash Player supports


two types of socket connections: those that require a specific format for packets
(XMLSocket) and those that allow raw socket connections (Socket)
File upload/download communication

 This category consists of the FileReference API which is native to Flash Player
and allows file upload and download directly within Flex applications .

2. Write a short note on (June/July 11) (6marks)


a. Mashup applications
A mashup is similar to a remix. You might have heard examples again from the music
world where elements of Led Zeppelin are combined with Jayzee, for example, to form a
weird rap/rock song. That’s a mashup. The same can be done with data from the Internet.
Mashup Techniques - Mashing on the Web Server

Every site sits on a Web server. It’s the thing that serves up the page, typically Internet
Information Server (IIS) in the Microsoft world.

Dept of CSE, SJBIT 23


Web 2.0 10CS666

b. RSS
RSS (most commonly expanded as Really Simple Syndication) is a family of web feed
formats used to publish frequently updated works—such as blog entries, news headlines,
audio, and video—in a standardized format.[2] An RSS document (which is called a
"feed", "web feed",[3] or "channel") includes full or summarized text, plus metadata such
as publishing dates and authorship. Web feeds benefit publishers by letting them
syndicate content automatically. They benefit readers who want to subscribe to timely
updates from favored websites or to aggregate feeds from many sites into one place. RSS
feeds can be read using software called an "RSS reader", "feed reader", or "aggregator",
which can be web-based, desktop-based, or mobile-device-based. A standardized XML
file format allows the information to be published once and viewed by many different
programs. The user subscribes to a feed by entering into the reader the feed's URI or by
clicking an RSS icon in a web browser that initiates the subscription process. The RSS
reader checks the user's subscribed feeds regularly for new work, downloads any updates
that it finds, and provides a user interface to monitor and read the feeds. RSS allows users
to avoid manually inspecting all of the websites they are interested in, and instead
subscribe to websites such that all new content is pushed onto their browsers when it
becomes available.

Dept of CSE, SJBIT 24

You might also like