<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.expertiza.ncsu.edu/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Aprasad3</id>
	<title>Expertiza_Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.expertiza.ncsu.edu/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Aprasad3"/>
	<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=Special:Contributions/Aprasad3"/>
	<updated>2026-06-06T20:22:47Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.41.0</generator>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/final_design_doc_M1450_navr&amp;diff=92383</id>
		<title>CSC/ECE 517 Fall 2014/final design doc M1450 navr</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/final_design_doc_M1450_navr&amp;diff=92383"/>
		<updated>2014-12-04T00:53:22Z</updated>

		<summary type="html">&lt;p&gt;Aprasad3: /* Implementation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Implement Window.sessionStorage ==&lt;br /&gt;
&lt;br /&gt;
This is the design document for the task &amp;lt;code&amp;gt;[http://github.com/servo/servo/wiki/Storage-student-project Implement Window.sessionStorage]&amp;lt;/code&amp;gt; for the [http://www.mozilla.org/ Mozilla] research project [http://github.com/servo/servo/wiki/Design Servo].&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
=== [http://www.rust-lang.org/ Rust]===&lt;br /&gt;
&lt;br /&gt;
Rust is a modern systems programming language focusing on safety and speed to build reliable and efficient systems &amp;lt;ref&amp;gt; http://doc.rust-lang.org/nightly/intro.html &amp;lt;/ref&amp;gt;. It accomplishes the goals of memory safe without using garbage collection and it supports concurrency and parallelism in building platforms. &lt;br /&gt;
&lt;br /&gt;
Rust’s lightweight task mechanism also promises to allow fine-grained isolation between browser components, such as tabs and extensions, without the need for expensive runtime protection schemes, like operating system process isolation. &amp;lt;ref&amp;gt; https://www.mozilla.org/en-US/research/projects/ &amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== [http://github.com/servo/servo/wiki/Design Servo] ===&lt;br /&gt;
&lt;br /&gt;
Mozilla Research team is currently working on an experimental project to develop a new Web browser engine &amp;quot;Servo&amp;quot;, that is capable of supporting a variety of current and next generation of hardware like mobile devices, multi-core processors and high-performance GPUs. Servo builds on top of Rust to provide a secure and reliable foundation. It is currently developed on 64 bit devices.&amp;lt;ref&amp;gt; https://www.mozilla.org/en-US/research/projects/ &amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The main objectives of this experimentation project is improving the layout to graphics rendering - to optimize for power efficiency and maximize parallelism. &amp;lt;ref&amp;gt; https://www.mozilla.org/en-US/research/projects/ &amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Background ==&lt;br /&gt;
&lt;br /&gt;
=== [http://html.spec.whatwg.org/multipage/webstorage.html#webstorage Web Storage] ===&lt;br /&gt;
The web storage specification defines the means by which a web application can store string key/value pairs in a browser and later retrieve them for use.&amp;lt;ref&amp;gt;https://developer.mozilla.org/en-US/docs/Web/Guide/API/DOM/Storage&amp;lt;/ref&amp;gt; It supports persistent data storage, similar to [http://en.wikipedia.org/wiki/HTTP_cookie cookies] but with a greatly enhanced capacity and no information stored in the [http://en.wikipedia.org/wiki/List_of_HTTP_headers HTTP request header].&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Web_storage&amp;lt;/ref&amp;gt; There are two types of web storage: [http://html.spec.whatwg.org/multipage/webstorage.html#dom-localstorage local storage] and [http://html.spec.whatwg.org/multipage/webstorage.html#dom-sessionstorage session storage].&lt;br /&gt;
&lt;br /&gt;
Browsers that support web storage have the global variables 'sessionStorage' and 'localStorage' declared at the [http://developer.mozilla.org/en-US/docs/Web/API/Window?redirectlocale=en-US&amp;amp;redirectslug=DOM%2Fwindow window] level. The following JavaScript code gives an example of how to use web storage:&lt;br /&gt;
&lt;br /&gt;
'''sessionStorage'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Store value on browser for duration of the session&lt;br /&gt;
sessionStorage.setItem('key', 'value');&lt;br /&gt;
 &lt;br /&gt;
// Retrieve value (gets deleted when browser is closed and re-opened)&lt;br /&gt;
alert(sessionStorage.getItem('key'));&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''localStorage'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Store value on the browser beyond the duration of the session&lt;br /&gt;
localStorage.setItem('key', 'value');&lt;br /&gt;
 &lt;br /&gt;
// Retrieve value (persists even after closing and re-opening the browser)&lt;br /&gt;
alert(localStorage.getItem('key'));&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
&lt;br /&gt;
As part of our [http://github.com/servo/servo/wiki/Storage-student-project project], we have to implement the web storage specification in the Servo browser. Implementing this important specification in Servo will allow stateful web applications to run, and will help expose any architectural problems that Servo's radical design may cause. &amp;lt;ref&amp;gt; https://github.com/servo/servo/wiki/Storage-student-project&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Requirement Analysis &amp;lt;ref&amp;gt;https://github.com/servo/servo/wiki/Storage-student-project&amp;lt;/ref&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
In order to introduce the support for session storage and local storage in the Servo Browser, we have to create the Storage structure and allow web pages to store data in the Servo memory space.&lt;br /&gt;
&lt;br /&gt;
Below is a overview of the various steps identified as part of requirement analysis:&lt;br /&gt;
&lt;br /&gt;
'''Storage Interface'''&lt;br /&gt;
* We have to create the Storage interface and its stub implementation.&lt;br /&gt;
* This interface is used by the web pages to communicate to the web storage.&lt;br /&gt;
&lt;br /&gt;
'''WindowSessionStorage Interface'''&lt;br /&gt;
* We have to create the WindowSessionStorage interface which will return a Storage instance.&lt;br /&gt;
* A web page will use this interface to access its session storage.&lt;br /&gt;
&lt;br /&gt;
'''WebStorageTask'''&lt;br /&gt;
* We have to create a Storage Task which will be used to store all the web storage data.&lt;br /&gt;
* This is a separate thread which starts when browser starts.&lt;br /&gt;
* The class implementing the Storage interface uses it to store and retrieve the actual data.&lt;br /&gt;
&lt;br /&gt;
'''Communication Channel'''&lt;br /&gt;
* It provides the means to communicate to the separate thread 'WebStorageTask'.&lt;br /&gt;
* We need to define a message-passing interface for reading and writing stored data for a particular browser tab and use it in the implementation of Storage interface to communicate to WebStorageTask.&lt;br /&gt;
&lt;br /&gt;
'''Notification Event'''&lt;br /&gt;
* We need to notify the respective browser tab when the value of a stored data is changed so that other browser objects which may be using this data can take appropriate action.&lt;br /&gt;
&lt;br /&gt;
'''Web Storage Tests'''&lt;br /&gt;
* We need to pass as many [http://github.com/servo/web-platform-tests/tree/servo/webstorage tests] as possible.&lt;br /&gt;
* These tests are part of the web storage specification. Any browser implementing the web storage interface must pass as many tests as possible out of these.&lt;br /&gt;
&lt;br /&gt;
'''WindowLocalStorage Interface'''&lt;br /&gt;
* We need to implement the WindowLocalStorage interface which behaves slightly different from the WindowSessionStorage interface.&lt;br /&gt;
* This will provide the interface to access browser's local storage.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
The implementation of the project was divided into the following milestones :&lt;br /&gt;
 &lt;br /&gt;
* '''Create and stub the Storage WebIDL interface defined in the spec :''' This milestone involved the initial creation of the Storage interface on which the entire project is based. The storage web idl was created as defined in the specifications : https://html.spec.whatwg.org/multipage/webstorage.html#storage-2&lt;br /&gt;
&lt;br /&gt;
* '''Create and stub the WindowSessionStorage WebIDL interface defined in the spec, making it return a Storage instance''' : Once the Storage interface was created, we had to implement the interface to actually define the functions which were a part of the interface. Here we extended the Storage interface to specialize it as Session Storage interface namely WindowSessionStorage. The methods in this interface were then further implemented in Storage.rs which was made to return a Storage instance to the web page or application requiring the support of sessionstorage.&lt;br /&gt;
&lt;br /&gt;
* '''Create a storage task (similar to the resource task) which will contain all stored data''' : The actual data is stored in a background task known as Storage Task, A task in rust terms is nothing but a thread which can run in the background keep polling until it is required, it does so by looping over a channel until a request comes its way. The Storage task contains a HashMap of TreeMap the outer Hashmap is used to store requests and values based on the origin of the request i.e. the url it is coming from , therefore every url/origin will have a TreeMap of its own which will maintain the &amp;lt;key , value&amp;gt; pair in a logical fashion. Thus the storage task contains the actual data structure which holds all the values and the Storage.rs will act as a mediator between the object and the data stored in the task.&lt;br /&gt;
&lt;br /&gt;
* '''Define a message-passing interface for reading and writing stored data for a particular origin''': The Storage object requires a medium to delegate the functions to storage task where the actual implementation takes place, this is done using [http://doc.rust-lang.org/std/comm/fn.channel.html Channels]. There are 2 major channels , one which the storage task creates and loops on to listen onto the request, the other is when the storage object wants to get data from the task , it creates a temp channel on which it listens for reply. This is how the message-passing interface has been implemented in the given milestone.&lt;br /&gt;
&lt;br /&gt;
* '''Store a channel to the storage task in the Page structure that sends messages from the previous interface, and make use of it in the implementation of Storage''' : The storage object requires to know the channel on which the task is looping in order to send it requests for get/set or other functions, this is done by storing the channel that the storage task creates in the Page Structure which acts as a common object between these 2, therefore by passing the created channel to the page structure it can now be accessed and utilized by the Storage in order to delegate the methods onto the storage task and communicate.&lt;br /&gt;
&lt;br /&gt;
== Architecture &amp;lt;ref&amp;gt;https://github.com/servo/servo/wiki/Design&amp;lt;/ref&amp;gt;==&lt;br /&gt;
[[File:task.jpg]] &lt;br /&gt;
&lt;br /&gt;
=== Architecture Explained ===&lt;br /&gt;
*Each box represents a Rust task.&lt;br /&gt;
*Blue boxes represent the primary tasks in the browser pipeline.&lt;br /&gt;
*Gray boxes represent tasks auxiliary to the browser pipeline.&lt;br /&gt;
*White boxes represent worker tasks. Each such box represents several tasks, the precise number of which will vary with the workload.&lt;br /&gt;
*Dashed lines indicate supervisor relationships.&lt;br /&gt;
*Solid lines indicate communication channels.&lt;br /&gt;
&lt;br /&gt;
== Component Design ==&lt;br /&gt;
[[File:servo.jpg]]&lt;br /&gt;
&lt;br /&gt;
There will be a Storage Task which will be responsible to hold all the data that the web page requests to save. This happens via Channels in Rust, which implements a Sender Receiver protocol. The task is runnning in the background and waits to receive the data sent from the web page.&lt;br /&gt;
&lt;br /&gt;
=== Task &amp;lt;ref&amp;gt;http://doc.rust-lang.org/guide-tasks.html&amp;lt;/ref&amp;gt;===&lt;br /&gt;
Rust provides safe concurrent abstractions through a number of core library primitives. This guide will describe the concurrency model in Rust, how it relates to the Rust type system, and introduce the fundamental library abstractions for constructing concurrent programs.&lt;br /&gt;
&lt;br /&gt;
Tasks provide failure isolation and recovery. When a fatal error occurs in Rust code as a result of an explicit call to panic!(), an assertion failure, or another invalid operation, the runtime system destroys the entire task. Unlike in languages such as Java and C++, there is no way to catch an exception. Instead, tasks may monitor each other to see if they panic.&lt;br /&gt;
&lt;br /&gt;
Tasks use Rust's type system to provide strong memory safety guarantees. In particular, the type system guarantees that tasks cannot induce a data race from shared mutable state.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Generate some state locally&lt;br /&gt;
let child_task_number = generate_task_number();&lt;br /&gt;
&lt;br /&gt;
spawn(proc() {&lt;br /&gt;
    // Capture it in the remote task&lt;br /&gt;
    println!(&amp;quot;I am child number {}&amp;quot;, child_task_number);&lt;br /&gt;
});&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Channel &amp;lt;ref&amp;gt;http://doc.rust-lang.org/guide-tasks.html&amp;lt;/ref&amp;gt;===&lt;br /&gt;
Now that we have spawned a new task, it would be nice if we could communicate with it. For this, we use channels. A channel is simply a pair of endpoints: one for sending messages and another for receiving messages.&lt;br /&gt;
&lt;br /&gt;
The simplest way to create a channel is to use the channel function to create a (Sender, Receiver) pair. In Rust parlance, a sender is a sending endpoint of a channel, and a receiver is the receiving endpoint. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
let (tx, rx): (Sender&amp;lt;int&amp;gt;, Receiver&amp;lt;int&amp;gt;) = channel();&lt;br /&gt;
&lt;br /&gt;
spawn(proc() {&lt;br /&gt;
    let result = some_expensive_computation();&lt;br /&gt;
    tx.send(result);&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
some_other_expensive_computation();&lt;br /&gt;
let result = rx.recv();&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Data Design ==&lt;br /&gt;
&lt;br /&gt;
===  Data Description ===&lt;br /&gt;
&lt;br /&gt;
''The following are the data structures that will be used.''&lt;br /&gt;
&lt;br /&gt;
'''Storage''' | TreeMap&amp;lt;String,String&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''UrlMap''' | TreeMap&amp;lt;String,TreeMap&amp;lt;String,String&amp;gt;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Design Pattern ==&lt;br /&gt;
&lt;br /&gt;
We will be using '''&amp;quot;Delegation Pattern&amp;quot;''' in our project. The Storage interface is used by web applications to access the web storage provided by the browser. However, the actual data is stored somewhere else(Servo Memory Space). So, it makes sense to create another class which will maintain the actual stored data. The Storage class can then delegate the task of storing/retrieving data to this class. We will create a class &amp;quot;WebStorageTask&amp;quot; for this purpose.&lt;br /&gt;
&lt;br /&gt;
Also we are using an '''&amp;quot;Observer Pattern&amp;quot;''' where the Storage task will run in the background and observe the commands issued using a channel, it will keep listening to changes on a port and as soon as it receives a message i.e. sees a call towards it , it will perform the required function.&lt;br /&gt;
&lt;br /&gt;
== UML Diagrams ==&lt;br /&gt;
&lt;br /&gt;
=== Flow Chart ===&lt;br /&gt;
[[File:Flow_Chart_Storage.png]]&lt;br /&gt;
&lt;br /&gt;
1. First, we need to build rust and servo. &amp;lt;br/&amp;gt;&lt;br /&gt;
2. Generate the corresponding WebIDL bindings - Storage.webidl &amp;lt;br/&amp;gt;&lt;br /&gt;
3. Define Storage.rs which has the actual code for creating the storage object. &amp;lt;br/&amp;gt;&lt;br /&gt;
4. Call the receiver via a channel- this is actually used for creating an instance for each unique URL. &amp;lt;br/&amp;gt;&lt;br /&gt;
5. Build the servo again. &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Use Case Diagram ===&lt;br /&gt;
[[File:Use_Case_-_Storage.png‎]]&lt;br /&gt;
&lt;br /&gt;
1. Here the user can open multiple domains( multiple URL's).&amp;lt;br/&amp;gt;&lt;br /&gt;
2. Thereby the user will be creating multiple storage instances.&amp;lt;br/&amp;gt;&lt;br /&gt;
3. An user can traverse deep into the website but the storage instance is same for that URL.&amp;lt;br/&amp;gt;&lt;br /&gt;
4. The user can reopen the domain for a later period.&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Proposed Test Cases ==&lt;br /&gt;
&lt;br /&gt;
Some of the test cases which will be used to validate our changes are as follows:&lt;br /&gt;
&lt;br /&gt;
* Allow a web page to clear its session storage ''i.e. storage.clear() function should work''&lt;br /&gt;
* Allow a web page to store an item in its session storage ''i.e. test storage.setitem(key,value)''&lt;br /&gt;
* Allow a web page to retrieve stored items from its session storage ''i.e. test storage.getitem(key)''&lt;br /&gt;
* Do not allow a web page to retrieve stored items from the session storage of a web page in another domain ''i.e. try to access elements by forging url&lt;br /&gt;
* Check the number of items stored in session storage i.e storage.count()''&lt;br /&gt;
* On removing an item from storage, it should be inaccessible ''i.e check if storage.remove(key) is functional''&lt;br /&gt;
* Should return null as value for a key not present in the session storage ''i.e. test storage.getitem(key) for non-existent key''&lt;br /&gt;
* Should give an error on exceeding the space limit of session storage ''i.e check for available memory on each command'' &lt;br /&gt;
&lt;br /&gt;
The complete list of test cases can be found [http://github.com/servo/web-platform-tests/tree/servo/webstorage here].&lt;br /&gt;
&lt;br /&gt;
== Further Readings ==&lt;br /&gt;
&lt;br /&gt;
Learning Rust by Examples: http://rustbyexample.com/ &amp;lt;br/&amp;gt;&lt;br /&gt;
Javascript as Servo's Garbage Collector: http://blog.mozilla.org/research/2014/08/26/javascript-servos-only-garbage-collector/  &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Aprasad3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/final_design_doc_M1450_navr&amp;diff=92382</id>
		<title>CSC/ECE 517 Fall 2014/final design doc M1450 navr</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/final_design_doc_M1450_navr&amp;diff=92382"/>
		<updated>2014-12-04T00:50:28Z</updated>

		<summary type="html">&lt;p&gt;Aprasad3: /* Implementation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Implement Window.sessionStorage ==&lt;br /&gt;
&lt;br /&gt;
This is the design document for the task &amp;lt;code&amp;gt;[http://github.com/servo/servo/wiki/Storage-student-project Implement Window.sessionStorage]&amp;lt;/code&amp;gt; for the [http://www.mozilla.org/ Mozilla] research project [http://github.com/servo/servo/wiki/Design Servo].&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
=== [http://www.rust-lang.org/ Rust]===&lt;br /&gt;
&lt;br /&gt;
Rust is a modern systems programming language focusing on safety and speed to build reliable and efficient systems &amp;lt;ref&amp;gt; http://doc.rust-lang.org/nightly/intro.html &amp;lt;/ref&amp;gt;. It accomplishes the goals of memory safe without using garbage collection and it supports concurrency and parallelism in building platforms. &lt;br /&gt;
&lt;br /&gt;
Rust’s lightweight task mechanism also promises to allow fine-grained isolation between browser components, such as tabs and extensions, without the need for expensive runtime protection schemes, like operating system process isolation. &amp;lt;ref&amp;gt; https://www.mozilla.org/en-US/research/projects/ &amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== [http://github.com/servo/servo/wiki/Design Servo] ===&lt;br /&gt;
&lt;br /&gt;
Mozilla Research team is currently working on an experimental project to develop a new Web browser engine &amp;quot;Servo&amp;quot;, that is capable of supporting a variety of current and next generation of hardware like mobile devices, multi-core processors and high-performance GPUs. Servo builds on top of Rust to provide a secure and reliable foundation. It is currently developed on 64 bit devices.&amp;lt;ref&amp;gt; https://www.mozilla.org/en-US/research/projects/ &amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The main objectives of this experimentation project is improving the layout to graphics rendering - to optimize for power efficiency and maximize parallelism. &amp;lt;ref&amp;gt; https://www.mozilla.org/en-US/research/projects/ &amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Background ==&lt;br /&gt;
&lt;br /&gt;
=== [http://html.spec.whatwg.org/multipage/webstorage.html#webstorage Web Storage] ===&lt;br /&gt;
The web storage specification defines the means by which a web application can store string key/value pairs in a browser and later retrieve them for use.&amp;lt;ref&amp;gt;https://developer.mozilla.org/en-US/docs/Web/Guide/API/DOM/Storage&amp;lt;/ref&amp;gt; It supports persistent data storage, similar to [http://en.wikipedia.org/wiki/HTTP_cookie cookies] but with a greatly enhanced capacity and no information stored in the [http://en.wikipedia.org/wiki/List_of_HTTP_headers HTTP request header].&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Web_storage&amp;lt;/ref&amp;gt; There are two types of web storage: [http://html.spec.whatwg.org/multipage/webstorage.html#dom-localstorage local storage] and [http://html.spec.whatwg.org/multipage/webstorage.html#dom-sessionstorage session storage].&lt;br /&gt;
&lt;br /&gt;
Browsers that support web storage have the global variables 'sessionStorage' and 'localStorage' declared at the [http://developer.mozilla.org/en-US/docs/Web/API/Window?redirectlocale=en-US&amp;amp;redirectslug=DOM%2Fwindow window] level. The following JavaScript code gives an example of how to use web storage:&lt;br /&gt;
&lt;br /&gt;
'''sessionStorage'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Store value on browser for duration of the session&lt;br /&gt;
sessionStorage.setItem('key', 'value');&lt;br /&gt;
 &lt;br /&gt;
// Retrieve value (gets deleted when browser is closed and re-opened)&lt;br /&gt;
alert(sessionStorage.getItem('key'));&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''localStorage'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Store value on the browser beyond the duration of the session&lt;br /&gt;
localStorage.setItem('key', 'value');&lt;br /&gt;
 &lt;br /&gt;
// Retrieve value (persists even after closing and re-opening the browser)&lt;br /&gt;
alert(localStorage.getItem('key'));&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
&lt;br /&gt;
As part of our [http://github.com/servo/servo/wiki/Storage-student-project project], we have to implement the web storage specification in the Servo browser. Implementing this important specification in Servo will allow stateful web applications to run, and will help expose any architectural problems that Servo's radical design may cause. &amp;lt;ref&amp;gt; https://github.com/servo/servo/wiki/Storage-student-project&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Requirement Analysis &amp;lt;ref&amp;gt;https://github.com/servo/servo/wiki/Storage-student-project&amp;lt;/ref&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
In order to introduce the support for session storage and local storage in the Servo Browser, we have to create the Storage structure and allow web pages to store data in the Servo memory space.&lt;br /&gt;
&lt;br /&gt;
Below is a overview of the various steps identified as part of requirement analysis:&lt;br /&gt;
&lt;br /&gt;
'''Storage Interface'''&lt;br /&gt;
* We have to create the Storage interface and its stub implementation.&lt;br /&gt;
* This interface is used by the web pages to communicate to the web storage.&lt;br /&gt;
&lt;br /&gt;
'''WindowSessionStorage Interface'''&lt;br /&gt;
* We have to create the WindowSessionStorage interface which will return a Storage instance.&lt;br /&gt;
* A web page will use this interface to access its session storage.&lt;br /&gt;
&lt;br /&gt;
'''WebStorageTask'''&lt;br /&gt;
* We have to create a Storage Task which will be used to store all the web storage data.&lt;br /&gt;
* This is a separate thread which starts when browser starts.&lt;br /&gt;
* The class implementing the Storage interface uses it to store and retrieve the actual data.&lt;br /&gt;
&lt;br /&gt;
'''Communication Channel'''&lt;br /&gt;
* It provides the means to communicate to the separate thread 'WebStorageTask'.&lt;br /&gt;
* We need to define a message-passing interface for reading and writing stored data for a particular browser tab and use it in the implementation of Storage interface to communicate to WebStorageTask.&lt;br /&gt;
&lt;br /&gt;
'''Notification Event'''&lt;br /&gt;
* We need to notify the respective browser tab when the value of a stored data is changed so that other browser objects which may be using this data can take appropriate action.&lt;br /&gt;
&lt;br /&gt;
'''Web Storage Tests'''&lt;br /&gt;
* We need to pass as many [http://github.com/servo/web-platform-tests/tree/servo/webstorage tests] as possible.&lt;br /&gt;
* These tests are part of the web storage specification. Any browser implementing the web storage interface must pass as many tests as possible out of these.&lt;br /&gt;
&lt;br /&gt;
'''WindowLocalStorage Interface'''&lt;br /&gt;
* We need to implement the WindowLocalStorage interface which behaves slightly different from the WindowSessionStorage interface.&lt;br /&gt;
* This will provide the interface to access browser's local storage.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
The implementation of the project was divided into the following milestones :&lt;br /&gt;
 &lt;br /&gt;
* '''Create and stub the Storage WebIDL interface defined in the spec :''' This milestone involved the initial creation of the Storage interface on which the entire project is based. The storage web idl was created as defined in the specifications : https://html.spec.whatwg.org/multipage/webstorage.html#storage-2&lt;br /&gt;
&lt;br /&gt;
* '''Create and stub the WindowSessionStorage WebIDL interface defined in the spec, making it return a Storage instance''' : Once the Storage interface was created, we had to implement the interface to actually define the functions which were a part of the interface. Here we extended the Storage interface to specialize it as Session Storage interface namely WindowSessionStorage. The methods in this interface were then further implemented in Storage.rs which was made to return a Storage instance to the web page or application requiring the support of sessionstorage.&lt;br /&gt;
&lt;br /&gt;
* '''Create a storage task (similar to the resource task) which will contain all stored data''' : The actual data is stored in a background task known as Storage Task, A task in rust terms is nothing but a thread which can run in the background keep polling until it is required, it does so by looping over a channel until a request comes its way. The Storage task contains a HashMap of TreeMap the outer Hashmap is used to store requests and values based on the origin of the request i.e. the url it is coming from , therefore every url/origin will have a TreeMap of its own which will maintain the &amp;lt;key , value&amp;gt; pair in a logical fashion. Thus the storage task contains the actual data structure which holds all the values and the Storage.rs will act as a mediator between the object and the data stored in the task.&lt;br /&gt;
&lt;br /&gt;
* '''Define a message-passing interface for reading and writing stored data for a particular origin''': The Storage object requires a medium to delegate the functions to storage task where the actual implementation takes place, this is done using [http://doc.rust-lang.org/std/comm/fn.channel.html Channels]. There are 2 major channels , one which the storage task creates and loops on to listen onto the request, the other is when the storage object wants to get data from the task , it creates a temp channel on which it listens for reply. This is how the message-passing interface has been implemented in the given milestone.&lt;br /&gt;
&lt;br /&gt;
== Architecture &amp;lt;ref&amp;gt;https://github.com/servo/servo/wiki/Design&amp;lt;/ref&amp;gt;==&lt;br /&gt;
[[File:task.jpg]] &lt;br /&gt;
&lt;br /&gt;
=== Architecture Explained ===&lt;br /&gt;
*Each box represents a Rust task.&lt;br /&gt;
*Blue boxes represent the primary tasks in the browser pipeline.&lt;br /&gt;
*Gray boxes represent tasks auxiliary to the browser pipeline.&lt;br /&gt;
*White boxes represent worker tasks. Each such box represents several tasks, the precise number of which will vary with the workload.&lt;br /&gt;
*Dashed lines indicate supervisor relationships.&lt;br /&gt;
*Solid lines indicate communication channels.&lt;br /&gt;
&lt;br /&gt;
== Component Design ==&lt;br /&gt;
[[File:servo.jpg]]&lt;br /&gt;
&lt;br /&gt;
There will be a Storage Task which will be responsible to hold all the data that the web page requests to save. This happens via Channels in Rust, which implements a Sender Receiver protocol. The task is runnning in the background and waits to receive the data sent from the web page.&lt;br /&gt;
&lt;br /&gt;
=== Task &amp;lt;ref&amp;gt;http://doc.rust-lang.org/guide-tasks.html&amp;lt;/ref&amp;gt;===&lt;br /&gt;
Rust provides safe concurrent abstractions through a number of core library primitives. This guide will describe the concurrency model in Rust, how it relates to the Rust type system, and introduce the fundamental library abstractions for constructing concurrent programs.&lt;br /&gt;
&lt;br /&gt;
Tasks provide failure isolation and recovery. When a fatal error occurs in Rust code as a result of an explicit call to panic!(), an assertion failure, or another invalid operation, the runtime system destroys the entire task. Unlike in languages such as Java and C++, there is no way to catch an exception. Instead, tasks may monitor each other to see if they panic.&lt;br /&gt;
&lt;br /&gt;
Tasks use Rust's type system to provide strong memory safety guarantees. In particular, the type system guarantees that tasks cannot induce a data race from shared mutable state.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Generate some state locally&lt;br /&gt;
let child_task_number = generate_task_number();&lt;br /&gt;
&lt;br /&gt;
spawn(proc() {&lt;br /&gt;
    // Capture it in the remote task&lt;br /&gt;
    println!(&amp;quot;I am child number {}&amp;quot;, child_task_number);&lt;br /&gt;
});&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Channel &amp;lt;ref&amp;gt;http://doc.rust-lang.org/guide-tasks.html&amp;lt;/ref&amp;gt;===&lt;br /&gt;
Now that we have spawned a new task, it would be nice if we could communicate with it. For this, we use channels. A channel is simply a pair of endpoints: one for sending messages and another for receiving messages.&lt;br /&gt;
&lt;br /&gt;
The simplest way to create a channel is to use the channel function to create a (Sender, Receiver) pair. In Rust parlance, a sender is a sending endpoint of a channel, and a receiver is the receiving endpoint. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
let (tx, rx): (Sender&amp;lt;int&amp;gt;, Receiver&amp;lt;int&amp;gt;) = channel();&lt;br /&gt;
&lt;br /&gt;
spawn(proc() {&lt;br /&gt;
    let result = some_expensive_computation();&lt;br /&gt;
    tx.send(result);&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
some_other_expensive_computation();&lt;br /&gt;
let result = rx.recv();&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Data Design ==&lt;br /&gt;
&lt;br /&gt;
===  Data Description ===&lt;br /&gt;
&lt;br /&gt;
''The following are the data structures that will be used.''&lt;br /&gt;
&lt;br /&gt;
'''Storage''' | TreeMap&amp;lt;String,String&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''UrlMap''' | TreeMap&amp;lt;String,TreeMap&amp;lt;String,String&amp;gt;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Design Pattern ==&lt;br /&gt;
&lt;br /&gt;
We will be using '''&amp;quot;Delegation Pattern&amp;quot;''' in our project. The Storage interface is used by web applications to access the web storage provided by the browser. However, the actual data is stored somewhere else(Servo Memory Space). So, it makes sense to create another class which will maintain the actual stored data. The Storage class can then delegate the task of storing/retrieving data to this class. We will create a class &amp;quot;WebStorageTask&amp;quot; for this purpose.&lt;br /&gt;
&lt;br /&gt;
Also we are using an '''&amp;quot;Observer Pattern&amp;quot;''' where the Storage task will run in the background and observe the commands issued using a channel, it will keep listening to changes on a port and as soon as it receives a message i.e. sees a call towards it , it will perform the required function.&lt;br /&gt;
&lt;br /&gt;
== UML Diagrams ==&lt;br /&gt;
&lt;br /&gt;
=== Flow Chart ===&lt;br /&gt;
[[File:Flow_Chart_Storage.png]]&lt;br /&gt;
&lt;br /&gt;
1. First, we need to build rust and servo. &amp;lt;br/&amp;gt;&lt;br /&gt;
2. Generate the corresponding WebIDL bindings - Storage.webidl &amp;lt;br/&amp;gt;&lt;br /&gt;
3. Define Storage.rs which has the actual code for creating the storage object. &amp;lt;br/&amp;gt;&lt;br /&gt;
4. Call the receiver via a channel- this is actually used for creating an instance for each unique URL. &amp;lt;br/&amp;gt;&lt;br /&gt;
5. Build the servo again. &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Use Case Diagram ===&lt;br /&gt;
[[File:Use_Case_-_Storage.png‎]]&lt;br /&gt;
&lt;br /&gt;
1. Here the user can open multiple domains( multiple URL's).&amp;lt;br/&amp;gt;&lt;br /&gt;
2. Thereby the user will be creating multiple storage instances.&amp;lt;br/&amp;gt;&lt;br /&gt;
3. An user can traverse deep into the website but the storage instance is same for that URL.&amp;lt;br/&amp;gt;&lt;br /&gt;
4. The user can reopen the domain for a later period.&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Proposed Test Cases ==&lt;br /&gt;
&lt;br /&gt;
Some of the test cases which will be used to validate our changes are as follows:&lt;br /&gt;
&lt;br /&gt;
* Allow a web page to clear its session storage ''i.e. storage.clear() function should work''&lt;br /&gt;
* Allow a web page to store an item in its session storage ''i.e. test storage.setitem(key,value)''&lt;br /&gt;
* Allow a web page to retrieve stored items from its session storage ''i.e. test storage.getitem(key)''&lt;br /&gt;
* Do not allow a web page to retrieve stored items from the session storage of a web page in another domain ''i.e. try to access elements by forging url&lt;br /&gt;
* Check the number of items stored in session storage i.e storage.count()''&lt;br /&gt;
* On removing an item from storage, it should be inaccessible ''i.e check if storage.remove(key) is functional''&lt;br /&gt;
* Should return null as value for a key not present in the session storage ''i.e. test storage.getitem(key) for non-existent key''&lt;br /&gt;
* Should give an error on exceeding the space limit of session storage ''i.e check for available memory on each command'' &lt;br /&gt;
&lt;br /&gt;
The complete list of test cases can be found [http://github.com/servo/web-platform-tests/tree/servo/webstorage here].&lt;br /&gt;
&lt;br /&gt;
== Further Readings ==&lt;br /&gt;
&lt;br /&gt;
Learning Rust by Examples: http://rustbyexample.com/ &amp;lt;br/&amp;gt;&lt;br /&gt;
Javascript as Servo's Garbage Collector: http://blog.mozilla.org/research/2014/08/26/javascript-servos-only-garbage-collector/  &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Aprasad3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/final_design_doc_M1450_navr&amp;diff=92381</id>
		<title>CSC/ECE 517 Fall 2014/final design doc M1450 navr</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/final_design_doc_M1450_navr&amp;diff=92381"/>
		<updated>2014-12-04T00:48:39Z</updated>

		<summary type="html">&lt;p&gt;Aprasad3: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Implement Window.sessionStorage ==&lt;br /&gt;
&lt;br /&gt;
This is the design document for the task &amp;lt;code&amp;gt;[http://github.com/servo/servo/wiki/Storage-student-project Implement Window.sessionStorage]&amp;lt;/code&amp;gt; for the [http://www.mozilla.org/ Mozilla] research project [http://github.com/servo/servo/wiki/Design Servo].&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
=== [http://www.rust-lang.org/ Rust]===&lt;br /&gt;
&lt;br /&gt;
Rust is a modern systems programming language focusing on safety and speed to build reliable and efficient systems &amp;lt;ref&amp;gt; http://doc.rust-lang.org/nightly/intro.html &amp;lt;/ref&amp;gt;. It accomplishes the goals of memory safe without using garbage collection and it supports concurrency and parallelism in building platforms. &lt;br /&gt;
&lt;br /&gt;
Rust’s lightweight task mechanism also promises to allow fine-grained isolation between browser components, such as tabs and extensions, without the need for expensive runtime protection schemes, like operating system process isolation. &amp;lt;ref&amp;gt; https://www.mozilla.org/en-US/research/projects/ &amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== [http://github.com/servo/servo/wiki/Design Servo] ===&lt;br /&gt;
&lt;br /&gt;
Mozilla Research team is currently working on an experimental project to develop a new Web browser engine &amp;quot;Servo&amp;quot;, that is capable of supporting a variety of current and next generation of hardware like mobile devices, multi-core processors and high-performance GPUs. Servo builds on top of Rust to provide a secure and reliable foundation. It is currently developed on 64 bit devices.&amp;lt;ref&amp;gt; https://www.mozilla.org/en-US/research/projects/ &amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The main objectives of this experimentation project is improving the layout to graphics rendering - to optimize for power efficiency and maximize parallelism. &amp;lt;ref&amp;gt; https://www.mozilla.org/en-US/research/projects/ &amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Background ==&lt;br /&gt;
&lt;br /&gt;
=== [http://html.spec.whatwg.org/multipage/webstorage.html#webstorage Web Storage] ===&lt;br /&gt;
The web storage specification defines the means by which a web application can store string key/value pairs in a browser and later retrieve them for use.&amp;lt;ref&amp;gt;https://developer.mozilla.org/en-US/docs/Web/Guide/API/DOM/Storage&amp;lt;/ref&amp;gt; It supports persistent data storage, similar to [http://en.wikipedia.org/wiki/HTTP_cookie cookies] but with a greatly enhanced capacity and no information stored in the [http://en.wikipedia.org/wiki/List_of_HTTP_headers HTTP request header].&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Web_storage&amp;lt;/ref&amp;gt; There are two types of web storage: [http://html.spec.whatwg.org/multipage/webstorage.html#dom-localstorage local storage] and [http://html.spec.whatwg.org/multipage/webstorage.html#dom-sessionstorage session storage].&lt;br /&gt;
&lt;br /&gt;
Browsers that support web storage have the global variables 'sessionStorage' and 'localStorage' declared at the [http://developer.mozilla.org/en-US/docs/Web/API/Window?redirectlocale=en-US&amp;amp;redirectslug=DOM%2Fwindow window] level. The following JavaScript code gives an example of how to use web storage:&lt;br /&gt;
&lt;br /&gt;
'''sessionStorage'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Store value on browser for duration of the session&lt;br /&gt;
sessionStorage.setItem('key', 'value');&lt;br /&gt;
 &lt;br /&gt;
// Retrieve value (gets deleted when browser is closed and re-opened)&lt;br /&gt;
alert(sessionStorage.getItem('key'));&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''localStorage'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Store value on the browser beyond the duration of the session&lt;br /&gt;
localStorage.setItem('key', 'value');&lt;br /&gt;
 &lt;br /&gt;
// Retrieve value (persists even after closing and re-opening the browser)&lt;br /&gt;
alert(localStorage.getItem('key'));&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
&lt;br /&gt;
As part of our [http://github.com/servo/servo/wiki/Storage-student-project project], we have to implement the web storage specification in the Servo browser. Implementing this important specification in Servo will allow stateful web applications to run, and will help expose any architectural problems that Servo's radical design may cause. &amp;lt;ref&amp;gt; https://github.com/servo/servo/wiki/Storage-student-project&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Requirement Analysis &amp;lt;ref&amp;gt;https://github.com/servo/servo/wiki/Storage-student-project&amp;lt;/ref&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
In order to introduce the support for session storage and local storage in the Servo Browser, we have to create the Storage structure and allow web pages to store data in the Servo memory space.&lt;br /&gt;
&lt;br /&gt;
Below is a overview of the various steps identified as part of requirement analysis:&lt;br /&gt;
&lt;br /&gt;
'''Storage Interface'''&lt;br /&gt;
* We have to create the Storage interface and its stub implementation.&lt;br /&gt;
* This interface is used by the web pages to communicate to the web storage.&lt;br /&gt;
&lt;br /&gt;
'''WindowSessionStorage Interface'''&lt;br /&gt;
* We have to create the WindowSessionStorage interface which will return a Storage instance.&lt;br /&gt;
* A web page will use this interface to access its session storage.&lt;br /&gt;
&lt;br /&gt;
'''WebStorageTask'''&lt;br /&gt;
* We have to create a Storage Task which will be used to store all the web storage data.&lt;br /&gt;
* This is a separate thread which starts when browser starts.&lt;br /&gt;
* The class implementing the Storage interface uses it to store and retrieve the actual data.&lt;br /&gt;
&lt;br /&gt;
'''Communication Channel'''&lt;br /&gt;
* It provides the means to communicate to the separate thread 'WebStorageTask'.&lt;br /&gt;
* We need to define a message-passing interface for reading and writing stored data for a particular browser tab and use it in the implementation of Storage interface to communicate to WebStorageTask.&lt;br /&gt;
&lt;br /&gt;
'''Notification Event'''&lt;br /&gt;
* We need to notify the respective browser tab when the value of a stored data is changed so that other browser objects which may be using this data can take appropriate action.&lt;br /&gt;
&lt;br /&gt;
'''Web Storage Tests'''&lt;br /&gt;
* We need to pass as many [http://github.com/servo/web-platform-tests/tree/servo/webstorage tests] as possible.&lt;br /&gt;
* These tests are part of the web storage specification. Any browser implementing the web storage interface must pass as many tests as possible out of these.&lt;br /&gt;
&lt;br /&gt;
'''WindowLocalStorage Interface'''&lt;br /&gt;
* We need to implement the WindowLocalStorage interface which behaves slightly different from the WindowSessionStorage interface.&lt;br /&gt;
* This will provide the interface to access browser's local storage.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
The implementation of the project was divided into the following milestones :&lt;br /&gt;
 &lt;br /&gt;
* '''Create and stub the Storage WebIDL interface defined in the spec :''' This milestone involved the initial creation of the Storage interface on which the entire project is based. The storage web idl was created as defined in the specifications : https://html.spec.whatwg.org/multipage/webstorage.html#storage-2&lt;br /&gt;
&lt;br /&gt;
* '''Create and stub the WindowSessionStorage WebIDL interface defined in the spec, making it return a Storage instance''' : Once the Storage interface was created, we had to implement the interface to actually define the functions which were a part of the interface. Here we extended the Storage interface to specialize it as Session Storage interface namely WindowSessionStorage. The methods in this interface were then further implemented in Storage.rs which was made to return a Storage instance to the web page or application requiring the support of sessionstorage.&lt;br /&gt;
&lt;br /&gt;
* '''Create a storage task (similar to the resource task) which will contain all stored data''' : The actual data is stored in a background task known as Storage Task, A task in rust terms is nothing but a thread which can run in the background keep polling until it is required, it does so by looping over a channel until a request comes its way. The Storage task contains a HashMap of TreeMap the outer Hashmap is used to store requests and values based on the origin of the request i.e. the url it is coming from , therefore every url/origin will have a TreeMap of its own which will maintain the &amp;lt;key , value&amp;gt; pair in a logical fashion. Thus the storage task contains the actual data structure which holds all the values and the Storage.rs will act as a mediator between the object and the data stored in the task.&lt;br /&gt;
&lt;br /&gt;
* '''Define a message-passing interface for reading and writing stored data for a particular origin''': The Storage object requires a medium to delegate the functions to storage task where the actual implementation takes place, this is done using [http://doc.rust-lang.org/std/comm/fn.channel.html Channels]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Architecture &amp;lt;ref&amp;gt;https://github.com/servo/servo/wiki/Design&amp;lt;/ref&amp;gt;==&lt;br /&gt;
[[File:task.jpg]] &lt;br /&gt;
&lt;br /&gt;
=== Architecture Explained ===&lt;br /&gt;
*Each box represents a Rust task.&lt;br /&gt;
*Blue boxes represent the primary tasks in the browser pipeline.&lt;br /&gt;
*Gray boxes represent tasks auxiliary to the browser pipeline.&lt;br /&gt;
*White boxes represent worker tasks. Each such box represents several tasks, the precise number of which will vary with the workload.&lt;br /&gt;
*Dashed lines indicate supervisor relationships.&lt;br /&gt;
*Solid lines indicate communication channels.&lt;br /&gt;
&lt;br /&gt;
== Component Design ==&lt;br /&gt;
[[File:servo.jpg]]&lt;br /&gt;
&lt;br /&gt;
There will be a Storage Task which will be responsible to hold all the data that the web page requests to save. This happens via Channels in Rust, which implements a Sender Receiver protocol. The task is runnning in the background and waits to receive the data sent from the web page.&lt;br /&gt;
&lt;br /&gt;
=== Task &amp;lt;ref&amp;gt;http://doc.rust-lang.org/guide-tasks.html&amp;lt;/ref&amp;gt;===&lt;br /&gt;
Rust provides safe concurrent abstractions through a number of core library primitives. This guide will describe the concurrency model in Rust, how it relates to the Rust type system, and introduce the fundamental library abstractions for constructing concurrent programs.&lt;br /&gt;
&lt;br /&gt;
Tasks provide failure isolation and recovery. When a fatal error occurs in Rust code as a result of an explicit call to panic!(), an assertion failure, or another invalid operation, the runtime system destroys the entire task. Unlike in languages such as Java and C++, there is no way to catch an exception. Instead, tasks may monitor each other to see if they panic.&lt;br /&gt;
&lt;br /&gt;
Tasks use Rust's type system to provide strong memory safety guarantees. In particular, the type system guarantees that tasks cannot induce a data race from shared mutable state.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Generate some state locally&lt;br /&gt;
let child_task_number = generate_task_number();&lt;br /&gt;
&lt;br /&gt;
spawn(proc() {&lt;br /&gt;
    // Capture it in the remote task&lt;br /&gt;
    println!(&amp;quot;I am child number {}&amp;quot;, child_task_number);&lt;br /&gt;
});&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Channel &amp;lt;ref&amp;gt;http://doc.rust-lang.org/guide-tasks.html&amp;lt;/ref&amp;gt;===&lt;br /&gt;
Now that we have spawned a new task, it would be nice if we could communicate with it. For this, we use channels. A channel is simply a pair of endpoints: one for sending messages and another for receiving messages.&lt;br /&gt;
&lt;br /&gt;
The simplest way to create a channel is to use the channel function to create a (Sender, Receiver) pair. In Rust parlance, a sender is a sending endpoint of a channel, and a receiver is the receiving endpoint. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
let (tx, rx): (Sender&amp;lt;int&amp;gt;, Receiver&amp;lt;int&amp;gt;) = channel();&lt;br /&gt;
&lt;br /&gt;
spawn(proc() {&lt;br /&gt;
    let result = some_expensive_computation();&lt;br /&gt;
    tx.send(result);&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
some_other_expensive_computation();&lt;br /&gt;
let result = rx.recv();&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Data Design ==&lt;br /&gt;
&lt;br /&gt;
===  Data Description ===&lt;br /&gt;
&lt;br /&gt;
''The following are the data structures that will be used.''&lt;br /&gt;
&lt;br /&gt;
'''Storage''' | TreeMap&amp;lt;String,String&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''UrlMap''' | TreeMap&amp;lt;String,TreeMap&amp;lt;String,String&amp;gt;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Design Pattern ==&lt;br /&gt;
&lt;br /&gt;
We will be using '''&amp;quot;Delegation Pattern&amp;quot;''' in our project. The Storage interface is used by web applications to access the web storage provided by the browser. However, the actual data is stored somewhere else(Servo Memory Space). So, it makes sense to create another class which will maintain the actual stored data. The Storage class can then delegate the task of storing/retrieving data to this class. We will create a class &amp;quot;WebStorageTask&amp;quot; for this purpose.&lt;br /&gt;
&lt;br /&gt;
Also we are using an '''&amp;quot;Observer Pattern&amp;quot;''' where the Storage task will run in the background and observe the commands issued using a channel, it will keep listening to changes on a port and as soon as it receives a message i.e. sees a call towards it , it will perform the required function.&lt;br /&gt;
&lt;br /&gt;
== UML Diagrams ==&lt;br /&gt;
&lt;br /&gt;
=== Flow Chart ===&lt;br /&gt;
[[File:Flow_Chart_Storage.png]]&lt;br /&gt;
&lt;br /&gt;
1. First, we need to build rust and servo. &amp;lt;br/&amp;gt;&lt;br /&gt;
2. Generate the corresponding WebIDL bindings - Storage.webidl &amp;lt;br/&amp;gt;&lt;br /&gt;
3. Define Storage.rs which has the actual code for creating the storage object. &amp;lt;br/&amp;gt;&lt;br /&gt;
4. Call the receiver via a channel- this is actually used for creating an instance for each unique URL. &amp;lt;br/&amp;gt;&lt;br /&gt;
5. Build the servo again. &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Use Case Diagram ===&lt;br /&gt;
[[File:Use_Case_-_Storage.png‎]]&lt;br /&gt;
&lt;br /&gt;
1. Here the user can open multiple domains( multiple URL's).&amp;lt;br/&amp;gt;&lt;br /&gt;
2. Thereby the user will be creating multiple storage instances.&amp;lt;br/&amp;gt;&lt;br /&gt;
3. An user can traverse deep into the website but the storage instance is same for that URL.&amp;lt;br/&amp;gt;&lt;br /&gt;
4. The user can reopen the domain for a later period.&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Proposed Test Cases ==&lt;br /&gt;
&lt;br /&gt;
Some of the test cases which will be used to validate our changes are as follows:&lt;br /&gt;
&lt;br /&gt;
* Allow a web page to clear its session storage ''i.e. storage.clear() function should work''&lt;br /&gt;
* Allow a web page to store an item in its session storage ''i.e. test storage.setitem(key,value)''&lt;br /&gt;
* Allow a web page to retrieve stored items from its session storage ''i.e. test storage.getitem(key)''&lt;br /&gt;
* Do not allow a web page to retrieve stored items from the session storage of a web page in another domain ''i.e. try to access elements by forging url&lt;br /&gt;
* Check the number of items stored in session storage i.e storage.count()''&lt;br /&gt;
* On removing an item from storage, it should be inaccessible ''i.e check if storage.remove(key) is functional''&lt;br /&gt;
* Should return null as value for a key not present in the session storage ''i.e. test storage.getitem(key) for non-existent key''&lt;br /&gt;
* Should give an error on exceeding the space limit of session storage ''i.e check for available memory on each command'' &lt;br /&gt;
&lt;br /&gt;
The complete list of test cases can be found [http://github.com/servo/web-platform-tests/tree/servo/webstorage here].&lt;br /&gt;
&lt;br /&gt;
== Further Readings ==&lt;br /&gt;
&lt;br /&gt;
Learning Rust by Examples: http://rustbyexample.com/ &amp;lt;br/&amp;gt;&lt;br /&gt;
Javascript as Servo's Garbage Collector: http://blog.mozilla.org/research/2014/08/26/javascript-servos-only-garbage-collector/  &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Aprasad3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/final_design_doc_M1450_navr&amp;diff=92149</id>
		<title>CSC/ECE 517 Fall 2014/final design doc M1450 navr</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/final_design_doc_M1450_navr&amp;diff=92149"/>
		<updated>2014-11-18T04:43:38Z</updated>

		<summary type="html">&lt;p&gt;Aprasad3: /* Proposed Test Cases */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Implement Window.sessionStorage ==&lt;br /&gt;
&lt;br /&gt;
This is the design document for the task &amp;lt;code&amp;gt;[http://github.com/servo/servo/wiki/Storage-student-project Implement Window.sessionStorage]&amp;lt;/code&amp;gt; for the [http://www.mozilla.org/ Mozilla] research project [http://github.com/servo/servo/wiki/Design Servo].&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
=== [http://www.rust-lang.org/ Rust]===&lt;br /&gt;
&lt;br /&gt;
Rust is a modern systems programming language focusing on safety and speed to build reliable and efficient systems &amp;lt;ref&amp;gt; http://doc.rust-lang.org/nightly/intro.html &amp;lt;/ref&amp;gt;. It accomplishes the goals of memory safe without using garbage collection and it supports concurrency and parallelism in building platforms. &lt;br /&gt;
&lt;br /&gt;
Rust’s lightweight task mechanism also promises to allow fine-grained isolation between browser components, such as tabs and extensions, without the need for expensive runtime protection schemes, like operating system process isolation. &amp;lt;ref&amp;gt; https://www.mozilla.org/en-US/research/projects/ &amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== [http://github.com/servo/servo/wiki/Design Servo] ===&lt;br /&gt;
&lt;br /&gt;
Mozilla Research team is currently working on an experimental project to develop a new Web browser engine &amp;quot;Servo&amp;quot;, that is capable of supporting a variety of current and next generation of hardware like mobile devices, multi-core processors and high-performance GPUs. Servo builds on top of Rust to provide a secure and reliable foundation. It is currently developed on 64 bit devices.&amp;lt;ref&amp;gt; https://www.mozilla.org/en-US/research/projects/ &amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The main objectives of this experimentation project is improving the layout to graphics rendering - to optimize for power efficiency and maximize parallelism. &amp;lt;ref&amp;gt; https://www.mozilla.org/en-US/research/projects/ &amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Background ==&lt;br /&gt;
&lt;br /&gt;
=== [http://html.spec.whatwg.org/multipage/webstorage.html#webstorage Web Storage] ===&lt;br /&gt;
The web storage specification defines the means by which a web application can store string key/value pairs in a browser and later retrieve them for use.&amp;lt;ref&amp;gt;https://developer.mozilla.org/en-US/docs/Web/Guide/API/DOM/Storage&amp;lt;/ref&amp;gt; It supports persistent data storage, similar to [http://en.wikipedia.org/wiki/HTTP_cookie cookies] but with a greatly enhanced capacity and no information stored in the [http://en.wikipedia.org/wiki/List_of_HTTP_headers HTTP request header].&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Web_storage&amp;lt;/ref&amp;gt; There are two types of web storage: [http://html.spec.whatwg.org/multipage/webstorage.html#dom-localstorage local storage] and [http://html.spec.whatwg.org/multipage/webstorage.html#dom-sessionstorage session storage].&lt;br /&gt;
&lt;br /&gt;
Browsers that support web storage have the global variables 'sessionStorage' and 'localStorage' declared at the [http://developer.mozilla.org/en-US/docs/Web/API/Window?redirectlocale=en-US&amp;amp;redirectslug=DOM%2Fwindow window] level. The following JavaScript code gives an example of how to use web storage:&lt;br /&gt;
&lt;br /&gt;
'''sessionStorage'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Store value on browser for duration of the session&lt;br /&gt;
sessionStorage.setItem('key', 'value');&lt;br /&gt;
 &lt;br /&gt;
// Retrieve value (gets deleted when browser is closed and re-opened)&lt;br /&gt;
alert(sessionStorage.getItem('key'));&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''localStorage'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Store value on the browser beyond the duration of the session&lt;br /&gt;
localStorage.setItem('key', 'value');&lt;br /&gt;
 &lt;br /&gt;
// Retrieve value (persists even after closing and re-opening the browser)&lt;br /&gt;
alert(localStorage.getItem('key'));&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
&lt;br /&gt;
As part of our [http://github.com/servo/servo/wiki/Storage-student-project project], we have to implement the web storage specification in the Servo browser. Implementing this important specification in Servo will allow stateful web applications to run, and will help expose any architectural problems that Servo's radical design may cause. &amp;lt;ref&amp;gt; https://github.com/servo/servo/wiki/Storage-student-project&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Requirement Analysis &amp;lt;ref&amp;gt;https://github.com/servo/servo/wiki/Storage-student-project&amp;lt;/ref&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
In order to introduce the support for session storage and local storage in the Servo Broswer, we have to create the Storage structure and allow web pages to store data in the Servo memory space.&lt;br /&gt;
&lt;br /&gt;
Below is a high level overview of the various steps that have been planned for this project:&lt;br /&gt;
&lt;br /&gt;
* Create the Storage interface and its stub implementation.&lt;br /&gt;
* Create the WindowSessionStorage interface making it return a Storage instance.&lt;br /&gt;
* Create a Storage Task which will be used to contain all stored data.&lt;br /&gt;
* Define a message-passing interface for reading and writing stored data for a particular browser tab.&lt;br /&gt;
* Use the Storage task in the implementation of Storage.&lt;br /&gt;
* When the value of a stored data is changed, notify its respective browser tab.&lt;br /&gt;
* Pass as many [http://github.com/servo/web-platform-tests/tree/servo/webstorage tests] as possible.&lt;br /&gt;
* Implement the WindowLocalStorage interface which behaves slightly different from the WindowSessionStorage interface.&lt;br /&gt;
&lt;br /&gt;
== Architecture &amp;lt;ref&amp;gt;https://github.com/servo/servo/wiki/Design&amp;lt;/ref&amp;gt;==&lt;br /&gt;
&lt;br /&gt;
[[File:task.jpg]]&lt;br /&gt;
&lt;br /&gt;
=== Architecture Explained ===&lt;br /&gt;
*Each box represents a Rust task.&lt;br /&gt;
*Blue boxes represent the primary tasks in the browser pipeline.&lt;br /&gt;
*Gray boxes represent tasks auxiliary to the browser pipeline.&lt;br /&gt;
*White boxes represent worker tasks. Each such box represents several tasks, the precise number of which will vary with the workload.&lt;br /&gt;
*Dashed lines indicate supervisor relationships.&lt;br /&gt;
*Solid lines indicate communication channels.&lt;br /&gt;
&lt;br /&gt;
== Component Design ==&lt;br /&gt;
[[File:servo.jpg]]&lt;br /&gt;
&lt;br /&gt;
There will be a Storage Task which will be responsible to hold all the data that the web page requests to save. This happens via Channels in Rust, which implements a Sender Receiver protocol. The task is runnning in the background and waits to receive the data sent from the web page.&lt;br /&gt;
&lt;br /&gt;
=== Task &amp;lt;ref&amp;gt;http://doc.rust-lang.org/guide-tasks.html&amp;lt;/ref&amp;gt;===&lt;br /&gt;
Rust provides safe concurrent abstractions through a number of core library primitives. This guide will describe the concurrency model in Rust, how it relates to the Rust type system, and introduce the fundamental library abstractions for constructing concurrent programs.&lt;br /&gt;
&lt;br /&gt;
Tasks provide failure isolation and recovery. When a fatal error occurs in Rust code as a result of an explicit call to panic!(), an assertion failure, or another invalid operation, the runtime system destroys the entire task. Unlike in languages such as Java and C++, there is no way to catch an exception. Instead, tasks may monitor each other to see if they panic.&lt;br /&gt;
&lt;br /&gt;
Tasks use Rust's type system to provide strong memory safety guarantees. In particular, the type system guarantees that tasks cannot induce a data race from shared mutable state.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Generate some state locally&lt;br /&gt;
let child_task_number = generate_task_number();&lt;br /&gt;
&lt;br /&gt;
spawn(proc() {&lt;br /&gt;
    // Capture it in the remote task&lt;br /&gt;
    println!(&amp;quot;I am child number {}&amp;quot;, child_task_number);&lt;br /&gt;
});&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Channel &amp;lt;ref&amp;gt;http://doc.rust-lang.org/guide-tasks.html&amp;lt;/ref&amp;gt;===&lt;br /&gt;
Now that we have spawned a new task, it would be nice if we could communicate with it. For this, we use channels. A channel is simply a pair of endpoints: one for sending messages and another for receiving messages.&lt;br /&gt;
&lt;br /&gt;
The simplest way to create a channel is to use the channel function to create a (Sender, Receiver) pair. In Rust parlance, a sender is a sending endpoint of a channel, and a receiver is the receiving endpoint. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
let (tx, rx): (Sender&amp;lt;int&amp;gt;, Receiver&amp;lt;int&amp;gt;) = channel();&lt;br /&gt;
&lt;br /&gt;
spawn(proc() {&lt;br /&gt;
    let result = some_expensive_computation();&lt;br /&gt;
    tx.send(result);&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
some_other_expensive_computation();&lt;br /&gt;
let result = rx.recv();&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Data Design ==&lt;br /&gt;
&lt;br /&gt;
===  Data Description ===&lt;br /&gt;
&lt;br /&gt;
''The following are the data structures that will be used.''&lt;br /&gt;
&lt;br /&gt;
'''Storage''' | TreeMap&amp;lt;String,String&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''UrlMap''' | TreeMap&amp;lt;String,TreeMap&amp;lt;String,String&amp;gt;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Design Pattern ==&lt;br /&gt;
&lt;br /&gt;
We will be using '''&amp;quot;Delegation Pattern&amp;quot;''' in our project. The Storage interface is used by web applications to access the web storage provided by the browser. However, the actual data is stored somewhere else(Servo Memory Space). So, it makes sense to create another class which will maintain the actual stored data. The Storage class can then delegate the task of storing/retrieving data to this class. We will create a class &amp;quot;WebStorageTask&amp;quot; for this purpose.&lt;br /&gt;
&lt;br /&gt;
Also we are using an '''&amp;quot;Observer Pattern&amp;quot;''' where the Storage task will run in the background and observe the commands issued using a channel, it will keep listening to changes on a port and as soon as it receives a message i.e. sees a call towards it , it will perform the required function.&lt;br /&gt;
&lt;br /&gt;
== UML Diagrams ==&lt;br /&gt;
             &lt;br /&gt;
[[File:Flow_Chart_Storage.png|left]] &lt;br /&gt;
[[File:Use_Case_-_Storage.png‎|right]]&lt;br /&gt;
&lt;br /&gt;
'''Steps:'''&lt;br /&gt;
&lt;br /&gt;
1. First, we need to build rust and servo. &amp;lt;br/&amp;gt;&lt;br /&gt;
2. Generate the corresponding WebIDL bindings - Storage.webidl &amp;lt;br/&amp;gt;&lt;br /&gt;
3. Define Storage.rs which has the actual code for creating the storage object. &amp;lt;br/&amp;gt;&lt;br /&gt;
4. Call the receiver via a channel- this is actually used for creating an instance for each unique URL. &amp;lt;br/&amp;gt;&lt;br /&gt;
5. Build the servo again. &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Use Case Functionality'''&lt;br /&gt;
&lt;br /&gt;
1. Here the user can open multiple domains( multiple URL's).&amp;lt;br/&amp;gt;&lt;br /&gt;
2. Thereby the user will be creating multiple storage instances.&amp;lt;br/&amp;gt;&lt;br /&gt;
3. An user can traverse deep into the website but the storage instance is same for that URL.&amp;lt;br/&amp;gt;&lt;br /&gt;
4. The user can reopen the domain for a later period.&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Proposed Test Cases ==&lt;br /&gt;
&lt;br /&gt;
Some of the test cases which will be used to validate our changes are as follows:&lt;br /&gt;
&lt;br /&gt;
* Allow a web page to clear its session storage ''i.e. storage.clear() function should work''&lt;br /&gt;
* Allow a web page to store an item in its session storage ''i.e. test storage.setitem(key,value)''&lt;br /&gt;
* Allow a web page to retrieve stored items from its session storage ''i.e. test storage.getitem(key)''&lt;br /&gt;
* Do not allow a web page to retrieve stored items from the session storage of a web page in another domain ''i.e. try to access elements by forging url&lt;br /&gt;
* Check the number of items stored in session storage i.e storage.count()''&lt;br /&gt;
* On removing an item from storage, it should be inaccessible ''i.e check if storage.remove(key) is functional''&lt;br /&gt;
* Should return null as value for a key not present in the session storage ''i.e. test storage.getitem(key) for non-existent key''&lt;br /&gt;
* Should give an error on exceeding the space limit of session storage ''i.e check for available memory on each command'' &lt;br /&gt;
&lt;br /&gt;
The complete list of test cases can be found [http://github.com/servo/web-platform-tests/tree/servo/webstorage here].&lt;br /&gt;
&lt;br /&gt;
== Further Readings ==&lt;br /&gt;
&lt;br /&gt;
Learning Rust by Examples: http://rustbyexample.com/ &amp;lt;br/&amp;gt;&lt;br /&gt;
Javascript as Servo's Garbage Collector: http://blog.mozilla.org/research/2014/08/26/javascript-servos-only-garbage-collector/  &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Aprasad3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/final_design_doc_M1450_navr&amp;diff=92148</id>
		<title>CSC/ECE 517 Fall 2014/final design doc M1450 navr</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/final_design_doc_M1450_navr&amp;diff=92148"/>
		<updated>2014-11-18T04:41:47Z</updated>

		<summary type="html">&lt;p&gt;Aprasad3: /* Design Pattern */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Implement Window.sessionStorage ==&lt;br /&gt;
&lt;br /&gt;
This is the design document for the task &amp;lt;code&amp;gt;[http://github.com/servo/servo/wiki/Storage-student-project Implement Window.sessionStorage]&amp;lt;/code&amp;gt; for the [http://www.mozilla.org/ Mozilla] research project [http://github.com/servo/servo/wiki/Design Servo].&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
=== [http://www.rust-lang.org/ Rust]===&lt;br /&gt;
&lt;br /&gt;
Rust is a modern systems programming language focusing on safety and speed to build reliable and efficient systems &amp;lt;ref&amp;gt; http://doc.rust-lang.org/nightly/intro.html &amp;lt;/ref&amp;gt;. It accomplishes the goals of memory safe without using garbage collection and it supports concurrency and parallelism in building platforms. &lt;br /&gt;
&lt;br /&gt;
Rust’s lightweight task mechanism also promises to allow fine-grained isolation between browser components, such as tabs and extensions, without the need for expensive runtime protection schemes, like operating system process isolation. &amp;lt;ref&amp;gt; https://www.mozilla.org/en-US/research/projects/ &amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== [http://github.com/servo/servo/wiki/Design Servo] ===&lt;br /&gt;
&lt;br /&gt;
Mozilla Research team is currently working on an experimental project to develop a new Web browser engine &amp;quot;Servo&amp;quot;, that is capable of supporting a variety of current and next generation of hardware like mobile devices, multi-core processors and high-performance GPUs. Servo builds on top of Rust to provide a secure and reliable foundation. It is currently developed on 64 bit devices.&amp;lt;ref&amp;gt; https://www.mozilla.org/en-US/research/projects/ &amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The main objectives of this experimentation project is improving the layout to graphics rendering - to optimize for power efficiency and maximize parallelism. &amp;lt;ref&amp;gt; https://www.mozilla.org/en-US/research/projects/ &amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Background ==&lt;br /&gt;
&lt;br /&gt;
=== [http://html.spec.whatwg.org/multipage/webstorage.html#webstorage Web Storage] ===&lt;br /&gt;
The web storage specification defines the means by which a web application can store string key/value pairs in a browser and later retrieve them for use.&amp;lt;ref&amp;gt;https://developer.mozilla.org/en-US/docs/Web/Guide/API/DOM/Storage&amp;lt;/ref&amp;gt; It supports persistent data storage, similar to [http://en.wikipedia.org/wiki/HTTP_cookie cookies] but with a greatly enhanced capacity and no information stored in the [http://en.wikipedia.org/wiki/List_of_HTTP_headers HTTP request header].&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Web_storage&amp;lt;/ref&amp;gt; There are two types of web storage: [http://html.spec.whatwg.org/multipage/webstorage.html#dom-localstorage local storage] and [http://html.spec.whatwg.org/multipage/webstorage.html#dom-sessionstorage session storage].&lt;br /&gt;
&lt;br /&gt;
Browsers that support web storage have the global variables 'sessionStorage' and 'localStorage' declared at the [http://developer.mozilla.org/en-US/docs/Web/API/Window?redirectlocale=en-US&amp;amp;redirectslug=DOM%2Fwindow window] level. The following JavaScript code gives an example of how to use web storage:&lt;br /&gt;
&lt;br /&gt;
'''sessionStorage'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Store value on browser for duration of the session&lt;br /&gt;
sessionStorage.setItem('key', 'value');&lt;br /&gt;
 &lt;br /&gt;
// Retrieve value (gets deleted when browser is closed and re-opened)&lt;br /&gt;
alert(sessionStorage.getItem('key'));&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''localStorage'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Store value on the browser beyond the duration of the session&lt;br /&gt;
localStorage.setItem('key', 'value');&lt;br /&gt;
 &lt;br /&gt;
// Retrieve value (persists even after closing and re-opening the browser)&lt;br /&gt;
alert(localStorage.getItem('key'));&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
&lt;br /&gt;
As part of our [http://github.com/servo/servo/wiki/Storage-student-project project], we have to implement the web storage specification in the Servo browser. Implementing this important specification in Servo will allow stateful web applications to run, and will help expose any architectural problems that Servo's radical design may cause. &amp;lt;ref&amp;gt; https://github.com/servo/servo/wiki/Storage-student-project&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Requirement Analysis &amp;lt;ref&amp;gt;https://github.com/servo/servo/wiki/Storage-student-project&amp;lt;/ref&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
In order to introduce the support for session storage and local storage in the Servo Broswer, we have to create the Storage structure and allow web pages to store data in the Servo memory space.&lt;br /&gt;
&lt;br /&gt;
Below is a high level overview of the various steps that have been planned for this project:&lt;br /&gt;
&lt;br /&gt;
* Create the Storage interface and its stub implementation.&lt;br /&gt;
* Create the WindowSessionStorage interface making it return a Storage instance.&lt;br /&gt;
* Create a Storage Task which will be used to contain all stored data.&lt;br /&gt;
* Define a message-passing interface for reading and writing stored data for a particular browser tab.&lt;br /&gt;
* Use the Storage task in the implementation of Storage.&lt;br /&gt;
* When the value of a stored data is changed, notify its respective browser tab.&lt;br /&gt;
* Pass as many [http://github.com/servo/web-platform-tests/tree/servo/webstorage tests] as possible.&lt;br /&gt;
* Implement the WindowLocalStorage interface which behaves slightly different from the WindowSessionStorage interface.&lt;br /&gt;
&lt;br /&gt;
== Architecture &amp;lt;ref&amp;gt;https://github.com/servo/servo/wiki/Design&amp;lt;/ref&amp;gt;==&lt;br /&gt;
&lt;br /&gt;
[[File:task.jpg]]&lt;br /&gt;
&lt;br /&gt;
=== Architecture Explained ===&lt;br /&gt;
*Each box represents a Rust task.&lt;br /&gt;
*Blue boxes represent the primary tasks in the browser pipeline.&lt;br /&gt;
*Gray boxes represent tasks auxiliary to the browser pipeline.&lt;br /&gt;
*White boxes represent worker tasks. Each such box represents several tasks, the precise number of which will vary with the workload.&lt;br /&gt;
*Dashed lines indicate supervisor relationships.&lt;br /&gt;
*Solid lines indicate communication channels.&lt;br /&gt;
&lt;br /&gt;
== Component Design ==&lt;br /&gt;
[[File:servo.jpg]]&lt;br /&gt;
&lt;br /&gt;
There will be a Storage Task which will be responsible to hold all the data that the web page requests to save. This happens via Channels in Rust, which implements a Sender Receiver protocol. The task is runnning in the background and waits to receive the data sent from the web page.&lt;br /&gt;
&lt;br /&gt;
=== Task &amp;lt;ref&amp;gt;http://doc.rust-lang.org/guide-tasks.html&amp;lt;/ref&amp;gt;===&lt;br /&gt;
Rust provides safe concurrent abstractions through a number of core library primitives. This guide will describe the concurrency model in Rust, how it relates to the Rust type system, and introduce the fundamental library abstractions for constructing concurrent programs.&lt;br /&gt;
&lt;br /&gt;
Tasks provide failure isolation and recovery. When a fatal error occurs in Rust code as a result of an explicit call to panic!(), an assertion failure, or another invalid operation, the runtime system destroys the entire task. Unlike in languages such as Java and C++, there is no way to catch an exception. Instead, tasks may monitor each other to see if they panic.&lt;br /&gt;
&lt;br /&gt;
Tasks use Rust's type system to provide strong memory safety guarantees. In particular, the type system guarantees that tasks cannot induce a data race from shared mutable state.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Generate some state locally&lt;br /&gt;
let child_task_number = generate_task_number();&lt;br /&gt;
&lt;br /&gt;
spawn(proc() {&lt;br /&gt;
    // Capture it in the remote task&lt;br /&gt;
    println!(&amp;quot;I am child number {}&amp;quot;, child_task_number);&lt;br /&gt;
});&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Channel &amp;lt;ref&amp;gt;http://doc.rust-lang.org/guide-tasks.html&amp;lt;/ref&amp;gt;===&lt;br /&gt;
Now that we have spawned a new task, it would be nice if we could communicate with it. For this, we use channels. A channel is simply a pair of endpoints: one for sending messages and another for receiving messages.&lt;br /&gt;
&lt;br /&gt;
The simplest way to create a channel is to use the channel function to create a (Sender, Receiver) pair. In Rust parlance, a sender is a sending endpoint of a channel, and a receiver is the receiving endpoint. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
let (tx, rx): (Sender&amp;lt;int&amp;gt;, Receiver&amp;lt;int&amp;gt;) = channel();&lt;br /&gt;
&lt;br /&gt;
spawn(proc() {&lt;br /&gt;
    let result = some_expensive_computation();&lt;br /&gt;
    tx.send(result);&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
some_other_expensive_computation();&lt;br /&gt;
let result = rx.recv();&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Data Design ==&lt;br /&gt;
&lt;br /&gt;
===  Data Description ===&lt;br /&gt;
&lt;br /&gt;
''The following are the data structures that will be used.''&lt;br /&gt;
&lt;br /&gt;
'''Storage''' | TreeMap&amp;lt;String,String&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''UrlMap''' | TreeMap&amp;lt;String,TreeMap&amp;lt;String,String&amp;gt;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Design Pattern ==&lt;br /&gt;
&lt;br /&gt;
We will be using '''&amp;quot;Delegation Pattern&amp;quot;''' in our project. The Storage interface is used by web applications to access the web storage provided by the browser. However, the actual data is stored somewhere else(Servo Memory Space). So, it makes sense to create another class which will maintain the actual stored data. The Storage class can then delegate the task of storing/retrieving data to this class. We will create a class &amp;quot;WebStorageTask&amp;quot; for this purpose.&lt;br /&gt;
&lt;br /&gt;
Also we are using an '''&amp;quot;Observer Pattern&amp;quot;''' where the Storage task will run in the background and observe the commands issued using a channel, it will keep listening to changes on a port and as soon as it receives a message i.e. sees a call towards it , it will perform the required function.&lt;br /&gt;
&lt;br /&gt;
== UML Diagrams ==&lt;br /&gt;
             &lt;br /&gt;
[[File:Flow_Chart_Storage.png|left]] &lt;br /&gt;
[[File:Use_Case_-_Storage.png‎|right]]&lt;br /&gt;
&lt;br /&gt;
'''Steps:'''&lt;br /&gt;
&lt;br /&gt;
1. First, we need to build rust and servo. &amp;lt;br/&amp;gt;&lt;br /&gt;
2. Generate the corresponding WebIDL bindings - Storage.webidl &amp;lt;br/&amp;gt;&lt;br /&gt;
3. Define Storage.rs which has the actual code for creating the storage object. &amp;lt;br/&amp;gt;&lt;br /&gt;
4. Call the receiver via a channel- this is actually used for creating an instance for each unique URL. &amp;lt;br/&amp;gt;&lt;br /&gt;
5. Build the servo again. &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Use Case Functionality'''&lt;br /&gt;
&lt;br /&gt;
1. Here the user can open multiple domains( multiple URL's).&amp;lt;br/&amp;gt;&lt;br /&gt;
2. Thereby the user will be creating multiple storage instances.&amp;lt;br/&amp;gt;&lt;br /&gt;
3. An user can traverse deep into the website but the storage instance is same for that URL.&amp;lt;br/&amp;gt;&lt;br /&gt;
4. The user can reopen the domain for a later period.&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Proposed Test Cases ==&lt;br /&gt;
&lt;br /&gt;
Some of the test cases which will be used to validate our changes are as follows:&lt;br /&gt;
&lt;br /&gt;
* Allow a web page to clear its session storage i.e. storage.clear() function should work&lt;br /&gt;
* Allow a web page to store an item in its session storage i.e. test storage.setitem(key,value)&lt;br /&gt;
* Allow a web page to retrieve stored items from its session storage i.e. test storage.getitem(key)&lt;br /&gt;
* Do not allow a web page to retrieve stored items from the session storage of a web page in another domain i.e. try to access elements by forging url&lt;br /&gt;
* Check the number of items stored in session storage i.e storage.count()&lt;br /&gt;
* On removing an item from storage, it should be inaccessible i.e check if storage.remove(key) is functional&lt;br /&gt;
* Should return null as value for a key not present in the session storage i.e. test storage.getitem(key) for non-existent key&lt;br /&gt;
* Should give an error on exceeding the space limit of session storage i.e check for available memory on each command &lt;br /&gt;
&lt;br /&gt;
The complete list of test cases can be found [http://github.com/servo/web-platform-tests/tree/servo/webstorage here].&lt;br /&gt;
&lt;br /&gt;
== Further Readings ==&lt;br /&gt;
&lt;br /&gt;
Learning Rust by Examples: http://rustbyexample.com/ &amp;lt;br/&amp;gt;&lt;br /&gt;
Javascript as Servo's Garbage Collector: http://blog.mozilla.org/research/2014/08/26/javascript-servos-only-garbage-collector/  &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Aprasad3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/final_design_doc_M1450_navr&amp;diff=92147</id>
		<title>CSC/ECE 517 Fall 2014/final design doc M1450 navr</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/final_design_doc_M1450_navr&amp;diff=92147"/>
		<updated>2014-11-18T04:41:33Z</updated>

		<summary type="html">&lt;p&gt;Aprasad3: /* Design Pattern */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Implement Window.sessionStorage ==&lt;br /&gt;
&lt;br /&gt;
This is the design document for the task &amp;lt;code&amp;gt;[http://github.com/servo/servo/wiki/Storage-student-project Implement Window.sessionStorage]&amp;lt;/code&amp;gt; for the [http://www.mozilla.org/ Mozilla] research project [http://github.com/servo/servo/wiki/Design Servo].&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
=== [http://www.rust-lang.org/ Rust]===&lt;br /&gt;
&lt;br /&gt;
Rust is a modern systems programming language focusing on safety and speed to build reliable and efficient systems &amp;lt;ref&amp;gt; http://doc.rust-lang.org/nightly/intro.html &amp;lt;/ref&amp;gt;. It accomplishes the goals of memory safe without using garbage collection and it supports concurrency and parallelism in building platforms. &lt;br /&gt;
&lt;br /&gt;
Rust’s lightweight task mechanism also promises to allow fine-grained isolation between browser components, such as tabs and extensions, without the need for expensive runtime protection schemes, like operating system process isolation. &amp;lt;ref&amp;gt; https://www.mozilla.org/en-US/research/projects/ &amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== [http://github.com/servo/servo/wiki/Design Servo] ===&lt;br /&gt;
&lt;br /&gt;
Mozilla Research team is currently working on an experimental project to develop a new Web browser engine &amp;quot;Servo&amp;quot;, that is capable of supporting a variety of current and next generation of hardware like mobile devices, multi-core processors and high-performance GPUs. Servo builds on top of Rust to provide a secure and reliable foundation. It is currently developed on 64 bit devices.&amp;lt;ref&amp;gt; https://www.mozilla.org/en-US/research/projects/ &amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The main objectives of this experimentation project is improving the layout to graphics rendering - to optimize for power efficiency and maximize parallelism. &amp;lt;ref&amp;gt; https://www.mozilla.org/en-US/research/projects/ &amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Background ==&lt;br /&gt;
&lt;br /&gt;
=== [http://html.spec.whatwg.org/multipage/webstorage.html#webstorage Web Storage] ===&lt;br /&gt;
The web storage specification defines the means by which a web application can store string key/value pairs in a browser and later retrieve them for use.&amp;lt;ref&amp;gt;https://developer.mozilla.org/en-US/docs/Web/Guide/API/DOM/Storage&amp;lt;/ref&amp;gt; It supports persistent data storage, similar to [http://en.wikipedia.org/wiki/HTTP_cookie cookies] but with a greatly enhanced capacity and no information stored in the [http://en.wikipedia.org/wiki/List_of_HTTP_headers HTTP request header].&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Web_storage&amp;lt;/ref&amp;gt; There are two types of web storage: [http://html.spec.whatwg.org/multipage/webstorage.html#dom-localstorage local storage] and [http://html.spec.whatwg.org/multipage/webstorage.html#dom-sessionstorage session storage].&lt;br /&gt;
&lt;br /&gt;
Browsers that support web storage have the global variables 'sessionStorage' and 'localStorage' declared at the [http://developer.mozilla.org/en-US/docs/Web/API/Window?redirectlocale=en-US&amp;amp;redirectslug=DOM%2Fwindow window] level. The following JavaScript code gives an example of how to use web storage:&lt;br /&gt;
&lt;br /&gt;
'''sessionStorage'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Store value on browser for duration of the session&lt;br /&gt;
sessionStorage.setItem('key', 'value');&lt;br /&gt;
 &lt;br /&gt;
// Retrieve value (gets deleted when browser is closed and re-opened)&lt;br /&gt;
alert(sessionStorage.getItem('key'));&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''localStorage'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Store value on the browser beyond the duration of the session&lt;br /&gt;
localStorage.setItem('key', 'value');&lt;br /&gt;
 &lt;br /&gt;
// Retrieve value (persists even after closing and re-opening the browser)&lt;br /&gt;
alert(localStorage.getItem('key'));&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
&lt;br /&gt;
As part of our [http://github.com/servo/servo/wiki/Storage-student-project project], we have to implement the web storage specification in the Servo browser. Implementing this important specification in Servo will allow stateful web applications to run, and will help expose any architectural problems that Servo's radical design may cause. &amp;lt;ref&amp;gt; https://github.com/servo/servo/wiki/Storage-student-project&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Requirement Analysis &amp;lt;ref&amp;gt;https://github.com/servo/servo/wiki/Storage-student-project&amp;lt;/ref&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
In order to introduce the support for session storage and local storage in the Servo Broswer, we have to create the Storage structure and allow web pages to store data in the Servo memory space.&lt;br /&gt;
&lt;br /&gt;
Below is a high level overview of the various steps that have been planned for this project:&lt;br /&gt;
&lt;br /&gt;
* Create the Storage interface and its stub implementation.&lt;br /&gt;
* Create the WindowSessionStorage interface making it return a Storage instance.&lt;br /&gt;
* Create a Storage Task which will be used to contain all stored data.&lt;br /&gt;
* Define a message-passing interface for reading and writing stored data for a particular browser tab.&lt;br /&gt;
* Use the Storage task in the implementation of Storage.&lt;br /&gt;
* When the value of a stored data is changed, notify its respective browser tab.&lt;br /&gt;
* Pass as many [http://github.com/servo/web-platform-tests/tree/servo/webstorage tests] as possible.&lt;br /&gt;
* Implement the WindowLocalStorage interface which behaves slightly different from the WindowSessionStorage interface.&lt;br /&gt;
&lt;br /&gt;
== Architecture &amp;lt;ref&amp;gt;https://github.com/servo/servo/wiki/Design&amp;lt;/ref&amp;gt;==&lt;br /&gt;
&lt;br /&gt;
[[File:task.jpg]]&lt;br /&gt;
&lt;br /&gt;
=== Architecture Explained ===&lt;br /&gt;
*Each box represents a Rust task.&lt;br /&gt;
*Blue boxes represent the primary tasks in the browser pipeline.&lt;br /&gt;
*Gray boxes represent tasks auxiliary to the browser pipeline.&lt;br /&gt;
*White boxes represent worker tasks. Each such box represents several tasks, the precise number of which will vary with the workload.&lt;br /&gt;
*Dashed lines indicate supervisor relationships.&lt;br /&gt;
*Solid lines indicate communication channels.&lt;br /&gt;
&lt;br /&gt;
== Component Design ==&lt;br /&gt;
[[File:servo.jpg]]&lt;br /&gt;
&lt;br /&gt;
There will be a Storage Task which will be responsible to hold all the data that the web page requests to save. This happens via Channels in Rust, which implements a Sender Receiver protocol. The task is runnning in the background and waits to receive the data sent from the web page.&lt;br /&gt;
&lt;br /&gt;
=== Task &amp;lt;ref&amp;gt;http://doc.rust-lang.org/guide-tasks.html&amp;lt;/ref&amp;gt;===&lt;br /&gt;
Rust provides safe concurrent abstractions through a number of core library primitives. This guide will describe the concurrency model in Rust, how it relates to the Rust type system, and introduce the fundamental library abstractions for constructing concurrent programs.&lt;br /&gt;
&lt;br /&gt;
Tasks provide failure isolation and recovery. When a fatal error occurs in Rust code as a result of an explicit call to panic!(), an assertion failure, or another invalid operation, the runtime system destroys the entire task. Unlike in languages such as Java and C++, there is no way to catch an exception. Instead, tasks may monitor each other to see if they panic.&lt;br /&gt;
&lt;br /&gt;
Tasks use Rust's type system to provide strong memory safety guarantees. In particular, the type system guarantees that tasks cannot induce a data race from shared mutable state.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Generate some state locally&lt;br /&gt;
let child_task_number = generate_task_number();&lt;br /&gt;
&lt;br /&gt;
spawn(proc() {&lt;br /&gt;
    // Capture it in the remote task&lt;br /&gt;
    println!(&amp;quot;I am child number {}&amp;quot;, child_task_number);&lt;br /&gt;
});&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Channel &amp;lt;ref&amp;gt;http://doc.rust-lang.org/guide-tasks.html&amp;lt;/ref&amp;gt;===&lt;br /&gt;
Now that we have spawned a new task, it would be nice if we could communicate with it. For this, we use channels. A channel is simply a pair of endpoints: one for sending messages and another for receiving messages.&lt;br /&gt;
&lt;br /&gt;
The simplest way to create a channel is to use the channel function to create a (Sender, Receiver) pair. In Rust parlance, a sender is a sending endpoint of a channel, and a receiver is the receiving endpoint. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
let (tx, rx): (Sender&amp;lt;int&amp;gt;, Receiver&amp;lt;int&amp;gt;) = channel();&lt;br /&gt;
&lt;br /&gt;
spawn(proc() {&lt;br /&gt;
    let result = some_expensive_computation();&lt;br /&gt;
    tx.send(result);&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
some_other_expensive_computation();&lt;br /&gt;
let result = rx.recv();&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Data Design ==&lt;br /&gt;
&lt;br /&gt;
===  Data Description ===&lt;br /&gt;
&lt;br /&gt;
''The following are the data structures that will be used.''&lt;br /&gt;
&lt;br /&gt;
'''Storage''' | TreeMap&amp;lt;String,String&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''UrlMap''' | TreeMap&amp;lt;String,TreeMap&amp;lt;String,String&amp;gt;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Design Pattern ==&lt;br /&gt;
&lt;br /&gt;
We will be using '''&amp;quot;Delegation Pattern&amp;quot;''' in our project. The Storage interface is used by web applications to access the web storage provided by the browser. However, the actual data is stored somewhere else(Servo Memory Space). So, it makes sense to create another class which will maintain the actual stored data. The Storage class can then delegate the task of storing/retrieving data to this class. We will create a class &amp;quot;WebStorageTask&amp;quot; for this purpose.&lt;br /&gt;
&lt;br /&gt;
Also we are using an '''&amp;quot;Observer Pattern&amp;quot;''' where the Storage task will run in the background and Observe the commands issued using a channel, it will keep listening to changes on a port and as soon as it receives a message i.e. sees a call towards it , it will perform the required function.&lt;br /&gt;
&lt;br /&gt;
== UML Diagrams ==&lt;br /&gt;
             &lt;br /&gt;
[[File:Flow_Chart_Storage.png|left]] &lt;br /&gt;
[[File:Use_Case_-_Storage.png‎|right]]&lt;br /&gt;
&lt;br /&gt;
'''Steps:'''&lt;br /&gt;
&lt;br /&gt;
1. First, we need to build rust and servo. &amp;lt;br/&amp;gt;&lt;br /&gt;
2. Generate the corresponding WebIDL bindings - Storage.webidl &amp;lt;br/&amp;gt;&lt;br /&gt;
3. Define Storage.rs which has the actual code for creating the storage object. &amp;lt;br/&amp;gt;&lt;br /&gt;
4. Call the receiver via a channel- this is actually used for creating an instance for each unique URL. &amp;lt;br/&amp;gt;&lt;br /&gt;
5. Build the servo again. &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Use Case Functionality'''&lt;br /&gt;
&lt;br /&gt;
1. Here the user can open multiple domains( multiple URL's).&amp;lt;br/&amp;gt;&lt;br /&gt;
2. Thereby the user will be creating multiple storage instances.&amp;lt;br/&amp;gt;&lt;br /&gt;
3. An user can traverse deep into the website but the storage instance is same for that URL.&amp;lt;br/&amp;gt;&lt;br /&gt;
4. The user can reopen the domain for a later period.&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Proposed Test Cases ==&lt;br /&gt;
&lt;br /&gt;
Some of the test cases which will be used to validate our changes are as follows:&lt;br /&gt;
&lt;br /&gt;
* Allow a web page to clear its session storage i.e. storage.clear() function should work&lt;br /&gt;
* Allow a web page to store an item in its session storage i.e. test storage.setitem(key,value)&lt;br /&gt;
* Allow a web page to retrieve stored items from its session storage i.e. test storage.getitem(key)&lt;br /&gt;
* Do not allow a web page to retrieve stored items from the session storage of a web page in another domain i.e. try to access elements by forging url&lt;br /&gt;
* Check the number of items stored in session storage i.e storage.count()&lt;br /&gt;
* On removing an item from storage, it should be inaccessible i.e check if storage.remove(key) is functional&lt;br /&gt;
* Should return null as value for a key not present in the session storage i.e. test storage.getitem(key) for non-existent key&lt;br /&gt;
* Should give an error on exceeding the space limit of session storage i.e check for available memory on each command &lt;br /&gt;
&lt;br /&gt;
The complete list of test cases can be found [http://github.com/servo/web-platform-tests/tree/servo/webstorage here].&lt;br /&gt;
&lt;br /&gt;
== Further Readings ==&lt;br /&gt;
&lt;br /&gt;
Learning Rust by Examples: http://rustbyexample.com/ &amp;lt;br/&amp;gt;&lt;br /&gt;
Javascript as Servo's Garbage Collector: http://blog.mozilla.org/research/2014/08/26/javascript-servos-only-garbage-collector/  &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Aprasad3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/final_design_doc_M1450_navr&amp;diff=92146</id>
		<title>CSC/ECE 517 Fall 2014/final design doc M1450 navr</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/final_design_doc_M1450_navr&amp;diff=92146"/>
		<updated>2014-11-18T04:41:18Z</updated>

		<summary type="html">&lt;p&gt;Aprasad3: /* Design Pattern */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Implement Window.sessionStorage ==&lt;br /&gt;
&lt;br /&gt;
This is the design document for the task &amp;lt;code&amp;gt;[http://github.com/servo/servo/wiki/Storage-student-project Implement Window.sessionStorage]&amp;lt;/code&amp;gt; for the [http://www.mozilla.org/ Mozilla] research project [http://github.com/servo/servo/wiki/Design Servo].&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
=== [http://www.rust-lang.org/ Rust]===&lt;br /&gt;
&lt;br /&gt;
Rust is a modern systems programming language focusing on safety and speed to build reliable and efficient systems &amp;lt;ref&amp;gt; http://doc.rust-lang.org/nightly/intro.html &amp;lt;/ref&amp;gt;. It accomplishes the goals of memory safe without using garbage collection and it supports concurrency and parallelism in building platforms. &lt;br /&gt;
&lt;br /&gt;
Rust’s lightweight task mechanism also promises to allow fine-grained isolation between browser components, such as tabs and extensions, without the need for expensive runtime protection schemes, like operating system process isolation. &amp;lt;ref&amp;gt; https://www.mozilla.org/en-US/research/projects/ &amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== [http://github.com/servo/servo/wiki/Design Servo] ===&lt;br /&gt;
&lt;br /&gt;
Mozilla Research team is currently working on an experimental project to develop a new Web browser engine &amp;quot;Servo&amp;quot;, that is capable of supporting a variety of current and next generation of hardware like mobile devices, multi-core processors and high-performance GPUs. Servo builds on top of Rust to provide a secure and reliable foundation. It is currently developed on 64 bit devices.&amp;lt;ref&amp;gt; https://www.mozilla.org/en-US/research/projects/ &amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The main objectives of this experimentation project is improving the layout to graphics rendering - to optimize for power efficiency and maximize parallelism. &amp;lt;ref&amp;gt; https://www.mozilla.org/en-US/research/projects/ &amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Background ==&lt;br /&gt;
&lt;br /&gt;
=== [http://html.spec.whatwg.org/multipage/webstorage.html#webstorage Web Storage] ===&lt;br /&gt;
The web storage specification defines the means by which a web application can store string key/value pairs in a browser and later retrieve them for use.&amp;lt;ref&amp;gt;https://developer.mozilla.org/en-US/docs/Web/Guide/API/DOM/Storage&amp;lt;/ref&amp;gt; It supports persistent data storage, similar to [http://en.wikipedia.org/wiki/HTTP_cookie cookies] but with a greatly enhanced capacity and no information stored in the [http://en.wikipedia.org/wiki/List_of_HTTP_headers HTTP request header].&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Web_storage&amp;lt;/ref&amp;gt; There are two types of web storage: [http://html.spec.whatwg.org/multipage/webstorage.html#dom-localstorage local storage] and [http://html.spec.whatwg.org/multipage/webstorage.html#dom-sessionstorage session storage].&lt;br /&gt;
&lt;br /&gt;
Browsers that support web storage have the global variables 'sessionStorage' and 'localStorage' declared at the [http://developer.mozilla.org/en-US/docs/Web/API/Window?redirectlocale=en-US&amp;amp;redirectslug=DOM%2Fwindow window] level. The following JavaScript code gives an example of how to use web storage:&lt;br /&gt;
&lt;br /&gt;
'''sessionStorage'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Store value on browser for duration of the session&lt;br /&gt;
sessionStorage.setItem('key', 'value');&lt;br /&gt;
 &lt;br /&gt;
// Retrieve value (gets deleted when browser is closed and re-opened)&lt;br /&gt;
alert(sessionStorage.getItem('key'));&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''localStorage'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Store value on the browser beyond the duration of the session&lt;br /&gt;
localStorage.setItem('key', 'value');&lt;br /&gt;
 &lt;br /&gt;
// Retrieve value (persists even after closing and re-opening the browser)&lt;br /&gt;
alert(localStorage.getItem('key'));&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
&lt;br /&gt;
As part of our [http://github.com/servo/servo/wiki/Storage-student-project project], we have to implement the web storage specification in the Servo browser. Implementing this important specification in Servo will allow stateful web applications to run, and will help expose any architectural problems that Servo's radical design may cause. &amp;lt;ref&amp;gt; https://github.com/servo/servo/wiki/Storage-student-project&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Requirement Analysis &amp;lt;ref&amp;gt;https://github.com/servo/servo/wiki/Storage-student-project&amp;lt;/ref&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
In order to introduce the support for session storage and local storage in the Servo Broswer, we have to create the Storage structure and allow web pages to store data in the Servo memory space.&lt;br /&gt;
&lt;br /&gt;
Below is a high level overview of the various steps that have been planned for this project:&lt;br /&gt;
&lt;br /&gt;
* Create the Storage interface and its stub implementation.&lt;br /&gt;
* Create the WindowSessionStorage interface making it return a Storage instance.&lt;br /&gt;
* Create a Storage Task which will be used to contain all stored data.&lt;br /&gt;
* Define a message-passing interface for reading and writing stored data for a particular browser tab.&lt;br /&gt;
* Use the Storage task in the implementation of Storage.&lt;br /&gt;
* When the value of a stored data is changed, notify its respective browser tab.&lt;br /&gt;
* Pass as many [http://github.com/servo/web-platform-tests/tree/servo/webstorage tests] as possible.&lt;br /&gt;
* Implement the WindowLocalStorage interface which behaves slightly different from the WindowSessionStorage interface.&lt;br /&gt;
&lt;br /&gt;
== Architecture &amp;lt;ref&amp;gt;https://github.com/servo/servo/wiki/Design&amp;lt;/ref&amp;gt;==&lt;br /&gt;
&lt;br /&gt;
[[File:task.jpg]]&lt;br /&gt;
&lt;br /&gt;
=== Architecture Explained ===&lt;br /&gt;
*Each box represents a Rust task.&lt;br /&gt;
*Blue boxes represent the primary tasks in the browser pipeline.&lt;br /&gt;
*Gray boxes represent tasks auxiliary to the browser pipeline.&lt;br /&gt;
*White boxes represent worker tasks. Each such box represents several tasks, the precise number of which will vary with the workload.&lt;br /&gt;
*Dashed lines indicate supervisor relationships.&lt;br /&gt;
*Solid lines indicate communication channels.&lt;br /&gt;
&lt;br /&gt;
== Component Design ==&lt;br /&gt;
[[File:servo.jpg]]&lt;br /&gt;
&lt;br /&gt;
There will be a Storage Task which will be responsible to hold all the data that the web page requests to save. This happens via Channels in Rust, which implements a Sender Receiver protocol. The task is runnning in the background and waits to receive the data sent from the web page.&lt;br /&gt;
&lt;br /&gt;
=== Task &amp;lt;ref&amp;gt;http://doc.rust-lang.org/guide-tasks.html&amp;lt;/ref&amp;gt;===&lt;br /&gt;
Rust provides safe concurrent abstractions through a number of core library primitives. This guide will describe the concurrency model in Rust, how it relates to the Rust type system, and introduce the fundamental library abstractions for constructing concurrent programs.&lt;br /&gt;
&lt;br /&gt;
Tasks provide failure isolation and recovery. When a fatal error occurs in Rust code as a result of an explicit call to panic!(), an assertion failure, or another invalid operation, the runtime system destroys the entire task. Unlike in languages such as Java and C++, there is no way to catch an exception. Instead, tasks may monitor each other to see if they panic.&lt;br /&gt;
&lt;br /&gt;
Tasks use Rust's type system to provide strong memory safety guarantees. In particular, the type system guarantees that tasks cannot induce a data race from shared mutable state.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Generate some state locally&lt;br /&gt;
let child_task_number = generate_task_number();&lt;br /&gt;
&lt;br /&gt;
spawn(proc() {&lt;br /&gt;
    // Capture it in the remote task&lt;br /&gt;
    println!(&amp;quot;I am child number {}&amp;quot;, child_task_number);&lt;br /&gt;
});&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Channel &amp;lt;ref&amp;gt;http://doc.rust-lang.org/guide-tasks.html&amp;lt;/ref&amp;gt;===&lt;br /&gt;
Now that we have spawned a new task, it would be nice if we could communicate with it. For this, we use channels. A channel is simply a pair of endpoints: one for sending messages and another for receiving messages.&lt;br /&gt;
&lt;br /&gt;
The simplest way to create a channel is to use the channel function to create a (Sender, Receiver) pair. In Rust parlance, a sender is a sending endpoint of a channel, and a receiver is the receiving endpoint. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
let (tx, rx): (Sender&amp;lt;int&amp;gt;, Receiver&amp;lt;int&amp;gt;) = channel();&lt;br /&gt;
&lt;br /&gt;
spawn(proc() {&lt;br /&gt;
    let result = some_expensive_computation();&lt;br /&gt;
    tx.send(result);&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
some_other_expensive_computation();&lt;br /&gt;
let result = rx.recv();&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Data Design ==&lt;br /&gt;
&lt;br /&gt;
===  Data Description ===&lt;br /&gt;
&lt;br /&gt;
''The following are the data structures that will be used.''&lt;br /&gt;
&lt;br /&gt;
'''Storage''' | TreeMap&amp;lt;String,String&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''UrlMap''' | TreeMap&amp;lt;String,TreeMap&amp;lt;String,String&amp;gt;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Design Pattern ==&lt;br /&gt;
&lt;br /&gt;
We will be using '''&amp;quot;Delegation Pattern&amp;quot;''' in our project. The Storage interface is used by web applications to access the web storage provided by the browser. However, the actual data is stored somewhere else(Servo Memory Space). So, it makes sense to create another class which will maintain the actual stored data. The Storage class can then delegate the task of storing/retrieving data to this class. We will create a class &amp;quot;WebStorageTask&amp;quot; for this purpose.&lt;br /&gt;
&lt;br /&gt;
Also we are using an &amp;quot;Observer Pattern&amp;quot; where the Storage task will run in the background and Observe the commands issued using a channel, it will keep listening to changes on a port and as soon as it receives a message i.e. sees a call towards it , it will perform the required function.&lt;br /&gt;
&lt;br /&gt;
== UML Diagrams ==&lt;br /&gt;
             &lt;br /&gt;
[[File:Flow_Chart_Storage.png|left]] &lt;br /&gt;
[[File:Use_Case_-_Storage.png‎|right]]&lt;br /&gt;
&lt;br /&gt;
'''Steps:'''&lt;br /&gt;
&lt;br /&gt;
1. First, we need to build rust and servo. &amp;lt;br/&amp;gt;&lt;br /&gt;
2. Generate the corresponding WebIDL bindings - Storage.webidl &amp;lt;br/&amp;gt;&lt;br /&gt;
3. Define Storage.rs which has the actual code for creating the storage object. &amp;lt;br/&amp;gt;&lt;br /&gt;
4. Call the receiver via a channel- this is actually used for creating an instance for each unique URL. &amp;lt;br/&amp;gt;&lt;br /&gt;
5. Build the servo again. &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Use Case Functionality'''&lt;br /&gt;
&lt;br /&gt;
1. Here the user can open multiple domains( multiple URL's).&amp;lt;br/&amp;gt;&lt;br /&gt;
2. Thereby the user will be creating multiple storage instances.&amp;lt;br/&amp;gt;&lt;br /&gt;
3. An user can traverse deep into the website but the storage instance is same for that URL.&amp;lt;br/&amp;gt;&lt;br /&gt;
4. The user can reopen the domain for a later period.&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Proposed Test Cases ==&lt;br /&gt;
&lt;br /&gt;
Some of the test cases which will be used to validate our changes are as follows:&lt;br /&gt;
&lt;br /&gt;
* Allow a web page to clear its session storage i.e. storage.clear() function should work&lt;br /&gt;
* Allow a web page to store an item in its session storage i.e. test storage.setitem(key,value)&lt;br /&gt;
* Allow a web page to retrieve stored items from its session storage i.e. test storage.getitem(key)&lt;br /&gt;
* Do not allow a web page to retrieve stored items from the session storage of a web page in another domain i.e. try to access elements by forging url&lt;br /&gt;
* Check the number of items stored in session storage i.e storage.count()&lt;br /&gt;
* On removing an item from storage, it should be inaccessible i.e check if storage.remove(key) is functional&lt;br /&gt;
* Should return null as value for a key not present in the session storage i.e. test storage.getitem(key) for non-existent key&lt;br /&gt;
* Should give an error on exceeding the space limit of session storage i.e check for available memory on each command &lt;br /&gt;
&lt;br /&gt;
The complete list of test cases can be found [http://github.com/servo/web-platform-tests/tree/servo/webstorage here].&lt;br /&gt;
&lt;br /&gt;
== Further Readings ==&lt;br /&gt;
&lt;br /&gt;
Learning Rust by Examples: http://rustbyexample.com/ &amp;lt;br/&amp;gt;&lt;br /&gt;
Javascript as Servo's Garbage Collector: http://blog.mozilla.org/research/2014/08/26/javascript-servos-only-garbage-collector/  &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Aprasad3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/final_design_doc_M1450_navr&amp;diff=92145</id>
		<title>CSC/ECE 517 Fall 2014/final design doc M1450 navr</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/final_design_doc_M1450_navr&amp;diff=92145"/>
		<updated>2014-11-18T04:40:15Z</updated>

		<summary type="html">&lt;p&gt;Aprasad3: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Implement Window.sessionStorage ==&lt;br /&gt;
&lt;br /&gt;
This is the design document for the task &amp;lt;code&amp;gt;[http://github.com/servo/servo/wiki/Storage-student-project Implement Window.sessionStorage]&amp;lt;/code&amp;gt; for the [http://www.mozilla.org/ Mozilla] research project [http://github.com/servo/servo/wiki/Design Servo].&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
=== [http://www.rust-lang.org/ Rust]===&lt;br /&gt;
&lt;br /&gt;
Rust is a modern systems programming language focusing on safety and speed to build reliable and efficient systems &amp;lt;ref&amp;gt; http://doc.rust-lang.org/nightly/intro.html &amp;lt;/ref&amp;gt;. It accomplishes the goals of memory safe without using garbage collection and it supports concurrency and parallelism in building platforms. &lt;br /&gt;
&lt;br /&gt;
Rust’s lightweight task mechanism also promises to allow fine-grained isolation between browser components, such as tabs and extensions, without the need for expensive runtime protection schemes, like operating system process isolation. &amp;lt;ref&amp;gt; https://www.mozilla.org/en-US/research/projects/ &amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== [http://github.com/servo/servo/wiki/Design Servo] ===&lt;br /&gt;
&lt;br /&gt;
Mozilla Research team is currently working on an experimental project to develop a new Web browser engine &amp;quot;Servo&amp;quot;, that is capable of supporting a variety of current and next generation of hardware like mobile devices, multi-core processors and high-performance GPUs. Servo builds on top of Rust to provide a secure and reliable foundation. It is currently developed on 64 bit devices.&amp;lt;ref&amp;gt; https://www.mozilla.org/en-US/research/projects/ &amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The main objectives of this experimentation project is improving the layout to graphics rendering - to optimize for power efficiency and maximize parallelism. &amp;lt;ref&amp;gt; https://www.mozilla.org/en-US/research/projects/ &amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Background ==&lt;br /&gt;
&lt;br /&gt;
=== [http://html.spec.whatwg.org/multipage/webstorage.html#webstorage Web Storage] ===&lt;br /&gt;
The web storage specification defines the means by which a web application can store string key/value pairs in a browser and later retrieve them for use.&amp;lt;ref&amp;gt;https://developer.mozilla.org/en-US/docs/Web/Guide/API/DOM/Storage&amp;lt;/ref&amp;gt; It supports persistent data storage, similar to [http://en.wikipedia.org/wiki/HTTP_cookie cookies] but with a greatly enhanced capacity and no information stored in the [http://en.wikipedia.org/wiki/List_of_HTTP_headers HTTP request header].&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Web_storage&amp;lt;/ref&amp;gt; There are two types of web storage: [http://html.spec.whatwg.org/multipage/webstorage.html#dom-localstorage local storage] and [http://html.spec.whatwg.org/multipage/webstorage.html#dom-sessionstorage session storage].&lt;br /&gt;
&lt;br /&gt;
Browsers that support web storage have the global variables 'sessionStorage' and 'localStorage' declared at the [http://developer.mozilla.org/en-US/docs/Web/API/Window?redirectlocale=en-US&amp;amp;redirectslug=DOM%2Fwindow window] level. The following JavaScript code gives an example of how to use web storage:&lt;br /&gt;
&lt;br /&gt;
'''sessionStorage'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Store value on browser for duration of the session&lt;br /&gt;
sessionStorage.setItem('key', 'value');&lt;br /&gt;
 &lt;br /&gt;
// Retrieve value (gets deleted when browser is closed and re-opened)&lt;br /&gt;
alert(sessionStorage.getItem('key'));&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''localStorage'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Store value on the browser beyond the duration of the session&lt;br /&gt;
localStorage.setItem('key', 'value');&lt;br /&gt;
 &lt;br /&gt;
// Retrieve value (persists even after closing and re-opening the browser)&lt;br /&gt;
alert(localStorage.getItem('key'));&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
&lt;br /&gt;
As part of our [http://github.com/servo/servo/wiki/Storage-student-project project], we have to implement the web storage specification in the Servo browser. Implementing this important specification in Servo will allow stateful web applications to run, and will help expose any architectural problems that Servo's radical design may cause. &amp;lt;ref&amp;gt; https://github.com/servo/servo/wiki/Storage-student-project&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Requirement Analysis &amp;lt;ref&amp;gt;https://github.com/servo/servo/wiki/Storage-student-project&amp;lt;/ref&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
In order to introduce the support for session storage and local storage in the Servo Broswer, we have to create the Storage structure and allow web pages to store data in the Servo memory space.&lt;br /&gt;
&lt;br /&gt;
Below is a high level overview of the various steps that have been planned for this project:&lt;br /&gt;
&lt;br /&gt;
* Create the Storage interface and its stub implementation.&lt;br /&gt;
* Create the WindowSessionStorage interface making it return a Storage instance.&lt;br /&gt;
* Create a Storage Task which will be used to contain all stored data.&lt;br /&gt;
* Define a message-passing interface for reading and writing stored data for a particular browser tab.&lt;br /&gt;
* Use the Storage task in the implementation of Storage.&lt;br /&gt;
* When the value of a stored data is changed, notify its respective browser tab.&lt;br /&gt;
* Pass as many [http://github.com/servo/web-platform-tests/tree/servo/webstorage tests] as possible.&lt;br /&gt;
* Implement the WindowLocalStorage interface which behaves slightly different from the WindowSessionStorage interface.&lt;br /&gt;
&lt;br /&gt;
== Architecture &amp;lt;ref&amp;gt;https://github.com/servo/servo/wiki/Design&amp;lt;/ref&amp;gt;==&lt;br /&gt;
&lt;br /&gt;
[[File:task.jpg]]&lt;br /&gt;
&lt;br /&gt;
=== Architecture Explained ===&lt;br /&gt;
*Each box represents a Rust task.&lt;br /&gt;
*Blue boxes represent the primary tasks in the browser pipeline.&lt;br /&gt;
*Gray boxes represent tasks auxiliary to the browser pipeline.&lt;br /&gt;
*White boxes represent worker tasks. Each such box represents several tasks, the precise number of which will vary with the workload.&lt;br /&gt;
*Dashed lines indicate supervisor relationships.&lt;br /&gt;
*Solid lines indicate communication channels.&lt;br /&gt;
&lt;br /&gt;
== Component Design ==&lt;br /&gt;
[[File:servo.jpg]]&lt;br /&gt;
&lt;br /&gt;
There will be a Storage Task which will be responsible to hold all the data that the web page requests to save. This happens via Channels in Rust, which implements a Sender Receiver protocol. The task is runnning in the background and waits to receive the data sent from the web page.&lt;br /&gt;
&lt;br /&gt;
=== Task &amp;lt;ref&amp;gt;http://doc.rust-lang.org/guide-tasks.html&amp;lt;/ref&amp;gt;===&lt;br /&gt;
Rust provides safe concurrent abstractions through a number of core library primitives. This guide will describe the concurrency model in Rust, how it relates to the Rust type system, and introduce the fundamental library abstractions for constructing concurrent programs.&lt;br /&gt;
&lt;br /&gt;
Tasks provide failure isolation and recovery. When a fatal error occurs in Rust code as a result of an explicit call to panic!(), an assertion failure, or another invalid operation, the runtime system destroys the entire task. Unlike in languages such as Java and C++, there is no way to catch an exception. Instead, tasks may monitor each other to see if they panic.&lt;br /&gt;
&lt;br /&gt;
Tasks use Rust's type system to provide strong memory safety guarantees. In particular, the type system guarantees that tasks cannot induce a data race from shared mutable state.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Generate some state locally&lt;br /&gt;
let child_task_number = generate_task_number();&lt;br /&gt;
&lt;br /&gt;
spawn(proc() {&lt;br /&gt;
    // Capture it in the remote task&lt;br /&gt;
    println!(&amp;quot;I am child number {}&amp;quot;, child_task_number);&lt;br /&gt;
});&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Channel &amp;lt;ref&amp;gt;http://doc.rust-lang.org/guide-tasks.html&amp;lt;/ref&amp;gt;===&lt;br /&gt;
Now that we have spawned a new task, it would be nice if we could communicate with it. For this, we use channels. A channel is simply a pair of endpoints: one for sending messages and another for receiving messages.&lt;br /&gt;
&lt;br /&gt;
The simplest way to create a channel is to use the channel function to create a (Sender, Receiver) pair. In Rust parlance, a sender is a sending endpoint of a channel, and a receiver is the receiving endpoint. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
let (tx, rx): (Sender&amp;lt;int&amp;gt;, Receiver&amp;lt;int&amp;gt;) = channel();&lt;br /&gt;
&lt;br /&gt;
spawn(proc() {&lt;br /&gt;
    let result = some_expensive_computation();&lt;br /&gt;
    tx.send(result);&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
some_other_expensive_computation();&lt;br /&gt;
let result = rx.recv();&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Data Design ==&lt;br /&gt;
&lt;br /&gt;
===  Data Description ===&lt;br /&gt;
&lt;br /&gt;
''The following are the data structures that will be used.''&lt;br /&gt;
&lt;br /&gt;
'''Storage''' | TreeMap&amp;lt;String,String&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''UrlMap''' | TreeMap&amp;lt;String,TreeMap&amp;lt;String,String&amp;gt;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Design Pattern ==&lt;br /&gt;
&lt;br /&gt;
We will be using &amp;quot;Delegation Pattern&amp;quot; in our project. The Storage interface is used by web applications to access the web storage provided by the browser. However, the actual data is stored somewhere else(Servo Memory Space). So, it makes sense to create another class which will maintain the actual stored data. The Storage class can then delegate the task of storing/retrieving data to this class. We will create a class &amp;quot;WebStorageTask&amp;quot; for this purpose.&lt;br /&gt;
&lt;br /&gt;
Also we are using an &amp;quot;Observer Pattern&amp;quot; where the Storage task will run in the background and Observe the commands issued using a channel, it will keep listening to changes on a port and as soon as it receives a message i.e. sees a call towards it , it will perform the required function.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== UML Diagrams ==&lt;br /&gt;
             &lt;br /&gt;
[[File:Flow_Chart_Storage.png|left]] &lt;br /&gt;
[[File:Use_Case_-_Storage.png‎|right]]&lt;br /&gt;
&lt;br /&gt;
'''Steps:'''&lt;br /&gt;
&lt;br /&gt;
1. First, we need to build rust and servo. &amp;lt;br/&amp;gt;&lt;br /&gt;
2. Generate the corresponding WebIDL bindings - Storage.webidl &amp;lt;br/&amp;gt;&lt;br /&gt;
3. Define Storage.rs which has the actual code for creating the storage object. &amp;lt;br/&amp;gt;&lt;br /&gt;
4. Call the receiver via a channel- this is actually used for creating an instance for each unique URL. &amp;lt;br/&amp;gt;&lt;br /&gt;
5. Build the servo again. &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Use Case Functionality'''&lt;br /&gt;
&lt;br /&gt;
1. Here the user can open multiple domains( multiple URL's).&amp;lt;br/&amp;gt;&lt;br /&gt;
2. Thereby the user will be creating multiple storage instances.&amp;lt;br/&amp;gt;&lt;br /&gt;
3. An user can traverse deep into the website but the storage instance is same for that URL.&amp;lt;br/&amp;gt;&lt;br /&gt;
4. The user can reopen the domain for a later period.&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Proposed Test Cases ==&lt;br /&gt;
&lt;br /&gt;
Some of the test cases which will be used to validate our changes are as follows:&lt;br /&gt;
&lt;br /&gt;
* Allow a web page to clear its session storage i.e. storage.clear() function should work&lt;br /&gt;
* Allow a web page to store an item in its session storage i.e. test storage.setitem(key,value)&lt;br /&gt;
* Allow a web page to retrieve stored items from its session storage i.e. test storage.getitem(key)&lt;br /&gt;
* Do not allow a web page to retrieve stored items from the session storage of a web page in another domain i.e. try to access elements by forging url&lt;br /&gt;
* Check the number of items stored in session storage i.e storage.count()&lt;br /&gt;
* On removing an item from storage, it should be inaccessible i.e check if storage.remove(key) is functional&lt;br /&gt;
* Should return null as value for a key not present in the session storage i.e. test storage.getitem(key) for non-existent key&lt;br /&gt;
* Should give an error on exceeding the space limit of session storage i.e check for available memory on each command &lt;br /&gt;
&lt;br /&gt;
The complete list of test cases can be found [http://github.com/servo/web-platform-tests/tree/servo/webstorage here].&lt;br /&gt;
&lt;br /&gt;
== Further Readings ==&lt;br /&gt;
&lt;br /&gt;
Learning Rust by Examples: http://rustbyexample.com/ &amp;lt;br/&amp;gt;&lt;br /&gt;
Javascript as Servo's Garbage Collector: http://blog.mozilla.org/research/2014/08/26/javascript-servos-only-garbage-collector/  &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Aprasad3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/final_design_doc_M1450_navr&amp;diff=92144</id>
		<title>CSC/ECE 517 Fall 2014/final design doc M1450 navr</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/final_design_doc_M1450_navr&amp;diff=92144"/>
		<updated>2014-11-18T04:37:52Z</updated>

		<summary type="html">&lt;p&gt;Aprasad3: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Implement Window.sessionStorage ==&lt;br /&gt;
&lt;br /&gt;
This is the design document for the task &amp;lt;code&amp;gt;[http://github.com/servo/servo/wiki/Storage-student-project Implement Window.sessionStorage]&amp;lt;/code&amp;gt; for the [http://www.mozilla.org/ Mozilla] research project [http://github.com/servo/servo/wiki/Design Servo].&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
=== [http://www.rust-lang.org/ Rust]===&lt;br /&gt;
&lt;br /&gt;
Rust is a modern systems programming language focusing on safety and speed to build reliable and efficient systems &amp;lt;ref&amp;gt; http://doc.rust-lang.org/nightly/intro.html &amp;lt;/ref&amp;gt;. It accomplishes the goals of memory safe without using garbage collection and it supports concurrency and parallelism in building platforms. &lt;br /&gt;
&lt;br /&gt;
Rust’s lightweight task mechanism also promises to allow fine-grained isolation between browser components, such as tabs and extensions, without the need for expensive runtime protection schemes, like operating system process isolation. &amp;lt;ref&amp;gt; https://www.mozilla.org/en-US/research/projects/ &amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== [http://github.com/servo/servo/wiki/Design Servo] ===&lt;br /&gt;
&lt;br /&gt;
Mozilla Research team is currently working on an experimental project to develop a new Web browser engine &amp;quot;Servo&amp;quot;, that is capable of supporting a variety of current and next generation of hardware like mobile devices, multi-core processors and high-performance GPUs. Servo builds on top of Rust to provide a secure and reliable foundation. It is currently developed on 64 bit devices.&amp;lt;ref&amp;gt; https://www.mozilla.org/en-US/research/projects/ &amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The main objectives of this experimentation project is improving the layout to graphics rendering - to optimize for power efficiency and maximize parallelism. &amp;lt;ref&amp;gt; https://www.mozilla.org/en-US/research/projects/ &amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Background ==&lt;br /&gt;
&lt;br /&gt;
=== [http://html.spec.whatwg.org/multipage/webstorage.html#webstorage Web Storage] ===&lt;br /&gt;
The web storage specification defines the means by which a web application can store string key/value pairs in a browser and later retrieve them for use.&amp;lt;ref&amp;gt;https://developer.mozilla.org/en-US/docs/Web/Guide/API/DOM/Storage&amp;lt;/ref&amp;gt; It supports persistent data storage, similar to [http://en.wikipedia.org/wiki/HTTP_cookie cookies] but with a greatly enhanced capacity and no information stored in the [http://en.wikipedia.org/wiki/List_of_HTTP_headers HTTP request header].&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Web_storage&amp;lt;/ref&amp;gt; There are two types of web storage: [http://html.spec.whatwg.org/multipage/webstorage.html#dom-localstorage local storage] and [http://html.spec.whatwg.org/multipage/webstorage.html#dom-sessionstorage session storage].&lt;br /&gt;
&lt;br /&gt;
Browsers that support web storage have the global variables 'sessionStorage' and 'localStorage' declared at the [http://developer.mozilla.org/en-US/docs/Web/API/Window?redirectlocale=en-US&amp;amp;redirectslug=DOM%2Fwindow window] level. The following JavaScript code gives an example of how to use web storage:&lt;br /&gt;
&lt;br /&gt;
'''sessionStorage'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Store value on browser for duration of the session&lt;br /&gt;
sessionStorage.setItem('key', 'value');&lt;br /&gt;
 &lt;br /&gt;
// Retrieve value (gets deleted when browser is closed and re-opened)&lt;br /&gt;
alert(sessionStorage.getItem('key'));&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''localStorage'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Store value on the browser beyond the duration of the session&lt;br /&gt;
localStorage.setItem('key', 'value');&lt;br /&gt;
 &lt;br /&gt;
// Retrieve value (persists even after closing and re-opening the browser)&lt;br /&gt;
alert(localStorage.getItem('key'));&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
&lt;br /&gt;
As part of our [http://github.com/servo/servo/wiki/Storage-student-project project], we have to implement the web storage specification in the Servo browser. Implementing this important specification in Servo will allow stateful web applications to run, and will help expose any architectural problems that Servo's radical design may cause. &amp;lt;ref&amp;gt; https://github.com/servo/servo/wiki/Storage-student-project&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Requirement Analysis &amp;lt;ref&amp;gt;https://github.com/servo/servo/wiki/Storage-student-project&amp;lt;/ref&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
In order to introduce the support for session storage and local storage in the Servo Broswer, we have to create the Storage structure and allow web pages to store data in the Servo memory space.&lt;br /&gt;
&lt;br /&gt;
Below is a high level overview of the various steps that have been planned for this project:&lt;br /&gt;
&lt;br /&gt;
* Create the Storage interface and its stub implementation.&lt;br /&gt;
* Create the WindowSessionStorage interface making it return a Storage instance.&lt;br /&gt;
* Create a Storage Task which will be used to contain all stored data.&lt;br /&gt;
* Define a message-passing interface for reading and writing stored data for a particular browser tab.&lt;br /&gt;
* Use the Storage task in the implementation of Storage.&lt;br /&gt;
* When the value of a stored data is changed, notify its respective browser tab.&lt;br /&gt;
* Pass as many [http://github.com/servo/web-platform-tests/tree/servo/webstorage tests] as possible.&lt;br /&gt;
* Implement the WindowLocalStorage interface which behaves slightly different from the WindowSessionStorage interface.&lt;br /&gt;
&lt;br /&gt;
== Architecture &amp;lt;ref&amp;gt;https://github.com/servo/servo/wiki/Design&amp;lt;/ref&amp;gt;==&lt;br /&gt;
&lt;br /&gt;
[[File:task.jpg]]&lt;br /&gt;
&lt;br /&gt;
=== Architecture Explained ===&lt;br /&gt;
*Each box represents a Rust task.&lt;br /&gt;
*Blue boxes represent the primary tasks in the browser pipeline.&lt;br /&gt;
*Gray boxes represent tasks auxiliary to the browser pipeline.&lt;br /&gt;
*White boxes represent worker tasks. Each such box represents several tasks, the precise number of which will vary with the workload.&lt;br /&gt;
*Dashed lines indicate supervisor relationships.&lt;br /&gt;
*Solid lines indicate communication channels.&lt;br /&gt;
&lt;br /&gt;
== Component Design ==&lt;br /&gt;
[[File:servo.jpg]]&lt;br /&gt;
&lt;br /&gt;
There will be a Storage Task which will be responsible to hold all the data that the web page requests to save. This happens via Channels in Rust, which implements a Sender Receiver protocol. The task is runnning in the background and waits to receive the data sent from the web page.&lt;br /&gt;
&lt;br /&gt;
=== Task &amp;lt;ref&amp;gt;http://doc.rust-lang.org/guide-tasks.html&amp;lt;/ref&amp;gt;===&lt;br /&gt;
Rust provides safe concurrent abstractions through a number of core library primitives. This guide will describe the concurrency model in Rust, how it relates to the Rust type system, and introduce the fundamental library abstractions for constructing concurrent programs.&lt;br /&gt;
&lt;br /&gt;
Tasks provide failure isolation and recovery. When a fatal error occurs in Rust code as a result of an explicit call to panic!(), an assertion failure, or another invalid operation, the runtime system destroys the entire task. Unlike in languages such as Java and C++, there is no way to catch an exception. Instead, tasks may monitor each other to see if they panic.&lt;br /&gt;
&lt;br /&gt;
Tasks use Rust's type system to provide strong memory safety guarantees. In particular, the type system guarantees that tasks cannot induce a data race from shared mutable state.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Generate some state locally&lt;br /&gt;
let child_task_number = generate_task_number();&lt;br /&gt;
&lt;br /&gt;
spawn(proc() {&lt;br /&gt;
    // Capture it in the remote task&lt;br /&gt;
    println!(&amp;quot;I am child number {}&amp;quot;, child_task_number);&lt;br /&gt;
});&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Channel &amp;lt;ref&amp;gt;http://doc.rust-lang.org/guide-tasks.html&amp;lt;/ref&amp;gt;===&lt;br /&gt;
Now that we have spawned a new task, it would be nice if we could communicate with it. For this, we use channels. A channel is simply a pair of endpoints: one for sending messages and another for receiving messages.&lt;br /&gt;
&lt;br /&gt;
The simplest way to create a channel is to use the channel function to create a (Sender, Receiver) pair. In Rust parlance, a sender is a sending endpoint of a channel, and a receiver is the receiving endpoint. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
let (tx, rx): (Sender&amp;lt;int&amp;gt;, Receiver&amp;lt;int&amp;gt;) = channel();&lt;br /&gt;
&lt;br /&gt;
spawn(proc() {&lt;br /&gt;
    let result = some_expensive_computation();&lt;br /&gt;
    tx.send(result);&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
some_other_expensive_computation();&lt;br /&gt;
let result = rx.recv();&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Data Design ==&lt;br /&gt;
&lt;br /&gt;
===  Data Description ===&lt;br /&gt;
&lt;br /&gt;
''The following are the data structures that will be used.''&lt;br /&gt;
&lt;br /&gt;
'''Storage''' | TreeMap&amp;lt;String,String&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''UrlMap''' | TreeMap&amp;lt;String,TreeMap&amp;lt;String,String&amp;gt;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Design Pattern ==&lt;br /&gt;
&lt;br /&gt;
We will be using &amp;quot;Delegation Pattern&amp;quot; in our project. The Storage interface is used by web applications to access the web storage provided by the browser. However, the actual data is stored somewhere else(Servo Memory Space). So, it makes sense to create another class which will maintain the actual stored data. The Storage class can then delegate the task of storing/retrieving data to this class. We will create a class &amp;quot;WebStorageTask&amp;quot; for this purpose.&lt;br /&gt;
&lt;br /&gt;
== UML Diagrams ==&lt;br /&gt;
             &lt;br /&gt;
[[File:Flow_Chart_Storage.png|left]] &lt;br /&gt;
[[File:Use_Case_-_Storage.png‎|right]]&lt;br /&gt;
&lt;br /&gt;
'''Steps:'''&lt;br /&gt;
&lt;br /&gt;
1. First, we need to build rust and servo. &amp;lt;br/&amp;gt;&lt;br /&gt;
2. Generate the corresponding WebIDL bindings - Storage.webidl &amp;lt;br/&amp;gt;&lt;br /&gt;
3. Define Storage.rs which has the actual code for creating the storage object. &amp;lt;br/&amp;gt;&lt;br /&gt;
4. Call the receiver via a channel- this is actually used for creating an instance for each unique URL. &amp;lt;br/&amp;gt;&lt;br /&gt;
5. Build the servo again. &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Use Case Functionality'''&lt;br /&gt;
&lt;br /&gt;
1. Here the user can open multiple domains( multiple URL's).&amp;lt;br/&amp;gt;&lt;br /&gt;
2. Thereby the user will be creating multiple storage instances.&amp;lt;br/&amp;gt;&lt;br /&gt;
3. An user can traverse deep into the website but the storage instance is same for that URL.&amp;lt;br/&amp;gt;&lt;br /&gt;
4. The user can reopen the domain for a later period.&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Proposed Test Cases ==&lt;br /&gt;
&lt;br /&gt;
Some of the test cases which will be used to validate our changes are as follows:&lt;br /&gt;
&lt;br /&gt;
* Allow a web page to clear its session storage i.e. storage.clear() function should work&lt;br /&gt;
* Allow a web page to store an item in its session storage i.e. test storage.setitem(key,value)&lt;br /&gt;
* Allow a web page to retrieve stored items from its session storage i.e. test storage.getitem(key)&lt;br /&gt;
* Do not allow a web page to retrieve stored items from the session storage of a web page in another domain i.e. try to access elements by forging url&lt;br /&gt;
* Check the number of items stored in session storage i.e storage.count()&lt;br /&gt;
* On removing an item from storage, it should be inaccessible i.e check if storage.remove(key) is functional&lt;br /&gt;
* Should return null as value for a key not present in the session storage i.e. test storage.getitem(key) for non-existent key&lt;br /&gt;
* Should give an error on exceeding the space limit of session storage i.e check for available memory on each command &lt;br /&gt;
&lt;br /&gt;
The complete list of test cases can be found [http://github.com/servo/web-platform-tests/tree/servo/webstorage here].&lt;br /&gt;
&lt;br /&gt;
== Further Readings ==&lt;br /&gt;
&lt;br /&gt;
Learning Rust by Examples: http://rustbyexample.com/ &amp;lt;br/&amp;gt;&lt;br /&gt;
Javascript as Servo's Garbage Collector: http://blog.mozilla.org/research/2014/08/26/javascript-servos-only-garbage-collector/  &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Aprasad3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/final_design_doc_M1450_navr&amp;diff=92143</id>
		<title>CSC/ECE 517 Fall 2014/final design doc M1450 navr</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/final_design_doc_M1450_navr&amp;diff=92143"/>
		<updated>2014-11-18T04:36:55Z</updated>

		<summary type="html">&lt;p&gt;Aprasad3: /* Proposed Test Cases */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Implement Window.sessionStorage ==&lt;br /&gt;
&lt;br /&gt;
This is the design document for the task &amp;lt;code&amp;gt;[http://github.com/servo/servo/wiki/Storage-student-project Implement Window.sessionStorage]&amp;lt;/code&amp;gt; for the [http://www.mozilla.org/ Mozilla] research project [http://github.com/servo/servo/wiki/Design Servo].&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
=== [http://www.rust-lang.org/ Rust]===&lt;br /&gt;
&lt;br /&gt;
Rust is a modern systems programming language focusing on safety and speed to build reliable and efficient systems &amp;lt;ref&amp;gt; http://doc.rust-lang.org/nightly/intro.html &amp;lt;/ref&amp;gt;. It accomplishes the goals of memory safe without using garbage collection and it supports concurrency and parallelism in building platforms. &lt;br /&gt;
&lt;br /&gt;
Rust’s lightweight task mechanism also promises to allow fine-grained isolation between browser components, such as tabs and extensions, without the need for expensive runtime protection schemes, like operating system process isolation. &amp;lt;ref&amp;gt; https://www.mozilla.org/en-US/research/projects/ &amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== [http://github.com/servo/servo/wiki/Design Servo] ===&lt;br /&gt;
&lt;br /&gt;
Mozilla Research team is currently working on an experimental project to develop a new Web browser engine &amp;quot;Servo&amp;quot;, that is capable of supporting a variety of current and next generation of hardware like mobile devices, multi-core processors and high-performance GPUs. Servo builds on top of Rust to provide a secure and reliable foundation. It is currently developed on 64 bit devices.&amp;lt;ref&amp;gt; https://www.mozilla.org/en-US/research/projects/ &amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The main objectives of this experimentation project is improving the layout to graphics rendering - to optimize for power efficiency and maximize parallelism. &amp;lt;ref&amp;gt; https://www.mozilla.org/en-US/research/projects/ &amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Background ==&lt;br /&gt;
&lt;br /&gt;
=== [http://html.spec.whatwg.org/multipage/webstorage.html#webstorage Web Storage] ===&lt;br /&gt;
The web storage specification defines the means by which a web application can store string key/value pairs in a browser and later retrieve them for use.&amp;lt;ref&amp;gt;https://developer.mozilla.org/en-US/docs/Web/Guide/API/DOM/Storage&amp;lt;/ref&amp;gt; It supports persistent data storage, similar to [http://en.wikipedia.org/wiki/HTTP_cookie cookies] but with a greatly enhanced capacity and no information stored in the [http://en.wikipedia.org/wiki/List_of_HTTP_headers HTTP request header].&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Web_storage&amp;lt;/ref&amp;gt; There are two types of web storage: [http://html.spec.whatwg.org/multipage/webstorage.html#dom-localstorage local storage] and [http://html.spec.whatwg.org/multipage/webstorage.html#dom-sessionstorage session storage].&lt;br /&gt;
&lt;br /&gt;
Browsers that support web storage have the global variables 'sessionStorage' and 'localStorage' declared at the [http://developer.mozilla.org/en-US/docs/Web/API/Window?redirectlocale=en-US&amp;amp;redirectslug=DOM%2Fwindow window] level. The following JavaScript code gives an example of how to use web storage:&lt;br /&gt;
&lt;br /&gt;
'''sessionStorage'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Store value on browser for duration of the session&lt;br /&gt;
sessionStorage.setItem('key', 'value');&lt;br /&gt;
 &lt;br /&gt;
// Retrieve value (gets deleted when browser is closed and re-opened)&lt;br /&gt;
alert(sessionStorage.getItem('key'));&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''localStorage'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Store value on the browser beyond the duration of the session&lt;br /&gt;
localStorage.setItem('key', 'value');&lt;br /&gt;
 &lt;br /&gt;
// Retrieve value (persists even after closing and re-opening the browser)&lt;br /&gt;
alert(localStorage.getItem('key'));&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
&lt;br /&gt;
As part of our [http://github.com/servo/servo/wiki/Storage-student-project project], we have to implement the web storage specification in the Servo browser. Implementing this important specification in Servo will allow stateful web applications to run, and will help expose any architectural problems that Servo's radical design may cause. &amp;lt;ref&amp;gt; https://github.com/servo/servo/wiki/Storage-student-project&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Requirement Analysis &amp;lt;ref&amp;gt;https://github.com/servo/servo/wiki/Storage-student-project&amp;lt;/ref&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
In order to introduce the support for session storage and local storage in the Servo Broswer, we have to create the Storage structure and allow web pages to store data in the Servo memory space.&lt;br /&gt;
&lt;br /&gt;
Below is a high level overview of the various steps that have been planned for this project:&lt;br /&gt;
&lt;br /&gt;
* Create the Storage interface and its stub implementation.&lt;br /&gt;
* Create the WindowSessionStorage interface making it return a Storage instance.&lt;br /&gt;
* Create a Storage Task which will be used to contain all stored data.&lt;br /&gt;
* Define a message-passing interface for reading and writing stored data for a particular browser tab.&lt;br /&gt;
* Use the Storage task in the implementation of Storage.&lt;br /&gt;
* When the value of a stored data is changed, notify its respective browser tab.&lt;br /&gt;
* Pass as many [http://github.com/servo/web-platform-tests/tree/servo/webstorage tests] as possible.&lt;br /&gt;
* Implement the WindowLocalStorage interface which behaves slightly different from the WindowSessionStorage interface.&lt;br /&gt;
&lt;br /&gt;
== Architecture &amp;lt;ref&amp;gt;https://github.com/servo/servo/wiki/Design&amp;lt;/ref&amp;gt;==&lt;br /&gt;
&lt;br /&gt;
[[File:task.jpg]]&lt;br /&gt;
&lt;br /&gt;
=== Architecture Explained ===&lt;br /&gt;
*Each box represents a Rust task.&lt;br /&gt;
*Blue boxes represent the primary tasks in the browser pipeline.&lt;br /&gt;
*Gray boxes represent tasks auxiliary to the browser pipeline.&lt;br /&gt;
*White boxes represent worker tasks. Each such box represents several tasks, the precise number of which will vary with the workload.&lt;br /&gt;
*Dashed lines indicate supervisor relationships.&lt;br /&gt;
*Solid lines indicate communication channels.&lt;br /&gt;
&lt;br /&gt;
== Component Design ==&lt;br /&gt;
[[File:servo.jpg]]&lt;br /&gt;
&lt;br /&gt;
There will be a Storage Task which will be responsible to hold all the data that the web page requests to save. This happens via Channels in Rust, which implements a Sender Receiver protocol. The task is runnning in the background and waits to receive the data sent from the web page.&lt;br /&gt;
&lt;br /&gt;
=== Task &amp;lt;ref&amp;gt;http://doc.rust-lang.org/guide-tasks.html&amp;lt;/ref&amp;gt;===&lt;br /&gt;
Rust provides safe concurrent abstractions through a number of core library primitives. This guide will describe the concurrency model in Rust, how it relates to the Rust type system, and introduce the fundamental library abstractions for constructing concurrent programs.&lt;br /&gt;
&lt;br /&gt;
Tasks provide failure isolation and recovery. When a fatal error occurs in Rust code as a result of an explicit call to panic!(), an assertion failure, or another invalid operation, the runtime system destroys the entire task. Unlike in languages such as Java and C++, there is no way to catch an exception. Instead, tasks may monitor each other to see if they panic.&lt;br /&gt;
&lt;br /&gt;
Tasks use Rust's type system to provide strong memory safety guarantees. In particular, the type system guarantees that tasks cannot induce a data race from shared mutable state.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Generate some state locally&lt;br /&gt;
let child_task_number = generate_task_number();&lt;br /&gt;
&lt;br /&gt;
spawn(proc() {&lt;br /&gt;
    // Capture it in the remote task&lt;br /&gt;
    println!(&amp;quot;I am child number {}&amp;quot;, child_task_number);&lt;br /&gt;
});&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Channel &amp;lt;ref&amp;gt;http://doc.rust-lang.org/guide-tasks.html&amp;lt;/ref&amp;gt;===&lt;br /&gt;
Now that we have spawned a new task, it would be nice if we could communicate with it. For this, we use channels. A channel is simply a pair of endpoints: one for sending messages and another for receiving messages.&lt;br /&gt;
&lt;br /&gt;
The simplest way to create a channel is to use the channel function to create a (Sender, Receiver) pair. In Rust parlance, a sender is a sending endpoint of a channel, and a receiver is the receiving endpoint. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
let (tx, rx): (Sender&amp;lt;int&amp;gt;, Receiver&amp;lt;int&amp;gt;) = channel();&lt;br /&gt;
&lt;br /&gt;
spawn(proc() {&lt;br /&gt;
    let result = some_expensive_computation();&lt;br /&gt;
    tx.send(result);&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
some_other_expensive_computation();&lt;br /&gt;
let result = rx.recv();&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Data Design ==&lt;br /&gt;
&lt;br /&gt;
===  Data Description ===&lt;br /&gt;
&lt;br /&gt;
''The following are the data structures that will be used.''&lt;br /&gt;
&lt;br /&gt;
'''Storage''' | TreeMap&amp;lt;String,String&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''UrlMap''' | TreeMap&amp;lt;String,TreeMap&amp;lt;String,String&amp;gt;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Design Pattern ==&lt;br /&gt;
&lt;br /&gt;
We will be using &amp;quot;Delegation Pattern&amp;quot; in our project. The Storage interface is used by web applications to access the web storage provided by the browser. However, the actual data is stored somewhere else(Servo Memory Space). So, it makes sense to create another class which will maintain the actual stored data. The Storage class can then delegate the task of storing/retrieving data to this class. We will create a class &amp;quot;WebStorageTask&amp;quot; for this purpose.&lt;br /&gt;
&lt;br /&gt;
== UML Diagrams ==&lt;br /&gt;
             &lt;br /&gt;
[[File:Flow_Chart_Storage.png|left]] &lt;br /&gt;
[[File:Use_Case_-_Storage.png‎|right]]&lt;br /&gt;
&lt;br /&gt;
'''Steps:'''&lt;br /&gt;
&lt;br /&gt;
1. First, we need to build rust and servo. &amp;lt;br/&amp;gt;&lt;br /&gt;
2. Generate the corresponding WebIDL bindings - Storage.webidl &amp;lt;br/&amp;gt;&lt;br /&gt;
3. Define Storage.rs which has the actual code for creating the storage object. &amp;lt;br/&amp;gt;&lt;br /&gt;
4. Call the receiver via a channel- this is actually used for creating an instance for each unique URL. &amp;lt;br/&amp;gt;&lt;br /&gt;
5. Build the servo again. &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Use Case Functionality'''&lt;br /&gt;
&lt;br /&gt;
1. Here the user can open multiple domains( multiple URL's).&amp;lt;br/&amp;gt;&lt;br /&gt;
2. Thereby the user will be creating multiple storage instances.&amp;lt;br/&amp;gt;&lt;br /&gt;
3. An user can traverse deep into the website but the storage instance is same for that URL.&amp;lt;br/&amp;gt;&lt;br /&gt;
4. The user can reopen the domain for a later period.&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Proposed Test Cases ==&lt;br /&gt;
&lt;br /&gt;
Some of the test cases which will be used to validate our changes are as follows:&lt;br /&gt;
&lt;br /&gt;
* Allow a web page to clear its session storage i.e. storage.clear() function should work&lt;br /&gt;
* Allow a web page to store an item in its session storage i.e. test storage.setitem(key,value)&lt;br /&gt;
* Allow a web page to retrieve stored items from its session storage i.e. test storage.getitem(key)&lt;br /&gt;
* Do not allow a web page to retrieve stored items from the session storage of a web page in another domain i.e. try to access elements by forging url&lt;br /&gt;
* Check the number of items stored in session storage i.e storage.count()&lt;br /&gt;
* On removing an item from storage, it should be inaccessible i.e check if storage.remove(key) is functional&lt;br /&gt;
* Should return null as value for a key not present in the session storage i.e. test storage.getitem(key) for non-existent key&lt;br /&gt;
* Should give an error on exceeding the space limit of session storage i.e check for available memory on each command &lt;br /&gt;
&lt;br /&gt;
The complete list of test cases can be found [http://github.com/servo/web-platform-tests/tree/servo/webstorage here].&lt;br /&gt;
&lt;br /&gt;
== Further Readings ==&lt;br /&gt;
&lt;br /&gt;
Learning Rust by Examples: http://rustbyexample.com/ &amp;lt;br/&amp;gt;&lt;br /&gt;
Javascript as Servo's Garbage Collector: http://blog.mozilla.org/research/2014/08/26/javascript-servos-only-garbage-collector/  &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Aprasad3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/final_design_doc_M1450_navr&amp;diff=91722</id>
		<title>CSC/ECE 517 Fall 2014/final design doc M1450 navr</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/final_design_doc_M1450_navr&amp;diff=91722"/>
		<updated>2014-11-11T19:17:01Z</updated>

		<summary type="html">&lt;p&gt;Aprasad3: /* Component Design */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
=== [http://www.rust-lang.org/ Rust]===&lt;br /&gt;
&lt;br /&gt;
Rust is a modern systems programming language focusing on safety and speed to build reliable and efficient systems &amp;lt;ref&amp;gt; http://doc.rust-lang.org/nightly/intro.html &amp;lt;/ref&amp;gt;. It accomplishes the goals of memory safe without using garbage collection and it supports concurrency and parallelism in building platforms. &lt;br /&gt;
&lt;br /&gt;
Rust’s lightweight task mechanism also promises to allow fine-grained isolation between browser components, such as tabs and extensions, without the need for expensive runtime protection schemes, like operating system process isolation. &amp;lt;ref&amp;gt; https://www.mozilla.org/en-US/research/projects/ &amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== [http://github.com/servo/servo/wiki/Design Servo] ===&lt;br /&gt;
&lt;br /&gt;
Mozilla Research team is currently working on an experimental project to develop a new Web browser engine &amp;quot;Servo&amp;quot;, that is capable of supporting a variety of current and next generation of hardware like mobile devices, multi-core processors and high-performance GPUs. Servo builds on top of Rust to provide a secure and reliable foundation. It is currently developed on 64 bit devices.&amp;lt;ref&amp;gt; https://www.mozilla.org/en-US/research/projects/ &amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The main objectives of this experimentation project is improving the layout to graphics rendering - to optimize for power efficiency and maximize parallelism. &amp;lt;ref&amp;gt; https://www.mozilla.org/en-US/research/projects/ &amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Purpose ===&lt;br /&gt;
&lt;br /&gt;
The purpose of this project is to introduce the support related to sessionstorage and localstorage in Servo Broswer, for this we have to create Storage structure and allow web pages to store data in the Servo memory space.&lt;br /&gt;
&lt;br /&gt;
=== Background ===&lt;br /&gt;
&lt;br /&gt;
Persistent storage on the web is used by many services such as the popular Disqus commenting interface. Implementing this important specification in Servo will allow stateful web applications to run, and will help expose any architectural problems that Servo's radical design may cause.&lt;br /&gt;
&lt;br /&gt;
== Architecture ==&lt;br /&gt;
&lt;br /&gt;
[[File:task.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The Architecture comprises of a Storage Task which will be responsible to hold all the data that the web page requests to save. This happens via Channels in Rust, which implements a Sender Receiver protocol, the task is runnning in the background and waits to receive the data sent from the web page.&lt;br /&gt;
&lt;br /&gt;
=== Architecture Explained ===&lt;br /&gt;
*Each box represents a Rust task.&lt;br /&gt;
*Blue boxes represent the primary tasks in the browser pipeline.&lt;br /&gt;
*Gray boxes represent tasks auxiliary to the browser pipeline.&lt;br /&gt;
*White boxes represent worker tasks. Each such box represents several tasks, the precise number of which will vary with the workload.&lt;br /&gt;
*Dashed lines indicate supervisor relationships.&lt;br /&gt;
*Solid lines indicate communication channels.&lt;br /&gt;
&lt;br /&gt;
== Requirement analysis &amp;lt;ref&amp;gt;https://github.com/servo/servo/wiki/Storage-student-project&amp;lt;/ref&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Data Design ==&lt;br /&gt;
&lt;br /&gt;
===  Data Description ===&lt;br /&gt;
&lt;br /&gt;
''The following are the data structures that will be used.''&lt;br /&gt;
&lt;br /&gt;
'''Storage''' | TreeMap&amp;lt;String,String&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''UrlMap''' | TreeMap&amp;lt;String,TreeMap&amp;lt;String,String&amp;gt;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Component Design ==&lt;br /&gt;
[[File:servo.jpg]]&lt;br /&gt;
=== Task ===&lt;br /&gt;
Rust provides safe concurrent abstractions through a number of core library primitives. This guide will describe the concurrency model in Rust, how it relates to the Rust type system, and introduce the fundamental library abstractions for constructing concurrent programs.&lt;br /&gt;
&lt;br /&gt;
Tasks provide failure isolation and recovery. When a fatal error occurs in Rust code as a result of an explicit call to panic!(), an assertion failure, or another invalid operation, the runtime system destroys the entire task. Unlike in languages such as Java and C++, there is no way to catch an exception. Instead, tasks may monitor each other to see if they panic.&lt;br /&gt;
&lt;br /&gt;
Tasks use Rust's type system to provide strong memory safety guarantees. In particular, the type system guarantees that tasks cannot induce a data race from shared mutable state.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Generate some state locally&lt;br /&gt;
let child_task_number = generate_task_number();&lt;br /&gt;
&lt;br /&gt;
spawn(proc() {&lt;br /&gt;
    // Capture it in the remote task&lt;br /&gt;
    println!(&amp;quot;I am child number {}&amp;quot;, child_task_number);&lt;br /&gt;
});&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Channel ===&lt;br /&gt;
Now that we have spawned a new task, it would be nice if we could communicate with it. For this, we use channels. A channel is simply a pair of endpoints: one for sending messages and another for receiving messages.&lt;br /&gt;
&lt;br /&gt;
The simplest way to create a channel is to use the channel function to create a (Sender, Receiver) pair. In Rust parlance, a sender is a sending endpoint of a channel, and a receiver is the receiving endpoint. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
let (tx, rx): (Sender&amp;lt;int&amp;gt;, Receiver&amp;lt;int&amp;gt;) = channel();&lt;br /&gt;
&lt;br /&gt;
spawn(proc() {&lt;br /&gt;
    let result = some_expensive_computation();&lt;br /&gt;
    tx.send(result);&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
some_other_expensive_computation();&lt;br /&gt;
let result = rx.recv();&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Design patterns ==&lt;br /&gt;
&lt;br /&gt;
== UML diagrams (Eg use case diagram, class diagrams) ==&lt;br /&gt;
&lt;br /&gt;
== Proposed Test Cases ==&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Aprasad3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/final_design_doc_M1450_navr&amp;diff=91719</id>
		<title>CSC/ECE 517 Fall 2014/final design doc M1450 navr</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/final_design_doc_M1450_navr&amp;diff=91719"/>
		<updated>2014-11-11T19:14:31Z</updated>

		<summary type="html">&lt;p&gt;Aprasad3: /* Component Design */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
=== [http://www.rust-lang.org/ Rust]===&lt;br /&gt;
&lt;br /&gt;
Rust is a modern systems programming language focusing on safety and speed to build reliable and efficient systems &amp;lt;ref&amp;gt; http://doc.rust-lang.org/nightly/intro.html &amp;lt;/ref&amp;gt;. It accomplishes the goals of memory safe without using garbage collection and it supports concurrency and parallelism in building platforms. &lt;br /&gt;
&lt;br /&gt;
Rust’s lightweight task mechanism also promises to allow fine-grained isolation between browser components, such as tabs and extensions, without the need for expensive runtime protection schemes, like operating system process isolation. &amp;lt;ref&amp;gt; https://www.mozilla.org/en-US/research/projects/ &amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== [http://github.com/servo/servo/wiki/Design Servo] ===&lt;br /&gt;
&lt;br /&gt;
Mozilla Research team is currently working on an experimental project to develop a new Web browser engine &amp;quot;Servo&amp;quot;, that is capable of supporting a variety of current and next generation of hardware like mobile devices, multi-core processors and high-performance GPUs. Servo builds on top of Rust to provide a secure and reliable foundation. It is currently developed on 64 bit devices.&amp;lt;ref&amp;gt; https://www.mozilla.org/en-US/research/projects/ &amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The main objectives of this experimentation project is improving the layout to graphics rendering - to optimize for power efficiency and maximize parallelism. &amp;lt;ref&amp;gt; https://www.mozilla.org/en-US/research/projects/ &amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Purpose ===&lt;br /&gt;
&lt;br /&gt;
The purpose of this project is to introduce the support related to sessionstorage and localstorage in Servo Broswer, for this we have to create Storage structure and allow web pages to store data in the Servo memory space.&lt;br /&gt;
&lt;br /&gt;
=== Background ===&lt;br /&gt;
&lt;br /&gt;
Persistent storage on the web is used by many services such as the popular Disqus commenting interface. Implementing this important specification in Servo will allow stateful web applications to run, and will help expose any architectural problems that Servo's radical design may cause.&lt;br /&gt;
&lt;br /&gt;
== Architecture ==&lt;br /&gt;
&lt;br /&gt;
[[File:task.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The Architecture comprises of a Storage Task which will be responsible to hold all the data that the web page requests to save. This happens via Channels in Rust, which implements a Sender Receiver protocol, the task is runnning in the background and waits to receive the data sent from the web page.&lt;br /&gt;
&lt;br /&gt;
=== Architecture Explained ===&lt;br /&gt;
*Each box represents a Rust task.&lt;br /&gt;
*Blue boxes represent the primary tasks in the browser pipeline.&lt;br /&gt;
*Gray boxes represent tasks auxiliary to the browser pipeline.&lt;br /&gt;
*White boxes represent worker tasks. Each such box represents several tasks, the precise number of which will vary with the workload.&lt;br /&gt;
*Dashed lines indicate supervisor relationships.&lt;br /&gt;
*Solid lines indicate communication channels.&lt;br /&gt;
&lt;br /&gt;
== Requirement analysis &amp;lt;ref&amp;gt;https://github.com/servo/servo/wiki/Storage-student-project&amp;lt;/ref&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Data Design ==&lt;br /&gt;
&lt;br /&gt;
===  Data Description ===&lt;br /&gt;
&lt;br /&gt;
''The following are the data structures that will be used.''&lt;br /&gt;
&lt;br /&gt;
'''Storage''' | TreeMap&amp;lt;String,String&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''UrlMap''' | TreeMap&amp;lt;String,TreeMap&amp;lt;String,String&amp;gt;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Component Design ==&lt;br /&gt;
[[File:servo.jpg]]&lt;br /&gt;
&lt;br /&gt;
== Design patterns ==&lt;br /&gt;
&lt;br /&gt;
== UML diagrams (Eg use case diagram, class diagrams) ==&lt;br /&gt;
&lt;br /&gt;
== Proposed Test Cases ==&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Aprasad3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Servo.jpg&amp;diff=91718</id>
		<title>File:Servo.jpg</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Servo.jpg&amp;diff=91718"/>
		<updated>2014-11-11T19:14:15Z</updated>

		<summary type="html">&lt;p&gt;Aprasad3: uploaded a new version of &amp;amp;quot;File:Servo.jpg&amp;amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Aprasad3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Servo.jpg&amp;diff=91717</id>
		<title>File:Servo.jpg</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Servo.jpg&amp;diff=91717"/>
		<updated>2014-11-11T19:13:59Z</updated>

		<summary type="html">&lt;p&gt;Aprasad3: uploaded a new version of &amp;amp;quot;File:Servo.jpg&amp;amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Aprasad3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Servo.png&amp;diff=91716</id>
		<title>File:Servo.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Servo.png&amp;diff=91716"/>
		<updated>2014-11-11T19:11:40Z</updated>

		<summary type="html">&lt;p&gt;Aprasad3: uploaded a new version of &amp;amp;quot;File:Servo.png&amp;amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Aprasad3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Servo.png&amp;diff=91715</id>
		<title>File:Servo.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Servo.png&amp;diff=91715"/>
		<updated>2014-11-11T19:09:09Z</updated>

		<summary type="html">&lt;p&gt;Aprasad3: uploaded a new version of &amp;amp;quot;File:Servo.png&amp;amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Aprasad3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/final_design_doc_M1450_navr&amp;diff=91714</id>
		<title>CSC/ECE 517 Fall 2014/final design doc M1450 navr</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/final_design_doc_M1450_navr&amp;diff=91714"/>
		<updated>2014-11-11T18:59:53Z</updated>

		<summary type="html">&lt;p&gt;Aprasad3: /* Architecture Explained */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
=== [http://www.rust-lang.org/ Rust]===&lt;br /&gt;
&lt;br /&gt;
Rust is a modern systems programming language focusing on safety and speed to build reliable and efficient systems &amp;lt;ref&amp;gt; http://doc.rust-lang.org/nightly/intro.html &amp;lt;/ref&amp;gt;. It accomplishes the goals of memory safe without using garbage collection and it supports concurrency and parallelism in building platforms. &lt;br /&gt;
&lt;br /&gt;
Rust’s lightweight task mechanism also promises to allow fine-grained isolation between browser components, such as tabs and extensions, without the need for expensive runtime protection schemes, like operating system process isolation. &amp;lt;ref&amp;gt; https://www.mozilla.org/en-US/research/projects/ &amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== [http://github.com/servo/servo/wiki/Design Servo] ===&lt;br /&gt;
&lt;br /&gt;
Mozilla Research team is currently working on an experimental project to develop a new Web browser engine &amp;quot;Servo&amp;quot;, that is capable of supporting a variety of current and next generation of hardware like mobile devices, multi-core processors and high-performance GPUs. Servo builds on top of Rust to provide a secure and reliable foundation. It is currently developed on 64 bit devices.&amp;lt;ref&amp;gt; https://www.mozilla.org/en-US/research/projects/ &amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The main objectives of this experimentation project is improving the layout to graphics rendering - to optimize for power efficiency and maximize parallelism. &amp;lt;ref&amp;gt; https://www.mozilla.org/en-US/research/projects/ &amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Purpose ===&lt;br /&gt;
&lt;br /&gt;
The purpose of this project is to introduce the support related to sessionstorage and localstorage in Servo Broswer, for this we have to create Storage structure and allow web pages to store data in the Servo memory space.&lt;br /&gt;
&lt;br /&gt;
=== Background ===&lt;br /&gt;
&lt;br /&gt;
Persistent storage on the web is used by many services such as the popular Disqus commenting interface. Implementing this important specification in Servo will allow stateful web applications to run, and will help expose any architectural problems that Servo's radical design may cause.&lt;br /&gt;
&lt;br /&gt;
== Architecture ==&lt;br /&gt;
&lt;br /&gt;
[[File:task.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The Architecture comprises of a Storage Task which will be responsible to hold all the data that the web page requests to save. This happens via Channels in Rust, which implements a Sender Receiver protocol, the task is runnning in the background and waits to receive the data sent from the web page.&lt;br /&gt;
&lt;br /&gt;
=== Architecture Explained ===&lt;br /&gt;
*Each box represents a Rust task.&lt;br /&gt;
*Blue boxes represent the primary tasks in the browser pipeline.&lt;br /&gt;
*Gray boxes represent tasks auxiliary to the browser pipeline.&lt;br /&gt;
*White boxes represent worker tasks. Each such box represents several tasks, the precise number of which will vary with the workload.&lt;br /&gt;
*Dashed lines indicate supervisor relationships.&lt;br /&gt;
*Solid lines indicate communication channels.&lt;br /&gt;
&lt;br /&gt;
== Requirement analysis &amp;lt;ref&amp;gt;https://github.com/servo/servo/wiki/Storage-student-project&amp;lt;/ref&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Data Design ==&lt;br /&gt;
&lt;br /&gt;
===  Data Description ===&lt;br /&gt;
&lt;br /&gt;
''The following are the data structures that will be used.''&lt;br /&gt;
&lt;br /&gt;
'''Storage''' | TreeMap&amp;lt;String,String&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''UrlMap''' | TreeMap&amp;lt;String,TreeMap&amp;lt;String,String&amp;gt;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Component Design ==&lt;br /&gt;
&lt;br /&gt;
== Design patterns ==&lt;br /&gt;
&lt;br /&gt;
== UML diagrams (Eg use case diagram, class diagrams) ==&lt;br /&gt;
&lt;br /&gt;
== Proposed Test Cases ==&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Aprasad3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/final_design_doc_M1450_navr&amp;diff=91713</id>
		<title>CSC/ECE 517 Fall 2014/final design doc M1450 navr</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/final_design_doc_M1450_navr&amp;diff=91713"/>
		<updated>2014-11-11T18:56:39Z</updated>

		<summary type="html">&lt;p&gt;Aprasad3: /* Data Description */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
=== [http://www.rust-lang.org/ Rust]===&lt;br /&gt;
&lt;br /&gt;
Rust is a modern systems programming language focusing on safety and speed to build reliable and efficient systems &amp;lt;ref&amp;gt; http://doc.rust-lang.org/nightly/intro.html &amp;lt;/ref&amp;gt;. It accomplishes the goals of memory safe without using garbage collection and it supports concurrency and parallelism in building platforms. &lt;br /&gt;
&lt;br /&gt;
Rust’s lightweight task mechanism also promises to allow fine-grained isolation between browser components, such as tabs and extensions, without the need for expensive runtime protection schemes, like operating system process isolation. &amp;lt;ref&amp;gt; https://www.mozilla.org/en-US/research/projects/ &amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== [http://github.com/servo/servo/wiki/Design Servo] ===&lt;br /&gt;
&lt;br /&gt;
Mozilla Research team is currently working on an experimental project to develop a new Web browser engine &amp;quot;Servo&amp;quot;, that is capable of supporting a variety of current and next generation of hardware like mobile devices, multi-core processors and high-performance GPUs. Servo builds on top of Rust to provide a secure and reliable foundation. It is currently developed on 64 bit devices.&amp;lt;ref&amp;gt; https://www.mozilla.org/en-US/research/projects/ &amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The main objectives of this experimentation project is improving the layout to graphics rendering - to optimize for power efficiency and maximize parallelism. &amp;lt;ref&amp;gt; https://www.mozilla.org/en-US/research/projects/ &amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Purpose ===&lt;br /&gt;
&lt;br /&gt;
The purpose of this project is to introduce the support related to sessionstorage and localstorage in Servo Broswer, for this we have to create Storage structure and allow web pages to store data in the Servo memory space.&lt;br /&gt;
&lt;br /&gt;
=== Background ===&lt;br /&gt;
&lt;br /&gt;
Persistent storage on the web is used by many services such as the popular Disqus commenting interface. Implementing this important specification in Servo will allow stateful web applications to run, and will help expose any architectural problems that Servo's radical design may cause.&lt;br /&gt;
&lt;br /&gt;
== Architecture ==&lt;br /&gt;
&lt;br /&gt;
[[File:task.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The Architecture comprises of a Storage Task which will be responsible to hold all the data that the web page requests to save. This happens via Channels in Rust, which implements a Sender Receiver protocol, the task is runnning in the background and waits to receive the data sent from the web page.&lt;br /&gt;
&lt;br /&gt;
=== Architecture Explained ===&lt;br /&gt;
Each box represents a Rust task.&lt;br /&gt;
Blue boxes represent the primary tasks in the browser pipeline.&lt;br /&gt;
Gray boxes represent tasks auxiliary to the browser pipeline.&lt;br /&gt;
White boxes represent worker tasks. Each such box represents several tasks, the precise number of which will vary with the workload.&lt;br /&gt;
Dashed lines indicate supervisor relationships.&lt;br /&gt;
Solid lines indicate communication channels.&lt;br /&gt;
&lt;br /&gt;
== Requirement analysis &amp;lt;ref&amp;gt;https://github.com/servo/servo/wiki/Storage-student-project&amp;lt;/ref&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Data Design ==&lt;br /&gt;
&lt;br /&gt;
===  Data Description ===&lt;br /&gt;
&lt;br /&gt;
''The following are the data structures that will be used.''&lt;br /&gt;
&lt;br /&gt;
'''Storage''' | TreeMap&amp;lt;String,String&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''UrlMap''' | TreeMap&amp;lt;String,TreeMap&amp;lt;String,String&amp;gt;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Component Design ==&lt;br /&gt;
&lt;br /&gt;
== Design patterns ==&lt;br /&gt;
&lt;br /&gt;
== UML diagrams (Eg use case diagram, class diagrams) ==&lt;br /&gt;
&lt;br /&gt;
== Proposed Test Cases ==&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Aprasad3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/final_design_doc_M1450_navr&amp;diff=91712</id>
		<title>CSC/ECE 517 Fall 2014/final design doc M1450 navr</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/final_design_doc_M1450_navr&amp;diff=91712"/>
		<updated>2014-11-11T18:56:20Z</updated>

		<summary type="html">&lt;p&gt;Aprasad3: /* Data Description */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
=== [http://www.rust-lang.org/ Rust]===&lt;br /&gt;
&lt;br /&gt;
Rust is a modern systems programming language focusing on safety and speed to build reliable and efficient systems &amp;lt;ref&amp;gt; http://doc.rust-lang.org/nightly/intro.html &amp;lt;/ref&amp;gt;. It accomplishes the goals of memory safe without using garbage collection and it supports concurrency and parallelism in building platforms. &lt;br /&gt;
&lt;br /&gt;
Rust’s lightweight task mechanism also promises to allow fine-grained isolation between browser components, such as tabs and extensions, without the need for expensive runtime protection schemes, like operating system process isolation. &amp;lt;ref&amp;gt; https://www.mozilla.org/en-US/research/projects/ &amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== [http://github.com/servo/servo/wiki/Design Servo] ===&lt;br /&gt;
&lt;br /&gt;
Mozilla Research team is currently working on an experimental project to develop a new Web browser engine &amp;quot;Servo&amp;quot;, that is capable of supporting a variety of current and next generation of hardware like mobile devices, multi-core processors and high-performance GPUs. Servo builds on top of Rust to provide a secure and reliable foundation. It is currently developed on 64 bit devices.&amp;lt;ref&amp;gt; https://www.mozilla.org/en-US/research/projects/ &amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The main objectives of this experimentation project is improving the layout to graphics rendering - to optimize for power efficiency and maximize parallelism. &amp;lt;ref&amp;gt; https://www.mozilla.org/en-US/research/projects/ &amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Purpose ===&lt;br /&gt;
&lt;br /&gt;
The purpose of this project is to introduce the support related to sessionstorage and localstorage in Servo Broswer, for this we have to create Storage structure and allow web pages to store data in the Servo memory space.&lt;br /&gt;
&lt;br /&gt;
=== Background ===&lt;br /&gt;
&lt;br /&gt;
Persistent storage on the web is used by many services such as the popular Disqus commenting interface. Implementing this important specification in Servo will allow stateful web applications to run, and will help expose any architectural problems that Servo's radical design may cause.&lt;br /&gt;
&lt;br /&gt;
== Architecture ==&lt;br /&gt;
&lt;br /&gt;
[[File:task.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The Architecture comprises of a Storage Task which will be responsible to hold all the data that the web page requests to save. This happens via Channels in Rust, which implements a Sender Receiver protocol, the task is runnning in the background and waits to receive the data sent from the web page.&lt;br /&gt;
&lt;br /&gt;
=== Architecture Explained ===&lt;br /&gt;
Each box represents a Rust task.&lt;br /&gt;
Blue boxes represent the primary tasks in the browser pipeline.&lt;br /&gt;
Gray boxes represent tasks auxiliary to the browser pipeline.&lt;br /&gt;
White boxes represent worker tasks. Each such box represents several tasks, the precise number of which will vary with the workload.&lt;br /&gt;
Dashed lines indicate supervisor relationships.&lt;br /&gt;
Solid lines indicate communication channels.&lt;br /&gt;
&lt;br /&gt;
== Requirement analysis &amp;lt;ref&amp;gt;https://github.com/servo/servo/wiki/Storage-student-project&amp;lt;/ref&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Data Design ==&lt;br /&gt;
&lt;br /&gt;
===  Data Description ===&lt;br /&gt;
&lt;br /&gt;
The following are the data structures that will be used.&lt;br /&gt;
&lt;br /&gt;
Storage | TreeMap&amp;lt;String,String&amp;gt;&lt;br /&gt;
&lt;br /&gt;
UrlMap | TreeMap&amp;lt;String,TreeMap&amp;lt;String,String&amp;gt;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Component Design ==&lt;br /&gt;
&lt;br /&gt;
== Design patterns ==&lt;br /&gt;
&lt;br /&gt;
== UML diagrams (Eg use case diagram, class diagrams) ==&lt;br /&gt;
&lt;br /&gt;
== Proposed Test Cases ==&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Aprasad3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/final_design_doc_M1450_navr&amp;diff=91711</id>
		<title>CSC/ECE 517 Fall 2014/final design doc M1450 navr</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/final_design_doc_M1450_navr&amp;diff=91711"/>
		<updated>2014-11-11T18:55:24Z</updated>

		<summary type="html">&lt;p&gt;Aprasad3: /* Data Design */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
=== [http://www.rust-lang.org/ Rust]===&lt;br /&gt;
&lt;br /&gt;
Rust is a modern systems programming language focusing on safety and speed to build reliable and efficient systems &amp;lt;ref&amp;gt; http://doc.rust-lang.org/nightly/intro.html &amp;lt;/ref&amp;gt;. It accomplishes the goals of memory safe without using garbage collection and it supports concurrency and parallelism in building platforms. &lt;br /&gt;
&lt;br /&gt;
Rust’s lightweight task mechanism also promises to allow fine-grained isolation between browser components, such as tabs and extensions, without the need for expensive runtime protection schemes, like operating system process isolation. &amp;lt;ref&amp;gt; https://www.mozilla.org/en-US/research/projects/ &amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== [http://github.com/servo/servo/wiki/Design Servo] ===&lt;br /&gt;
&lt;br /&gt;
Mozilla Research team is currently working on an experimental project to develop a new Web browser engine &amp;quot;Servo&amp;quot;, that is capable of supporting a variety of current and next generation of hardware like mobile devices, multi-core processors and high-performance GPUs. Servo builds on top of Rust to provide a secure and reliable foundation. It is currently developed on 64 bit devices.&amp;lt;ref&amp;gt; https://www.mozilla.org/en-US/research/projects/ &amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The main objectives of this experimentation project is improving the layout to graphics rendering - to optimize for power efficiency and maximize parallelism. &amp;lt;ref&amp;gt; https://www.mozilla.org/en-US/research/projects/ &amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Purpose ===&lt;br /&gt;
&lt;br /&gt;
The purpose of this project is to introduce the support related to sessionstorage and localstorage in Servo Broswer, for this we have to create Storage structure and allow web pages to store data in the Servo memory space.&lt;br /&gt;
&lt;br /&gt;
=== Background ===&lt;br /&gt;
&lt;br /&gt;
Persistent storage on the web is used by many services such as the popular Disqus commenting interface. Implementing this important specification in Servo will allow stateful web applications to run, and will help expose any architectural problems that Servo's radical design may cause.&lt;br /&gt;
&lt;br /&gt;
== Architecture ==&lt;br /&gt;
&lt;br /&gt;
[[File:task.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The Architecture comprises of a Storage Task which will be responsible to hold all the data that the web page requests to save. This happens via Channels in Rust, which implements a Sender Receiver protocol, the task is runnning in the background and waits to receive the data sent from the web page.&lt;br /&gt;
&lt;br /&gt;
=== Architecture Explained ===&lt;br /&gt;
Each box represents a Rust task.&lt;br /&gt;
Blue boxes represent the primary tasks in the browser pipeline.&lt;br /&gt;
Gray boxes represent tasks auxiliary to the browser pipeline.&lt;br /&gt;
White boxes represent worker tasks. Each such box represents several tasks, the precise number of which will vary with the workload.&lt;br /&gt;
Dashed lines indicate supervisor relationships.&lt;br /&gt;
Solid lines indicate communication channels.&lt;br /&gt;
&lt;br /&gt;
== Requirement analysis &amp;lt;ref&amp;gt;https://github.com/servo/servo/wiki/Storage-student-project&amp;lt;/ref&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Data Design ==&lt;br /&gt;
&lt;br /&gt;
===  Data Description ===&lt;br /&gt;
&lt;br /&gt;
The following are the data structures that will be used.&lt;br /&gt;
&lt;br /&gt;
Storage | TreeMap&amp;lt;String,String&amp;gt;&lt;br /&gt;
UrlMap | TreeMap&amp;lt;String,TreeMap&amp;lt;String,String&amp;gt;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Component Design ==&lt;br /&gt;
&lt;br /&gt;
== Design patterns ==&lt;br /&gt;
&lt;br /&gt;
== UML diagrams (Eg use case diagram, class diagrams) ==&lt;br /&gt;
&lt;br /&gt;
== Proposed Test Cases ==&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Aprasad3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/final_design_doc_M1450_navr&amp;diff=91710</id>
		<title>CSC/ECE 517 Fall 2014/final design doc M1450 navr</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/final_design_doc_M1450_navr&amp;diff=91710"/>
		<updated>2014-11-11T18:52:29Z</updated>

		<summary type="html">&lt;p&gt;Aprasad3: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
=== [http://www.rust-lang.org/ Rust]===&lt;br /&gt;
&lt;br /&gt;
Rust is a modern systems programming language focusing on safety and speed to build reliable and efficient systems &amp;lt;ref&amp;gt; http://doc.rust-lang.org/nightly/intro.html &amp;lt;/ref&amp;gt;. It accomplishes the goals of memory safe without using garbage collection and it supports concurrency and parallelism in building platforms. &lt;br /&gt;
&lt;br /&gt;
Rust’s lightweight task mechanism also promises to allow fine-grained isolation between browser components, such as tabs and extensions, without the need for expensive runtime protection schemes, like operating system process isolation. &amp;lt;ref&amp;gt; https://www.mozilla.org/en-US/research/projects/ &amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== [http://github.com/servo/servo/wiki/Design Servo] ===&lt;br /&gt;
&lt;br /&gt;
Mozilla Research team is currently working on an experimental project to develop a new Web browser engine &amp;quot;Servo&amp;quot;, that is capable of supporting a variety of current and next generation of hardware like mobile devices, multi-core processors and high-performance GPUs. Servo builds on top of Rust to provide a secure and reliable foundation. It is currently developed on 64 bit devices.&amp;lt;ref&amp;gt; https://www.mozilla.org/en-US/research/projects/ &amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The main objectives of this experimentation project is improving the layout to graphics rendering - to optimize for power efficiency and maximize parallelism. &amp;lt;ref&amp;gt; https://www.mozilla.org/en-US/research/projects/ &amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Purpose ===&lt;br /&gt;
&lt;br /&gt;
The purpose of this project is to introduce the support related to sessionstorage and localstorage in Servo Broswer, for this we have to create Storage structure and allow web pages to store data in the Servo memory space.&lt;br /&gt;
&lt;br /&gt;
=== Background ===&lt;br /&gt;
&lt;br /&gt;
Persistent storage on the web is used by many services such as the popular Disqus commenting interface. Implementing this important specification in Servo will allow stateful web applications to run, and will help expose any architectural problems that Servo's radical design may cause.&lt;br /&gt;
&lt;br /&gt;
== Architecture ==&lt;br /&gt;
&lt;br /&gt;
[[File:task.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The Architecture comprises of a Storage Task which will be responsible to hold all the data that the web page requests to save. This happens via Channels in Rust, which implements a Sender Receiver protocol, the task is runnning in the background and waits to receive the data sent from the web page.&lt;br /&gt;
&lt;br /&gt;
=== Architecture Explained ===&lt;br /&gt;
Each box represents a Rust task.&lt;br /&gt;
Blue boxes represent the primary tasks in the browser pipeline.&lt;br /&gt;
Gray boxes represent tasks auxiliary to the browser pipeline.&lt;br /&gt;
White boxes represent worker tasks. Each such box represents several tasks, the precise number of which will vary with the workload.&lt;br /&gt;
Dashed lines indicate supervisor relationships.&lt;br /&gt;
Solid lines indicate communication channels.&lt;br /&gt;
&lt;br /&gt;
== Requirement analysis &amp;lt;ref&amp;gt;https://github.com/servo/servo/wiki/Storage-student-project&amp;lt;/ref&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Data Design ==&lt;br /&gt;
&lt;br /&gt;
== Component Design ==&lt;br /&gt;
&lt;br /&gt;
== Design patterns ==&lt;br /&gt;
&lt;br /&gt;
== UML diagrams (Eg use case diagram, class diagrams) ==&lt;br /&gt;
&lt;br /&gt;
== Proposed Test Cases ==&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Aprasad3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/final_design_doc_M1450_navr&amp;diff=91709</id>
		<title>CSC/ECE 517 Fall 2014/final design doc M1450 navr</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/final_design_doc_M1450_navr&amp;diff=91709"/>
		<updated>2014-11-11T18:47:29Z</updated>

		<summary type="html">&lt;p&gt;Aprasad3: /* Introduction */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
=== [http://www.rust-lang.org/ Rust]===&lt;br /&gt;
&lt;br /&gt;
Rust is a modern systems programming language focusing on safety and speed to build reliable and efficient systems &amp;lt;ref&amp;gt; http://doc.rust-lang.org/nightly/intro.html &amp;lt;/ref&amp;gt;. It accomplishes the goals of memory safe without using garbage collection and it supports concurrency and parallelism in building platforms. &lt;br /&gt;
&lt;br /&gt;
Rust’s lightweight task mechanism also promises to allow fine-grained isolation between browser components, such as tabs and extensions, without the need for expensive runtime protection schemes, like operating system process isolation. &amp;lt;ref&amp;gt; https://www.mozilla.org/en-US/research/projects/ &amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== [http://github.com/servo/servo/wiki/Design Servo] ===&lt;br /&gt;
&lt;br /&gt;
Mozilla Research team is currently working on an experimental project to develop a new Web browser engine &amp;quot;Servo&amp;quot;, that is capable of supporting a variety of current and next generation of hardware like mobile devices, multi-core processors and high-performance GPUs. Servo builds on top of Rust to provide a secure and reliable foundation. It is currently developed on 64 bit devices.&amp;lt;ref&amp;gt; https://www.mozilla.org/en-US/research/projects/ &amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The main objectives of this experimentation project is improving the layout to graphics rendering - to optimize for power efficiency and maximize parallelism. &amp;lt;ref&amp;gt; https://www.mozilla.org/en-US/research/projects/ &amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Purpose ===&lt;br /&gt;
&lt;br /&gt;
The purpose of this project is to introduce the support related to sessionstorage and localstorage in Servo Broswer, for this we have to create Storage structure and allow web pages to store data in the Servo memory space.&lt;br /&gt;
&lt;br /&gt;
=== Background ===&lt;br /&gt;
&lt;br /&gt;
Persistent storage on the web is used by many services such as the popular Disqus commenting interface. Implementing this important specification in Servo will allow stateful web applications to run, and will help expose any architectural problems that Servo's radical design may cause.&lt;br /&gt;
&lt;br /&gt;
== Architecture ==&lt;br /&gt;
&lt;br /&gt;
[[File:task.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The Architecture comprises of a Storage Task which will be responsible to hold all the data that the web page requests to save. This happens via Channels in Rust, which implements a Sender Receiver protocol, the task is runnning in the background and waits to receive the data sent from the web page.&lt;br /&gt;
&lt;br /&gt;
=== Architecture Explained ===&lt;br /&gt;
Each box represents a Rust task.&lt;br /&gt;
Blue boxes represent the primary tasks in the browser pipeline.&lt;br /&gt;
Gray boxes represent tasks auxiliary to the browser pipeline.&lt;br /&gt;
White boxes represent worker tasks. Each such box represents several tasks, the precise number of which will vary with the workload.&lt;br /&gt;
Dashed lines indicate supervisor relationships.&lt;br /&gt;
Solid lines indicate communication channels.&lt;br /&gt;
&lt;br /&gt;
== Requirement analysis &amp;lt;ref&amp;gt;https://github.com/servo/servo/wiki/Storage-student-project&amp;lt;/ref&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Data and component design ==&lt;br /&gt;
&lt;br /&gt;
== Design patterns ==&lt;br /&gt;
&lt;br /&gt;
== UML diagrams (Eg use case diagram, class diagrams) ==&lt;br /&gt;
&lt;br /&gt;
== Proposed Test Cases ==&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Aprasad3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/final_design_doc_M1450_navr&amp;diff=91708</id>
		<title>CSC/ECE 517 Fall 2014/final design doc M1450 navr</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/final_design_doc_M1450_navr&amp;diff=91708"/>
		<updated>2014-11-11T18:47:10Z</updated>

		<summary type="html">&lt;p&gt;Aprasad3: /* Architecture */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
=== [http://www.rust-lang.org/ Rust]===&lt;br /&gt;
&lt;br /&gt;
Rust is a modern systems programming language focusing on safety and speed to build reliable and efficient systems &amp;lt;ref&amp;gt; http://doc.rust-lang.org/nightly/intro.html &amp;lt;/ref&amp;gt;. It accomplishes the goals of memory safe without using garbage collection and it supports concurrency and parallelism in building platforms. &lt;br /&gt;
&lt;br /&gt;
Rust’s lightweight task mechanism also promises to allow fine-grained isolation between browser components, such as tabs and extensions, without the need for expensive runtime protection schemes, like operating system process isolation. &amp;lt;ref&amp;gt; https://www.mozilla.org/en-US/research/projects/ &amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== [http://github.com/servo/servo/wiki/Design Servo] ===&lt;br /&gt;
&lt;br /&gt;
Mozilla Research team is currently working on an experimental project to develop a new Web browser engine &amp;quot;Servo&amp;quot;, that is capable of supporting a variety of current and next generation of hardware like mobile devices, multi-core processors and high-performance GPUs. Servo builds on top of Rust to provide a secure and reliable foundation. It is currently developed on 64 bit devices.&amp;lt;ref&amp;gt; https://www.mozilla.org/en-US/research/projects/ &amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The main objectives of this experimentation project is improving the layout to graphics rendering - to optimize for power efficiency and maximize parallelism. &amp;lt;ref&amp;gt; https://www.mozilla.org/en-US/research/projects/ &amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Purpose ===&lt;br /&gt;
&lt;br /&gt;
The purpose of this project is to introduce the support related to sessionstorage and localstorage in Servo Broswer, for this we have to create Storage structure and allow web pages to store data in the Servo memory space.&lt;br /&gt;
&lt;br /&gt;
=== Background ===&lt;br /&gt;
&lt;br /&gt;
Persistent storage on the web is used by many services such as the popular Disqus commenting interface. Implementing this important specification in Servo will allow stateful web applications to run, and will help expose any architectural problems that Servo's radical design may cause.&lt;br /&gt;
&lt;br /&gt;
== Architecture ==&lt;br /&gt;
&lt;br /&gt;
[[File:task.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The Architecture comprises of a Storage Task which will be responsible to hold all the data that the web page requests to save. This happens via Channels in Rust, which implements a Sender Receiver protocol, the task is runnning in the background and waits to receive the data sent from the web page.&lt;br /&gt;
&lt;br /&gt;
=== Architecture Explained ===&lt;br /&gt;
Each box represents a Rust task.&lt;br /&gt;
Blue boxes represent the primary tasks in the browser pipeline.&lt;br /&gt;
Gray boxes represent tasks auxiliary to the browser pipeline.&lt;br /&gt;
White boxes represent worker tasks. Each such box represents several tasks, the precise number of which will vary with the workload.&lt;br /&gt;
Dashed lines indicate supervisor relationships.&lt;br /&gt;
Solid lines indicate communication channels.&lt;br /&gt;
&lt;br /&gt;
== Requirement analysis &amp;lt;ref&amp;gt;https://github.com/servo/servo/wiki/Storage-student-project&amp;lt;/ref&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Data and component design ==&lt;br /&gt;
&lt;br /&gt;
== Design patterns ==&lt;br /&gt;
&lt;br /&gt;
== UML diagrams (Eg use case diagram, class diagrams) ==&lt;br /&gt;
&lt;br /&gt;
== Proposed Test Cases ==&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Aprasad3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/final_design_doc_M1450_navr&amp;diff=91707</id>
		<title>CSC/ECE 517 Fall 2014/final design doc M1450 navr</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/final_design_doc_M1450_navr&amp;diff=91707"/>
		<updated>2014-11-11T18:46:55Z</updated>

		<summary type="html">&lt;p&gt;Aprasad3: /* Architecture */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
=== [http://www.rust-lang.org/ Rust]===&lt;br /&gt;
&lt;br /&gt;
Rust is a modern systems programming language focusing on safety and speed to build reliable and efficient systems &amp;lt;ref&amp;gt; http://doc.rust-lang.org/nightly/intro.html &amp;lt;/ref&amp;gt;. It accomplishes the goals of memory safe without using garbage collection and it supports concurrency and parallelism in building platforms. &lt;br /&gt;
&lt;br /&gt;
Rust’s lightweight task mechanism also promises to allow fine-grained isolation between browser components, such as tabs and extensions, without the need for expensive runtime protection schemes, like operating system process isolation. &amp;lt;ref&amp;gt; https://www.mozilla.org/en-US/research/projects/ &amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== [http://github.com/servo/servo/wiki/Design Servo] ===&lt;br /&gt;
&lt;br /&gt;
Mozilla Research team is currently working on an experimental project to develop a new Web browser engine &amp;quot;Servo&amp;quot;, that is capable of supporting a variety of current and next generation of hardware like mobile devices, multi-core processors and high-performance GPUs. Servo builds on top of Rust to provide a secure and reliable foundation. It is currently developed on 64 bit devices.&amp;lt;ref&amp;gt; https://www.mozilla.org/en-US/research/projects/ &amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The main objectives of this experimentation project is improving the layout to graphics rendering - to optimize for power efficiency and maximize parallelism. &amp;lt;ref&amp;gt; https://www.mozilla.org/en-US/research/projects/ &amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Purpose ===&lt;br /&gt;
&lt;br /&gt;
The purpose of this project is to introduce the support related to sessionstorage and localstorage in Servo Broswer, for this we have to create Storage structure and allow web pages to store data in the Servo memory space.&lt;br /&gt;
&lt;br /&gt;
=== Background ===&lt;br /&gt;
&lt;br /&gt;
Persistent storage on the web is used by many services such as the popular Disqus commenting interface. Implementing this important specification in Servo will allow stateful web applications to run, and will help expose any architectural problems that Servo's radical design may cause.&lt;br /&gt;
&lt;br /&gt;
== Architecture ==&lt;br /&gt;
&lt;br /&gt;
[[File:task.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The Architecture comprises of a Storage Task which will be responsible to hold all the data that the web page requests to save. This happens via Channels in Rust, which implements a Sender Receiver protocol, the task is runnning in the background and waits to receive the data sent from the web page.&lt;br /&gt;
&lt;br /&gt;
Architecture Explained&lt;br /&gt;
Each box represents a Rust task.&lt;br /&gt;
Blue boxes represent the primary tasks in the browser pipeline.&lt;br /&gt;
Gray boxes represent tasks auxiliary to the browser pipeline.&lt;br /&gt;
White boxes represent worker tasks. Each such box represents several tasks, the precise number of which will vary with the workload.&lt;br /&gt;
Dashed lines indicate supervisor relationships.&lt;br /&gt;
Solid lines indicate communication channels.&lt;br /&gt;
&lt;br /&gt;
== Requirement analysis &amp;lt;ref&amp;gt;https://github.com/servo/servo/wiki/Storage-student-project&amp;lt;/ref&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Data and component design ==&lt;br /&gt;
&lt;br /&gt;
== Design patterns ==&lt;br /&gt;
&lt;br /&gt;
== UML diagrams (Eg use case diagram, class diagrams) ==&lt;br /&gt;
&lt;br /&gt;
== Proposed Test Cases ==&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Aprasad3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/final_design_doc_M1450_navr&amp;diff=91706</id>
		<title>CSC/ECE 517 Fall 2014/final design doc M1450 navr</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/final_design_doc_M1450_navr&amp;diff=91706"/>
		<updated>2014-11-11T18:46:39Z</updated>

		<summary type="html">&lt;p&gt;Aprasad3: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
=== [http://www.rust-lang.org/ Rust]===&lt;br /&gt;
&lt;br /&gt;
Rust is a modern systems programming language focusing on safety and speed to build reliable and efficient systems &amp;lt;ref&amp;gt; http://doc.rust-lang.org/nightly/intro.html &amp;lt;/ref&amp;gt;. It accomplishes the goals of memory safe without using garbage collection and it supports concurrency and parallelism in building platforms. &lt;br /&gt;
&lt;br /&gt;
Rust’s lightweight task mechanism also promises to allow fine-grained isolation between browser components, such as tabs and extensions, without the need for expensive runtime protection schemes, like operating system process isolation. &amp;lt;ref&amp;gt; https://www.mozilla.org/en-US/research/projects/ &amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== [http://github.com/servo/servo/wiki/Design Servo] ===&lt;br /&gt;
&lt;br /&gt;
Mozilla Research team is currently working on an experimental project to develop a new Web browser engine &amp;quot;Servo&amp;quot;, that is capable of supporting a variety of current and next generation of hardware like mobile devices, multi-core processors and high-performance GPUs. Servo builds on top of Rust to provide a secure and reliable foundation. It is currently developed on 64 bit devices.&amp;lt;ref&amp;gt; https://www.mozilla.org/en-US/research/projects/ &amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The main objectives of this experimentation project is improving the layout to graphics rendering - to optimize for power efficiency and maximize parallelism. &amp;lt;ref&amp;gt; https://www.mozilla.org/en-US/research/projects/ &amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Purpose ===&lt;br /&gt;
&lt;br /&gt;
The purpose of this project is to introduce the support related to sessionstorage and localstorage in Servo Broswer, for this we have to create Storage structure and allow web pages to store data in the Servo memory space.&lt;br /&gt;
&lt;br /&gt;
=== Background ===&lt;br /&gt;
&lt;br /&gt;
Persistent storage on the web is used by many services such as the popular Disqus commenting interface. Implementing this important specification in Servo will allow stateful web applications to run, and will help expose any architectural problems that Servo's radical design may cause.&lt;br /&gt;
&lt;br /&gt;
== Architecture ==&lt;br /&gt;
&lt;br /&gt;
[[File:task.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Requirement analysis &amp;lt;ref&amp;gt;https://github.com/servo/servo/wiki/Storage-student-project&amp;lt;/ref&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Data and component design ==&lt;br /&gt;
&lt;br /&gt;
== Design patterns ==&lt;br /&gt;
&lt;br /&gt;
== UML diagrams (Eg use case diagram, class diagrams) ==&lt;br /&gt;
&lt;br /&gt;
== Proposed Test Cases ==&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Aprasad3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Task.png&amp;diff=91705</id>
		<title>File:Task.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Task.png&amp;diff=91705"/>
		<updated>2014-11-11T18:46:07Z</updated>

		<summary type="html">&lt;p&gt;Aprasad3: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Aprasad3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/final_design_doc_M1450_navr&amp;diff=91704</id>
		<title>CSC/ECE 517 Fall 2014/final design doc M1450 navr</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/final_design_doc_M1450_navr&amp;diff=91704"/>
		<updated>2014-11-11T18:45:17Z</updated>

		<summary type="html">&lt;p&gt;Aprasad3: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
=== [http://www.rust-lang.org/ Rust]===&lt;br /&gt;
&lt;br /&gt;
Rust is a modern systems programming language focusing on safety and speed to build reliable and efficient systems &amp;lt;ref&amp;gt; http://doc.rust-lang.org/nightly/intro.html &amp;lt;/ref&amp;gt;. It accomplishes the goals of memory safe without using garbage collection and it supports concurrency and parallelism in building platforms. &lt;br /&gt;
&lt;br /&gt;
Rust’s lightweight task mechanism also promises to allow fine-grained isolation between browser components, such as tabs and extensions, without the need for expensive runtime protection schemes, like operating system process isolation. &amp;lt;ref&amp;gt; https://www.mozilla.org/en-US/research/projects/ &amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== [http://github.com/servo/servo/wiki/Design Servo] ===&lt;br /&gt;
&lt;br /&gt;
Mozilla Research team is currently working on an experimental project to develop a new Web browser engine &amp;quot;Servo&amp;quot;, that is capable of supporting a variety of current and next generation of hardware like mobile devices, multi-core processors and high-performance GPUs. Servo builds on top of Rust to provide a secure and reliable foundation. It is currently developed on 64 bit devices.&amp;lt;ref&amp;gt; https://www.mozilla.org/en-US/research/projects/ &amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The main objectives of this experimentation project is improving the layout to graphics rendering - to optimize for power efficiency and maximize parallelism. &amp;lt;ref&amp;gt; https://www.mozilla.org/en-US/research/projects/ &amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Purpose ===&lt;br /&gt;
&lt;br /&gt;
The purpose of this project is to introduce the support related to sessionstorage and localstorage in Servo Broswer, for this we have to create Storage structure and allow web pages to store data in the Servo memory space.&lt;br /&gt;
&lt;br /&gt;
=== Background ===&lt;br /&gt;
&lt;br /&gt;
Persistent storage on the web is used by many services such as the popular Disqus commenting interface. Implementing this important specification in Servo will allow stateful web applications to run, and will help expose any architectural problems that Servo's radical design may cause.&lt;br /&gt;
&lt;br /&gt;
== Architecture ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Requirement analysis &amp;lt;ref&amp;gt;https://github.com/servo/servo/wiki/Storage-student-project&amp;lt;/ref&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Data and component design ==&lt;br /&gt;
&lt;br /&gt;
== Design patterns ==&lt;br /&gt;
&lt;br /&gt;
== UML diagrams (Eg use case diagram, class diagrams) ==&lt;br /&gt;
&lt;br /&gt;
== Proposed Test Cases ==&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Aprasad3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/final_design_doc_M1450_navr&amp;diff=91703</id>
		<title>CSC/ECE 517 Fall 2014/final design doc M1450 navr</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/final_design_doc_M1450_navr&amp;diff=91703"/>
		<updated>2014-11-11T18:44:56Z</updated>

		<summary type="html">&lt;p&gt;Aprasad3: /* Introduction and architecture of system */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
=== [http://www.rust-lang.org/ Rust]===&lt;br /&gt;
&lt;br /&gt;
Rust is a modern systems programming language focusing on safety and speed to build reliable and efficient systems &amp;lt;ref&amp;gt; http://doc.rust-lang.org/nightly/intro.html &amp;lt;/ref&amp;gt;. It accomplishes the goals of memory safe without using garbage collection and it supports concurrency and parallelism in building platforms. &lt;br /&gt;
&lt;br /&gt;
Rust’s lightweight task mechanism also promises to allow fine-grained isolation between browser components, such as tabs and extensions, without the need for expensive runtime protection schemes, like operating system process isolation. &amp;lt;ref&amp;gt; https://www.mozilla.org/en-US/research/projects/ &amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== [http://github.com/servo/servo/wiki/Design Servo] ===&lt;br /&gt;
&lt;br /&gt;
Mozilla Research team is currently working on an experimental project to develop a new Web browser engine &amp;quot;Servo&amp;quot;, that is capable of supporting a variety of current and next generation of hardware like mobile devices, multi-core processors and high-performance GPUs. Servo builds on top of Rust to provide a secure and reliable foundation. It is currently developed on 64 bit devices.&amp;lt;ref&amp;gt; https://www.mozilla.org/en-US/research/projects/ &amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The main objectives of this experimentation project is improving the layout to graphics rendering - to optimize for power efficiency and maximize parallelism. &amp;lt;ref&amp;gt; https://www.mozilla.org/en-US/research/projects/ &amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Purpose ===&lt;br /&gt;
&lt;br /&gt;
The purpose of this project is to introduce the support related to sessionstorage and localstorage in Servo Broswer, for this we have to create Storage structure and allow web pages to store data in the Servo memory space.&lt;br /&gt;
&lt;br /&gt;
=== Background ===&lt;br /&gt;
&lt;br /&gt;
Persistent storage on the web is used by many services such as the popular Disqus commenting interface. Implementing this important specification in Servo will allow stateful web applications to run, and will help expose any architectural problems that Servo's radical design may cause.&lt;br /&gt;
&lt;br /&gt;
== Requirement analysis &amp;lt;ref&amp;gt;https://github.com/servo/servo/wiki/Storage-student-project&amp;lt;/ref&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Data and component design ==&lt;br /&gt;
&lt;br /&gt;
== Design patterns ==&lt;br /&gt;
&lt;br /&gt;
== UML diagrams (Eg use case diagram, class diagrams) ==&lt;br /&gt;
&lt;br /&gt;
== Proposed Test Cases ==&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Aprasad3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/final_design_doc_M1450_navr&amp;diff=91702</id>
		<title>CSC/ECE 517 Fall 2014/final design doc M1450 navr</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/final_design_doc_M1450_navr&amp;diff=91702"/>
		<updated>2014-11-11T18:44:23Z</updated>

		<summary type="html">&lt;p&gt;Aprasad3: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction and architecture of system ==&lt;br /&gt;
&lt;br /&gt;
=== [http://www.rust-lang.org/ Rust]===&lt;br /&gt;
&lt;br /&gt;
Rust is a modern systems programming language focusing on safety and speed to build reliable and efficient systems &amp;lt;ref&amp;gt; http://doc.rust-lang.org/nightly/intro.html &amp;lt;/ref&amp;gt;. It accomplishes the goals of memory safe without using garbage collection and it supports concurrency and parallelism in building platforms. &lt;br /&gt;
&lt;br /&gt;
Rust’s lightweight task mechanism also promises to allow fine-grained isolation between browser components, such as tabs and extensions, without the need for expensive runtime protection schemes, like operating system process isolation. &amp;lt;ref&amp;gt; https://www.mozilla.org/en-US/research/projects/ &amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== [http://github.com/servo/servo/wiki/Design Servo] ===&lt;br /&gt;
&lt;br /&gt;
Mozilla Research team is currently working on an experimental project to develop a new Web browser engine &amp;quot;Servo&amp;quot;, that is capable of supporting a variety of current and next generation of hardware like mobile devices, multi-core processors and high-performance GPUs. Servo builds on top of Rust to provide a secure and reliable foundation. It is currently developed on 64 bit devices.&amp;lt;ref&amp;gt; https://www.mozilla.org/en-US/research/projects/ &amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The main objectives of this experimentation project is improving the layout to graphics rendering - to optimize for power efficiency and maximize parallelism. &amp;lt;ref&amp;gt; https://www.mozilla.org/en-US/research/projects/ &amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Purpose ===&lt;br /&gt;
&lt;br /&gt;
The purpose of this project is to introduce the support related to sessionstorage and localstorage in Servo Broswer, for this we have to create Storage structure and allow web pages to store data in the Servo memory space.&lt;br /&gt;
&lt;br /&gt;
=== Background ===&lt;br /&gt;
&lt;br /&gt;
Persistent storage on the web is used by many services such as the popular Disqus commenting interface. Implementing this important specification in Servo will allow stateful web applications to run, and will help expose any architectural problems that Servo's radical design may cause.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Requirement analysis &amp;lt;ref&amp;gt;https://github.com/servo/servo/wiki/Storage-student-project&amp;lt;/ref&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Data and component design ==&lt;br /&gt;
&lt;br /&gt;
== Design patterns ==&lt;br /&gt;
&lt;br /&gt;
== UML diagrams (Eg use case diagram, class diagrams) ==&lt;br /&gt;
&lt;br /&gt;
== Proposed Test Cases ==&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Aprasad3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/OSS_M1450_vda&amp;diff=91033</id>
		<title>CSC/ECE 517 Fall 2014/OSS M1450 vda</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/OSS_M1450_vda&amp;diff=91033"/>
		<updated>2014-10-30T00:27:57Z</updated>

		<summary type="html">&lt;p&gt;Aprasad3: /* Project Description */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Implement Window.sessionStorage ==&lt;br /&gt;
&lt;br /&gt;
This wiki page contains details on the work done for the initial step of the task &amp;lt;code&amp;gt; [http://github.com/servo/servo/wiki/Storage-student-project Implement Window.sessionStorage] &amp;lt;/code&amp;gt; for the [http://www.mozilla.org/ Mozilla] research project [http://github.com/servo/servo/wiki/Design Servo].&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
=== [http://www.rust-lang.org/ Rust]===&lt;br /&gt;
&lt;br /&gt;
Rust is a modern systems programming language focusing on safety and speed to build reliable and efficient systems &amp;lt;ref&amp;gt; http://doc.rust-lang.org/nightly/intro.html &amp;lt;/ref&amp;gt;. It accomplishes the goals of memory safe without using garbage collection and it supports concurrency and parallelism in building platforms. &lt;br /&gt;
&lt;br /&gt;
Rust’s lightweight task mechanism also promises to allow fine-grained isolation between browser components, such as tabs and extensions, without the need for expensive runtime protection schemes, like operating system process isolation. &amp;lt;ref&amp;gt; https://www.mozilla.org/en-US/research/projects/ &amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== [http://github.com/servo/servo/wiki/Design Servo] ===&lt;br /&gt;
&lt;br /&gt;
Mozilla Research team is currently working on an experimental project to develop a new Web browser engine &amp;quot;Servo&amp;quot;, that is capable of supporting a variety of current and next generation of hardware like mobile devices, multi-core processors and high-performance GPUs. Servo builds on top of Rust to provide a secure and reliable foundation. It is currently developed on 64 bit devices.&amp;lt;ref&amp;gt; https://www.mozilla.org/en-US/research/projects/ &amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The main objectives of this experimentation project is improving the layout to graphics rendering - to optimize for power efficiency and maximize parallelism. &amp;lt;ref&amp;gt; https://www.mozilla.org/en-US/research/projects/ &amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Developer Environment Setup &amp;lt;ref&amp;gt;https://github.com/servo/servo/blob/master/README.md&amp;lt;/ref&amp;gt;==&lt;br /&gt;
&lt;br /&gt;
=== Installing Required Packages for Servo ===&lt;br /&gt;
&lt;br /&gt;
On OS X (homebrew):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
brew install automake pkg-config python glfw3 cmake&lt;br /&gt;
pip install virtualenv&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On OS X (MacPorts):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo port install python27 py27-virtualenv cmake&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On Debian-based Linuxes:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo apt-get install curl freeglut3-dev \&lt;br /&gt;
    libfreetype6-dev libgl1-mesa-dri libglib2.0-dev xorg-dev \&lt;br /&gt;
    msttcorefonts gperf g++ cmake python-virtualenv \&lt;br /&gt;
    libssl-dev libglfw-dev&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On Fedora:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo yum install curl freeglut-devel libtool gcc-c++ libXi-devel \&lt;br /&gt;
    freetype-devel mesa-libGL-devel glib2-devel libX11-devel libXrandr-devel gperf \&lt;br /&gt;
    fontconfig-devel cabextract ttmkfdir python python-virtualenv expat-devel \&lt;br /&gt;
    rpm-build openssl-devel glfw-devel cmake&lt;br /&gt;
pushd .&lt;br /&gt;
cd /tmp&lt;br /&gt;
wget http://corefonts.sourceforge.net/msttcorefonts-2.5-1.spec&lt;br /&gt;
rpmbuild -bb msttcorefonts-2.5-1.spec&lt;br /&gt;
sudo yum install $HOME/rpmbuild/RPMS/noarch/msttcorefonts-2.5-1.noarch.rpm&lt;br /&gt;
popd&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On Arch Linux:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo pacman -S base-devel git python2 python2-virtualenv mesa glfw ttf-font cmake&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Building Servo ===&lt;br /&gt;
&lt;br /&gt;
Clone the Servo repository hosted at https://github.com/servo/servo and switch to the working directory.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
git clone https://github.com/servo/servo&lt;br /&gt;
cd servo&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Normal Build'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
./mach build&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Building for Android target'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ANDROID_TOOLCHAIN=/path/to/toolchain ANDROID_NDK=/path/to/ndk PATH=$PATH:/path/to/toolchain/bin ./mach build --android&lt;br /&gt;
cd ports/android&lt;br /&gt;
ANDROID_SDK=/path/to/sdk make install&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;I&amp;gt;Note: Building Servo will take a considerable amount of time. &amp;lt;/I&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Launch Servo ===&lt;br /&gt;
&lt;br /&gt;
Once the build is successful, launch Servo using this command.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
./mach run tests/html/about-mozilla.html&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:servo.png]]&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
&lt;br /&gt;
Web storage and DOM storage (document object model) are web application software methods and protocols used for storing data in a web browser. Web storage supports persistent data storage, similar to cookies but with a greatly enhanced capacity and no information stored in the HTTP request header. There are two main web storage types: local storage and session storage, behaving similarly to persistent cookies and session cookies respectively.&amp;lt;ref&amp;gt; http://en.wikipedia.org/wiki/Web_storage &amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Browsers that support web storage have the global variables 'sessionStorage' and 'localStorage' declared at the window level. The following JavaScript code can be used on browsers to trigger web storage behaviour:&lt;br /&gt;
&lt;br /&gt;
'''sessionStorage'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Store value on browser for duration of the session&lt;br /&gt;
sessionStorage.setItem('key', 'value');&lt;br /&gt;
 &lt;br /&gt;
// Retrieve value (gets deleted when browser is closed and re-opened)&lt;br /&gt;
alert(sessionStorage.getItem('key'));&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''localStorage'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Store value on the browser beyond the duration of the session&lt;br /&gt;
localStorage.setItem('key', 'value');&lt;br /&gt;
 &lt;br /&gt;
// Retrieve value (persists even after closing and re-opening the browser)&lt;br /&gt;
alert(localStorage.getItem('key'));&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Persistent storage on the web is used by many services such as the popular Disqus commenting interface. Implementing this important specification in Servo will allow stateful web applications to run, and will help expose any architectural problems that Servo's radical design may cause. &amp;lt;ref&amp;gt; https://github.com/servo/servo/wiki/Storage-student-project&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
 &lt;br /&gt;
In order to create the Storage inteface and its stub implementation, we made the following changes:&lt;br /&gt;
&lt;br /&gt;
* Created a new file called [http://github.com/nkdalmia/servo/tree/master/components/script/dom/webidls Storage.webidl] under the folder '''''components/script/dom/webidls.'''''&lt;br /&gt;
&lt;br /&gt;
* Added the method definitions in the above interface file.&lt;br /&gt;
&lt;br /&gt;
* Created another file called [http://github.com/nkdalmia/servo/tree/master/components/script/dom storage.rs] under the specified folder '''''components/script/dom.''''' &lt;br /&gt;
&lt;br /&gt;
* Added constructor for Storage object and stub implementations of the methods defined in the above mentioned interface file.&lt;br /&gt;
&lt;br /&gt;
* Added our module entry in the file ''''' components/script/lib.rs ''''' so that our files are compiled as part of the Servo build.&lt;br /&gt;
&lt;br /&gt;
* Built the Servo once again and verified that the Servo browser was launching correctly.&lt;br /&gt;
&lt;br /&gt;
== Future Work &amp;lt;ref&amp;gt; https://github.com/servo/servo/wiki/Storage-student-project &amp;lt;/ref&amp;gt;==&lt;br /&gt;
&lt;br /&gt;
* Create the WindowSessionStorage interface making it return a Storage instance.&lt;br /&gt;
* Create a Storage task which will be used to contain all stored data.&lt;br /&gt;
* Define a message-passing interface for reading and writing stored data for a particular browser tab.&lt;br /&gt;
* Use the Storage task in the implementation of Storage.&lt;br /&gt;
* When the value of a stored data is changed, notify its respective browser tab.&lt;br /&gt;
* Pass as many tests as possible.&lt;br /&gt;
* Implement the WindowLocalStorage interface which behaves slightly different from the WindowSessionStorage interface.&lt;br /&gt;
&lt;br /&gt;
== Further Readings ==&lt;br /&gt;
&lt;br /&gt;
Design and Architecture of Servo: http://github.com/servo/servo/wiki/Design/ &amp;lt;br/&amp;gt;&lt;br /&gt;
Learning Rust by Examples: http://rustbyexample.com/ &amp;lt;br/&amp;gt;&lt;br /&gt;
Javascript as Servo's Garbage Collector: http://blog.mozilla.org/research/2014/08/26/javascript-servos-only-garbage-collector/  &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Aprasad3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/OSS_M1450_vda&amp;diff=91015</id>
		<title>CSC/ECE 517 Fall 2014/OSS M1450 vda</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/OSS_M1450_vda&amp;diff=91015"/>
		<updated>2014-10-30T00:08:44Z</updated>

		<summary type="html">&lt;p&gt;Aprasad3: /* Project Description */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Implement Window.sessionStorage ==&lt;br /&gt;
&lt;br /&gt;
This wiki page contains details on the work done for the initial step of the task &amp;lt;code&amp;gt; [http://github.com/servo/servo/wiki/Storage-student-project Implement Window.sessionStorage] &amp;lt;/code&amp;gt; for the [http://www.mozilla.org/ Mozilla] research project [http://github.com/servo/servo/wiki/Design Servo].&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
=== [http://www.rust-lang.org/ Rust]===&lt;br /&gt;
&lt;br /&gt;
Rust is a modern systems programming language focusing on safety and speed to build reliable and efficient systems &amp;lt;ref&amp;gt; http://doc.rust-lang.org/nightly/intro.html &amp;lt;/ref&amp;gt;. It accomplishes the goals of memory safe without using garbage collection and it supports concurrency and parallelism in building platforms. &lt;br /&gt;
&lt;br /&gt;
Rust’s lightweight task mechanism also promises to allow fine-grained isolation between browser components, such as tabs and extensions, without the need for expensive runtime protection schemes, like operating system process isolation. &amp;lt;ref&amp;gt; https://www.mozilla.org/en-US/research/projects/ &amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== [http://github.com/servo/servo/wiki/Design Servo] ===&lt;br /&gt;
&lt;br /&gt;
Mozilla Research team is currently working on an experimental project to develop a new Web browser engine &amp;quot;Servo&amp;quot;, that is capable of supporting a variety of current and next generation of hardware like mobile devices, multi-core processors and high-performance GPUs. Servo builds on top of Rust to provide a secure and reliable foundation. It is currently developed on 64 bit devices.&amp;lt;ref&amp;gt; https://www.mozilla.org/en-US/research/projects/ &amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The main objectives of this experimentation project is improving the layout to graphics rendering - to optimize for power efficiency and maximize parallelism. &amp;lt;ref&amp;gt; https://www.mozilla.org/en-US/research/projects/ &amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Developer Environment Setup &amp;lt;ref&amp;gt;https://github.com/servo/servo/blob/master/README.md&amp;lt;/ref&amp;gt;==&lt;br /&gt;
&lt;br /&gt;
=== Installing Required Packages for Servo ===&lt;br /&gt;
&lt;br /&gt;
On OS X (homebrew):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
brew install automake pkg-config python glfw3 cmake&lt;br /&gt;
pip install virtualenv&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On OS X (MacPorts):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo port install python27 py27-virtualenv cmake&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On Debian-based Linuxes:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo apt-get install curl freeglut3-dev \&lt;br /&gt;
    libfreetype6-dev libgl1-mesa-dri libglib2.0-dev xorg-dev \&lt;br /&gt;
    msttcorefonts gperf g++ cmake python-virtualenv \&lt;br /&gt;
    libssl-dev libglfw-dev&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On Fedora:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo yum install curl freeglut-devel libtool gcc-c++ libXi-devel \&lt;br /&gt;
    freetype-devel mesa-libGL-devel glib2-devel libX11-devel libXrandr-devel gperf \&lt;br /&gt;
    fontconfig-devel cabextract ttmkfdir python python-virtualenv expat-devel \&lt;br /&gt;
    rpm-build openssl-devel glfw-devel cmake&lt;br /&gt;
pushd .&lt;br /&gt;
cd /tmp&lt;br /&gt;
wget http://corefonts.sourceforge.net/msttcorefonts-2.5-1.spec&lt;br /&gt;
rpmbuild -bb msttcorefonts-2.5-1.spec&lt;br /&gt;
sudo yum install $HOME/rpmbuild/RPMS/noarch/msttcorefonts-2.5-1.noarch.rpm&lt;br /&gt;
popd&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On Arch Linux:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo pacman -S base-devel git python2 python2-virtualenv mesa glfw ttf-font cmake&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Building Servo ===&lt;br /&gt;
&lt;br /&gt;
Clone the Servo repository hosted at https://github.com/servo/servo and switch to the working directory.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
git clone https://github.com/servo/servo&lt;br /&gt;
cd servo&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Normal Build'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
./mach build&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Building for Android target'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ANDROID_TOOLCHAIN=/path/to/toolchain ANDROID_NDK=/path/to/ndk PATH=$PATH:/path/to/toolchain/bin ./mach build --android&lt;br /&gt;
cd ports/android&lt;br /&gt;
ANDROID_SDK=/path/to/sdk make install&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;I&amp;gt;Note: Building Servo will take a considerable amount of time. &amp;lt;/I&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Launch Servo ===&lt;br /&gt;
&lt;br /&gt;
Once the build is successful, launch Servo using this command.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
./mach run tests/html/about-mozilla.html&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:servo.png]]&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
&lt;br /&gt;
Web storage and DOM storage (document object model) are web application software methods and protocols used for storing data in a web browser. Web storage supports persistent data storage, similar to cookies but with a greatly enhanced capacity and no information stored in the HTTP request header. There are two main web storage types: local storage and session storage, behaving similarly to persistent cookies and session cookies respectively.&amp;lt;ref&amp;gt; http://en.wikipedia.org/wiki/Web_storage &amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Browsers that support web storage have the global variables 'sessionStorage' and 'localStorage' declared at the window level. The following JavaScript code can be used on these browsers to trigger web storage behaviour:&lt;br /&gt;
&lt;br /&gt;
'''sessionStorage'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Store value on browser for duration of the session&lt;br /&gt;
sessionStorage.setItem('key', 'value');&lt;br /&gt;
 &lt;br /&gt;
// Retrieve value (gets deleted when browser is closed and re-opened)&lt;br /&gt;
alert(sessionStorage.getItem('key'));&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''localStorage'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Store value on the browser beyond the duration of the session&lt;br /&gt;
localStorage.setItem('key', 'value');&lt;br /&gt;
 &lt;br /&gt;
// Retrieve value (persists even after closing and re-opening the browser)&lt;br /&gt;
alert(localStorage.getItem('key'));&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Persistent storage on the web is used by many services such as the popular Disqus commenting interface. Implementing this important specification in Servo will allow stateful web applications to run, and will help expose any architectural problems that Servo's radical design may cause. &amp;lt;ref&amp;gt; https://github.com/servo/servo/wiki/Storage-student-project&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
 &lt;br /&gt;
In order to create the Storage inteface and its stub implementation, we made the following changes:&lt;br /&gt;
&lt;br /&gt;
* Created a new file called [http://github.com/nkdalmia/servo/tree/master/components/script/dom/webidls Storage.webidl] under the folder '''''components/script/dom/webidls.'''''&lt;br /&gt;
&lt;br /&gt;
* Added the method definitions in the above interface file.&lt;br /&gt;
&lt;br /&gt;
* Created another file called [http://github.com/nkdalmia/servo/tree/master/components/script/dom storage.rs] under the specified folder '''''components/script/dom.''''' &lt;br /&gt;
&lt;br /&gt;
* Added constructor for Storage object and stub implementations of the methods defined in the above mentioned interface file.&lt;br /&gt;
&lt;br /&gt;
* Added our module entry in the file ''''' components/script/lib.rs ''''' so that our files are compiled as part of the Servo build.&lt;br /&gt;
&lt;br /&gt;
* Built the Servo once again and verified that the Servo browser was launching correctly.&lt;br /&gt;
&lt;br /&gt;
== Future Work &amp;lt;ref&amp;gt; https://github.com/servo/servo/wiki/Storage-student-project &amp;lt;/ref&amp;gt;==&lt;br /&gt;
&lt;br /&gt;
* Create the WindowSessionStorage interface making it return a Storage instance.&lt;br /&gt;
* Create a Storage task which will be used to contain all stored data.&lt;br /&gt;
* Define a message-passing interface for reading and writing stored data for a particular browser tab.&lt;br /&gt;
* Use the Storage task in the implementation of Storage.&lt;br /&gt;
* When the value of a stored data is changed, notify its respective browser tab.&lt;br /&gt;
* Pass as many tests as possible.&lt;br /&gt;
* Implement the WindowLocalStorage interface which behaves slightly different from the WindowSessionStorage interface.&lt;br /&gt;
&lt;br /&gt;
== Further Readings ==&lt;br /&gt;
&lt;br /&gt;
Design and Architecture of Servo: http://github.com/servo/servo/wiki/Design/ &amp;lt;br/&amp;gt;&lt;br /&gt;
Learning Rust by Examples: http://rustbyexample.com/ &amp;lt;br/&amp;gt;&lt;br /&gt;
Javascript as Servo's Garbage Collector: http://blog.mozilla.org/research/2014/08/26/javascript-servos-only-garbage-collector/  &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Aprasad3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/OSS_M1450_vda&amp;diff=91014</id>
		<title>CSC/ECE 517 Fall 2014/OSS M1450 vda</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/OSS_M1450_vda&amp;diff=91014"/>
		<updated>2014-10-30T00:08:01Z</updated>

		<summary type="html">&lt;p&gt;Aprasad3: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Implement Window.sessionStorage ==&lt;br /&gt;
&lt;br /&gt;
This wiki page contains details on the work done for the initial step of the task &amp;lt;code&amp;gt; [http://github.com/servo/servo/wiki/Storage-student-project Implement Window.sessionStorage] &amp;lt;/code&amp;gt; for the [http://www.mozilla.org/ Mozilla] research project [http://github.com/servo/servo/wiki/Design Servo].&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
=== [http://www.rust-lang.org/ Rust]===&lt;br /&gt;
&lt;br /&gt;
Rust is a modern systems programming language focusing on safety and speed to build reliable and efficient systems &amp;lt;ref&amp;gt; http://doc.rust-lang.org/nightly/intro.html &amp;lt;/ref&amp;gt;. It accomplishes the goals of memory safe without using garbage collection and it supports concurrency and parallelism in building platforms. &lt;br /&gt;
&lt;br /&gt;
Rust’s lightweight task mechanism also promises to allow fine-grained isolation between browser components, such as tabs and extensions, without the need for expensive runtime protection schemes, like operating system process isolation. &amp;lt;ref&amp;gt; https://www.mozilla.org/en-US/research/projects/ &amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== [http://github.com/servo/servo/wiki/Design Servo] ===&lt;br /&gt;
&lt;br /&gt;
Mozilla Research team is currently working on an experimental project to develop a new Web browser engine &amp;quot;Servo&amp;quot;, that is capable of supporting a variety of current and next generation of hardware like mobile devices, multi-core processors and high-performance GPUs. Servo builds on top of Rust to provide a secure and reliable foundation. It is currently developed on 64 bit devices.&amp;lt;ref&amp;gt; https://www.mozilla.org/en-US/research/projects/ &amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The main objectives of this experimentation project is improving the layout to graphics rendering - to optimize for power efficiency and maximize parallelism. &amp;lt;ref&amp;gt; https://www.mozilla.org/en-US/research/projects/ &amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Developer Environment Setup &amp;lt;ref&amp;gt;https://github.com/servo/servo/blob/master/README.md&amp;lt;/ref&amp;gt;==&lt;br /&gt;
&lt;br /&gt;
=== Installing Required Packages for Servo ===&lt;br /&gt;
&lt;br /&gt;
On OS X (homebrew):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
brew install automake pkg-config python glfw3 cmake&lt;br /&gt;
pip install virtualenv&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On OS X (MacPorts):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo port install python27 py27-virtualenv cmake&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On Debian-based Linuxes:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo apt-get install curl freeglut3-dev \&lt;br /&gt;
    libfreetype6-dev libgl1-mesa-dri libglib2.0-dev xorg-dev \&lt;br /&gt;
    msttcorefonts gperf g++ cmake python-virtualenv \&lt;br /&gt;
    libssl-dev libglfw-dev&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On Fedora:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo yum install curl freeglut-devel libtool gcc-c++ libXi-devel \&lt;br /&gt;
    freetype-devel mesa-libGL-devel glib2-devel libX11-devel libXrandr-devel gperf \&lt;br /&gt;
    fontconfig-devel cabextract ttmkfdir python python-virtualenv expat-devel \&lt;br /&gt;
    rpm-build openssl-devel glfw-devel cmake&lt;br /&gt;
pushd .&lt;br /&gt;
cd /tmp&lt;br /&gt;
wget http://corefonts.sourceforge.net/msttcorefonts-2.5-1.spec&lt;br /&gt;
rpmbuild -bb msttcorefonts-2.5-1.spec&lt;br /&gt;
sudo yum install $HOME/rpmbuild/RPMS/noarch/msttcorefonts-2.5-1.noarch.rpm&lt;br /&gt;
popd&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On Arch Linux:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo pacman -S base-devel git python2 python2-virtualenv mesa glfw ttf-font cmake&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Building Servo ===&lt;br /&gt;
&lt;br /&gt;
Clone the Servo repository hosted at https://github.com/servo/servo and switch to the working directory.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
git clone https://github.com/servo/servo&lt;br /&gt;
cd servo&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Normal Build'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
./mach build&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Building for Android target'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ANDROID_TOOLCHAIN=/path/to/toolchain ANDROID_NDK=/path/to/ndk PATH=$PATH:/path/to/toolchain/bin ./mach build --android&lt;br /&gt;
cd ports/android&lt;br /&gt;
ANDROID_SDK=/path/to/sdk make install&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;I&amp;gt;Note: Building Servo will take a considerable amount of time. &amp;lt;/I&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Launch Servo ===&lt;br /&gt;
&lt;br /&gt;
Once the build is successful, launch Servo using this command.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
./mach run tests/html/about-mozilla.html&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:servo.png]]&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
&lt;br /&gt;
Web storage and DOM storage (document object model) are web application software methods and protocols used for storing data in a web browser. Web storage supports persistent data storage, similar to cookies but with a greatly enhanced capacity and no information stored in the HTTP request header. There are two main web storage types: local storage and session storage, behaving similarly to persistent cookies and session cookies respectively.&amp;lt;ref&amp;gt; http://en.wikipedia.org/wiki/Web_storage &amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Browsers that support web storage have the global variables 'sessionStorage' and 'localStorage' declared at the window level. The following JavaScript code can be used on these browsers to trigger web storage behaviour:&lt;br /&gt;
&lt;br /&gt;
'''sessionStorage'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Store value on browser for duration of the session&lt;br /&gt;
sessionStorage.setItem('key', 'value');&lt;br /&gt;
 &lt;br /&gt;
// Retrieve value (gets deleted when browser is closed and re-opened)&lt;br /&gt;
alert(sessionStorage.getItem('key'));&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''localStorage'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Store value on the browser beyond the duration of the session&lt;br /&gt;
localStorage.setItem('key', 'value');&lt;br /&gt;
 &lt;br /&gt;
// Retrieve value (persists even after closing and re-opening the browser)&lt;br /&gt;
alert(localStorage.getItem('key'));&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
 &lt;br /&gt;
In order to create the Storage inteface and its stub implementation, we made the following changes:&lt;br /&gt;
&lt;br /&gt;
* Created a new file called [http://github.com/nkdalmia/servo/tree/master/components/script/dom/webidls Storage.webidl] under the folder '''''components/script/dom/webidls.'''''&lt;br /&gt;
&lt;br /&gt;
* Added the method definitions in the above interface file.&lt;br /&gt;
&lt;br /&gt;
* Created another file called [http://github.com/nkdalmia/servo/tree/master/components/script/dom storage.rs] under the specified folder '''''components/script/dom.''''' &lt;br /&gt;
&lt;br /&gt;
* Added constructor for Storage object and stub implementations of the methods defined in the above mentioned interface file.&lt;br /&gt;
&lt;br /&gt;
* Added our module entry in the file ''''' components/script/lib.rs ''''' so that our files are compiled as part of the Servo build.&lt;br /&gt;
&lt;br /&gt;
* Built the Servo once again and verified that the Servo browser was launching correctly.&lt;br /&gt;
&lt;br /&gt;
== Future Work &amp;lt;ref&amp;gt; https://github.com/servo/servo/wiki/Storage-student-project &amp;lt;/ref&amp;gt;==&lt;br /&gt;
&lt;br /&gt;
* Create the WindowSessionStorage interface making it return a Storage instance.&lt;br /&gt;
* Create a Storage task which will be used to contain all stored data.&lt;br /&gt;
* Define a message-passing interface for reading and writing stored data for a particular browser tab.&lt;br /&gt;
* Use the Storage task in the implementation of Storage.&lt;br /&gt;
* When the value of a stored data is changed, notify its respective browser tab.&lt;br /&gt;
* Pass as many tests as possible.&lt;br /&gt;
* Implement the WindowLocalStorage interface which behaves slightly different from the WindowSessionStorage interface.&lt;br /&gt;
&lt;br /&gt;
== Further Readings ==&lt;br /&gt;
&lt;br /&gt;
Design and Architecture of Servo: http://github.com/servo/servo/wiki/Design/ &amp;lt;br/&amp;gt;&lt;br /&gt;
Learning Rust by Examples: http://rustbyexample.com/ &amp;lt;br/&amp;gt;&lt;br /&gt;
Javascript as Servo's Garbage Collector: http://blog.mozilla.org/research/2014/08/26/javascript-servos-only-garbage-collector/  &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Aprasad3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/OSS_M1450_vda&amp;diff=91012</id>
		<title>CSC/ECE 517 Fall 2014/OSS M1450 vda</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/OSS_M1450_vda&amp;diff=91012"/>
		<updated>2014-10-30T00:06:34Z</updated>

		<summary type="html">&lt;p&gt;Aprasad3: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Implement Window.sessionStorage ==&lt;br /&gt;
&lt;br /&gt;
This wiki page contains details on the work done for the initial step of the task &amp;lt;code&amp;gt; [http://github.com/servo/servo/wiki/Storage-student-project Implement Window.sessionStorage] &amp;lt;/code&amp;gt; for the [http://www.mozilla.org/ Mozilla] research project [http://github.com/servo/servo/wiki/Design Servo].&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
=== [http://www.rust-lang.org/ Rust]===&lt;br /&gt;
&lt;br /&gt;
Rust is a modern systems programming language focusing on safety and speed to build reliable and efficient systems &amp;lt;ref&amp;gt; http://doc.rust-lang.org/nightly/intro.html &amp;lt;/ref&amp;gt;. It accomplishes the goals of memory safe without using garbage collection and it supports concurrency and parallelism in building platforms. &lt;br /&gt;
&lt;br /&gt;
Rust’s lightweight task mechanism also promises to allow fine-grained isolation between browser components, such as tabs and extensions, without the need for expensive runtime protection schemes, like operating system process isolation. &amp;lt;ref&amp;gt; https://www.mozilla.org/en-US/research/projects/ &amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== [http://github.com/servo/servo/wiki/Design Servo] ===&lt;br /&gt;
&lt;br /&gt;
Mozilla Research team is currently working on an experimental project to develop a new Web browser engine &amp;quot;Servo&amp;quot;, that is capable of supporting a variety of current and next generation of hardware like mobile devices, multi-core processors and high-performance GPUs. Servo builds on top of Rust to provide a secure and reliable foundation. It is currently developed on 64 bit devices.&amp;lt;ref&amp;gt; https://www.mozilla.org/en-US/research/projects/ &amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The main objectives of this experimentation project is improving the layout to graphics rendering - to optimize for power efficiency and maximize parallelism. &amp;lt;ref&amp;gt; https://www.mozilla.org/en-US/research/projects/ &amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Developer Environment Setup &amp;lt;ref&amp;gt;https://github.com/servo/servo/blob/master/README.md&amp;lt;/ref&amp;gt;==&lt;br /&gt;
&lt;br /&gt;
=== Installing Required Packages for Servo ===&lt;br /&gt;
&lt;br /&gt;
On OS X (homebrew):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
brew install automake pkg-config python glfw3 cmake&lt;br /&gt;
pip install virtualenv&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On OS X (MacPorts):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo port install python27 py27-virtualenv cmake&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On Debian-based Linuxes:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo apt-get install curl freeglut3-dev \&lt;br /&gt;
    libfreetype6-dev libgl1-mesa-dri libglib2.0-dev xorg-dev \&lt;br /&gt;
    msttcorefonts gperf g++ cmake python-virtualenv \&lt;br /&gt;
    libssl-dev libglfw-dev&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On Fedora:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo yum install curl freeglut-devel libtool gcc-c++ libXi-devel \&lt;br /&gt;
    freetype-devel mesa-libGL-devel glib2-devel libX11-devel libXrandr-devel gperf \&lt;br /&gt;
    fontconfig-devel cabextract ttmkfdir python python-virtualenv expat-devel \&lt;br /&gt;
    rpm-build openssl-devel glfw-devel cmake&lt;br /&gt;
pushd .&lt;br /&gt;
cd /tmp&lt;br /&gt;
wget http://corefonts.sourceforge.net/msttcorefonts-2.5-1.spec&lt;br /&gt;
rpmbuild -bb msttcorefonts-2.5-1.spec&lt;br /&gt;
sudo yum install $HOME/rpmbuild/RPMS/noarch/msttcorefonts-2.5-1.noarch.rpm&lt;br /&gt;
popd&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On Arch Linux:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo pacman -S base-devel git python2 python2-virtualenv mesa glfw ttf-font cmake&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Building Servo ===&lt;br /&gt;
&lt;br /&gt;
Clone the Servo repository hosted at https://github.com/servo/servo and switch to the working directory.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
git clone https://github.com/servo/servo&lt;br /&gt;
cd servo&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Normal Build'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
./mach build&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Building for Android target'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ANDROID_TOOLCHAIN=/path/to/toolchain ANDROID_NDK=/path/to/ndk PATH=$PATH:/path/to/toolchain/bin ./mach build --android&lt;br /&gt;
cd ports/android&lt;br /&gt;
ANDROID_SDK=/path/to/sdk make install&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;I&amp;gt;Note: Building Servo will take a considerable amount of time. &amp;lt;/I&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Launch Servo ===&lt;br /&gt;
&lt;br /&gt;
Once the build is successful, launch Servo using this command.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
./mach run tests/html/about-mozilla.html&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:servo.png]]&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
&lt;br /&gt;
Web storage and DOM storage (document object model) are web application software methods and protocols used for storing data in a web browser. Web storage supports persistent data storage, similar to cookies but with a greatly enhanced capacity and no information stored in the HTTP request header. There are two main web storage types: local storage and session storage, behaving similarly to persistent cookies and session cookies respectively.&lt;br /&gt;
&lt;br /&gt;
Browsers that support web storage have the global variables 'sessionStorage' and 'localStorage' declared at the window level. The following JavaScript code can be used on these browsers to trigger web storage behaviour:&lt;br /&gt;
&lt;br /&gt;
'''sessionStorage'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Store value on browser for duration of the session&lt;br /&gt;
sessionStorage.setItem('key', 'value');&lt;br /&gt;
 &lt;br /&gt;
// Retrieve value (gets deleted when browser is closed and re-opened)&lt;br /&gt;
alert(sessionStorage.getItem('key'));&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''localStorage'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Store value on the browser beyond the duration of the session&lt;br /&gt;
localStorage.setItem('key', 'value');&lt;br /&gt;
 &lt;br /&gt;
// Retrieve value (persists even after closing and re-opening the browser)&lt;br /&gt;
alert(localStorage.getItem('key'));&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
 &lt;br /&gt;
In order to create the Storage inteface and its stub implementation, we made the following changes:&lt;br /&gt;
&lt;br /&gt;
* Created a new file called [http://github.com/nkdalmia/servo/tree/master/components/script/dom/webidls Storage.webidl] under the folder '''''components/script/dom/webidls.'''''&lt;br /&gt;
&lt;br /&gt;
* Added the method definitions in the above interface file.&lt;br /&gt;
&lt;br /&gt;
* Created another file called [http://github.com/nkdalmia/servo/tree/master/components/script/dom storage.rs] under the specified folder '''''components/script/dom.''''' &lt;br /&gt;
&lt;br /&gt;
* Added constructor for Storage object and stub implementations of the methods defined in the above mentioned interface file.&lt;br /&gt;
&lt;br /&gt;
* Added our module entry in the file ''''' components/script/lib.rs ''''' so that our files are compiled as part of the Servo build.&lt;br /&gt;
&lt;br /&gt;
* Built the Servo once again and verified that the Servo browser was launching correctly.&lt;br /&gt;
&lt;br /&gt;
== Future Work &amp;lt;ref&amp;gt; https://github.com/servo/servo/wiki/Storage-student-project &amp;lt;/ref&amp;gt;==&lt;br /&gt;
&lt;br /&gt;
* Create the WindowSessionStorage interface making it return a Storage instance.&lt;br /&gt;
* Create a Storage task which will be used to contain all stored data.&lt;br /&gt;
* Define a message-passing interface for reading and writing stored data for a particular browser tab.&lt;br /&gt;
* Use the Storage task in the implementation of Storage.&lt;br /&gt;
* When the value of a stored data is changed, notify its respective browser tab.&lt;br /&gt;
* Pass as many tests as possible.&lt;br /&gt;
* Implement the WindowLocalStorage interface which behaves slightly different from the WindowSessionStorage interface.&lt;br /&gt;
&lt;br /&gt;
== Further Readings ==&lt;br /&gt;
&lt;br /&gt;
Design and Architecture of Servo: http://github.com/servo/servo/wiki/Design/ &amp;lt;br/&amp;gt;&lt;br /&gt;
Learning Rust by Examples: http://rustbyexample.com/ &amp;lt;br/&amp;gt;&lt;br /&gt;
Javascript as Servo's Garbage Collector: http://blog.mozilla.org/research/2014/08/26/javascript-servos-only-garbage-collector/  &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Aprasad3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/OSS_M1450_vda&amp;diff=91011</id>
		<title>CSC/ECE 517 Fall 2014/OSS M1450 vda</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/OSS_M1450_vda&amp;diff=91011"/>
		<updated>2014-10-30T00:05:25Z</updated>

		<summary type="html">&lt;p&gt;Aprasad3: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Implement Window.sessionStorage ==&lt;br /&gt;
&lt;br /&gt;
This wiki page contains details on the work done for the initial step of the task &amp;lt;code&amp;gt; [http://github.com/servo/servo/wiki/Storage-student-project Implement Window.sessionStorage] &amp;lt;/code&amp;gt; for the [http://www.mozilla.org/ Mozilla] research project [http://github.com/servo/servo/wiki/Design Servo].&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
=== [http://www.rust-lang.org/ Rust]===&lt;br /&gt;
&lt;br /&gt;
Rust is a modern systems programming language focusing on safety and speed to build reliable and efficient systems &amp;lt;ref&amp;gt; http://doc.rust-lang.org/nightly/intro.html &amp;lt;/ref&amp;gt;. It accomplishes the goals of memory safe without using garbage collection and it supports concurrency and parallelism in building platforms. &lt;br /&gt;
&lt;br /&gt;
Rust’s lightweight task mechanism also promises to allow fine-grained isolation between browser components, such as tabs and extensions, without the need for expensive runtime protection schemes, like operating system process isolation. &amp;lt;ref&amp;gt; https://www.mozilla.org/en-US/research/projects/ &amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== [http://github.com/servo/servo/wiki/Design Servo] ===&lt;br /&gt;
&lt;br /&gt;
Mozilla Research team is currently working on an experimental project to develop a new Web browser engine &amp;quot;Servo&amp;quot;, that is capable of supporting a variety of current and next generation of hardware like mobile devices, multi-core processors and high-performance GPUs. Servo builds on top of Rust to provide a secure and reliable foundation. It is currently developed on 64 bit devices.&amp;lt;ref&amp;gt; https://www.mozilla.org/en-US/research/projects/ &amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The main objectives of this experimentation project is improving the layout to graphics rendering - to optimize for power efficiency and maximize parallelism. &amp;lt;ref&amp;gt; https://www.mozilla.org/en-US/research/projects/ &amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Developer Environment Setup &amp;lt;ref&amp;gt;https://github.com/servo/servo/blob/master/README.md&amp;lt;/ref&amp;gt;==&lt;br /&gt;
&lt;br /&gt;
=== Installing Required Packages for Servo ===&lt;br /&gt;
&lt;br /&gt;
On OS X (homebrew):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
brew install automake pkg-config python glfw3 cmake&lt;br /&gt;
pip install virtualenv&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On OS X (MacPorts):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo port install python27 py27-virtualenv cmake&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On Debian-based Linuxes:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo apt-get install curl freeglut3-dev \&lt;br /&gt;
    libfreetype6-dev libgl1-mesa-dri libglib2.0-dev xorg-dev \&lt;br /&gt;
    msttcorefonts gperf g++ cmake python-virtualenv \&lt;br /&gt;
    libssl-dev libglfw-dev&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On Fedora:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo yum install curl freeglut-devel libtool gcc-c++ libXi-devel \&lt;br /&gt;
    freetype-devel mesa-libGL-devel glib2-devel libX11-devel libXrandr-devel gperf \&lt;br /&gt;
    fontconfig-devel cabextract ttmkfdir python python-virtualenv expat-devel \&lt;br /&gt;
    rpm-build openssl-devel glfw-devel cmake&lt;br /&gt;
pushd .&lt;br /&gt;
cd /tmp&lt;br /&gt;
wget http://corefonts.sourceforge.net/msttcorefonts-2.5-1.spec&lt;br /&gt;
rpmbuild -bb msttcorefonts-2.5-1.spec&lt;br /&gt;
sudo yum install $HOME/rpmbuild/RPMS/noarch/msttcorefonts-2.5-1.noarch.rpm&lt;br /&gt;
popd&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On Arch Linux:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo pacman -S base-devel git python2 python2-virtualenv mesa glfw ttf-font cmake&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Building Servo ===&lt;br /&gt;
&lt;br /&gt;
Clone the Servo repository hosted at https://github.com/servo/servo and switch to the working directory.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
git clone https://github.com/servo/servo&lt;br /&gt;
cd servo&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Normal Build'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
./mach build&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Building for Android target'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ANDROID_TOOLCHAIN=/path/to/toolchain ANDROID_NDK=/path/to/ndk PATH=$PATH:/path/to/toolchain/bin ./mach build --android&lt;br /&gt;
cd ports/android&lt;br /&gt;
ANDROID_SDK=/path/to/sdk make install&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;I&amp;gt;Note: Building Servo will take a considerable amount of time. &amp;lt;/I&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Launch Servo ===&lt;br /&gt;
&lt;br /&gt;
Once the build is successful, launch Servo using this command.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
./mach run tests/html/about-mozilla.html&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:servo.png]]&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
&lt;br /&gt;
== Persistent Storage==&lt;br /&gt;
&lt;br /&gt;
Web storage and DOM storage (document object model) are web application software methods and protocols used for storing data in a web browser. Web storage supports persistent data storage, similar to cookies but with a greatly enhanced capacity and no information stored in the HTTP request header. There are two main web storage types: local storage and session storage, behaving similarly to persistent cookies and session cookies respectively.&lt;br /&gt;
&lt;br /&gt;
Browsers that support web storage have the global variables 'sessionStorage' and 'localStorage' declared at the window level. The following JavaScript code can be used on these browsers to trigger web storage behaviour:&lt;br /&gt;
&lt;br /&gt;
'''sessionStorage'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Store value on browser for duration of the session&lt;br /&gt;
sessionStorage.setItem('key', 'value');&lt;br /&gt;
 &lt;br /&gt;
// Retrieve value (gets deleted when browser is closed and re-opened)&lt;br /&gt;
alert(sessionStorage.getItem('key'));&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''localStorage'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Store value on the browser beyond the duration of the session&lt;br /&gt;
localStorage.setItem('key', 'value');&lt;br /&gt;
 &lt;br /&gt;
// Retrieve value (persists even after closing and re-opening the browser)&lt;br /&gt;
alert(localStorage.getItem('key'));&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
 &lt;br /&gt;
In order to create the Storage inteface and its stub implementation, we made the following changes:&lt;br /&gt;
&lt;br /&gt;
* Created a new file called [http://github.com/nkdalmia/servo/tree/master/components/script/dom/webidls Storage.webidl] under the folder '''''components/script/dom/webidls.'''''&lt;br /&gt;
&lt;br /&gt;
* Added the method definitions in the above interface file.&lt;br /&gt;
&lt;br /&gt;
* Created another file called [http://github.com/nkdalmia/servo/tree/master/components/script/dom storage.rs] under the specified folder '''''components/script/dom.''''' &lt;br /&gt;
&lt;br /&gt;
* Added constructor for Storage object and stub implementations of the methods defined in the above mentioned interface file.&lt;br /&gt;
&lt;br /&gt;
* Added our module entry in the file ''''' components/script/lib.rs ''''' so that our files are compiled as part of the Servo build.&lt;br /&gt;
&lt;br /&gt;
* Built the Servo once again and verified that the Servo browser was launching correctly.&lt;br /&gt;
&lt;br /&gt;
== Future Work &amp;lt;ref&amp;gt; https://github.com/servo/servo/wiki/Storage-student-project &amp;lt;/ref&amp;gt;==&lt;br /&gt;
&lt;br /&gt;
* Create the WindowSessionStorage interface making it return a Storage instance.&lt;br /&gt;
* Create a Storage task which will be used to contain all stored data.&lt;br /&gt;
* Define a message-passing interface for reading and writing stored data for a particular browser tab.&lt;br /&gt;
* Use the Storage task in the implementation of Storage.&lt;br /&gt;
* When the value of a stored data is changed, notify its respective browser tab.&lt;br /&gt;
* Pass as many tests as possible.&lt;br /&gt;
* Implement the WindowLocalStorage interface which behaves slightly different from the WindowSessionStorage interface.&lt;br /&gt;
&lt;br /&gt;
== Further Readings ==&lt;br /&gt;
&lt;br /&gt;
Design and Architecture of Servo: http://github.com/servo/servo/wiki/Design/ &amp;lt;br/&amp;gt;&lt;br /&gt;
Learning Rust by Examples: http://rustbyexample.com/ &amp;lt;br/&amp;gt;&lt;br /&gt;
Javascript as Servo's Garbage Collector: http://blog.mozilla.org/research/2014/08/26/javascript-servos-only-garbage-collector/  &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Aprasad3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/OSS_M1450_vda&amp;diff=91010</id>
		<title>CSC/ECE 517 Fall 2014/OSS M1450 vda</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/OSS_M1450_vda&amp;diff=91010"/>
		<updated>2014-10-30T00:04:33Z</updated>

		<summary type="html">&lt;p&gt;Aprasad3: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Implement Window.sessionStorage ==&lt;br /&gt;
&lt;br /&gt;
This wiki page contains details on the work done for the initial step of the task &amp;lt;code&amp;gt; [http://github.com/servo/servo/wiki/Storage-student-project Implement Window.sessionStorage] &amp;lt;/code&amp;gt; for the [http://www.mozilla.org/ Mozilla] research project [http://github.com/servo/servo/wiki/Design Servo].&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
=== [http://www.rust-lang.org/ Rust]===&lt;br /&gt;
&lt;br /&gt;
Rust is a modern systems programming language focusing on safety and speed to build reliable and efficient systems &amp;lt;ref&amp;gt; http://doc.rust-lang.org/nightly/intro.html &amp;lt;/ref&amp;gt;. It accomplishes the goals of memory safe without using garbage collection and it supports concurrency and parallelism in building platforms. &lt;br /&gt;
&lt;br /&gt;
Rust’s lightweight task mechanism also promises to allow fine-grained isolation between browser components, such as tabs and extensions, without the need for expensive runtime protection schemes, like operating system process isolation. &amp;lt;ref&amp;gt; https://www.mozilla.org/en-US/research/projects/ &amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== [http://github.com/servo/servo/wiki/Design Servo] ===&lt;br /&gt;
&lt;br /&gt;
Mozilla Research team is currently working on an experimental project to develop a new Web browser engine &amp;quot;Servo&amp;quot;, that is capable of supporting a variety of current and next generation of hardware like mobile devices, multi-core processors and high-performance GPUs. Servo builds on top of Rust to provide a secure and reliable foundation. It is currently developed on 64 bit devices.&amp;lt;ref&amp;gt; https://www.mozilla.org/en-US/research/projects/ &amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The main objectives of this experimentation project is improving the layout to graphics rendering - to optimize for power efficiency and maximize parallelism. &amp;lt;ref&amp;gt; https://www.mozilla.org/en-US/research/projects/ &amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Developer Environment Setup &amp;lt;ref&amp;gt;https://github.com/servo/servo/blob/master/README.md&amp;lt;/ref&amp;gt;==&lt;br /&gt;
&lt;br /&gt;
=== Installing Required Packages for Servo ===&lt;br /&gt;
&lt;br /&gt;
On OS X (homebrew):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
brew install automake pkg-config python glfw3 cmake&lt;br /&gt;
pip install virtualenv&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On OS X (MacPorts):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo port install python27 py27-virtualenv cmake&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On Debian-based Linuxes:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo apt-get install curl freeglut3-dev \&lt;br /&gt;
    libfreetype6-dev libgl1-mesa-dri libglib2.0-dev xorg-dev \&lt;br /&gt;
    msttcorefonts gperf g++ cmake python-virtualenv \&lt;br /&gt;
    libssl-dev libglfw-dev&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On Fedora:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo yum install curl freeglut-devel libtool gcc-c++ libXi-devel \&lt;br /&gt;
    freetype-devel mesa-libGL-devel glib2-devel libX11-devel libXrandr-devel gperf \&lt;br /&gt;
    fontconfig-devel cabextract ttmkfdir python python-virtualenv expat-devel \&lt;br /&gt;
    rpm-build openssl-devel glfw-devel cmake&lt;br /&gt;
pushd .&lt;br /&gt;
cd /tmp&lt;br /&gt;
wget http://corefonts.sourceforge.net/msttcorefonts-2.5-1.spec&lt;br /&gt;
rpmbuild -bb msttcorefonts-2.5-1.spec&lt;br /&gt;
sudo yum install $HOME/rpmbuild/RPMS/noarch/msttcorefonts-2.5-1.noarch.rpm&lt;br /&gt;
popd&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On Arch Linux:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo pacman -S base-devel git python2 python2-virtualenv mesa glfw ttf-font cmake&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Building Servo ===&lt;br /&gt;
&lt;br /&gt;
Clone the Servo repository hosted at https://github.com/servo/servo and switch to the working directory.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
git clone https://github.com/servo/servo&lt;br /&gt;
cd servo&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Normal Build'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
./mach build&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Building for Android target'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ANDROID_TOOLCHAIN=/path/to/toolchain ANDROID_NDK=/path/to/ndk PATH=$PATH:/path/to/toolchain/bin ./mach build --android&lt;br /&gt;
cd ports/android&lt;br /&gt;
ANDROID_SDK=/path/to/sdk make install&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;I&amp;gt;Note: Building Servo will take a considerable amount of time. &amp;lt;/I&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Launch Servo ===&lt;br /&gt;
&lt;br /&gt;
Once the build is successful, launch Servo using this command.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
./mach run tests/html/about-mozilla.html&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:servo.png]]&lt;br /&gt;
&lt;br /&gt;
== Project Description ==&lt;br /&gt;
&lt;br /&gt;
== Persistent Storage==&lt;br /&gt;
&lt;br /&gt;
Web storage and DOM storage (document object model) are web application software methods and protocols used for storing data in a web browser. Web storage supports persistent data storage, similar to cookies but with a greatly enhanced capacity and no information stored in the HTTP request header. There are two main web storage types: local storage and session storage, behaving similarly to persistent cookies and session cookies respectively.&lt;br /&gt;
&lt;br /&gt;
Browsers that support web storage have the global variables 'sessionStorage' and 'localStorage' declared at the window level. The following JavaScript code can be used on these browsers to trigger web storage behaviour:&lt;br /&gt;
&lt;br /&gt;
sessionStorage&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Store value on browser for duration of the session&lt;br /&gt;
sessionStorage.setItem('key', 'value');&lt;br /&gt;
 &lt;br /&gt;
// Retrieve value (gets deleted when browser is closed and re-opened)&lt;br /&gt;
alert(sessionStorage.getItem('key'));&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
localStorage&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Store value on the browser beyond the duration of the session&lt;br /&gt;
localStorage.setItem('key', 'value');&lt;br /&gt;
 &lt;br /&gt;
// Retrieve value (persists even after closing and re-opening the browser)&lt;br /&gt;
alert(localStorage.getItem('key'));&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
 &lt;br /&gt;
In order to create the Storage inteface and its stub implementation, we made the following changes:&lt;br /&gt;
&lt;br /&gt;
* Created a new file called [http://github.com/nkdalmia/servo/tree/master/components/script/dom/webidls Storage.webidl] under the folder '''''components/script/dom/webidls.'''''&lt;br /&gt;
&lt;br /&gt;
* Added the method definitions in the above interface file.&lt;br /&gt;
&lt;br /&gt;
* Created another file called [http://github.com/nkdalmia/servo/tree/master/components/script/dom storage.rs] under the specified folder '''''components/script/dom.''''' &lt;br /&gt;
&lt;br /&gt;
* Added constructor for Storage object and stub implementations of the methods defined in the above mentioned interface file.&lt;br /&gt;
&lt;br /&gt;
* Added our module entry in the file ''''' components/script/lib.rs ''''' so that our files are compiled as part of the Servo build.&lt;br /&gt;
&lt;br /&gt;
* Built the Servo once again and verified that the Servo browser was launching correctly.&lt;br /&gt;
&lt;br /&gt;
== Future Work &amp;lt;ref&amp;gt; https://github.com/servo/servo/wiki/Storage-student-project &amp;lt;/ref&amp;gt;==&lt;br /&gt;
&lt;br /&gt;
* Create the WindowSessionStorage interface making it return a Storage instance.&lt;br /&gt;
* Create a Storage task which will be used to contain all stored data.&lt;br /&gt;
* Define a message-passing interface for reading and writing stored data for a particular browser tab.&lt;br /&gt;
* Use the Storage task in the implementation of Storage.&lt;br /&gt;
* When the value of a stored data is changed, notify its respective browser tab.&lt;br /&gt;
* Pass as many tests as possible.&lt;br /&gt;
* Implement the WindowLocalStorage interface which behaves slightly different from the WindowSessionStorage interface.&lt;br /&gt;
&lt;br /&gt;
== Further Readings ==&lt;br /&gt;
&lt;br /&gt;
Design and Architecture of Servo: http://github.com/servo/servo/wiki/Design/ &amp;lt;br/&amp;gt;&lt;br /&gt;
Learning Rust by Examples: http://rustbyexample.com/ &amp;lt;br/&amp;gt;&lt;br /&gt;
Javascript as Servo's Garbage Collector: http://blog.mozilla.org/research/2014/08/26/javascript-servos-only-garbage-collector/  &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Aprasad3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/ch1a_4_wl&amp;diff=88667</id>
		<title>CSC/ECE 517 Fall 2014/ch1a 4 wl</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/ch1a_4_wl&amp;diff=88667"/>
		<updated>2014-09-26T03:08:50Z</updated>

		<summary type="html">&lt;p&gt;Aprasad3: /* The Scala Programming Language */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;WEB DEVELOPMENT USING LIFT&lt;br /&gt;
==Introduction==&lt;br /&gt;
Lift is a web framework designed to make the most powerful techniques easily accessible while keeping the overall framework simple and flexible. Lift has picked some of the best ideas from a number of other frameworks while creating some of it's own novel ideas. This combination of solid foundation and new techniques makes Lift a powerful framework. The clear separation of presentation content and logic based on the concept of Model View Controller pattern is one of the key strengths of the framework.&lt;br /&gt;
&lt;br /&gt;
     &amp;quot;Lift is the kind of web framework that enables you as a developer to concentrate on the big picture. Strong, expressive typing and higher-level&lt;br /&gt;
      features like the built-in Comet support allow you to focus on innovating instead of the plumbing.&amp;quot; -- Novell&amp;lt;ref name=overview&amp;gt;[http://www.liftweb.net/lift_overview Lift Overview]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Background==&lt;br /&gt;
Lift is an open source software licensed under an Apache 2.0 license. Lift 2.5 is the latest stable version released and the Lift community has already started development for Lift 3.0. The source code can be found of the GitHub repository.&amp;lt;ref name=github&amp;gt;[https://github.com/lift/framework Lift Source Code]&amp;lt;/ref&amp;gt;&lt;br /&gt;
Lift borrows from the best of existing frameworks, providing: &lt;br /&gt;
*Seaside’s highly granular sessions and security.&lt;br /&gt;
*Rails’s fast flash-to-bang.&lt;br /&gt;
*[http://en.wikipedia.org/wiki/Django Django’s] “more than just [http://en.wikipedia.org/wiki/Create,_read,_update_and_delete CRUD] is included”.&lt;br /&gt;
*Wicket’s designer-friendly templating style.&amp;lt;ref name=wiki&amp;gt;[https://www.assembla.com/spaces/liftweb/wiki/Home Lift Developers' wiki]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Lift is built on top of the Scala programming language. Scala is a relatively new language which compiles to Java bytecode and runs on the JVM. Scala was developed by Martin Odersky. Since lift is built on Scala, the vast ecosystem of Java libraries can be leveraged for the web development like any other Java based web framework. Lift also uses the extensive XML library support and processing capabilities of the Scala language.&lt;br /&gt;
&lt;br /&gt;
== The Scala Programming Language ==&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/Scala_(programming_language) Scala] is a statically typed multi-paradigm programming language integrating features of object-oriented and functional languages. It runs on the JVM and is fully interoperable with Java. Scala is equipped with an expressive type system providing a powerful basis for the safe reuse of component abstractions and provides a combination of language mechanisms that make it easy to smoothly add new language constructs as libraries. The resulting language scalability -- as praised in Guy Steele's famous 1998 OOPSLA keynote, is illustrated by Scala's lightweight actor library. Furthermore, Scala syntax supports native XML literals.&lt;br /&gt;
&lt;br /&gt;
==Features of Lift Web Framework ==&lt;br /&gt;
*   '''LazyLoading:''' Lift supports lazy loading of a snippet. This is useful when a snippet may take a long time to render, but it is required to return the page to the browser quickly.&lt;br /&gt;
&lt;br /&gt;
*  '''Parallel Page rendering:''' Executing multiple snippets in parallel is possible in Lift. Multiple jobs or processes can be spawned and run in parallel. However only when all the tasks or jobs are complete the final page render is sent back to the browser.&lt;br /&gt;
&lt;br /&gt;
*   '''[http://en.wikipedia.org/wiki/Comet_(programming) Comet] and [http://en.wikipedia.org/wiki/Ajax_(programming) Ajax] support:''' Comet along with Ajax supports the asynchronous updates from user to the server or from server back to the user.&lt;br /&gt;
&lt;br /&gt;
*   '''Wiring:''' The relationship between different elements on a page is defined through Lift Wiring. When any element on a page changes, the dependent items are displayed on the next HTTP response.&lt;br /&gt;
&lt;br /&gt;
*   '''Security:''' Lift apps are not vulnerable to the common security concerns. Lift has built-in safeguards to combat vulnerabilities like Injection, [http://en.wikipedia.org/wiki/Cross-site_scripting XSS], Direct Object references and URL access&lt;br /&gt;
&lt;br /&gt;
*   '''Developer centric:''' Lift apps are fast to build, concise and easy to maintain and can be developed in totally designer friendly way.&lt;br /&gt;
&lt;br /&gt;
*  '''Scalable:''' Lift apps are high performance and scale in the real world to handle the high volume of traffic.&lt;br /&gt;
&lt;br /&gt;
*  ''' Modular:''' Lift apps can benefit from, easy to integrate, pre built modules&amp;lt;ref name=liftweb&amp;gt;[http://liftweb.net/ Lift Official HomePage]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Comparison to Rails ==&lt;br /&gt;
&lt;br /&gt;
=== The View-First Approach ===&lt;br /&gt;
&lt;br /&gt;
Templates in Lift are used for display only and never contain programming logic. Consequently, they can be manipulated by non-programmers with tools such as Dreamweaver. Furthermore, contrarily to Rails, Lift snippets are invoked by the template, and not vice versa. The following template illustrates the view-first approach by invoking the form method in the User snippet using the &amp;lt;lift:snippet&amp;gt; tag. The body of this tag can refer to values bound by the User snippet in the snippet-defined fields namespace.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;html xmlns=&amp;quot;http://www.w3.org/1999/xhtml&amp;quot; xmlns:lift=&amp;quot;http://liftweb.net/&amp;quot;&amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;lt;lift:snippet type=&amp;quot;user:form&amp;quot; form=&amp;quot;POST&amp;quot;&amp;gt;&lt;br /&gt;
    First name &amp;lt;fields:first /&amp;gt;&lt;br /&gt;
    Last name &amp;lt;fields:last /&amp;gt;&lt;br /&gt;
    &amp;lt;fields:submit /&amp;gt;&lt;br /&gt;
  &amp;lt;/lift:snippet&amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
&amp;lt;/html&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Rails' controller-first dispatch mechanism makes the assumption that there is only one piece of logic on the page and the rest is decoration. When a page contains more than one piece of logic (e.g. a shopping cart and an interactive chat), having to choose a single piece of logic make the controller code complicated. This usually require some combination of controller inheritance (move common logic into the superclass of controllers -- e.g. put the shopping cart code in the ApplicationController), moving code from controllers into helpers and models, and the use of partial views.&lt;br /&gt;
&lt;br /&gt;
Finally, the view-first approach allows the templates to easily glue different components together. However, when gluing components gets more complicated (e.g. when dependencies must be satisfied), the simplicity of this approach fails and actual code has to be written.&amp;lt;ref name=viewfirst&amp;gt;[http://stanford.wikia.com/wiki/Project_2:_Lift,_the_Scala_Web_framework View-First Approach]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Long-Lived Closures ===&lt;br /&gt;
Lift allows the server application to attach closures to elements rendered in the user interface (e.g. form elements). The following snippet illustrates to usage of such closures.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class User {&lt;br /&gt;
  def form(template: Group) = {&lt;br /&gt;
    var first, last = &amp;quot;&amp;quot;&lt;br /&gt;
    bind(&amp;quot;fields&amp;quot;, template,&lt;br /&gt;
      &amp;quot;first&amp;quot;  --&amp;gt; text(&amp;quot;&amp;quot;, n =&amp;gt; first = n),&lt;br /&gt;
      &amp;quot;last&amp;quot;   --&amp;gt; text(&amp;quot;&amp;quot;, l =&amp;gt; last = l),&lt;br /&gt;
      &amp;quot;submit&amp;quot; --&amp;gt; submit(&amp;quot;Submit&amp;quot;, ignore =&amp;gt; process(first, last)))&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  def process(first: String, last: String) {&lt;br /&gt;
    ...&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The n =&amp;gt; first = n and l =&amp;gt; last = l anonymous functions are attached to two text inputs. The input Lift passes to these functions is the value of the element. The body of these two functions assign the value of text input to the first and last variables. The ignore =&amp;gt; process(first, last) anonymous function is attached to the submit button. In this case, we ignore the argument adequately named ignore because a button doesn't have a value. The body is call another function that could, for instance, store the two names in a database.&lt;br /&gt;
&lt;br /&gt;
To achieve this magic, Lift stores the closures in a map when the component is rendered. Randomly generated strings are used as keys and inserted in the generated HTML elements. When the form is submitted, Lift looks for the closures in the map based on the provided keys and executes them. Note how the first and last variables are captured by the three closures and, consequently, stored between the two request-response cycles.&lt;br /&gt;
&lt;br /&gt;
The advantage of this approach is that snippets can specify what happens when a specific button is pushed rather than having a controller parsing the submitted form and process the parameters extracted from the HTTP request. In essence, Lift allows you to specify server-side actions corresponding to user actions when the form is rendered rather than processing the results to figure out what actions the user performed during the next request. This reduces the need for magic constants used to map actions between the rendered view and controllers in other frameworks. In Rails, you might create a form with two buttons labeled 'Buy Now' and 'Buy Later' and then compare the submit parameter to 'Buy Now' and 'Buy Later' in the controller to determine the appropriate action. In Lift, this can be done with two different bindings in the render function.&amp;lt;ref name = closure&amp;gt;[http://stanford.wikia.com/wiki/Project_2:_Lift,_the_Scala_Web_framework Closures]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Lift Web Framework ==&lt;br /&gt;
&amp;lt;div class=&amp;quot;center&amp;quot;&amp;gt; [[File:LiftArchDiagram.jpg]] &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Components ===&lt;br /&gt;
#	LiftCore: This is the web processor of the framework which handles the following functions.&lt;br /&gt;
##	Request/Response&lt;br /&gt;
##	Rendering Pipeline&lt;br /&gt;
##	Invoking User Functions&lt;br /&gt;
#	LiftRules : Lift Configuration Management. Allows you to configure Lift. &lt;br /&gt;
#	LiftSession: Inherent Session State Representation.&amp;lt;ref name=liftsession&amp;gt;[http://exploring.liftweb.net/master/index-9.html#sec:Session-Management Session Management]&amp;lt;/ref&amp;gt;&lt;br /&gt;
#	S: The stateful object impersonating the state context for a given request/response lifecycle.&amp;lt;ref name=s&amp;gt;[http://exploring.liftweb.net/master/index-9.html#sub:Advanced-S-Object S Object]&amp;lt;/ref&amp;gt;&lt;br /&gt;
#	SiteMap: contains web pages for the lift application.&amp;lt;ref name=sitemap&amp;gt;[http://exploring.liftweb.net/master/index-7.html#cha:SiteMap SiteMap]&amp;lt;/ref&amp;gt;&lt;br /&gt;
#	SHtml: helper functions for XHtml.&amp;lt;ref name=shtml&amp;gt;[http://exploring.liftweb.net/master/index-11.html#cha:AJAX-and-COMET SHtml]&amp;lt;/ref&amp;gt;&lt;br /&gt;
#	Views: LiftView objects impersonating a view as a XML content. Thus pages can be composed from other sources not only from html files.&amp;lt;ref name=views&amp;gt;[http://exploring.liftweb.net/master/index-4.html#sec:Views Lift Views]&amp;lt;/ref&amp;gt;&lt;br /&gt;
#	LiftResponse: Represents the abstraction of a response that will be propagated to the client. &amp;lt;ref name=response&amp;gt;[http://exploring.liftweb.net/master/index-9.html#sec:LiftResponse-in-Detail Lift Response]&amp;lt;/ref&amp;gt;&lt;br /&gt;
#	Comet: allows sending asynchronous content to browser.&amp;lt;ref name =comet&amp;gt;[http://exploring.liftweb.net/master/index-11.html#sec:COMET Comet]&amp;lt;/ref&amp;gt;&lt;br /&gt;
#	[http://en.wikipedia.org/wiki/Object-relational_mapping ORM]: Either Mapper or Record - The lightweight ORM library provided by Lift. The Mapper framework is the proposed ORM framework for Lift 1.0 and the Record framework will be out for next releases. &lt;br /&gt;
#	HTTP Auth: provides control over authentication model.&amp;lt;ref name=orm&amp;gt;[http://exploring.liftweb.net/master/index-8.html#cha:mapper_and_record HTTP Auth]&amp;lt;/ref&amp;gt;&lt;br /&gt;
#	JS API: The JavaScript abstraction layer. These are Scala classes/objects that abstract JavaScript artifacts. Such objects can be combined to build JavaScript code .&amp;lt;ref name=js&amp;gt;[http://exploring.liftweb.net/master/index-10.html#cha:Lift-and-Javascript JS]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Getting Started ==&lt;br /&gt;
&lt;br /&gt;
=== Set Up on Eclipse ===&lt;br /&gt;
&lt;br /&gt;
#	Download “Scala IDE for Eclipse” : http://scala-ide.org/&lt;br /&gt;
#	Install plugin in Eclipse from this update site : http://download.scala-ide.org/sdk/helium/e38/scala211/stable/site&lt;br /&gt;
#	Once the plugin is installed restart Eclipse&lt;br /&gt;
#	Install sbteclipse&amp;lt;ref name=sbt&amp;gt;[http://en.wikipedia.org/wiki/SBT_(software) SBT]&amp;lt;/ref&amp;gt;  by adding the following to projects/plugins.sbt in your Lift Project: &amp;lt;code&amp;gt; addSbtPlugin(&amp;quot;com.typesafe.sbteclipse&amp;quot; % &amp;quot;sbteclipse-plugin&amp;quot; % &amp;quot;2.5.0&amp;quot;) &amp;lt;/code&amp;gt;&lt;br /&gt;
#	You can then create Eclipse project files (.project and .classpath) by entering the following into the SBT prompt: &amp;lt;code&amp;gt; eclipse &amp;lt;/code&amp;gt;&amp;lt;ref name=cookbook&amp;gt;[http://cookbook.liftweb.net/ The Lift Cookbook]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Setup Video Tutorial : [http://www.youtube.com/watch?v=qRIiUUKA2Mw link] &lt;br /&gt;
&lt;br /&gt;
== Basic Web Application Structure ==&lt;br /&gt;
&lt;br /&gt;
=== Step 1: Making a SiteMap entry ===&lt;br /&gt;
&lt;br /&gt;
Every page on the site needs a SiteMap entry.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def sitemap(): SiteMap = SiteMap(&lt;br /&gt;
  Menu(&amp;quot;Home&amp;quot;) / &amp;quot;index&amp;quot;,&lt;br /&gt;
  Menu(&amp;quot;Second Page&amp;quot;) / &amp;quot;second&amp;quot;&lt;br /&gt;
)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Step 2: Creating the view ===&lt;br /&gt;
Create an HTML file that corresponds to the sitemap entry.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;meta content=&amp;quot;text/html; charset=UTF-8&amp;quot; http-equiv=&amp;quot;content-type&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;title&amp;gt;Home&amp;lt;/title&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;div id=&amp;quot;main&amp;quot; class=&amp;quot;lift:surround?with=default&amp;amp;at=content&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;div&amp;gt;&lt;br /&gt;
        Hi, I'm a page that contains the time:&lt;br /&gt;
        &amp;lt;span class=&amp;quot;lift:TimeNow&amp;quot;&amp;gt;??? some time&amp;lt;/span&amp;gt;.&lt;br /&gt;
      &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
      &amp;lt;div&amp;gt;&lt;br /&gt;
        And a button: &amp;lt;button class=&amp;quot;lift:ClickMe&amp;quot;&amp;gt;Click Me&amp;lt;/button&amp;gt;.&lt;br /&gt;
      &amp;lt;/div&amp;gt;&lt;br /&gt;
    &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Step 3 : Creating the Snippet ===&lt;br /&gt;
&lt;br /&gt;
A snippet can be thought of as a controller which has rules for transforming the section of your template.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
package code&lt;br /&gt;
package snippet&lt;br /&gt;
&lt;br /&gt;
import net.liftweb._&lt;br /&gt;
import util._&lt;br /&gt;
import Helpers._&lt;br /&gt;
&lt;br /&gt;
object TimeNow {&lt;br /&gt;
  def render = &amp;quot;* *&amp;quot; #&amp;gt; now.toString&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&amp;lt;ref name=simplylift&amp;gt;[http://simply.liftweb.net/ Simply Lift]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Framework Comparison ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! &lt;br /&gt;
! Lift&lt;br /&gt;
! Rails&lt;br /&gt;
! Play&lt;br /&gt;
|-&lt;br /&gt;
| Scaffolding&lt;br /&gt;
| No&lt;br /&gt;
| Yes&lt;br /&gt;
| Yes&lt;br /&gt;
|-&lt;br /&gt;
| Design Pattern&lt;br /&gt;
| MVVM&lt;br /&gt;
| MVC&lt;br /&gt;
| MVC&lt;br /&gt;
|-&lt;br /&gt;
| Programming language&lt;br /&gt;
| Scala&lt;br /&gt;
| Ruby&lt;br /&gt;
| Java&lt;br /&gt;
|-&lt;br /&gt;
| Template language&lt;br /&gt;
| HTML5&lt;br /&gt;
| ERB/HAML&lt;br /&gt;
| Groovy/Japid&lt;br /&gt;
|-&lt;br /&gt;
| Dynamic Typing&lt;br /&gt;
| No&lt;br /&gt;
| Yes&lt;br /&gt;
| No&lt;br /&gt;
|-&lt;br /&gt;
| Admin Generator&lt;br /&gt;
| Yes&lt;br /&gt;
| Yes&lt;br /&gt;
| No&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Advantages ==&lt;br /&gt;
# Binding server side state to users' sessions is incredibly powerful. Each user can have a living representation in the server that talks to other users' representations.&amp;lt;ref name=adv&amp;gt;[http://stanford.wikia.com/wiki/Project_2:_Lift,_the_Scala_Web_framework Lift Project]&amp;lt;/ref&amp;gt;&lt;br /&gt;
# Built-in Comet support possibly the best Comet support in web frameworks. Pushing data to the browser is as simple as calling partialUpdate or asking for a full re-rendering of the component. Updates of multiple components are automatically serialized in a unique connection.&lt;br /&gt;
# Long-live closures simplify form processing and can be used to create complex wizards.&lt;br /&gt;
# View-first approach helps with 'Lean Controller, Fat Model'.&lt;br /&gt;
# Server state machines support for models, including timeouts. For instance, we can use a machine to specify that after three days without confirmation, a new account has to be deleted. Consequently, there is no need for cron and script/runner type solutions in Rails. Instead of imperatively stating what maintenance operations to do; state what rules to enforce and it is automatically done when necessary.&lt;br /&gt;
&lt;br /&gt;
== Disadvantages ==&lt;br /&gt;
&lt;br /&gt;
# Moving state to the server comes with all disadvantages discussed in class. That being said, various remote actors libraries are currently being developed and would permit actors living in different JVMs (running possibly on different machines) to communicate between each others seamlessly. &amp;lt;ref name=adv&amp;gt;[http://stanford.wikia.com/wiki/Project_2:_Lift,_the_Scala_Web_framework Lift Project]&amp;lt;/ref&amp;gt;Furthermore, it is often possible to architect an application such that loosely coupled components can live on different machines -- it is definitely possible with the stock trading application we will present during our in-class presentation.&lt;br /&gt;
# Terrible API (i.e. badly chosen names, confusing domain model) and no documentation at all (the Scala documentation is OK, though).&lt;br /&gt;
# Despite the fact that the API is stabilizing (unfortunately?), most of the tutorials are outdated.&lt;br /&gt;
# Routing is a nightmare for no infrastructure is available. &lt;br /&gt;
# Despite the fact that we can't move logic from snippets to templates, it is possible to move XHTML from templates to snippets. It is not always clear where the view has to be. Is a snippet a controller or a dynamically generated view? Is there actually a difference between the two?&lt;br /&gt;
&lt;br /&gt;
== Get Started ==&lt;br /&gt;
&lt;br /&gt;
The Lift Cookbook is the best place to start with using the Lift Framework.&lt;br /&gt;
[http://cookbook.liftweb.net/ CookBook]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&amp;lt;references&amp;gt;&amp;lt;/references&amp;gt;&lt;/div&gt;</summary>
		<author><name>Aprasad3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/ch1a_4_wl&amp;diff=88664</id>
		<title>CSC/ECE 517 Fall 2014/ch1a 4 wl</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/ch1a_4_wl&amp;diff=88664"/>
		<updated>2014-09-26T03:06:47Z</updated>

		<summary type="html">&lt;p&gt;Aprasad3: /* Background */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;WEB DEVELOPMENT USING LIFT&lt;br /&gt;
==Introduction==&lt;br /&gt;
Lift is a web framework designed to make the most powerful techniques easily accessible while keeping the overall framework simple and flexible. Lift has picked some of the best ideas from a number of other frameworks while creating some of it's own novel ideas. This combination of solid foundation and new techniques makes Lift a powerful framework. The clear separation of presentation content and logic based on the concept of Model View Controller pattern is one of the key strengths of the framework.&lt;br /&gt;
&lt;br /&gt;
     &amp;quot;Lift is the kind of web framework that enables you as a developer to concentrate on the big picture. Strong, expressive typing and higher-level&lt;br /&gt;
      features like the built-in Comet support allow you to focus on innovating instead of the plumbing.&amp;quot; -- Novell&amp;lt;ref name=overview&amp;gt;[http://www.liftweb.net/lift_overview Lift Overview]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Background==&lt;br /&gt;
Lift is an open source software licensed under an Apache 2.0 license. Lift 2.5 is the latest stable version released and the Lift community has already started development for Lift 3.0. The source code can be found of the GitHub repository.&amp;lt;ref name=github&amp;gt;[https://github.com/lift/framework Lift Source Code]&amp;lt;/ref&amp;gt;&lt;br /&gt;
Lift borrows from the best of existing frameworks, providing: &lt;br /&gt;
*Seaside’s highly granular sessions and security.&lt;br /&gt;
*Rails’s fast flash-to-bang.&lt;br /&gt;
*[http://en.wikipedia.org/wiki/Django Django’s] “more than just [http://en.wikipedia.org/wiki/Create,_read,_update_and_delete CRUD] is included”.&lt;br /&gt;
*Wicket’s designer-friendly templating style.&amp;lt;ref name=wiki&amp;gt;[https://www.assembla.com/spaces/liftweb/wiki/Home Lift Developers' wiki]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Lift is built on top of the Scala programming language. Scala is a relatively new language which compiles to Java bytecode and runs on the JVM. Scala was developed by Martin Odersky. Since lift is built on Scala, the vast ecosystem of Java libraries can be leveraged for the web development like any other Java based web framework. Lift also uses the extensive XML library support and processing capabilities of the Scala language.&lt;br /&gt;
&lt;br /&gt;
== The Scala Programming Language ==&lt;br /&gt;
&lt;br /&gt;
Scala is a statically typed multi-paradigm programming language integrating features of object-oriented and functional languages. It runs on the JVM and is fully interoperable with Java. Scala is equipped with an expressive type system providing a powerful basis for the safe reuse of component abstractions and provides a combination of language mechanisms that make it easy to smoothly add new language constructs as libraries. The resulting language scalability -- as praised in Guy Steele's famous 1998 OOPSLA keynote, is illustrated by Scala's lightweight actor library. Furthermore, Scala syntax supports native XML literals.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Features of Lift Web Framework ==&lt;br /&gt;
*   '''LazyLoading:''' Lift supports lazy loading of a snippet. This is useful when a snippet may take a long time to render, but it is required to return the page to the browser quickly.&lt;br /&gt;
&lt;br /&gt;
*  '''Parallel Page rendering:''' Executing multiple snippets in parallel is possible in Lift. Multiple jobs or processes can be spawned and run in parallel. However only when all the tasks or jobs are complete the final page render is sent back to the browser.&lt;br /&gt;
&lt;br /&gt;
*   '''[http://en.wikipedia.org/wiki/Comet_(programming) Comet] and [http://en.wikipedia.org/wiki/Ajax_(programming) Ajax] support:''' Comet along with Ajax supports the asynchronous updates from user to the server or from server back to the user.&lt;br /&gt;
&lt;br /&gt;
*   '''Wiring:''' The relationship between different elements on a page is defined through Lift Wiring. When any element on a page changes, the dependent items are displayed on the next HTTP response.&lt;br /&gt;
&lt;br /&gt;
*   '''Security:''' Lift apps are not vulnerable to the common security concerns. Lift has built-in safeguards to combat vulnerabilities like Injection, [http://en.wikipedia.org/wiki/Cross-site_scripting XSS], Direct Object references and URL access&lt;br /&gt;
&lt;br /&gt;
*   '''Developer centric:''' Lift apps are fast to build, concise and easy to maintain and can be developed in totally designer friendly way.&lt;br /&gt;
&lt;br /&gt;
*  '''Scalable:''' Lift apps are high performance and scale in the real world to handle the high volume of traffic.&lt;br /&gt;
&lt;br /&gt;
*  ''' Modular:''' Lift apps can benefit from, easy to integrate, pre built modules&amp;lt;ref name=liftweb&amp;gt;[http://liftweb.net/ Lift Official HomePage]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Comparison to Rails ==&lt;br /&gt;
&lt;br /&gt;
=== The View-First Approach ===&lt;br /&gt;
&lt;br /&gt;
Templates in Lift are used for display only and never contain programming logic. Consequently, they can be manipulated by non-programmers with tools such as Dreamweaver. Furthermore, contrarily to Rails, Lift snippets are invoked by the template, and not vice versa. The following template illustrates the view-first approach by invoking the form method in the User snippet using the &amp;lt;lift:snippet&amp;gt; tag. The body of this tag can refer to values bound by the User snippet in the snippet-defined fields namespace.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;html xmlns=&amp;quot;http://www.w3.org/1999/xhtml&amp;quot; xmlns:lift=&amp;quot;http://liftweb.net/&amp;quot;&amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;lt;lift:snippet type=&amp;quot;user:form&amp;quot; form=&amp;quot;POST&amp;quot;&amp;gt;&lt;br /&gt;
    First name &amp;lt;fields:first /&amp;gt;&lt;br /&gt;
    Last name &amp;lt;fields:last /&amp;gt;&lt;br /&gt;
    &amp;lt;fields:submit /&amp;gt;&lt;br /&gt;
  &amp;lt;/lift:snippet&amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
&amp;lt;/html&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Rails' controller-first dispatch mechanism makes the assumption that there is only one piece of logic on the page and the rest is decoration. When a page contains more than one piece of logic (e.g. a shopping cart and an interactive chat), having to choose a single piece of logic make the controller code complicated. This usually require some combination of controller inheritance (move common logic into the superclass of controllers -- e.g. put the shopping cart code in the ApplicationController), moving code from controllers into helpers and models, and the use of partial views.&lt;br /&gt;
&lt;br /&gt;
Finally, the view-first approach allows the templates to easily glue different components together. However, when gluing components gets more complicated (e.g. when dependencies must be satisfied), the simplicity of this approach fails and actual code has to be written.&amp;lt;ref name=viewfirst&amp;gt;[http://stanford.wikia.com/wiki/Project_2:_Lift,_the_Scala_Web_framework View-First Approach]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Long-Lived Closures ===&lt;br /&gt;
Lift allows the server application to attach closures to elements rendered in the user interface (e.g. form elements). The following snippet illustrates to usage of such closures.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class User {&lt;br /&gt;
  def form(template: Group) = {&lt;br /&gt;
    var first, last = &amp;quot;&amp;quot;&lt;br /&gt;
    bind(&amp;quot;fields&amp;quot;, template,&lt;br /&gt;
      &amp;quot;first&amp;quot;  --&amp;gt; text(&amp;quot;&amp;quot;, n =&amp;gt; first = n),&lt;br /&gt;
      &amp;quot;last&amp;quot;   --&amp;gt; text(&amp;quot;&amp;quot;, l =&amp;gt; last = l),&lt;br /&gt;
      &amp;quot;submit&amp;quot; --&amp;gt; submit(&amp;quot;Submit&amp;quot;, ignore =&amp;gt; process(first, last)))&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  def process(first: String, last: String) {&lt;br /&gt;
    ...&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The n =&amp;gt; first = n and l =&amp;gt; last = l anonymous functions are attached to two text inputs. The input Lift passes to these functions is the value of the element. The body of these two functions assign the value of text input to the first and last variables. The ignore =&amp;gt; process(first, last) anonymous function is attached to the submit button. In this case, we ignore the argument adequately named ignore because a button doesn't have a value. The body is call another function that could, for instance, store the two names in a database.&lt;br /&gt;
&lt;br /&gt;
To achieve this magic, Lift stores the closures in a map when the component is rendered. Randomly generated strings are used as keys and inserted in the generated HTML elements. When the form is submitted, Lift looks for the closures in the map based on the provided keys and executes them. Note how the first and last variables are captured by the three closures and, consequently, stored between the two request-response cycles.&lt;br /&gt;
&lt;br /&gt;
The advantage of this approach is that snippets can specify what happens when a specific button is pushed rather than having a controller parsing the submitted form and process the parameters extracted from the HTTP request. In essence, Lift allows you to specify server-side actions corresponding to user actions when the form is rendered rather than processing the results to figure out what actions the user performed during the next request. This reduces the need for magic constants used to map actions between the rendered view and controllers in other frameworks. In Rails, you might create a form with two buttons labeled 'Buy Now' and 'Buy Later' and then compare the submit parameter to 'Buy Now' and 'Buy Later' in the controller to determine the appropriate action. In Lift, this can be done with two different bindings in the render function.&amp;lt;ref name = closure&amp;gt;[http://stanford.wikia.com/wiki/Project_2:_Lift,_the_Scala_Web_framework Closures]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Lift Web Framework ==&lt;br /&gt;
&amp;lt;div class=&amp;quot;center&amp;quot;&amp;gt; [[File:LiftArchDiagram.jpg]] &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Components ===&lt;br /&gt;
#	LiftCore: This is the web processor of the framework which handles the following functions.&lt;br /&gt;
##	Request/Response&lt;br /&gt;
##	Rendering Pipeline&lt;br /&gt;
##	Invoking User Functions&lt;br /&gt;
#	LiftRules : Lift Configuration Management. Allows you to configure Lift. &lt;br /&gt;
#	LiftSession: Inherent Session State Representation.&amp;lt;ref name=liftsession&amp;gt;[http://exploring.liftweb.net/master/index-9.html#sec:Session-Management Session Management]&amp;lt;/ref&amp;gt;&lt;br /&gt;
#	S: The stateful object impersonating the state context for a given request/response lifecycle.&amp;lt;ref name=s&amp;gt;[http://exploring.liftweb.net/master/index-9.html#sub:Advanced-S-Object S Object]&amp;lt;/ref&amp;gt;&lt;br /&gt;
#	SiteMap: contains web pages for the lift application.&amp;lt;ref name=sitemap&amp;gt;[http://exploring.liftweb.net/master/index-7.html#cha:SiteMap SiteMap]&amp;lt;/ref&amp;gt;&lt;br /&gt;
#	SHtml: helper functions for XHtml.&amp;lt;ref name=shtml&amp;gt;[http://exploring.liftweb.net/master/index-11.html#cha:AJAX-and-COMET SHtml]&amp;lt;/ref&amp;gt;&lt;br /&gt;
#	Views: LiftView objects impersonating a view as a XML content. Thus pages can be composed from other sources not only from html files.&amp;lt;ref name=views&amp;gt;[http://exploring.liftweb.net/master/index-4.html#sec:Views Lift Views]&amp;lt;/ref&amp;gt;&lt;br /&gt;
#	LiftResponse: Represents the abstraction of a response that will be propagated to the client. &amp;lt;ref name=response&amp;gt;[http://exploring.liftweb.net/master/index-9.html#sec:LiftResponse-in-Detail Lift Response]&amp;lt;/ref&amp;gt;&lt;br /&gt;
#	Comet: allows sending asynchronous content to browser.&amp;lt;ref name =comet&amp;gt;[http://exploring.liftweb.net/master/index-11.html#sec:COMET Comet]&amp;lt;/ref&amp;gt;&lt;br /&gt;
#	[http://en.wikipedia.org/wiki/Object-relational_mapping ORM]: Either Mapper or Record - The lightweight ORM library provided by Lift. The Mapper framework is the proposed ORM framework for Lift 1.0 and the Record framework will be out for next releases. &lt;br /&gt;
#	HTTP Auth: provides control over authentication model.&amp;lt;ref name=orm&amp;gt;[http://exploring.liftweb.net/master/index-8.html#cha:mapper_and_record HTTP Auth]&amp;lt;/ref&amp;gt;&lt;br /&gt;
#	JS API: The JavaScript abstraction layer. These are Scala classes/objects that abstract JavaScript artifacts. Such objects can be combined to build JavaScript code .&amp;lt;ref name=js&amp;gt;[http://exploring.liftweb.net/master/index-10.html#cha:Lift-and-Javascript JS]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Getting Started ==&lt;br /&gt;
&lt;br /&gt;
=== Set Up on Eclipse ===&lt;br /&gt;
&lt;br /&gt;
#	Download “Scala IDE for Eclipse” : http://scala-ide.org/&lt;br /&gt;
#	Install plugin in Eclipse from this update site : http://download.scala-ide.org/sdk/helium/e38/scala211/stable/site&lt;br /&gt;
#	Once the plugin is installed restart Eclipse&lt;br /&gt;
#	Install sbteclipse&amp;lt;ref name=sbt&amp;gt;[http://en.wikipedia.org/wiki/SBT_(software) SBT]&amp;lt;/ref&amp;gt;  by adding the following to projects/plugins.sbt in your Lift Project: &amp;lt;code&amp;gt; addSbtPlugin(&amp;quot;com.typesafe.sbteclipse&amp;quot; % &amp;quot;sbteclipse-plugin&amp;quot; % &amp;quot;2.5.0&amp;quot;) &amp;lt;/code&amp;gt;&lt;br /&gt;
#	You can then create Eclipse project files (.project and .classpath) by entering the following into the SBT prompt: &amp;lt;code&amp;gt; eclipse &amp;lt;/code&amp;gt;&amp;lt;ref name=cookbook&amp;gt;[http://cookbook.liftweb.net/ The Lift Cookbook]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Setup Video Tutorial : [http://www.youtube.com/watch?v=qRIiUUKA2Mw link] &lt;br /&gt;
&lt;br /&gt;
== Basic Web Application Structure ==&lt;br /&gt;
&lt;br /&gt;
=== Step 1: Making a SiteMap entry ===&lt;br /&gt;
&lt;br /&gt;
Every page on the site needs a SiteMap entry.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def sitemap(): SiteMap = SiteMap(&lt;br /&gt;
  Menu(&amp;quot;Home&amp;quot;) / &amp;quot;index&amp;quot;,&lt;br /&gt;
  Menu(&amp;quot;Second Page&amp;quot;) / &amp;quot;second&amp;quot;&lt;br /&gt;
)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Step 2: Creating the view ===&lt;br /&gt;
Create an HTML file that corresponds to the sitemap entry.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;meta content=&amp;quot;text/html; charset=UTF-8&amp;quot; http-equiv=&amp;quot;content-type&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;title&amp;gt;Home&amp;lt;/title&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;div id=&amp;quot;main&amp;quot; class=&amp;quot;lift:surround?with=default&amp;amp;at=content&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;div&amp;gt;&lt;br /&gt;
        Hi, I'm a page that contains the time:&lt;br /&gt;
        &amp;lt;span class=&amp;quot;lift:TimeNow&amp;quot;&amp;gt;??? some time&amp;lt;/span&amp;gt;.&lt;br /&gt;
      &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
      &amp;lt;div&amp;gt;&lt;br /&gt;
        And a button: &amp;lt;button class=&amp;quot;lift:ClickMe&amp;quot;&amp;gt;Click Me&amp;lt;/button&amp;gt;.&lt;br /&gt;
      &amp;lt;/div&amp;gt;&lt;br /&gt;
    &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Step 3 : Creating the Snippet ===&lt;br /&gt;
&lt;br /&gt;
A snippet can be thought of as a controller which has rules for transforming the section of your template.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
package code&lt;br /&gt;
package snippet&lt;br /&gt;
&lt;br /&gt;
import net.liftweb._&lt;br /&gt;
import util._&lt;br /&gt;
import Helpers._&lt;br /&gt;
&lt;br /&gt;
object TimeNow {&lt;br /&gt;
  def render = &amp;quot;* *&amp;quot; #&amp;gt; now.toString&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&amp;lt;ref name=simplylift&amp;gt;[http://simply.liftweb.net/ Simply Lift]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Framework Comparison ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! &lt;br /&gt;
! Lift&lt;br /&gt;
! Rails&lt;br /&gt;
! Play&lt;br /&gt;
|-&lt;br /&gt;
| Scaffolding&lt;br /&gt;
| No&lt;br /&gt;
| Yes&lt;br /&gt;
| Yes&lt;br /&gt;
|-&lt;br /&gt;
| Design Pattern&lt;br /&gt;
| MVVM&lt;br /&gt;
| MVC&lt;br /&gt;
| MVC&lt;br /&gt;
|-&lt;br /&gt;
| Programming language&lt;br /&gt;
| Scala&lt;br /&gt;
| Ruby&lt;br /&gt;
| Java&lt;br /&gt;
|-&lt;br /&gt;
| Template language&lt;br /&gt;
| HTML5&lt;br /&gt;
| ERB/HAML&lt;br /&gt;
| Groovy/Japid&lt;br /&gt;
|-&lt;br /&gt;
| Dynamic Typing&lt;br /&gt;
| No&lt;br /&gt;
| Yes&lt;br /&gt;
| No&lt;br /&gt;
|-&lt;br /&gt;
| Admin Generator&lt;br /&gt;
| Yes&lt;br /&gt;
| Yes&lt;br /&gt;
| No&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Advantages ==&lt;br /&gt;
# Binding server side state to users' sessions is incredibly powerful. Each user can have a living representation in the server that talks to other users' representations.&amp;lt;ref name=adv&amp;gt;[http://stanford.wikia.com/wiki/Project_2:_Lift,_the_Scala_Web_framework Lift Project]&amp;lt;/ref&amp;gt;&lt;br /&gt;
# Built-in Comet support possibly the best Comet support in web frameworks. Pushing data to the browser is as simple as calling partialUpdate or asking for a full re-rendering of the component. Updates of multiple components are automatically serialized in a unique connection.&lt;br /&gt;
# Long-live closures simplify form processing and can be used to create complex wizards.&lt;br /&gt;
# View-first approach helps with 'Lean Controller, Fat Model'.&lt;br /&gt;
# Server state machines support for models, including timeouts. For instance, we can use a machine to specify that after three days without confirmation, a new account has to be deleted. Consequently, there is no need for cron and script/runner type solutions in Rails. Instead of imperatively stating what maintenance operations to do; state what rules to enforce and it is automatically done when necessary.&lt;br /&gt;
&lt;br /&gt;
== Disadvantages ==&lt;br /&gt;
&lt;br /&gt;
# Moving state to the server comes with all disadvantages discussed in class. That being said, various remote actors libraries are currently being developed and would permit actors living in different JVMs (running possibly on different machines) to communicate between each others seamlessly. &amp;lt;ref name=adv&amp;gt;[http://stanford.wikia.com/wiki/Project_2:_Lift,_the_Scala_Web_framework Lift Project]&amp;lt;/ref&amp;gt;Furthermore, it is often possible to architect an application such that loosely coupled components can live on different machines -- it is definitely possible with the stock trading application we will present during our in-class presentation.&lt;br /&gt;
# Terrible API (i.e. badly chosen names, confusing domain model) and no documentation at all (the Scala documentation is OK, though).&lt;br /&gt;
# Despite the fact that the API is stabilizing (unfortunately?), most of the tutorials are outdated.&lt;br /&gt;
# Routing is a nightmare for no infrastructure is available. &lt;br /&gt;
# Despite the fact that we can't move logic from snippets to templates, it is possible to move XHTML from templates to snippets. It is not always clear where the view has to be. Is a snippet a controller or a dynamically generated view? Is there actually a difference between the two?&lt;br /&gt;
&lt;br /&gt;
== Get Started ==&lt;br /&gt;
&lt;br /&gt;
The Lift Cookbook is the best place to start with using the Lift Framework.&lt;br /&gt;
[http://cookbook.liftweb.net/ CookBook]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&amp;lt;references&amp;gt;&amp;lt;/references&amp;gt;&lt;/div&gt;</summary>
		<author><name>Aprasad3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/ch1a_4_wl&amp;diff=88663</id>
		<title>CSC/ECE 517 Fall 2014/ch1a 4 wl</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/ch1a_4_wl&amp;diff=88663"/>
		<updated>2014-09-26T03:05:58Z</updated>

		<summary type="html">&lt;p&gt;Aprasad3: /* Background */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;WEB DEVELOPMENT USING LIFT&lt;br /&gt;
==Introduction==&lt;br /&gt;
Lift is a web framework designed to make the most powerful techniques easily accessible while keeping the overall framework simple and flexible. Lift has picked some of the best ideas from a number of other frameworks while creating some of it's own novel ideas. This combination of solid foundation and new techniques makes Lift a powerful framework. The clear separation of presentation content and logic based on the concept of Model View Controller pattern is one of the key strengths of the framework.&lt;br /&gt;
&lt;br /&gt;
     &amp;quot;Lift is the kind of web framework that enables you as a developer to concentrate on the big picture. Strong, expressive typing and higher-level&lt;br /&gt;
      features like the built-in Comet support allow you to focus on innovating instead of the plumbing.&amp;quot; -- Novell&amp;lt;ref name=overview&amp;gt;[http://www.liftweb.net/lift_overview Lift Overview]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Background==&lt;br /&gt;
Lift is an open source software licensed under an Apache 2.0 license. Lift 2.5 is the latest stable version released and the Lift community has already started development for Lift 3.0. The source code can be found of the GitHub repository.&amp;lt;ref name=github&amp;gt;[https://github.com/lift/framework Lift Source Code]&amp;lt;/ref&amp;gt;&lt;br /&gt;
Lift borrows from the best of existing frameworks, providing: &lt;br /&gt;
*Seaside’s highly granular sessions and security.&lt;br /&gt;
*Rails’s fast flash-to-bang.&lt;br /&gt;
*Django’s “more than just [http://en.wikipedia.org/wiki/Create,_read,_update_and_delete CRUD] is included”.&lt;br /&gt;
*Wicket’s designer-friendly templating style.&amp;lt;ref name=wiki&amp;gt;[https://www.assembla.com/spaces/liftweb/wiki/Home Lift Developers' wiki]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Lift is built on top of the Scala programming language. Scala is a relatively new language which compiles to Java bytecode and runs on the JVM. Scala was developed by Martin Odersky. Since lift is built on Scala, the vast ecosystem of Java libraries can be leveraged for the web development like any other Java based web framework. Lift also uses the extensive XML library support and processing capabilities of the Scala language.&lt;br /&gt;
&lt;br /&gt;
== The Scala Programming Language ==&lt;br /&gt;
&lt;br /&gt;
Scala is a statically typed multi-paradigm programming language integrating features of object-oriented and functional languages. It runs on the JVM and is fully interoperable with Java. Scala is equipped with an expressive type system providing a powerful basis for the safe reuse of component abstractions and provides a combination of language mechanisms that make it easy to smoothly add new language constructs as libraries. The resulting language scalability -- as praised in Guy Steele's famous 1998 OOPSLA keynote, is illustrated by Scala's lightweight actor library. Furthermore, Scala syntax supports native XML literals.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Features of Lift Web Framework ==&lt;br /&gt;
*   '''LazyLoading:''' Lift supports lazy loading of a snippet. This is useful when a snippet may take a long time to render, but it is required to return the page to the browser quickly.&lt;br /&gt;
&lt;br /&gt;
*  '''Parallel Page rendering:''' Executing multiple snippets in parallel is possible in Lift. Multiple jobs or processes can be spawned and run in parallel. However only when all the tasks or jobs are complete the final page render is sent back to the browser.&lt;br /&gt;
&lt;br /&gt;
*   '''[http://en.wikipedia.org/wiki/Comet_(programming) Comet] and [http://en.wikipedia.org/wiki/Ajax_(programming) Ajax] support:''' Comet along with Ajax supports the asynchronous updates from user to the server or from server back to the user.&lt;br /&gt;
&lt;br /&gt;
*   '''Wiring:''' The relationship between different elements on a page is defined through Lift Wiring. When any element on a page changes, the dependent items are displayed on the next HTTP response.&lt;br /&gt;
&lt;br /&gt;
*   '''Security:''' Lift apps are not vulnerable to the common security concerns. Lift has built-in safeguards to combat vulnerabilities like Injection, [http://en.wikipedia.org/wiki/Cross-site_scripting XSS], Direct Object references and URL access&lt;br /&gt;
&lt;br /&gt;
*   '''Developer centric:''' Lift apps are fast to build, concise and easy to maintain and can be developed in totally designer friendly way.&lt;br /&gt;
&lt;br /&gt;
*  '''Scalable:''' Lift apps are high performance and scale in the real world to handle the high volume of traffic.&lt;br /&gt;
&lt;br /&gt;
*  ''' Modular:''' Lift apps can benefit from, easy to integrate, pre built modules&amp;lt;ref name=liftweb&amp;gt;[http://liftweb.net/ Lift Official HomePage]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Comparison to Rails ==&lt;br /&gt;
&lt;br /&gt;
=== The View-First Approach ===&lt;br /&gt;
&lt;br /&gt;
Templates in Lift are used for display only and never contain programming logic. Consequently, they can be manipulated by non-programmers with tools such as Dreamweaver. Furthermore, contrarily to Rails, Lift snippets are invoked by the template, and not vice versa. The following template illustrates the view-first approach by invoking the form method in the User snippet using the &amp;lt;lift:snippet&amp;gt; tag. The body of this tag can refer to values bound by the User snippet in the snippet-defined fields namespace.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;html xmlns=&amp;quot;http://www.w3.org/1999/xhtml&amp;quot; xmlns:lift=&amp;quot;http://liftweb.net/&amp;quot;&amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;lt;lift:snippet type=&amp;quot;user:form&amp;quot; form=&amp;quot;POST&amp;quot;&amp;gt;&lt;br /&gt;
    First name &amp;lt;fields:first /&amp;gt;&lt;br /&gt;
    Last name &amp;lt;fields:last /&amp;gt;&lt;br /&gt;
    &amp;lt;fields:submit /&amp;gt;&lt;br /&gt;
  &amp;lt;/lift:snippet&amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
&amp;lt;/html&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Rails' controller-first dispatch mechanism makes the assumption that there is only one piece of logic on the page and the rest is decoration. When a page contains more than one piece of logic (e.g. a shopping cart and an interactive chat), having to choose a single piece of logic make the controller code complicated. This usually require some combination of controller inheritance (move common logic into the superclass of controllers -- e.g. put the shopping cart code in the ApplicationController), moving code from controllers into helpers and models, and the use of partial views.&lt;br /&gt;
&lt;br /&gt;
Finally, the view-first approach allows the templates to easily glue different components together. However, when gluing components gets more complicated (e.g. when dependencies must be satisfied), the simplicity of this approach fails and actual code has to be written.&amp;lt;ref name=viewfirst&amp;gt;[http://stanford.wikia.com/wiki/Project_2:_Lift,_the_Scala_Web_framework View-First Approach]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Long-Lived Closures ===&lt;br /&gt;
Lift allows the server application to attach closures to elements rendered in the user interface (e.g. form elements). The following snippet illustrates to usage of such closures.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class User {&lt;br /&gt;
  def form(template: Group) = {&lt;br /&gt;
    var first, last = &amp;quot;&amp;quot;&lt;br /&gt;
    bind(&amp;quot;fields&amp;quot;, template,&lt;br /&gt;
      &amp;quot;first&amp;quot;  --&amp;gt; text(&amp;quot;&amp;quot;, n =&amp;gt; first = n),&lt;br /&gt;
      &amp;quot;last&amp;quot;   --&amp;gt; text(&amp;quot;&amp;quot;, l =&amp;gt; last = l),&lt;br /&gt;
      &amp;quot;submit&amp;quot; --&amp;gt; submit(&amp;quot;Submit&amp;quot;, ignore =&amp;gt; process(first, last)))&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  def process(first: String, last: String) {&lt;br /&gt;
    ...&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The n =&amp;gt; first = n and l =&amp;gt; last = l anonymous functions are attached to two text inputs. The input Lift passes to these functions is the value of the element. The body of these two functions assign the value of text input to the first and last variables. The ignore =&amp;gt; process(first, last) anonymous function is attached to the submit button. In this case, we ignore the argument adequately named ignore because a button doesn't have a value. The body is call another function that could, for instance, store the two names in a database.&lt;br /&gt;
&lt;br /&gt;
To achieve this magic, Lift stores the closures in a map when the component is rendered. Randomly generated strings are used as keys and inserted in the generated HTML elements. When the form is submitted, Lift looks for the closures in the map based on the provided keys and executes them. Note how the first and last variables are captured by the three closures and, consequently, stored between the two request-response cycles.&lt;br /&gt;
&lt;br /&gt;
The advantage of this approach is that snippets can specify what happens when a specific button is pushed rather than having a controller parsing the submitted form and process the parameters extracted from the HTTP request. In essence, Lift allows you to specify server-side actions corresponding to user actions when the form is rendered rather than processing the results to figure out what actions the user performed during the next request. This reduces the need for magic constants used to map actions between the rendered view and controllers in other frameworks. In Rails, you might create a form with two buttons labeled 'Buy Now' and 'Buy Later' and then compare the submit parameter to 'Buy Now' and 'Buy Later' in the controller to determine the appropriate action. In Lift, this can be done with two different bindings in the render function.&amp;lt;ref name = closure&amp;gt;[http://stanford.wikia.com/wiki/Project_2:_Lift,_the_Scala_Web_framework Closures]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Lift Web Framework ==&lt;br /&gt;
&amp;lt;div class=&amp;quot;center&amp;quot;&amp;gt; [[File:LiftArchDiagram.jpg]] &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Components ===&lt;br /&gt;
#	LiftCore: This is the web processor of the framework which handles the following functions.&lt;br /&gt;
##	Request/Response&lt;br /&gt;
##	Rendering Pipeline&lt;br /&gt;
##	Invoking User Functions&lt;br /&gt;
#	LiftRules : Lift Configuration Management. Allows you to configure Lift. &lt;br /&gt;
#	LiftSession: Inherent Session State Representation.&amp;lt;ref name=liftsession&amp;gt;[http://exploring.liftweb.net/master/index-9.html#sec:Session-Management Session Management]&amp;lt;/ref&amp;gt;&lt;br /&gt;
#	S: The stateful object impersonating the state context for a given request/response lifecycle.&amp;lt;ref name=s&amp;gt;[http://exploring.liftweb.net/master/index-9.html#sub:Advanced-S-Object S Object]&amp;lt;/ref&amp;gt;&lt;br /&gt;
#	SiteMap: contains web pages for the lift application.&amp;lt;ref name=sitemap&amp;gt;[http://exploring.liftweb.net/master/index-7.html#cha:SiteMap SiteMap]&amp;lt;/ref&amp;gt;&lt;br /&gt;
#	SHtml: helper functions for XHtml.&amp;lt;ref name=shtml&amp;gt;[http://exploring.liftweb.net/master/index-11.html#cha:AJAX-and-COMET SHtml]&amp;lt;/ref&amp;gt;&lt;br /&gt;
#	Views: LiftView objects impersonating a view as a XML content. Thus pages can be composed from other sources not only from html files.&amp;lt;ref name=views&amp;gt;[http://exploring.liftweb.net/master/index-4.html#sec:Views Lift Views]&amp;lt;/ref&amp;gt;&lt;br /&gt;
#	LiftResponse: Represents the abstraction of a response that will be propagated to the client. &amp;lt;ref name=response&amp;gt;[http://exploring.liftweb.net/master/index-9.html#sec:LiftResponse-in-Detail Lift Response]&amp;lt;/ref&amp;gt;&lt;br /&gt;
#	Comet: allows sending asynchronous content to browser.&amp;lt;ref name =comet&amp;gt;[http://exploring.liftweb.net/master/index-11.html#sec:COMET Comet]&amp;lt;/ref&amp;gt;&lt;br /&gt;
#	[http://en.wikipedia.org/wiki/Object-relational_mapping ORM]: Either Mapper or Record - The lightweight ORM library provided by Lift. The Mapper framework is the proposed ORM framework for Lift 1.0 and the Record framework will be out for next releases. &lt;br /&gt;
#	HTTP Auth: provides control over authentication model.&amp;lt;ref name=orm&amp;gt;[http://exploring.liftweb.net/master/index-8.html#cha:mapper_and_record HTTP Auth]&amp;lt;/ref&amp;gt;&lt;br /&gt;
#	JS API: The JavaScript abstraction layer. These are Scala classes/objects that abstract JavaScript artifacts. Such objects can be combined to build JavaScript code .&amp;lt;ref name=js&amp;gt;[http://exploring.liftweb.net/master/index-10.html#cha:Lift-and-Javascript JS]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Getting Started ==&lt;br /&gt;
&lt;br /&gt;
=== Set Up on Eclipse ===&lt;br /&gt;
&lt;br /&gt;
#	Download “Scala IDE for Eclipse” : http://scala-ide.org/&lt;br /&gt;
#	Install plugin in Eclipse from this update site : http://download.scala-ide.org/sdk/helium/e38/scala211/stable/site&lt;br /&gt;
#	Once the plugin is installed restart Eclipse&lt;br /&gt;
#	Install sbteclipse&amp;lt;ref name=sbt&amp;gt;[http://en.wikipedia.org/wiki/SBT_(software) SBT]&amp;lt;/ref&amp;gt;  by adding the following to projects/plugins.sbt in your Lift Project: &amp;lt;code&amp;gt; addSbtPlugin(&amp;quot;com.typesafe.sbteclipse&amp;quot; % &amp;quot;sbteclipse-plugin&amp;quot; % &amp;quot;2.5.0&amp;quot;) &amp;lt;/code&amp;gt;&lt;br /&gt;
#	You can then create Eclipse project files (.project and .classpath) by entering the following into the SBT prompt: &amp;lt;code&amp;gt; eclipse &amp;lt;/code&amp;gt;&amp;lt;ref name=cookbook&amp;gt;[http://cookbook.liftweb.net/ The Lift Cookbook]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Setup Video Tutorial : [http://www.youtube.com/watch?v=qRIiUUKA2Mw link] &lt;br /&gt;
&lt;br /&gt;
== Basic Web Application Structure ==&lt;br /&gt;
&lt;br /&gt;
=== Step 1: Making a SiteMap entry ===&lt;br /&gt;
&lt;br /&gt;
Every page on the site needs a SiteMap entry.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def sitemap(): SiteMap = SiteMap(&lt;br /&gt;
  Menu(&amp;quot;Home&amp;quot;) / &amp;quot;index&amp;quot;,&lt;br /&gt;
  Menu(&amp;quot;Second Page&amp;quot;) / &amp;quot;second&amp;quot;&lt;br /&gt;
)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Step 2: Creating the view ===&lt;br /&gt;
Create an HTML file that corresponds to the sitemap entry.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;meta content=&amp;quot;text/html; charset=UTF-8&amp;quot; http-equiv=&amp;quot;content-type&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;title&amp;gt;Home&amp;lt;/title&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;div id=&amp;quot;main&amp;quot; class=&amp;quot;lift:surround?with=default&amp;amp;at=content&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;div&amp;gt;&lt;br /&gt;
        Hi, I'm a page that contains the time:&lt;br /&gt;
        &amp;lt;span class=&amp;quot;lift:TimeNow&amp;quot;&amp;gt;??? some time&amp;lt;/span&amp;gt;.&lt;br /&gt;
      &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
      &amp;lt;div&amp;gt;&lt;br /&gt;
        And a button: &amp;lt;button class=&amp;quot;lift:ClickMe&amp;quot;&amp;gt;Click Me&amp;lt;/button&amp;gt;.&lt;br /&gt;
      &amp;lt;/div&amp;gt;&lt;br /&gt;
    &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Step 3 : Creating the Snippet ===&lt;br /&gt;
&lt;br /&gt;
A snippet can be thought of as a controller which has rules for transforming the section of your template.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
package code&lt;br /&gt;
package snippet&lt;br /&gt;
&lt;br /&gt;
import net.liftweb._&lt;br /&gt;
import util._&lt;br /&gt;
import Helpers._&lt;br /&gt;
&lt;br /&gt;
object TimeNow {&lt;br /&gt;
  def render = &amp;quot;* *&amp;quot; #&amp;gt; now.toString&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&amp;lt;ref name=simplylift&amp;gt;[http://simply.liftweb.net/ Simply Lift]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Framework Comparison ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! &lt;br /&gt;
! Lift&lt;br /&gt;
! Rails&lt;br /&gt;
! Play&lt;br /&gt;
|-&lt;br /&gt;
| Scaffolding&lt;br /&gt;
| No&lt;br /&gt;
| Yes&lt;br /&gt;
| Yes&lt;br /&gt;
|-&lt;br /&gt;
| Design Pattern&lt;br /&gt;
| MVVM&lt;br /&gt;
| MVC&lt;br /&gt;
| MVC&lt;br /&gt;
|-&lt;br /&gt;
| Programming language&lt;br /&gt;
| Scala&lt;br /&gt;
| Ruby&lt;br /&gt;
| Java&lt;br /&gt;
|-&lt;br /&gt;
| Template language&lt;br /&gt;
| HTML5&lt;br /&gt;
| ERB/HAML&lt;br /&gt;
| Groovy/Japid&lt;br /&gt;
|-&lt;br /&gt;
| Dynamic Typing&lt;br /&gt;
| No&lt;br /&gt;
| Yes&lt;br /&gt;
| No&lt;br /&gt;
|-&lt;br /&gt;
| Admin Generator&lt;br /&gt;
| Yes&lt;br /&gt;
| Yes&lt;br /&gt;
| No&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Advantages ==&lt;br /&gt;
# Binding server side state to users' sessions is incredibly powerful. Each user can have a living representation in the server that talks to other users' representations.&amp;lt;ref name=adv&amp;gt;[http://stanford.wikia.com/wiki/Project_2:_Lift,_the_Scala_Web_framework Lift Project]&amp;lt;/ref&amp;gt;&lt;br /&gt;
# Built-in Comet support possibly the best Comet support in web frameworks. Pushing data to the browser is as simple as calling partialUpdate or asking for a full re-rendering of the component. Updates of multiple components are automatically serialized in a unique connection.&lt;br /&gt;
# Long-live closures simplify form processing and can be used to create complex wizards.&lt;br /&gt;
# View-first approach helps with 'Lean Controller, Fat Model'.&lt;br /&gt;
# Server state machines support for models, including timeouts. For instance, we can use a machine to specify that after three days without confirmation, a new account has to be deleted. Consequently, there is no need for cron and script/runner type solutions in Rails. Instead of imperatively stating what maintenance operations to do; state what rules to enforce and it is automatically done when necessary.&lt;br /&gt;
&lt;br /&gt;
== Disadvantages ==&lt;br /&gt;
&lt;br /&gt;
# Moving state to the server comes with all disadvantages discussed in class. That being said, various remote actors libraries are currently being developed and would permit actors living in different JVMs (running possibly on different machines) to communicate between each others seamlessly. &amp;lt;ref name=adv&amp;gt;[http://stanford.wikia.com/wiki/Project_2:_Lift,_the_Scala_Web_framework Lift Project]&amp;lt;/ref&amp;gt;Furthermore, it is often possible to architect an application such that loosely coupled components can live on different machines -- it is definitely possible with the stock trading application we will present during our in-class presentation.&lt;br /&gt;
# Terrible API (i.e. badly chosen names, confusing domain model) and no documentation at all (the Scala documentation is OK, though).&lt;br /&gt;
# Despite the fact that the API is stabilizing (unfortunately?), most of the tutorials are outdated.&lt;br /&gt;
# Routing is a nightmare for no infrastructure is available. &lt;br /&gt;
# Despite the fact that we can't move logic from snippets to templates, it is possible to move XHTML from templates to snippets. It is not always clear where the view has to be. Is a snippet a controller or a dynamically generated view? Is there actually a difference between the two?&lt;br /&gt;
&lt;br /&gt;
== Get Started ==&lt;br /&gt;
&lt;br /&gt;
The Lift Cookbook is the best place to start with using the Lift Framework.&lt;br /&gt;
[http://cookbook.liftweb.net/ CookBook]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&amp;lt;references&amp;gt;&amp;lt;/references&amp;gt;&lt;/div&gt;</summary>
		<author><name>Aprasad3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/ch1a_4_wl&amp;diff=88662</id>
		<title>CSC/ECE 517 Fall 2014/ch1a 4 wl</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/ch1a_4_wl&amp;diff=88662"/>
		<updated>2014-09-26T03:05:22Z</updated>

		<summary type="html">&lt;p&gt;Aprasad3: /* Features of Lift Web Framework */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;WEB DEVELOPMENT USING LIFT&lt;br /&gt;
==Introduction==&lt;br /&gt;
Lift is a web framework designed to make the most powerful techniques easily accessible while keeping the overall framework simple and flexible. Lift has picked some of the best ideas from a number of other frameworks while creating some of it's own novel ideas. This combination of solid foundation and new techniques makes Lift a powerful framework. The clear separation of presentation content and logic based on the concept of Model View Controller pattern is one of the key strengths of the framework.&lt;br /&gt;
&lt;br /&gt;
     &amp;quot;Lift is the kind of web framework that enables you as a developer to concentrate on the big picture. Strong, expressive typing and higher-level&lt;br /&gt;
      features like the built-in Comet support allow you to focus on innovating instead of the plumbing.&amp;quot; -- Novell&amp;lt;ref name=overview&amp;gt;[http://www.liftweb.net/lift_overview Lift Overview]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Background==&lt;br /&gt;
Lift is an open source software licensed under an Apache 2.0 license. Lift 2.5 is the latest stable version released and the Lift community has already started development for Lift 3.0. The source code can be found of the GitHub repository.&amp;lt;ref name=github&amp;gt;[https://github.com/lift/framework Lift Source Code]&amp;lt;/ref&amp;gt;&lt;br /&gt;
Lift borrows from the best of existing frameworks, providing: &lt;br /&gt;
*Seaside’s highly granular sessions and security.&lt;br /&gt;
*Rails’s fast flash-to-bang.&lt;br /&gt;
*Django’s “more than just CRUD is included”.&lt;br /&gt;
*Wicket’s designer-friendly templating style.&amp;lt;ref name=wiki&amp;gt;[https://www.assembla.com/spaces/liftweb/wiki/Home Lift Developers' wiki]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Lift is built on top of the Scala programming language. Scala is a relatively new language which compiles to Java bytecode and runs on the JVM. Scala was developed by Martin Odersky. Since lift is built on Scala, the vast ecosystem of Java libraries can be leveraged for the web development like any other Java based web framework. Lift also uses the extensive XML library support and processing capabilities of the Scala language.&lt;br /&gt;
&lt;br /&gt;
== The Scala Programming Language ==&lt;br /&gt;
&lt;br /&gt;
Scala is a statically typed multi-paradigm programming language integrating features of object-oriented and functional languages. It runs on the JVM and is fully interoperable with Java. Scala is equipped with an expressive type system providing a powerful basis for the safe reuse of component abstractions and provides a combination of language mechanisms that make it easy to smoothly add new language constructs as libraries. The resulting language scalability -- as praised in Guy Steele's famous 1998 OOPSLA keynote, is illustrated by Scala's lightweight actor library. Furthermore, Scala syntax supports native XML literals.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Features of Lift Web Framework ==&lt;br /&gt;
*   '''LazyLoading:''' Lift supports lazy loading of a snippet. This is useful when a snippet may take a long time to render, but it is required to return the page to the browser quickly.&lt;br /&gt;
&lt;br /&gt;
*  '''Parallel Page rendering:''' Executing multiple snippets in parallel is possible in Lift. Multiple jobs or processes can be spawned and run in parallel. However only when all the tasks or jobs are complete the final page render is sent back to the browser.&lt;br /&gt;
&lt;br /&gt;
*   '''[http://en.wikipedia.org/wiki/Comet_(programming) Comet] and [http://en.wikipedia.org/wiki/Ajax_(programming) Ajax] support:''' Comet along with Ajax supports the asynchronous updates from user to the server or from server back to the user.&lt;br /&gt;
&lt;br /&gt;
*   '''Wiring:''' The relationship between different elements on a page is defined through Lift Wiring. When any element on a page changes, the dependent items are displayed on the next HTTP response.&lt;br /&gt;
&lt;br /&gt;
*   '''Security:''' Lift apps are not vulnerable to the common security concerns. Lift has built-in safeguards to combat vulnerabilities like Injection, [http://en.wikipedia.org/wiki/Cross-site_scripting XSS], Direct Object references and URL access&lt;br /&gt;
&lt;br /&gt;
*   '''Developer centric:''' Lift apps are fast to build, concise and easy to maintain and can be developed in totally designer friendly way.&lt;br /&gt;
&lt;br /&gt;
*  '''Scalable:''' Lift apps are high performance and scale in the real world to handle the high volume of traffic.&lt;br /&gt;
&lt;br /&gt;
*  ''' Modular:''' Lift apps can benefit from, easy to integrate, pre built modules&amp;lt;ref name=liftweb&amp;gt;[http://liftweb.net/ Lift Official HomePage]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Comparison to Rails ==&lt;br /&gt;
&lt;br /&gt;
=== The View-First Approach ===&lt;br /&gt;
&lt;br /&gt;
Templates in Lift are used for display only and never contain programming logic. Consequently, they can be manipulated by non-programmers with tools such as Dreamweaver. Furthermore, contrarily to Rails, Lift snippets are invoked by the template, and not vice versa. The following template illustrates the view-first approach by invoking the form method in the User snippet using the &amp;lt;lift:snippet&amp;gt; tag. The body of this tag can refer to values bound by the User snippet in the snippet-defined fields namespace.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;html xmlns=&amp;quot;http://www.w3.org/1999/xhtml&amp;quot; xmlns:lift=&amp;quot;http://liftweb.net/&amp;quot;&amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;lt;lift:snippet type=&amp;quot;user:form&amp;quot; form=&amp;quot;POST&amp;quot;&amp;gt;&lt;br /&gt;
    First name &amp;lt;fields:first /&amp;gt;&lt;br /&gt;
    Last name &amp;lt;fields:last /&amp;gt;&lt;br /&gt;
    &amp;lt;fields:submit /&amp;gt;&lt;br /&gt;
  &amp;lt;/lift:snippet&amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
&amp;lt;/html&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Rails' controller-first dispatch mechanism makes the assumption that there is only one piece of logic on the page and the rest is decoration. When a page contains more than one piece of logic (e.g. a shopping cart and an interactive chat), having to choose a single piece of logic make the controller code complicated. This usually require some combination of controller inheritance (move common logic into the superclass of controllers -- e.g. put the shopping cart code in the ApplicationController), moving code from controllers into helpers and models, and the use of partial views.&lt;br /&gt;
&lt;br /&gt;
Finally, the view-first approach allows the templates to easily glue different components together. However, when gluing components gets more complicated (e.g. when dependencies must be satisfied), the simplicity of this approach fails and actual code has to be written.&amp;lt;ref name=viewfirst&amp;gt;[http://stanford.wikia.com/wiki/Project_2:_Lift,_the_Scala_Web_framework View-First Approach]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Long-Lived Closures ===&lt;br /&gt;
Lift allows the server application to attach closures to elements rendered in the user interface (e.g. form elements). The following snippet illustrates to usage of such closures.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class User {&lt;br /&gt;
  def form(template: Group) = {&lt;br /&gt;
    var first, last = &amp;quot;&amp;quot;&lt;br /&gt;
    bind(&amp;quot;fields&amp;quot;, template,&lt;br /&gt;
      &amp;quot;first&amp;quot;  --&amp;gt; text(&amp;quot;&amp;quot;, n =&amp;gt; first = n),&lt;br /&gt;
      &amp;quot;last&amp;quot;   --&amp;gt; text(&amp;quot;&amp;quot;, l =&amp;gt; last = l),&lt;br /&gt;
      &amp;quot;submit&amp;quot; --&amp;gt; submit(&amp;quot;Submit&amp;quot;, ignore =&amp;gt; process(first, last)))&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  def process(first: String, last: String) {&lt;br /&gt;
    ...&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The n =&amp;gt; first = n and l =&amp;gt; last = l anonymous functions are attached to two text inputs. The input Lift passes to these functions is the value of the element. The body of these two functions assign the value of text input to the first and last variables. The ignore =&amp;gt; process(first, last) anonymous function is attached to the submit button. In this case, we ignore the argument adequately named ignore because a button doesn't have a value. The body is call another function that could, for instance, store the two names in a database.&lt;br /&gt;
&lt;br /&gt;
To achieve this magic, Lift stores the closures in a map when the component is rendered. Randomly generated strings are used as keys and inserted in the generated HTML elements. When the form is submitted, Lift looks for the closures in the map based on the provided keys and executes them. Note how the first and last variables are captured by the three closures and, consequently, stored between the two request-response cycles.&lt;br /&gt;
&lt;br /&gt;
The advantage of this approach is that snippets can specify what happens when a specific button is pushed rather than having a controller parsing the submitted form and process the parameters extracted from the HTTP request. In essence, Lift allows you to specify server-side actions corresponding to user actions when the form is rendered rather than processing the results to figure out what actions the user performed during the next request. This reduces the need for magic constants used to map actions between the rendered view and controllers in other frameworks. In Rails, you might create a form with two buttons labeled 'Buy Now' and 'Buy Later' and then compare the submit parameter to 'Buy Now' and 'Buy Later' in the controller to determine the appropriate action. In Lift, this can be done with two different bindings in the render function.&amp;lt;ref name = closure&amp;gt;[http://stanford.wikia.com/wiki/Project_2:_Lift,_the_Scala_Web_framework Closures]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Lift Web Framework ==&lt;br /&gt;
&amp;lt;div class=&amp;quot;center&amp;quot;&amp;gt; [[File:LiftArchDiagram.jpg]] &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Components ===&lt;br /&gt;
#	LiftCore: This is the web processor of the framework which handles the following functions.&lt;br /&gt;
##	Request/Response&lt;br /&gt;
##	Rendering Pipeline&lt;br /&gt;
##	Invoking User Functions&lt;br /&gt;
#	LiftRules : Lift Configuration Management. Allows you to configure Lift. &lt;br /&gt;
#	LiftSession: Inherent Session State Representation.&amp;lt;ref name=liftsession&amp;gt;[http://exploring.liftweb.net/master/index-9.html#sec:Session-Management Session Management]&amp;lt;/ref&amp;gt;&lt;br /&gt;
#	S: The stateful object impersonating the state context for a given request/response lifecycle.&amp;lt;ref name=s&amp;gt;[http://exploring.liftweb.net/master/index-9.html#sub:Advanced-S-Object S Object]&amp;lt;/ref&amp;gt;&lt;br /&gt;
#	SiteMap: contains web pages for the lift application.&amp;lt;ref name=sitemap&amp;gt;[http://exploring.liftweb.net/master/index-7.html#cha:SiteMap SiteMap]&amp;lt;/ref&amp;gt;&lt;br /&gt;
#	SHtml: helper functions for XHtml.&amp;lt;ref name=shtml&amp;gt;[http://exploring.liftweb.net/master/index-11.html#cha:AJAX-and-COMET SHtml]&amp;lt;/ref&amp;gt;&lt;br /&gt;
#	Views: LiftView objects impersonating a view as a XML content. Thus pages can be composed from other sources not only from html files.&amp;lt;ref name=views&amp;gt;[http://exploring.liftweb.net/master/index-4.html#sec:Views Lift Views]&amp;lt;/ref&amp;gt;&lt;br /&gt;
#	LiftResponse: Represents the abstraction of a response that will be propagated to the client. &amp;lt;ref name=response&amp;gt;[http://exploring.liftweb.net/master/index-9.html#sec:LiftResponse-in-Detail Lift Response]&amp;lt;/ref&amp;gt;&lt;br /&gt;
#	Comet: allows sending asynchronous content to browser.&amp;lt;ref name =comet&amp;gt;[http://exploring.liftweb.net/master/index-11.html#sec:COMET Comet]&amp;lt;/ref&amp;gt;&lt;br /&gt;
#	[http://en.wikipedia.org/wiki/Object-relational_mapping ORM]: Either Mapper or Record - The lightweight ORM library provided by Lift. The Mapper framework is the proposed ORM framework for Lift 1.0 and the Record framework will be out for next releases. &lt;br /&gt;
#	HTTP Auth: provides control over authentication model.&amp;lt;ref name=orm&amp;gt;[http://exploring.liftweb.net/master/index-8.html#cha:mapper_and_record HTTP Auth]&amp;lt;/ref&amp;gt;&lt;br /&gt;
#	JS API: The JavaScript abstraction layer. These are Scala classes/objects that abstract JavaScript artifacts. Such objects can be combined to build JavaScript code .&amp;lt;ref name=js&amp;gt;[http://exploring.liftweb.net/master/index-10.html#cha:Lift-and-Javascript JS]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Getting Started ==&lt;br /&gt;
&lt;br /&gt;
=== Set Up on Eclipse ===&lt;br /&gt;
&lt;br /&gt;
#	Download “Scala IDE for Eclipse” : http://scala-ide.org/&lt;br /&gt;
#	Install plugin in Eclipse from this update site : http://download.scala-ide.org/sdk/helium/e38/scala211/stable/site&lt;br /&gt;
#	Once the plugin is installed restart Eclipse&lt;br /&gt;
#	Install sbteclipse&amp;lt;ref name=sbt&amp;gt;[http://en.wikipedia.org/wiki/SBT_(software) SBT]&amp;lt;/ref&amp;gt;  by adding the following to projects/plugins.sbt in your Lift Project: &amp;lt;code&amp;gt; addSbtPlugin(&amp;quot;com.typesafe.sbteclipse&amp;quot; % &amp;quot;sbteclipse-plugin&amp;quot; % &amp;quot;2.5.0&amp;quot;) &amp;lt;/code&amp;gt;&lt;br /&gt;
#	You can then create Eclipse project files (.project and .classpath) by entering the following into the SBT prompt: &amp;lt;code&amp;gt; eclipse &amp;lt;/code&amp;gt;&amp;lt;ref name=cookbook&amp;gt;[http://cookbook.liftweb.net/ The Lift Cookbook]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Setup Video Tutorial : [http://www.youtube.com/watch?v=qRIiUUKA2Mw link] &lt;br /&gt;
&lt;br /&gt;
== Basic Web Application Structure ==&lt;br /&gt;
&lt;br /&gt;
=== Step 1: Making a SiteMap entry ===&lt;br /&gt;
&lt;br /&gt;
Every page on the site needs a SiteMap entry.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def sitemap(): SiteMap = SiteMap(&lt;br /&gt;
  Menu(&amp;quot;Home&amp;quot;) / &amp;quot;index&amp;quot;,&lt;br /&gt;
  Menu(&amp;quot;Second Page&amp;quot;) / &amp;quot;second&amp;quot;&lt;br /&gt;
)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Step 2: Creating the view ===&lt;br /&gt;
Create an HTML file that corresponds to the sitemap entry.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;meta content=&amp;quot;text/html; charset=UTF-8&amp;quot; http-equiv=&amp;quot;content-type&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;title&amp;gt;Home&amp;lt;/title&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;div id=&amp;quot;main&amp;quot; class=&amp;quot;lift:surround?with=default&amp;amp;at=content&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;div&amp;gt;&lt;br /&gt;
        Hi, I'm a page that contains the time:&lt;br /&gt;
        &amp;lt;span class=&amp;quot;lift:TimeNow&amp;quot;&amp;gt;??? some time&amp;lt;/span&amp;gt;.&lt;br /&gt;
      &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
      &amp;lt;div&amp;gt;&lt;br /&gt;
        And a button: &amp;lt;button class=&amp;quot;lift:ClickMe&amp;quot;&amp;gt;Click Me&amp;lt;/button&amp;gt;.&lt;br /&gt;
      &amp;lt;/div&amp;gt;&lt;br /&gt;
    &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Step 3 : Creating the Snippet ===&lt;br /&gt;
&lt;br /&gt;
A snippet can be thought of as a controller which has rules for transforming the section of your template.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
package code&lt;br /&gt;
package snippet&lt;br /&gt;
&lt;br /&gt;
import net.liftweb._&lt;br /&gt;
import util._&lt;br /&gt;
import Helpers._&lt;br /&gt;
&lt;br /&gt;
object TimeNow {&lt;br /&gt;
  def render = &amp;quot;* *&amp;quot; #&amp;gt; now.toString&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&amp;lt;ref name=simplylift&amp;gt;[http://simply.liftweb.net/ Simply Lift]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Framework Comparison ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! &lt;br /&gt;
! Lift&lt;br /&gt;
! Rails&lt;br /&gt;
! Play&lt;br /&gt;
|-&lt;br /&gt;
| Scaffolding&lt;br /&gt;
| No&lt;br /&gt;
| Yes&lt;br /&gt;
| Yes&lt;br /&gt;
|-&lt;br /&gt;
| Design Pattern&lt;br /&gt;
| MVVM&lt;br /&gt;
| MVC&lt;br /&gt;
| MVC&lt;br /&gt;
|-&lt;br /&gt;
| Programming language&lt;br /&gt;
| Scala&lt;br /&gt;
| Ruby&lt;br /&gt;
| Java&lt;br /&gt;
|-&lt;br /&gt;
| Template language&lt;br /&gt;
| HTML5&lt;br /&gt;
| ERB/HAML&lt;br /&gt;
| Groovy/Japid&lt;br /&gt;
|-&lt;br /&gt;
| Dynamic Typing&lt;br /&gt;
| No&lt;br /&gt;
| Yes&lt;br /&gt;
| No&lt;br /&gt;
|-&lt;br /&gt;
| Admin Generator&lt;br /&gt;
| Yes&lt;br /&gt;
| Yes&lt;br /&gt;
| No&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Advantages ==&lt;br /&gt;
# Binding server side state to users' sessions is incredibly powerful. Each user can have a living representation in the server that talks to other users' representations.&amp;lt;ref name=adv&amp;gt;[http://stanford.wikia.com/wiki/Project_2:_Lift,_the_Scala_Web_framework Lift Project]&amp;lt;/ref&amp;gt;&lt;br /&gt;
# Built-in Comet support possibly the best Comet support in web frameworks. Pushing data to the browser is as simple as calling partialUpdate or asking for a full re-rendering of the component. Updates of multiple components are automatically serialized in a unique connection.&lt;br /&gt;
# Long-live closures simplify form processing and can be used to create complex wizards.&lt;br /&gt;
# View-first approach helps with 'Lean Controller, Fat Model'.&lt;br /&gt;
# Server state machines support for models, including timeouts. For instance, we can use a machine to specify that after three days without confirmation, a new account has to be deleted. Consequently, there is no need for cron and script/runner type solutions in Rails. Instead of imperatively stating what maintenance operations to do; state what rules to enforce and it is automatically done when necessary.&lt;br /&gt;
&lt;br /&gt;
== Disadvantages ==&lt;br /&gt;
&lt;br /&gt;
# Moving state to the server comes with all disadvantages discussed in class. That being said, various remote actors libraries are currently being developed and would permit actors living in different JVMs (running possibly on different machines) to communicate between each others seamlessly. &amp;lt;ref name=adv&amp;gt;[http://stanford.wikia.com/wiki/Project_2:_Lift,_the_Scala_Web_framework Lift Project]&amp;lt;/ref&amp;gt;Furthermore, it is often possible to architect an application such that loosely coupled components can live on different machines -- it is definitely possible with the stock trading application we will present during our in-class presentation.&lt;br /&gt;
# Terrible API (i.e. badly chosen names, confusing domain model) and no documentation at all (the Scala documentation is OK, though).&lt;br /&gt;
# Despite the fact that the API is stabilizing (unfortunately?), most of the tutorials are outdated.&lt;br /&gt;
# Routing is a nightmare for no infrastructure is available. &lt;br /&gt;
# Despite the fact that we can't move logic from snippets to templates, it is possible to move XHTML from templates to snippets. It is not always clear where the view has to be. Is a snippet a controller or a dynamically generated view? Is there actually a difference between the two?&lt;br /&gt;
&lt;br /&gt;
== Get Started ==&lt;br /&gt;
&lt;br /&gt;
The Lift Cookbook is the best place to start with using the Lift Framework.&lt;br /&gt;
[http://cookbook.liftweb.net/ CookBook]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&amp;lt;references&amp;gt;&amp;lt;/references&amp;gt;&lt;/div&gt;</summary>
		<author><name>Aprasad3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/ch1a_4_wl&amp;diff=88661</id>
		<title>CSC/ECE 517 Fall 2014/ch1a 4 wl</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/ch1a_4_wl&amp;diff=88661"/>
		<updated>2014-09-26T03:04:51Z</updated>

		<summary type="html">&lt;p&gt;Aprasad3: /* Features of Lift Web Framework */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;WEB DEVELOPMENT USING LIFT&lt;br /&gt;
==Introduction==&lt;br /&gt;
Lift is a web framework designed to make the most powerful techniques easily accessible while keeping the overall framework simple and flexible. Lift has picked some of the best ideas from a number of other frameworks while creating some of it's own novel ideas. This combination of solid foundation and new techniques makes Lift a powerful framework. The clear separation of presentation content and logic based on the concept of Model View Controller pattern is one of the key strengths of the framework.&lt;br /&gt;
&lt;br /&gt;
     &amp;quot;Lift is the kind of web framework that enables you as a developer to concentrate on the big picture. Strong, expressive typing and higher-level&lt;br /&gt;
      features like the built-in Comet support allow you to focus on innovating instead of the plumbing.&amp;quot; -- Novell&amp;lt;ref name=overview&amp;gt;[http://www.liftweb.net/lift_overview Lift Overview]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Background==&lt;br /&gt;
Lift is an open source software licensed under an Apache 2.0 license. Lift 2.5 is the latest stable version released and the Lift community has already started development for Lift 3.0. The source code can be found of the GitHub repository.&amp;lt;ref name=github&amp;gt;[https://github.com/lift/framework Lift Source Code]&amp;lt;/ref&amp;gt;&lt;br /&gt;
Lift borrows from the best of existing frameworks, providing: &lt;br /&gt;
*Seaside’s highly granular sessions and security.&lt;br /&gt;
*Rails’s fast flash-to-bang.&lt;br /&gt;
*Django’s “more than just CRUD is included”.&lt;br /&gt;
*Wicket’s designer-friendly templating style.&amp;lt;ref name=wiki&amp;gt;[https://www.assembla.com/spaces/liftweb/wiki/Home Lift Developers' wiki]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Lift is built on top of the Scala programming language. Scala is a relatively new language which compiles to Java bytecode and runs on the JVM. Scala was developed by Martin Odersky. Since lift is built on Scala, the vast ecosystem of Java libraries can be leveraged for the web development like any other Java based web framework. Lift also uses the extensive XML library support and processing capabilities of the Scala language.&lt;br /&gt;
&lt;br /&gt;
== The Scala Programming Language ==&lt;br /&gt;
&lt;br /&gt;
Scala is a statically typed multi-paradigm programming language integrating features of object-oriented and functional languages. It runs on the JVM and is fully interoperable with Java. Scala is equipped with an expressive type system providing a powerful basis for the safe reuse of component abstractions and provides a combination of language mechanisms that make it easy to smoothly add new language constructs as libraries. The resulting language scalability -- as praised in Guy Steele's famous 1998 OOPSLA keynote, is illustrated by Scala's lightweight actor library. Furthermore, Scala syntax supports native XML literals.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Features of Lift Web Framework ==&lt;br /&gt;
*   '''LazyLoading:''' Lift supports lazy loading of a snippet. This is useful when a snippet may take a long time to render, but it is required to return the page to the browser quickly.&lt;br /&gt;
&lt;br /&gt;
*  '''Parallel Page rendering:''' Executing multiple snippets in parallel is possible in Lift. Multiple jobs or processes can be spawned and run in parallel. However only when all the tasks or jobs are complete the final page render is sent back to the browser.&lt;br /&gt;
&lt;br /&gt;
*   '''[http://en.wikipedia.org/wiki/Comet_(programming) Comet] and Ajax support:''' Comet along with Ajax supports the asynchronous updates from user to the server or from server back to the user.&lt;br /&gt;
&lt;br /&gt;
*   '''Wiring:''' The relationship between different elements on a page is defined through Lift Wiring. When any element on a page changes, the dependent items are displayed on the next HTTP response.&lt;br /&gt;
&lt;br /&gt;
*   '''Security:''' Lift apps are not vulnerable to the common security concerns. Lift has built-in safeguards to combat vulnerabilities like Injection, [http://en.wikipedia.org/wiki/Cross-site_scripting XSS], Direct Object references and URL access&lt;br /&gt;
&lt;br /&gt;
*   '''Developer centric:''' Lift apps are fast to build, concise and easy to maintain and can be developed in totally designer friendly way.&lt;br /&gt;
&lt;br /&gt;
*  '''Scalable:''' Lift apps are high performance and scale in the real world to handle the high volume of traffic.&lt;br /&gt;
&lt;br /&gt;
*  ''' Modular:''' Lift apps can benefit from, easy to integrate, pre built modules&amp;lt;ref name=liftweb&amp;gt;[http://liftweb.net/ Lift Official HomePage]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Comparison to Rails ==&lt;br /&gt;
&lt;br /&gt;
=== The View-First Approach ===&lt;br /&gt;
&lt;br /&gt;
Templates in Lift are used for display only and never contain programming logic. Consequently, they can be manipulated by non-programmers with tools such as Dreamweaver. Furthermore, contrarily to Rails, Lift snippets are invoked by the template, and not vice versa. The following template illustrates the view-first approach by invoking the form method in the User snippet using the &amp;lt;lift:snippet&amp;gt; tag. The body of this tag can refer to values bound by the User snippet in the snippet-defined fields namespace.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;html xmlns=&amp;quot;http://www.w3.org/1999/xhtml&amp;quot; xmlns:lift=&amp;quot;http://liftweb.net/&amp;quot;&amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;lt;lift:snippet type=&amp;quot;user:form&amp;quot; form=&amp;quot;POST&amp;quot;&amp;gt;&lt;br /&gt;
    First name &amp;lt;fields:first /&amp;gt;&lt;br /&gt;
    Last name &amp;lt;fields:last /&amp;gt;&lt;br /&gt;
    &amp;lt;fields:submit /&amp;gt;&lt;br /&gt;
  &amp;lt;/lift:snippet&amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
&amp;lt;/html&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Rails' controller-first dispatch mechanism makes the assumption that there is only one piece of logic on the page and the rest is decoration. When a page contains more than one piece of logic (e.g. a shopping cart and an interactive chat), having to choose a single piece of logic make the controller code complicated. This usually require some combination of controller inheritance (move common logic into the superclass of controllers -- e.g. put the shopping cart code in the ApplicationController), moving code from controllers into helpers and models, and the use of partial views.&lt;br /&gt;
&lt;br /&gt;
Finally, the view-first approach allows the templates to easily glue different components together. However, when gluing components gets more complicated (e.g. when dependencies must be satisfied), the simplicity of this approach fails and actual code has to be written.&amp;lt;ref name=viewfirst&amp;gt;[http://stanford.wikia.com/wiki/Project_2:_Lift,_the_Scala_Web_framework View-First Approach]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Long-Lived Closures ===&lt;br /&gt;
Lift allows the server application to attach closures to elements rendered in the user interface (e.g. form elements). The following snippet illustrates to usage of such closures.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class User {&lt;br /&gt;
  def form(template: Group) = {&lt;br /&gt;
    var first, last = &amp;quot;&amp;quot;&lt;br /&gt;
    bind(&amp;quot;fields&amp;quot;, template,&lt;br /&gt;
      &amp;quot;first&amp;quot;  --&amp;gt; text(&amp;quot;&amp;quot;, n =&amp;gt; first = n),&lt;br /&gt;
      &amp;quot;last&amp;quot;   --&amp;gt; text(&amp;quot;&amp;quot;, l =&amp;gt; last = l),&lt;br /&gt;
      &amp;quot;submit&amp;quot; --&amp;gt; submit(&amp;quot;Submit&amp;quot;, ignore =&amp;gt; process(first, last)))&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  def process(first: String, last: String) {&lt;br /&gt;
    ...&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The n =&amp;gt; first = n and l =&amp;gt; last = l anonymous functions are attached to two text inputs. The input Lift passes to these functions is the value of the element. The body of these two functions assign the value of text input to the first and last variables. The ignore =&amp;gt; process(first, last) anonymous function is attached to the submit button. In this case, we ignore the argument adequately named ignore because a button doesn't have a value. The body is call another function that could, for instance, store the two names in a database.&lt;br /&gt;
&lt;br /&gt;
To achieve this magic, Lift stores the closures in a map when the component is rendered. Randomly generated strings are used as keys and inserted in the generated HTML elements. When the form is submitted, Lift looks for the closures in the map based on the provided keys and executes them. Note how the first and last variables are captured by the three closures and, consequently, stored between the two request-response cycles.&lt;br /&gt;
&lt;br /&gt;
The advantage of this approach is that snippets can specify what happens when a specific button is pushed rather than having a controller parsing the submitted form and process the parameters extracted from the HTTP request. In essence, Lift allows you to specify server-side actions corresponding to user actions when the form is rendered rather than processing the results to figure out what actions the user performed during the next request. This reduces the need for magic constants used to map actions between the rendered view and controllers in other frameworks. In Rails, you might create a form with two buttons labeled 'Buy Now' and 'Buy Later' and then compare the submit parameter to 'Buy Now' and 'Buy Later' in the controller to determine the appropriate action. In Lift, this can be done with two different bindings in the render function.&amp;lt;ref name = closure&amp;gt;[http://stanford.wikia.com/wiki/Project_2:_Lift,_the_Scala_Web_framework Closures]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Lift Web Framework ==&lt;br /&gt;
&amp;lt;div class=&amp;quot;center&amp;quot;&amp;gt; [[File:LiftArchDiagram.jpg]] &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Components ===&lt;br /&gt;
#	LiftCore: This is the web processor of the framework which handles the following functions.&lt;br /&gt;
##	Request/Response&lt;br /&gt;
##	Rendering Pipeline&lt;br /&gt;
##	Invoking User Functions&lt;br /&gt;
#	LiftRules : Lift Configuration Management. Allows you to configure Lift. &lt;br /&gt;
#	LiftSession: Inherent Session State Representation.&amp;lt;ref name=liftsession&amp;gt;[http://exploring.liftweb.net/master/index-9.html#sec:Session-Management Session Management]&amp;lt;/ref&amp;gt;&lt;br /&gt;
#	S: The stateful object impersonating the state context for a given request/response lifecycle.&amp;lt;ref name=s&amp;gt;[http://exploring.liftweb.net/master/index-9.html#sub:Advanced-S-Object S Object]&amp;lt;/ref&amp;gt;&lt;br /&gt;
#	SiteMap: contains web pages for the lift application.&amp;lt;ref name=sitemap&amp;gt;[http://exploring.liftweb.net/master/index-7.html#cha:SiteMap SiteMap]&amp;lt;/ref&amp;gt;&lt;br /&gt;
#	SHtml: helper functions for XHtml.&amp;lt;ref name=shtml&amp;gt;[http://exploring.liftweb.net/master/index-11.html#cha:AJAX-and-COMET SHtml]&amp;lt;/ref&amp;gt;&lt;br /&gt;
#	Views: LiftView objects impersonating a view as a XML content. Thus pages can be composed from other sources not only from html files.&amp;lt;ref name=views&amp;gt;[http://exploring.liftweb.net/master/index-4.html#sec:Views Lift Views]&amp;lt;/ref&amp;gt;&lt;br /&gt;
#	LiftResponse: Represents the abstraction of a response that will be propagated to the client. &amp;lt;ref name=response&amp;gt;[http://exploring.liftweb.net/master/index-9.html#sec:LiftResponse-in-Detail Lift Response]&amp;lt;/ref&amp;gt;&lt;br /&gt;
#	Comet: allows sending asynchronous content to browser.&amp;lt;ref name =comet&amp;gt;[http://exploring.liftweb.net/master/index-11.html#sec:COMET Comet]&amp;lt;/ref&amp;gt;&lt;br /&gt;
#	[http://en.wikipedia.org/wiki/Object-relational_mapping ORM]: Either Mapper or Record - The lightweight ORM library provided by Lift. The Mapper framework is the proposed ORM framework for Lift 1.0 and the Record framework will be out for next releases. &lt;br /&gt;
#	HTTP Auth: provides control over authentication model.&amp;lt;ref name=orm&amp;gt;[http://exploring.liftweb.net/master/index-8.html#cha:mapper_and_record HTTP Auth]&amp;lt;/ref&amp;gt;&lt;br /&gt;
#	JS API: The JavaScript abstraction layer. These are Scala classes/objects that abstract JavaScript artifacts. Such objects can be combined to build JavaScript code .&amp;lt;ref name=js&amp;gt;[http://exploring.liftweb.net/master/index-10.html#cha:Lift-and-Javascript JS]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Getting Started ==&lt;br /&gt;
&lt;br /&gt;
=== Set Up on Eclipse ===&lt;br /&gt;
&lt;br /&gt;
#	Download “Scala IDE for Eclipse” : http://scala-ide.org/&lt;br /&gt;
#	Install plugin in Eclipse from this update site : http://download.scala-ide.org/sdk/helium/e38/scala211/stable/site&lt;br /&gt;
#	Once the plugin is installed restart Eclipse&lt;br /&gt;
#	Install sbteclipse&amp;lt;ref name=sbt&amp;gt;[http://en.wikipedia.org/wiki/SBT_(software) SBT]&amp;lt;/ref&amp;gt;  by adding the following to projects/plugins.sbt in your Lift Project: &amp;lt;code&amp;gt; addSbtPlugin(&amp;quot;com.typesafe.sbteclipse&amp;quot; % &amp;quot;sbteclipse-plugin&amp;quot; % &amp;quot;2.5.0&amp;quot;) &amp;lt;/code&amp;gt;&lt;br /&gt;
#	You can then create Eclipse project files (.project and .classpath) by entering the following into the SBT prompt: &amp;lt;code&amp;gt; eclipse &amp;lt;/code&amp;gt;&amp;lt;ref name=cookbook&amp;gt;[http://cookbook.liftweb.net/ The Lift Cookbook]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Setup Video Tutorial : [http://www.youtube.com/watch?v=qRIiUUKA2Mw link] &lt;br /&gt;
&lt;br /&gt;
== Basic Web Application Structure ==&lt;br /&gt;
&lt;br /&gt;
=== Step 1: Making a SiteMap entry ===&lt;br /&gt;
&lt;br /&gt;
Every page on the site needs a SiteMap entry.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def sitemap(): SiteMap = SiteMap(&lt;br /&gt;
  Menu(&amp;quot;Home&amp;quot;) / &amp;quot;index&amp;quot;,&lt;br /&gt;
  Menu(&amp;quot;Second Page&amp;quot;) / &amp;quot;second&amp;quot;&lt;br /&gt;
)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Step 2: Creating the view ===&lt;br /&gt;
Create an HTML file that corresponds to the sitemap entry.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;meta content=&amp;quot;text/html; charset=UTF-8&amp;quot; http-equiv=&amp;quot;content-type&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;title&amp;gt;Home&amp;lt;/title&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;div id=&amp;quot;main&amp;quot; class=&amp;quot;lift:surround?with=default&amp;amp;at=content&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;div&amp;gt;&lt;br /&gt;
        Hi, I'm a page that contains the time:&lt;br /&gt;
        &amp;lt;span class=&amp;quot;lift:TimeNow&amp;quot;&amp;gt;??? some time&amp;lt;/span&amp;gt;.&lt;br /&gt;
      &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
      &amp;lt;div&amp;gt;&lt;br /&gt;
        And a button: &amp;lt;button class=&amp;quot;lift:ClickMe&amp;quot;&amp;gt;Click Me&amp;lt;/button&amp;gt;.&lt;br /&gt;
      &amp;lt;/div&amp;gt;&lt;br /&gt;
    &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Step 3 : Creating the Snippet ===&lt;br /&gt;
&lt;br /&gt;
A snippet can be thought of as a controller which has rules for transforming the section of your template.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
package code&lt;br /&gt;
package snippet&lt;br /&gt;
&lt;br /&gt;
import net.liftweb._&lt;br /&gt;
import util._&lt;br /&gt;
import Helpers._&lt;br /&gt;
&lt;br /&gt;
object TimeNow {&lt;br /&gt;
  def render = &amp;quot;* *&amp;quot; #&amp;gt; now.toString&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&amp;lt;ref name=simplylift&amp;gt;[http://simply.liftweb.net/ Simply Lift]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Framework Comparison ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! &lt;br /&gt;
! Lift&lt;br /&gt;
! Rails&lt;br /&gt;
! Play&lt;br /&gt;
|-&lt;br /&gt;
| Scaffolding&lt;br /&gt;
| No&lt;br /&gt;
| Yes&lt;br /&gt;
| Yes&lt;br /&gt;
|-&lt;br /&gt;
| Design Pattern&lt;br /&gt;
| MVVM&lt;br /&gt;
| MVC&lt;br /&gt;
| MVC&lt;br /&gt;
|-&lt;br /&gt;
| Programming language&lt;br /&gt;
| Scala&lt;br /&gt;
| Ruby&lt;br /&gt;
| Java&lt;br /&gt;
|-&lt;br /&gt;
| Template language&lt;br /&gt;
| HTML5&lt;br /&gt;
| ERB/HAML&lt;br /&gt;
| Groovy/Japid&lt;br /&gt;
|-&lt;br /&gt;
| Dynamic Typing&lt;br /&gt;
| No&lt;br /&gt;
| Yes&lt;br /&gt;
| No&lt;br /&gt;
|-&lt;br /&gt;
| Admin Generator&lt;br /&gt;
| Yes&lt;br /&gt;
| Yes&lt;br /&gt;
| No&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Advantages ==&lt;br /&gt;
# Binding server side state to users' sessions is incredibly powerful. Each user can have a living representation in the server that talks to other users' representations.&amp;lt;ref name=adv&amp;gt;[http://stanford.wikia.com/wiki/Project_2:_Lift,_the_Scala_Web_framework Lift Project]&amp;lt;/ref&amp;gt;&lt;br /&gt;
# Built-in Comet support possibly the best Comet support in web frameworks. Pushing data to the browser is as simple as calling partialUpdate or asking for a full re-rendering of the component. Updates of multiple components are automatically serialized in a unique connection.&lt;br /&gt;
# Long-live closures simplify form processing and can be used to create complex wizards.&lt;br /&gt;
# View-first approach helps with 'Lean Controller, Fat Model'.&lt;br /&gt;
# Server state machines support for models, including timeouts. For instance, we can use a machine to specify that after three days without confirmation, a new account has to be deleted. Consequently, there is no need for cron and script/runner type solutions in Rails. Instead of imperatively stating what maintenance operations to do; state what rules to enforce and it is automatically done when necessary.&lt;br /&gt;
&lt;br /&gt;
== Disadvantages ==&lt;br /&gt;
&lt;br /&gt;
# Moving state to the server comes with all disadvantages discussed in class. That being said, various remote actors libraries are currently being developed and would permit actors living in different JVMs (running possibly on different machines) to communicate between each others seamlessly. &amp;lt;ref name=adv&amp;gt;[http://stanford.wikia.com/wiki/Project_2:_Lift,_the_Scala_Web_framework Lift Project]&amp;lt;/ref&amp;gt;Furthermore, it is often possible to architect an application such that loosely coupled components can live on different machines -- it is definitely possible with the stock trading application we will present during our in-class presentation.&lt;br /&gt;
# Terrible API (i.e. badly chosen names, confusing domain model) and no documentation at all (the Scala documentation is OK, though).&lt;br /&gt;
# Despite the fact that the API is stabilizing (unfortunately?), most of the tutorials are outdated.&lt;br /&gt;
# Routing is a nightmare for no infrastructure is available. &lt;br /&gt;
# Despite the fact that we can't move logic from snippets to templates, it is possible to move XHTML from templates to snippets. It is not always clear where the view has to be. Is a snippet a controller or a dynamically generated view? Is there actually a difference between the two?&lt;br /&gt;
&lt;br /&gt;
== Get Started ==&lt;br /&gt;
&lt;br /&gt;
The Lift Cookbook is the best place to start with using the Lift Framework.&lt;br /&gt;
[http://cookbook.liftweb.net/ CookBook]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&amp;lt;references&amp;gt;&amp;lt;/references&amp;gt;&lt;/div&gt;</summary>
		<author><name>Aprasad3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/ch1a_4_wl&amp;diff=88660</id>
		<title>CSC/ECE 517 Fall 2014/ch1a 4 wl</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/ch1a_4_wl&amp;diff=88660"/>
		<updated>2014-09-26T03:03:34Z</updated>

		<summary type="html">&lt;p&gt;Aprasad3: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;WEB DEVELOPMENT USING LIFT&lt;br /&gt;
==Introduction==&lt;br /&gt;
Lift is a web framework designed to make the most powerful techniques easily accessible while keeping the overall framework simple and flexible. Lift has picked some of the best ideas from a number of other frameworks while creating some of it's own novel ideas. This combination of solid foundation and new techniques makes Lift a powerful framework. The clear separation of presentation content and logic based on the concept of Model View Controller pattern is one of the key strengths of the framework.&lt;br /&gt;
&lt;br /&gt;
     &amp;quot;Lift is the kind of web framework that enables you as a developer to concentrate on the big picture. Strong, expressive typing and higher-level&lt;br /&gt;
      features like the built-in Comet support allow you to focus on innovating instead of the plumbing.&amp;quot; -- Novell&amp;lt;ref name=overview&amp;gt;[http://www.liftweb.net/lift_overview Lift Overview]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Background==&lt;br /&gt;
Lift is an open source software licensed under an Apache 2.0 license. Lift 2.5 is the latest stable version released and the Lift community has already started development for Lift 3.0. The source code can be found of the GitHub repository.&amp;lt;ref name=github&amp;gt;[https://github.com/lift/framework Lift Source Code]&amp;lt;/ref&amp;gt;&lt;br /&gt;
Lift borrows from the best of existing frameworks, providing: &lt;br /&gt;
*Seaside’s highly granular sessions and security.&lt;br /&gt;
*Rails’s fast flash-to-bang.&lt;br /&gt;
*Django’s “more than just CRUD is included”.&lt;br /&gt;
*Wicket’s designer-friendly templating style.&amp;lt;ref name=wiki&amp;gt;[https://www.assembla.com/spaces/liftweb/wiki/Home Lift Developers' wiki]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Lift is built on top of the Scala programming language. Scala is a relatively new language which compiles to Java bytecode and runs on the JVM. Scala was developed by Martin Odersky. Since lift is built on Scala, the vast ecosystem of Java libraries can be leveraged for the web development like any other Java based web framework. Lift also uses the extensive XML library support and processing capabilities of the Scala language.&lt;br /&gt;
&lt;br /&gt;
== The Scala Programming Language ==&lt;br /&gt;
&lt;br /&gt;
Scala is a statically typed multi-paradigm programming language integrating features of object-oriented and functional languages. It runs on the JVM and is fully interoperable with Java. Scala is equipped with an expressive type system providing a powerful basis for the safe reuse of component abstractions and provides a combination of language mechanisms that make it easy to smoothly add new language constructs as libraries. The resulting language scalability -- as praised in Guy Steele's famous 1998 OOPSLA keynote, is illustrated by Scala's lightweight actor library. Furthermore, Scala syntax supports native XML literals.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Features of Lift Web Framework ==&lt;br /&gt;
*   '''LazyLoading:''' Lift supports lazy loading of a snippet. This is useful when a snippet may take a long time to render, but it is required to return the page to the browser quickly.&lt;br /&gt;
&lt;br /&gt;
*  '''Parallel Page rendering:''' Executing multiple snippets in parallel is possible in Lift. Multiple jobs or processes can be spawned and run in parallel. However only when all the tasks or jobs are complete the final page render is sent back to the browser.&lt;br /&gt;
&lt;br /&gt;
*   '''Comet and Ajax support:''' Comet along with Ajax supports the asynchronous updates from user to the server or from server back to the user.&lt;br /&gt;
&lt;br /&gt;
*   '''Wiring:''' The relationship between different elements on a page is defined through Lift Wiring. When any element on a page changes, the dependent items are displayed on the next HTTP response.&lt;br /&gt;
&lt;br /&gt;
*   '''Security:''' Lift apps are not vulnerable to the common security concerns. Lift has built-in safeguards to combat vulnerabilities like Injection, [http://en.wikipedia.org/wiki/Cross-site_scripting XSS], Direct Object references and URL access&lt;br /&gt;
&lt;br /&gt;
*   '''Developer centric:''' Lift apps are fast to build, concise and easy to maintain and can be developed in totally designer friendly way.&lt;br /&gt;
&lt;br /&gt;
*  '''Scalable:''' Lift apps are high performance and scale in the real world to handle the high volume of traffic.&lt;br /&gt;
&lt;br /&gt;
*  ''' Modular:''' Lift apps can benefit from, easy to integrate, pre built modules&amp;lt;ref name=liftweb&amp;gt;[http://liftweb.net/ Lift Official HomePage]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Comparison to Rails ==&lt;br /&gt;
&lt;br /&gt;
=== The View-First Approach ===&lt;br /&gt;
&lt;br /&gt;
Templates in Lift are used for display only and never contain programming logic. Consequently, they can be manipulated by non-programmers with tools such as Dreamweaver. Furthermore, contrarily to Rails, Lift snippets are invoked by the template, and not vice versa. The following template illustrates the view-first approach by invoking the form method in the User snippet using the &amp;lt;lift:snippet&amp;gt; tag. The body of this tag can refer to values bound by the User snippet in the snippet-defined fields namespace.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;html xmlns=&amp;quot;http://www.w3.org/1999/xhtml&amp;quot; xmlns:lift=&amp;quot;http://liftweb.net/&amp;quot;&amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;lt;lift:snippet type=&amp;quot;user:form&amp;quot; form=&amp;quot;POST&amp;quot;&amp;gt;&lt;br /&gt;
    First name &amp;lt;fields:first /&amp;gt;&lt;br /&gt;
    Last name &amp;lt;fields:last /&amp;gt;&lt;br /&gt;
    &amp;lt;fields:submit /&amp;gt;&lt;br /&gt;
  &amp;lt;/lift:snippet&amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
&amp;lt;/html&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Rails' controller-first dispatch mechanism makes the assumption that there is only one piece of logic on the page and the rest is decoration. When a page contains more than one piece of logic (e.g. a shopping cart and an interactive chat), having to choose a single piece of logic make the controller code complicated. This usually require some combination of controller inheritance (move common logic into the superclass of controllers -- e.g. put the shopping cart code in the ApplicationController), moving code from controllers into helpers and models, and the use of partial views.&lt;br /&gt;
&lt;br /&gt;
Finally, the view-first approach allows the templates to easily glue different components together. However, when gluing components gets more complicated (e.g. when dependencies must be satisfied), the simplicity of this approach fails and actual code has to be written.&amp;lt;ref name=viewfirst&amp;gt;[http://stanford.wikia.com/wiki/Project_2:_Lift,_the_Scala_Web_framework View-First Approach]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Long-Lived Closures ===&lt;br /&gt;
Lift allows the server application to attach closures to elements rendered in the user interface (e.g. form elements). The following snippet illustrates to usage of such closures.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class User {&lt;br /&gt;
  def form(template: Group) = {&lt;br /&gt;
    var first, last = &amp;quot;&amp;quot;&lt;br /&gt;
    bind(&amp;quot;fields&amp;quot;, template,&lt;br /&gt;
      &amp;quot;first&amp;quot;  --&amp;gt; text(&amp;quot;&amp;quot;, n =&amp;gt; first = n),&lt;br /&gt;
      &amp;quot;last&amp;quot;   --&amp;gt; text(&amp;quot;&amp;quot;, l =&amp;gt; last = l),&lt;br /&gt;
      &amp;quot;submit&amp;quot; --&amp;gt; submit(&amp;quot;Submit&amp;quot;, ignore =&amp;gt; process(first, last)))&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  def process(first: String, last: String) {&lt;br /&gt;
    ...&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The n =&amp;gt; first = n and l =&amp;gt; last = l anonymous functions are attached to two text inputs. The input Lift passes to these functions is the value of the element. The body of these two functions assign the value of text input to the first and last variables. The ignore =&amp;gt; process(first, last) anonymous function is attached to the submit button. In this case, we ignore the argument adequately named ignore because a button doesn't have a value. The body is call another function that could, for instance, store the two names in a database.&lt;br /&gt;
&lt;br /&gt;
To achieve this magic, Lift stores the closures in a map when the component is rendered. Randomly generated strings are used as keys and inserted in the generated HTML elements. When the form is submitted, Lift looks for the closures in the map based on the provided keys and executes them. Note how the first and last variables are captured by the three closures and, consequently, stored between the two request-response cycles.&lt;br /&gt;
&lt;br /&gt;
The advantage of this approach is that snippets can specify what happens when a specific button is pushed rather than having a controller parsing the submitted form and process the parameters extracted from the HTTP request. In essence, Lift allows you to specify server-side actions corresponding to user actions when the form is rendered rather than processing the results to figure out what actions the user performed during the next request. This reduces the need for magic constants used to map actions between the rendered view and controllers in other frameworks. In Rails, you might create a form with two buttons labeled 'Buy Now' and 'Buy Later' and then compare the submit parameter to 'Buy Now' and 'Buy Later' in the controller to determine the appropriate action. In Lift, this can be done with two different bindings in the render function.&amp;lt;ref name = closure&amp;gt;[http://stanford.wikia.com/wiki/Project_2:_Lift,_the_Scala_Web_framework Closures]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Lift Web Framework ==&lt;br /&gt;
&amp;lt;div class=&amp;quot;center&amp;quot;&amp;gt; [[File:LiftArchDiagram.jpg]] &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Components ===&lt;br /&gt;
#	LiftCore: This is the web processor of the framework which handles the following functions.&lt;br /&gt;
##	Request/Response&lt;br /&gt;
##	Rendering Pipeline&lt;br /&gt;
##	Invoking User Functions&lt;br /&gt;
#	LiftRules : Lift Configuration Management. Allows you to configure Lift. &lt;br /&gt;
#	LiftSession: Inherent Session State Representation.&amp;lt;ref name=liftsession&amp;gt;[http://exploring.liftweb.net/master/index-9.html#sec:Session-Management Session Management]&amp;lt;/ref&amp;gt;&lt;br /&gt;
#	S: The stateful object impersonating the state context for a given request/response lifecycle.&amp;lt;ref name=s&amp;gt;[http://exploring.liftweb.net/master/index-9.html#sub:Advanced-S-Object S Object]&amp;lt;/ref&amp;gt;&lt;br /&gt;
#	SiteMap: contains web pages for the lift application.&amp;lt;ref name=sitemap&amp;gt;[http://exploring.liftweb.net/master/index-7.html#cha:SiteMap SiteMap]&amp;lt;/ref&amp;gt;&lt;br /&gt;
#	SHtml: helper functions for XHtml.&amp;lt;ref name=shtml&amp;gt;[http://exploring.liftweb.net/master/index-11.html#cha:AJAX-and-COMET SHtml]&amp;lt;/ref&amp;gt;&lt;br /&gt;
#	Views: LiftView objects impersonating a view as a XML content. Thus pages can be composed from other sources not only from html files.&amp;lt;ref name=views&amp;gt;[http://exploring.liftweb.net/master/index-4.html#sec:Views Lift Views]&amp;lt;/ref&amp;gt;&lt;br /&gt;
#	LiftResponse: Represents the abstraction of a response that will be propagated to the client. &amp;lt;ref name=response&amp;gt;[http://exploring.liftweb.net/master/index-9.html#sec:LiftResponse-in-Detail Lift Response]&amp;lt;/ref&amp;gt;&lt;br /&gt;
#	Comet: allows sending asynchronous content to browser.&amp;lt;ref name =comet&amp;gt;[http://exploring.liftweb.net/master/index-11.html#sec:COMET Comet]&amp;lt;/ref&amp;gt;&lt;br /&gt;
#	[http://en.wikipedia.org/wiki/Object-relational_mapping ORM]: Either Mapper or Record - The lightweight ORM library provided by Lift. The Mapper framework is the proposed ORM framework for Lift 1.0 and the Record framework will be out for next releases. &lt;br /&gt;
#	HTTP Auth: provides control over authentication model.&amp;lt;ref name=orm&amp;gt;[http://exploring.liftweb.net/master/index-8.html#cha:mapper_and_record HTTP Auth]&amp;lt;/ref&amp;gt;&lt;br /&gt;
#	JS API: The JavaScript abstraction layer. These are Scala classes/objects that abstract JavaScript artifacts. Such objects can be combined to build JavaScript code .&amp;lt;ref name=js&amp;gt;[http://exploring.liftweb.net/master/index-10.html#cha:Lift-and-Javascript JS]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Getting Started ==&lt;br /&gt;
&lt;br /&gt;
=== Set Up on Eclipse ===&lt;br /&gt;
&lt;br /&gt;
#	Download “Scala IDE for Eclipse” : http://scala-ide.org/&lt;br /&gt;
#	Install plugin in Eclipse from this update site : http://download.scala-ide.org/sdk/helium/e38/scala211/stable/site&lt;br /&gt;
#	Once the plugin is installed restart Eclipse&lt;br /&gt;
#	Install sbteclipse&amp;lt;ref name=sbt&amp;gt;[http://en.wikipedia.org/wiki/SBT_(software) SBT]&amp;lt;/ref&amp;gt;  by adding the following to projects/plugins.sbt in your Lift Project: &amp;lt;code&amp;gt; addSbtPlugin(&amp;quot;com.typesafe.sbteclipse&amp;quot; % &amp;quot;sbteclipse-plugin&amp;quot; % &amp;quot;2.5.0&amp;quot;) &amp;lt;/code&amp;gt;&lt;br /&gt;
#	You can then create Eclipse project files (.project and .classpath) by entering the following into the SBT prompt: &amp;lt;code&amp;gt; eclipse &amp;lt;/code&amp;gt;&amp;lt;ref name=cookbook&amp;gt;[http://cookbook.liftweb.net/ The Lift Cookbook]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Setup Video Tutorial : [http://www.youtube.com/watch?v=qRIiUUKA2Mw link] &lt;br /&gt;
&lt;br /&gt;
== Basic Web Application Structure ==&lt;br /&gt;
&lt;br /&gt;
=== Step 1: Making a SiteMap entry ===&lt;br /&gt;
&lt;br /&gt;
Every page on the site needs a SiteMap entry.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def sitemap(): SiteMap = SiteMap(&lt;br /&gt;
  Menu(&amp;quot;Home&amp;quot;) / &amp;quot;index&amp;quot;,&lt;br /&gt;
  Menu(&amp;quot;Second Page&amp;quot;) / &amp;quot;second&amp;quot;&lt;br /&gt;
)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Step 2: Creating the view ===&lt;br /&gt;
Create an HTML file that corresponds to the sitemap entry.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;meta content=&amp;quot;text/html; charset=UTF-8&amp;quot; http-equiv=&amp;quot;content-type&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;title&amp;gt;Home&amp;lt;/title&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;div id=&amp;quot;main&amp;quot; class=&amp;quot;lift:surround?with=default&amp;amp;at=content&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;div&amp;gt;&lt;br /&gt;
        Hi, I'm a page that contains the time:&lt;br /&gt;
        &amp;lt;span class=&amp;quot;lift:TimeNow&amp;quot;&amp;gt;??? some time&amp;lt;/span&amp;gt;.&lt;br /&gt;
      &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
      &amp;lt;div&amp;gt;&lt;br /&gt;
        And a button: &amp;lt;button class=&amp;quot;lift:ClickMe&amp;quot;&amp;gt;Click Me&amp;lt;/button&amp;gt;.&lt;br /&gt;
      &amp;lt;/div&amp;gt;&lt;br /&gt;
    &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Step 3 : Creating the Snippet ===&lt;br /&gt;
&lt;br /&gt;
A snippet can be thought of as a controller which has rules for transforming the section of your template.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
package code&lt;br /&gt;
package snippet&lt;br /&gt;
&lt;br /&gt;
import net.liftweb._&lt;br /&gt;
import util._&lt;br /&gt;
import Helpers._&lt;br /&gt;
&lt;br /&gt;
object TimeNow {&lt;br /&gt;
  def render = &amp;quot;* *&amp;quot; #&amp;gt; now.toString&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&amp;lt;ref name=simplylift&amp;gt;[http://simply.liftweb.net/ Simply Lift]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Framework Comparison ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! &lt;br /&gt;
! Lift&lt;br /&gt;
! Rails&lt;br /&gt;
! Play&lt;br /&gt;
|-&lt;br /&gt;
| Scaffolding&lt;br /&gt;
| No&lt;br /&gt;
| Yes&lt;br /&gt;
| Yes&lt;br /&gt;
|-&lt;br /&gt;
| Design Pattern&lt;br /&gt;
| MVVM&lt;br /&gt;
| MVC&lt;br /&gt;
| MVC&lt;br /&gt;
|-&lt;br /&gt;
| Programming language&lt;br /&gt;
| Scala&lt;br /&gt;
| Ruby&lt;br /&gt;
| Java&lt;br /&gt;
|-&lt;br /&gt;
| Template language&lt;br /&gt;
| HTML5&lt;br /&gt;
| ERB/HAML&lt;br /&gt;
| Groovy/Japid&lt;br /&gt;
|-&lt;br /&gt;
| Dynamic Typing&lt;br /&gt;
| No&lt;br /&gt;
| Yes&lt;br /&gt;
| No&lt;br /&gt;
|-&lt;br /&gt;
| Admin Generator&lt;br /&gt;
| Yes&lt;br /&gt;
| Yes&lt;br /&gt;
| No&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Advantages ==&lt;br /&gt;
# Binding server side state to users' sessions is incredibly powerful. Each user can have a living representation in the server that talks to other users' representations.&amp;lt;ref name=adv&amp;gt;[http://stanford.wikia.com/wiki/Project_2:_Lift,_the_Scala_Web_framework Lift Project]&amp;lt;/ref&amp;gt;&lt;br /&gt;
# Built-in Comet support possibly the best Comet support in web frameworks. Pushing data to the browser is as simple as calling partialUpdate or asking for a full re-rendering of the component. Updates of multiple components are automatically serialized in a unique connection.&lt;br /&gt;
# Long-live closures simplify form processing and can be used to create complex wizards.&lt;br /&gt;
# View-first approach helps with 'Lean Controller, Fat Model'.&lt;br /&gt;
# Server state machines support for models, including timeouts. For instance, we can use a machine to specify that after three days without confirmation, a new account has to be deleted. Consequently, there is no need for cron and script/runner type solutions in Rails. Instead of imperatively stating what maintenance operations to do; state what rules to enforce and it is automatically done when necessary.&lt;br /&gt;
&lt;br /&gt;
== Disadvantages ==&lt;br /&gt;
&lt;br /&gt;
# Moving state to the server comes with all disadvantages discussed in class. That being said, various remote actors libraries are currently being developed and would permit actors living in different JVMs (running possibly on different machines) to communicate between each others seamlessly. &amp;lt;ref name=adv&amp;gt;[http://stanford.wikia.com/wiki/Project_2:_Lift,_the_Scala_Web_framework Lift Project]&amp;lt;/ref&amp;gt;Furthermore, it is often possible to architect an application such that loosely coupled components can live on different machines -- it is definitely possible with the stock trading application we will present during our in-class presentation.&lt;br /&gt;
# Terrible API (i.e. badly chosen names, confusing domain model) and no documentation at all (the Scala documentation is OK, though).&lt;br /&gt;
# Despite the fact that the API is stabilizing (unfortunately?), most of the tutorials are outdated.&lt;br /&gt;
# Routing is a nightmare for no infrastructure is available. &lt;br /&gt;
# Despite the fact that we can't move logic from snippets to templates, it is possible to move XHTML from templates to snippets. It is not always clear where the view has to be. Is a snippet a controller or a dynamically generated view? Is there actually a difference between the two?&lt;br /&gt;
&lt;br /&gt;
== Get Started ==&lt;br /&gt;
&lt;br /&gt;
The Lift Cookbook is the best place to start with using the Lift Framework.&lt;br /&gt;
[http://cookbook.liftweb.net/ CookBook]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&amp;lt;references&amp;gt;&amp;lt;/references&amp;gt;&lt;/div&gt;</summary>
		<author><name>Aprasad3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/ch1a_4_wl&amp;diff=88504</id>
		<title>CSC/ECE 517 Fall 2014/ch1a 4 wl</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/ch1a_4_wl&amp;diff=88504"/>
		<updated>2014-09-25T23:04:05Z</updated>

		<summary type="html">&lt;p&gt;Aprasad3: /* Components */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;WEB DEVELOPMENT USING LIFT&lt;br /&gt;
==Introduction==&lt;br /&gt;
Lift is a web framework designed to make the most powerful techniques easily accessible while keeping the overall framework simple and flexible. Lift has picked some of the best ideas from a number of other frameworks while creating some of it's own novel ideas. This combination of solid foundation and new techniques makes Lift a powerful framework. The clear separation of presentation content and logic based on the concept of Model View Controller pattern is one of the key strengths of the framework.&lt;br /&gt;
&lt;br /&gt;
     &amp;quot;Lift is the kind of web framework that enables you as a developer to concentrate on the big picture. Strong, expressive typing and higher-level&lt;br /&gt;
      features like the built-in Comet support allow you to focus on innovating instead of the plumbing.&amp;quot; -- Novell&amp;lt;ref name=overview&amp;gt;[http://www.liftweb.net/lift_overview Lift Overview]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Background==&lt;br /&gt;
Lift is an open source software licensed under an Apache 2.0 license. Lift 2.5 is the latest stable version released and the Lift community has already started development for Lift 3.0. The source code can be found of the GitHub repository.&amp;lt;ref name=github&amp;gt;[https://github.com/lift/framework Lift Source Code]&amp;lt;/ref&amp;gt;&lt;br /&gt;
Lift borrows from the best of existing frameworks, providing: &lt;br /&gt;
*Seaside’s highly granular sessions and security.&lt;br /&gt;
*Rails’s fast flash-to-bang.&lt;br /&gt;
*Django’s “more than just CRUD is included”.&lt;br /&gt;
*Wicket’s designer-friendly templating style.&amp;lt;ref name=wiki&amp;gt;[https://www.assembla.com/spaces/liftweb/wiki/Home Lift Developers' wiki]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Lift is built on top of the Scala programming language. Scala is a relatively new language which compiles to Java bytecode and runs on the JVM. Scala was developed by Martin Odersky. Since lift is built on Scala, the vast ecosystem of Java libraries can be leveraged for the web development like any other Java based web framework. Lift also uses the extensive XML library support and processing capabilities of the Scala language.&lt;br /&gt;
&lt;br /&gt;
== The Scala Programming Language ==&lt;br /&gt;
&lt;br /&gt;
Scala is a statically typed multi-paradigm programming language integrating features of object-oriented and functional languages. It runs on the JVM and is fully interoperable with Java. Scala is equipped with an expressive type system providing a powerful basis for the safe reuse of component abstractions and provides a combination of language mechanisms that make it easy to smoothly add new language constructs as libraries. The resulting language scalability -- as praised in Guy Steele's famous 1998 OOPSLA keynote, is illustrated by Scala's lightweight actor library. Furthermore, Scala syntax supports native XML literals.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Features of Lift Web Framework ==&lt;br /&gt;
*   '''LazyLoading:''' Lift supports lazy loading of a snippet. This is useful when a snippet may take a long time to render, but it is required to return the page to the browser quickly.&lt;br /&gt;
&lt;br /&gt;
*  '''Parallel Page rendering:''' Executing multiple snippets in parallel is possible in Lift. Multiple jobs or processes can be spawned and run in parallel. However only when all the tasks or jobs are complete the final page render is sent back to the browser.&lt;br /&gt;
&lt;br /&gt;
*   '''Comet and Ajax support:''' Comet along with Ajax supports the asynchronous updates from user to the server or from server back to the user.&lt;br /&gt;
&lt;br /&gt;
*   '''Wiring:''' The relationship between different elements on a page is defined through Lift Wiring. When any element on a page changes, the dependent items are displayed on the next HTTP response.&lt;br /&gt;
&lt;br /&gt;
*   '''Security:''' Lift apps are not vulnerable to the common security concerns. Lift has built-in safeguards to combat vulnerabilities like Injection, [http://en.wikipedia.org/wiki/Cross-site_scripting XSS], Direct Object references and URL access&lt;br /&gt;
&lt;br /&gt;
*   '''Developer centric:''' Lift apps are fast to build, concise and easy to maintain and can be developed in totally designer friendly way.&lt;br /&gt;
&lt;br /&gt;
*  '''Scalable:''' Lift apps are high performance and scale in the real world to handle the high volume of traffic.&lt;br /&gt;
&lt;br /&gt;
*  ''' Modular:''' Lift apps can benefit from, easy to integrate, pre built modules&amp;lt;ref name=liftweb&amp;gt;[http://liftweb.net/ Lift Official HomePage]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Comparison to Rails ==&lt;br /&gt;
&lt;br /&gt;
=== The View-First Approach ===&lt;br /&gt;
&lt;br /&gt;
Templates in Lift are used for display only and never contain programming logic. Consequently, they can be manipulated by non-programmers with tools such as Dreamweaver. Furthermore, contrarily to Rails, Lift snippets are invoked by the template, and not vice versa. The following template illustrates the view-first approach by invoking the form method in the User snippet using the &amp;lt;lift:snippet&amp;gt; tag. The body of this tag can refer to values bound by the User snippet in the snippet-defined fields namespace.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;html xmlns=&amp;quot;http://www.w3.org/1999/xhtml&amp;quot; xmlns:lift=&amp;quot;http://liftweb.net/&amp;quot;&amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;lt;lift:snippet type=&amp;quot;user:form&amp;quot; form=&amp;quot;POST&amp;quot;&amp;gt;&lt;br /&gt;
    First name &amp;lt;fields:first /&amp;gt;&lt;br /&gt;
    Last name &amp;lt;fields:last /&amp;gt;&lt;br /&gt;
    &amp;lt;fields:submit /&amp;gt;&lt;br /&gt;
  &amp;lt;/lift:snippet&amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
&amp;lt;/html&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Rails' controller-first dispatch mechanism makes the assumption that there is only one piece of logic on the page and the rest is decoration. When a page contains more than one piece of logic (e.g. a shopping cart and an interactive chat), having to choose a single piece of logic make the controller code complicated. This usually require some combination of controller inheritance (move common logic into the superclass of controllers -- e.g. put the shopping cart code in the ApplicationController), moving code from controllers into helpers and models, and the use of partial views.&lt;br /&gt;
&lt;br /&gt;
Finally, the view-first approach allows the templates to easily glue different components together. However, when gluing components gets more complicated (e.g. when dependencies must be satisfied), the simplicity of this approach fails and actual code has to be written.&amp;lt;ref name=viewfirst&amp;gt;[http://stanford.wikia.com/wiki/Project_2:_Lift,_the_Scala_Web_framework View-First Approach]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Long-Lived Closures ===&lt;br /&gt;
Lift allows the server application to attach closures to elements rendered in the user interface (e.g. form elements). The following snippet illustrates to usage of such closures.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class User {&lt;br /&gt;
  def form(template: Group) = {&lt;br /&gt;
    var first, last = &amp;quot;&amp;quot;&lt;br /&gt;
    bind(&amp;quot;fields&amp;quot;, template,&lt;br /&gt;
      &amp;quot;first&amp;quot;  --&amp;gt; text(&amp;quot;&amp;quot;, n =&amp;gt; first = n),&lt;br /&gt;
      &amp;quot;last&amp;quot;   --&amp;gt; text(&amp;quot;&amp;quot;, l =&amp;gt; last = l),&lt;br /&gt;
      &amp;quot;submit&amp;quot; --&amp;gt; submit(&amp;quot;Submit&amp;quot;, ignore =&amp;gt; process(first, last)))&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  def process(first: String, last: String) {&lt;br /&gt;
    ...&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The n =&amp;gt; first = n and l =&amp;gt; last = l anonymous functions are attached to two text inputs. The input Lift passes to these functions is the value of the element. The body of these two functions assign the value of text input to the first and last variables. The ignore =&amp;gt; process(first, last) anonymous function is attached to the submit button. In this case, we ignore the argument adequately named ignore because a button doesn't have a value. The body is call another function that could, for instance, store the two names in a database.&lt;br /&gt;
&lt;br /&gt;
To achieve this magic, Lift stores the closures in a map when the component is rendered. Randomly generated strings are used as keys and inserted in the generated HTML elements. When the form is submitted, Lift looks for the closures in the map based on the provided keys and executes them. Note how the first and last variables are captured by the three closures and, consequently, stored between the two request-response cycles.&lt;br /&gt;
&lt;br /&gt;
The advantage of this approach is that snippets can specify what happens when a specific button is pushed rather than having a controller parsing the submitted form and process the parameters extracted from the HTTP request. In essence, Lift allows you to specify server-side actions corresponding to user actions when the form is rendered rather than processing the results to figure out what actions the user performed during the next request. This reduces the need for magic constants used to map actions between the rendered view and controllers in other frameworks. In Rails, you might create a form with two buttons labeled 'Buy Now' and 'Buy Later' and then compare the submit parameter to 'Buy Now' and 'Buy Later' in the controller to determine the appropriate action. In Lift, this can be done with two different bindings in the render function.&amp;lt;ref name = closure&amp;gt;[http://stanford.wikia.com/wiki/Project_2:_Lift,_the_Scala_Web_framework Closures]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Lift Web Framework ==&lt;br /&gt;
&amp;lt;div class=&amp;quot;center&amp;quot;&amp;gt; [[File:LiftArchDiagram.jpg]] &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Components ===&lt;br /&gt;
#	LiftCore: This is the web processor of the framework which handles the following functions.&lt;br /&gt;
##	Request/Response&lt;br /&gt;
##	Rendering Pipeline&lt;br /&gt;
##	Invoking User Functions&lt;br /&gt;
#	LiftRules : Lift Configuration Management. Allows you to configure Lift. &lt;br /&gt;
#	LiftSession: Inherent Session State Representation.&amp;lt;ref name=liftsession&amp;gt;[http://exploring.liftweb.net/master/index-9.html#sec:Session-Management Session Management]&amp;lt;/ref&amp;gt;&lt;br /&gt;
#	S: The stateful object impersonating the state context for a given request/response lifecycle.&amp;lt;ref name=s&amp;gt;[http://exploring.liftweb.net/master/index-9.html#sub:Advanced-S-Object S Object]&amp;lt;/ref&amp;gt;&lt;br /&gt;
#	SiteMap: contains web pages for the lift application.&amp;lt;ref name=sitemap&amp;gt;[http://exploring.liftweb.net/master/index-7.html#cha:SiteMap SiteMap]&amp;lt;/ref&amp;gt;&lt;br /&gt;
#	SHtml: helper functions for XHtml.&amp;lt;ref name=shtml&amp;gt;[http://exploring.liftweb.net/master/index-11.html#cha:AJAX-and-COMET SHtml]&amp;lt;/ref&amp;gt;&lt;br /&gt;
#	Views: LiftView objects impersonating a view as a XML content. Thus pages can be composed from other sources not only from html files.&amp;lt;ref name=views&amp;gt;[http://exploring.liftweb.net/master/index-4.html#sec:Views Lift Views]&amp;lt;/ref&amp;gt;&lt;br /&gt;
#	LiftResponse: Represents the abstraction of a response that will be propagated to the client. &amp;lt;ref name=response&amp;gt;[http://exploring.liftweb.net/master/index-9.html#sec:LiftResponse-in-Detail Lift Response]&amp;lt;/ref&amp;gt;&lt;br /&gt;
#	Comet: allows sending asynchronous content to browser.&amp;lt;ref name =comet&amp;gt;[http://exploring.liftweb.net/master/index-11.html#sec:COMET Comet]&amp;lt;/ref&amp;gt;&lt;br /&gt;
#	[http://en.wikipedia.org/wiki/Object-relational_mapping ORM]: Either Mapper or Record - The lightweight ORM library provided by Lift. The Mapper framework is the proposed ORM framework for Lift 1.0 and the Record framework will be out for next releases. &lt;br /&gt;
#	HTTP Auth: provides control over authentication model.&amp;lt;ref name=orm&amp;gt;[http://exploring.liftweb.net/master/index-8.html#cha:mapper_and_record HTTP Auth]&amp;lt;/ref&amp;gt;&lt;br /&gt;
#	JS API: The JavaScript abstraction layer. These are Scala classes/objects that abstract JavaScript artifacts. Such objects can be combined to build JavaScript code .&amp;lt;ref name=js&amp;gt;[http://exploring.liftweb.net/master/index-10.html#cha:Lift-and-Javascript JS]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Getting Started ==&lt;br /&gt;
&lt;br /&gt;
=== Set Up on Eclipse ===&lt;br /&gt;
&lt;br /&gt;
#	Download “Scala IDE for Eclipse” : http://scala-ide.org/&lt;br /&gt;
#	Install plugin in Eclipse from this update site : http://download.scala-ide.org/sdk/helium/e38/scala211/stable/site&lt;br /&gt;
#	Once the plugin is installed restart Eclipse&lt;br /&gt;
#	Install sbteclipse  by adding the following to projects/plugins.sbt in your Lift Project: &amp;lt;code&amp;gt; addSbtPlugin(&amp;quot;com.typesafe.sbteclipse&amp;quot; % &amp;quot;sbteclipse-plugin&amp;quot; % &amp;quot;2.5.0&amp;quot;) &amp;lt;/code&amp;gt;&amp;lt;ref name=sbt&amp;gt;[http://en.wikipedia.org/wiki/SBT_(software) SBT]&amp;lt;/ref&amp;gt;&lt;br /&gt;
#	You can then create Eclipse project files (.project and .classpath) by entering the following into the SBT prompt: &amp;lt;code&amp;gt; eclipse &amp;lt;/code&amp;gt;&amp;lt;ref name=cookbook&amp;gt;[http://cookbook.liftweb.net/ The Lift Cookbook]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Setup Video Tutorial : [http://www.youtube.com/watch?v=qRIiUUKA2Mw link] &lt;br /&gt;
&lt;br /&gt;
== Basic Web Application Structure ==&lt;br /&gt;
&lt;br /&gt;
=== Step 1: Making a SiteMap entry ===&lt;br /&gt;
&lt;br /&gt;
Every page on the site needs a SiteMap entry.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def sitemap(): SiteMap = SiteMap(&lt;br /&gt;
  Menu(&amp;quot;Home&amp;quot;) / &amp;quot;index&amp;quot;,&lt;br /&gt;
  Menu(&amp;quot;Second Page&amp;quot;) / &amp;quot;second&amp;quot;&lt;br /&gt;
)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Step 2: Creating the view ===&lt;br /&gt;
Create an HTML file that corresponds to the sitemap entry.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;meta content=&amp;quot;text/html; charset=UTF-8&amp;quot; http-equiv=&amp;quot;content-type&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;title&amp;gt;Home&amp;lt;/title&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;div id=&amp;quot;main&amp;quot; class=&amp;quot;lift:surround?with=default&amp;amp;at=content&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;div&amp;gt;&lt;br /&gt;
        Hi, I'm a page that contains the time:&lt;br /&gt;
        &amp;lt;span class=&amp;quot;lift:TimeNow&amp;quot;&amp;gt;??? some time&amp;lt;/span&amp;gt;.&lt;br /&gt;
      &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
      &amp;lt;div&amp;gt;&lt;br /&gt;
        And a button: &amp;lt;button class=&amp;quot;lift:ClickMe&amp;quot;&amp;gt;Click Me&amp;lt;/button&amp;gt;.&lt;br /&gt;
      &amp;lt;/div&amp;gt;&lt;br /&gt;
    &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Step 3 : Creating the Snippet ===&lt;br /&gt;
&lt;br /&gt;
A snippet can be thought of as a controller which has rules for transforming the section of your template.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
package code&lt;br /&gt;
package snippet&lt;br /&gt;
&lt;br /&gt;
import net.liftweb._&lt;br /&gt;
import util._&lt;br /&gt;
import Helpers._&lt;br /&gt;
&lt;br /&gt;
object TimeNow {&lt;br /&gt;
  def render = &amp;quot;* *&amp;quot; #&amp;gt; now.toString&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&amp;lt;ref name=simplylift&amp;gt;[http://simply.liftweb.net/ Simply Lift]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Framework Comparison ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! &lt;br /&gt;
! Lift&lt;br /&gt;
! Rails&lt;br /&gt;
! Play&lt;br /&gt;
|-&lt;br /&gt;
| Scaffolding&lt;br /&gt;
| No&lt;br /&gt;
| Yes&lt;br /&gt;
| Yes&lt;br /&gt;
|-&lt;br /&gt;
| Design Pattern&lt;br /&gt;
| MVVM&lt;br /&gt;
| MVC&lt;br /&gt;
| MVC&lt;br /&gt;
|-&lt;br /&gt;
| Programming language&lt;br /&gt;
| Scala&lt;br /&gt;
| Ruby&lt;br /&gt;
| Java&lt;br /&gt;
|-&lt;br /&gt;
| Template language&lt;br /&gt;
| HTML5&lt;br /&gt;
| ERB/HAML&lt;br /&gt;
| Groovy/Japid&lt;br /&gt;
|-&lt;br /&gt;
| Dynamic Typing&lt;br /&gt;
| No&lt;br /&gt;
| Yes&lt;br /&gt;
| No&lt;br /&gt;
|-&lt;br /&gt;
| Admin Generator&lt;br /&gt;
| Yes&lt;br /&gt;
| Yes&lt;br /&gt;
| No&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Advantages ==&lt;br /&gt;
# Binding server side state to users' sessions is incredibly powerful. Each user can have a living representation in the server that talks to other users' representations.&amp;lt;ref name=adv&amp;gt;[http://stanford.wikia.com/wiki/Project_2:_Lift,_the_Scala_Web_framework Lift Project]&amp;lt;/ref&amp;gt;&lt;br /&gt;
# Built-in Comet support possibly the best Comet support in web frameworks. Pushing data to the browser is as simple as calling partialUpdate or asking for a full re-rendering of the component. Updates of multiple components are automatically serialized in a unique connection.&lt;br /&gt;
# Long-live closures simplify form processing and can be used to create complex wizards.&lt;br /&gt;
# View-first approach helps with 'Lean Controller, Fat Model'.&lt;br /&gt;
# Server state machines support for models, including timeouts. For instance, we can use a machine to specify that after three days without confirmation, a new account has to be deleted. Consequently, there is no need for cron and script/runner type solutions in Rails. Instead of imperatively stating what maintenance operations to do; state what rules to enforce and it is automatically done when necessary.&lt;br /&gt;
&lt;br /&gt;
== Disadvantages ==&lt;br /&gt;
&lt;br /&gt;
# Moving state to the server comes with all disadvantages discussed in class. That being said, various remote actors libraries are currently being developed and would permit actors living in different JVMs (running possibly on different machines) to communicate between each others seamlessly. &amp;lt;ref name=adv&amp;gt;[http://stanford.wikia.com/wiki/Project_2:_Lift,_the_Scala_Web_framework Lift Project]&amp;lt;/ref&amp;gt;Furthermore, it is often possible to architect an application such that loosely coupled components can live on different machines -- it is definitely possible with the stock trading application we will present during our in-class presentation.&lt;br /&gt;
# Terrible API (i.e. badly chosen names, confusing domain model) and no documentation at all (the Scala documentation is OK, though).&lt;br /&gt;
# Despite the fact that the API is stabilizing (unfortunately?), most of the tutorials are outdated.&lt;br /&gt;
# Routing is a nightmare for no infrastructure is available. &lt;br /&gt;
# Despite the fact that we can't move logic from snippets to templates, it is possible to move XHTML from templates to snippets. It is not always clear where the view has to be. Is a snippet a controller or a dynamically generated view? Is there actually a difference between the two?&lt;br /&gt;
&lt;br /&gt;
== Get Started ==&lt;br /&gt;
&lt;br /&gt;
The Lift Cookbook is the best place to start with using the Lift Framework.&lt;br /&gt;
[http://cookbook.liftweb.net/ CookBook]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&amp;lt;references&amp;gt;&amp;lt;/references&amp;gt;&lt;/div&gt;</summary>
		<author><name>Aprasad3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/ch1a_4_wl&amp;diff=88503</id>
		<title>CSC/ECE 517 Fall 2014/ch1a 4 wl</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/ch1a_4_wl&amp;diff=88503"/>
		<updated>2014-09-25T23:03:37Z</updated>

		<summary type="html">&lt;p&gt;Aprasad3: /* Components */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;WEB DEVELOPMENT USING LIFT&lt;br /&gt;
==Introduction==&lt;br /&gt;
Lift is a web framework designed to make the most powerful techniques easily accessible while keeping the overall framework simple and flexible. Lift has picked some of the best ideas from a number of other frameworks while creating some of it's own novel ideas. This combination of solid foundation and new techniques makes Lift a powerful framework. The clear separation of presentation content and logic based on the concept of Model View Controller pattern is one of the key strengths of the framework.&lt;br /&gt;
&lt;br /&gt;
     &amp;quot;Lift is the kind of web framework that enables you as a developer to concentrate on the big picture. Strong, expressive typing and higher-level&lt;br /&gt;
      features like the built-in Comet support allow you to focus on innovating instead of the plumbing.&amp;quot; -- Novell&amp;lt;ref name=overview&amp;gt;[http://www.liftweb.net/lift_overview Lift Overview]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Background==&lt;br /&gt;
Lift is an open source software licensed under an Apache 2.0 license. Lift 2.5 is the latest stable version released and the Lift community has already started development for Lift 3.0. The source code can be found of the GitHub repository.&amp;lt;ref name=github&amp;gt;[https://github.com/lift/framework Lift Source Code]&amp;lt;/ref&amp;gt;&lt;br /&gt;
Lift borrows from the best of existing frameworks, providing: &lt;br /&gt;
*Seaside’s highly granular sessions and security.&lt;br /&gt;
*Rails’s fast flash-to-bang.&lt;br /&gt;
*Django’s “more than just CRUD is included”.&lt;br /&gt;
*Wicket’s designer-friendly templating style.&amp;lt;ref name=wiki&amp;gt;[https://www.assembla.com/spaces/liftweb/wiki/Home Lift Developers' wiki]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Lift is built on top of the Scala programming language. Scala is a relatively new language which compiles to Java bytecode and runs on the JVM. Scala was developed by Martin Odersky. Since lift is built on Scala, the vast ecosystem of Java libraries can be leveraged for the web development like any other Java based web framework. Lift also uses the extensive XML library support and processing capabilities of the Scala language.&lt;br /&gt;
&lt;br /&gt;
== The Scala Programming Language ==&lt;br /&gt;
&lt;br /&gt;
Scala is a statically typed multi-paradigm programming language integrating features of object-oriented and functional languages. It runs on the JVM and is fully interoperable with Java. Scala is equipped with an expressive type system providing a powerful basis for the safe reuse of component abstractions and provides a combination of language mechanisms that make it easy to smoothly add new language constructs as libraries. The resulting language scalability -- as praised in Guy Steele's famous 1998 OOPSLA keynote, is illustrated by Scala's lightweight actor library. Furthermore, Scala syntax supports native XML literals.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Features of Lift Web Framework ==&lt;br /&gt;
*   '''LazyLoading:''' Lift supports lazy loading of a snippet. This is useful when a snippet may take a long time to render, but it is required to return the page to the browser quickly.&lt;br /&gt;
&lt;br /&gt;
*  '''Parallel Page rendering:''' Executing multiple snippets in parallel is possible in Lift. Multiple jobs or processes can be spawned and run in parallel. However only when all the tasks or jobs are complete the final page render is sent back to the browser.&lt;br /&gt;
&lt;br /&gt;
*   '''Comet and Ajax support:''' Comet along with Ajax supports the asynchronous updates from user to the server or from server back to the user.&lt;br /&gt;
&lt;br /&gt;
*   '''Wiring:''' The relationship between different elements on a page is defined through Lift Wiring. When any element on a page changes, the dependent items are displayed on the next HTTP response.&lt;br /&gt;
&lt;br /&gt;
*   '''Security:''' Lift apps are not vulnerable to the common security concerns. Lift has built-in safeguards to combat vulnerabilities like Injection, [http://en.wikipedia.org/wiki/Cross-site_scripting XSS], Direct Object references and URL access&lt;br /&gt;
&lt;br /&gt;
*   '''Developer centric:''' Lift apps are fast to build, concise and easy to maintain and can be developed in totally designer friendly way.&lt;br /&gt;
&lt;br /&gt;
*  '''Scalable:''' Lift apps are high performance and scale in the real world to handle the high volume of traffic.&lt;br /&gt;
&lt;br /&gt;
*  ''' Modular:''' Lift apps can benefit from, easy to integrate, pre built modules&amp;lt;ref name=liftweb&amp;gt;[http://liftweb.net/ Lift Official HomePage]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Comparison to Rails ==&lt;br /&gt;
&lt;br /&gt;
=== The View-First Approach ===&lt;br /&gt;
&lt;br /&gt;
Templates in Lift are used for display only and never contain programming logic. Consequently, they can be manipulated by non-programmers with tools such as Dreamweaver. Furthermore, contrarily to Rails, Lift snippets are invoked by the template, and not vice versa. The following template illustrates the view-first approach by invoking the form method in the User snippet using the &amp;lt;lift:snippet&amp;gt; tag. The body of this tag can refer to values bound by the User snippet in the snippet-defined fields namespace.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;html xmlns=&amp;quot;http://www.w3.org/1999/xhtml&amp;quot; xmlns:lift=&amp;quot;http://liftweb.net/&amp;quot;&amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;lt;lift:snippet type=&amp;quot;user:form&amp;quot; form=&amp;quot;POST&amp;quot;&amp;gt;&lt;br /&gt;
    First name &amp;lt;fields:first /&amp;gt;&lt;br /&gt;
    Last name &amp;lt;fields:last /&amp;gt;&lt;br /&gt;
    &amp;lt;fields:submit /&amp;gt;&lt;br /&gt;
  &amp;lt;/lift:snippet&amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
&amp;lt;/html&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Rails' controller-first dispatch mechanism makes the assumption that there is only one piece of logic on the page and the rest is decoration. When a page contains more than one piece of logic (e.g. a shopping cart and an interactive chat), having to choose a single piece of logic make the controller code complicated. This usually require some combination of controller inheritance (move common logic into the superclass of controllers -- e.g. put the shopping cart code in the ApplicationController), moving code from controllers into helpers and models, and the use of partial views.&lt;br /&gt;
&lt;br /&gt;
Finally, the view-first approach allows the templates to easily glue different components together. However, when gluing components gets more complicated (e.g. when dependencies must be satisfied), the simplicity of this approach fails and actual code has to be written.&amp;lt;ref name=viewfirst&amp;gt;[http://stanford.wikia.com/wiki/Project_2:_Lift,_the_Scala_Web_framework View-First Approach]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Long-Lived Closures ===&lt;br /&gt;
Lift allows the server application to attach closures to elements rendered in the user interface (e.g. form elements). The following snippet illustrates to usage of such closures.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class User {&lt;br /&gt;
  def form(template: Group) = {&lt;br /&gt;
    var first, last = &amp;quot;&amp;quot;&lt;br /&gt;
    bind(&amp;quot;fields&amp;quot;, template,&lt;br /&gt;
      &amp;quot;first&amp;quot;  --&amp;gt; text(&amp;quot;&amp;quot;, n =&amp;gt; first = n),&lt;br /&gt;
      &amp;quot;last&amp;quot;   --&amp;gt; text(&amp;quot;&amp;quot;, l =&amp;gt; last = l),&lt;br /&gt;
      &amp;quot;submit&amp;quot; --&amp;gt; submit(&amp;quot;Submit&amp;quot;, ignore =&amp;gt; process(first, last)))&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  def process(first: String, last: String) {&lt;br /&gt;
    ...&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The n =&amp;gt; first = n and l =&amp;gt; last = l anonymous functions are attached to two text inputs. The input Lift passes to these functions is the value of the element. The body of these two functions assign the value of text input to the first and last variables. The ignore =&amp;gt; process(first, last) anonymous function is attached to the submit button. In this case, we ignore the argument adequately named ignore because a button doesn't have a value. The body is call another function that could, for instance, store the two names in a database.&lt;br /&gt;
&lt;br /&gt;
To achieve this magic, Lift stores the closures in a map when the component is rendered. Randomly generated strings are used as keys and inserted in the generated HTML elements. When the form is submitted, Lift looks for the closures in the map based on the provided keys and executes them. Note how the first and last variables are captured by the three closures and, consequently, stored between the two request-response cycles.&lt;br /&gt;
&lt;br /&gt;
The advantage of this approach is that snippets can specify what happens when a specific button is pushed rather than having a controller parsing the submitted form and process the parameters extracted from the HTTP request. In essence, Lift allows you to specify server-side actions corresponding to user actions when the form is rendered rather than processing the results to figure out what actions the user performed during the next request. This reduces the need for magic constants used to map actions between the rendered view and controllers in other frameworks. In Rails, you might create a form with two buttons labeled 'Buy Now' and 'Buy Later' and then compare the submit parameter to 'Buy Now' and 'Buy Later' in the controller to determine the appropriate action. In Lift, this can be done with two different bindings in the render function.&amp;lt;ref name = closure&amp;gt;[http://stanford.wikia.com/wiki/Project_2:_Lift,_the_Scala_Web_framework Closures]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Lift Web Framework ==&lt;br /&gt;
&amp;lt;div class=&amp;quot;center&amp;quot;&amp;gt; [[File:LiftArchDiagram.jpg]] &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Components ===&lt;br /&gt;
#	LiftCore: This is the web processor of the framework which handles the following functions.&lt;br /&gt;
##	Request/Response&lt;br /&gt;
##	Rendering Pipeline&lt;br /&gt;
##	Invoking User Functions&lt;br /&gt;
#	LiftRules : Lift Configuration Management. Allows you to configure Lift. &lt;br /&gt;
#	LiftSession: Inherent Session State Representation.&amp;lt;ref name=liftsession&amp;gt;[http://exploring.liftweb.net/master/index-9.html#sec:Session-Management Session Management]&amp;lt;/ref&amp;gt;&lt;br /&gt;
#	S: The stateful object impersonating the state context for a given request/response lifecycle.&amp;lt;ref name=s&amp;gt;[http://exploring.liftweb.net/master/index-9.html#sub:Advanced-S-Object S Object]&amp;lt;/ref&amp;gt;&lt;br /&gt;
#	SiteMap: contains web pages for the lift application.&amp;lt;ref name=sitemap&amp;gt;[http://exploring.liftweb.net/master/index-7.html#cha:SiteMap SiteMap]&amp;lt;/ref&amp;gt;&lt;br /&gt;
#	SHtml: helper functions for XHtml.&amp;lt;ref name=shtml&amp;gt;[http://exploring.liftweb.net/master/index-11.html#cha:AJAX-and-COMET SHtml]&amp;lt;/ref&amp;gt;&lt;br /&gt;
#	Views: LiftView objects impersonating a view as a XML content. Thus pages can be composed from other sources not only from html files.&amp;lt;ref name=views&amp;gt;[http://exploring.liftweb.net/master/index-4.html#sec:Views Lift Views]&amp;lt;/ref&amp;gt;&lt;br /&gt;
#	LiftResponse: Represents the abstraction of a response that will be propagated to the client. &amp;lt;ref name=response&amp;gt;[http://exploring.liftweb.net/master/index-9.html#sec:LiftResponse-in-Detail Lift Response]&amp;lt;/ref&amp;gt;&lt;br /&gt;
#	Comet: allows sending asynchronous content to browser.&amp;lt;ref name =comet&amp;gt;[http://exploring.liftweb.net/master/index-11.html#sec:COMET Comet]&amp;lt;/ref&amp;gt;&lt;br /&gt;
#	[http://en.wikipedia.org/wiki/Object-relational_mapping ORM]: Either Mapper or Record - The lightweight ORM library provided by Lift. The Mapper framework is the proposed ORM framework for Lift 1.0 and the Record framework will be out for next releases. &lt;br /&gt;
#	HTTP Auth: provides control over authentication model.&amp;lt;ref name=orm&amp;gt;[http://exploring.liftweb.net/master/index-8.html#cha:mapper_and_record]&amp;lt;/ref&amp;gt;&lt;br /&gt;
#	JS API: The JavaScript abstraction layer. These are Scala classes/objects that abstract JavaScript artifacts. Such objects can be combined to build JavaScript code .&amp;lt;ref name=js&amp;gt;[http://exploring.liftweb.net/master/index-10.html#cha:Lift-and-Javascript JS]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Getting Started ==&lt;br /&gt;
&lt;br /&gt;
=== Set Up on Eclipse ===&lt;br /&gt;
&lt;br /&gt;
#	Download “Scala IDE for Eclipse” : http://scala-ide.org/&lt;br /&gt;
#	Install plugin in Eclipse from this update site : http://download.scala-ide.org/sdk/helium/e38/scala211/stable/site&lt;br /&gt;
#	Once the plugin is installed restart Eclipse&lt;br /&gt;
#	Install sbteclipse  by adding the following to projects/plugins.sbt in your Lift Project: &amp;lt;code&amp;gt; addSbtPlugin(&amp;quot;com.typesafe.sbteclipse&amp;quot; % &amp;quot;sbteclipse-plugin&amp;quot; % &amp;quot;2.5.0&amp;quot;) &amp;lt;/code&amp;gt;&amp;lt;ref name=sbt&amp;gt;[http://en.wikipedia.org/wiki/SBT_(software) SBT]&amp;lt;/ref&amp;gt;&lt;br /&gt;
#	You can then create Eclipse project files (.project and .classpath) by entering the following into the SBT prompt: &amp;lt;code&amp;gt; eclipse &amp;lt;/code&amp;gt;&amp;lt;ref name=cookbook&amp;gt;[http://cookbook.liftweb.net/ The Lift Cookbook]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Setup Video Tutorial : [http://www.youtube.com/watch?v=qRIiUUKA2Mw link] &lt;br /&gt;
&lt;br /&gt;
== Basic Web Application Structure ==&lt;br /&gt;
&lt;br /&gt;
=== Step 1: Making a SiteMap entry ===&lt;br /&gt;
&lt;br /&gt;
Every page on the site needs a SiteMap entry.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def sitemap(): SiteMap = SiteMap(&lt;br /&gt;
  Menu(&amp;quot;Home&amp;quot;) / &amp;quot;index&amp;quot;,&lt;br /&gt;
  Menu(&amp;quot;Second Page&amp;quot;) / &amp;quot;second&amp;quot;&lt;br /&gt;
)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Step 2: Creating the view ===&lt;br /&gt;
Create an HTML file that corresponds to the sitemap entry.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;meta content=&amp;quot;text/html; charset=UTF-8&amp;quot; http-equiv=&amp;quot;content-type&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;title&amp;gt;Home&amp;lt;/title&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;div id=&amp;quot;main&amp;quot; class=&amp;quot;lift:surround?with=default&amp;amp;at=content&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;div&amp;gt;&lt;br /&gt;
        Hi, I'm a page that contains the time:&lt;br /&gt;
        &amp;lt;span class=&amp;quot;lift:TimeNow&amp;quot;&amp;gt;??? some time&amp;lt;/span&amp;gt;.&lt;br /&gt;
      &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
      &amp;lt;div&amp;gt;&lt;br /&gt;
        And a button: &amp;lt;button class=&amp;quot;lift:ClickMe&amp;quot;&amp;gt;Click Me&amp;lt;/button&amp;gt;.&lt;br /&gt;
      &amp;lt;/div&amp;gt;&lt;br /&gt;
    &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Step 3 : Creating the Snippet ===&lt;br /&gt;
&lt;br /&gt;
A snippet can be thought of as a controller which has rules for transforming the section of your template.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
package code&lt;br /&gt;
package snippet&lt;br /&gt;
&lt;br /&gt;
import net.liftweb._&lt;br /&gt;
import util._&lt;br /&gt;
import Helpers._&lt;br /&gt;
&lt;br /&gt;
object TimeNow {&lt;br /&gt;
  def render = &amp;quot;* *&amp;quot; #&amp;gt; now.toString&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&amp;lt;ref name=simplylift&amp;gt;[http://simply.liftweb.net/ Simply Lift]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Framework Comparison ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! &lt;br /&gt;
! Lift&lt;br /&gt;
! Rails&lt;br /&gt;
! Play&lt;br /&gt;
|-&lt;br /&gt;
| Scaffolding&lt;br /&gt;
| No&lt;br /&gt;
| Yes&lt;br /&gt;
| Yes&lt;br /&gt;
|-&lt;br /&gt;
| Design Pattern&lt;br /&gt;
| MVVM&lt;br /&gt;
| MVC&lt;br /&gt;
| MVC&lt;br /&gt;
|-&lt;br /&gt;
| Programming language&lt;br /&gt;
| Scala&lt;br /&gt;
| Ruby&lt;br /&gt;
| Java&lt;br /&gt;
|-&lt;br /&gt;
| Template language&lt;br /&gt;
| HTML5&lt;br /&gt;
| ERB/HAML&lt;br /&gt;
| Groovy/Japid&lt;br /&gt;
|-&lt;br /&gt;
| Dynamic Typing&lt;br /&gt;
| No&lt;br /&gt;
| Yes&lt;br /&gt;
| No&lt;br /&gt;
|-&lt;br /&gt;
| Admin Generator&lt;br /&gt;
| Yes&lt;br /&gt;
| Yes&lt;br /&gt;
| No&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Advantages ==&lt;br /&gt;
# Binding server side state to users' sessions is incredibly powerful. Each user can have a living representation in the server that talks to other users' representations.&amp;lt;ref name=adv&amp;gt;[http://stanford.wikia.com/wiki/Project_2:_Lift,_the_Scala_Web_framework Lift Project]&amp;lt;/ref&amp;gt;&lt;br /&gt;
# Built-in Comet support possibly the best Comet support in web frameworks. Pushing data to the browser is as simple as calling partialUpdate or asking for a full re-rendering of the component. Updates of multiple components are automatically serialized in a unique connection.&lt;br /&gt;
# Long-live closures simplify form processing and can be used to create complex wizards.&lt;br /&gt;
# View-first approach helps with 'Lean Controller, Fat Model'.&lt;br /&gt;
# Server state machines support for models, including timeouts. For instance, we can use a machine to specify that after three days without confirmation, a new account has to be deleted. Consequently, there is no need for cron and script/runner type solutions in Rails. Instead of imperatively stating what maintenance operations to do; state what rules to enforce and it is automatically done when necessary.&lt;br /&gt;
&lt;br /&gt;
== Disadvantages ==&lt;br /&gt;
&lt;br /&gt;
# Moving state to the server comes with all disadvantages discussed in class. That being said, various remote actors libraries are currently being developed and would permit actors living in different JVMs (running possibly on different machines) to communicate between each others seamlessly. &amp;lt;ref name=adv&amp;gt;[http://stanford.wikia.com/wiki/Project_2:_Lift,_the_Scala_Web_framework Lift Project]&amp;lt;/ref&amp;gt;Furthermore, it is often possible to architect an application such that loosely coupled components can live on different machines -- it is definitely possible with the stock trading application we will present during our in-class presentation.&lt;br /&gt;
# Terrible API (i.e. badly chosen names, confusing domain model) and no documentation at all (the Scala documentation is OK, though).&lt;br /&gt;
# Despite the fact that the API is stabilizing (unfortunately?), most of the tutorials are outdated.&lt;br /&gt;
# Routing is a nightmare for no infrastructure is available. &lt;br /&gt;
# Despite the fact that we can't move logic from snippets to templates, it is possible to move XHTML from templates to snippets. It is not always clear where the view has to be. Is a snippet a controller or a dynamically generated view? Is there actually a difference between the two?&lt;br /&gt;
&lt;br /&gt;
== Get Started ==&lt;br /&gt;
&lt;br /&gt;
The Lift Cookbook is the best place to start with using the Lift Framework.&lt;br /&gt;
[http://cookbook.liftweb.net/ CookBook]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&amp;lt;references&amp;gt;&amp;lt;/references&amp;gt;&lt;/div&gt;</summary>
		<author><name>Aprasad3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/ch1a_4_wl&amp;diff=88502</id>
		<title>CSC/ECE 517 Fall 2014/ch1a 4 wl</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/ch1a_4_wl&amp;diff=88502"/>
		<updated>2014-09-25T23:03:06Z</updated>

		<summary type="html">&lt;p&gt;Aprasad3: /* Components */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;WEB DEVELOPMENT USING LIFT&lt;br /&gt;
==Introduction==&lt;br /&gt;
Lift is a web framework designed to make the most powerful techniques easily accessible while keeping the overall framework simple and flexible. Lift has picked some of the best ideas from a number of other frameworks while creating some of it's own novel ideas. This combination of solid foundation and new techniques makes Lift a powerful framework. The clear separation of presentation content and logic based on the concept of Model View Controller pattern is one of the key strengths of the framework.&lt;br /&gt;
&lt;br /&gt;
     &amp;quot;Lift is the kind of web framework that enables you as a developer to concentrate on the big picture. Strong, expressive typing and higher-level&lt;br /&gt;
      features like the built-in Comet support allow you to focus on innovating instead of the plumbing.&amp;quot; -- Novell&amp;lt;ref name=overview&amp;gt;[http://www.liftweb.net/lift_overview Lift Overview]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Background==&lt;br /&gt;
Lift is an open source software licensed under an Apache 2.0 license. Lift 2.5 is the latest stable version released and the Lift community has already started development for Lift 3.0. The source code can be found of the GitHub repository.&amp;lt;ref name=github&amp;gt;[https://github.com/lift/framework Lift Source Code]&amp;lt;/ref&amp;gt;&lt;br /&gt;
Lift borrows from the best of existing frameworks, providing: &lt;br /&gt;
*Seaside’s highly granular sessions and security.&lt;br /&gt;
*Rails’s fast flash-to-bang.&lt;br /&gt;
*Django’s “more than just CRUD is included”.&lt;br /&gt;
*Wicket’s designer-friendly templating style.&amp;lt;ref name=wiki&amp;gt;[https://www.assembla.com/spaces/liftweb/wiki/Home Lift Developers' wiki]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Lift is built on top of the Scala programming language. Scala is a relatively new language which compiles to Java bytecode and runs on the JVM. Scala was developed by Martin Odersky. Since lift is built on Scala, the vast ecosystem of Java libraries can be leveraged for the web development like any other Java based web framework. Lift also uses the extensive XML library support and processing capabilities of the Scala language.&lt;br /&gt;
&lt;br /&gt;
== The Scala Programming Language ==&lt;br /&gt;
&lt;br /&gt;
Scala is a statically typed multi-paradigm programming language integrating features of object-oriented and functional languages. It runs on the JVM and is fully interoperable with Java. Scala is equipped with an expressive type system providing a powerful basis for the safe reuse of component abstractions and provides a combination of language mechanisms that make it easy to smoothly add new language constructs as libraries. The resulting language scalability -- as praised in Guy Steele's famous 1998 OOPSLA keynote, is illustrated by Scala's lightweight actor library. Furthermore, Scala syntax supports native XML literals.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Features of Lift Web Framework ==&lt;br /&gt;
*   '''LazyLoading:''' Lift supports lazy loading of a snippet. This is useful when a snippet may take a long time to render, but it is required to return the page to the browser quickly.&lt;br /&gt;
&lt;br /&gt;
*  '''Parallel Page rendering:''' Executing multiple snippets in parallel is possible in Lift. Multiple jobs or processes can be spawned and run in parallel. However only when all the tasks or jobs are complete the final page render is sent back to the browser.&lt;br /&gt;
&lt;br /&gt;
*   '''Comet and Ajax support:''' Comet along with Ajax supports the asynchronous updates from user to the server or from server back to the user.&lt;br /&gt;
&lt;br /&gt;
*   '''Wiring:''' The relationship between different elements on a page is defined through Lift Wiring. When any element on a page changes, the dependent items are displayed on the next HTTP response.&lt;br /&gt;
&lt;br /&gt;
*   '''Security:''' Lift apps are not vulnerable to the common security concerns. Lift has built-in safeguards to combat vulnerabilities like Injection, [http://en.wikipedia.org/wiki/Cross-site_scripting XSS], Direct Object references and URL access&lt;br /&gt;
&lt;br /&gt;
*   '''Developer centric:''' Lift apps are fast to build, concise and easy to maintain and can be developed in totally designer friendly way.&lt;br /&gt;
&lt;br /&gt;
*  '''Scalable:''' Lift apps are high performance and scale in the real world to handle the high volume of traffic.&lt;br /&gt;
&lt;br /&gt;
*  ''' Modular:''' Lift apps can benefit from, easy to integrate, pre built modules&amp;lt;ref name=liftweb&amp;gt;[http://liftweb.net/ Lift Official HomePage]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Comparison to Rails ==&lt;br /&gt;
&lt;br /&gt;
=== The View-First Approach ===&lt;br /&gt;
&lt;br /&gt;
Templates in Lift are used for display only and never contain programming logic. Consequently, they can be manipulated by non-programmers with tools such as Dreamweaver. Furthermore, contrarily to Rails, Lift snippets are invoked by the template, and not vice versa. The following template illustrates the view-first approach by invoking the form method in the User snippet using the &amp;lt;lift:snippet&amp;gt; tag. The body of this tag can refer to values bound by the User snippet in the snippet-defined fields namespace.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;html xmlns=&amp;quot;http://www.w3.org/1999/xhtml&amp;quot; xmlns:lift=&amp;quot;http://liftweb.net/&amp;quot;&amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;lt;lift:snippet type=&amp;quot;user:form&amp;quot; form=&amp;quot;POST&amp;quot;&amp;gt;&lt;br /&gt;
    First name &amp;lt;fields:first /&amp;gt;&lt;br /&gt;
    Last name &amp;lt;fields:last /&amp;gt;&lt;br /&gt;
    &amp;lt;fields:submit /&amp;gt;&lt;br /&gt;
  &amp;lt;/lift:snippet&amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
&amp;lt;/html&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Rails' controller-first dispatch mechanism makes the assumption that there is only one piece of logic on the page and the rest is decoration. When a page contains more than one piece of logic (e.g. a shopping cart and an interactive chat), having to choose a single piece of logic make the controller code complicated. This usually require some combination of controller inheritance (move common logic into the superclass of controllers -- e.g. put the shopping cart code in the ApplicationController), moving code from controllers into helpers and models, and the use of partial views.&lt;br /&gt;
&lt;br /&gt;
Finally, the view-first approach allows the templates to easily glue different components together. However, when gluing components gets more complicated (e.g. when dependencies must be satisfied), the simplicity of this approach fails and actual code has to be written.&amp;lt;ref name=viewfirst&amp;gt;[http://stanford.wikia.com/wiki/Project_2:_Lift,_the_Scala_Web_framework View-First Approach]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Long-Lived Closures ===&lt;br /&gt;
Lift allows the server application to attach closures to elements rendered in the user interface (e.g. form elements). The following snippet illustrates to usage of such closures.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class User {&lt;br /&gt;
  def form(template: Group) = {&lt;br /&gt;
    var first, last = &amp;quot;&amp;quot;&lt;br /&gt;
    bind(&amp;quot;fields&amp;quot;, template,&lt;br /&gt;
      &amp;quot;first&amp;quot;  --&amp;gt; text(&amp;quot;&amp;quot;, n =&amp;gt; first = n),&lt;br /&gt;
      &amp;quot;last&amp;quot;   --&amp;gt; text(&amp;quot;&amp;quot;, l =&amp;gt; last = l),&lt;br /&gt;
      &amp;quot;submit&amp;quot; --&amp;gt; submit(&amp;quot;Submit&amp;quot;, ignore =&amp;gt; process(first, last)))&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  def process(first: String, last: String) {&lt;br /&gt;
    ...&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The n =&amp;gt; first = n and l =&amp;gt; last = l anonymous functions are attached to two text inputs. The input Lift passes to these functions is the value of the element. The body of these two functions assign the value of text input to the first and last variables. The ignore =&amp;gt; process(first, last) anonymous function is attached to the submit button. In this case, we ignore the argument adequately named ignore because a button doesn't have a value. The body is call another function that could, for instance, store the two names in a database.&lt;br /&gt;
&lt;br /&gt;
To achieve this magic, Lift stores the closures in a map when the component is rendered. Randomly generated strings are used as keys and inserted in the generated HTML elements. When the form is submitted, Lift looks for the closures in the map based on the provided keys and executes them. Note how the first and last variables are captured by the three closures and, consequently, stored between the two request-response cycles.&lt;br /&gt;
&lt;br /&gt;
The advantage of this approach is that snippets can specify what happens when a specific button is pushed rather than having a controller parsing the submitted form and process the parameters extracted from the HTTP request. In essence, Lift allows you to specify server-side actions corresponding to user actions when the form is rendered rather than processing the results to figure out what actions the user performed during the next request. This reduces the need for magic constants used to map actions between the rendered view and controllers in other frameworks. In Rails, you might create a form with two buttons labeled 'Buy Now' and 'Buy Later' and then compare the submit parameter to 'Buy Now' and 'Buy Later' in the controller to determine the appropriate action. In Lift, this can be done with two different bindings in the render function.&amp;lt;ref name = closure&amp;gt;[http://stanford.wikia.com/wiki/Project_2:_Lift,_the_Scala_Web_framework Closures]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Lift Web Framework ==&lt;br /&gt;
&amp;lt;div class=&amp;quot;center&amp;quot;&amp;gt; [[File:LiftArchDiagram.jpg]] &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Components ===&lt;br /&gt;
#	LiftCore: This is the web processor of the framework which handles the following functions.&lt;br /&gt;
##	Request/Response&lt;br /&gt;
##	Rendering Pipeline&lt;br /&gt;
##	Invoking User Functions&lt;br /&gt;
#	LiftRules : Lift Configuration Management. Allows you to configure Lift. &lt;br /&gt;
#	LiftSession: Inherent Session State Representation.&amp;lt;ref name=liftsession&amp;gt;[http://exploring.liftweb.net/master/index-9.html#sec:Session-Management Session Management]&amp;lt;/ref&amp;gt;&lt;br /&gt;
#	S: The stateful object impersonating the state context for a given request/response lifecycle.&amp;lt;ref name=s&amp;gt;[http://exploring.liftweb.net/master/index-9.html#sub:Advanced-S-Object S Object]&amp;lt;/ref&amp;gt;&lt;br /&gt;
#	SiteMap: contains web pages for the lift application.&amp;lt;ref name=sitemap&amp;gt;[http://exploring.liftweb.net/master/index-7.html#cha:SiteMap]&amp;lt;/ref&amp;gt;&lt;br /&gt;
#	SHtml: helper functions for XHtml.&amp;lt;ref name=shtml&amp;gt;[http://exploring.liftweb.net/master/index-11.html#cha:AJAX-and-COMET SHtml]&amp;lt;/ref&amp;gt;&lt;br /&gt;
#	Views: LiftView objects impersonating a view as a XML content. Thus pages can be composed from other sources not only from html files.&amp;lt;ref name=views&amp;gt;[http://exploring.liftweb.net/master/index-4.html#sec:Views Lift Views]&amp;lt;/ref&amp;gt;&lt;br /&gt;
#	LiftResponse: Represents the abstraction of a response that will be propagated to the client. &amp;lt;ref name=response&amp;gt;[http://exploring.liftweb.net/master/index-9.html#sec:LiftResponse-in-Detail Lift Response]&amp;lt;/ref&amp;gt;&lt;br /&gt;
#	Comet: allows sending asynchronous content to browser.&amp;lt;ref name =comet&amp;gt;[http://exploring.liftweb.net/master/index-11.html#sec:COMET Comet]&amp;lt;/ref&amp;gt;&lt;br /&gt;
#	[http://en.wikipedia.org/wiki/Object-relational_mapping ORM]: Either Mapper or Record - The lightweight ORM library provided by Lift. The Mapper framework is the proposed ORM framework for Lift 1.0 and the Record framework will be out for next releases. &lt;br /&gt;
#	HTTP Auth: provides control over authentication model.&amp;lt;ref name=orm&amp;gt;[http://exploring.liftweb.net/master/index-8.html#cha:mapper_and_record]&amp;lt;/ref&amp;gt;&lt;br /&gt;
#	JS API: The JavaScript abstraction layer. These are Scala classes/objects that abstract JavaScript artifacts. Such objects can be combined to build JavaScript code .&amp;lt;ref name=js&amp;gt;[http://exploring.liftweb.net/master/index-10.html#cha:Lift-and-Javascript]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Getting Started ==&lt;br /&gt;
&lt;br /&gt;
=== Set Up on Eclipse ===&lt;br /&gt;
&lt;br /&gt;
#	Download “Scala IDE for Eclipse” : http://scala-ide.org/&lt;br /&gt;
#	Install plugin in Eclipse from this update site : http://download.scala-ide.org/sdk/helium/e38/scala211/stable/site&lt;br /&gt;
#	Once the plugin is installed restart Eclipse&lt;br /&gt;
#	Install sbteclipse  by adding the following to projects/plugins.sbt in your Lift Project: &amp;lt;code&amp;gt; addSbtPlugin(&amp;quot;com.typesafe.sbteclipse&amp;quot; % &amp;quot;sbteclipse-plugin&amp;quot; % &amp;quot;2.5.0&amp;quot;) &amp;lt;/code&amp;gt;&amp;lt;ref name=sbt&amp;gt;[http://en.wikipedia.org/wiki/SBT_(software) SBT]&amp;lt;/ref&amp;gt;&lt;br /&gt;
#	You can then create Eclipse project files (.project and .classpath) by entering the following into the SBT prompt: &amp;lt;code&amp;gt; eclipse &amp;lt;/code&amp;gt;&amp;lt;ref name=cookbook&amp;gt;[http://cookbook.liftweb.net/ The Lift Cookbook]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Setup Video Tutorial : [http://www.youtube.com/watch?v=qRIiUUKA2Mw link] &lt;br /&gt;
&lt;br /&gt;
== Basic Web Application Structure ==&lt;br /&gt;
&lt;br /&gt;
=== Step 1: Making a SiteMap entry ===&lt;br /&gt;
&lt;br /&gt;
Every page on the site needs a SiteMap entry.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def sitemap(): SiteMap = SiteMap(&lt;br /&gt;
  Menu(&amp;quot;Home&amp;quot;) / &amp;quot;index&amp;quot;,&lt;br /&gt;
  Menu(&amp;quot;Second Page&amp;quot;) / &amp;quot;second&amp;quot;&lt;br /&gt;
)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Step 2: Creating the view ===&lt;br /&gt;
Create an HTML file that corresponds to the sitemap entry.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;meta content=&amp;quot;text/html; charset=UTF-8&amp;quot; http-equiv=&amp;quot;content-type&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;title&amp;gt;Home&amp;lt;/title&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;div id=&amp;quot;main&amp;quot; class=&amp;quot;lift:surround?with=default&amp;amp;at=content&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;div&amp;gt;&lt;br /&gt;
        Hi, I'm a page that contains the time:&lt;br /&gt;
        &amp;lt;span class=&amp;quot;lift:TimeNow&amp;quot;&amp;gt;??? some time&amp;lt;/span&amp;gt;.&lt;br /&gt;
      &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
      &amp;lt;div&amp;gt;&lt;br /&gt;
        And a button: &amp;lt;button class=&amp;quot;lift:ClickMe&amp;quot;&amp;gt;Click Me&amp;lt;/button&amp;gt;.&lt;br /&gt;
      &amp;lt;/div&amp;gt;&lt;br /&gt;
    &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Step 3 : Creating the Snippet ===&lt;br /&gt;
&lt;br /&gt;
A snippet can be thought of as a controller which has rules for transforming the section of your template.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
package code&lt;br /&gt;
package snippet&lt;br /&gt;
&lt;br /&gt;
import net.liftweb._&lt;br /&gt;
import util._&lt;br /&gt;
import Helpers._&lt;br /&gt;
&lt;br /&gt;
object TimeNow {&lt;br /&gt;
  def render = &amp;quot;* *&amp;quot; #&amp;gt; now.toString&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&amp;lt;ref name=simplylift&amp;gt;[http://simply.liftweb.net/ Simply Lift]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Framework Comparison ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! &lt;br /&gt;
! Lift&lt;br /&gt;
! Rails&lt;br /&gt;
! Play&lt;br /&gt;
|-&lt;br /&gt;
| Scaffolding&lt;br /&gt;
| No&lt;br /&gt;
| Yes&lt;br /&gt;
| Yes&lt;br /&gt;
|-&lt;br /&gt;
| Design Pattern&lt;br /&gt;
| MVVM&lt;br /&gt;
| MVC&lt;br /&gt;
| MVC&lt;br /&gt;
|-&lt;br /&gt;
| Programming language&lt;br /&gt;
| Scala&lt;br /&gt;
| Ruby&lt;br /&gt;
| Java&lt;br /&gt;
|-&lt;br /&gt;
| Template language&lt;br /&gt;
| HTML5&lt;br /&gt;
| ERB/HAML&lt;br /&gt;
| Groovy/Japid&lt;br /&gt;
|-&lt;br /&gt;
| Dynamic Typing&lt;br /&gt;
| No&lt;br /&gt;
| Yes&lt;br /&gt;
| No&lt;br /&gt;
|-&lt;br /&gt;
| Admin Generator&lt;br /&gt;
| Yes&lt;br /&gt;
| Yes&lt;br /&gt;
| No&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Advantages ==&lt;br /&gt;
# Binding server side state to users' sessions is incredibly powerful. Each user can have a living representation in the server that talks to other users' representations.&amp;lt;ref name=adv&amp;gt;[http://stanford.wikia.com/wiki/Project_2:_Lift,_the_Scala_Web_framework Lift Project]&amp;lt;/ref&amp;gt;&lt;br /&gt;
# Built-in Comet support possibly the best Comet support in web frameworks. Pushing data to the browser is as simple as calling partialUpdate or asking for a full re-rendering of the component. Updates of multiple components are automatically serialized in a unique connection.&lt;br /&gt;
# Long-live closures simplify form processing and can be used to create complex wizards.&lt;br /&gt;
# View-first approach helps with 'Lean Controller, Fat Model'.&lt;br /&gt;
# Server state machines support for models, including timeouts. For instance, we can use a machine to specify that after three days without confirmation, a new account has to be deleted. Consequently, there is no need for cron and script/runner type solutions in Rails. Instead of imperatively stating what maintenance operations to do; state what rules to enforce and it is automatically done when necessary.&lt;br /&gt;
&lt;br /&gt;
== Disadvantages ==&lt;br /&gt;
&lt;br /&gt;
# Moving state to the server comes with all disadvantages discussed in class. That being said, various remote actors libraries are currently being developed and would permit actors living in different JVMs (running possibly on different machines) to communicate between each others seamlessly. &amp;lt;ref name=adv&amp;gt;[http://stanford.wikia.com/wiki/Project_2:_Lift,_the_Scala_Web_framework Lift Project]&amp;lt;/ref&amp;gt;Furthermore, it is often possible to architect an application such that loosely coupled components can live on different machines -- it is definitely possible with the stock trading application we will present during our in-class presentation.&lt;br /&gt;
# Terrible API (i.e. badly chosen names, confusing domain model) and no documentation at all (the Scala documentation is OK, though).&lt;br /&gt;
# Despite the fact that the API is stabilizing (unfortunately?), most of the tutorials are outdated.&lt;br /&gt;
# Routing is a nightmare for no infrastructure is available. &lt;br /&gt;
# Despite the fact that we can't move logic from snippets to templates, it is possible to move XHTML from templates to snippets. It is not always clear where the view has to be. Is a snippet a controller or a dynamically generated view? Is there actually a difference between the two?&lt;br /&gt;
&lt;br /&gt;
== Get Started ==&lt;br /&gt;
&lt;br /&gt;
The Lift Cookbook is the best place to start with using the Lift Framework.&lt;br /&gt;
[http://cookbook.liftweb.net/ CookBook]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&amp;lt;references&amp;gt;&amp;lt;/references&amp;gt;&lt;/div&gt;</summary>
		<author><name>Aprasad3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/ch1a_4_wl&amp;diff=88501</id>
		<title>CSC/ECE 517 Fall 2014/ch1a 4 wl</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/ch1a_4_wl&amp;diff=88501"/>
		<updated>2014-09-25T23:02:20Z</updated>

		<summary type="html">&lt;p&gt;Aprasad3: /* Components */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;WEB DEVELOPMENT USING LIFT&lt;br /&gt;
==Introduction==&lt;br /&gt;
Lift is a web framework designed to make the most powerful techniques easily accessible while keeping the overall framework simple and flexible. Lift has picked some of the best ideas from a number of other frameworks while creating some of it's own novel ideas. This combination of solid foundation and new techniques makes Lift a powerful framework. The clear separation of presentation content and logic based on the concept of Model View Controller pattern is one of the key strengths of the framework.&lt;br /&gt;
&lt;br /&gt;
     &amp;quot;Lift is the kind of web framework that enables you as a developer to concentrate on the big picture. Strong, expressive typing and higher-level&lt;br /&gt;
      features like the built-in Comet support allow you to focus on innovating instead of the plumbing.&amp;quot; -- Novell&amp;lt;ref name=overview&amp;gt;[http://www.liftweb.net/lift_overview Lift Overview]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Background==&lt;br /&gt;
Lift is an open source software licensed under an Apache 2.0 license. Lift 2.5 is the latest stable version released and the Lift community has already started development for Lift 3.0. The source code can be found of the GitHub repository.&amp;lt;ref name=github&amp;gt;[https://github.com/lift/framework Lift Source Code]&amp;lt;/ref&amp;gt;&lt;br /&gt;
Lift borrows from the best of existing frameworks, providing: &lt;br /&gt;
*Seaside’s highly granular sessions and security.&lt;br /&gt;
*Rails’s fast flash-to-bang.&lt;br /&gt;
*Django’s “more than just CRUD is included”.&lt;br /&gt;
*Wicket’s designer-friendly templating style.&amp;lt;ref name=wiki&amp;gt;[https://www.assembla.com/spaces/liftweb/wiki/Home Lift Developers' wiki]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Lift is built on top of the Scala programming language. Scala is a relatively new language which compiles to Java bytecode and runs on the JVM. Scala was developed by Martin Odersky. Since lift is built on Scala, the vast ecosystem of Java libraries can be leveraged for the web development like any other Java based web framework. Lift also uses the extensive XML library support and processing capabilities of the Scala language.&lt;br /&gt;
&lt;br /&gt;
== The Scala Programming Language ==&lt;br /&gt;
&lt;br /&gt;
Scala is a statically typed multi-paradigm programming language integrating features of object-oriented and functional languages. It runs on the JVM and is fully interoperable with Java. Scala is equipped with an expressive type system providing a powerful basis for the safe reuse of component abstractions and provides a combination of language mechanisms that make it easy to smoothly add new language constructs as libraries. The resulting language scalability -- as praised in Guy Steele's famous 1998 OOPSLA keynote, is illustrated by Scala's lightweight actor library. Furthermore, Scala syntax supports native XML literals.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Features of Lift Web Framework ==&lt;br /&gt;
*   '''LazyLoading:''' Lift supports lazy loading of a snippet. This is useful when a snippet may take a long time to render, but it is required to return the page to the browser quickly.&lt;br /&gt;
&lt;br /&gt;
*  '''Parallel Page rendering:''' Executing multiple snippets in parallel is possible in Lift. Multiple jobs or processes can be spawned and run in parallel. However only when all the tasks or jobs are complete the final page render is sent back to the browser.&lt;br /&gt;
&lt;br /&gt;
*   '''Comet and Ajax support:''' Comet along with Ajax supports the asynchronous updates from user to the server or from server back to the user.&lt;br /&gt;
&lt;br /&gt;
*   '''Wiring:''' The relationship between different elements on a page is defined through Lift Wiring. When any element on a page changes, the dependent items are displayed on the next HTTP response.&lt;br /&gt;
&lt;br /&gt;
*   '''Security:''' Lift apps are not vulnerable to the common security concerns. Lift has built-in safeguards to combat vulnerabilities like Injection, [http://en.wikipedia.org/wiki/Cross-site_scripting XSS], Direct Object references and URL access&lt;br /&gt;
&lt;br /&gt;
*   '''Developer centric:''' Lift apps are fast to build, concise and easy to maintain and can be developed in totally designer friendly way.&lt;br /&gt;
&lt;br /&gt;
*  '''Scalable:''' Lift apps are high performance and scale in the real world to handle the high volume of traffic.&lt;br /&gt;
&lt;br /&gt;
*  ''' Modular:''' Lift apps can benefit from, easy to integrate, pre built modules&amp;lt;ref name=liftweb&amp;gt;[http://liftweb.net/ Lift Official HomePage]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Comparison to Rails ==&lt;br /&gt;
&lt;br /&gt;
=== The View-First Approach ===&lt;br /&gt;
&lt;br /&gt;
Templates in Lift are used for display only and never contain programming logic. Consequently, they can be manipulated by non-programmers with tools such as Dreamweaver. Furthermore, contrarily to Rails, Lift snippets are invoked by the template, and not vice versa. The following template illustrates the view-first approach by invoking the form method in the User snippet using the &amp;lt;lift:snippet&amp;gt; tag. The body of this tag can refer to values bound by the User snippet in the snippet-defined fields namespace.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;html xmlns=&amp;quot;http://www.w3.org/1999/xhtml&amp;quot; xmlns:lift=&amp;quot;http://liftweb.net/&amp;quot;&amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;lt;lift:snippet type=&amp;quot;user:form&amp;quot; form=&amp;quot;POST&amp;quot;&amp;gt;&lt;br /&gt;
    First name &amp;lt;fields:first /&amp;gt;&lt;br /&gt;
    Last name &amp;lt;fields:last /&amp;gt;&lt;br /&gt;
    &amp;lt;fields:submit /&amp;gt;&lt;br /&gt;
  &amp;lt;/lift:snippet&amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
&amp;lt;/html&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Rails' controller-first dispatch mechanism makes the assumption that there is only one piece of logic on the page and the rest is decoration. When a page contains more than one piece of logic (e.g. a shopping cart and an interactive chat), having to choose a single piece of logic make the controller code complicated. This usually require some combination of controller inheritance (move common logic into the superclass of controllers -- e.g. put the shopping cart code in the ApplicationController), moving code from controllers into helpers and models, and the use of partial views.&lt;br /&gt;
&lt;br /&gt;
Finally, the view-first approach allows the templates to easily glue different components together. However, when gluing components gets more complicated (e.g. when dependencies must be satisfied), the simplicity of this approach fails and actual code has to be written.&amp;lt;ref name=viewfirst&amp;gt;[http://stanford.wikia.com/wiki/Project_2:_Lift,_the_Scala_Web_framework View-First Approach]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Long-Lived Closures ===&lt;br /&gt;
Lift allows the server application to attach closures to elements rendered in the user interface (e.g. form elements). The following snippet illustrates to usage of such closures.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class User {&lt;br /&gt;
  def form(template: Group) = {&lt;br /&gt;
    var first, last = &amp;quot;&amp;quot;&lt;br /&gt;
    bind(&amp;quot;fields&amp;quot;, template,&lt;br /&gt;
      &amp;quot;first&amp;quot;  --&amp;gt; text(&amp;quot;&amp;quot;, n =&amp;gt; first = n),&lt;br /&gt;
      &amp;quot;last&amp;quot;   --&amp;gt; text(&amp;quot;&amp;quot;, l =&amp;gt; last = l),&lt;br /&gt;
      &amp;quot;submit&amp;quot; --&amp;gt; submit(&amp;quot;Submit&amp;quot;, ignore =&amp;gt; process(first, last)))&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  def process(first: String, last: String) {&lt;br /&gt;
    ...&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The n =&amp;gt; first = n and l =&amp;gt; last = l anonymous functions are attached to two text inputs. The input Lift passes to these functions is the value of the element. The body of these two functions assign the value of text input to the first and last variables. The ignore =&amp;gt; process(first, last) anonymous function is attached to the submit button. In this case, we ignore the argument adequately named ignore because a button doesn't have a value. The body is call another function that could, for instance, store the two names in a database.&lt;br /&gt;
&lt;br /&gt;
To achieve this magic, Lift stores the closures in a map when the component is rendered. Randomly generated strings are used as keys and inserted in the generated HTML elements. When the form is submitted, Lift looks for the closures in the map based on the provided keys and executes them. Note how the first and last variables are captured by the three closures and, consequently, stored between the two request-response cycles.&lt;br /&gt;
&lt;br /&gt;
The advantage of this approach is that snippets can specify what happens when a specific button is pushed rather than having a controller parsing the submitted form and process the parameters extracted from the HTTP request. In essence, Lift allows you to specify server-side actions corresponding to user actions when the form is rendered rather than processing the results to figure out what actions the user performed during the next request. This reduces the need for magic constants used to map actions between the rendered view and controllers in other frameworks. In Rails, you might create a form with two buttons labeled 'Buy Now' and 'Buy Later' and then compare the submit parameter to 'Buy Now' and 'Buy Later' in the controller to determine the appropriate action. In Lift, this can be done with two different bindings in the render function.&amp;lt;ref name = closure&amp;gt;[http://stanford.wikia.com/wiki/Project_2:_Lift,_the_Scala_Web_framework Closures]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Lift Web Framework ==&lt;br /&gt;
&amp;lt;div class=&amp;quot;center&amp;quot;&amp;gt; [[File:LiftArchDiagram.jpg]] &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Components ===&lt;br /&gt;
#	LiftCore: This is the web processor of the framework which handles the following functions.&lt;br /&gt;
##	Request/Response&lt;br /&gt;
##	Rendering Pipeline&lt;br /&gt;
##	Invoking User Functions&lt;br /&gt;
#	LiftRules : Lift Configuration Management. Allows you to configure Lift. &lt;br /&gt;
#	LiftSession: Inherent Session State Representation.&amp;lt;ref name=liftsession&amp;gt;[http://exploring.liftweb.net/master/index-9.html#sec:Session-Management Session Management]&amp;lt;/ref&amp;gt;&lt;br /&gt;
#	S: The stateful object impersonating the state context for a given request/response lifecycle.&amp;lt;ref name=s&amp;gt;[http://exploring.liftweb.net/master/index-9.html#sub:Advanced-S-Object S Object]&amp;lt;/ref&amp;gt;&lt;br /&gt;
#	SiteMap: contains web pages for the lift application.&amp;lt;ref name=sitemap&amp;gt;[http://exploring.liftweb.net/master/index-7.html#cha:SiteMap]&amp;lt;/ref&amp;gt;&lt;br /&gt;
#	SHtml: helper functions for XHtml.&amp;lt;ref name=shtml&amp;gt;[http://exploring.liftweb.net/master/index-11.html#cha:AJAX-and-COMET SHtml]&amp;lt;/ref&amp;gt;&lt;br /&gt;
#	Views: LiftView objects impersonating a view as a XML content. Thus pages can be composed from other sources not only from html files.&amp;lt;ref name=views&amp;gt;[http://exploring.liftweb.net/master/index-4.html#sec:Views Lift Views]&amp;lt;/ref&amp;gt;&lt;br /&gt;
#	LiftResponse: Represents the abstraction of a response that will be propagated to the client. &amp;lt;ref name=response&amp;gt;[http://exploring.liftweb.net/master/index-9.html#sec:LiftResponse-in-Detail Lift Response]&amp;lt;/ref&amp;gt;&lt;br /&gt;
#	Comet: allows sending asynchronous content to browser.&amp;lt;ref name =comet&amp;gt;[Represents the Comet Actors layer which allows the sending of asynchronous content to the browser Comet]&amp;lt;/ref&amp;gt;&lt;br /&gt;
#	[http://en.wikipedia.org/wiki/Object-relational_mapping ORM]: Either Mapper or Record - The lightweight ORM library provided by Lift. The Mapper framework is the proposed ORM framework for Lift 1.0 and the Record framework will be out for next releases. &lt;br /&gt;
#	HTTP Auth: provides control over authentication model.&amp;lt;ref name=orm&amp;gt;[http://exploring.liftweb.net/master/index-8.html#cha:mapper_and_record]&amp;lt;/ref&amp;gt;&lt;br /&gt;
#	JS API: The JavaScript abstraction layer. These are Scala classes/objects that abstract JavaScript artifacts. Such objects can be combined to build JavaScript code .&amp;lt;ref name=js&amp;gt;[http://exploring.liftweb.net/master/index-10.html#cha:Lift-and-Javascript]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Getting Started ==&lt;br /&gt;
&lt;br /&gt;
=== Set Up on Eclipse ===&lt;br /&gt;
&lt;br /&gt;
#	Download “Scala IDE for Eclipse” : http://scala-ide.org/&lt;br /&gt;
#	Install plugin in Eclipse from this update site : http://download.scala-ide.org/sdk/helium/e38/scala211/stable/site&lt;br /&gt;
#	Once the plugin is installed restart Eclipse&lt;br /&gt;
#	Install sbteclipse  by adding the following to projects/plugins.sbt in your Lift Project: &amp;lt;code&amp;gt; addSbtPlugin(&amp;quot;com.typesafe.sbteclipse&amp;quot; % &amp;quot;sbteclipse-plugin&amp;quot; % &amp;quot;2.5.0&amp;quot;) &amp;lt;/code&amp;gt;&amp;lt;ref name=sbt&amp;gt;[http://en.wikipedia.org/wiki/SBT_(software) SBT]&amp;lt;/ref&amp;gt;&lt;br /&gt;
#	You can then create Eclipse project files (.project and .classpath) by entering the following into the SBT prompt: &amp;lt;code&amp;gt; eclipse &amp;lt;/code&amp;gt;&amp;lt;ref name=cookbook&amp;gt;[http://cookbook.liftweb.net/ The Lift Cookbook]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Setup Video Tutorial : [http://www.youtube.com/watch?v=qRIiUUKA2Mw link] &lt;br /&gt;
&lt;br /&gt;
== Basic Web Application Structure ==&lt;br /&gt;
&lt;br /&gt;
=== Step 1: Making a SiteMap entry ===&lt;br /&gt;
&lt;br /&gt;
Every page on the site needs a SiteMap entry.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def sitemap(): SiteMap = SiteMap(&lt;br /&gt;
  Menu(&amp;quot;Home&amp;quot;) / &amp;quot;index&amp;quot;,&lt;br /&gt;
  Menu(&amp;quot;Second Page&amp;quot;) / &amp;quot;second&amp;quot;&lt;br /&gt;
)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Step 2: Creating the view ===&lt;br /&gt;
Create an HTML file that corresponds to the sitemap entry.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;meta content=&amp;quot;text/html; charset=UTF-8&amp;quot; http-equiv=&amp;quot;content-type&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;title&amp;gt;Home&amp;lt;/title&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;div id=&amp;quot;main&amp;quot; class=&amp;quot;lift:surround?with=default&amp;amp;at=content&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;div&amp;gt;&lt;br /&gt;
        Hi, I'm a page that contains the time:&lt;br /&gt;
        &amp;lt;span class=&amp;quot;lift:TimeNow&amp;quot;&amp;gt;??? some time&amp;lt;/span&amp;gt;.&lt;br /&gt;
      &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
      &amp;lt;div&amp;gt;&lt;br /&gt;
        And a button: &amp;lt;button class=&amp;quot;lift:ClickMe&amp;quot;&amp;gt;Click Me&amp;lt;/button&amp;gt;.&lt;br /&gt;
      &amp;lt;/div&amp;gt;&lt;br /&gt;
    &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Step 3 : Creating the Snippet ===&lt;br /&gt;
&lt;br /&gt;
A snippet can be thought of as a controller which has rules for transforming the section of your template.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
package code&lt;br /&gt;
package snippet&lt;br /&gt;
&lt;br /&gt;
import net.liftweb._&lt;br /&gt;
import util._&lt;br /&gt;
import Helpers._&lt;br /&gt;
&lt;br /&gt;
object TimeNow {&lt;br /&gt;
  def render = &amp;quot;* *&amp;quot; #&amp;gt; now.toString&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&amp;lt;ref name=simplylift&amp;gt;[http://simply.liftweb.net/ Simply Lift]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Framework Comparison ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! &lt;br /&gt;
! Lift&lt;br /&gt;
! Rails&lt;br /&gt;
! Play&lt;br /&gt;
|-&lt;br /&gt;
| Scaffolding&lt;br /&gt;
| No&lt;br /&gt;
| Yes&lt;br /&gt;
| Yes&lt;br /&gt;
|-&lt;br /&gt;
| Design Pattern&lt;br /&gt;
| MVVM&lt;br /&gt;
| MVC&lt;br /&gt;
| MVC&lt;br /&gt;
|-&lt;br /&gt;
| Programming language&lt;br /&gt;
| Scala&lt;br /&gt;
| Ruby&lt;br /&gt;
| Java&lt;br /&gt;
|-&lt;br /&gt;
| Template language&lt;br /&gt;
| HTML5&lt;br /&gt;
| ERB/HAML&lt;br /&gt;
| Groovy/Japid&lt;br /&gt;
|-&lt;br /&gt;
| Dynamic Typing&lt;br /&gt;
| No&lt;br /&gt;
| Yes&lt;br /&gt;
| No&lt;br /&gt;
|-&lt;br /&gt;
| Admin Generator&lt;br /&gt;
| Yes&lt;br /&gt;
| Yes&lt;br /&gt;
| No&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Advantages ==&lt;br /&gt;
# Binding server side state to users' sessions is incredibly powerful. Each user can have a living representation in the server that talks to other users' representations.&amp;lt;ref name=adv&amp;gt;[http://stanford.wikia.com/wiki/Project_2:_Lift,_the_Scala_Web_framework Lift Project]&amp;lt;/ref&amp;gt;&lt;br /&gt;
# Built-in Comet support possibly the best Comet support in web frameworks. Pushing data to the browser is as simple as calling partialUpdate or asking for a full re-rendering of the component. Updates of multiple components are automatically serialized in a unique connection.&lt;br /&gt;
# Long-live closures simplify form processing and can be used to create complex wizards.&lt;br /&gt;
# View-first approach helps with 'Lean Controller, Fat Model'.&lt;br /&gt;
# Server state machines support for models, including timeouts. For instance, we can use a machine to specify that after three days without confirmation, a new account has to be deleted. Consequently, there is no need for cron and script/runner type solutions in Rails. Instead of imperatively stating what maintenance operations to do; state what rules to enforce and it is automatically done when necessary.&lt;br /&gt;
&lt;br /&gt;
== Disadvantages ==&lt;br /&gt;
&lt;br /&gt;
# Moving state to the server comes with all disadvantages discussed in class. That being said, various remote actors libraries are currently being developed and would permit actors living in different JVMs (running possibly on different machines) to communicate between each others seamlessly. &amp;lt;ref name=adv&amp;gt;[http://stanford.wikia.com/wiki/Project_2:_Lift,_the_Scala_Web_framework Lift Project]&amp;lt;/ref&amp;gt;Furthermore, it is often possible to architect an application such that loosely coupled components can live on different machines -- it is definitely possible with the stock trading application we will present during our in-class presentation.&lt;br /&gt;
# Terrible API (i.e. badly chosen names, confusing domain model) and no documentation at all (the Scala documentation is OK, though).&lt;br /&gt;
# Despite the fact that the API is stabilizing (unfortunately?), most of the tutorials are outdated.&lt;br /&gt;
# Routing is a nightmare for no infrastructure is available. &lt;br /&gt;
# Despite the fact that we can't move logic from snippets to templates, it is possible to move XHTML from templates to snippets. It is not always clear where the view has to be. Is a snippet a controller or a dynamically generated view? Is there actually a difference between the two?&lt;br /&gt;
&lt;br /&gt;
== Get Started ==&lt;br /&gt;
&lt;br /&gt;
The Lift Cookbook is the best place to start with using the Lift Framework.&lt;br /&gt;
[http://cookbook.liftweb.net/ CookBook]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&amp;lt;references&amp;gt;&amp;lt;/references&amp;gt;&lt;/div&gt;</summary>
		<author><name>Aprasad3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/ch1a_4_wl&amp;diff=88497</id>
		<title>CSC/ECE 517 Fall 2014/ch1a 4 wl</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/ch1a_4_wl&amp;diff=88497"/>
		<updated>2014-09-25T22:48:21Z</updated>

		<summary type="html">&lt;p&gt;Aprasad3: /* Components */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;WEB DEVELOPMENT USING LIFT&lt;br /&gt;
==Introduction==&lt;br /&gt;
Lift is a web framework designed to make the most powerful techniques easily accessible while keeping the overall framework simple and flexible. Lift has picked some of the best ideas from a number of other frameworks while creating some of it's own novel ideas. This combination of solid foundation and new techniques makes Lift a powerful framework. The clear separation of presentation content and logic based on the concept of Model View Controller pattern is one of the key strengths of the framework.&lt;br /&gt;
&lt;br /&gt;
     &amp;quot;Lift is the kind of web framework that enables you as a developer to concentrate on the big picture. Strong, expressive typing and higher-level&lt;br /&gt;
      features like the built-in Comet support allow you to focus on innovating instead of the plumbing.&amp;quot; -- Novell&amp;lt;ref name=overview&amp;gt;[http://www.liftweb.net/lift_overview Lift Overview]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Background==&lt;br /&gt;
Lift is an open source software licensed under an Apache 2.0 license. Lift 2.5 is the latest stable version released and the Lift community has already started development for Lift 3.0. The source code can be found of the GitHub repository.&amp;lt;ref name=github&amp;gt;[https://github.com/lift/framework Lift Source Code]&amp;lt;/ref&amp;gt;&lt;br /&gt;
Lift borrows from the best of existing frameworks, providing: &lt;br /&gt;
*Seaside’s highly granular sessions and security.&lt;br /&gt;
*Rails’s fast flash-to-bang.&lt;br /&gt;
*Django’s “more than just CRUD is included”.&lt;br /&gt;
*Wicket’s designer-friendly templating style.&amp;lt;ref name=wiki&amp;gt;[https://www.assembla.com/spaces/liftweb/wiki/Home Lift Developers' wiki]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Lift is built on top of the Scala programming language. Scala is a relatively new language which compiles to Java bytecode and runs on the JVM. Scala was developed by Martin Odersky. Since lift is built on Scala, the vast ecosystem of Java libraries can be leveraged for the web development like any other Java based web framework. Lift also uses the extensive XML library support and processing capabilities of the Scala language.&lt;br /&gt;
&lt;br /&gt;
== The Scala Programming Language ==&lt;br /&gt;
&lt;br /&gt;
Scala is a statically typed multi-paradigm programming language integrating features of object-oriented and functional languages. It runs on the JVM and is fully interoperable with Java. Scala is equipped with an expressive type system providing a powerful basis for the safe reuse of component abstractions and provides a combination of language mechanisms that make it easy to smoothly add new language constructs as libraries. The resulting language scalability -- as praised in Guy Steele's famous 1998 OOPSLA keynote, is illustrated by Scala's lightweight actor library. Furthermore, Scala syntax supports native XML literals.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Features of Lift Web Framework ==&lt;br /&gt;
*   '''LazyLoading:''' Lift supports lazy loading of a snippet. This is useful when a snippet may take a long time to render, but it is required to return the page to the browser quickly.&lt;br /&gt;
&lt;br /&gt;
*  '''Parallel Page rendering:''' Executing multiple snippets in parallel is possible in Lift. Multiple jobs or processes can be spawned and run in parallel. However only when all the tasks or jobs are complete the final page render is sent back to the browser.&lt;br /&gt;
&lt;br /&gt;
*   '''Comet and Ajax support:''' Comet along with Ajax supports the asynchronous updates from user to the server or from server back to the user.&lt;br /&gt;
&lt;br /&gt;
*   '''Wiring:''' The relationship between different elements on a page is defined through Lift Wiring. When any element on a page changes, the dependent items are displayed on the next HTTP response.&lt;br /&gt;
&lt;br /&gt;
*   '''Security:''' Lift apps are not vulnerable to the common security concerns. Lift has built-in safeguards to combat vulnerabilities like Injection, [http://en.wikipedia.org/wiki/Cross-site_scripting XSS], Direct Object references and URL access&lt;br /&gt;
&lt;br /&gt;
*   '''Developer centric:''' Lift apps are fast to build, concise and easy to maintain and can be developed in totally designer friendly way.&lt;br /&gt;
&lt;br /&gt;
*  '''Scalable:''' Lift apps are high performance and scale in the real world to handle the high volume of traffic.&lt;br /&gt;
&lt;br /&gt;
*  ''' Modular:''' Lift apps can benefit from, easy to integrate, pre built modules&amp;lt;ref name=liftweb&amp;gt;[http://liftweb.net/ Lift Official HomePage]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Comparison to Rails ==&lt;br /&gt;
&lt;br /&gt;
=== The View-First Approach ===&lt;br /&gt;
&lt;br /&gt;
Templates in Lift are used for display only and never contain programming logic. Consequently, they can be manipulated by non-programmers with tools such as Dreamweaver. Furthermore, contrarily to Rails, Lift snippets are invoked by the template, and not vice versa. The following template illustrates the view-first approach by invoking the form method in the User snippet using the &amp;lt;lift:snippet&amp;gt; tag. The body of this tag can refer to values bound by the User snippet in the snippet-defined fields namespace.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;html xmlns=&amp;quot;http://www.w3.org/1999/xhtml&amp;quot; xmlns:lift=&amp;quot;http://liftweb.net/&amp;quot;&amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;lt;lift:snippet type=&amp;quot;user:form&amp;quot; form=&amp;quot;POST&amp;quot;&amp;gt;&lt;br /&gt;
    First name &amp;lt;fields:first /&amp;gt;&lt;br /&gt;
    Last name &amp;lt;fields:last /&amp;gt;&lt;br /&gt;
    &amp;lt;fields:submit /&amp;gt;&lt;br /&gt;
  &amp;lt;/lift:snippet&amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
&amp;lt;/html&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Rails' controller-first dispatch mechanism makes the assumption that there is only one piece of logic on the page and the rest is decoration. When a page contains more than one piece of logic (e.g. a shopping cart and an interactive chat), having to choose a single piece of logic make the controller code complicated. This usually require some combination of controller inheritance (move common logic into the superclass of controllers -- e.g. put the shopping cart code in the ApplicationController), moving code from controllers into helpers and models, and the use of partial views.&lt;br /&gt;
&lt;br /&gt;
Finally, the view-first approach allows the templates to easily glue different components together. However, when gluing components gets more complicated (e.g. when dependencies must be satisfied), the simplicity of this approach fails and actual code has to be written.&amp;lt;ref name=viewfirst&amp;gt;[http://stanford.wikia.com/wiki/Project_2:_Lift,_the_Scala_Web_framework View-First Approach]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Long-Lived Closures ===&lt;br /&gt;
Lift allows the server application to attach closures to elements rendered in the user interface (e.g. form elements). The following snippet illustrates to usage of such closures.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class User {&lt;br /&gt;
  def form(template: Group) = {&lt;br /&gt;
    var first, last = &amp;quot;&amp;quot;&lt;br /&gt;
    bind(&amp;quot;fields&amp;quot;, template,&lt;br /&gt;
      &amp;quot;first&amp;quot;  --&amp;gt; text(&amp;quot;&amp;quot;, n =&amp;gt; first = n),&lt;br /&gt;
      &amp;quot;last&amp;quot;   --&amp;gt; text(&amp;quot;&amp;quot;, l =&amp;gt; last = l),&lt;br /&gt;
      &amp;quot;submit&amp;quot; --&amp;gt; submit(&amp;quot;Submit&amp;quot;, ignore =&amp;gt; process(first, last)))&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  def process(first: String, last: String) {&lt;br /&gt;
    ...&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The n =&amp;gt; first = n and l =&amp;gt; last = l anonymous functions are attached to two text inputs. The input Lift passes to these functions is the value of the element. The body of these two functions assign the value of text input to the first and last variables. The ignore =&amp;gt; process(first, last) anonymous function is attached to the submit button. In this case, we ignore the argument adequately named ignore because a button doesn't have a value. The body is call another function that could, for instance, store the two names in a database.&lt;br /&gt;
&lt;br /&gt;
To achieve this magic, Lift stores the closures in a map when the component is rendered. Randomly generated strings are used as keys and inserted in the generated HTML elements. When the form is submitted, Lift looks for the closures in the map based on the provided keys and executes them. Note how the first and last variables are captured by the three closures and, consequently, stored between the two request-response cycles.&lt;br /&gt;
&lt;br /&gt;
The advantage of this approach is that snippets can specify what happens when a specific button is pushed rather than having a controller parsing the submitted form and process the parameters extracted from the HTTP request. In essence, Lift allows you to specify server-side actions corresponding to user actions when the form is rendered rather than processing the results to figure out what actions the user performed during the next request. This reduces the need for magic constants used to map actions between the rendered view and controllers in other frameworks. In Rails, you might create a form with two buttons labeled 'Buy Now' and 'Buy Later' and then compare the submit parameter to 'Buy Now' and 'Buy Later' in the controller to determine the appropriate action. In Lift, this can be done with two different bindings in the render function.&amp;lt;ref name = closure&amp;gt;[http://stanford.wikia.com/wiki/Project_2:_Lift,_the_Scala_Web_framework Closures]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Lift Web Framework ==&lt;br /&gt;
&amp;lt;div class=&amp;quot;center&amp;quot;&amp;gt; [[File:LiftArchDiagram.jpg]] &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Components ===&lt;br /&gt;
#	LiftCore: This is the web processor of the framework which handles the following functions.&lt;br /&gt;
##	Request/Response&lt;br /&gt;
##	Rendering Pipeline&lt;br /&gt;
##	Invoking User Functions&lt;br /&gt;
#	LiftRules : Lift Configuration Management. Allows you to configure Lift. &lt;br /&gt;
#	LiftSession: Inherent Session State Representation.&amp;lt;ref name=liftsession&amp;gt;[http://exploring.liftweb.net/master/index-9.html#sec:Session-Management]&amp;lt;/ref&amp;gt;&lt;br /&gt;
#	S: The stateful object impersonating the state context for a given request/response lifecycle.&amp;lt;ref name=s&amp;gt;[http://exploring.liftweb.net/master/index-9.html#sub:Advanced-S-Object]&amp;lt;/ref&amp;gt;&lt;br /&gt;
#	SiteMap: contains web pages for the lift application.&amp;lt;ref name=sitemap&amp;gt;[http://exploring.liftweb.net/master/index-7.html#cha:SiteMap]&amp;lt;/ref&amp;gt;&lt;br /&gt;
#	SHtml: helper functions for XHtml.&amp;lt;ref name=shtml&amp;gt;[http://exploring.liftweb.net/master/index-11.html#cha:AJAX-and-COMET]&amp;lt;/ref&amp;gt;&lt;br /&gt;
#	Views: LiftView objects impersonating a view as a XML content. Thus pages can be composed from other sources not only from html files.&amp;lt;ref name=views&amp;gt;[http://exploring.liftweb.net/master/index-4.html#sec:Views]&amp;lt;/ref&amp;gt;&lt;br /&gt;
#	LiftResponse: Represents the abstraction of a response that will be propagated to the client. &amp;lt;ref name=response&amp;gt;[http://exploring.liftweb.net/master/index-9.html#sec:LiftResponse-in-Detail]&amp;lt;/ref&amp;gt;&lt;br /&gt;
#	Comet: allows sending asynchronous content to browser.&amp;lt;ref name =comet&amp;gt;[Represents the Comet Actors layer which allows the sending of asynchronous content to the browser]&amp;lt;/ref&amp;gt;&lt;br /&gt;
#	[http://en.wikipedia.org/wiki/Object-relational_mapping ORM]: Either Mapper or Record - The lightweight ORM library provided by Lift. The Mapper framework is the proposed ORM framework for Lift 1.0 and the Record framework will be out for next releases. &lt;br /&gt;
#	HTTP Auth: provides control over authentication model.&amp;lt;ref name=orm&amp;gt;[http://exploring.liftweb.net/master/index-8.html#cha:mapper_and_record]&amp;lt;/ref&amp;gt;&lt;br /&gt;
#	JS API: The JavaScript abstraction layer. These are Scala classes/objects that abstract JavaScript artifacts. Such objects can be combined to build JavaScript code .&amp;lt;ref name=js&amp;gt;[http://exploring.liftweb.net/master/index-10.html#cha:Lift-and-Javascript]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Getting Started ==&lt;br /&gt;
&lt;br /&gt;
=== Set Up on Eclipse ===&lt;br /&gt;
&lt;br /&gt;
#	Download “Scala IDE for Eclipse” : http://scala-ide.org/&lt;br /&gt;
#	Install plugin in Eclipse from this update site : http://download.scala-ide.org/sdk/helium/e38/scala211/stable/site&lt;br /&gt;
#	Once the plugin is installed restart Eclipse&lt;br /&gt;
#	Install sbteclipse  by adding the following to projects/plugins.sbt in your Lift Project: &amp;lt;code&amp;gt; addSbtPlugin(&amp;quot;com.typesafe.sbteclipse&amp;quot; % &amp;quot;sbteclipse-plugin&amp;quot; % &amp;quot;2.5.0&amp;quot;) &amp;lt;/code&amp;gt;&amp;lt;ref name=sbt&amp;gt;[http://en.wikipedia.org/wiki/SBT_(software) SBT]&amp;lt;/ref&amp;gt;&lt;br /&gt;
#	You can then create Eclipse project files (.project and .classpath) by entering the following into the SBT prompt: &amp;lt;code&amp;gt; eclipse &amp;lt;/code&amp;gt;&amp;lt;ref name=cookbook&amp;gt;[http://cookbook.liftweb.net/ The Lift Cookbook]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Setup Video Tutorial : [http://www.youtube.com/watch?v=qRIiUUKA2Mw link] &lt;br /&gt;
&lt;br /&gt;
== Basic Web Application Structure ==&lt;br /&gt;
&lt;br /&gt;
=== Step 1: Making a SiteMap entry ===&lt;br /&gt;
&lt;br /&gt;
Every page on the site needs a SiteMap entry.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def sitemap(): SiteMap = SiteMap(&lt;br /&gt;
  Menu(&amp;quot;Home&amp;quot;) / &amp;quot;index&amp;quot;,&lt;br /&gt;
  Menu(&amp;quot;Second Page&amp;quot;) / &amp;quot;second&amp;quot;&lt;br /&gt;
)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Step 2: Creating the view ===&lt;br /&gt;
Create an HTML file that corresponds to the sitemap entry.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;meta content=&amp;quot;text/html; charset=UTF-8&amp;quot; http-equiv=&amp;quot;content-type&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;title&amp;gt;Home&amp;lt;/title&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;div id=&amp;quot;main&amp;quot; class=&amp;quot;lift:surround?with=default&amp;amp;at=content&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;div&amp;gt;&lt;br /&gt;
        Hi, I'm a page that contains the time:&lt;br /&gt;
        &amp;lt;span class=&amp;quot;lift:TimeNow&amp;quot;&amp;gt;??? some time&amp;lt;/span&amp;gt;.&lt;br /&gt;
      &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
      &amp;lt;div&amp;gt;&lt;br /&gt;
        And a button: &amp;lt;button class=&amp;quot;lift:ClickMe&amp;quot;&amp;gt;Click Me&amp;lt;/button&amp;gt;.&lt;br /&gt;
      &amp;lt;/div&amp;gt;&lt;br /&gt;
    &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Step 3 : Creating the Snippet ===&lt;br /&gt;
&lt;br /&gt;
A snippet can be thought of as a controller which has rules for transforming the section of your template.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
package code&lt;br /&gt;
package snippet&lt;br /&gt;
&lt;br /&gt;
import net.liftweb._&lt;br /&gt;
import util._&lt;br /&gt;
import Helpers._&lt;br /&gt;
&lt;br /&gt;
object TimeNow {&lt;br /&gt;
  def render = &amp;quot;* *&amp;quot; #&amp;gt; now.toString&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&amp;lt;ref name=simplylift&amp;gt;[http://simply.liftweb.net/ Simply Lift]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Framework Comparison ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! &lt;br /&gt;
! Lift&lt;br /&gt;
! Rails&lt;br /&gt;
! Play&lt;br /&gt;
|-&lt;br /&gt;
| Scaffolding&lt;br /&gt;
| No&lt;br /&gt;
| Yes&lt;br /&gt;
| Yes&lt;br /&gt;
|-&lt;br /&gt;
| Design Pattern&lt;br /&gt;
| MVVM&lt;br /&gt;
| MVC&lt;br /&gt;
| MVC&lt;br /&gt;
|-&lt;br /&gt;
| Programming language&lt;br /&gt;
| Scala&lt;br /&gt;
| Ruby&lt;br /&gt;
| Java&lt;br /&gt;
|-&lt;br /&gt;
| Template language&lt;br /&gt;
| HTML5&lt;br /&gt;
| ERB/HAML&lt;br /&gt;
| Groovy/Japid&lt;br /&gt;
|-&lt;br /&gt;
| Dynamic Typing&lt;br /&gt;
| No&lt;br /&gt;
| Yes&lt;br /&gt;
| No&lt;br /&gt;
|-&lt;br /&gt;
| Admin Generator&lt;br /&gt;
| Yes&lt;br /&gt;
| Yes&lt;br /&gt;
| No&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Advantages ==&lt;br /&gt;
# Binding server side state to users' sessions is incredibly powerful. Each user can have a living representation in the server that talks to other users' representations.&amp;lt;ref name=adv&amp;gt;[http://stanford.wikia.com/wiki/Project_2:_Lift,_the_Scala_Web_framework Lift Project]&amp;lt;/ref&amp;gt;&lt;br /&gt;
# Built-in Comet support possibly the best Comet support in web frameworks. Pushing data to the browser is as simple as calling partialUpdate or asking for a full re-rendering of the component. Updates of multiple components are automatically serialized in a unique connection.&lt;br /&gt;
# Long-live closures simplify form processing and can be used to create complex wizards.&lt;br /&gt;
# View-first approach helps with 'Lean Controller, Fat Model'.&lt;br /&gt;
# Server state machines support for models, including timeouts. For instance, we can use a machine to specify that after three days without confirmation, a new account has to be deleted. Consequently, there is no need for cron and script/runner type solutions in Rails. Instead of imperatively stating what maintenance operations to do; state what rules to enforce and it is automatically done when necessary.&lt;br /&gt;
&lt;br /&gt;
== Disadvantages ==&lt;br /&gt;
&lt;br /&gt;
# Moving state to the server comes with all disadvantages discussed in class. That being said, various remote actors libraries are currently being developed and would permit actors living in different JVMs (running possibly on different machines) to communicate between each others seamlessly. &amp;lt;ref name=adv&amp;gt;[http://stanford.wikia.com/wiki/Project_2:_Lift,_the_Scala_Web_framework Lift Project]&amp;lt;/ref&amp;gt;Furthermore, it is often possible to architect an application such that loosely coupled components can live on different machines -- it is definitely possible with the stock trading application we will present during our in-class presentation.&lt;br /&gt;
# Terrible API (i.e. badly chosen names, confusing domain model) and no documentation at all (the Scala documentation is OK, though).&lt;br /&gt;
# Despite the fact that the API is stabilizing (unfortunately?), most of the tutorials are outdated.&lt;br /&gt;
# Routing is a nightmare for no infrastructure is available. &lt;br /&gt;
# Despite the fact that we can't move logic from snippets to templates, it is possible to move XHTML from templates to snippets. It is not always clear where the view has to be. Is a snippet a controller or a dynamically generated view? Is there actually a difference between the two?&lt;br /&gt;
&lt;br /&gt;
== Get Started ==&lt;br /&gt;
&lt;br /&gt;
The Lift Cookbook is the best place to start with using the Lift Framework.&lt;br /&gt;
[http://cookbook.liftweb.net/ CookBook]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&amp;lt;references&amp;gt;&amp;lt;/references&amp;gt;&lt;/div&gt;</summary>
		<author><name>Aprasad3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/ch1a_4_wl&amp;diff=88496</id>
		<title>CSC/ECE 517 Fall 2014/ch1a 4 wl</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/ch1a_4_wl&amp;diff=88496"/>
		<updated>2014-09-25T22:45:43Z</updated>

		<summary type="html">&lt;p&gt;Aprasad3: /* Components */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;WEB DEVELOPMENT USING LIFT&lt;br /&gt;
==Introduction==&lt;br /&gt;
Lift is a web framework designed to make the most powerful techniques easily accessible while keeping the overall framework simple and flexible. Lift has picked some of the best ideas from a number of other frameworks while creating some of it's own novel ideas. This combination of solid foundation and new techniques makes Lift a powerful framework. The clear separation of presentation content and logic based on the concept of Model View Controller pattern is one of the key strengths of the framework.&lt;br /&gt;
&lt;br /&gt;
     &amp;quot;Lift is the kind of web framework that enables you as a developer to concentrate on the big picture. Strong, expressive typing and higher-level&lt;br /&gt;
      features like the built-in Comet support allow you to focus on innovating instead of the plumbing.&amp;quot; -- Novell&amp;lt;ref name=overview&amp;gt;[http://www.liftweb.net/lift_overview Lift Overview]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Background==&lt;br /&gt;
Lift is an open source software licensed under an Apache 2.0 license. Lift 2.5 is the latest stable version released and the Lift community has already started development for Lift 3.0. The source code can be found of the GitHub repository.&amp;lt;ref name=github&amp;gt;[https://github.com/lift/framework Lift Source Code]&amp;lt;/ref&amp;gt;&lt;br /&gt;
Lift borrows from the best of existing frameworks, providing: &lt;br /&gt;
*Seaside’s highly granular sessions and security.&lt;br /&gt;
*Rails’s fast flash-to-bang.&lt;br /&gt;
*Django’s “more than just CRUD is included”.&lt;br /&gt;
*Wicket’s designer-friendly templating style.&amp;lt;ref name=wiki&amp;gt;[https://www.assembla.com/spaces/liftweb/wiki/Home Lift Developers' wiki]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Lift is built on top of the Scala programming language. Scala is a relatively new language which compiles to Java bytecode and runs on the JVM. Scala was developed by Martin Odersky. Since lift is built on Scala, the vast ecosystem of Java libraries can be leveraged for the web development like any other Java based web framework. Lift also uses the extensive XML library support and processing capabilities of the Scala language.&lt;br /&gt;
&lt;br /&gt;
== The Scala Programming Language ==&lt;br /&gt;
&lt;br /&gt;
Scala is a statically typed multi-paradigm programming language integrating features of object-oriented and functional languages. It runs on the JVM and is fully interoperable with Java. Scala is equipped with an expressive type system providing a powerful basis for the safe reuse of component abstractions and provides a combination of language mechanisms that make it easy to smoothly add new language constructs as libraries. The resulting language scalability -- as praised in Guy Steele's famous 1998 OOPSLA keynote, is illustrated by Scala's lightweight actor library. Furthermore, Scala syntax supports native XML literals.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Features of Lift Web Framework ==&lt;br /&gt;
*   '''LazyLoading:''' Lift supports lazy loading of a snippet. This is useful when a snippet may take a long time to render, but it is required to return the page to the browser quickly.&lt;br /&gt;
&lt;br /&gt;
*  '''Parallel Page rendering:''' Executing multiple snippets in parallel is possible in Lift. Multiple jobs or processes can be spawned and run in parallel. However only when all the tasks or jobs are complete the final page render is sent back to the browser.&lt;br /&gt;
&lt;br /&gt;
*   '''Comet and Ajax support:''' Comet along with Ajax supports the asynchronous updates from user to the server or from server back to the user.&lt;br /&gt;
&lt;br /&gt;
*   '''Wiring:''' The relationship between different elements on a page is defined through Lift Wiring. When any element on a page changes, the dependent items are displayed on the next HTTP response.&lt;br /&gt;
&lt;br /&gt;
*   '''Security:''' Lift apps are not vulnerable to the common security concerns. Lift has built-in safeguards to combat vulnerabilities like Injection, [http://en.wikipedia.org/wiki/Cross-site_scripting XSS], Direct Object references and URL access&lt;br /&gt;
&lt;br /&gt;
*   '''Developer centric:''' Lift apps are fast to build, concise and easy to maintain and can be developed in totally designer friendly way.&lt;br /&gt;
&lt;br /&gt;
*  '''Scalable:''' Lift apps are high performance and scale in the real world to handle the high volume of traffic.&lt;br /&gt;
&lt;br /&gt;
*  ''' Modular:''' Lift apps can benefit from, easy to integrate, pre built modules&amp;lt;ref name=liftweb&amp;gt;[http://liftweb.net/ Lift Official HomePage]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Comparison to Rails ==&lt;br /&gt;
&lt;br /&gt;
=== The View-First Approach ===&lt;br /&gt;
&lt;br /&gt;
Templates in Lift are used for display only and never contain programming logic. Consequently, they can be manipulated by non-programmers with tools such as Dreamweaver. Furthermore, contrarily to Rails, Lift snippets are invoked by the template, and not vice versa. The following template illustrates the view-first approach by invoking the form method in the User snippet using the &amp;lt;lift:snippet&amp;gt; tag. The body of this tag can refer to values bound by the User snippet in the snippet-defined fields namespace.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;html xmlns=&amp;quot;http://www.w3.org/1999/xhtml&amp;quot; xmlns:lift=&amp;quot;http://liftweb.net/&amp;quot;&amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;lt;lift:snippet type=&amp;quot;user:form&amp;quot; form=&amp;quot;POST&amp;quot;&amp;gt;&lt;br /&gt;
    First name &amp;lt;fields:first /&amp;gt;&lt;br /&gt;
    Last name &amp;lt;fields:last /&amp;gt;&lt;br /&gt;
    &amp;lt;fields:submit /&amp;gt;&lt;br /&gt;
  &amp;lt;/lift:snippet&amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
&amp;lt;/html&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Rails' controller-first dispatch mechanism makes the assumption that there is only one piece of logic on the page and the rest is decoration. When a page contains more than one piece of logic (e.g. a shopping cart and an interactive chat), having to choose a single piece of logic make the controller code complicated. This usually require some combination of controller inheritance (move common logic into the superclass of controllers -- e.g. put the shopping cart code in the ApplicationController), moving code from controllers into helpers and models, and the use of partial views.&lt;br /&gt;
&lt;br /&gt;
Finally, the view-first approach allows the templates to easily glue different components together. However, when gluing components gets more complicated (e.g. when dependencies must be satisfied), the simplicity of this approach fails and actual code has to be written.&amp;lt;ref name=viewfirst&amp;gt;[http://stanford.wikia.com/wiki/Project_2:_Lift,_the_Scala_Web_framework View-First Approach]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Long-Lived Closures ===&lt;br /&gt;
Lift allows the server application to attach closures to elements rendered in the user interface (e.g. form elements). The following snippet illustrates to usage of such closures.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class User {&lt;br /&gt;
  def form(template: Group) = {&lt;br /&gt;
    var first, last = &amp;quot;&amp;quot;&lt;br /&gt;
    bind(&amp;quot;fields&amp;quot;, template,&lt;br /&gt;
      &amp;quot;first&amp;quot;  --&amp;gt; text(&amp;quot;&amp;quot;, n =&amp;gt; first = n),&lt;br /&gt;
      &amp;quot;last&amp;quot;   --&amp;gt; text(&amp;quot;&amp;quot;, l =&amp;gt; last = l),&lt;br /&gt;
      &amp;quot;submit&amp;quot; --&amp;gt; submit(&amp;quot;Submit&amp;quot;, ignore =&amp;gt; process(first, last)))&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  def process(first: String, last: String) {&lt;br /&gt;
    ...&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The n =&amp;gt; first = n and l =&amp;gt; last = l anonymous functions are attached to two text inputs. The input Lift passes to these functions is the value of the element. The body of these two functions assign the value of text input to the first and last variables. The ignore =&amp;gt; process(first, last) anonymous function is attached to the submit button. In this case, we ignore the argument adequately named ignore because a button doesn't have a value. The body is call another function that could, for instance, store the two names in a database.&lt;br /&gt;
&lt;br /&gt;
To achieve this magic, Lift stores the closures in a map when the component is rendered. Randomly generated strings are used as keys and inserted in the generated HTML elements. When the form is submitted, Lift looks for the closures in the map based on the provided keys and executes them. Note how the first and last variables are captured by the three closures and, consequently, stored between the two request-response cycles.&lt;br /&gt;
&lt;br /&gt;
The advantage of this approach is that snippets can specify what happens when a specific button is pushed rather than having a controller parsing the submitted form and process the parameters extracted from the HTTP request. In essence, Lift allows you to specify server-side actions corresponding to user actions when the form is rendered rather than processing the results to figure out what actions the user performed during the next request. This reduces the need for magic constants used to map actions between the rendered view and controllers in other frameworks. In Rails, you might create a form with two buttons labeled 'Buy Now' and 'Buy Later' and then compare the submit parameter to 'Buy Now' and 'Buy Later' in the controller to determine the appropriate action. In Lift, this can be done with two different bindings in the render function.&amp;lt;ref name = closure&amp;gt;[http://stanford.wikia.com/wiki/Project_2:_Lift,_the_Scala_Web_framework Closures]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Lift Web Framework ==&lt;br /&gt;
&amp;lt;div class=&amp;quot;center&amp;quot;&amp;gt; [[File:LiftArchDiagram.jpg]] &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Components ===&lt;br /&gt;
#	LiftCore: This is the web processor of the framework which handles the following functions.&lt;br /&gt;
##	Request/Response&lt;br /&gt;
##	Rendering Pipeline&lt;br /&gt;
##	Invoking User Functions&lt;br /&gt;
#	LiftRules : Lift Configuration Management. Allows you to configure Lift. &lt;br /&gt;
#	LiftSession: Inherent Session State Representation.&amp;lt;ref name=liftsession&amp;gt;[http://exploring.liftweb.net/master/index-9.html#sec:Session-Management]&amp;lt;/ref&amp;gt;&lt;br /&gt;
#	S: The stateful object impersonating the state context for a given request/response lifecycle.&amp;lt;ref name=s&amp;gt;[http://exploring.liftweb.net/master/index-9.html#sub:Advanced-S-Object]&amp;lt;/ref&amp;gt;&lt;br /&gt;
#	SiteMap: contains web pages for the lift application.&amp;lt;ref name=sitemap&amp;gt;[http://exploring.liftweb.net/master/index-7.html#cha:SiteMap]&amp;lt;/ref&amp;gt;&lt;br /&gt;
#	SHtml: helper functions for XHtml.&amp;lt;ref name=shtml&amp;gt;[http://exploring.liftweb.net/master/index-11.html#cha:AJAX-and-COMET]&amp;lt;/ref&amp;gt;&lt;br /&gt;
#	Views: Views as XML content. Allows composing views from not only html files but other contexts too.&lt;br /&gt;
#	LiftResponse: Represents the abstraction of a response that will be propagated to the client. &amp;lt;ref name=response&amp;gt;[http://exploring.liftweb.net/master/index-9.html#sec:LiftResponse-in-Detail]&amp;lt;/ref&amp;gt;&lt;br /&gt;
#	Comet: allows sending asynchronous content to browser.&lt;br /&gt;
#	[http://en.wikipedia.org/wiki/Object-relational_mapping ORM]: A specialized library.&lt;br /&gt;
#	HTTP Auth: provides control over authentication model.&lt;br /&gt;
#	JS API: JavaScript abstraction layer.&amp;lt;ref name=explore&amp;gt;[http://exploring.liftweb.net/master/index-9.html Exploring Lift Framework]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Getting Started ==&lt;br /&gt;
&lt;br /&gt;
=== Set Up on Eclipse ===&lt;br /&gt;
&lt;br /&gt;
#	Download “Scala IDE for Eclipse” : http://scala-ide.org/&lt;br /&gt;
#	Install plugin in Eclipse from this update site : http://download.scala-ide.org/sdk/helium/e38/scala211/stable/site&lt;br /&gt;
#	Once the plugin is installed restart Eclipse&lt;br /&gt;
#	Install sbteclipse  by adding the following to projects/plugins.sbt in your Lift Project: &amp;lt;code&amp;gt; addSbtPlugin(&amp;quot;com.typesafe.sbteclipse&amp;quot; % &amp;quot;sbteclipse-plugin&amp;quot; % &amp;quot;2.5.0&amp;quot;) &amp;lt;/code&amp;gt;&amp;lt;ref name=sbt&amp;gt;[http://en.wikipedia.org/wiki/SBT_(software) SBT]&amp;lt;/ref&amp;gt;&lt;br /&gt;
#	You can then create Eclipse project files (.project and .classpath) by entering the following into the SBT prompt: &amp;lt;code&amp;gt; eclipse &amp;lt;/code&amp;gt;&amp;lt;ref name=cookbook&amp;gt;[http://cookbook.liftweb.net/ The Lift Cookbook]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Setup Video Tutorial : [http://www.youtube.com/watch?v=qRIiUUKA2Mw link] &lt;br /&gt;
&lt;br /&gt;
== Basic Web Application Structure ==&lt;br /&gt;
&lt;br /&gt;
=== Step 1: Making a SiteMap entry ===&lt;br /&gt;
&lt;br /&gt;
Every page on the site needs a SiteMap entry.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def sitemap(): SiteMap = SiteMap(&lt;br /&gt;
  Menu(&amp;quot;Home&amp;quot;) / &amp;quot;index&amp;quot;,&lt;br /&gt;
  Menu(&amp;quot;Second Page&amp;quot;) / &amp;quot;second&amp;quot;&lt;br /&gt;
)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Step 2: Creating the view ===&lt;br /&gt;
Create an HTML file that corresponds to the sitemap entry.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;meta content=&amp;quot;text/html; charset=UTF-8&amp;quot; http-equiv=&amp;quot;content-type&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;title&amp;gt;Home&amp;lt;/title&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;div id=&amp;quot;main&amp;quot; class=&amp;quot;lift:surround?with=default&amp;amp;at=content&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;div&amp;gt;&lt;br /&gt;
        Hi, I'm a page that contains the time:&lt;br /&gt;
        &amp;lt;span class=&amp;quot;lift:TimeNow&amp;quot;&amp;gt;??? some time&amp;lt;/span&amp;gt;.&lt;br /&gt;
      &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
      &amp;lt;div&amp;gt;&lt;br /&gt;
        And a button: &amp;lt;button class=&amp;quot;lift:ClickMe&amp;quot;&amp;gt;Click Me&amp;lt;/button&amp;gt;.&lt;br /&gt;
      &amp;lt;/div&amp;gt;&lt;br /&gt;
    &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Step 3 : Creating the Snippet ===&lt;br /&gt;
&lt;br /&gt;
A snippet can be thought of as a controller which has rules for transforming the section of your template.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
package code&lt;br /&gt;
package snippet&lt;br /&gt;
&lt;br /&gt;
import net.liftweb._&lt;br /&gt;
import util._&lt;br /&gt;
import Helpers._&lt;br /&gt;
&lt;br /&gt;
object TimeNow {&lt;br /&gt;
  def render = &amp;quot;* *&amp;quot; #&amp;gt; now.toString&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&amp;lt;ref name=simplylift&amp;gt;[http://simply.liftweb.net/ Simply Lift]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Framework Comparison ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! &lt;br /&gt;
! Lift&lt;br /&gt;
! Rails&lt;br /&gt;
! Play&lt;br /&gt;
|-&lt;br /&gt;
| Scaffolding&lt;br /&gt;
| No&lt;br /&gt;
| Yes&lt;br /&gt;
| Yes&lt;br /&gt;
|-&lt;br /&gt;
| Design Pattern&lt;br /&gt;
| MVVM&lt;br /&gt;
| MVC&lt;br /&gt;
| MVC&lt;br /&gt;
|-&lt;br /&gt;
| Programming language&lt;br /&gt;
| Scala&lt;br /&gt;
| Ruby&lt;br /&gt;
| Java&lt;br /&gt;
|-&lt;br /&gt;
| Template language&lt;br /&gt;
| HTML5&lt;br /&gt;
| ERB/HAML&lt;br /&gt;
| Groovy/Japid&lt;br /&gt;
|-&lt;br /&gt;
| Dynamic Typing&lt;br /&gt;
| No&lt;br /&gt;
| Yes&lt;br /&gt;
| No&lt;br /&gt;
|-&lt;br /&gt;
| Admin Generator&lt;br /&gt;
| Yes&lt;br /&gt;
| Yes&lt;br /&gt;
| No&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Advantages ==&lt;br /&gt;
# Binding server side state to users' sessions is incredibly powerful. Each user can have a living representation in the server that talks to other users' representations.&amp;lt;ref name=adv&amp;gt;[http://stanford.wikia.com/wiki/Project_2:_Lift,_the_Scala_Web_framework Lift Project]&amp;lt;/ref&amp;gt;&lt;br /&gt;
# Built-in Comet support possibly the best Comet support in web frameworks. Pushing data to the browser is as simple as calling partialUpdate or asking for a full re-rendering of the component. Updates of multiple components are automatically serialized in a unique connection.&lt;br /&gt;
# Long-live closures simplify form processing and can be used to create complex wizards.&lt;br /&gt;
# View-first approach helps with 'Lean Controller, Fat Model'.&lt;br /&gt;
# Server state machines support for models, including timeouts. For instance, we can use a machine to specify that after three days without confirmation, a new account has to be deleted. Consequently, there is no need for cron and script/runner type solutions in Rails. Instead of imperatively stating what maintenance operations to do; state what rules to enforce and it is automatically done when necessary.&lt;br /&gt;
&lt;br /&gt;
== Disadvantages ==&lt;br /&gt;
&lt;br /&gt;
# Moving state to the server comes with all disadvantages discussed in class. That being said, various remote actors libraries are currently being developed and would permit actors living in different JVMs (running possibly on different machines) to communicate between each others seamlessly. &amp;lt;ref name=adv&amp;gt;[http://stanford.wikia.com/wiki/Project_2:_Lift,_the_Scala_Web_framework Lift Project]&amp;lt;/ref&amp;gt;Furthermore, it is often possible to architect an application such that loosely coupled components can live on different machines -- it is definitely possible with the stock trading application we will present during our in-class presentation.&lt;br /&gt;
# Terrible API (i.e. badly chosen names, confusing domain model) and no documentation at all (the Scala documentation is OK, though).&lt;br /&gt;
# Despite the fact that the API is stabilizing (unfortunately?), most of the tutorials are outdated.&lt;br /&gt;
# Routing is a nightmare for no infrastructure is available. &lt;br /&gt;
# Despite the fact that we can't move logic from snippets to templates, it is possible to move XHTML from templates to snippets. It is not always clear where the view has to be. Is a snippet a controller or a dynamically generated view? Is there actually a difference between the two?&lt;br /&gt;
&lt;br /&gt;
== Get Started ==&lt;br /&gt;
&lt;br /&gt;
The Lift Cookbook is the best place to start with using the Lift Framework.&lt;br /&gt;
[http://cookbook.liftweb.net/ CookBook]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&amp;lt;references&amp;gt;&amp;lt;/references&amp;gt;&lt;/div&gt;</summary>
		<author><name>Aprasad3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/ch1a_4_wl&amp;diff=88494</id>
		<title>CSC/ECE 517 Fall 2014/ch1a 4 wl</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/ch1a_4_wl&amp;diff=88494"/>
		<updated>2014-09-25T22:43:17Z</updated>

		<summary type="html">&lt;p&gt;Aprasad3: /* Components */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;WEB DEVELOPMENT USING LIFT&lt;br /&gt;
==Introduction==&lt;br /&gt;
Lift is a web framework designed to make the most powerful techniques easily accessible while keeping the overall framework simple and flexible. Lift has picked some of the best ideas from a number of other frameworks while creating some of it's own novel ideas. This combination of solid foundation and new techniques makes Lift a powerful framework. The clear separation of presentation content and logic based on the concept of Model View Controller pattern is one of the key strengths of the framework.&lt;br /&gt;
&lt;br /&gt;
     &amp;quot;Lift is the kind of web framework that enables you as a developer to concentrate on the big picture. Strong, expressive typing and higher-level&lt;br /&gt;
      features like the built-in Comet support allow you to focus on innovating instead of the plumbing.&amp;quot; -- Novell&amp;lt;ref name=overview&amp;gt;[http://www.liftweb.net/lift_overview Lift Overview]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Background==&lt;br /&gt;
Lift is an open source software licensed under an Apache 2.0 license. Lift 2.5 is the latest stable version released and the Lift community has already started development for Lift 3.0. The source code can be found of the GitHub repository.&amp;lt;ref name=github&amp;gt;[https://github.com/lift/framework Lift Source Code]&amp;lt;/ref&amp;gt;&lt;br /&gt;
Lift borrows from the best of existing frameworks, providing: &lt;br /&gt;
*Seaside’s highly granular sessions and security.&lt;br /&gt;
*Rails’s fast flash-to-bang.&lt;br /&gt;
*Django’s “more than just CRUD is included”.&lt;br /&gt;
*Wicket’s designer-friendly templating style.&amp;lt;ref name=wiki&amp;gt;[https://www.assembla.com/spaces/liftweb/wiki/Home Lift Developers' wiki]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Lift is built on top of the Scala programming language. Scala is a relatively new language which compiles to Java bytecode and runs on the JVM. Scala was developed by Martin Odersky. Since lift is built on Scala, the vast ecosystem of Java libraries can be leveraged for the web development like any other Java based web framework. Lift also uses the extensive XML library support and processing capabilities of the Scala language.&lt;br /&gt;
&lt;br /&gt;
== The Scala Programming Language ==&lt;br /&gt;
&lt;br /&gt;
Scala is a statically typed multi-paradigm programming language integrating features of object-oriented and functional languages. It runs on the JVM and is fully interoperable with Java. Scala is equipped with an expressive type system providing a powerful basis for the safe reuse of component abstractions and provides a combination of language mechanisms that make it easy to smoothly add new language constructs as libraries. The resulting language scalability -- as praised in Guy Steele's famous 1998 OOPSLA keynote, is illustrated by Scala's lightweight actor library. Furthermore, Scala syntax supports native XML literals.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Features of Lift Web Framework ==&lt;br /&gt;
*   '''LazyLoading:''' Lift supports lazy loading of a snippet. This is useful when a snippet may take a long time to render, but it is required to return the page to the browser quickly.&lt;br /&gt;
&lt;br /&gt;
*  '''Parallel Page rendering:''' Executing multiple snippets in parallel is possible in Lift. Multiple jobs or processes can be spawned and run in parallel. However only when all the tasks or jobs are complete the final page render is sent back to the browser.&lt;br /&gt;
&lt;br /&gt;
*   '''Comet and Ajax support:''' Comet along with Ajax supports the asynchronous updates from user to the server or from server back to the user.&lt;br /&gt;
&lt;br /&gt;
*   '''Wiring:''' The relationship between different elements on a page is defined through Lift Wiring. When any element on a page changes, the dependent items are displayed on the next HTTP response.&lt;br /&gt;
&lt;br /&gt;
*   '''Security:''' Lift apps are not vulnerable to the common security concerns. Lift has built-in safeguards to combat vulnerabilities like Injection, [http://en.wikipedia.org/wiki/Cross-site_scripting XSS], Direct Object references and URL access&lt;br /&gt;
&lt;br /&gt;
*   '''Developer centric:''' Lift apps are fast to build, concise and easy to maintain and can be developed in totally designer friendly way.&lt;br /&gt;
&lt;br /&gt;
*  '''Scalable:''' Lift apps are high performance and scale in the real world to handle the high volume of traffic.&lt;br /&gt;
&lt;br /&gt;
*  ''' Modular:''' Lift apps can benefit from, easy to integrate, pre built modules&amp;lt;ref name=liftweb&amp;gt;[http://liftweb.net/ Lift Official HomePage]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Comparison to Rails ==&lt;br /&gt;
&lt;br /&gt;
=== The View-First Approach ===&lt;br /&gt;
&lt;br /&gt;
Templates in Lift are used for display only and never contain programming logic. Consequently, they can be manipulated by non-programmers with tools such as Dreamweaver. Furthermore, contrarily to Rails, Lift snippets are invoked by the template, and not vice versa. The following template illustrates the view-first approach by invoking the form method in the User snippet using the &amp;lt;lift:snippet&amp;gt; tag. The body of this tag can refer to values bound by the User snippet in the snippet-defined fields namespace.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;html xmlns=&amp;quot;http://www.w3.org/1999/xhtml&amp;quot; xmlns:lift=&amp;quot;http://liftweb.net/&amp;quot;&amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;lt;lift:snippet type=&amp;quot;user:form&amp;quot; form=&amp;quot;POST&amp;quot;&amp;gt;&lt;br /&gt;
    First name &amp;lt;fields:first /&amp;gt;&lt;br /&gt;
    Last name &amp;lt;fields:last /&amp;gt;&lt;br /&gt;
    &amp;lt;fields:submit /&amp;gt;&lt;br /&gt;
  &amp;lt;/lift:snippet&amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
&amp;lt;/html&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Rails' controller-first dispatch mechanism makes the assumption that there is only one piece of logic on the page and the rest is decoration. When a page contains more than one piece of logic (e.g. a shopping cart and an interactive chat), having to choose a single piece of logic make the controller code complicated. This usually require some combination of controller inheritance (move common logic into the superclass of controllers -- e.g. put the shopping cart code in the ApplicationController), moving code from controllers into helpers and models, and the use of partial views.&lt;br /&gt;
&lt;br /&gt;
Finally, the view-first approach allows the templates to easily glue different components together. However, when gluing components gets more complicated (e.g. when dependencies must be satisfied), the simplicity of this approach fails and actual code has to be written.&amp;lt;ref name=viewfirst&amp;gt;[http://stanford.wikia.com/wiki/Project_2:_Lift,_the_Scala_Web_framework View-First Approach]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Long-Lived Closures ===&lt;br /&gt;
Lift allows the server application to attach closures to elements rendered in the user interface (e.g. form elements). The following snippet illustrates to usage of such closures.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class User {&lt;br /&gt;
  def form(template: Group) = {&lt;br /&gt;
    var first, last = &amp;quot;&amp;quot;&lt;br /&gt;
    bind(&amp;quot;fields&amp;quot;, template,&lt;br /&gt;
      &amp;quot;first&amp;quot;  --&amp;gt; text(&amp;quot;&amp;quot;, n =&amp;gt; first = n),&lt;br /&gt;
      &amp;quot;last&amp;quot;   --&amp;gt; text(&amp;quot;&amp;quot;, l =&amp;gt; last = l),&lt;br /&gt;
      &amp;quot;submit&amp;quot; --&amp;gt; submit(&amp;quot;Submit&amp;quot;, ignore =&amp;gt; process(first, last)))&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  def process(first: String, last: String) {&lt;br /&gt;
    ...&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The n =&amp;gt; first = n and l =&amp;gt; last = l anonymous functions are attached to two text inputs. The input Lift passes to these functions is the value of the element. The body of these two functions assign the value of text input to the first and last variables. The ignore =&amp;gt; process(first, last) anonymous function is attached to the submit button. In this case, we ignore the argument adequately named ignore because a button doesn't have a value. The body is call another function that could, for instance, store the two names in a database.&lt;br /&gt;
&lt;br /&gt;
To achieve this magic, Lift stores the closures in a map when the component is rendered. Randomly generated strings are used as keys and inserted in the generated HTML elements. When the form is submitted, Lift looks for the closures in the map based on the provided keys and executes them. Note how the first and last variables are captured by the three closures and, consequently, stored between the two request-response cycles.&lt;br /&gt;
&lt;br /&gt;
The advantage of this approach is that snippets can specify what happens when a specific button is pushed rather than having a controller parsing the submitted form and process the parameters extracted from the HTTP request. In essence, Lift allows you to specify server-side actions corresponding to user actions when the form is rendered rather than processing the results to figure out what actions the user performed during the next request. This reduces the need for magic constants used to map actions between the rendered view and controllers in other frameworks. In Rails, you might create a form with two buttons labeled 'Buy Now' and 'Buy Later' and then compare the submit parameter to 'Buy Now' and 'Buy Later' in the controller to determine the appropriate action. In Lift, this can be done with two different bindings in the render function.&amp;lt;ref name = closure&amp;gt;[http://stanford.wikia.com/wiki/Project_2:_Lift,_the_Scala_Web_framework Closures]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Lift Web Framework ==&lt;br /&gt;
&amp;lt;div class=&amp;quot;center&amp;quot;&amp;gt; [[File:LiftArchDiagram.jpg]] &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Components ===&lt;br /&gt;
#	LiftCore: This is the web processor of the framework which handles the following functions.&lt;br /&gt;
##	Request/Response&lt;br /&gt;
##	Rendering Pipeline&lt;br /&gt;
##	Invoking User Functions&lt;br /&gt;
#	LiftRules : Lift Configuration Management. Allows you to configure Lift. &lt;br /&gt;
#	LiftSession: Inherent Session State Representation.&amp;lt;ref name=liftsession&amp;gt;[http://exploring.liftweb.net/master/index-9.html#sec:Session-Management]&amp;lt;/ref&amp;gt;&lt;br /&gt;
#	S: stateful context for request/response lifecycle.&lt;br /&gt;
#	SiteMap: contains web pages for the lift application.&lt;br /&gt;
#	SHtml: helper functions for XHtml.&lt;br /&gt;
#	Views: Views as XML content. Allows composing views from not only html files but other contexts too.&lt;br /&gt;
#	LiftResponse: Abstraction of response sent to the client.&lt;br /&gt;
#	Comet: allows sending asynchronous content to browser.&lt;br /&gt;
#	[http://en.wikipedia.org/wiki/Object-relational_mapping ORM]: A specialized library.&lt;br /&gt;
#	HTTP Auth: provides control over authentication model.&lt;br /&gt;
#	JS API: JavaScript abstraction layer.&amp;lt;ref name=explore&amp;gt;[http://exploring.liftweb.net/master/index-9.html Exploring Lift Framework]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Getting Started ==&lt;br /&gt;
&lt;br /&gt;
=== Set Up on Eclipse ===&lt;br /&gt;
&lt;br /&gt;
#	Download “Scala IDE for Eclipse” : http://scala-ide.org/&lt;br /&gt;
#	Install plugin in Eclipse from this update site : http://download.scala-ide.org/sdk/helium/e38/scala211/stable/site&lt;br /&gt;
#	Once the plugin is installed restart Eclipse&lt;br /&gt;
#	Install sbteclipse  by adding the following to projects/plugins.sbt in your Lift Project: &amp;lt;code&amp;gt; addSbtPlugin(&amp;quot;com.typesafe.sbteclipse&amp;quot; % &amp;quot;sbteclipse-plugin&amp;quot; % &amp;quot;2.5.0&amp;quot;) &amp;lt;/code&amp;gt;&amp;lt;ref name=sbt&amp;gt;[http://en.wikipedia.org/wiki/SBT_(software) SBT]&amp;lt;/ref&amp;gt;&lt;br /&gt;
#	You can then create Eclipse project files (.project and .classpath) by entering the following into the SBT prompt: &amp;lt;code&amp;gt; eclipse &amp;lt;/code&amp;gt;&amp;lt;ref name=cookbook&amp;gt;[http://cookbook.liftweb.net/ The Lift Cookbook]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Setup Video Tutorial : [http://www.youtube.com/watch?v=qRIiUUKA2Mw link] &lt;br /&gt;
&lt;br /&gt;
== Basic Web Application Structure ==&lt;br /&gt;
&lt;br /&gt;
=== Step 1: Making a SiteMap entry ===&lt;br /&gt;
&lt;br /&gt;
Every page on the site needs a SiteMap entry.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def sitemap(): SiteMap = SiteMap(&lt;br /&gt;
  Menu(&amp;quot;Home&amp;quot;) / &amp;quot;index&amp;quot;,&lt;br /&gt;
  Menu(&amp;quot;Second Page&amp;quot;) / &amp;quot;second&amp;quot;&lt;br /&gt;
)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Step 2: Creating the view ===&lt;br /&gt;
Create an HTML file that corresponds to the sitemap entry.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;meta content=&amp;quot;text/html; charset=UTF-8&amp;quot; http-equiv=&amp;quot;content-type&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;title&amp;gt;Home&amp;lt;/title&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;div id=&amp;quot;main&amp;quot; class=&amp;quot;lift:surround?with=default&amp;amp;at=content&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;div&amp;gt;&lt;br /&gt;
        Hi, I'm a page that contains the time:&lt;br /&gt;
        &amp;lt;span class=&amp;quot;lift:TimeNow&amp;quot;&amp;gt;??? some time&amp;lt;/span&amp;gt;.&lt;br /&gt;
      &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
      &amp;lt;div&amp;gt;&lt;br /&gt;
        And a button: &amp;lt;button class=&amp;quot;lift:ClickMe&amp;quot;&amp;gt;Click Me&amp;lt;/button&amp;gt;.&lt;br /&gt;
      &amp;lt;/div&amp;gt;&lt;br /&gt;
    &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Step 3 : Creating the Snippet ===&lt;br /&gt;
&lt;br /&gt;
A snippet can be thought of as a controller which has rules for transforming the section of your template.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
package code&lt;br /&gt;
package snippet&lt;br /&gt;
&lt;br /&gt;
import net.liftweb._&lt;br /&gt;
import util._&lt;br /&gt;
import Helpers._&lt;br /&gt;
&lt;br /&gt;
object TimeNow {&lt;br /&gt;
  def render = &amp;quot;* *&amp;quot; #&amp;gt; now.toString&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&amp;lt;ref name=simplylift&amp;gt;[http://simply.liftweb.net/ Simply Lift]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Framework Comparison ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! &lt;br /&gt;
! Lift&lt;br /&gt;
! Rails&lt;br /&gt;
! Play&lt;br /&gt;
|-&lt;br /&gt;
| Scaffolding&lt;br /&gt;
| No&lt;br /&gt;
| Yes&lt;br /&gt;
| Yes&lt;br /&gt;
|-&lt;br /&gt;
| Design Pattern&lt;br /&gt;
| MVVM&lt;br /&gt;
| MVC&lt;br /&gt;
| MVC&lt;br /&gt;
|-&lt;br /&gt;
| Programming language&lt;br /&gt;
| Scala&lt;br /&gt;
| Ruby&lt;br /&gt;
| Java&lt;br /&gt;
|-&lt;br /&gt;
| Template language&lt;br /&gt;
| HTML5&lt;br /&gt;
| ERB/HAML&lt;br /&gt;
| Groovy/Japid&lt;br /&gt;
|-&lt;br /&gt;
| Dynamic Typing&lt;br /&gt;
| No&lt;br /&gt;
| Yes&lt;br /&gt;
| No&lt;br /&gt;
|-&lt;br /&gt;
| Admin Generator&lt;br /&gt;
| Yes&lt;br /&gt;
| Yes&lt;br /&gt;
| No&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Advantages ==&lt;br /&gt;
# Binding server side state to users' sessions is incredibly powerful. Each user can have a living representation in the server that talks to other users' representations.&amp;lt;ref name=adv&amp;gt;[http://stanford.wikia.com/wiki/Project_2:_Lift,_the_Scala_Web_framework Lift Project]&amp;lt;/ref&amp;gt;&lt;br /&gt;
# Built-in Comet support possibly the best Comet support in web frameworks. Pushing data to the browser is as simple as calling partialUpdate or asking for a full re-rendering of the component. Updates of multiple components are automatically serialized in a unique connection.&lt;br /&gt;
# Long-live closures simplify form processing and can be used to create complex wizards.&lt;br /&gt;
# View-first approach helps with 'Lean Controller, Fat Model'.&lt;br /&gt;
# Server state machines support for models, including timeouts. For instance, we can use a machine to specify that after three days without confirmation, a new account has to be deleted. Consequently, there is no need for cron and script/runner type solutions in Rails. Instead of imperatively stating what maintenance operations to do; state what rules to enforce and it is automatically done when necessary.&lt;br /&gt;
&lt;br /&gt;
== Disadvantages ==&lt;br /&gt;
&lt;br /&gt;
# Moving state to the server comes with all disadvantages discussed in class. That being said, various remote actors libraries are currently being developed and would permit actors living in different JVMs (running possibly on different machines) to communicate between each others seamlessly. &amp;lt;ref name=adv&amp;gt;[http://stanford.wikia.com/wiki/Project_2:_Lift,_the_Scala_Web_framework Lift Project]&amp;lt;/ref&amp;gt;Furthermore, it is often possible to architect an application such that loosely coupled components can live on different machines -- it is definitely possible with the stock trading application we will present during our in-class presentation.&lt;br /&gt;
# Terrible API (i.e. badly chosen names, confusing domain model) and no documentation at all (the Scala documentation is OK, though).&lt;br /&gt;
# Despite the fact that the API is stabilizing (unfortunately?), most of the tutorials are outdated.&lt;br /&gt;
# Routing is a nightmare for no infrastructure is available. &lt;br /&gt;
# Despite the fact that we can't move logic from snippets to templates, it is possible to move XHTML from templates to snippets. It is not always clear where the view has to be. Is a snippet a controller or a dynamically generated view? Is there actually a difference between the two?&lt;br /&gt;
&lt;br /&gt;
== Get Started ==&lt;br /&gt;
&lt;br /&gt;
The Lift Cookbook is the best place to start with using the Lift Framework.&lt;br /&gt;
[http://cookbook.liftweb.net/ CookBook]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&amp;lt;references&amp;gt;&amp;lt;/references&amp;gt;&lt;/div&gt;</summary>
		<author><name>Aprasad3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/ch1a_4_wl&amp;diff=88489</id>
		<title>CSC/ECE 517 Fall 2014/ch1a 4 wl</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/ch1a_4_wl&amp;diff=88489"/>
		<updated>2014-09-25T22:39:28Z</updated>

		<summary type="html">&lt;p&gt;Aprasad3: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;WEB DEVELOPMENT USING LIFT&lt;br /&gt;
==Introduction==&lt;br /&gt;
Lift is a web framework designed to make the most powerful techniques easily accessible while keeping the overall framework simple and flexible. Lift has picked some of the best ideas from a number of other frameworks while creating some of it's own novel ideas. This combination of solid foundation and new techniques makes Lift a powerful framework. The clear separation of presentation content and logic based on the concept of Model View Controller pattern is one of the key strengths of the framework.&lt;br /&gt;
&lt;br /&gt;
     &amp;quot;Lift is the kind of web framework that enables you as a developer to concentrate on the big picture. Strong, expressive typing and higher-level&lt;br /&gt;
      features like the built-in Comet support allow you to focus on innovating instead of the plumbing.&amp;quot; -- Novell&amp;lt;ref name=overview&amp;gt;[http://www.liftweb.net/lift_overview Lift Overview]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Background==&lt;br /&gt;
Lift is an open source software licensed under an Apache 2.0 license. Lift 2.5 is the latest stable version released and the Lift community has already started development for Lift 3.0. The source code can be found of the GitHub repository.&amp;lt;ref name=github&amp;gt;[https://github.com/lift/framework Lift Source Code]&amp;lt;/ref&amp;gt;&lt;br /&gt;
Lift borrows from the best of existing frameworks, providing: &lt;br /&gt;
*Seaside’s highly granular sessions and security.&lt;br /&gt;
*Rails’s fast flash-to-bang.&lt;br /&gt;
*Django’s “more than just CRUD is included”.&lt;br /&gt;
*Wicket’s designer-friendly templating style.&amp;lt;ref name=wiki&amp;gt;[https://www.assembla.com/spaces/liftweb/wiki/Home Lift Developers' wiki]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Lift is built on top of the Scala programming language. Scala is a relatively new language which compiles to Java bytecode and runs on the JVM. Scala was developed by Martin Odersky. Since lift is built on Scala, the vast ecosystem of Java libraries can be leveraged for the web development like any other Java based web framework. Lift also uses the extensive XML library support and processing capabilities of the Scala language.&lt;br /&gt;
&lt;br /&gt;
== The Scala Programming Language ==&lt;br /&gt;
&lt;br /&gt;
Scala is a statically typed multi-paradigm programming language integrating features of object-oriented and functional languages. It runs on the JVM and is fully interoperable with Java. Scala is equipped with an expressive type system providing a powerful basis for the safe reuse of component abstractions and provides a combination of language mechanisms that make it easy to smoothly add new language constructs as libraries. The resulting language scalability -- as praised in Guy Steele's famous 1998 OOPSLA keynote, is illustrated by Scala's lightweight actor library. Furthermore, Scala syntax supports native XML literals.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Features of Lift Web Framework ==&lt;br /&gt;
*   '''LazyLoading:''' Lift supports lazy loading of a snippet. This is useful when a snippet may take a long time to render, but it is required to return the page to the browser quickly.&lt;br /&gt;
&lt;br /&gt;
*  '''Parallel Page rendering:''' Executing multiple snippets in parallel is possible in Lift. Multiple jobs or processes can be spawned and run in parallel. However only when all the tasks or jobs are complete the final page render is sent back to the browser.&lt;br /&gt;
&lt;br /&gt;
*   '''Comet and Ajax support:''' Comet along with Ajax supports the asynchronous updates from user to the server or from server back to the user.&lt;br /&gt;
&lt;br /&gt;
*   '''Wiring:''' The relationship between different elements on a page is defined through Lift Wiring. When any element on a page changes, the dependent items are displayed on the next HTTP response.&lt;br /&gt;
&lt;br /&gt;
*   '''Security:''' Lift apps are not vulnerable to the common security concerns. Lift has built-in safeguards to combat vulnerabilities like Injection, [http://en.wikipedia.org/wiki/Cross-site_scripting XSS], Direct Object references and URL access&lt;br /&gt;
&lt;br /&gt;
*   '''Developer centric:''' Lift apps are fast to build, concise and easy to maintain and can be developed in totally designer friendly way.&lt;br /&gt;
&lt;br /&gt;
*  '''Scalable:''' Lift apps are high performance and scale in the real world to handle the high volume of traffic.&lt;br /&gt;
&lt;br /&gt;
*  ''' Modular:''' Lift apps can benefit from, easy to integrate, pre built modules&amp;lt;ref name=liftweb&amp;gt;[http://liftweb.net/ Lift Official HomePage]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Comparison to Rails ==&lt;br /&gt;
&lt;br /&gt;
=== The View-First Approach ===&lt;br /&gt;
&lt;br /&gt;
Templates in Lift are used for display only and never contain programming logic. Consequently, they can be manipulated by non-programmers with tools such as Dreamweaver. Furthermore, contrarily to Rails, Lift snippets are invoked by the template, and not vice versa. The following template illustrates the view-first approach by invoking the form method in the User snippet using the &amp;lt;lift:snippet&amp;gt; tag. The body of this tag can refer to values bound by the User snippet in the snippet-defined fields namespace.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;html xmlns=&amp;quot;http://www.w3.org/1999/xhtml&amp;quot; xmlns:lift=&amp;quot;http://liftweb.net/&amp;quot;&amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;lt;lift:snippet type=&amp;quot;user:form&amp;quot; form=&amp;quot;POST&amp;quot;&amp;gt;&lt;br /&gt;
    First name &amp;lt;fields:first /&amp;gt;&lt;br /&gt;
    Last name &amp;lt;fields:last /&amp;gt;&lt;br /&gt;
    &amp;lt;fields:submit /&amp;gt;&lt;br /&gt;
  &amp;lt;/lift:snippet&amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
&amp;lt;/html&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Rails' controller-first dispatch mechanism makes the assumption that there is only one piece of logic on the page and the rest is decoration. When a page contains more than one piece of logic (e.g. a shopping cart and an interactive chat), having to choose a single piece of logic make the controller code complicated. This usually require some combination of controller inheritance (move common logic into the superclass of controllers -- e.g. put the shopping cart code in the ApplicationController), moving code from controllers into helpers and models, and the use of partial views.&lt;br /&gt;
&lt;br /&gt;
Finally, the view-first approach allows the templates to easily glue different components together. However, when gluing components gets more complicated (e.g. when dependencies must be satisfied), the simplicity of this approach fails and actual code has to be written.&amp;lt;ref name=viewfirst&amp;gt;[http://stanford.wikia.com/wiki/Project_2:_Lift,_the_Scala_Web_framework View-First Approach]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Long-Lived Closures ===&lt;br /&gt;
Lift allows the server application to attach closures to elements rendered in the user interface (e.g. form elements). The following snippet illustrates to usage of such closures.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class User {&lt;br /&gt;
  def form(template: Group) = {&lt;br /&gt;
    var first, last = &amp;quot;&amp;quot;&lt;br /&gt;
    bind(&amp;quot;fields&amp;quot;, template,&lt;br /&gt;
      &amp;quot;first&amp;quot;  --&amp;gt; text(&amp;quot;&amp;quot;, n =&amp;gt; first = n),&lt;br /&gt;
      &amp;quot;last&amp;quot;   --&amp;gt; text(&amp;quot;&amp;quot;, l =&amp;gt; last = l),&lt;br /&gt;
      &amp;quot;submit&amp;quot; --&amp;gt; submit(&amp;quot;Submit&amp;quot;, ignore =&amp;gt; process(first, last)))&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  def process(first: String, last: String) {&lt;br /&gt;
    ...&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The n =&amp;gt; first = n and l =&amp;gt; last = l anonymous functions are attached to two text inputs. The input Lift passes to these functions is the value of the element. The body of these two functions assign the value of text input to the first and last variables. The ignore =&amp;gt; process(first, last) anonymous function is attached to the submit button. In this case, we ignore the argument adequately named ignore because a button doesn't have a value. The body is call another function that could, for instance, store the two names in a database.&lt;br /&gt;
&lt;br /&gt;
To achieve this magic, Lift stores the closures in a map when the component is rendered. Randomly generated strings are used as keys and inserted in the generated HTML elements. When the form is submitted, Lift looks for the closures in the map based on the provided keys and executes them. Note how the first and last variables are captured by the three closures and, consequently, stored between the two request-response cycles.&lt;br /&gt;
&lt;br /&gt;
The advantage of this approach is that snippets can specify what happens when a specific button is pushed rather than having a controller parsing the submitted form and process the parameters extracted from the HTTP request. In essence, Lift allows you to specify server-side actions corresponding to user actions when the form is rendered rather than processing the results to figure out what actions the user performed during the next request. This reduces the need for magic constants used to map actions between the rendered view and controllers in other frameworks. In Rails, you might create a form with two buttons labeled 'Buy Now' and 'Buy Later' and then compare the submit parameter to 'Buy Now' and 'Buy Later' in the controller to determine the appropriate action. In Lift, this can be done with two different bindings in the render function.&amp;lt;ref name = closure&amp;gt;[http://stanford.wikia.com/wiki/Project_2:_Lift,_the_Scala_Web_framework Closures]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Lift Web Framework ==&lt;br /&gt;
&amp;lt;div class=&amp;quot;center&amp;quot;&amp;gt; [[File:LiftArchDiagram.jpg]] &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Components ===&lt;br /&gt;
#	LiftCore: This is the web processor of the framework which handles the following functions.&lt;br /&gt;
##	Request/Response&lt;br /&gt;
##	Rendering Pipeline&lt;br /&gt;
##	Invoking User Functions&lt;br /&gt;
#	LiftRules : Lift Configuration&lt;br /&gt;
#	LiftSession: Inherent Session State.&lt;br /&gt;
#	S: stateful context for request/response lifecycle.&lt;br /&gt;
#	SiteMap: contains web pages for the lift application.&lt;br /&gt;
#	SHtml: helper functions for XHtml.&lt;br /&gt;
#	Views: Views as XML content. Allows composing views from not only html files but other contexts too.&lt;br /&gt;
#	LiftResponse: Abstraction of response sent to the client.&lt;br /&gt;
#	Comet: allows sending asynchronous content to browser.&lt;br /&gt;
#	[http://en.wikipedia.org/wiki/Object-relational_mapping ORM]: A specialized library.&lt;br /&gt;
#	HTTP Auth: provides control over authentication model.&lt;br /&gt;
#	JS API: JavaScript abstraction layer.&amp;lt;ref name=explore&amp;gt;[http://exploring.liftweb.net/master/index-9.html Exploring Lift Framework]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Getting Started ==&lt;br /&gt;
&lt;br /&gt;
=== Set Up on Eclipse ===&lt;br /&gt;
&lt;br /&gt;
#	Download “Scala IDE for Eclipse” : http://scala-ide.org/&lt;br /&gt;
#	Install plugin in Eclipse from this update site : http://download.scala-ide.org/sdk/helium/e38/scala211/stable/site&lt;br /&gt;
#	Once the plugin is installed restart Eclipse&lt;br /&gt;
#	Install sbteclipse  by adding the following to projects/plugins.sbt in your Lift Project: &amp;lt;code&amp;gt; addSbtPlugin(&amp;quot;com.typesafe.sbteclipse&amp;quot; % &amp;quot;sbteclipse-plugin&amp;quot; % &amp;quot;2.5.0&amp;quot;) &amp;lt;/code&amp;gt;&amp;lt;ref name=sbt&amp;gt;[http://en.wikipedia.org/wiki/SBT_(software) SBT]&amp;lt;/ref&amp;gt;&lt;br /&gt;
#	You can then create Eclipse project files (.project and .classpath) by entering the following into the SBT prompt: &amp;lt;code&amp;gt; eclipse &amp;lt;/code&amp;gt;&amp;lt;ref name=cookbook&amp;gt;[http://cookbook.liftweb.net/ The Lift Cookbook]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Setup Video Tutorial : [http://www.youtube.com/watch?v=qRIiUUKA2Mw link] &lt;br /&gt;
&lt;br /&gt;
== Basic Web Application Structure ==&lt;br /&gt;
&lt;br /&gt;
=== Step 1: Making a SiteMap entry ===&lt;br /&gt;
&lt;br /&gt;
Every page on the site needs a SiteMap entry.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def sitemap(): SiteMap = SiteMap(&lt;br /&gt;
  Menu(&amp;quot;Home&amp;quot;) / &amp;quot;index&amp;quot;,&lt;br /&gt;
  Menu(&amp;quot;Second Page&amp;quot;) / &amp;quot;second&amp;quot;&lt;br /&gt;
)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Step 2: Creating the view ===&lt;br /&gt;
Create an HTML file that corresponds to the sitemap entry.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;meta content=&amp;quot;text/html; charset=UTF-8&amp;quot; http-equiv=&amp;quot;content-type&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;title&amp;gt;Home&amp;lt;/title&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;div id=&amp;quot;main&amp;quot; class=&amp;quot;lift:surround?with=default&amp;amp;at=content&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;div&amp;gt;&lt;br /&gt;
        Hi, I'm a page that contains the time:&lt;br /&gt;
        &amp;lt;span class=&amp;quot;lift:TimeNow&amp;quot;&amp;gt;??? some time&amp;lt;/span&amp;gt;.&lt;br /&gt;
      &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
      &amp;lt;div&amp;gt;&lt;br /&gt;
        And a button: &amp;lt;button class=&amp;quot;lift:ClickMe&amp;quot;&amp;gt;Click Me&amp;lt;/button&amp;gt;.&lt;br /&gt;
      &amp;lt;/div&amp;gt;&lt;br /&gt;
    &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Step 3 : Creating the Snippet ===&lt;br /&gt;
&lt;br /&gt;
A snippet can be thought of as a controller which has rules for transforming the section of your template.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
package code&lt;br /&gt;
package snippet&lt;br /&gt;
&lt;br /&gt;
import net.liftweb._&lt;br /&gt;
import util._&lt;br /&gt;
import Helpers._&lt;br /&gt;
&lt;br /&gt;
object TimeNow {&lt;br /&gt;
  def render = &amp;quot;* *&amp;quot; #&amp;gt; now.toString&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&amp;lt;ref name=simplylift&amp;gt;[http://simply.liftweb.net/ Simply Lift]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Framework Comparison ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! &lt;br /&gt;
! Lift&lt;br /&gt;
! Rails&lt;br /&gt;
! Play&lt;br /&gt;
|-&lt;br /&gt;
| Scaffolding&lt;br /&gt;
| No&lt;br /&gt;
| Yes&lt;br /&gt;
| Yes&lt;br /&gt;
|-&lt;br /&gt;
| Design Pattern&lt;br /&gt;
| MVVM&lt;br /&gt;
| MVC&lt;br /&gt;
| MVC&lt;br /&gt;
|-&lt;br /&gt;
| Programming language&lt;br /&gt;
| Scala&lt;br /&gt;
| Ruby&lt;br /&gt;
| Java&lt;br /&gt;
|-&lt;br /&gt;
| Template language&lt;br /&gt;
| HTML5&lt;br /&gt;
| ERB/HAML&lt;br /&gt;
| Groovy/Japid&lt;br /&gt;
|-&lt;br /&gt;
| Dynamic Typing&lt;br /&gt;
| No&lt;br /&gt;
| Yes&lt;br /&gt;
| No&lt;br /&gt;
|-&lt;br /&gt;
| Admin Generator&lt;br /&gt;
| Yes&lt;br /&gt;
| Yes&lt;br /&gt;
| No&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Advantages ==&lt;br /&gt;
# Binding server side state to users' sessions is incredibly powerful. Each user can have a living representation in the server that talks to other users' representations.&amp;lt;ref name=adv&amp;gt;[http://stanford.wikia.com/wiki/Project_2:_Lift,_the_Scala_Web_framework Lift Project]&amp;lt;/ref&amp;gt;&lt;br /&gt;
# Built-in Comet support possibly the best Comet support in web frameworks. Pushing data to the browser is as simple as calling partialUpdate or asking for a full re-rendering of the component. Updates of multiple components are automatically serialized in a unique connection.&lt;br /&gt;
# Long-live closures simplify form processing and can be used to create complex wizards.&lt;br /&gt;
# View-first approach helps with 'Lean Controller, Fat Model'.&lt;br /&gt;
# Server state machines support for models, including timeouts. For instance, we can use a machine to specify that after three days without confirmation, a new account has to be deleted. Consequently, there is no need for cron and script/runner type solutions in Rails. Instead of imperatively stating what maintenance operations to do; state what rules to enforce and it is automatically done when necessary.&lt;br /&gt;
&lt;br /&gt;
== Disadvantages ==&lt;br /&gt;
&lt;br /&gt;
# Moving state to the server comes with all disadvantages discussed in class. That being said, various remote actors libraries are currently being developed and would permit actors living in different JVMs (running possibly on different machines) to communicate between each others seamlessly. &amp;lt;ref name=adv&amp;gt;[http://stanford.wikia.com/wiki/Project_2:_Lift,_the_Scala_Web_framework Lift Project]&amp;lt;/ref&amp;gt;Furthermore, it is often possible to architect an application such that loosely coupled components can live on different machines -- it is definitely possible with the stock trading application we will present during our in-class presentation.&lt;br /&gt;
# Terrible API (i.e. badly chosen names, confusing domain model) and no documentation at all (the Scala documentation is OK, though).&lt;br /&gt;
# Despite the fact that the API is stabilizing (unfortunately?), most of the tutorials are outdated.&lt;br /&gt;
# Routing is a nightmare for no infrastructure is available. &lt;br /&gt;
# Despite the fact that we can't move logic from snippets to templates, it is possible to move XHTML from templates to snippets. It is not always clear where the view has to be. Is a snippet a controller or a dynamically generated view? Is there actually a difference between the two?&lt;br /&gt;
&lt;br /&gt;
== Get Started ==&lt;br /&gt;
&lt;br /&gt;
The Lift Cookbook is the best place to start with using the Lift Framework.&lt;br /&gt;
[http://cookbook.liftweb.net/ CookBook]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&amp;lt;references&amp;gt;&amp;lt;/references&amp;gt;&lt;/div&gt;</summary>
		<author><name>Aprasad3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/ch1a_4_wl&amp;diff=88487</id>
		<title>CSC/ECE 517 Fall 2014/ch1a 4 wl</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/ch1a_4_wl&amp;diff=88487"/>
		<updated>2014-09-25T22:38:44Z</updated>

		<summary type="html">&lt;p&gt;Aprasad3: /* Framework Comparison */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;WEB DEVELOPMENT USING LIFT&lt;br /&gt;
==Introduction==&lt;br /&gt;
Lift is a web framework designed to make the most powerful techniques easily accessible while keeping the overall framework simple and flexible. Lift has picked some of the best ideas from a number of other frameworks while creating some of it's own novel ideas. This combination of solid foundation and new techniques makes Lift a powerful framework. The clear separation of presentation content and logic based on the concept of Model View Controller pattern is one of the key strengths of the framework.&lt;br /&gt;
&lt;br /&gt;
     &amp;quot;Lift is the kind of web framework that enables you as a developer to concentrate on the big picture. Strong, expressive typing and higher-level&lt;br /&gt;
      features like the built-in Comet support allow you to focus on innovating instead of the plumbing.&amp;quot; -- Novell&amp;lt;ref name=overview&amp;gt;[http://www.liftweb.net/lift_overview Lift Overview]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Background==&lt;br /&gt;
Lift is an open source software licensed under an Apache 2.0 license. Lift 2.5 is the latest stable version released and the Lift community has already started development for Lift 3.0. The source code can be found of the GitHub repository.&amp;lt;ref name=github&amp;gt;[https://github.com/lift/framework Lift Source Code]&amp;lt;/ref&amp;gt;&lt;br /&gt;
Lift borrows from the best of existing frameworks, providing: &lt;br /&gt;
*Seaside’s highly granular sessions and security.&lt;br /&gt;
*Rails’s fast flash-to-bang.&lt;br /&gt;
*Django’s “more than just CRUD is included”.&lt;br /&gt;
*Wicket’s designer-friendly templating style.&amp;lt;ref name=wiki&amp;gt;[https://www.assembla.com/spaces/liftweb/wiki/Home Lift Developers' wiki]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Lift is built on top of the Scala programming language. Scala is a relatively new language which compiles to Java bytecode and runs on the JVM. Scala was developed by Martin Odersky. Since lift is built on Scala, the vast ecosystem of Java libraries can be leveraged for the web development like any other Java based web framework. Lift also uses the extensive XML library support and processing capabilities of the Scala language.&lt;br /&gt;
&lt;br /&gt;
== The Scala Programming Language ==&lt;br /&gt;
&lt;br /&gt;
Scala is a statically typed multi-paradigm programming language integrating features of object-oriented and functional languages. It runs on the JVM and is fully interoperable with Java. Scala is equipped with an expressive type system providing a powerful basis for the safe reuse of component abstractions and provides a combination of language mechanisms that make it easy to smoothly add new language constructs as libraries. The resulting language scalability -- as praised in Guy Steele's famous 1998 OOPSLA keynote, is illustrated by Scala's lightweight actor library. Furthermore, Scala syntax supports native XML literals.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Features of Lift Web Framework ==&lt;br /&gt;
*   '''LazyLoading:''' Lift supports lazy loading of a snippet. This is useful when a snippet may take a long time to render, but it is required to return the page to the browser quickly.&lt;br /&gt;
&lt;br /&gt;
*  '''Parallel Page rendering:''' Executing multiple snippets in parallel is possible in Lift. Multiple jobs or processes can be spawned and run in parallel. However only when all the tasks or jobs are complete the final page render is sent back to the browser.&lt;br /&gt;
&lt;br /&gt;
*   '''Comet and Ajax support:''' Comet along with Ajax supports the asynchronous updates from user to the server or from server back to the user.&lt;br /&gt;
&lt;br /&gt;
*   '''Wiring:''' The relationship between different elements on a page is defined through Lift Wiring. When any element on a page changes, the dependent items are displayed on the next HTTP response.&lt;br /&gt;
&lt;br /&gt;
*   '''Security:''' Lift apps are not vulnerable to the common security concerns. Lift has built-in safeguards to combat vulnerabilities like Injection, [http://en.wikipedia.org/wiki/Cross-site_scripting XSS], Direct Object references and URL access&lt;br /&gt;
&lt;br /&gt;
*   '''Developer centric:''' Lift apps are fast to build, concise and easy to maintain and can be developed in totally designer friendly way.&lt;br /&gt;
&lt;br /&gt;
*  '''Scalable:''' Lift apps are high performance and scale in the real world to handle the high volume of traffic.&lt;br /&gt;
&lt;br /&gt;
*  ''' Modular:''' Lift apps can benefit from, easy to integrate, pre built modules&amp;lt;ref name=liftweb&amp;gt;[http://liftweb.net/ Lift Official HomePage]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Comparison to Rails ==&lt;br /&gt;
&lt;br /&gt;
=== The View-First Approach ===&lt;br /&gt;
&lt;br /&gt;
Templates in Lift are used for display only and never contain programming logic. Consequently, they can be manipulated by non-programmers with tools such as Dreamweaver. Furthermore, contrarily to Rails, Lift snippets are invoked by the template, and not vice versa. The following template illustrates the view-first approach by invoking the form method in the User snippet using the &amp;lt;lift:snippet&amp;gt; tag. The body of this tag can refer to values bound by the User snippet in the snippet-defined fields namespace.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;html xmlns=&amp;quot;http://www.w3.org/1999/xhtml&amp;quot; xmlns:lift=&amp;quot;http://liftweb.net/&amp;quot;&amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;lt;lift:snippet type=&amp;quot;user:form&amp;quot; form=&amp;quot;POST&amp;quot;&amp;gt;&lt;br /&gt;
    First name &amp;lt;fields:first /&amp;gt;&lt;br /&gt;
    Last name &amp;lt;fields:last /&amp;gt;&lt;br /&gt;
    &amp;lt;fields:submit /&amp;gt;&lt;br /&gt;
  &amp;lt;/lift:snippet&amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
&amp;lt;/html&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Rails' controller-first dispatch mechanism makes the assumption that there is only one piece of logic on the page and the rest is decoration. When a page contains more than one piece of logic (e.g. a shopping cart and an interactive chat), having to choose a single piece of logic make the controller code complicated. This usually require some combination of controller inheritance (move common logic into the superclass of controllers -- e.g. put the shopping cart code in the ApplicationController), moving code from controllers into helpers and models, and the use of partial views.&lt;br /&gt;
&lt;br /&gt;
Finally, the view-first approach allows the templates to easily glue different components together. However, when gluing components gets more complicated (e.g. when dependencies must be satisfied), the simplicity of this approach fails and actual code has to be written.&amp;lt;ref name=viewfirst&amp;gt;[http://stanford.wikia.com/wiki/Project_2:_Lift,_the_Scala_Web_framework View-First Approach]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Long-Lived Closures ===&lt;br /&gt;
Lift allows the server application to attach closures to elements rendered in the user interface (e.g. form elements). The following snippet illustrates to usage of such closures.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class User {&lt;br /&gt;
  def form(template: Group) = {&lt;br /&gt;
    var first, last = &amp;quot;&amp;quot;&lt;br /&gt;
    bind(&amp;quot;fields&amp;quot;, template,&lt;br /&gt;
      &amp;quot;first&amp;quot;  --&amp;gt; text(&amp;quot;&amp;quot;, n =&amp;gt; first = n),&lt;br /&gt;
      &amp;quot;last&amp;quot;   --&amp;gt; text(&amp;quot;&amp;quot;, l =&amp;gt; last = l),&lt;br /&gt;
      &amp;quot;submit&amp;quot; --&amp;gt; submit(&amp;quot;Submit&amp;quot;, ignore =&amp;gt; process(first, last)))&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  def process(first: String, last: String) {&lt;br /&gt;
    ...&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The n =&amp;gt; first = n and l =&amp;gt; last = l anonymous functions are attached to two text inputs. The input Lift passes to these functions is the value of the element. The body of these two functions assign the value of text input to the first and last variables. The ignore =&amp;gt; process(first, last) anonymous function is attached to the submit button. In this case, we ignore the argument adequately named ignore because a button doesn't have a value. The body is call another function that could, for instance, store the two names in a database.&lt;br /&gt;
&lt;br /&gt;
To achieve this magic, Lift stores the closures in a map when the component is rendered. Randomly generated strings are used as keys and inserted in the generated HTML elements. When the form is submitted, Lift looks for the closures in the map based on the provided keys and executes them. Note how the first and last variables are captured by the three closures and, consequently, stored between the two request-response cycles.&lt;br /&gt;
&lt;br /&gt;
The advantage of this approach is that snippets can specify what happens when a specific button is pushed rather than having a controller parsing the submitted form and process the parameters extracted from the HTTP request. In essence, Lift allows you to specify server-side actions corresponding to user actions when the form is rendered rather than processing the results to figure out what actions the user performed during the next request. This reduces the need for magic constants used to map actions between the rendered view and controllers in other frameworks. In Rails, you might create a form with two buttons labeled 'Buy Now' and 'Buy Later' and then compare the submit parameter to 'Buy Now' and 'Buy Later' in the controller to determine the appropriate action. In Lift, this can be done with two different bindings in the render function.&amp;lt;ref name = closure&amp;gt;[http://stanford.wikia.com/wiki/Project_2:_Lift,_the_Scala_Web_framework Closures]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Lift Web Framework ==&lt;br /&gt;
&amp;lt;div class=&amp;quot;center&amp;quot;&amp;gt; [[File:LiftArchDiagram.jpg]] &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Components ===&lt;br /&gt;
#	LiftCore: This is the web processor of the framework which handles the following functions.&lt;br /&gt;
##	Request/Response&lt;br /&gt;
##	Rendering Pipeline&lt;br /&gt;
##	Invoking User Functions&lt;br /&gt;
#	LiftRules : Lift Configuration&lt;br /&gt;
#	LiftSession: Inherent Session State.&lt;br /&gt;
#	S: stateful context for request/response lifecycle.&lt;br /&gt;
#	SiteMap: contains web pages for the lift application.&lt;br /&gt;
#	SHtml: helper functions for XHtml.&lt;br /&gt;
#	Views: Views as XML content. Allows composing views from not only html files but other contexts too.&lt;br /&gt;
#	LiftResponse: Abstraction of response sent to the client.&lt;br /&gt;
#	Comet: allows sending asynchronous content to browser.&lt;br /&gt;
#	[http://en.wikipedia.org/wiki/Object-relational_mapping ORM]: A specialized library.&lt;br /&gt;
#	HTTP Auth: provides control over authentication model.&lt;br /&gt;
#	JS API: JavaScript abstraction layer.&amp;lt;ref name=explore&amp;gt;[http://exploring.liftweb.net/master/index-9.html Exploring Lift Framework]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Getting Started ==&lt;br /&gt;
&lt;br /&gt;
=== Set Up on Eclipse ===&lt;br /&gt;
&lt;br /&gt;
#	Download “Scala IDE for Eclipse” : http://scala-ide.org/&lt;br /&gt;
#	Install plugin in Eclipse from this update site : http://download.scala-ide.org/sdk/helium/e38/scala211/stable/site&lt;br /&gt;
#	Once the plugin is installed restart Eclipse&lt;br /&gt;
#	Install sbteclipse  by adding the following to projects/plugins.sbt in your Lift Project: &amp;lt;code&amp;gt; addSbtPlugin(&amp;quot;com.typesafe.sbteclipse&amp;quot; % &amp;quot;sbteclipse-plugin&amp;quot; % &amp;quot;2.5.0&amp;quot;) &amp;lt;/code&amp;gt;&amp;lt;ref name=sbt&amp;gt;[http://en.wikipedia.org/wiki/SBT_(software) SBT]&amp;lt;/ref&amp;gt;&lt;br /&gt;
#	You can then create Eclipse project files (.project and .classpath) by entering the following into the SBT prompt: &amp;lt;code&amp;gt; eclipse &amp;lt;/code&amp;gt;&amp;lt;ref name=cookbook&amp;gt;[http://cookbook.liftweb.net/ The Lift Cookbook]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Setup Video Tutorial : [http://www.youtube.com/watch?v=qRIiUUKA2Mw link] &lt;br /&gt;
&lt;br /&gt;
== Basic Web Application Structure ==&lt;br /&gt;
&lt;br /&gt;
=== Step 1: Making a SiteMap entry ===&lt;br /&gt;
&lt;br /&gt;
Every page on the site needs a SiteMap entry.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def sitemap(): SiteMap = SiteMap(&lt;br /&gt;
  Menu(&amp;quot;Home&amp;quot;) / &amp;quot;index&amp;quot;,&lt;br /&gt;
  Menu(&amp;quot;Second Page&amp;quot;) / &amp;quot;second&amp;quot;&lt;br /&gt;
)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Step 2: Creating the view ===&lt;br /&gt;
Create an HTML file that corresponds to the sitemap entry.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;meta content=&amp;quot;text/html; charset=UTF-8&amp;quot; http-equiv=&amp;quot;content-type&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;title&amp;gt;Home&amp;lt;/title&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;div id=&amp;quot;main&amp;quot; class=&amp;quot;lift:surround?with=default&amp;amp;at=content&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;div&amp;gt;&lt;br /&gt;
        Hi, I'm a page that contains the time:&lt;br /&gt;
        &amp;lt;span class=&amp;quot;lift:TimeNow&amp;quot;&amp;gt;??? some time&amp;lt;/span&amp;gt;.&lt;br /&gt;
      &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
      &amp;lt;div&amp;gt;&lt;br /&gt;
        And a button: &amp;lt;button class=&amp;quot;lift:ClickMe&amp;quot;&amp;gt;Click Me&amp;lt;/button&amp;gt;.&lt;br /&gt;
      &amp;lt;/div&amp;gt;&lt;br /&gt;
    &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Step 3 : Creating the Snippet ===&lt;br /&gt;
&lt;br /&gt;
A snippet can be thought of as a controller which has rules for transforming the section of your template.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
package code&lt;br /&gt;
package snippet&lt;br /&gt;
&lt;br /&gt;
import net.liftweb._&lt;br /&gt;
import util._&lt;br /&gt;
import Helpers._&lt;br /&gt;
&lt;br /&gt;
object TimeNow {&lt;br /&gt;
  def render = &amp;quot;* *&amp;quot; #&amp;gt; now.toString&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&amp;lt;ref name=simplylift&amp;gt;[http://simply.liftweb.net/ Simply Lift]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Advantages ==&lt;br /&gt;
# Binding server side state to users' sessions is incredibly powerful. Each user can have a living representation in the server that talks to other users' representations.&amp;lt;ref name=adv&amp;gt;[http://stanford.wikia.com/wiki/Project_2:_Lift,_the_Scala_Web_framework Lift Project]&amp;lt;/ref&amp;gt;&lt;br /&gt;
# Built-in Comet support possibly the best Comet support in web frameworks. Pushing data to the browser is as simple as calling partialUpdate or asking for a full re-rendering of the component. Updates of multiple components are automatically serialized in a unique connection.&lt;br /&gt;
# Long-live closures simplify form processing and can be used to create complex wizards.&lt;br /&gt;
# View-first approach helps with 'Lean Controller, Fat Model'.&lt;br /&gt;
# Server state machines support for models, including timeouts. For instance, we can use a machine to specify that after three days without confirmation, a new account has to be deleted. Consequently, there is no need for cron and script/runner type solutions in Rails. Instead of imperatively stating what maintenance operations to do; state what rules to enforce and it is automatically done when necessary.&lt;br /&gt;
&lt;br /&gt;
== Disadvantages ==&lt;br /&gt;
&lt;br /&gt;
# Moving state to the server comes with all disadvantages discussed in class. That being said, various remote actors libraries are currently being developed and would permit actors living in different JVMs (running possibly on different machines) to communicate between each others seamlessly. &amp;lt;ref name=adv&amp;gt;[http://stanford.wikia.com/wiki/Project_2:_Lift,_the_Scala_Web_framework Lift Project]&amp;lt;/ref&amp;gt;Furthermore, it is often possible to architect an application such that loosely coupled components can live on different machines -- it is definitely possible with the stock trading application we will present during our in-class presentation.&lt;br /&gt;
# Terrible API (i.e. badly chosen names, confusing domain model) and no documentation at all (the Scala documentation is OK, though).&lt;br /&gt;
# Despite the fact that the API is stabilizing (unfortunately?), most of the tutorials are outdated.&lt;br /&gt;
# Routing is a nightmare for no infrastructure is available. &lt;br /&gt;
# Despite the fact that we can't move logic from snippets to templates, it is possible to move XHTML from templates to snippets. It is not always clear where the view has to be. Is a snippet a controller or a dynamically generated view? Is there actually a difference between the two?&lt;br /&gt;
&lt;br /&gt;
== Get Started ==&lt;br /&gt;
&lt;br /&gt;
The Lift Cookbook is the best place to start with using the Lift Framework.&lt;br /&gt;
[http://cookbook.liftweb.net/ CookBook]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Framework Comparison ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! &lt;br /&gt;
! Lift&lt;br /&gt;
! Rails&lt;br /&gt;
! Play&lt;br /&gt;
|-&lt;br /&gt;
| Scaffolding&lt;br /&gt;
| No&lt;br /&gt;
| Yes&lt;br /&gt;
| Yes&lt;br /&gt;
|-&lt;br /&gt;
| Design Pattern&lt;br /&gt;
| MVVM&lt;br /&gt;
| MVC&lt;br /&gt;
| MVC&lt;br /&gt;
|-&lt;br /&gt;
| Programming language&lt;br /&gt;
| Scala&lt;br /&gt;
| Ruby&lt;br /&gt;
| Java&lt;br /&gt;
|-&lt;br /&gt;
| Template language&lt;br /&gt;
| HTML5&lt;br /&gt;
| ERB/HAML&lt;br /&gt;
| Groovy/Japid&lt;br /&gt;
|-&lt;br /&gt;
| Dynamic Typing&lt;br /&gt;
| No&lt;br /&gt;
| Yes&lt;br /&gt;
| No&lt;br /&gt;
|-&lt;br /&gt;
| Admin Generator&lt;br /&gt;
| Yes&lt;br /&gt;
| Yes&lt;br /&gt;
| No&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&amp;lt;references&amp;gt;&amp;lt;/references&amp;gt;&lt;/div&gt;</summary>
		<author><name>Aprasad3</name></author>
	</entry>
</feed>