<?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=Amohanr</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=Amohanr"/>
	<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=Special:Contributions/Amohanr"/>
	<updated>2026-05-17T03:46:27Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.41.0</generator>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015_M1503_EDTS&amp;diff=97126</id>
		<title>CSC/ECE 517 Spring 2015 M1503 EDTS</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015_M1503_EDTS&amp;diff=97126"/>
		<updated>2015-05-05T16:44:39Z</updated>

		<summary type="html">&lt;p&gt;Amohanr: /* Implementation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;font size=&amp;quot;5&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Extending Developer Tools for Servo&amp;lt;/b&amp;gt;&amp;lt;/font&amp;gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
=='''Introduction'''==&lt;br /&gt;
===Rust===&lt;br /&gt;
Rust is a general purpose, [http://en.wikipedia.org/wiki/Programming_paradigm#Multi-paradigm multi-paradigm], compiled programming language developed by [http://en.wikipedia.org/wiki/Mozilla Mozilla] Research. It is designed to be a &amp;quot;safe, concurrent, practical language&amp;quot;, supporting [http://en.wikipedia.org/wiki/Purely_functional pure-functional], [http://en.wikipedia.org/wiki/Actor_model concurrent-actor], [http://en.wikipedia.org/wiki/Procedural_programming imperative-procedural], and object-oriented styles.&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Rust_%28programming_language%29&amp;lt;/ref&amp;gt; Being a modern systems programming language focusing on safety and speed, it accomplishes these goals by being memory safe without using garbage collection.&amp;lt;ref&amp;gt;http://doc.rust-lang.org/nightly/intro.html&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Servo===&lt;br /&gt;
Servo is an experimental project to build a Web browser engine for a new generation of hardware: mobile devices, multi-core processors and high-performance GPUs. With Servo, we are rethinking the browser at every level of the technology stack — from input parsing to page layout to graphics rendering — to optimize for power efficiency and maximum parallelism.&lt;br /&gt;
Servo builds on top of Rust to provide a secure and reliable foundation. Memory safety at the core of the platform ensures a high degree of assurance in the browser’s trusted computing base. 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;
=='''Background'''==&lt;br /&gt;
===Remote Developer Tools===&lt;br /&gt;
&lt;br /&gt;
Firefox supports remote developer tools - ie. communicating with an arbitrary server that implements a protocol for exposing information about web content. You can use the [https://developer.mozilla.org/en-US/docs/Tools Firefox developer tools] on your desktop to debug Web sites and Web apps running in other browsers or runtimes. The other browser might be on the same device as the tools themselves or on a different device, such as a phone connected over USB.&lt;br /&gt;
&lt;br /&gt;
=='''Project Description'''==&lt;br /&gt;
Servo implements a very basic developer tools server that currently supports executing JS remotely and investigating the DOM tree in the document inspector. We want to expand these capabilities by completing previous work that enables remote logging from web content, and add new capabilities to log HTTP requests and responses to allow for easier debugging of network-related problems in Servo.&amp;lt;ref&amp;gt;https://github.com/servo/servo/wiki/More-developer-tools-student-project&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The initial step included changes for enabling remote logging from the [http://developer.mozilla.org/en-US/docs/Tools/Web_Console Web Console] using 'console.log'. This was completed as part of the OSS project (Pull request [http://github.com/servo/servo/pull/5229 here]).&lt;br /&gt;
&lt;br /&gt;
In continuation, the objective of the project is to add support for logging HTTP requests and responses in the Web Console.&lt;br /&gt;
&lt;br /&gt;
=='''Requirement Analysis'''==&lt;br /&gt;
&lt;br /&gt;
To configure Firefox for remote debugging, please follow the instructions on [http://developer.mozilla.org/en-US/docs/Tools/Remote_Debugging/Thunderbird Setting up Firefox]&lt;br /&gt;
&lt;br /&gt;
Alternatively, to just view the Web Console, follow instructions [http://developer.mozilla.org/en-US/docs/Tools/Web_Console here].&lt;br /&gt;
&lt;br /&gt;
As mentioned above, Firefox provides the ability to debug a web page running on a remote server with its Developer Tools. The Message Display pane of the Web Console displays various kinds of messages: &lt;br /&gt;
* HTTP requests&lt;br /&gt;
* JavaScript warnings and errors&lt;br /&gt;
* CSS warnings, errors, and reflow events&lt;br /&gt;
* Security warnings and errors&lt;br /&gt;
* console API calls&lt;br /&gt;
* Input/output messages&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The Message Display pane looks like this:&lt;br /&gt;
&lt;br /&gt;
[[File:web_console_display_pane.jpg]]&lt;br /&gt;
&lt;br /&gt;
Open the Web Console from the Developer menu (or Ctrl+Shift+K) from a version of Firefox with Developer Tools extensions. Navigate to any web page and observe messages on the Web Console (Console tab). You may have to check the Log option under &amp;quot;Net&amp;quot; (the first option in black).&lt;br /&gt;
The log is cleared on every redirection/reload of a page. To avoid this, you can select the &amp;quot;Enable Persistent Logs&amp;quot; option in Settings.&lt;br /&gt;
&lt;br /&gt;
HTTP Requests are logged with lines that looks like this on the Web Console:&lt;br /&gt;
&lt;br /&gt;
[[File:HTTP_console_log.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Clicking on the message brings up a new window that gives more details about the HTTP request and the response.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:network_action_window.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Versions of Firefox in use today use [http://en.wikipedia.org/wiki/Gecko_%28software%29 Gecko] as the browser engine. The Developer Edition of Firefox includes complete support for the latest [https://developer.mozilla.org/en-US/docs/Tools Firefox Developer Tools]&lt;br /&gt;
&lt;br /&gt;
Servo so far implements partial support for Developer Tools, which does not include the logging of HTTP requests as shown above. The goal of this project is to implement capability for logging HTTP requests and responses on the Web Console.&lt;br /&gt;
When we run Servo with our changes on a webpage with the --devtools argument, and connect from an instance of Firefox, we should be able to see the HTTP requests and responses from the server appear on the log in the Web Console.&lt;br /&gt;
&lt;br /&gt;
=='''Implementation'''==&lt;br /&gt;
The following is a rough list of changes that will be required in the code to enable logging of HTTP messages. It includes adding types for HTTP request and response messages to the enum that represents messages exchanged between Servo and the debugger client. An &amp;quot;actor&amp;quot; is created to store the information that will be sent in these messages.&lt;br /&gt;
*Add a NetworkEventMessage variant to the DevtoolsControlMsg enum  in devtools_traits/lib.rs, containing fields for the request id and the network event.&lt;br /&gt;
[[File:DevToolsControlMsg.png]]&lt;br /&gt;
**DevtoolsControlMsg is a template type for the messages exchanged between the developer tools server and the actor objects. The developer tools server runs in a loop in the run_server function in devtools/lib.rs (this will be referred to as the &amp;quot;main loop&amp;quot; in run_server). The run_server function takes as arguments a sender and receiver, that can send and receive respectively messages of type &amp;lt;DevtoolsControlMsg&amp;gt; &lt;br /&gt;
**A new variant NetworkEventMessage of DevtoolsControlMsg will be used for all network event messages that are sent to the developer tools server. These messages will notify the server of either an HTTP request or an HTTP response.&lt;br /&gt;
**NetworkEventMessage will have two fields - a String representing the unique id corresponding to a request-response pair, and an enum NetworkEvent that holds the information about the request or response.&lt;br /&gt;
**The HTTRequest variant of the NetworkEvent enum contains fields for the target url, the method, headers, and the request body. It uses the types that are present in the LoadData struct in components/net/resource_task.rs.&lt;br /&gt;
**The HTTPResponse variant of the DevtoolsControlMsg enum containing fields for the response headers, status, and body. It uses the same types that are present in the Metadata struct in components/net/resource_task.rs.&lt;br /&gt;
*Make the HTTP loader's load function take an optional Sender&amp;lt;DevtoolsControlMsg&amp;gt;. Use the cookies_chan argument as a model. Send HTTPRequest and HTTPResponse messages using this sender at the appropriate times.&lt;br /&gt;
**The HTTP loader's load function is present in components/net/http_loader.rs. This is the place in Servo from which HTTP requests are sent and responses are received. This means that the developer tools server, if it is running (i.e., Servo is run with the --devtools argument), needs to be notified of network events from this function.&lt;br /&gt;
**So the load function now needs a channel to send messages to the developer tools server (the run_server function). &lt;br /&gt;
**This is accomplished by adding an optional argument devtools_chan of type Sender&amp;lt;DevtoolsControlMsg&amp;gt; to the HTTP loader's factory. This is then passed to the load function, where it can be used to send messages to the devtools server.&lt;br /&gt;
**The devtools_chan parameter is passed to the HTTP loader's factory when a new resource task is created in components/net/resource_task.rs (new_resource_task)&lt;br /&gt;
**This devtools_chan is used to send messages of the type DevtoolsControlMsg::NetworkEventMessage from the load function.&lt;br /&gt;
**A message containing NetworkEvent::HttpRequest is sent with the information contained in the load_data struct of the load function. &lt;br /&gt;
**A new unique ID for this request is created using the uuid crate, and passed in the NetworkEventMessage. This ID is used whenever the devtools server is notified of further updates corresponding to this request or its response. A new ID is generated for every new request.&lt;br /&gt;
**A message containing NetworkEvent::HttpResponse is sent with the response information after the load function receives the HTTP response. The values in the fields of the HttpResponse enum come from the information contained in the metadata struct. This response is tagged with the same ID value that was generated for its request earlier.&lt;br /&gt;
*Create a NetworkEventActor actor in the devtools crate that stores the request and response information transmitted in the new messages. The String field in the NetworkEventMessage contains a unique ID that joins the HTTPRequest and HTTPResponse. Associate the unique IDs with the corresponding NetworkEventActor names via a hashtable.&lt;br /&gt;
[[File:NetworkEventActor.png]]&lt;br /&gt;
**A new NetworkEventActor that implements the Actor trait is added to components/devtools/actors/. The NetworkEventActor needs to implement the name() and handle_message(..) functions of the Actor trait. The NetworkEventActor stores information about the HTTP requests and responses.&lt;br /&gt;
**A new NetworkEventActor object is created for each network event that is a new HTTP request. The corresponding response and updates should use the same actor object, which makes it possible for the debugger client to send query messages to the actor for more information (headers, cookies, security info, etc). &lt;br /&gt;
**This is achieved by tracking the unique request_id of each new request when its actor object is created. The new NetworkEventActor object is assigned a name using the new_name function of the actor registry, which creates a name by appending a number to the &amp;quot;netevent&amp;quot; string that is passed to it. The (request_id, actor_name) pairs are tracked in a HashMap called actor_requests.&lt;br /&gt;
**When the devtools server is notified of new network event, the actor_requests hash table is first looked up with the request_id to see if an actor exists for the event. If it does, the name of the actor is retrieved from the table. Otherwise, a new NetworkEventActor is created.&lt;br /&gt;
*Send the networkEvent message when the HTTPRequest and HTTPResponse messages are received. Use the Firefox devtools code (onNetworkEvent) as a reference.&lt;br /&gt;
**When a NetworkEventMessage (HTTPRequest or HTTPResponse) is received, the NetworkEventActor corresponding to it is either created or located as described above. &lt;br /&gt;
**On an HTTPRequest, a networkEvent message is sent to each debugger client using the accepted_connections vector of TcpStream objects. The message is in JSON and contains the name of the NetworkEventActor associated with the event.&lt;br /&gt;
&amp;lt;pre&amp;gt;{&lt;br /&gt;
  &amp;quot;from&amp;quot;: &amp;quot;server1.conn0.consoleActor2&amp;quot;,&lt;br /&gt;
  &amp;quot;type&amp;quot;: &amp;quot;networkEvent&amp;quot;,&lt;br /&gt;
  &amp;quot;eventActor&amp;quot;: {&lt;br /&gt;
    &amp;quot;actor&amp;quot;: &amp;quot;server1.conn0.netEvent45&amp;quot;,&lt;br /&gt;
    &amp;quot;startedDateTime&amp;quot;: &amp;quot;2015-04-22T20:47:08.545Z&amp;quot;,&lt;br /&gt;
    &amp;quot;url&amp;quot;: &amp;quot;https://aus4.mozilla.org/update/3/Firefox/40.0a1/20150421152828/Darwin_x86_64-gcc3/en-US/default/Darwin%2013.4.0/default/default/update.xml?force=1&amp;quot;,&lt;br /&gt;
    &amp;quot;method&amp;quot;: &amp;quot;GET&amp;quot;,&lt;br /&gt;
    &amp;quot;isXHR&amp;quot;: true,&lt;br /&gt;
    &amp;quot;private&amp;quot;: false&lt;br /&gt;
  }&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
**Similarly, on an HTTPResponse, a networkEventUpdate message is sent to the debugger client(s). The name of the NetworkEventActor passed in this message should be the same as of the actor that was used for the request.&lt;br /&gt;
&amp;lt;pre&amp;gt;{&lt;br /&gt;
  &amp;quot;from&amp;quot;: &amp;quot;server1.conn0.netEvent45&amp;quot;,&lt;br /&gt;
  &amp;quot;type&amp;quot;: &amp;quot;networkEventUpdate&amp;quot;,&lt;br /&gt;
  &amp;quot;updateType&amp;quot;: &amp;quot;responseStart&amp;quot;,&lt;br /&gt;
  &amp;quot;response&amp;quot;: {&lt;br /&gt;
    &amp;quot;httpVersion&amp;quot;: &amp;quot;HTTP/1.1&amp;quot;,&lt;br /&gt;
    &amp;quot;remoteAddress&amp;quot;: &amp;quot;63.245.217.43&amp;quot;,&lt;br /&gt;
    &amp;quot;remotePort&amp;quot;: 443,&lt;br /&gt;
    &amp;quot;status&amp;quot;: &amp;quot;200&amp;quot;,&lt;br /&gt;
    &amp;quot;statusText&amp;quot;: &amp;quot;OK&amp;quot;,&lt;br /&gt;
    &amp;quot;headersSize&amp;quot;: 337,&lt;br /&gt;
    &amp;quot;discardResponseBody&amp;quot;: true&lt;br /&gt;
  }&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Implement the getRequestHeaders, getRequestCookies, getRequestPostData, getReponseHeaders, getReponseCookies, and getResponseContent messages for NetworkEventActor.&lt;br /&gt;
**Messages can be sent from the debugger clients to the developer tools server via the Actor object. &lt;br /&gt;
**Once the client knows the name of the NetworkEventActor that is associated with a request, it can query the devtools server for more information about the request/response by sending messages with the actor name in the &amp;quot;to&amp;quot; field. These messages will be directed to the actor object with that name registered in the actors registry (The network event actors are registered upon creation). &lt;br /&gt;
**The handle_message function in the NetworkEventActor will handle messages that are sent to the actor object from the debugger client. It contains a parameter stream of type TcpStream that can be used to send JSON messages in reply.&lt;br /&gt;
**The handle_message function should return the appropriate response using the information stored in the fields of the NetworkEventActor. The struct contains private fields of type struct HttpRequest and struct HttpResponse that are populated at the time when requests and responses are received by the main loop in run_server.&lt;br /&gt;
&lt;br /&gt;
Sample query message from the client:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
DBG-SERVER: Received packet 304: {&lt;br /&gt;
  &amp;quot;to&amp;quot;: &amp;quot;server1.conn1.child1/netEvent42&amp;quot;,&lt;br /&gt;
  &amp;quot;type&amp;quot;: &amp;quot;getRequestHeaders&amp;quot;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Sample response from the actor (truncated):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
DBG-SERVER: Received packet 305: {&lt;br /&gt;
  &amp;quot;from&amp;quot;: &amp;quot;server1.conn1.child1/netEvent42&amp;quot;,&lt;br /&gt;
  &amp;quot;headers&amp;quot;: [&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;name&amp;quot;: &amp;quot;Host&amp;quot;,&lt;br /&gt;
      &amp;quot;value&amp;quot;: &amp;quot;sendto.mozilla.org&amp;quot;&lt;br /&gt;
    },&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;name&amp;quot;: &amp;quot;User-Agent&amp;quot;,&lt;br /&gt;
      &amp;quot;value&amp;quot;: &amp;quot;Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:40.0) Gecko/20100101 Firefox/40.0&amp;quot;&lt;br /&gt;
    },&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;name&amp;quot;: &amp;quot;Accept&amp;quot;,&lt;br /&gt;
      &amp;quot;value&amp;quot;: &amp;quot;image/png,image/*;q=0.8,*/*;q=0.5&amp;quot;&lt;br /&gt;
    },&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;name&amp;quot;: &amp;quot;Accept-Language&amp;quot;,&lt;br /&gt;
      &amp;quot;value&amp;quot;: &amp;quot;en-US,en;q=0.5&amp;quot;&lt;br /&gt;
    },&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Architecture'''==&lt;br /&gt;
The conceptual architecture of Mozilla Firefox running Gecko is represented in the following figure. This is from Grosskurth and Godfrey, A Reference Architecture for Web Browsers &amp;lt;ref&amp;gt;http://grosskurth.ca/papers/browser-refarch.pdf&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:mozilla_arch.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Component Diagrams===&lt;br /&gt;
Servo is designed to be highly parallel, with many components (rendering, layout, HTML parsing, image decoding, etc.) handled by fine-grained, isolated tasks. &lt;br /&gt;
&lt;br /&gt;
The following figures represent the browser architecture with all these components, and the Servo architecture &amp;lt;ref&amp;gt;http://www.joshmatthews.net/fosdemservo/&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Browser:&lt;br /&gt;
&lt;br /&gt;
[[File:browser_arch.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Servo Architecture:&lt;br /&gt;
&lt;br /&gt;
[[File:servo_arch.jpg]]&lt;br /&gt;
&lt;br /&gt;
=='''Design'''==&lt;br /&gt;
===enum in Rust===&lt;br /&gt;
Enums are datatypes with several alternate representations. A simple enum defines one or more constants with the same data type. In Rust, an enum can have complex variants though, like a struct. For example, consider an enum 'Shape' with variants 'Circle' and 'Triangle' each of which is a struct.&lt;br /&gt;
&lt;br /&gt;
    enum Shape {&lt;br /&gt;
        Circle { center: Point, radius: f64 },&lt;br /&gt;
        Triangle{ vert1: Point, vert2: Point, vert3: Point }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
A variable of type Shape can be resolved to its appropriate variant by using a 'match'.&lt;br /&gt;
&lt;br /&gt;
    fn area(sh: Shape) -&amp;gt; f64 {&lt;br /&gt;
        match sh {&lt;br /&gt;
            Circle(_, size) =&amp;gt; f64::consts::PI * size * size,&lt;br /&gt;
            Rectangle(Point { x, y }, Point { x: x2, y: y2 }) =&amp;gt; (x2 - x) * (y2 - y)&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
The Servo Developers Tools project has a 'DevtoolsControlMsg' enum which is used to instruct the devtools server to update its known actors/state according to changes in the browser. The current project requires the addition of two new variants to the 'DevtoolsControlMsg' enum, namely 'HTTRequest' and 'HTTResponse'.&lt;br /&gt;
&lt;br /&gt;
===Sender and Receiver===&lt;br /&gt;
&lt;br /&gt;
In Rust, a pipe is used for communication between tasks. A pipe is simply a pair of endpoints: one for sending messages and another for receiving messages(Sender and Receiver). The simplest way to create a pipe is to use the channel function to create a (Sender, Receiver) pair. In Rust parlance, a sender is a sending endpoint of a pipe, and a receiver is the receiving endpoint. A simple channel can be created as follows:&lt;br /&gt;
    let (tx, rx) = channel();&lt;br /&gt;
    spawn(proc() {&lt;br /&gt;
        tx.send(10i);&lt;br /&gt;
    });&lt;br /&gt;
    assert_eq!(rx.recv(), 10i);&lt;br /&gt;
&lt;br /&gt;
The sending half of the asynchronous channel type is Struct [https://doc.rust-lang.org/std/sync/mpsc/struct.Sender.html Sender&amp;lt;T&amp;gt;] and the receiving half is the struct [https://doc.rust-lang.org/std/sync/mpsc/struct.Receiver.html Receiver&amp;lt;T&amp;gt;].&lt;br /&gt;
For the purpose of this project, we will be using the channel to send and receive messages. To log the HTTP requests and responses on the console, we can use a variant of the enum 'DevtoolsControlMsg'. This enum is used to send messages to the devtools server to update its actors/state according to changes in the browser. We now add HTTPRequest and HHTPResponse variant to the DevtoolsControlMsg enum. We can now use the HTTP loaders' load function to send the HTTPRequest and HHTPResponse to the main loop in the run_server, where it can be received using a receiver. This is done by adding an argument, Sender&amp;lt;DevtoolsControlMsg&amp;gt; to the load function.&lt;br /&gt;
&lt;br /&gt;
=='''Design Patterns'''==&lt;br /&gt;
===Actor Model===&lt;br /&gt;
The actor model&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Actor_model&amp;lt;/ref&amp;gt; in computer science is a mathematical model of concurrent computation that treats &amp;quot;actors&amp;quot; as the universal primitives of concurrent computation: in response to a message that it receives, an actor can make local decisions, create more actors, send more messages, and determine how to respond to the next message received.&lt;br /&gt;
&lt;br /&gt;
The Actor model adopts the philosophy that everything is an actor. This is similar to the everything is an object philosophy used by some object-oriented programming languages, but differs in that object-oriented software is typically executed sequentially, while the Actor model is inherently concurrent.&lt;br /&gt;
&lt;br /&gt;
An actor is a computational entity that, in response to a message it receives, can concurrently:&lt;br /&gt;
*send a finite number of messages to other actors;&lt;br /&gt;
*create a finite number of new actors;&lt;br /&gt;
*designate the behavior to be used for the next message it receives.&lt;br /&gt;
 &lt;br /&gt;
Servo uses an actor-based devtools server implementation. There are different types of actor objects created to handle different messages. The developer tools server creates a ConsoleActor that is a part of every TabActor. The ConsoleActor is responsible for handling console events and sending messages of type ConsoleMsg to the debugger clients. As part of the initial steps of this project, we extended existing work that made console.log messages appear on the Web Console.&lt;br /&gt;
&lt;br /&gt;
For the logging of Http requests and responses, a new NetworkEventActor that implements the Actor trait is added. This actor sends messages to, and listens for messages from, the debugger clients. We use the NetworkEventActor to store the request and response information that is to be transmitted in these messages. A unique id is used to keep track of a request and its corresponding response (as described in the Implementation section). In the event that a client wants more information about a request/response, it can query the server using this unique id. Following is a code snippet showing the structure of the actor and its fields.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
struct HttpRequest {&lt;br /&gt;
    url: String,&lt;br /&gt;
    method: Method,&lt;br /&gt;
    headers: Headers,&lt;br /&gt;
    body: Option&amp;lt;Vec&amp;lt;u8&amp;gt;&amp;gt;,&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
struct HttpResponse {&lt;br /&gt;
    headers: Option&amp;lt;Headers&amp;gt;,&lt;br /&gt;
    status: Option&amp;lt;RawStatus&amp;gt;,&lt;br /&gt;
    body: Option&amp;lt;Vec&amp;lt;u8&amp;gt;&amp;gt;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
pub struct NetworkEventActor {&lt;br /&gt;
    pub name: String,&lt;br /&gt;
    request: HttpRequest,&lt;br /&gt;
    response: HttpResponse,&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Examples of messages sent from and handled by the NetworkEventActor are shown in the Implementation section. Some other sample JSON messages sent from Servo to the debugger clients can be found on [https://github.com/servo/servo/wiki/More-developer-tools-student-project this page]&lt;br /&gt;
&lt;br /&gt;
=='''UML Diagrams'''==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The diagrams are an approximation of UML, that are drawn by treating the 'struct's in Rust as classes.&lt;br /&gt;
&lt;br /&gt;
==='''Class Diagram'''===&lt;br /&gt;
Traits can be used in a manner similar to interfaces in a language like C++ or Java.&lt;br /&gt;
&lt;br /&gt;
[[File:Class_diagram1.png‎]]&lt;br /&gt;
&lt;br /&gt;
===='''Sequence Diagram'''====&lt;br /&gt;
&lt;br /&gt;
[[File:uml_seq1.jpg]]&lt;br /&gt;
&lt;br /&gt;
=='''Proposed Test Cases'''==&lt;br /&gt;
===='''Testing the feature'''====&lt;br /&gt;
The feature added will be tested using the following steps:&lt;br /&gt;
* Build Servo successfully with the changes (./mach build)&lt;br /&gt;
* Run Servo on a web page with the --devtools argument specifying a port number, say 6000 (./mach run [url] --devtools 6000)&lt;br /&gt;
* Open an instance of a recent version Firefox configured with Remote Debugging enabled.&lt;br /&gt;
* Connect to Servo running the web page on port 6000.&lt;br /&gt;
* Enable persistent logs in Settings. Select logging of Net messages from the Console.&lt;br /&gt;
* Navigate to another url from the webpage running Servo.&lt;br /&gt;
* The HTTP request and response messages should be logged on the Console.&lt;br /&gt;
&lt;br /&gt;
===='''Regression Testing'''====&lt;br /&gt;
We want to ensure that everything is in order after we have completed our changes; more importantly, that we have not broken any existing functionality. Mozilla has an automated workflow in place for running tests on pull requests submitted to Servo. Servo has a test suite which runs on every reviewed pull request, via [https://github.com/bors-servo bors-servo] and the buildbot.&lt;br /&gt;
&lt;br /&gt;
After it sees an approval on a reviewed pull requests, bors-servo automatically merges the changes&lt;br /&gt;
&lt;br /&gt;
[[File:bors-servo-merge.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
It starts off running a suite of regression tests, and any failure is reported. It can be issued a retry command once the fixes are in place.&lt;br /&gt;
&lt;br /&gt;
[[File:bors-servo-fail.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
When all tests pass, the changes are successfully merged into master. The following is the set of tests that will be run after the pull request is reviewed:&lt;br /&gt;
&lt;br /&gt;
[[File:bors-servo-success.jpg]]&lt;br /&gt;
&lt;br /&gt;
===='''Unit Tests'''====&lt;br /&gt;
The unit tests can be run using the command:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
./mach test-unit&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Since the code changes involve changing the parameters needed by existing functions new_resource_task(..) and LoadData::new(..), some of the unit tests that used these functions need to be fixed.&lt;br /&gt;
&lt;br /&gt;
=='''Reference'''==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Amohanr</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015_M1503_EDTS&amp;diff=97125</id>
		<title>CSC/ECE 517 Spring 2015 M1503 EDTS</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015_M1503_EDTS&amp;diff=97125"/>
		<updated>2015-05-05T16:43:47Z</updated>

		<summary type="html">&lt;p&gt;Amohanr: /* Implementation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;font size=&amp;quot;5&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Extending Developer Tools for Servo&amp;lt;/b&amp;gt;&amp;lt;/font&amp;gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
=='''Introduction'''==&lt;br /&gt;
===Rust===&lt;br /&gt;
Rust is a general purpose, [http://en.wikipedia.org/wiki/Programming_paradigm#Multi-paradigm multi-paradigm], compiled programming language developed by [http://en.wikipedia.org/wiki/Mozilla Mozilla] Research. It is designed to be a &amp;quot;safe, concurrent, practical language&amp;quot;, supporting [http://en.wikipedia.org/wiki/Purely_functional pure-functional], [http://en.wikipedia.org/wiki/Actor_model concurrent-actor], [http://en.wikipedia.org/wiki/Procedural_programming imperative-procedural], and object-oriented styles.&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Rust_%28programming_language%29&amp;lt;/ref&amp;gt; Being a modern systems programming language focusing on safety and speed, it accomplishes these goals by being memory safe without using garbage collection.&amp;lt;ref&amp;gt;http://doc.rust-lang.org/nightly/intro.html&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Servo===&lt;br /&gt;
Servo is an experimental project to build a Web browser engine for a new generation of hardware: mobile devices, multi-core processors and high-performance GPUs. With Servo, we are rethinking the browser at every level of the technology stack — from input parsing to page layout to graphics rendering — to optimize for power efficiency and maximum parallelism.&lt;br /&gt;
Servo builds on top of Rust to provide a secure and reliable foundation. Memory safety at the core of the platform ensures a high degree of assurance in the browser’s trusted computing base. 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;
=='''Background'''==&lt;br /&gt;
===Remote Developer Tools===&lt;br /&gt;
&lt;br /&gt;
Firefox supports remote developer tools - ie. communicating with an arbitrary server that implements a protocol for exposing information about web content. You can use the [https://developer.mozilla.org/en-US/docs/Tools Firefox developer tools] on your desktop to debug Web sites and Web apps running in other browsers or runtimes. The other browser might be on the same device as the tools themselves or on a different device, such as a phone connected over USB.&lt;br /&gt;
&lt;br /&gt;
=='''Project Description'''==&lt;br /&gt;
Servo implements a very basic developer tools server that currently supports executing JS remotely and investigating the DOM tree in the document inspector. We want to expand these capabilities by completing previous work that enables remote logging from web content, and add new capabilities to log HTTP requests and responses to allow for easier debugging of network-related problems in Servo.&amp;lt;ref&amp;gt;https://github.com/servo/servo/wiki/More-developer-tools-student-project&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The initial step included changes for enabling remote logging from the [http://developer.mozilla.org/en-US/docs/Tools/Web_Console Web Console] using 'console.log'. This was completed as part of the OSS project (Pull request [http://github.com/servo/servo/pull/5229 here]).&lt;br /&gt;
&lt;br /&gt;
In continuation, the objective of the project is to add support for logging HTTP requests and responses in the Web Console.&lt;br /&gt;
&lt;br /&gt;
=='''Requirement Analysis'''==&lt;br /&gt;
&lt;br /&gt;
To configure Firefox for remote debugging, please follow the instructions on [http://developer.mozilla.org/en-US/docs/Tools/Remote_Debugging/Thunderbird Setting up Firefox]&lt;br /&gt;
&lt;br /&gt;
Alternatively, to just view the Web Console, follow instructions [http://developer.mozilla.org/en-US/docs/Tools/Web_Console here].&lt;br /&gt;
&lt;br /&gt;
As mentioned above, Firefox provides the ability to debug a web page running on a remote server with its Developer Tools. The Message Display pane of the Web Console displays various kinds of messages: &lt;br /&gt;
* HTTP requests&lt;br /&gt;
* JavaScript warnings and errors&lt;br /&gt;
* CSS warnings, errors, and reflow events&lt;br /&gt;
* Security warnings and errors&lt;br /&gt;
* console API calls&lt;br /&gt;
* Input/output messages&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The Message Display pane looks like this:&lt;br /&gt;
&lt;br /&gt;
[[File:web_console_display_pane.jpg]]&lt;br /&gt;
&lt;br /&gt;
Open the Web Console from the Developer menu (or Ctrl+Shift+K) from a version of Firefox with Developer Tools extensions. Navigate to any web page and observe messages on the Web Console (Console tab). You may have to check the Log option under &amp;quot;Net&amp;quot; (the first option in black).&lt;br /&gt;
The log is cleared on every redirection/reload of a page. To avoid this, you can select the &amp;quot;Enable Persistent Logs&amp;quot; option in Settings.&lt;br /&gt;
&lt;br /&gt;
HTTP Requests are logged with lines that looks like this on the Web Console:&lt;br /&gt;
&lt;br /&gt;
[[File:HTTP_console_log.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Clicking on the message brings up a new window that gives more details about the HTTP request and the response.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:network_action_window.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Versions of Firefox in use today use [http://en.wikipedia.org/wiki/Gecko_%28software%29 Gecko] as the browser engine. The Developer Edition of Firefox includes complete support for the latest [https://developer.mozilla.org/en-US/docs/Tools Firefox Developer Tools]&lt;br /&gt;
&lt;br /&gt;
Servo so far implements partial support for Developer Tools, which does not include the logging of HTTP requests as shown above. The goal of this project is to implement capability for logging HTTP requests and responses on the Web Console.&lt;br /&gt;
When we run Servo with our changes on a webpage with the --devtools argument, and connect from an instance of Firefox, we should be able to see the HTTP requests and responses from the server appear on the log in the Web Console.&lt;br /&gt;
&lt;br /&gt;
=='''Implementation'''==&lt;br /&gt;
The following is a rough list of changes that will be required in the code to enable logging of HTTP messages. It includes adding types for HTTP request and response messages to the enum that represents messages exchanged between Servo and the debugger client. An &amp;quot;actor&amp;quot; is created to store the information that will be sent in these messages.&lt;br /&gt;
*Add a NetworkEventMessage variant to the DevtoolsControlMsg enum  in devtools_traits/lib.rs, containing fields for the request id and the network event.&lt;br /&gt;
[[File:DevtoolsControlMsg.png]]&lt;br /&gt;
**DevtoolsControlMsg is a template type for the messages exchanged between the developer tools server and the actor objects. The developer tools server runs in a loop in the run_server function in devtools/lib.rs (this will be referred to as the &amp;quot;main loop&amp;quot; in run_server). The run_server function takes as arguments a sender and receiver, that can send and receive respectively messages of type &amp;lt;DevtoolsControlMsg&amp;gt; &lt;br /&gt;
**A new variant NetworkEventMessage of DevtoolsControlMsg will be used for all network event messages that are sent to the developer tools server. These messages will notify the server of either an HTTP request or an HTTP response.&lt;br /&gt;
**NetworkEventMessage will have two fields - a String representing the unique id corresponding to a request-response pair, and an enum NetworkEvent that holds the information about the request or response.&lt;br /&gt;
**The HTTRequest variant of the NetworkEvent enum contains fields for the target url, the method, headers, and the request body. It uses the types that are present in the LoadData struct in components/net/resource_task.rs.&lt;br /&gt;
**The HTTPResponse variant of the DevtoolsControlMsg enum containing fields for the response headers, status, and body. It uses the same types that are present in the Metadata struct in components/net/resource_task.rs.&lt;br /&gt;
*Make the HTTP loader's load function take an optional Sender&amp;lt;DevtoolsControlMsg&amp;gt;. Use the cookies_chan argument as a model. Send HTTPRequest and HTTPResponse messages using this sender at the appropriate times.&lt;br /&gt;
**The HTTP loader's load function is present in components/net/http_loader.rs. This is the place in Servo from which HTTP requests are sent and responses are received. This means that the developer tools server, if it is running (i.e., Servo is run with the --devtools argument), needs to be notified of network events from this function.&lt;br /&gt;
**So the load function now needs a channel to send messages to the developer tools server (the run_server function). &lt;br /&gt;
**This is accomplished by adding an optional argument devtools_chan of type Sender&amp;lt;DevtoolsControlMsg&amp;gt; to the HTTP loader's factory. This is then passed to the load function, where it can be used to send messages to the devtools server.&lt;br /&gt;
**The devtools_chan parameter is passed to the HTTP loader's factory when a new resource task is created in components/net/resource_task.rs (new_resource_task)&lt;br /&gt;
**This devtools_chan is used to send messages of the type DevtoolsControlMsg::NetworkEventMessage from the load function.&lt;br /&gt;
**A message containing NetworkEvent::HttpRequest is sent with the information contained in the load_data struct of the load function. &lt;br /&gt;
**A new unique ID for this request is created using the uuid crate, and passed in the NetworkEventMessage. This ID is used whenever the devtools server is notified of further updates corresponding to this request or its response. A new ID is generated for every new request.&lt;br /&gt;
**A message containing NetworkEvent::HttpResponse is sent with the response information after the load function receives the HTTP response. The values in the fields of the HttpResponse enum come from the information contained in the metadata struct. This response is tagged with the same ID value that was generated for its request earlier.&lt;br /&gt;
*Create a NetworkEventActor actor in the devtools crate that stores the request and response information transmitted in the new messages. The String field in the NetworkEventMessage contains a unique ID that joins the HTTPRequest and HTTPResponse. Associate the unique IDs with the corresponding NetworkEventActor names via a hashtable.&lt;br /&gt;
[[File:NetworkEventActor.png]]&lt;br /&gt;
**A new NetworkEventActor that implements the Actor trait is added to components/devtools/actors/. The NetworkEventActor needs to implement the name() and handle_message(..) functions of the Actor trait. The NetworkEventActor stores information about the HTTP requests and responses.&lt;br /&gt;
**A new NetworkEventActor object is created for each network event that is a new HTTP request. The corresponding response and updates should use the same actor object, which makes it possible for the debugger client to send query messages to the actor for more information (headers, cookies, security info, etc). &lt;br /&gt;
**This is achieved by tracking the unique request_id of each new request when its actor object is created. The new NetworkEventActor object is assigned a name using the new_name function of the actor registry, which creates a name by appending a number to the &amp;quot;netevent&amp;quot; string that is passed to it. The (request_id, actor_name) pairs are tracked in a HashMap called actor_requests.&lt;br /&gt;
**When the devtools server is notified of new network event, the actor_requests hash table is first looked up with the request_id to see if an actor exists for the event. If it does, the name of the actor is retrieved from the table. Otherwise, a new NetworkEventActor is created.&lt;br /&gt;
*Send the networkEvent message when the HTTPRequest and HTTPResponse messages are received. Use the Firefox devtools code (onNetworkEvent) as a reference.&lt;br /&gt;
**When a NetworkEventMessage (HTTPRequest or HTTPResponse) is received, the NetworkEventActor corresponding to it is either created or located as described above. &lt;br /&gt;
**On an HTTPRequest, a networkEvent message is sent to each debugger client using the accepted_connections vector of TcpStream objects. The message is in JSON and contains the name of the NetworkEventActor associated with the event.&lt;br /&gt;
&amp;lt;pre&amp;gt;{&lt;br /&gt;
  &amp;quot;from&amp;quot;: &amp;quot;server1.conn0.consoleActor2&amp;quot;,&lt;br /&gt;
  &amp;quot;type&amp;quot;: &amp;quot;networkEvent&amp;quot;,&lt;br /&gt;
  &amp;quot;eventActor&amp;quot;: {&lt;br /&gt;
    &amp;quot;actor&amp;quot;: &amp;quot;server1.conn0.netEvent45&amp;quot;,&lt;br /&gt;
    &amp;quot;startedDateTime&amp;quot;: &amp;quot;2015-04-22T20:47:08.545Z&amp;quot;,&lt;br /&gt;
    &amp;quot;url&amp;quot;: &amp;quot;https://aus4.mozilla.org/update/3/Firefox/40.0a1/20150421152828/Darwin_x86_64-gcc3/en-US/default/Darwin%2013.4.0/default/default/update.xml?force=1&amp;quot;,&lt;br /&gt;
    &amp;quot;method&amp;quot;: &amp;quot;GET&amp;quot;,&lt;br /&gt;
    &amp;quot;isXHR&amp;quot;: true,&lt;br /&gt;
    &amp;quot;private&amp;quot;: false&lt;br /&gt;
  }&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
**Similarly, on an HTTPResponse, a networkEventUpdate message is sent to the debugger client(s). The name of the NetworkEventActor passed in this message should be the same as of the actor that was used for the request.&lt;br /&gt;
&amp;lt;pre&amp;gt;{&lt;br /&gt;
  &amp;quot;from&amp;quot;: &amp;quot;server1.conn0.netEvent45&amp;quot;,&lt;br /&gt;
  &amp;quot;type&amp;quot;: &amp;quot;networkEventUpdate&amp;quot;,&lt;br /&gt;
  &amp;quot;updateType&amp;quot;: &amp;quot;responseStart&amp;quot;,&lt;br /&gt;
  &amp;quot;response&amp;quot;: {&lt;br /&gt;
    &amp;quot;httpVersion&amp;quot;: &amp;quot;HTTP/1.1&amp;quot;,&lt;br /&gt;
    &amp;quot;remoteAddress&amp;quot;: &amp;quot;63.245.217.43&amp;quot;,&lt;br /&gt;
    &amp;quot;remotePort&amp;quot;: 443,&lt;br /&gt;
    &amp;quot;status&amp;quot;: &amp;quot;200&amp;quot;,&lt;br /&gt;
    &amp;quot;statusText&amp;quot;: &amp;quot;OK&amp;quot;,&lt;br /&gt;
    &amp;quot;headersSize&amp;quot;: 337,&lt;br /&gt;
    &amp;quot;discardResponseBody&amp;quot;: true&lt;br /&gt;
  }&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Implement the getRequestHeaders, getRequestCookies, getRequestPostData, getReponseHeaders, getReponseCookies, and getResponseContent messages for NetworkEventActor.&lt;br /&gt;
**Messages can be sent from the debugger clients to the developer tools server via the Actor object. &lt;br /&gt;
**Once the client knows the name of the NetworkEventActor that is associated with a request, it can query the devtools server for more information about the request/response by sending messages with the actor name in the &amp;quot;to&amp;quot; field. These messages will be directed to the actor object with that name registered in the actors registry (The network event actors are registered upon creation). &lt;br /&gt;
**The handle_message function in the NetworkEventActor will handle messages that are sent to the actor object from the debugger client. It contains a parameter stream of type TcpStream that can be used to send JSON messages in reply.&lt;br /&gt;
**The handle_message function should return the appropriate response using the information stored in the fields of the NetworkEventActor. The struct contains private fields of type struct HttpRequest and struct HttpResponse that are populated at the time when requests and responses are received by the main loop in run_server.&lt;br /&gt;
&lt;br /&gt;
Sample query message from the client:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
DBG-SERVER: Received packet 304: {&lt;br /&gt;
  &amp;quot;to&amp;quot;: &amp;quot;server1.conn1.child1/netEvent42&amp;quot;,&lt;br /&gt;
  &amp;quot;type&amp;quot;: &amp;quot;getRequestHeaders&amp;quot;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Sample response from the actor (truncated):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
DBG-SERVER: Received packet 305: {&lt;br /&gt;
  &amp;quot;from&amp;quot;: &amp;quot;server1.conn1.child1/netEvent42&amp;quot;,&lt;br /&gt;
  &amp;quot;headers&amp;quot;: [&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;name&amp;quot;: &amp;quot;Host&amp;quot;,&lt;br /&gt;
      &amp;quot;value&amp;quot;: &amp;quot;sendto.mozilla.org&amp;quot;&lt;br /&gt;
    },&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;name&amp;quot;: &amp;quot;User-Agent&amp;quot;,&lt;br /&gt;
      &amp;quot;value&amp;quot;: &amp;quot;Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:40.0) Gecko/20100101 Firefox/40.0&amp;quot;&lt;br /&gt;
    },&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;name&amp;quot;: &amp;quot;Accept&amp;quot;,&lt;br /&gt;
      &amp;quot;value&amp;quot;: &amp;quot;image/png,image/*;q=0.8,*/*;q=0.5&amp;quot;&lt;br /&gt;
    },&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;name&amp;quot;: &amp;quot;Accept-Language&amp;quot;,&lt;br /&gt;
      &amp;quot;value&amp;quot;: &amp;quot;en-US,en;q=0.5&amp;quot;&lt;br /&gt;
    },&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Architecture'''==&lt;br /&gt;
The conceptual architecture of Mozilla Firefox running Gecko is represented in the following figure. This is from Grosskurth and Godfrey, A Reference Architecture for Web Browsers &amp;lt;ref&amp;gt;http://grosskurth.ca/papers/browser-refarch.pdf&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:mozilla_arch.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Component Diagrams===&lt;br /&gt;
Servo is designed to be highly parallel, with many components (rendering, layout, HTML parsing, image decoding, etc.) handled by fine-grained, isolated tasks. &lt;br /&gt;
&lt;br /&gt;
The following figures represent the browser architecture with all these components, and the Servo architecture &amp;lt;ref&amp;gt;http://www.joshmatthews.net/fosdemservo/&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Browser:&lt;br /&gt;
&lt;br /&gt;
[[File:browser_arch.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Servo Architecture:&lt;br /&gt;
&lt;br /&gt;
[[File:servo_arch.jpg]]&lt;br /&gt;
&lt;br /&gt;
=='''Design'''==&lt;br /&gt;
===enum in Rust===&lt;br /&gt;
Enums are datatypes with several alternate representations. A simple enum defines one or more constants with the same data type. In Rust, an enum can have complex variants though, like a struct. For example, consider an enum 'Shape' with variants 'Circle' and 'Triangle' each of which is a struct.&lt;br /&gt;
&lt;br /&gt;
    enum Shape {&lt;br /&gt;
        Circle { center: Point, radius: f64 },&lt;br /&gt;
        Triangle{ vert1: Point, vert2: Point, vert3: Point }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
A variable of type Shape can be resolved to its appropriate variant by using a 'match'.&lt;br /&gt;
&lt;br /&gt;
    fn area(sh: Shape) -&amp;gt; f64 {&lt;br /&gt;
        match sh {&lt;br /&gt;
            Circle(_, size) =&amp;gt; f64::consts::PI * size * size,&lt;br /&gt;
            Rectangle(Point { x, y }, Point { x: x2, y: y2 }) =&amp;gt; (x2 - x) * (y2 - y)&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
The Servo Developers Tools project has a 'DevtoolsControlMsg' enum which is used to instruct the devtools server to update its known actors/state according to changes in the browser. The current project requires the addition of two new variants to the 'DevtoolsControlMsg' enum, namely 'HTTRequest' and 'HTTResponse'.&lt;br /&gt;
&lt;br /&gt;
===Sender and Receiver===&lt;br /&gt;
&lt;br /&gt;
In Rust, a pipe is used for communication between tasks. A pipe is simply a pair of endpoints: one for sending messages and another for receiving messages(Sender and Receiver). The simplest way to create a pipe is to use the channel function to create a (Sender, Receiver) pair. In Rust parlance, a sender is a sending endpoint of a pipe, and a receiver is the receiving endpoint. A simple channel can be created as follows:&lt;br /&gt;
    let (tx, rx) = channel();&lt;br /&gt;
    spawn(proc() {&lt;br /&gt;
        tx.send(10i);&lt;br /&gt;
    });&lt;br /&gt;
    assert_eq!(rx.recv(), 10i);&lt;br /&gt;
&lt;br /&gt;
The sending half of the asynchronous channel type is Struct [https://doc.rust-lang.org/std/sync/mpsc/struct.Sender.html Sender&amp;lt;T&amp;gt;] and the receiving half is the struct [https://doc.rust-lang.org/std/sync/mpsc/struct.Receiver.html Receiver&amp;lt;T&amp;gt;].&lt;br /&gt;
For the purpose of this project, we will be using the channel to send and receive messages. To log the HTTP requests and responses on the console, we can use a variant of the enum 'DevtoolsControlMsg'. This enum is used to send messages to the devtools server to update its actors/state according to changes in the browser. We now add HTTPRequest and HHTPResponse variant to the DevtoolsControlMsg enum. We can now use the HTTP loaders' load function to send the HTTPRequest and HHTPResponse to the main loop in the run_server, where it can be received using a receiver. This is done by adding an argument, Sender&amp;lt;DevtoolsControlMsg&amp;gt; to the load function.&lt;br /&gt;
&lt;br /&gt;
=='''Design Patterns'''==&lt;br /&gt;
===Actor Model===&lt;br /&gt;
The actor model&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Actor_model&amp;lt;/ref&amp;gt; in computer science is a mathematical model of concurrent computation that treats &amp;quot;actors&amp;quot; as the universal primitives of concurrent computation: in response to a message that it receives, an actor can make local decisions, create more actors, send more messages, and determine how to respond to the next message received.&lt;br /&gt;
&lt;br /&gt;
The Actor model adopts the philosophy that everything is an actor. This is similar to the everything is an object philosophy used by some object-oriented programming languages, but differs in that object-oriented software is typically executed sequentially, while the Actor model is inherently concurrent.&lt;br /&gt;
&lt;br /&gt;
An actor is a computational entity that, in response to a message it receives, can concurrently:&lt;br /&gt;
*send a finite number of messages to other actors;&lt;br /&gt;
*create a finite number of new actors;&lt;br /&gt;
*designate the behavior to be used for the next message it receives.&lt;br /&gt;
 &lt;br /&gt;
Servo uses an actor-based devtools server implementation. There are different types of actor objects created to handle different messages. The developer tools server creates a ConsoleActor that is a part of every TabActor. The ConsoleActor is responsible for handling console events and sending messages of type ConsoleMsg to the debugger clients. As part of the initial steps of this project, we extended existing work that made console.log messages appear on the Web Console.&lt;br /&gt;
&lt;br /&gt;
For the logging of Http requests and responses, a new NetworkEventActor that implements the Actor trait is added. This actor sends messages to, and listens for messages from, the debugger clients. We use the NetworkEventActor to store the request and response information that is to be transmitted in these messages. A unique id is used to keep track of a request and its corresponding response (as described in the Implementation section). In the event that a client wants more information about a request/response, it can query the server using this unique id. Following is a code snippet showing the structure of the actor and its fields.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
struct HttpRequest {&lt;br /&gt;
    url: String,&lt;br /&gt;
    method: Method,&lt;br /&gt;
    headers: Headers,&lt;br /&gt;
    body: Option&amp;lt;Vec&amp;lt;u8&amp;gt;&amp;gt;,&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
struct HttpResponse {&lt;br /&gt;
    headers: Option&amp;lt;Headers&amp;gt;,&lt;br /&gt;
    status: Option&amp;lt;RawStatus&amp;gt;,&lt;br /&gt;
    body: Option&amp;lt;Vec&amp;lt;u8&amp;gt;&amp;gt;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
pub struct NetworkEventActor {&lt;br /&gt;
    pub name: String,&lt;br /&gt;
    request: HttpRequest,&lt;br /&gt;
    response: HttpResponse,&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Examples of messages sent from and handled by the NetworkEventActor are shown in the Implementation section. Some other sample JSON messages sent from Servo to the debugger clients can be found on [https://github.com/servo/servo/wiki/More-developer-tools-student-project this page]&lt;br /&gt;
&lt;br /&gt;
=='''UML Diagrams'''==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The diagrams are an approximation of UML, that are drawn by treating the 'struct's in Rust as classes.&lt;br /&gt;
&lt;br /&gt;
==='''Class Diagram'''===&lt;br /&gt;
Traits can be used in a manner similar to interfaces in a language like C++ or Java.&lt;br /&gt;
&lt;br /&gt;
[[File:Class_diagram1.png‎]]&lt;br /&gt;
&lt;br /&gt;
===='''Sequence Diagram'''====&lt;br /&gt;
&lt;br /&gt;
[[File:uml_seq1.jpg]]&lt;br /&gt;
&lt;br /&gt;
=='''Proposed Test Cases'''==&lt;br /&gt;
===='''Testing the feature'''====&lt;br /&gt;
The feature added will be tested using the following steps:&lt;br /&gt;
* Build Servo successfully with the changes (./mach build)&lt;br /&gt;
* Run Servo on a web page with the --devtools argument specifying a port number, say 6000 (./mach run [url] --devtools 6000)&lt;br /&gt;
* Open an instance of a recent version Firefox configured with Remote Debugging enabled.&lt;br /&gt;
* Connect to Servo running the web page on port 6000.&lt;br /&gt;
* Enable persistent logs in Settings. Select logging of Net messages from the Console.&lt;br /&gt;
* Navigate to another url from the webpage running Servo.&lt;br /&gt;
* The HTTP request and response messages should be logged on the Console.&lt;br /&gt;
&lt;br /&gt;
===='''Regression Testing'''====&lt;br /&gt;
We want to ensure that everything is in order after we have completed our changes; more importantly, that we have not broken any existing functionality. Mozilla has an automated workflow in place for running tests on pull requests submitted to Servo. Servo has a test suite which runs on every reviewed pull request, via [https://github.com/bors-servo bors-servo] and the buildbot.&lt;br /&gt;
&lt;br /&gt;
After it sees an approval on a reviewed pull requests, bors-servo automatically merges the changes&lt;br /&gt;
&lt;br /&gt;
[[File:bors-servo-merge.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
It starts off running a suite of regression tests, and any failure is reported. It can be issued a retry command once the fixes are in place.&lt;br /&gt;
&lt;br /&gt;
[[File:bors-servo-fail.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
When all tests pass, the changes are successfully merged into master. The following is the set of tests that will be run after the pull request is reviewed:&lt;br /&gt;
&lt;br /&gt;
[[File:bors-servo-success.jpg]]&lt;br /&gt;
&lt;br /&gt;
===='''Unit Tests'''====&lt;br /&gt;
The unit tests can be run using the command:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
./mach test-unit&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Since the code changes involve changing the parameters needed by existing functions new_resource_task(..) and LoadData::new(..), some of the unit tests that used these functions need to be fixed.&lt;br /&gt;
&lt;br /&gt;
=='''Reference'''==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Amohanr</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:NetworkEventActor.png&amp;diff=97124</id>
		<title>File:NetworkEventActor.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:NetworkEventActor.png&amp;diff=97124"/>
		<updated>2015-05-05T16:41:49Z</updated>

		<summary type="html">&lt;p&gt;Amohanr: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Amohanr</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:DevToolsControlMsg.png&amp;diff=97123</id>
		<title>File:DevToolsControlMsg.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:DevToolsControlMsg.png&amp;diff=97123"/>
		<updated>2015-05-05T16:38:14Z</updated>

		<summary type="html">&lt;p&gt;Amohanr: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Amohanr</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015_M1503_EDTS&amp;diff=97122</id>
		<title>CSC/ECE 517 Spring 2015 M1503 EDTS</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015_M1503_EDTS&amp;diff=97122"/>
		<updated>2015-05-05T16:29:16Z</updated>

		<summary type="html">&lt;p&gt;Amohanr: /* Actor Model */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;font size=&amp;quot;5&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Extending Developer Tools for Servo&amp;lt;/b&amp;gt;&amp;lt;/font&amp;gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
=='''Introduction'''==&lt;br /&gt;
===Rust===&lt;br /&gt;
Rust is a general purpose, [http://en.wikipedia.org/wiki/Programming_paradigm#Multi-paradigm multi-paradigm], compiled programming language developed by [http://en.wikipedia.org/wiki/Mozilla Mozilla] Research. It is designed to be a &amp;quot;safe, concurrent, practical language&amp;quot;, supporting [http://en.wikipedia.org/wiki/Purely_functional pure-functional], [http://en.wikipedia.org/wiki/Actor_model concurrent-actor], [http://en.wikipedia.org/wiki/Procedural_programming imperative-procedural], and object-oriented styles.&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Rust_%28programming_language%29&amp;lt;/ref&amp;gt; Being a modern systems programming language focusing on safety and speed, it accomplishes these goals by being memory safe without using garbage collection.&amp;lt;ref&amp;gt;http://doc.rust-lang.org/nightly/intro.html&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Servo===&lt;br /&gt;
Servo is an experimental project to build a Web browser engine for a new generation of hardware: mobile devices, multi-core processors and high-performance GPUs. With Servo, we are rethinking the browser at every level of the technology stack — from input parsing to page layout to graphics rendering — to optimize for power efficiency and maximum parallelism.&lt;br /&gt;
Servo builds on top of Rust to provide a secure and reliable foundation. Memory safety at the core of the platform ensures a high degree of assurance in the browser’s trusted computing base. 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;
=='''Background'''==&lt;br /&gt;
===Remote Developer Tools===&lt;br /&gt;
&lt;br /&gt;
Firefox supports remote developer tools - ie. communicating with an arbitrary server that implements a protocol for exposing information about web content. You can use the [https://developer.mozilla.org/en-US/docs/Tools Firefox developer tools] on your desktop to debug Web sites and Web apps running in other browsers or runtimes. The other browser might be on the same device as the tools themselves or on a different device, such as a phone connected over USB.&lt;br /&gt;
&lt;br /&gt;
=='''Project Description'''==&lt;br /&gt;
Servo implements a very basic developer tools server that currently supports executing JS remotely and investigating the DOM tree in the document inspector. We want to expand these capabilities by completing previous work that enables remote logging from web content, and add new capabilities to log HTTP requests and responses to allow for easier debugging of network-related problems in Servo.&amp;lt;ref&amp;gt;https://github.com/servo/servo/wiki/More-developer-tools-student-project&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The initial step included changes for enabling remote logging from the [http://developer.mozilla.org/en-US/docs/Tools/Web_Console Web Console] using 'console.log'. This was completed as part of the OSS project (Pull request [http://github.com/servo/servo/pull/5229 here]).&lt;br /&gt;
&lt;br /&gt;
In continuation, the objective of the project is to add support for logging HTTP requests and responses in the Web Console.&lt;br /&gt;
&lt;br /&gt;
=='''Requirement Analysis'''==&lt;br /&gt;
&lt;br /&gt;
To configure Firefox for remote debugging, please follow the instructions on [http://developer.mozilla.org/en-US/docs/Tools/Remote_Debugging/Thunderbird Setting up Firefox]&lt;br /&gt;
&lt;br /&gt;
Alternatively, to just view the Web Console, follow instructions [http://developer.mozilla.org/en-US/docs/Tools/Web_Console here].&lt;br /&gt;
&lt;br /&gt;
As mentioned above, Firefox provides the ability to debug a web page running on a remote server with its Developer Tools. The Message Display pane of the Web Console displays various kinds of messages: &lt;br /&gt;
* HTTP requests&lt;br /&gt;
* JavaScript warnings and errors&lt;br /&gt;
* CSS warnings, errors, and reflow events&lt;br /&gt;
* Security warnings and errors&lt;br /&gt;
* console API calls&lt;br /&gt;
* Input/output messages&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The Message Display pane looks like this:&lt;br /&gt;
&lt;br /&gt;
[[File:web_console_display_pane.jpg]]&lt;br /&gt;
&lt;br /&gt;
Open the Web Console from the Developer menu (or Ctrl+Shift+K) from a version of Firefox with Developer Tools extensions. Navigate to any web page and observe messages on the Web Console (Console tab). You may have to check the Log option under &amp;quot;Net&amp;quot; (the first option in black).&lt;br /&gt;
The log is cleared on every redirection/reload of a page. To avoid this, you can select the &amp;quot;Enable Persistent Logs&amp;quot; option in Settings.&lt;br /&gt;
&lt;br /&gt;
HTTP Requests are logged with lines that looks like this on the Web Console:&lt;br /&gt;
&lt;br /&gt;
[[File:HTTP_console_log.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Clicking on the message brings up a new window that gives more details about the HTTP request and the response.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:network_action_window.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Versions of Firefox in use today use [http://en.wikipedia.org/wiki/Gecko_%28software%29 Gecko] as the browser engine. The Developer Edition of Firefox includes complete support for the latest [https://developer.mozilla.org/en-US/docs/Tools Firefox Developer Tools]&lt;br /&gt;
&lt;br /&gt;
Servo so far implements partial support for Developer Tools, which does not include the logging of HTTP requests as shown above. The goal of this project is to implement capability for logging HTTP requests and responses on the Web Console.&lt;br /&gt;
When we run Servo with our changes on a webpage with the --devtools argument, and connect from an instance of Firefox, we should be able to see the HTTP requests and responses from the server appear on the log in the Web Console.&lt;br /&gt;
&lt;br /&gt;
=='''Implementation'''==&lt;br /&gt;
The following is a rough list of changes that will be required in the code to enable logging of HTTP messages. It includes adding types for HTTP request and response messages to the enum that represents messages exchanged between Servo and the debugger client. An &amp;quot;actor&amp;quot; is created to store the information that will be sent in these messages.&lt;br /&gt;
*Add a NetworkEventMessage variant to the DevtoolsControlMsg enum  in devtools_traits/lib.rs, containing fields for the request id and the network event.&lt;br /&gt;
**DevtoolsControlMsg is a template type for the messages exchanged between the developer tools server and the actor objects. The developer tools server runs in a loop in the run_server function in devtools/lib.rs (this will be referred to as the &amp;quot;main loop&amp;quot; in run_server). The run_server function takes as arguments a sender and receiver, that can send and receive respectively messages of type &amp;lt;DevtoolsControlMsg&amp;gt; &lt;br /&gt;
**A new variant NetworkEventMessage of DevtoolsControlMsg will be used for all network event messages that are sent to the developer tools server. These messages will notify the server of either an HTTP request or an HTTP response.&lt;br /&gt;
**NetworkEventMessage will have two fields - a String representing the unique id corresponding to a request-response pair, and an enum NetworkEvent that holds the information about the request or response.&lt;br /&gt;
**The HTTRequest variant of the NetworkEvent enum contains fields for the target url, the method, headers, and the request body. It uses the types that are present in the LoadData struct in components/net/resource_task.rs.&lt;br /&gt;
**The HTTPResponse variant of the DevtoolsControlMsg enum containing fields for the response headers, status, and body. It uses the same types that are present in the Metadata struct in components/net/resource_task.rs.&lt;br /&gt;
*Make the HTTP loader's load function take an optional Sender&amp;lt;DevtoolsControlMsg&amp;gt;. Use the cookies_chan argument as a model. Send HTTPRequest and HTTPResponse messages using this sender at the appropriate times.&lt;br /&gt;
**The HTTP loader's load function is present in components/net/http_loader.rs. This is the place in Servo from which HTTP requests are sent and responses are received. This means that the developer tools server, if it is running (i.e., Servo is run with the --devtools argument), needs to be notified of network events from this function.&lt;br /&gt;
**So the load function now needs a channel to send messages to the developer tools server (the run_server function). &lt;br /&gt;
**This is accomplished by adding an optional argument devtools_chan of type Sender&amp;lt;DevtoolsControlMsg&amp;gt; to the HTTP loader's factory. This is then passed to the load function, where it can be used to send messages to the devtools server.&lt;br /&gt;
**The devtools_chan parameter is passed to the HTTP loader's factory when a new resource task is created in components/net/resource_task.rs (new_resource_task)&lt;br /&gt;
**This devtools_chan is used to send messages of the type DevtoolsControlMsg::NetworkEventMessage from the load function.&lt;br /&gt;
**A message containing NetworkEvent::HttpRequest is sent with the information contained in the load_data struct of the load function. &lt;br /&gt;
**A new unique ID for this request is created using the uuid crate, and passed in the NetworkEventMessage. This ID is used whenever the devtools server is notified of further updates corresponding to this request or its response. A new ID is generated for every new request.&lt;br /&gt;
**A message containing NetworkEvent::HttpResponse is sent with the response information after the load function receives the HTTP response. The values in the fields of the HttpResponse enum come from the information contained in the metadata struct. This response is tagged with the same ID value that was generated for its request earlier.&lt;br /&gt;
*Create a NetworkEventActor actor in the devtools crate that stores the request and response information transmitted in the new messages. The String field in the NetworkEventMessage contains a unique ID that joins the HTTPRequest and HTTPResponse. Associate the unique IDs with the corresponding NetworkEventActor names via a hashtable.&lt;br /&gt;
**A new NetworkEventActor that implements the Actor trait is added to components/devtools/actors/. The NetworkEventActor needs to implement the name() and handle_message(..) functions of the Actor trait. The NetworkEventActor stores information about the HTTP requests and responses.&lt;br /&gt;
**A new NetworkEventActor object is created for each network event that is a new HTTP request. The corresponding response and updates should use the same actor object, which makes it possible for the debugger client to send query messages to the actor for more information (headers, cookies, security info, etc). &lt;br /&gt;
**This is achieved by tracking the unique request_id of each new request when its actor object is created. The new NetworkEventActor object is assigned a name using the new_name function of the actor registry, which creates a name by appending a number to the &amp;quot;netevent&amp;quot; string that is passed to it. The (request_id, actor_name) pairs are tracked in a HashMap called actor_requests.&lt;br /&gt;
**When the devtools server is notified of new network event, the actor_requests hash table is first looked up with the request_id to see if an actor exists for the event. If it does, the name of the actor is retrieved from the table. Otherwise, a new NetworkEventActor is created.&lt;br /&gt;
*Send the networkEvent message when the HTTPRequest and HTTPResponse messages are received. Use the Firefox devtools code (onNetworkEvent) as a reference.&lt;br /&gt;
**When a NetworkEventMessage (HTTPRequest or HTTPResponse) is received, the NetworkEventActor corresponding to it is either created or located as described above. &lt;br /&gt;
**On an HTTPRequest, a networkEvent message is sent to each debugger client using the accepted_connections vector of TcpStream objects. The message is in JSON and contains the name of the NetworkEventActor associated with the event.&lt;br /&gt;
&amp;lt;pre&amp;gt;{&lt;br /&gt;
  &amp;quot;from&amp;quot;: &amp;quot;server1.conn0.consoleActor2&amp;quot;,&lt;br /&gt;
  &amp;quot;type&amp;quot;: &amp;quot;networkEvent&amp;quot;,&lt;br /&gt;
  &amp;quot;eventActor&amp;quot;: {&lt;br /&gt;
    &amp;quot;actor&amp;quot;: &amp;quot;server1.conn0.netEvent45&amp;quot;,&lt;br /&gt;
    &amp;quot;startedDateTime&amp;quot;: &amp;quot;2015-04-22T20:47:08.545Z&amp;quot;,&lt;br /&gt;
    &amp;quot;url&amp;quot;: &amp;quot;https://aus4.mozilla.org/update/3/Firefox/40.0a1/20150421152828/Darwin_x86_64-gcc3/en-US/default/Darwin%2013.4.0/default/default/update.xml?force=1&amp;quot;,&lt;br /&gt;
    &amp;quot;method&amp;quot;: &amp;quot;GET&amp;quot;,&lt;br /&gt;
    &amp;quot;isXHR&amp;quot;: true,&lt;br /&gt;
    &amp;quot;private&amp;quot;: false&lt;br /&gt;
  }&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
**Similarly, on an HTTPResponse, a networkEventUpdate message is sent to the debugger client(s). The name of the NetworkEventActor passed in this message should be the same as of the actor that was used for the request.&lt;br /&gt;
&amp;lt;pre&amp;gt;{&lt;br /&gt;
  &amp;quot;from&amp;quot;: &amp;quot;server1.conn0.netEvent45&amp;quot;,&lt;br /&gt;
  &amp;quot;type&amp;quot;: &amp;quot;networkEventUpdate&amp;quot;,&lt;br /&gt;
  &amp;quot;updateType&amp;quot;: &amp;quot;responseStart&amp;quot;,&lt;br /&gt;
  &amp;quot;response&amp;quot;: {&lt;br /&gt;
    &amp;quot;httpVersion&amp;quot;: &amp;quot;HTTP/1.1&amp;quot;,&lt;br /&gt;
    &amp;quot;remoteAddress&amp;quot;: &amp;quot;63.245.217.43&amp;quot;,&lt;br /&gt;
    &amp;quot;remotePort&amp;quot;: 443,&lt;br /&gt;
    &amp;quot;status&amp;quot;: &amp;quot;200&amp;quot;,&lt;br /&gt;
    &amp;quot;statusText&amp;quot;: &amp;quot;OK&amp;quot;,&lt;br /&gt;
    &amp;quot;headersSize&amp;quot;: 337,&lt;br /&gt;
    &amp;quot;discardResponseBody&amp;quot;: true&lt;br /&gt;
  }&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Implement the getRequestHeaders, getRequestCookies, getRequestPostData, getReponseHeaders, getReponseCookies, and getResponseContent messages for NetworkEventActor.&lt;br /&gt;
**Messages can be sent from the debugger clients to the developer tools server via the Actor object. &lt;br /&gt;
**Once the client knows the name of the NetworkEventActor that is associated with a request, it can query the devtools server for more information about the request/response by sending messages with the actor name in the &amp;quot;to&amp;quot; field. These messages will be directed to the actor object with that name registered in the actors registry (The network event actors are registered upon creation). &lt;br /&gt;
**The handle_message function in the NetworkEventActor will handle messages that are sent to the actor object from the debugger client. It contains a parameter stream of type TcpStream that can be used to send JSON messages in reply.&lt;br /&gt;
**The handle_message function should return the appropriate response using the information stored in the fields of the NetworkEventActor. The struct contains private fields of type struct HttpRequest and struct HttpResponse that are populated at the time when requests and responses are received by the main loop in run_server.&lt;br /&gt;
&lt;br /&gt;
Sample query message from the client:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
DBG-SERVER: Received packet 304: {&lt;br /&gt;
  &amp;quot;to&amp;quot;: &amp;quot;server1.conn1.child1/netEvent42&amp;quot;,&lt;br /&gt;
  &amp;quot;type&amp;quot;: &amp;quot;getRequestHeaders&amp;quot;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Sample response from the actor (truncated):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
DBG-SERVER: Received packet 305: {&lt;br /&gt;
  &amp;quot;from&amp;quot;: &amp;quot;server1.conn1.child1/netEvent42&amp;quot;,&lt;br /&gt;
  &amp;quot;headers&amp;quot;: [&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;name&amp;quot;: &amp;quot;Host&amp;quot;,&lt;br /&gt;
      &amp;quot;value&amp;quot;: &amp;quot;sendto.mozilla.org&amp;quot;&lt;br /&gt;
    },&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;name&amp;quot;: &amp;quot;User-Agent&amp;quot;,&lt;br /&gt;
      &amp;quot;value&amp;quot;: &amp;quot;Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:40.0) Gecko/20100101 Firefox/40.0&amp;quot;&lt;br /&gt;
    },&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;name&amp;quot;: &amp;quot;Accept&amp;quot;,&lt;br /&gt;
      &amp;quot;value&amp;quot;: &amp;quot;image/png,image/*;q=0.8,*/*;q=0.5&amp;quot;&lt;br /&gt;
    },&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;name&amp;quot;: &amp;quot;Accept-Language&amp;quot;,&lt;br /&gt;
      &amp;quot;value&amp;quot;: &amp;quot;en-US,en;q=0.5&amp;quot;&lt;br /&gt;
    },&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Architecture'''==&lt;br /&gt;
The conceptual architecture of Mozilla Firefox running Gecko is represented in the following figure. This is from Grosskurth and Godfrey, A Reference Architecture for Web Browsers &amp;lt;ref&amp;gt;http://grosskurth.ca/papers/browser-refarch.pdf&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:mozilla_arch.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Component Diagrams===&lt;br /&gt;
Servo is designed to be highly parallel, with many components (rendering, layout, HTML parsing, image decoding, etc.) handled by fine-grained, isolated tasks. &lt;br /&gt;
&lt;br /&gt;
The following figures represent the browser architecture with all these components, and the Servo architecture &amp;lt;ref&amp;gt;http://www.joshmatthews.net/fosdemservo/&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Browser:&lt;br /&gt;
&lt;br /&gt;
[[File:browser_arch.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Servo Architecture:&lt;br /&gt;
&lt;br /&gt;
[[File:servo_arch.jpg]]&lt;br /&gt;
&lt;br /&gt;
=='''Design'''==&lt;br /&gt;
===enum in Rust===&lt;br /&gt;
Enums are datatypes with several alternate representations. A simple enum defines one or more constants with the same data type. In Rust, an enum can have complex variants though, like a struct. For example, consider an enum 'Shape' with variants 'Circle' and 'Triangle' each of which is a struct.&lt;br /&gt;
&lt;br /&gt;
    enum Shape {&lt;br /&gt;
        Circle { center: Point, radius: f64 },&lt;br /&gt;
        Triangle{ vert1: Point, vert2: Point, vert3: Point }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
A variable of type Shape can be resolved to its appropriate variant by using a 'match'.&lt;br /&gt;
&lt;br /&gt;
    fn area(sh: Shape) -&amp;gt; f64 {&lt;br /&gt;
        match sh {&lt;br /&gt;
            Circle(_, size) =&amp;gt; f64::consts::PI * size * size,&lt;br /&gt;
            Rectangle(Point { x, y }, Point { x: x2, y: y2 }) =&amp;gt; (x2 - x) * (y2 - y)&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
The Servo Developers Tools project has a 'DevtoolsControlMsg' enum which is used to instruct the devtools server to update its known actors/state according to changes in the browser. The current project requires the addition of two new variants to the 'DevtoolsControlMsg' enum, namely 'HTTRequest' and 'HTTResponse'.&lt;br /&gt;
&lt;br /&gt;
===Sender and Receiver===&lt;br /&gt;
&lt;br /&gt;
In Rust, a pipe is used for communication between tasks. A pipe is simply a pair of endpoints: one for sending messages and another for receiving messages(Sender and Receiver). The simplest way to create a pipe is to use the channel function to create a (Sender, Receiver) pair. In Rust parlance, a sender is a sending endpoint of a pipe, and a receiver is the receiving endpoint. A simple channel can be created as follows:&lt;br /&gt;
    let (tx, rx) = channel();&lt;br /&gt;
    spawn(proc() {&lt;br /&gt;
        tx.send(10i);&lt;br /&gt;
    });&lt;br /&gt;
    assert_eq!(rx.recv(), 10i);&lt;br /&gt;
&lt;br /&gt;
The sending half of the asynchronous channel type is Struct [https://doc.rust-lang.org/std/sync/mpsc/struct.Sender.html Sender&amp;lt;T&amp;gt;] and the receiving half is the struct [https://doc.rust-lang.org/std/sync/mpsc/struct.Receiver.html Receiver&amp;lt;T&amp;gt;].&lt;br /&gt;
For the purpose of this project, we will be using the channel to send and receive messages. To log the HTTP requests and responses on the console, we can use a variant of the enum 'DevtoolsControlMsg'. This enum is used to send messages to the devtools server to update its actors/state according to changes in the browser. We now add HTTPRequest and HHTPResponse variant to the DevtoolsControlMsg enum. We can now use the HTTP loaders' load function to send the HTTPRequest and HHTPResponse to the main loop in the run_server, where it can be received using a receiver. This is done by adding an argument, Sender&amp;lt;DevtoolsControlMsg&amp;gt; to the load function.&lt;br /&gt;
&lt;br /&gt;
=='''Design Patterns'''==&lt;br /&gt;
===Actor Model===&lt;br /&gt;
The actor model&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Actor_model&amp;lt;/ref&amp;gt; in computer science is a mathematical model of concurrent computation that treats &amp;quot;actors&amp;quot; as the universal primitives of concurrent computation: in response to a message that it receives, an actor can make local decisions, create more actors, send more messages, and determine how to respond to the next message received.&lt;br /&gt;
&lt;br /&gt;
The Actor model adopts the philosophy that everything is an actor. This is similar to the everything is an object philosophy used by some object-oriented programming languages, but differs in that object-oriented software is typically executed sequentially, while the Actor model is inherently concurrent.&lt;br /&gt;
&lt;br /&gt;
An actor is a computational entity that, in response to a message it receives, can concurrently:&lt;br /&gt;
*send a finite number of messages to other actors;&lt;br /&gt;
*create a finite number of new actors;&lt;br /&gt;
*designate the behavior to be used for the next message it receives.&lt;br /&gt;
 &lt;br /&gt;
Servo uses an actor-based devtools server implementation. There are different types of actor objects created to handle different messages. The developer tools server creates a ConsoleActor that is a part of every TabActor. The ConsoleActor is responsible for handling console events and sending messages of type ConsoleMsg to the debugger clients. As part of the initial steps of this project, we extended existing work that made console.log messages appear on the Web Console.&lt;br /&gt;
&lt;br /&gt;
For the logging of Http requests and responses, a new NetworkEventActor that implements the Actor trait is added. This actor sends messages to, and listens for messages from, the debugger clients. We use the NetworkEventActor to store the request and response information that is to be transmitted in these messages. A unique id is used to keep track of a request and its corresponding response (as described in the Implementation section). In the event that a client wants more information about a request/response, it can query the server using this unique id. Following is a code snippet showing the structure of the actor and its fields.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
struct HttpRequest {&lt;br /&gt;
    url: String,&lt;br /&gt;
    method: Method,&lt;br /&gt;
    headers: Headers,&lt;br /&gt;
    body: Option&amp;lt;Vec&amp;lt;u8&amp;gt;&amp;gt;,&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
struct HttpResponse {&lt;br /&gt;
    headers: Option&amp;lt;Headers&amp;gt;,&lt;br /&gt;
    status: Option&amp;lt;RawStatus&amp;gt;,&lt;br /&gt;
    body: Option&amp;lt;Vec&amp;lt;u8&amp;gt;&amp;gt;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
pub struct NetworkEventActor {&lt;br /&gt;
    pub name: String,&lt;br /&gt;
    request: HttpRequest,&lt;br /&gt;
    response: HttpResponse,&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Examples of messages sent from and handled by the NetworkEventActor are shown in the Implementation section. Some other sample JSON messages sent from Servo to the debugger clients can be found on [https://github.com/servo/servo/wiki/More-developer-tools-student-project this page]&lt;br /&gt;
&lt;br /&gt;
=='''UML Diagrams'''==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The diagrams are an approximation of UML, that are drawn by treating the 'struct's in Rust as classes.&lt;br /&gt;
&lt;br /&gt;
==='''Class Diagram'''===&lt;br /&gt;
Traits can be used in a manner similar to interfaces in a language like C++ or Java.&lt;br /&gt;
&lt;br /&gt;
[[File:Class_diagram1.png‎]]&lt;br /&gt;
&lt;br /&gt;
===='''Sequence Diagram'''====&lt;br /&gt;
&lt;br /&gt;
[[File:uml_seq1.jpg]]&lt;br /&gt;
&lt;br /&gt;
=='''Proposed Test Cases'''==&lt;br /&gt;
===='''Testing the feature'''====&lt;br /&gt;
The feature added will be tested using the following steps:&lt;br /&gt;
* Build Servo successfully with the changes (./mach build)&lt;br /&gt;
* Run Servo on a web page with the --devtools argument specifying a port number, say 6000 (./mach run [url] --devtools 6000)&lt;br /&gt;
* Open an instance of a recent version Firefox configured with Remote Debugging enabled.&lt;br /&gt;
* Connect to Servo running the web page on port 6000.&lt;br /&gt;
* Enable persistent logs in Settings. Select logging of Net messages from the Console.&lt;br /&gt;
* Navigate to another url from the webpage running Servo.&lt;br /&gt;
* The HTTP request and response messages should be logged on the Console.&lt;br /&gt;
&lt;br /&gt;
===='''Regression Testing'''====&lt;br /&gt;
We want to ensure that everything is in order after we have completed our changes; more importantly, that we have not broken any existing functionality. Mozilla has an automated workflow in place for running tests on pull requests submitted to Servo. Servo has a test suite which runs on every reviewed pull request, via [https://github.com/bors-servo bors-servo] and the buildbot.&lt;br /&gt;
&lt;br /&gt;
After it sees an approval on a reviewed pull requests, bors-servo automatically merges the changes&lt;br /&gt;
&lt;br /&gt;
[[File:bors-servo-merge.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
It starts off running a suite of regression tests, and any failure is reported. It can be issued a retry command once the fixes are in place.&lt;br /&gt;
&lt;br /&gt;
[[File:bors-servo-fail.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
When all tests pass, the changes are successfully merged into master. The following is the set of tests that will be run after the pull request is reviewed:&lt;br /&gt;
&lt;br /&gt;
[[File:bors-servo-success.jpg]]&lt;br /&gt;
&lt;br /&gt;
===='''Unit Tests'''====&lt;br /&gt;
The unit tests can be run using the command:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
./mach test-unit&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Since the code changes involve changing the parameters needed by existing functions new_resource_task(..) and LoadData::new(..), some of the unit tests that used these functions need to be fixed.&lt;br /&gt;
&lt;br /&gt;
=='''Reference'''==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Amohanr</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015_M1503_EDTS&amp;diff=97103</id>
		<title>CSC/ECE 517 Spring 2015 M1503 EDTS</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015_M1503_EDTS&amp;diff=97103"/>
		<updated>2015-05-05T03:13:33Z</updated>

		<summary type="html">&lt;p&gt;Amohanr: /* UML Diagrams */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;font size=&amp;quot;5&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Extending Developer Tools for Servo&amp;lt;/b&amp;gt;&amp;lt;/font&amp;gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
=='''Introduction'''==&lt;br /&gt;
===Rust===&lt;br /&gt;
Rust is a general purpose, [http://en.wikipedia.org/wiki/Programming_paradigm#Multi-paradigm multi-paradigm], compiled programming language developed by [http://en.wikipedia.org/wiki/Mozilla Mozilla] Research. It is designed to be a &amp;quot;safe, concurrent, practical language&amp;quot;, supporting [http://en.wikipedia.org/wiki/Purely_functional pure-functional], [http://en.wikipedia.org/wiki/Actor_model concurrent-actor], [http://en.wikipedia.org/wiki/Procedural_programming imperative-procedural], and object-oriented styles.&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Rust_%28programming_language%29&amp;lt;/ref&amp;gt; Being a modern systems programming language focusing on safety and speed, it accomplishes these goals by being memory safe without using garbage collection.&amp;lt;ref&amp;gt;http://doc.rust-lang.org/nightly/intro.html&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Servo===&lt;br /&gt;
Servo is an experimental project to build a Web browser engine for a new generation of hardware: mobile devices, multi-core processors and high-performance GPUs. With Servo, we are rethinking the browser at every level of the technology stack — from input parsing to page layout to graphics rendering — to optimize for power efficiency and maximum parallelism.&lt;br /&gt;
Servo builds on top of Rust to provide a secure and reliable foundation. Memory safety at the core of the platform ensures a high degree of assurance in the browser’s trusted computing base. 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;
=='''Background'''==&lt;br /&gt;
===Remote Developer Tools===&lt;br /&gt;
&lt;br /&gt;
Firefox supports remote developer tools - ie. communicating with an arbitrary server that implements a protocol for exposing information about web content. You can use the [https://developer.mozilla.org/en-US/docs/Tools Firefox developer tools] on your desktop to debug Web sites and Web apps running in other browsers or runtimes. The other browser might be on the same device as the tools themselves or on a different device, such as a phone connected over USB.&lt;br /&gt;
&lt;br /&gt;
=='''Project Description'''==&lt;br /&gt;
Servo implements a very basic developer tools server that currently supports executing JS remotely and investigating the DOM tree in the document inspector. We want to expand these capabilities by completing previous work that enables remote logging from web content, and add new capabilities to log HTTP requests and responses to allow for easier debugging of network-related problems in Servo.&amp;lt;ref&amp;gt;https://github.com/servo/servo/wiki/More-developer-tools-student-project&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The initial step included changes for enabling remote logging from the [http://developer.mozilla.org/en-US/docs/Tools/Web_Console Web Console] using 'console.log'. This was completed as part of the OSS project (Pull request [http://github.com/servo/servo/pull/5229 here]).&lt;br /&gt;
&lt;br /&gt;
In continuation, the objective of the project is to add support for logging HTTP requests and responses in the Web Console.&lt;br /&gt;
&lt;br /&gt;
=='''Requirement Analysis'''==&lt;br /&gt;
&lt;br /&gt;
To configure Firefox for remote debugging, please follow the instructions on [http://developer.mozilla.org/en-US/docs/Tools/Remote_Debugging/Thunderbird Setting up Firefox]&lt;br /&gt;
&lt;br /&gt;
Alternatively, to just view the Web Console, follow instructions [http://developer.mozilla.org/en-US/docs/Tools/Web_Console here].&lt;br /&gt;
&lt;br /&gt;
As mentioned above, Firefox provides the ability to debug a web page running on a remote server with its Developer Tools. The Message Display pane of the Web Console displays various kinds of messages: &lt;br /&gt;
* HTTP requests&lt;br /&gt;
* JavaScript warnings and errors&lt;br /&gt;
* CSS warnings, errors, and reflow events&lt;br /&gt;
* Security warnings and errors&lt;br /&gt;
* console API calls&lt;br /&gt;
* Input/output messages&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The Message Display pane looks like this:&lt;br /&gt;
&lt;br /&gt;
[[File:web_console_display_pane.jpg]]&lt;br /&gt;
&lt;br /&gt;
Open the Web Console from the Developer menu (or Ctrl+Shift+K) from a version of Firefox with Developer Tools extensions. Navigate to any web page and observe messages on the Web Console (Console tab). You may have to check the Log option under &amp;quot;Net&amp;quot; (the first option in black).&lt;br /&gt;
The log is cleared on every redirection/reload of a page. To avoid this, you can select the &amp;quot;Enable Persistent Logs&amp;quot; option in Settings.&lt;br /&gt;
&lt;br /&gt;
HTTP Requests are logged with lines that looks like this on the Web Console:&lt;br /&gt;
&lt;br /&gt;
[[File:HTTP_console_log.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Clicking on the message brings up a new window that gives more details about the HTTP request and the response.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:network_action_window.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Versions of Firefox in use today use [http://en.wikipedia.org/wiki/Gecko_%28software%29 Gecko] as the browser engine. The Developer Edition of Firefox includes complete support for the latest [https://developer.mozilla.org/en-US/docs/Tools Firefox Developer Tools]&lt;br /&gt;
&lt;br /&gt;
Servo so far implements partial support for Developer Tools, which does not include the logging of HTTP requests as shown above. The goal of this project is to implement capability for logging HTTP requests and responses on the Web Console.&lt;br /&gt;
When we run Servo with our changes on a webpage with the --devtools argument, and connect from an instance of Firefox, we should be able to see the HTTP requests and responses from the server appear on the log in the Web Console.&lt;br /&gt;
&lt;br /&gt;
=='''Implementation'''==&lt;br /&gt;
The following is a rough list of changes that will be required in the code to enable logging of HTTP messages. It includes adding types for HTTP request and response messages to the enum that represents messages exchanged between Servo and the debugger client. An &amp;quot;actor&amp;quot; is created to store the information that will be sent in these messages.&lt;br /&gt;
&lt;br /&gt;
*Add an HTTRequest variant to the DevtoolsControlMsg enum in devtools_traits/lib.rs, containing fields for the target url, the method, headers, and the request body. Use the types that are present in the LoadData struct in components/net/resource_task.rs.&lt;br /&gt;
*Add an HTTPResponse variant to the DevtoolsControlMsg enum containing fields for the response headers, status, and body. Use the same types that are present in the Metadata struct in components/net/resource_task.rs.&lt;br /&gt;
*Make the HTTP loader's load function take an optional Sender&amp;lt;DevtoolsControlMsg&amp;gt;. Use the cookies_chan argument as a model. Send HTTPRequest and HTTPResponse messages using this sender at the appropriate times.&lt;br /&gt;
*Create a NetworkEventActor actor in the devtools crate that stores the request and response information transmitted in the new messages. Add a String field to HTTPRequest and HTTPResponse which contains a unique ID that joins them - see Node::summarize for an example of creating this. Associate the unique IDs with the corresponding NetworkEventActor names via a hashtable.&lt;br /&gt;
*Send the networkEvent message when the HTTPRequest and HTTPResponse messages are received. Use the Firefox devtools code (onNetworkEvent) as a reference.&lt;br /&gt;
*Implement the getRequestHeaders, getRequestCookies, getRequestPostData, getReponseHeaders, getReponseCookies, and getResponseContent messages for NetworkEventActor.&lt;br /&gt;
&lt;br /&gt;
=='''Architecture'''==&lt;br /&gt;
The conceptual architecture of Mozilla Firefox running Gecko is represented in the following figure. This is from Grosskurth and Godfrey, A Reference Architecture for Web Browsers &amp;lt;ref&amp;gt;http://grosskurth.ca/papers/browser-refarch.pdf&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:mozilla_arch.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Component Diagrams===&lt;br /&gt;
Servo is designed to be highly parallel, with many components (rendering, layout, HTML parsing, image decoding, etc.) handled by fine-grained, isolated tasks. &lt;br /&gt;
&lt;br /&gt;
The following figures represent the browser architecture with all these components, and the Servo architecture &amp;lt;ref&amp;gt;http://www.joshmatthews.net/fosdemservo/&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Browser:&lt;br /&gt;
&lt;br /&gt;
[[File:browser_arch.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Servo Architecture:&lt;br /&gt;
&lt;br /&gt;
[[File:servo_arch.jpg]]&lt;br /&gt;
&lt;br /&gt;
=='''Design'''==&lt;br /&gt;
===enum in Rust===&lt;br /&gt;
Enums are datatypes with several alternate representations. A simple enum defines one or more constants with the same data type. In Rust, an enum can have complex variants though, like a struct. For example, consider an enum 'Shape' with variants 'Circle' and 'Triangle' each of which is a struct.&lt;br /&gt;
&lt;br /&gt;
    enum Shape {&lt;br /&gt;
        Circle { center: Point, radius: f64 },&lt;br /&gt;
        Triangle{ vert1: Point, vert2: Point, vert3: Point }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
A variable of type Shape can be resolved to its appropriate variant by using a 'match'.&lt;br /&gt;
&lt;br /&gt;
    fn area(sh: Shape) -&amp;gt; f64 {&lt;br /&gt;
        match sh {&lt;br /&gt;
            Circle(_, size) =&amp;gt; f64::consts::PI * size * size,&lt;br /&gt;
            Rectangle(Point { x, y }, Point { x: x2, y: y2 }) =&amp;gt; (x2 - x) * (y2 - y)&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
The Servo Developers Tools project has a 'DevtoolsControlMsg' enum which is used to instruct the devtools server to update its known actors/state according to changes in the browser. The current project requires the addition of two new variants to the 'DevtoolsControlMsg' enum, namely 'HTTRequest' and 'HTTResponse'.&lt;br /&gt;
&lt;br /&gt;
===Sender and Receiver===&lt;br /&gt;
&lt;br /&gt;
In Rust, a pipe is used for communication between tasks. A pipe is simply a pair of endpoints: one for sending messages and another for receiving messages(Sender and Receiver). The simplest way to create a pipe is to use the channel function to create a (Sender, Receiver) pair. In Rust parlance, a sender is a sending endpoint of a pipe, and a receiver is the receiving endpoint. A simple channel can be created as follows:&lt;br /&gt;
    let (tx, rx) = channel();&lt;br /&gt;
    spawn(proc() {&lt;br /&gt;
        tx.send(10i);&lt;br /&gt;
    });&lt;br /&gt;
    assert_eq!(rx.recv(), 10i);&lt;br /&gt;
&lt;br /&gt;
The sending half of the asynchronous channel type is Struct [https://doc.rust-lang.org/std/sync/mpsc/struct.Sender.html Sender&amp;lt;T&amp;gt;] and the receiving half is the struct [https://doc.rust-lang.org/std/sync/mpsc/struct.Receiver.html Receiver&amp;lt;T&amp;gt;].&lt;br /&gt;
For the purpose of this project, we will be using the channel to send and receive messages. To log the HTTP requests and responses on the console, we can use a variant of the enum 'DevtoolsControlMsg'. This enum is used to send messages to the devtools server to update its actors/state according to changes in the browser. We now add HTTPRequest and HHTPResponse variant to the DevtoolsControlMsg enum. We can now use the HTTP loaders' load function to send the HTTPRequest and HHTPResponse to the main loop in the run_server, where it can be received using a receiver. This is done by adding an argument, Sender&amp;lt;DevtoolsControlMsg&amp;gt; to the load function.&lt;br /&gt;
&lt;br /&gt;
[[File:uml_enum.jpg]]&lt;br /&gt;
&lt;br /&gt;
=='''Design Patterns'''==&lt;br /&gt;
===Actor Model===&lt;br /&gt;
The actor model&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Actor_model&amp;lt;/ref&amp;gt; in computer science is a mathematical model of concurrent computation that treats &amp;quot;actors&amp;quot; as the universal primitives of concurrent computation: in response to a message that it receives, an actor can make local decisions, create more actors, send more messages, and determine how to respond to the next message received.&lt;br /&gt;
&lt;br /&gt;
The Actor model adopts the philosophy that everything is an actor. This is similar to the everything is an object philosophy used by some object-oriented programming languages, but differs in that object-oriented software is typically executed sequentially, while the Actor model is inherently concurrent.&lt;br /&gt;
&lt;br /&gt;
An actor is a computational entity that, in response to a message it receives, can concurrently:&lt;br /&gt;
*send a finite number of messages to other actors;&lt;br /&gt;
*create a finite number of new actors;&lt;br /&gt;
*designate the behavior to be used for the next message it receives.&lt;br /&gt;
 &lt;br /&gt;
Servo uses an actor-based remote devtools server implementation. For the logging of Http requests and responses, we use a NetworkEventActor to store the request and response information transmitted in the new messages. A unique id is used to keep track of a request and its corresponding respond. In the event that a client want more information about a request/response, it can query the server using this unique id. Following is a code snippet showing the structure of the actor and its fields.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
struct HttpRequest {&lt;br /&gt;
    url: String,&lt;br /&gt;
    method: Method,&lt;br /&gt;
    headers: Headers,&lt;br /&gt;
    body: Option&amp;lt;Vec&amp;lt;u8&amp;gt;&amp;gt;,&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
struct HttpResponse {&lt;br /&gt;
    headers: Option&amp;lt;Headers&amp;gt;,&lt;br /&gt;
    status: Option&amp;lt;RawStatus&amp;gt;,&lt;br /&gt;
    body: Option&amp;lt;Vec&amp;lt;u8&amp;gt;&amp;gt;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
pub struct NetworkEventActor {&lt;br /&gt;
    pub name: String,&lt;br /&gt;
    request: HttpRequest,&lt;br /&gt;
    response: HttpResponse,&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''UML Diagrams'''==&lt;br /&gt;
&lt;br /&gt;
==='''Class Diagram'''===&lt;br /&gt;
&lt;br /&gt;
[[File:Class_diagram1.png‎]]&lt;br /&gt;
&lt;br /&gt;
===='''Sequence Diagram'''====&lt;br /&gt;
&lt;br /&gt;
[[File:uml_seq1.jpg]]&lt;br /&gt;
&lt;br /&gt;
=='''Proposed Test Cases'''==&lt;br /&gt;
===='''Testing the feature'''====&lt;br /&gt;
The feature added will be tested using the following steps:&lt;br /&gt;
* Build Servo successfully with the changes (./mach build)&lt;br /&gt;
* Run Servo on a web page with the --devtools argument specifying a port number, say 6000 (./mach run [url] --devtools 6000)&lt;br /&gt;
* Open an instance of a recent version Firefox configured with Remote Debugging enabled.&lt;br /&gt;
* Connect to Servo running the web page on port 6000.&lt;br /&gt;
* Enable persistent logs in Settings. Select logging of Net messages from the Console.&lt;br /&gt;
* Navigate to another url from the webpage running Servo.&lt;br /&gt;
* The HTTP request and response messages should be logged on the Console.&lt;br /&gt;
&lt;br /&gt;
===='''Regression Testing'''====&lt;br /&gt;
We want to ensure that everything is in order after we have completed our changes; more importantly, that we have not broken any existing functionality. Mozilla has an automated workflow in place for running tests on pull requests submitted to Servo. Servo has a test suite which runs on every reviewed pull request, via [https://github.com/bors-servo bors-servo] and the buildbot.&lt;br /&gt;
&lt;br /&gt;
After it sees an approval on a reviewed pull requests, bors-servo automatically merges the changes&lt;br /&gt;
&lt;br /&gt;
[[File:bors-servo-merge.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
It starts off running a suite of regression tests, and any failure is reported. It can be issued a retry command once the fixes are in place.&lt;br /&gt;
&lt;br /&gt;
[[File:bors-servo-fail.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
When all tests pass, the changes are successfully merged into master. The following is the set of tests that will be run after the pull request is reviewed:&lt;br /&gt;
&lt;br /&gt;
[[File:bors-servo-success.jpg]]&lt;br /&gt;
&lt;br /&gt;
=='''Reference'''==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Amohanr</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Class_diagram1.png&amp;diff=97102</id>
		<title>File:Class diagram1.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Class_diagram1.png&amp;diff=97102"/>
		<updated>2015-05-05T03:11:10Z</updated>

		<summary type="html">&lt;p&gt;Amohanr: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Amohanr</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015_M1503_EDTS&amp;diff=97097</id>
		<title>CSC/ECE 517 Spring 2015 M1503 EDTS</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015_M1503_EDTS&amp;diff=97097"/>
		<updated>2015-05-04T19:00:55Z</updated>

		<summary type="html">&lt;p&gt;Amohanr: /* Sender and Receiver */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;font size=&amp;quot;5&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Extending Developer Tools for Servo&amp;lt;/b&amp;gt;&amp;lt;/font&amp;gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
=='''Introduction'''==&lt;br /&gt;
===Rust===&lt;br /&gt;
Rust is a general purpose, [http://en.wikipedia.org/wiki/Programming_paradigm#Multi-paradigm multi-paradigm], compiled programming language developed by [http://en.wikipedia.org/wiki/Mozilla Mozilla] Research. It is designed to be a &amp;quot;safe, concurrent, practical language&amp;quot;, supporting [http://en.wikipedia.org/wiki/Purely_functional pure-functional], [http://en.wikipedia.org/wiki/Actor_model concurrent-actor], [http://en.wikipedia.org/wiki/Procedural_programming imperative-procedural], and object-oriented styles.&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Rust_%28programming_language%29&amp;lt;/ref&amp;gt; Being a modern systems programming language focusing on safety and speed, it accomplishes these goals by being memory safe without using garbage collection.&amp;lt;ref&amp;gt;http://doc.rust-lang.org/nightly/intro.html&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Servo===&lt;br /&gt;
Servo is an experimental project to build a Web browser engine for a new generation of hardware: mobile devices, multi-core processors and high-performance GPUs. With Servo, we are rethinking the browser at every level of the technology stack — from input parsing to page layout to graphics rendering — to optimize for power efficiency and maximum parallelism.&lt;br /&gt;
Servo builds on top of Rust to provide a secure and reliable foundation. Memory safety at the core of the platform ensures a high degree of assurance in the browser’s trusted computing base. 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;
=='''Background'''==&lt;br /&gt;
===Remote Developer Tools===&lt;br /&gt;
&lt;br /&gt;
Firefox supports remote developer tools - ie. communicating with an arbitrary server that implements a protocol for exposing information about web content. You can use the [https://developer.mozilla.org/en-US/docs/Tools Firefox developer tools] on your desktop to debug Web sites and Web apps running in other browsers or runtimes. The other browser might be on the same device as the tools themselves or on a different device, such as a phone connected over USB.&lt;br /&gt;
&lt;br /&gt;
=='''Project Description'''==&lt;br /&gt;
Servo implements a very basic developer tools server that currently supports executing JS remotely and investigating the DOM tree in the document inspector. We want to expand these capabilities by completing previous work that enables remote logging from web content, and add new capabilities to log HTTP requests and responses to allow for easier debugging of network-related problems in Servo.&amp;lt;ref&amp;gt;https://github.com/servo/servo/wiki/More-developer-tools-student-project&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The initial step included changes for enabling remote logging from the [http://developer.mozilla.org/en-US/docs/Tools/Web_Console Web Console] using 'console.log'. This was completed as part of the OSS project (Pull request [http://github.com/servo/servo/pull/5229 here]).&lt;br /&gt;
&lt;br /&gt;
In continuation, the objective of the project is to add support for logging HTTP requests and responses in the Web Console.&lt;br /&gt;
&lt;br /&gt;
=='''Requirement Analysis'''==&lt;br /&gt;
&lt;br /&gt;
To configure Firefox for remote debugging, please follow the instructions on [http://developer.mozilla.org/en-US/docs/Tools/Remote_Debugging/Thunderbird Setting up Firefox]&lt;br /&gt;
&lt;br /&gt;
Alternatively, to just view the Web Console, follow instructions [http://developer.mozilla.org/en-US/docs/Tools/Web_Console here].&lt;br /&gt;
&lt;br /&gt;
As mentioned above, Firefox provides the ability to debug a web page running on a remote server with its Developer Tools. The Message Display pane of the Web Console displays various kinds of messages: &lt;br /&gt;
* HTTP requests&lt;br /&gt;
* JavaScript warnings and errors&lt;br /&gt;
* CSS warnings, errors, and reflow events&lt;br /&gt;
* Security warnings and errors&lt;br /&gt;
* console API calls&lt;br /&gt;
* Input/output messages&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The Message Display pane looks like this:&lt;br /&gt;
&lt;br /&gt;
[[File:web_console_display_pane.jpg]]&lt;br /&gt;
&lt;br /&gt;
Open the Web Console from the Developer menu (or Ctrl+Shift+K) from a version of Firefox with Developer Tools extensions. Navigate to any web page and observe messages on the Web Console (Console tab). You may have to check the Log option under &amp;quot;Net&amp;quot; (the first option in black).&lt;br /&gt;
The log is cleared on every redirection/reload of a page. To avoid this, you can select the &amp;quot;Enable Persistent Logs&amp;quot; option in Settings.&lt;br /&gt;
&lt;br /&gt;
HTTP Requests are logged with lines that looks like this on the Web Console:&lt;br /&gt;
&lt;br /&gt;
[[File:HTTP_console_log.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Clicking on the message brings up a new window that gives more details about the HTTP request and the response.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:network_action_window.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Versions of Firefox in use today use [http://en.wikipedia.org/wiki/Gecko_%28software%29 Gecko] as the browser engine. The Developer Edition of Firefox includes complete support for the latest [https://developer.mozilla.org/en-US/docs/Tools Firefox Developer Tools]&lt;br /&gt;
&lt;br /&gt;
Servo so far implements partial support for Developer Tools, which does not include the logging of HTTP requests as shown above. The goal of this project is to implement capability for logging HTTP requests and responses on the Web Console.&lt;br /&gt;
When we run Servo with our changes on a webpage with the --devtools argument, and connect from an instance of Firefox, we should be able to see the HTTP requests and responses from the server appear on the log in the Web Console.&lt;br /&gt;
&lt;br /&gt;
=='''Implementation'''==&lt;br /&gt;
The following is a rough list of changes that will be required in the code to enable logging of HTTP messages. It includes adding types for HTTP request and response messages to the enum that represents messages exchanged between Servo and the debugger client. An &amp;quot;actor&amp;quot; is created to store the information that will be sent in these messages.&lt;br /&gt;
&lt;br /&gt;
*Add an HTTRequest variant to the DevtoolsControlMsg enum in devtools_traits/lib.rs, containing fields for the target url, the method, headers, and the request body. Use the types that are present in the LoadData struct in components/net/resource_task.rs.&lt;br /&gt;
*Add an HTTPResponse variant to the DevtoolsControlMsg enum containing fields for the response headers, status, and body. Use the same types that are present in the Metadata struct in components/net/resource_task.rs.&lt;br /&gt;
*Make the HTTP loader's load function take an optional Sender&amp;lt;DevtoolsControlMsg&amp;gt;. Use the cookies_chan argument as a model. Send HTTPRequest and HTTPResponse messages using this sender at the appropriate times.&lt;br /&gt;
*Create a NetworkEventActor actor in the devtools crate that stores the request and response information transmitted in the new messages. Add a String field to HTTPRequest and HTTPResponse which contains a unique ID that joins them - see Node::summarize for an example of creating this. Associate the unique IDs with the corresponding NetworkEventActor names via a hashtable.&lt;br /&gt;
*Send the networkEvent message when the HTTPRequest and HTTPResponse messages are received. Use the Firefox devtools code (onNetworkEvent) as a reference.&lt;br /&gt;
*Implement the getRequestHeaders, getRequestCookies, getRequestPostData, getReponseHeaders, getReponseCookies, and getResponseContent messages for NetworkEventActor.&lt;br /&gt;
&lt;br /&gt;
=='''Architecture'''==&lt;br /&gt;
The conceptual architecture of Mozilla Firefox running Gecko is represented in the following figure. This is from Grosskurth and Godfrey, A Reference Architecture for Web Browsers &amp;lt;ref&amp;gt;http://grosskurth.ca/papers/browser-refarch.pdf&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:mozilla_arch.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Component Diagrams===&lt;br /&gt;
Servo is designed to be highly parallel, with many components (rendering, layout, HTML parsing, image decoding, etc.) handled by fine-grained, isolated tasks. &lt;br /&gt;
&lt;br /&gt;
The following figures represent the browser architecture with all these components, and the Servo architecture &amp;lt;ref&amp;gt;http://www.joshmatthews.net/fosdemservo/&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Browser:&lt;br /&gt;
&lt;br /&gt;
[[File:browser_arch.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Servo Architecture:&lt;br /&gt;
&lt;br /&gt;
[[File:servo_arch.jpg]]&lt;br /&gt;
&lt;br /&gt;
=='''Design'''==&lt;br /&gt;
===enum in Rust===&lt;br /&gt;
Enums are datatypes with several alternate representations. A simple enum defines one or more constants with the same data type. In Rust, an enum can have complex variants though, like a struct. For example, consider an enum 'Shape' with variants 'Circle' and 'Triangle' each of which is a struct.&lt;br /&gt;
&lt;br /&gt;
    enum Shape {&lt;br /&gt;
        Circle { center: Point, radius: f64 },&lt;br /&gt;
        Triangle{ vert1: Point, vert2: Point, vert3: Point }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
A variable of type Shape can be resolved to its appropriate variant by using a 'match'.&lt;br /&gt;
&lt;br /&gt;
    fn area(sh: Shape) -&amp;gt; f64 {&lt;br /&gt;
        match sh {&lt;br /&gt;
            Circle(_, size) =&amp;gt; f64::consts::PI * size * size,&lt;br /&gt;
            Rectangle(Point { x, y }, Point { x: x2, y: y2 }) =&amp;gt; (x2 - x) * (y2 - y)&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
The Servo Developers Tools project has a 'DevtoolsControlMsg' enum which is used to instruct the devtools server to update its known actors/state according to changes in the browser. The current project requires the addition of two new variants to the 'DevtoolsControlMsg' enum, namely 'HTTRequest' and 'HTTResponse'.&lt;br /&gt;
&lt;br /&gt;
===Sender and Receiver===&lt;br /&gt;
&lt;br /&gt;
In Rust, a pipe is used for communication between tasks. A pipe is simply a pair of endpoints: one for sending messages and another for receiving messages(Sender and Receiver). The simplest way to create a pipe is to use the channel function to create a (Sender, Receiver) pair. In Rust parlance, a sender is a sending endpoint of a pipe, and a receiver is the receiving endpoint. A simple channel can be created as follows:&lt;br /&gt;
    let (tx, rx) = channel();&lt;br /&gt;
    spawn(proc() {&lt;br /&gt;
        tx.send(10i);&lt;br /&gt;
    });&lt;br /&gt;
    assert_eq!(rx.recv(), 10i);&lt;br /&gt;
&lt;br /&gt;
The sending half of the asynchronous channel type is Struct [https://doc.rust-lang.org/std/sync/mpsc/struct.Sender.html Sender&amp;lt;T&amp;gt;] and the receiving half is the struct [https://doc.rust-lang.org/std/sync/mpsc/struct.Receiver.html Receiver&amp;lt;T&amp;gt;].&lt;br /&gt;
For the purpose of this project, we will be using the channel to send and receive messages. To log the HTTP requests and responses on the console, we can use a variant of the enum 'DevtoolsControlMsg'. This enum is used to send messages to the devtools server to update its actors/state according to changes in the browser. We now add HTTPRequest and HHTPResponse variant to the DevtoolsControlMsg enum. We can now use the HTTP loaders' load function to send the HTTPRequest and HHTPResponse to the main loop in the run_server, where it can be received using a receiver. This is done by adding an argument, Sender&amp;lt;DevtoolsControlMsg&amp;gt; to the load function.&lt;br /&gt;
&lt;br /&gt;
[[File:uml_enum.jpg]]&lt;br /&gt;
&lt;br /&gt;
=='''Design Patterns'''==&lt;br /&gt;
===Actor Model===&lt;br /&gt;
The actor model&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Actor_model&amp;lt;/ref&amp;gt; in computer science is a mathematical model of concurrent computation that treats &amp;quot;actors&amp;quot; as the universal primitives of concurrent computation: in response to a message that it receives, an actor can make local decisions, create more actors, send more messages, and determine how to respond to the next message received.&lt;br /&gt;
&lt;br /&gt;
The Actor model adopts the philosophy that everything is an actor. This is similar to the everything is an object philosophy used by some object-oriented programming languages, but differs in that object-oriented software is typically executed sequentially, while the Actor model is inherently concurrent.&lt;br /&gt;
&lt;br /&gt;
An actor is a computational entity that, in response to a message it receives, can concurrently:&lt;br /&gt;
*send a finite number of messages to other actors;&lt;br /&gt;
*create a finite number of new actors;&lt;br /&gt;
*designate the behavior to be used for the next message it receives.&lt;br /&gt;
 &lt;br /&gt;
Servo uses an actor-based remote devtools server implementation. For the logging of Http requests and responses, we use a NetworkEventActor to store the request and response information transmitted in the new messages. A unique id is used to keep track of a request and its corresponding respond. In the event that a client want more information about a request/response, it can query the server using this unique id. Following is a code snippet showing the structure of the actor and its fields.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
struct HttpRequest {&lt;br /&gt;
    url: String,&lt;br /&gt;
    method: Method,&lt;br /&gt;
    headers: Headers,&lt;br /&gt;
    body: Option&amp;lt;Vec&amp;lt;u8&amp;gt;&amp;gt;,&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
struct HttpResponse {&lt;br /&gt;
    headers: Option&amp;lt;Headers&amp;gt;,&lt;br /&gt;
    status: Option&amp;lt;RawStatus&amp;gt;,&lt;br /&gt;
    body: Option&amp;lt;Vec&amp;lt;u8&amp;gt;&amp;gt;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
pub struct NetworkEventActor {&lt;br /&gt;
    pub name: String,&lt;br /&gt;
    request: HttpRequest,&lt;br /&gt;
    response: HttpResponse,&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''UML Diagrams'''==&lt;br /&gt;
===='''Sequence Diagram'''====&lt;br /&gt;
&lt;br /&gt;
[[File:uml_seq1.jpg]]&lt;br /&gt;
&lt;br /&gt;
=='''Proposed Test Cases'''==&lt;br /&gt;
===='''Testing the feature'''====&lt;br /&gt;
The feature added will be tested using the following steps:&lt;br /&gt;
* Build Servo successfully with the changes (./mach build)&lt;br /&gt;
* Run Servo on a web page with the --devtools argument specifying a port number, say 6000 (./mach run [url] --devtools 6000)&lt;br /&gt;
* Open an instance of a recent version Firefox configured with Remote Debugging enabled.&lt;br /&gt;
* Connect to Servo running the web page on port 6000.&lt;br /&gt;
* Enable persistent logs in Settings. Select logging of Net messages from the Console.&lt;br /&gt;
* Navigate to another url from the webpage running Servo.&lt;br /&gt;
* The HTTP request and response messages should be logged on the Console.&lt;br /&gt;
&lt;br /&gt;
===='''Regression Testing'''====&lt;br /&gt;
We want to ensure that everything is in order after we have completed our changes; more importantly, that we have not broken any existing functionality. Mozilla has an automated workflow in place for running tests on pull requests submitted to Servo. Servo has a test suite which runs on every reviewed pull request, via [https://github.com/bors-servo bors-servo] and the buildbot.&lt;br /&gt;
&lt;br /&gt;
After it sees an approval on a reviewed pull requests, bors-servo automatically merges the changes&lt;br /&gt;
&lt;br /&gt;
[[File:bors-servo-merge.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
It starts off running a suite of regression tests, and any failure is reported. It can be issued a retry command once the fixes are in place.&lt;br /&gt;
&lt;br /&gt;
[[File:bors-servo-fail.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
When all tests pass, the changes are successfully merged into master. The following is the set of tests that will be run after the pull request is reviewed:&lt;br /&gt;
&lt;br /&gt;
[[File:bors-servo-success.jpg]]&lt;br /&gt;
&lt;br /&gt;
=='''Reference'''==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Amohanr</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015_M1503_EDTS&amp;diff=97096</id>
		<title>CSC/ECE 517 Spring 2015 M1503 EDTS</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015_M1503_EDTS&amp;diff=97096"/>
		<updated>2015-05-04T16:33:00Z</updated>

		<summary type="html">&lt;p&gt;Amohanr: /* Actor Model */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;font size=&amp;quot;5&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Extending Developer Tools for Servo&amp;lt;/b&amp;gt;&amp;lt;/font&amp;gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
=='''Introduction'''==&lt;br /&gt;
===Rust===&lt;br /&gt;
Rust is a general purpose, [http://en.wikipedia.org/wiki/Programming_paradigm#Multi-paradigm multi-paradigm], compiled programming language developed by [http://en.wikipedia.org/wiki/Mozilla Mozilla] Research. It is designed to be a &amp;quot;safe, concurrent, practical language&amp;quot;, supporting [http://en.wikipedia.org/wiki/Purely_functional pure-functional], [http://en.wikipedia.org/wiki/Actor_model concurrent-actor], [http://en.wikipedia.org/wiki/Procedural_programming imperative-procedural], and object-oriented styles.&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Rust_%28programming_language%29&amp;lt;/ref&amp;gt; Being a modern systems programming language focusing on safety and speed, it accomplishes these goals by being memory safe without using garbage collection.&amp;lt;ref&amp;gt;http://doc.rust-lang.org/nightly/intro.html&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Servo===&lt;br /&gt;
Servo is an experimental project to build a Web browser engine for a new generation of hardware: mobile devices, multi-core processors and high-performance GPUs. With Servo, we are rethinking the browser at every level of the technology stack — from input parsing to page layout to graphics rendering — to optimize for power efficiency and maximum parallelism.&lt;br /&gt;
Servo builds on top of Rust to provide a secure and reliable foundation. Memory safety at the core of the platform ensures a high degree of assurance in the browser’s trusted computing base. 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;
=='''Background'''==&lt;br /&gt;
===Remote Developer Tools===&lt;br /&gt;
&lt;br /&gt;
Firefox supports remote developer tools - ie. communicating with an arbitrary server that implements a protocol for exposing information about web content. You can use the [https://developer.mozilla.org/en-US/docs/Tools Firefox developer tools] on your desktop to debug Web sites and Web apps running in other browsers or runtimes. The other browser might be on the same device as the tools themselves or on a different device, such as a phone connected over USB.&lt;br /&gt;
&lt;br /&gt;
=='''Project Description'''==&lt;br /&gt;
Servo implements a very basic developer tools server that currently supports executing JS remotely and investigating the DOM tree in the document inspector. We want to expand these capabilities by completing previous work that enables remote logging from web content, and add new capabilities to log HTTP requests and responses to allow for easier debugging of network-related problems in Servo.&amp;lt;ref&amp;gt;https://github.com/servo/servo/wiki/More-developer-tools-student-project&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The initial step included changes for enabling remote logging from the [http://developer.mozilla.org/en-US/docs/Tools/Web_Console Web Console] using 'console.log'. This was completed as part of the OSS project (Pull request [http://github.com/servo/servo/pull/5229 here]).&lt;br /&gt;
&lt;br /&gt;
In continuation, the objective of the project is to add support for logging HTTP requests and responses in the Web Console.&lt;br /&gt;
&lt;br /&gt;
=='''Requirement Analysis'''==&lt;br /&gt;
&lt;br /&gt;
To configure Firefox for remote debugging, please follow the instructions on [http://developer.mozilla.org/en-US/docs/Tools/Remote_Debugging/Thunderbird Setting up Firefox]&lt;br /&gt;
&lt;br /&gt;
Alternatively, to just view the Web Console, follow instructions [http://developer.mozilla.org/en-US/docs/Tools/Web_Console here].&lt;br /&gt;
&lt;br /&gt;
As mentioned above, Firefox provides the ability to debug a web page running on a remote server with its Developer Tools. The Message Display pane of the Web Console displays various kinds of messages: &lt;br /&gt;
* HTTP requests&lt;br /&gt;
* JavaScript warnings and errors&lt;br /&gt;
* CSS warnings, errors, and reflow events&lt;br /&gt;
* Security warnings and errors&lt;br /&gt;
* console API calls&lt;br /&gt;
* Input/output messages&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The Message Display pane looks like this:&lt;br /&gt;
&lt;br /&gt;
[[File:web_console_display_pane.jpg]]&lt;br /&gt;
&lt;br /&gt;
Open the Web Console from the Developer menu (or Ctrl+Shift+K) from a version of Firefox with Developer Tools extensions. Navigate to any web page and observe messages on the Web Console (Console tab). You may have to check the Log option under &amp;quot;Net&amp;quot; (the first option in black).&lt;br /&gt;
The log is cleared on every redirection/reload of a page. To avoid this, you can select the &amp;quot;Enable Persistent Logs&amp;quot; option in Settings.&lt;br /&gt;
&lt;br /&gt;
HTTP Requests are logged with lines that looks like this on the Web Console:&lt;br /&gt;
&lt;br /&gt;
[[File:HTTP_console_log.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Clicking on the message brings up a new window that gives more details about the HTTP request and the response.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:network_action_window.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Versions of Firefox in use today use [http://en.wikipedia.org/wiki/Gecko_%28software%29 Gecko] as the browser engine. The Developer Edition of Firefox includes complete support for the latest [https://developer.mozilla.org/en-US/docs/Tools Firefox Developer Tools]&lt;br /&gt;
&lt;br /&gt;
Servo so far implements partial support for Developer Tools, which does not include the logging of HTTP requests as shown above. The goal of this project is to implement capability for logging HTTP requests and responses on the Web Console.&lt;br /&gt;
When we run Servo with our changes on a webpage with the --devtools argument, and connect from an instance of Firefox, we should be able to see the HTTP requests and responses from the server appear on the log in the Web Console.&lt;br /&gt;
&lt;br /&gt;
=='''Implementation'''==&lt;br /&gt;
The following is a rough list of changes that will be required in the code to enable logging of HTTP messages. It includes adding types for HTTP request and response messages to the enum that represents messages exchanged between Servo and the debugger client. An &amp;quot;actor&amp;quot; is created to store the information that will be sent in these messages.&lt;br /&gt;
&lt;br /&gt;
*Add an HTTRequest variant to the DevtoolsControlMsg enum in devtools_traits/lib.rs, containing fields for the target url, the method, headers, and the request body. Use the types that are present in the LoadData struct in components/net/resource_task.rs.&lt;br /&gt;
*Add an HTTPResponse variant to the DevtoolsControlMsg enum containing fields for the response headers, status, and body. Use the same types that are present in the Metadata struct in components/net/resource_task.rs.&lt;br /&gt;
*Make the HTTP loader's load function take an optional Sender&amp;lt;DevtoolsControlMsg&amp;gt;. Use the cookies_chan argument as a model. Send HTTPRequest and HTTPResponse messages using this sender at the appropriate times.&lt;br /&gt;
*Create a NetworkEventActor actor in the devtools crate that stores the request and response information transmitted in the new messages. Add a String field to HTTPRequest and HTTPResponse which contains a unique ID that joins them - see Node::summarize for an example of creating this. Associate the unique IDs with the corresponding NetworkEventActor names via a hashtable.&lt;br /&gt;
*Send the networkEvent message when the HTTPRequest and HTTPResponse messages are received. Use the Firefox devtools code (onNetworkEvent) as a reference.&lt;br /&gt;
*Implement the getRequestHeaders, getRequestCookies, getRequestPostData, getReponseHeaders, getReponseCookies, and getResponseContent messages for NetworkEventActor.&lt;br /&gt;
&lt;br /&gt;
=='''Architecture'''==&lt;br /&gt;
The conceptual architecture of Mozilla Firefox running Gecko is represented in the following figure. This is from Grosskurth and Godfrey, A Reference Architecture for Web Browsers &amp;lt;ref&amp;gt;http://grosskurth.ca/papers/browser-refarch.pdf&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:mozilla_arch.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Component Diagrams===&lt;br /&gt;
Servo is designed to be highly parallel, with many components (rendering, layout, HTML parsing, image decoding, etc.) handled by fine-grained, isolated tasks. &lt;br /&gt;
&lt;br /&gt;
The following figures represent the browser architecture with all these components, and the Servo architecture &amp;lt;ref&amp;gt;http://www.joshmatthews.net/fosdemservo/&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Browser:&lt;br /&gt;
&lt;br /&gt;
[[File:browser_arch.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Servo Architecture:&lt;br /&gt;
&lt;br /&gt;
[[File:servo_arch.jpg]]&lt;br /&gt;
&lt;br /&gt;
=='''Design'''==&lt;br /&gt;
===enum in Rust===&lt;br /&gt;
Enums are datatypes with several alternate representations. A simple enum defines one or more constants with the same data type. In Rust, an enum can have complex variants though, like a struct. For example, consider an enum 'Shape' with variants 'Circle' and 'Triangle' each of which is a struct.&lt;br /&gt;
&lt;br /&gt;
    enum Shape {&lt;br /&gt;
        Circle { center: Point, radius: f64 },&lt;br /&gt;
        Triangle{ vert1: Point, vert2: Point, vert3: Point }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
A variable of type Shape can be resolved to its appropriate variant by using a 'match'.&lt;br /&gt;
&lt;br /&gt;
    fn area(sh: Shape) -&amp;gt; f64 {&lt;br /&gt;
        match sh {&lt;br /&gt;
            Circle(_, size) =&amp;gt; f64::consts::PI * size * size,&lt;br /&gt;
            Rectangle(Point { x, y }, Point { x: x2, y: y2 }) =&amp;gt; (x2 - x) * (y2 - y)&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
The Servo Developers Tools project has a 'DevtoolsControlMsg' enum which is used to instruct the devtools server to update its known actors/state according to changes in the browser. The current project requires the addition of two new variants to the 'DevtoolsControlMsg' enum, namely 'HTTRequest' and 'HTTResponse'.&lt;br /&gt;
&lt;br /&gt;
===Sender and Receiver===&lt;br /&gt;
&lt;br /&gt;
In Rust, a pipe is used for communication between tasks. A pipe is simply a pair of endpoints: one for sending messages and another for receiving messages(Sender and Receiver). The simplest way to create a pipe is to use the channel function to create a (Sender, Receiver) pair. In Rust parlance, a sender is a sending endpoint of a pipe, and a receiver is the receiving endpoint. A simple channel can be created as follows:&lt;br /&gt;
    let (tx, rx) = channel();&lt;br /&gt;
    spawn(proc() {&lt;br /&gt;
        tx.send(10i);&lt;br /&gt;
    });&lt;br /&gt;
    assert_eq!(rx.recv(), 10i);&lt;br /&gt;
&lt;br /&gt;
The sending half of the asynchronous channel type is Struct [https://doc.rust-lang.org/std/sync/mpsc/struct.Sender.html Sender&amp;lt;T&amp;gt;] and the receiving half is the struct [https://doc.rust-lang.org/std/sync/mpsc/struct.Receiver.html Receiver&amp;lt;T&amp;gt;].&lt;br /&gt;
For the purpose of this project, we will be using the channel to send and receive messages. To log the HTTP requests and responses on the console, we can use a variant of the enum 'DevtoolsControlMsg'. This enum is used to send messages to the devtools server to update its actors/state according to changes in the browser. We now add HTTPRequest and HHTpResponse variant to the DevtoolsControlMsg enum. We can now use the HTTP loaders' load function to send the HTTPRequest and HHTPResponse to the main loop in the run_server, where it can be received using a receiver. This is done by adding an argument, Sender&amp;lt;DevtoolsControlMsg&amp;gt; to the load function.&lt;br /&gt;
&lt;br /&gt;
[[File:uml_enum.jpg]]&lt;br /&gt;
&lt;br /&gt;
=='''Design Patterns'''==&lt;br /&gt;
===Actor Model===&lt;br /&gt;
The actor model&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Actor_model&amp;lt;/ref&amp;gt; in computer science is a mathematical model of concurrent computation that treats &amp;quot;actors&amp;quot; as the universal primitives of concurrent computation: in response to a message that it receives, an actor can make local decisions, create more actors, send more messages, and determine how to respond to the next message received.&lt;br /&gt;
&lt;br /&gt;
The Actor model adopts the philosophy that everything is an actor. This is similar to the everything is an object philosophy used by some object-oriented programming languages, but differs in that object-oriented software is typically executed sequentially, while the Actor model is inherently concurrent.&lt;br /&gt;
&lt;br /&gt;
An actor is a computational entity that, in response to a message it receives, can concurrently:&lt;br /&gt;
*send a finite number of messages to other actors;&lt;br /&gt;
*create a finite number of new actors;&lt;br /&gt;
*designate the behavior to be used for the next message it receives.&lt;br /&gt;
 &lt;br /&gt;
Servo uses an actor-based remote devtools server implementation. For the logging of Http requests and responses, we use a NetworkEventActor to store the request and response information transmitted in the new messages. A unique id is used to keep track of a request and its corresponding respond. In the event that a client want more information about a request/response, it can query the server using this unique id. Following is a code snippet showing the structure of the actor and its fields.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
struct HttpRequest {&lt;br /&gt;
    url: String,&lt;br /&gt;
    method: Method,&lt;br /&gt;
    headers: Headers,&lt;br /&gt;
    body: Option&amp;lt;Vec&amp;lt;u8&amp;gt;&amp;gt;,&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
struct HttpResponse {&lt;br /&gt;
    headers: Option&amp;lt;Headers&amp;gt;,&lt;br /&gt;
    status: Option&amp;lt;RawStatus&amp;gt;,&lt;br /&gt;
    body: Option&amp;lt;Vec&amp;lt;u8&amp;gt;&amp;gt;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
pub struct NetworkEventActor {&lt;br /&gt;
    pub name: String,&lt;br /&gt;
    request: HttpRequest,&lt;br /&gt;
    response: HttpResponse,&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''UML Diagrams'''==&lt;br /&gt;
===='''Sequence Diagram'''====&lt;br /&gt;
&lt;br /&gt;
[[File:uml_seq1.jpg]]&lt;br /&gt;
&lt;br /&gt;
=='''Proposed Test Cases'''==&lt;br /&gt;
===='''Testing the feature'''====&lt;br /&gt;
The feature added will be tested using the following steps:&lt;br /&gt;
* Build Servo successfully with the changes (./mach build)&lt;br /&gt;
* Run Servo on a web page with the --devtools argument specifying a port number, say 6000 (./mach run [url] --devtools 6000)&lt;br /&gt;
* Open an instance of a recent version Firefox configured with Remote Debugging enabled.&lt;br /&gt;
* Connect to Servo running the web page on port 6000.&lt;br /&gt;
* Enable persistent logs in Settings. Select logging of Net messages from the Console.&lt;br /&gt;
* Navigate to another url from the webpage running Servo.&lt;br /&gt;
* The HTTP request and response messages should be logged on the Console.&lt;br /&gt;
&lt;br /&gt;
===='''Regression Testing'''====&lt;br /&gt;
We want to ensure that everything is in order after we have completed our changes; more importantly, that we have not broken any existing functionality. Mozilla has an automated workflow in place for running tests on pull requests submitted to Servo. Servo has a test suite which runs on every reviewed pull request, via [https://github.com/bors-servo bors-servo] and the buildbot.&lt;br /&gt;
&lt;br /&gt;
After it sees an approval on a reviewed pull requests, bors-servo automatically merges the changes&lt;br /&gt;
&lt;br /&gt;
[[File:bors-servo-merge.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
It starts off running a suite of regression tests, and any failure is reported. It can be issued a retry command once the fixes are in place.&lt;br /&gt;
&lt;br /&gt;
[[File:bors-servo-fail.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
When all tests pass, the changes are successfully merged into master. The following is the set of tests that will be run after the pull request is reviewed:&lt;br /&gt;
&lt;br /&gt;
[[File:bors-servo-success.jpg]]&lt;br /&gt;
&lt;br /&gt;
=='''Reference'''==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Amohanr</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015_M1503_EDTS&amp;diff=97095</id>
		<title>CSC/ECE 517 Spring 2015 M1503 EDTS</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015_M1503_EDTS&amp;diff=97095"/>
		<updated>2015-05-04T16:32:30Z</updated>

		<summary type="html">&lt;p&gt;Amohanr: /* Actor Model */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;font size=&amp;quot;5&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Extending Developer Tools for Servo&amp;lt;/b&amp;gt;&amp;lt;/font&amp;gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
=='''Introduction'''==&lt;br /&gt;
===Rust===&lt;br /&gt;
Rust is a general purpose, [http://en.wikipedia.org/wiki/Programming_paradigm#Multi-paradigm multi-paradigm], compiled programming language developed by [http://en.wikipedia.org/wiki/Mozilla Mozilla] Research. It is designed to be a &amp;quot;safe, concurrent, practical language&amp;quot;, supporting [http://en.wikipedia.org/wiki/Purely_functional pure-functional], [http://en.wikipedia.org/wiki/Actor_model concurrent-actor], [http://en.wikipedia.org/wiki/Procedural_programming imperative-procedural], and object-oriented styles.&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Rust_%28programming_language%29&amp;lt;/ref&amp;gt; Being a modern systems programming language focusing on safety and speed, it accomplishes these goals by being memory safe without using garbage collection.&amp;lt;ref&amp;gt;http://doc.rust-lang.org/nightly/intro.html&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Servo===&lt;br /&gt;
Servo is an experimental project to build a Web browser engine for a new generation of hardware: mobile devices, multi-core processors and high-performance GPUs. With Servo, we are rethinking the browser at every level of the technology stack — from input parsing to page layout to graphics rendering — to optimize for power efficiency and maximum parallelism.&lt;br /&gt;
Servo builds on top of Rust to provide a secure and reliable foundation. Memory safety at the core of the platform ensures a high degree of assurance in the browser’s trusted computing base. 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;
=='''Background'''==&lt;br /&gt;
===Remote Developer Tools===&lt;br /&gt;
&lt;br /&gt;
Firefox supports remote developer tools - ie. communicating with an arbitrary server that implements a protocol for exposing information about web content. You can use the [https://developer.mozilla.org/en-US/docs/Tools Firefox developer tools] on your desktop to debug Web sites and Web apps running in other browsers or runtimes. The other browser might be on the same device as the tools themselves or on a different device, such as a phone connected over USB.&lt;br /&gt;
&lt;br /&gt;
=='''Project Description'''==&lt;br /&gt;
Servo implements a very basic developer tools server that currently supports executing JS remotely and investigating the DOM tree in the document inspector. We want to expand these capabilities by completing previous work that enables remote logging from web content, and add new capabilities to log HTTP requests and responses to allow for easier debugging of network-related problems in Servo.&amp;lt;ref&amp;gt;https://github.com/servo/servo/wiki/More-developer-tools-student-project&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The initial step included changes for enabling remote logging from the [http://developer.mozilla.org/en-US/docs/Tools/Web_Console Web Console] using 'console.log'. This was completed as part of the OSS project (Pull request [http://github.com/servo/servo/pull/5229 here]).&lt;br /&gt;
&lt;br /&gt;
In continuation, the objective of the project is to add support for logging HTTP requests and responses in the Web Console.&lt;br /&gt;
&lt;br /&gt;
=='''Requirement Analysis'''==&lt;br /&gt;
&lt;br /&gt;
To configure Firefox for remote debugging, please follow the instructions on [http://developer.mozilla.org/en-US/docs/Tools/Remote_Debugging/Thunderbird Setting up Firefox]&lt;br /&gt;
&lt;br /&gt;
Alternatively, to just view the Web Console, follow instructions [http://developer.mozilla.org/en-US/docs/Tools/Web_Console here].&lt;br /&gt;
&lt;br /&gt;
As mentioned above, Firefox provides the ability to debug a web page running on a remote server with its Developer Tools. The Message Display pane of the Web Console displays various kinds of messages: &lt;br /&gt;
* HTTP requests&lt;br /&gt;
* JavaScript warnings and errors&lt;br /&gt;
* CSS warnings, errors, and reflow events&lt;br /&gt;
* Security warnings and errors&lt;br /&gt;
* console API calls&lt;br /&gt;
* Input/output messages&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The Message Display pane looks like this:&lt;br /&gt;
&lt;br /&gt;
[[File:web_console_display_pane.jpg]]&lt;br /&gt;
&lt;br /&gt;
Open the Web Console from the Developer menu (or Ctrl+Shift+K) from a version of Firefox with Developer Tools extensions. Navigate to any web page and observe messages on the Web Console (Console tab). You may have to check the Log option under &amp;quot;Net&amp;quot; (the first option in black).&lt;br /&gt;
The log is cleared on every redirection/reload of a page. To avoid this, you can select the &amp;quot;Enable Persistent Logs&amp;quot; option in Settings.&lt;br /&gt;
&lt;br /&gt;
HTTP Requests are logged with lines that looks like this on the Web Console:&lt;br /&gt;
&lt;br /&gt;
[[File:HTTP_console_log.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Clicking on the message brings up a new window that gives more details about the HTTP request and the response.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:network_action_window.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Versions of Firefox in use today use [http://en.wikipedia.org/wiki/Gecko_%28software%29 Gecko] as the browser engine. The Developer Edition of Firefox includes complete support for the latest [https://developer.mozilla.org/en-US/docs/Tools Firefox Developer Tools]&lt;br /&gt;
&lt;br /&gt;
Servo so far implements partial support for Developer Tools, which does not include the logging of HTTP requests as shown above. The goal of this project is to implement capability for logging HTTP requests and responses on the Web Console.&lt;br /&gt;
When we run Servo with our changes on a webpage with the --devtools argument, and connect from an instance of Firefox, we should be able to see the HTTP requests and responses from the server appear on the log in the Web Console.&lt;br /&gt;
&lt;br /&gt;
=='''Implementation'''==&lt;br /&gt;
The following is a rough list of changes that will be required in the code to enable logging of HTTP messages. It includes adding types for HTTP request and response messages to the enum that represents messages exchanged between Servo and the debugger client. An &amp;quot;actor&amp;quot; is created to store the information that will be sent in these messages.&lt;br /&gt;
&lt;br /&gt;
*Add an HTTRequest variant to the DevtoolsControlMsg enum in devtools_traits/lib.rs, containing fields for the target url, the method, headers, and the request body. Use the types that are present in the LoadData struct in components/net/resource_task.rs.&lt;br /&gt;
*Add an HTTPResponse variant to the DevtoolsControlMsg enum containing fields for the response headers, status, and body. Use the same types that are present in the Metadata struct in components/net/resource_task.rs.&lt;br /&gt;
*Make the HTTP loader's load function take an optional Sender&amp;lt;DevtoolsControlMsg&amp;gt;. Use the cookies_chan argument as a model. Send HTTPRequest and HTTPResponse messages using this sender at the appropriate times.&lt;br /&gt;
*Create a NetworkEventActor actor in the devtools crate that stores the request and response information transmitted in the new messages. Add a String field to HTTPRequest and HTTPResponse which contains a unique ID that joins them - see Node::summarize for an example of creating this. Associate the unique IDs with the corresponding NetworkEventActor names via a hashtable.&lt;br /&gt;
*Send the networkEvent message when the HTTPRequest and HTTPResponse messages are received. Use the Firefox devtools code (onNetworkEvent) as a reference.&lt;br /&gt;
*Implement the getRequestHeaders, getRequestCookies, getRequestPostData, getReponseHeaders, getReponseCookies, and getResponseContent messages for NetworkEventActor.&lt;br /&gt;
&lt;br /&gt;
=='''Architecture'''==&lt;br /&gt;
The conceptual architecture of Mozilla Firefox running Gecko is represented in the following figure. This is from Grosskurth and Godfrey, A Reference Architecture for Web Browsers &amp;lt;ref&amp;gt;http://grosskurth.ca/papers/browser-refarch.pdf&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:mozilla_arch.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Component Diagrams===&lt;br /&gt;
Servo is designed to be highly parallel, with many components (rendering, layout, HTML parsing, image decoding, etc.) handled by fine-grained, isolated tasks. &lt;br /&gt;
&lt;br /&gt;
The following figures represent the browser architecture with all these components, and the Servo architecture &amp;lt;ref&amp;gt;http://www.joshmatthews.net/fosdemservo/&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Browser:&lt;br /&gt;
&lt;br /&gt;
[[File:browser_arch.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Servo Architecture:&lt;br /&gt;
&lt;br /&gt;
[[File:servo_arch.jpg]]&lt;br /&gt;
&lt;br /&gt;
=='''Design'''==&lt;br /&gt;
===enum in Rust===&lt;br /&gt;
Enums are datatypes with several alternate representations. A simple enum defines one or more constants with the same data type. In Rust, an enum can have complex variants though, like a struct. For example, consider an enum 'Shape' with variants 'Circle' and 'Triangle' each of which is a struct.&lt;br /&gt;
&lt;br /&gt;
    enum Shape {&lt;br /&gt;
        Circle { center: Point, radius: f64 },&lt;br /&gt;
        Triangle{ vert1: Point, vert2: Point, vert3: Point }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
A variable of type Shape can be resolved to its appropriate variant by using a 'match'.&lt;br /&gt;
&lt;br /&gt;
    fn area(sh: Shape) -&amp;gt; f64 {&lt;br /&gt;
        match sh {&lt;br /&gt;
            Circle(_, size) =&amp;gt; f64::consts::PI * size * size,&lt;br /&gt;
            Rectangle(Point { x, y }, Point { x: x2, y: y2 }) =&amp;gt; (x2 - x) * (y2 - y)&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
The Servo Developers Tools project has a 'DevtoolsControlMsg' enum which is used to instruct the devtools server to update its known actors/state according to changes in the browser. The current project requires the addition of two new variants to the 'DevtoolsControlMsg' enum, namely 'HTTRequest' and 'HTTResponse'.&lt;br /&gt;
&lt;br /&gt;
===Sender and Receiver===&lt;br /&gt;
&lt;br /&gt;
In Rust, a pipe is used for communication between tasks. A pipe is simply a pair of endpoints: one for sending messages and another for receiving messages(Sender and Receiver). The simplest way to create a pipe is to use the channel function to create a (Sender, Receiver) pair. In Rust parlance, a sender is a sending endpoint of a pipe, and a receiver is the receiving endpoint. A simple channel can be created as follows:&lt;br /&gt;
    let (tx, rx) = channel();&lt;br /&gt;
    spawn(proc() {&lt;br /&gt;
        tx.send(10i);&lt;br /&gt;
    });&lt;br /&gt;
    assert_eq!(rx.recv(), 10i);&lt;br /&gt;
&lt;br /&gt;
The sending half of the asynchronous channel type is Struct [https://doc.rust-lang.org/std/sync/mpsc/struct.Sender.html Sender&amp;lt;T&amp;gt;] and the receiving half is the struct [https://doc.rust-lang.org/std/sync/mpsc/struct.Receiver.html Receiver&amp;lt;T&amp;gt;].&lt;br /&gt;
For the purpose of this project, we will be using the channel to send and receive messages. To log the HTTP requests and responses on the console, we can use a variant of the enum 'DevtoolsControlMsg'. This enum is used to send messages to the devtools server to update its actors/state according to changes in the browser. We now add HTTPRequest and HHTpResponse variant to the DevtoolsControlMsg enum. We can now use the HTTP loaders' load function to send the HTTPRequest and HHTPResponse to the main loop in the run_server, where it can be received using a receiver. This is done by adding an argument, Sender&amp;lt;DevtoolsControlMsg&amp;gt; to the load function.&lt;br /&gt;
&lt;br /&gt;
[[File:uml_enum.jpg]]&lt;br /&gt;
&lt;br /&gt;
=='''Design Patterns'''==&lt;br /&gt;
===Actor Model===&lt;br /&gt;
The actor model&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Actor_model&amp;lt;/ref&amp;gt; in computer science is a mathematical model of concurrent computation that treats &amp;quot;actors&amp;quot; as the universal primitives of concurrent computation: in response to a message that it receives, an actor can make local decisions, create more actors, send more messages, and determine how to respond to the next message received.&lt;br /&gt;
&lt;br /&gt;
The Actor model adopts the philosophy that everything is an actor. This is similar to the everything is an object philosophy used by some object-oriented programming languages, but differs in that object-oriented software is typically executed sequentially, while the Actor model is inherently concurrent.&lt;br /&gt;
&lt;br /&gt;
An actor is a computational entity that, in response to a message it receives, can concurrently:&lt;br /&gt;
*send a finite number of messages to other actors;&lt;br /&gt;
*create a finite number of new actors;&lt;br /&gt;
*designate the behavior to be used for the next message it receives.&lt;br /&gt;
 &lt;br /&gt;
Servo uses an actor-based remote devtools server implementation. For the logging of Http requests and responses, we use a NetworkEventActor to store the request and response information transmitted in the new messages. A unique id is used to keep track of a request and its corresponding respond. In the event that a client want more information about a request/response, it can query the server using this unique id. Following is a code snippet showing the structure of the actor and its fields.&lt;br /&gt;
&lt;br /&gt;
struct HttpRequest {&lt;br /&gt;
    url: String,&lt;br /&gt;
    method: Method,&lt;br /&gt;
    headers: Headers,&lt;br /&gt;
    body: Option&amp;lt;Vec&amp;lt;u8&amp;gt;&amp;gt;,&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
struct HttpResponse {&lt;br /&gt;
    headers: Option&amp;lt;Headers&amp;gt;,&lt;br /&gt;
    status: Option&amp;lt;RawStatus&amp;gt;,&lt;br /&gt;
    body: Option&amp;lt;Vec&amp;lt;u8&amp;gt;&amp;gt;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
pub struct NetworkEventActor {&lt;br /&gt;
    pub name: String,&lt;br /&gt;
    request: HttpRequest,&lt;br /&gt;
    response: HttpResponse,&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
=='''UML Diagrams'''==&lt;br /&gt;
===='''Sequence Diagram'''====&lt;br /&gt;
&lt;br /&gt;
[[File:uml_seq1.jpg]]&lt;br /&gt;
&lt;br /&gt;
=='''Proposed Test Cases'''==&lt;br /&gt;
===='''Testing the feature'''====&lt;br /&gt;
The feature added will be tested using the following steps:&lt;br /&gt;
* Build Servo successfully with the changes (./mach build)&lt;br /&gt;
* Run Servo on a web page with the --devtools argument specifying a port number, say 6000 (./mach run [url] --devtools 6000)&lt;br /&gt;
* Open an instance of a recent version Firefox configured with Remote Debugging enabled.&lt;br /&gt;
* Connect to Servo running the web page on port 6000.&lt;br /&gt;
* Enable persistent logs in Settings. Select logging of Net messages from the Console.&lt;br /&gt;
* Navigate to another url from the webpage running Servo.&lt;br /&gt;
* The HTTP request and response messages should be logged on the Console.&lt;br /&gt;
&lt;br /&gt;
===='''Regression Testing'''====&lt;br /&gt;
We want to ensure that everything is in order after we have completed our changes; more importantly, that we have not broken any existing functionality. Mozilla has an automated workflow in place for running tests on pull requests submitted to Servo. Servo has a test suite which runs on every reviewed pull request, via [https://github.com/bors-servo bors-servo] and the buildbot.&lt;br /&gt;
&lt;br /&gt;
After it sees an approval on a reviewed pull requests, bors-servo automatically merges the changes&lt;br /&gt;
&lt;br /&gt;
[[File:bors-servo-merge.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
It starts off running a suite of regression tests, and any failure is reported. It can be issued a retry command once the fixes are in place.&lt;br /&gt;
&lt;br /&gt;
[[File:bors-servo-fail.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
When all tests pass, the changes are successfully merged into master. The following is the set of tests that will be run after the pull request is reviewed:&lt;br /&gt;
&lt;br /&gt;
[[File:bors-servo-success.jpg]]&lt;br /&gt;
&lt;br /&gt;
=='''Reference'''==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Amohanr</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015_M1503_EDTS&amp;diff=97094</id>
		<title>CSC/ECE 517 Spring 2015 M1503 EDTS</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015_M1503_EDTS&amp;diff=97094"/>
		<updated>2015-05-04T16:30:34Z</updated>

		<summary type="html">&lt;p&gt;Amohanr: /* Actor Model */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;font size=&amp;quot;5&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Extending Developer Tools for Servo&amp;lt;/b&amp;gt;&amp;lt;/font&amp;gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
=='''Introduction'''==&lt;br /&gt;
===Rust===&lt;br /&gt;
Rust is a general purpose, [http://en.wikipedia.org/wiki/Programming_paradigm#Multi-paradigm multi-paradigm], compiled programming language developed by [http://en.wikipedia.org/wiki/Mozilla Mozilla] Research. It is designed to be a &amp;quot;safe, concurrent, practical language&amp;quot;, supporting [http://en.wikipedia.org/wiki/Purely_functional pure-functional], [http://en.wikipedia.org/wiki/Actor_model concurrent-actor], [http://en.wikipedia.org/wiki/Procedural_programming imperative-procedural], and object-oriented styles.&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Rust_%28programming_language%29&amp;lt;/ref&amp;gt; Being a modern systems programming language focusing on safety and speed, it accomplishes these goals by being memory safe without using garbage collection.&amp;lt;ref&amp;gt;http://doc.rust-lang.org/nightly/intro.html&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Servo===&lt;br /&gt;
Servo is an experimental project to build a Web browser engine for a new generation of hardware: mobile devices, multi-core processors and high-performance GPUs. With Servo, we are rethinking the browser at every level of the technology stack — from input parsing to page layout to graphics rendering — to optimize for power efficiency and maximum parallelism.&lt;br /&gt;
Servo builds on top of Rust to provide a secure and reliable foundation. Memory safety at the core of the platform ensures a high degree of assurance in the browser’s trusted computing base. 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;
=='''Background'''==&lt;br /&gt;
===Remote Developer Tools===&lt;br /&gt;
&lt;br /&gt;
Firefox supports remote developer tools - ie. communicating with an arbitrary server that implements a protocol for exposing information about web content. You can use the [https://developer.mozilla.org/en-US/docs/Tools Firefox developer tools] on your desktop to debug Web sites and Web apps running in other browsers or runtimes. The other browser might be on the same device as the tools themselves or on a different device, such as a phone connected over USB.&lt;br /&gt;
&lt;br /&gt;
=='''Project Description'''==&lt;br /&gt;
Servo implements a very basic developer tools server that currently supports executing JS remotely and investigating the DOM tree in the document inspector. We want to expand these capabilities by completing previous work that enables remote logging from web content, and add new capabilities to log HTTP requests and responses to allow for easier debugging of network-related problems in Servo.&amp;lt;ref&amp;gt;https://github.com/servo/servo/wiki/More-developer-tools-student-project&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The initial step included changes for enabling remote logging from the [http://developer.mozilla.org/en-US/docs/Tools/Web_Console Web Console] using 'console.log'. This was completed as part of the OSS project (Pull request [http://github.com/servo/servo/pull/5229 here]).&lt;br /&gt;
&lt;br /&gt;
In continuation, the objective of the project is to add support for logging HTTP requests and responses in the Web Console.&lt;br /&gt;
&lt;br /&gt;
=='''Requirement Analysis'''==&lt;br /&gt;
&lt;br /&gt;
To configure Firefox for remote debugging, please follow the instructions on [http://developer.mozilla.org/en-US/docs/Tools/Remote_Debugging/Thunderbird Setting up Firefox]&lt;br /&gt;
&lt;br /&gt;
Alternatively, to just view the Web Console, follow instructions [http://developer.mozilla.org/en-US/docs/Tools/Web_Console here].&lt;br /&gt;
&lt;br /&gt;
As mentioned above, Firefox provides the ability to debug a web page running on a remote server with its Developer Tools. The Message Display pane of the Web Console displays various kinds of messages: &lt;br /&gt;
* HTTP requests&lt;br /&gt;
* JavaScript warnings and errors&lt;br /&gt;
* CSS warnings, errors, and reflow events&lt;br /&gt;
* Security warnings and errors&lt;br /&gt;
* console API calls&lt;br /&gt;
* Input/output messages&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The Message Display pane looks like this:&lt;br /&gt;
&lt;br /&gt;
[[File:web_console_display_pane.jpg]]&lt;br /&gt;
&lt;br /&gt;
Open the Web Console from the Developer menu (or Ctrl+Shift+K) from a version of Firefox with Developer Tools extensions. Navigate to any web page and observe messages on the Web Console (Console tab). You may have to check the Log option under &amp;quot;Net&amp;quot; (the first option in black).&lt;br /&gt;
The log is cleared on every redirection/reload of a page. To avoid this, you can select the &amp;quot;Enable Persistent Logs&amp;quot; option in Settings.&lt;br /&gt;
&lt;br /&gt;
HTTP Requests are logged with lines that looks like this on the Web Console:&lt;br /&gt;
&lt;br /&gt;
[[File:HTTP_console_log.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Clicking on the message brings up a new window that gives more details about the HTTP request and the response.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:network_action_window.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Versions of Firefox in use today use [http://en.wikipedia.org/wiki/Gecko_%28software%29 Gecko] as the browser engine. The Developer Edition of Firefox includes complete support for the latest [https://developer.mozilla.org/en-US/docs/Tools Firefox Developer Tools]&lt;br /&gt;
&lt;br /&gt;
Servo so far implements partial support for Developer Tools, which does not include the logging of HTTP requests as shown above. The goal of this project is to implement capability for logging HTTP requests and responses on the Web Console.&lt;br /&gt;
When we run Servo with our changes on a webpage with the --devtools argument, and connect from an instance of Firefox, we should be able to see the HTTP requests and responses from the server appear on the log in the Web Console.&lt;br /&gt;
&lt;br /&gt;
=='''Implementation'''==&lt;br /&gt;
The following is a rough list of changes that will be required in the code to enable logging of HTTP messages. It includes adding types for HTTP request and response messages to the enum that represents messages exchanged between Servo and the debugger client. An &amp;quot;actor&amp;quot; is created to store the information that will be sent in these messages.&lt;br /&gt;
&lt;br /&gt;
*Add an HTTRequest variant to the DevtoolsControlMsg enum in devtools_traits/lib.rs, containing fields for the target url, the method, headers, and the request body. Use the types that are present in the LoadData struct in components/net/resource_task.rs.&lt;br /&gt;
*Add an HTTPResponse variant to the DevtoolsControlMsg enum containing fields for the response headers, status, and body. Use the same types that are present in the Metadata struct in components/net/resource_task.rs.&lt;br /&gt;
*Make the HTTP loader's load function take an optional Sender&amp;lt;DevtoolsControlMsg&amp;gt;. Use the cookies_chan argument as a model. Send HTTPRequest and HTTPResponse messages using this sender at the appropriate times.&lt;br /&gt;
*Create a NetworkEventActor actor in the devtools crate that stores the request and response information transmitted in the new messages. Add a String field to HTTPRequest and HTTPResponse which contains a unique ID that joins them - see Node::summarize for an example of creating this. Associate the unique IDs with the corresponding NetworkEventActor names via a hashtable.&lt;br /&gt;
*Send the networkEvent message when the HTTPRequest and HTTPResponse messages are received. Use the Firefox devtools code (onNetworkEvent) as a reference.&lt;br /&gt;
*Implement the getRequestHeaders, getRequestCookies, getRequestPostData, getReponseHeaders, getReponseCookies, and getResponseContent messages for NetworkEventActor.&lt;br /&gt;
&lt;br /&gt;
=='''Architecture'''==&lt;br /&gt;
The conceptual architecture of Mozilla Firefox running Gecko is represented in the following figure. This is from Grosskurth and Godfrey, A Reference Architecture for Web Browsers &amp;lt;ref&amp;gt;http://grosskurth.ca/papers/browser-refarch.pdf&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:mozilla_arch.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Component Diagrams===&lt;br /&gt;
Servo is designed to be highly parallel, with many components (rendering, layout, HTML parsing, image decoding, etc.) handled by fine-grained, isolated tasks. &lt;br /&gt;
&lt;br /&gt;
The following figures represent the browser architecture with all these components, and the Servo architecture &amp;lt;ref&amp;gt;http://www.joshmatthews.net/fosdemservo/&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Browser:&lt;br /&gt;
&lt;br /&gt;
[[File:browser_arch.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Servo Architecture:&lt;br /&gt;
&lt;br /&gt;
[[File:servo_arch.jpg]]&lt;br /&gt;
&lt;br /&gt;
=='''Design'''==&lt;br /&gt;
===enum in Rust===&lt;br /&gt;
Enums are datatypes with several alternate representations. A simple enum defines one or more constants with the same data type. In Rust, an enum can have complex variants though, like a struct. For example, consider an enum 'Shape' with variants 'Circle' and 'Triangle' each of which is a struct.&lt;br /&gt;
&lt;br /&gt;
    enum Shape {&lt;br /&gt;
        Circle { center: Point, radius: f64 },&lt;br /&gt;
        Triangle{ vert1: Point, vert2: Point, vert3: Point }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
A variable of type Shape can be resolved to its appropriate variant by using a 'match'.&lt;br /&gt;
&lt;br /&gt;
    fn area(sh: Shape) -&amp;gt; f64 {&lt;br /&gt;
        match sh {&lt;br /&gt;
            Circle(_, size) =&amp;gt; f64::consts::PI * size * size,&lt;br /&gt;
            Rectangle(Point { x, y }, Point { x: x2, y: y2 }) =&amp;gt; (x2 - x) * (y2 - y)&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
The Servo Developers Tools project has a 'DevtoolsControlMsg' enum which is used to instruct the devtools server to update its known actors/state according to changes in the browser. The current project requires the addition of two new variants to the 'DevtoolsControlMsg' enum, namely 'HTTRequest' and 'HTTResponse'.&lt;br /&gt;
&lt;br /&gt;
===Sender and Receiver===&lt;br /&gt;
&lt;br /&gt;
In Rust, a pipe is used for communication between tasks. A pipe is simply a pair of endpoints: one for sending messages and another for receiving messages(Sender and Receiver). The simplest way to create a pipe is to use the channel function to create a (Sender, Receiver) pair. In Rust parlance, a sender is a sending endpoint of a pipe, and a receiver is the receiving endpoint. A simple channel can be created as follows:&lt;br /&gt;
    let (tx, rx) = channel();&lt;br /&gt;
    spawn(proc() {&lt;br /&gt;
        tx.send(10i);&lt;br /&gt;
    });&lt;br /&gt;
    assert_eq!(rx.recv(), 10i);&lt;br /&gt;
&lt;br /&gt;
The sending half of the asynchronous channel type is Struct [https://doc.rust-lang.org/std/sync/mpsc/struct.Sender.html Sender&amp;lt;T&amp;gt;] and the receiving half is the struct [https://doc.rust-lang.org/std/sync/mpsc/struct.Receiver.html Receiver&amp;lt;T&amp;gt;].&lt;br /&gt;
For the purpose of this project, we will be using the channel to send and receive messages. To log the HTTP requests and responses on the console, we can use a variant of the enum 'DevtoolsControlMsg'. This enum is used to send messages to the devtools server to update its actors/state according to changes in the browser. We now add HTTPRequest and HHTpResponse variant to the DevtoolsControlMsg enum. We can now use the HTTP loaders' load function to send the HTTPRequest and HHTPResponse to the main loop in the run_server, where it can be received using a receiver. This is done by adding an argument, Sender&amp;lt;DevtoolsControlMsg&amp;gt; to the load function.&lt;br /&gt;
&lt;br /&gt;
[[File:uml_enum.jpg]]&lt;br /&gt;
&lt;br /&gt;
=='''Design Patterns'''==&lt;br /&gt;
===Actor Model===&lt;br /&gt;
The actor model&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Actor_model&amp;lt;/ref&amp;gt; in computer science is a mathematical model of concurrent computation that treats &amp;quot;actors&amp;quot; as the universal primitives of concurrent computation: in response to a message that it receives, an actor can make local decisions, create more actors, send more messages, and determine how to respond to the next message received.&lt;br /&gt;
&lt;br /&gt;
The Actor model adopts the philosophy that everything is an actor. This is similar to the everything is an object philosophy used by some object-oriented programming languages, but differs in that object-oriented software is typically executed sequentially, while the Actor model is inherently concurrent.&lt;br /&gt;
&lt;br /&gt;
An actor is a computational entity that, in response to a message it receives, can concurrently:&lt;br /&gt;
*send a finite number of messages to other actors;&lt;br /&gt;
*create a finite number of new actors;&lt;br /&gt;
*designate the behavior to be used for the next message it receives.&lt;br /&gt;
 &lt;br /&gt;
Servo uses an actor-based remote devtools server implementation. For the logging of Http requests and responses, we use a NetworkEventActor to store the request and response information transmitted in the new messages. A unique id is used to keep track of a request and its corresponding respond. In the event that a client want more information about a request/response, it can query the server using this unique id. Following is a code snippet showing the structure of the actor and its fields.&lt;br /&gt;
&lt;br /&gt;
=='''UML Diagrams'''==&lt;br /&gt;
===='''Sequence Diagram'''====&lt;br /&gt;
&lt;br /&gt;
[[File:uml_seq1.jpg]]&lt;br /&gt;
&lt;br /&gt;
=='''Proposed Test Cases'''==&lt;br /&gt;
===='''Testing the feature'''====&lt;br /&gt;
The feature added will be tested using the following steps:&lt;br /&gt;
* Build Servo successfully with the changes (./mach build)&lt;br /&gt;
* Run Servo on a web page with the --devtools argument specifying a port number, say 6000 (./mach run [url] --devtools 6000)&lt;br /&gt;
* Open an instance of a recent version Firefox configured with Remote Debugging enabled.&lt;br /&gt;
* Connect to Servo running the web page on port 6000.&lt;br /&gt;
* Enable persistent logs in Settings. Select logging of Net messages from the Console.&lt;br /&gt;
* Navigate to another url from the webpage running Servo.&lt;br /&gt;
* The HTTP request and response messages should be logged on the Console.&lt;br /&gt;
&lt;br /&gt;
===='''Regression Testing'''====&lt;br /&gt;
We want to ensure that everything is in order after we have completed our changes; more importantly, that we have not broken any existing functionality. Mozilla has an automated workflow in place for running tests on pull requests submitted to Servo. Servo has a test suite which runs on every reviewed pull request, via [https://github.com/bors-servo bors-servo] and the buildbot.&lt;br /&gt;
&lt;br /&gt;
After it sees an approval on a reviewed pull requests, bors-servo automatically merges the changes&lt;br /&gt;
&lt;br /&gt;
[[File:bors-servo-merge.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
It starts off running a suite of regression tests, and any failure is reported. It can be issued a retry command once the fixes are in place.&lt;br /&gt;
&lt;br /&gt;
[[File:bors-servo-fail.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
When all tests pass, the changes are successfully merged into master. The following is the set of tests that will be run after the pull request is reviewed:&lt;br /&gt;
&lt;br /&gt;
[[File:bors-servo-success.jpg]]&lt;br /&gt;
&lt;br /&gt;
=='''Reference'''==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Amohanr</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015_M1503_EDTS&amp;diff=96672</id>
		<title>CSC/ECE 517 Spring 2015 M1503 EDTS</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015_M1503_EDTS&amp;diff=96672"/>
		<updated>2015-04-21T19:21:58Z</updated>

		<summary type="html">&lt;p&gt;Amohanr: /* Sender and Receiver */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;font size=&amp;quot;5&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Extending Developer Tools for Servo&amp;lt;/b&amp;gt;&amp;lt;/font&amp;gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
=='''Introduction'''==&lt;br /&gt;
===Rust===&lt;br /&gt;
Rust is a general purpose, [http://en.wikipedia.org/wiki/Programming_paradigm#Multi-paradigm multi-paradigm], compiled programming language developed by [http://en.wikipedia.org/wiki/Mozilla Mozilla] Research. It is designed to be a &amp;quot;safe, concurrent, practical language&amp;quot;, supporting [http://en.wikipedia.org/wiki/Purely_functional pure-functional], [http://en.wikipedia.org/wiki/Actor_model concurrent-actor], [http://en.wikipedia.org/wiki/Procedural_programming imperative-procedural], and object-oriented styles.&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Rust_%28programming_language%29&amp;lt;/ref&amp;gt; Being a modern systems programming language focusing on safety and speed, it accomplishes these goals by being memory safe without using garbage collection.&amp;lt;ref&amp;gt;http://doc.rust-lang.org/nightly/intro.html&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Servo===&lt;br /&gt;
Servo is an experimental project to build a Web browser engine for a new generation of hardware: mobile devices, multi-core processors and high-performance GPUs. With Servo, we are rethinking the browser at every level of the technology stack — from input parsing to page layout to graphics rendering — to optimize for power efficiency and maximum parallelism.&lt;br /&gt;
Servo builds on top of Rust to provide a secure and reliable foundation. Memory safety at the core of the platform ensures a high degree of assurance in the browser’s trusted computing base. 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;
=='''Background'''==&lt;br /&gt;
===Remote Developer Tools===&lt;br /&gt;
&lt;br /&gt;
Firefox supports remote developer tools - ie. communicating with an arbitrary server that implements a protocol for exposing information about web content. You can use the [https://developer.mozilla.org/en-US/docs/Tools Firefox developer tools] on your desktop to debug Web sites and Web apps running in other browsers or runtimes. The other browser might be on the same device as the tools themselves or on a different device, such as a phone connected over USB.&lt;br /&gt;
&lt;br /&gt;
=='''Project Description'''==&lt;br /&gt;
Servo implements a very basic developer tools server that currently supports executing JS remotely and investigating the DOM tree in the document inspector. We want to expand these capabilities by completing previous work that enables remote logging from web content, and add new capabilities to log HTTP requests and responses to allow for easier debugging of network-related problems in Servo.&amp;lt;ref&amp;gt;https://github.com/servo/servo/wiki/More-developer-tools-student-project&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The initial step included changes for enabling remote logging from the [http://developer.mozilla.org/en-US/docs/Tools/Web_Console Web Console] using 'console.log'. This was completed as part of the OSS project (Pull request [http://github.com/servo/servo/pull/5229 here]).&lt;br /&gt;
&lt;br /&gt;
In continuation, the objective of the project is to add support for logging HTTP requests and responses in the Web Console.&lt;br /&gt;
&lt;br /&gt;
=='''Requirement Analysis'''==&lt;br /&gt;
&lt;br /&gt;
To configure Firefox for remote debugging, please follow the instructions on [http://developer.mozilla.org/en-US/docs/Tools/Remote_Debugging/Thunderbird Setting up Firefox]&lt;br /&gt;
&lt;br /&gt;
Alternatively, to just view the Web Console, follow instructions [http://developer.mozilla.org/en-US/docs/Tools/Web_Console here].&lt;br /&gt;
&lt;br /&gt;
As mentioned above, Firefox provides the ability to debug a web page running on a remote server with its Developer Tools. The Message Display pane of the Web Console displays various kinds of messages: &lt;br /&gt;
* HTTP requests&lt;br /&gt;
* JavaScript warnings and errors&lt;br /&gt;
* CSS warnings, errors, and reflow events&lt;br /&gt;
* Security warnings and errors&lt;br /&gt;
* console API calls&lt;br /&gt;
* Input/output messages&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The Message Display pane looks like this:&lt;br /&gt;
&lt;br /&gt;
[[File:web_console_display_pane.jpg]]&lt;br /&gt;
&lt;br /&gt;
Open the Web Console from the Developer menu (or Ctrl+Shift+K) from a version of Firefox with Developer Tools extensions. Navigate to any web page and observe messages on the Web Console (Console tab). You may have to check the Log option under &amp;quot;Net&amp;quot; (the first option in black).&lt;br /&gt;
The log is cleared on every redirection/reload of a page. To avoid this, you can select the &amp;quot;Enable Persistent Logs&amp;quot; option in Settings.&lt;br /&gt;
&lt;br /&gt;
HTTP Requests are logged with lines that looks like this on the Web Console:&lt;br /&gt;
&lt;br /&gt;
[[File:HTTP_console_log.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Clicking on the message brings up a new window that gives more details about the HTTP request and the response.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:network_action_window.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Versions of Firefox in use today use [http://en.wikipedia.org/wiki/Gecko_%28software%29 Gecko] as the browser engine. The Developer Edition of Firefox includes complete support for the latest [https://developer.mozilla.org/en-US/docs/Tools Firefox Developer Tools]&lt;br /&gt;
&lt;br /&gt;
Servo so far implements partial support for Developer Tools, which does not include the logging of HTTP requests as shown above. The goal of this project is to implement capability for logging HTTP requests and responses on the Web Console.&lt;br /&gt;
When we run Servo with our changes on a webpage with the --devtools argument, and connect from an instance of Firefox, we should be able to see the HTTP requests and responses from the server appear on the log in the Web Console.&lt;br /&gt;
&lt;br /&gt;
=='''Implementation'''==&lt;br /&gt;
The following is a rough list of changes that will be required in the code to enable logging of HTTP messages. It includes adding types for HTTP request and response messages to the enum that represents messages exchanged between Servo and the debugger client. An &amp;quot;actor&amp;quot; is created to store the information that will be sent in these messages.&lt;br /&gt;
&lt;br /&gt;
*Add an HTTRequest variant to the DevtoolsControlMsg enum in devtools_traits/lib.rs, containing fields for the target url, the method, headers, and the request body. Use the types that are present in the LoadData struct in components/net/resource_task.rs.&lt;br /&gt;
*Add an HTTPResponse variant to the DevtoolsControlMsg enum containing fields for the response headers, status, and body. Use the same types that are present in the Metadata struct in components/net/resource_task.rs.&lt;br /&gt;
*Make the HTTP loader's load function take an optional Sender&amp;lt;DevtoolsControlMsg&amp;gt;. Use the cookies_chan argument as a model. Send HTTPRequest and HTTPResponse messages using this sender at the appropriate times.&lt;br /&gt;
*Create a NetworkEventActor actor in the devtools crate that stores the request and response information transmitted in the new messages. Add a String field to HTTPRequest and HTTPResponse which contains a unique ID that joins them - see Node::summarize for an example of creating this. Associate the unique IDs with the corresponding NetworkEventActor names via a hashtable.&lt;br /&gt;
*Send the networkEvent message when the HTTPRequest and HTTPResponse messages are received. Use the Firefox devtools code (onNetworkEvent) as a reference.&lt;br /&gt;
*Implement the getRequestHeaders, getRequestCookies, getRequestPostData, getReponseHeaders, getReponseCookies, and getResponseContent messages for NetworkEventActor.&lt;br /&gt;
&lt;br /&gt;
=='''Architecture'''==&lt;br /&gt;
The conceptual architecture of Mozilla Firefox running Gecko is represented in the following figure. This is from Grosskurth and Godfrey, A Reference Architecture for Web Browsers &amp;lt;ref&amp;gt;http://grosskurth.ca/papers/browser-refarch.pdf&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:mozilla_arch.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Component Diagrams===&lt;br /&gt;
Servo is designed to be highly parallel, with many components (rendering, layout, HTML parsing, image decoding, etc.) handled by fine-grained, isolated tasks. &lt;br /&gt;
&lt;br /&gt;
The following figures represent the browser architecture with all these components, and the Servo architecture &amp;lt;ref&amp;gt;http://www.joshmatthews.net/fosdemservo/&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Browser:&lt;br /&gt;
&lt;br /&gt;
[[File:browser_arch.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Servo Architecture:&lt;br /&gt;
&lt;br /&gt;
[[File:servo_arch.jpg]]&lt;br /&gt;
&lt;br /&gt;
=='''Design'''==&lt;br /&gt;
===enum in Rust===&lt;br /&gt;
Enums are datatypes with several alternate representations. A simple enum defines one or more constants with the same data type. In Rust, an enum can have complex variants though, like a struct. For example, consider an enum 'Shape' with variants 'Circle' and 'Triangle' each of which is a struct.&lt;br /&gt;
&lt;br /&gt;
    enum Shape {&lt;br /&gt;
        Circle { center: Point, radius: f64 },&lt;br /&gt;
        Triangle{ vert1: Point, vert2: Point, vert3: Point }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
A variable of type Shape can be resolved to its appropriate variant by using a 'match'.&lt;br /&gt;
&lt;br /&gt;
    fn area(sh: Shape) -&amp;gt; f64 {&lt;br /&gt;
        match sh {&lt;br /&gt;
            Circle(_, size) =&amp;gt; f64::consts::PI * size * size,&lt;br /&gt;
            Rectangle(Point { x, y }, Point { x: x2, y: y2 }) =&amp;gt; (x2 - x) * (y2 - y)&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
The Servo Developers Tools project has a 'DevtoolsControlMsg' enum which is used to instruct the devtools server to update its known actors/state according to changes in the browser. The current project requires the addition of two new variants to the 'DevtoolsControlMsg' enum, namely 'HTTRequest' and 'HTTResponse'.&lt;br /&gt;
&lt;br /&gt;
===Sender and Receiver===&lt;br /&gt;
&lt;br /&gt;
In Rust, a pipe is used for communication between tasks. A pipe is simply a pair of endpoints: one for sending messages and another for receiving messages(Sender and Receiver). The simplest way to create a pipe is to use the channel function to create a (Sender, Receiver) pair. In Rust parlance, a sender is a sending endpoint of a pipe, and a receiver is the receiving endpoint. A simple channel can be created as follows:&lt;br /&gt;
    let (tx, rx) = channel();&lt;br /&gt;
    spawn(proc() {&lt;br /&gt;
        tx.send(10i);&lt;br /&gt;
    });&lt;br /&gt;
    assert_eq!(rx.recv(), 10i);&lt;br /&gt;
&lt;br /&gt;
The sending half of the asynchronous channel type is Struct [https://doc.rust-lang.org/std/sync/mpsc/struct.Sender.html Sender&amp;lt;T&amp;gt;] and the receiving half is the struct [https://doc.rust-lang.org/std/sync/mpsc/struct.Receiver.html Receiver&amp;lt;T&amp;gt;].&lt;br /&gt;
For the purpose of this project, we will be using the channel to send and receive messages. To log the HTTP requests and responses on the console, we can use a variant of the enum 'DevtoolsControlMsg'. This enum is used to send messages to the devtools server to update its actors/state according to changes in the browser. We now add HTTPRequest and HHTpResponse variant to the DevtoolsControlMsg enum. We can now use the HTTP loaders' load function to send the HTTPRequest and HHTPResponse to the main loop in the run_server, where it can be received using a receiver. This is done by adding an argument, Sender&amp;lt;DevtoolsControlMsg&amp;gt; to the load function.&lt;br /&gt;
&lt;br /&gt;
[[File:uml_enum.jpg]]&lt;br /&gt;
&lt;br /&gt;
=='''Design Patterns'''==&lt;br /&gt;
===Actor Model===&lt;br /&gt;
The actor model&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Actor_model&amp;lt;/ref&amp;gt; in computer science is a mathematical model of concurrent computation that treats &amp;quot;actors&amp;quot; as the universal primitives of concurrent computation: in response to a message that it receives, an actor can make local decisions, create more actors, send more messages, and determine how to respond to the next message received.&lt;br /&gt;
&lt;br /&gt;
The Actor model adopts the philosophy that everything is an actor. This is similar to the everything is an object philosophy used by some object-oriented programming languages, but differs in that object-oriented software is typically executed sequentially, while the Actor model is inherently concurrent.&lt;br /&gt;
&lt;br /&gt;
An actor is a computational entity that, in response to a message it receives, can concurrently:&lt;br /&gt;
*send a finite number of messages to other actors;&lt;br /&gt;
*create a finite number of new actors;&lt;br /&gt;
*designate the behavior to be used for the next message it receives.&lt;br /&gt;
&lt;br /&gt;
=='''UML Diagrams'''==&lt;br /&gt;
===='''Sequence Diagram'''====&lt;br /&gt;
&lt;br /&gt;
[[File:uml_seq1.jpg]]&lt;br /&gt;
&lt;br /&gt;
=='''Proposed Test Cases'''==&lt;br /&gt;
===='''Testing the feature'''====&lt;br /&gt;
The feature added will be tested using the following steps:&lt;br /&gt;
* Build Servo successfully with the changes (./mach build)&lt;br /&gt;
* Run Servo on a web page with the --devtools argument specifying a port number, say 6000 (./mach run [url] --devtools 6000)&lt;br /&gt;
* Open an instance of a recent version Firefox configured with Remote Debugging enabled.&lt;br /&gt;
* Connect to Servo running the web page on port 6000.&lt;br /&gt;
* Enable persistent logs in Settings. Select logging of Net messages from the Console.&lt;br /&gt;
* Navigate to another url from the webpage running Servo.&lt;br /&gt;
* The HTTP request and response messages should be logged on the Console.&lt;br /&gt;
&lt;br /&gt;
===='''Regression Testing'''====&lt;br /&gt;
We want to ensure that everything is in order after we have completed our changes; more importantly, that we have not broken any existing functionality. Mozilla has an automated workflow in place for running tests on pull requests submitted to Servo. Servo has a test suite which runs on every reviewed pull request, via [https://github.com/bors-servo bors-servo] and the buildbot.&lt;br /&gt;
&lt;br /&gt;
After it sees an approval on a reviewed pull requests, bors-servo automatically merges the changes&lt;br /&gt;
&lt;br /&gt;
[[File:bors-servo-merge.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
It starts off running a suite of regression tests, and any failure is reported. It can be issued a retry command once the fixes are in place.&lt;br /&gt;
&lt;br /&gt;
[[File:bors-servo-fail.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
When all tests pass, the changes are successfully merged into master. The following is the set of tests that will be run after the pull request is reviewed:&lt;br /&gt;
&lt;br /&gt;
[[File:bors-servo-success.jpg]]&lt;br /&gt;
&lt;br /&gt;
=='''Reference'''==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Amohanr</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015_M1503_EDTS&amp;diff=96671</id>
		<title>CSC/ECE 517 Spring 2015 M1503 EDTS</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015_M1503_EDTS&amp;diff=96671"/>
		<updated>2015-04-21T19:20:12Z</updated>

		<summary type="html">&lt;p&gt;Amohanr: /* Sender */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;font size=&amp;quot;5&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Extending Developer Tools for Servo&amp;lt;/b&amp;gt;&amp;lt;/font&amp;gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
=='''Introduction'''==&lt;br /&gt;
===Rust===&lt;br /&gt;
Rust is a general purpose, [http://en.wikipedia.org/wiki/Programming_paradigm#Multi-paradigm multi-paradigm], compiled programming language developed by [http://en.wikipedia.org/wiki/Mozilla Mozilla] Research. It is designed to be a &amp;quot;safe, concurrent, practical language&amp;quot;, supporting [http://en.wikipedia.org/wiki/Purely_functional pure-functional], [http://en.wikipedia.org/wiki/Actor_model concurrent-actor], [http://en.wikipedia.org/wiki/Procedural_programming imperative-procedural], and object-oriented styles.&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Rust_%28programming_language%29&amp;lt;/ref&amp;gt; Being a modern systems programming language focusing on safety and speed, it accomplishes these goals by being memory safe without using garbage collection.&amp;lt;ref&amp;gt;http://doc.rust-lang.org/nightly/intro.html&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Servo===&lt;br /&gt;
Servo is an experimental project to build a Web browser engine for a new generation of hardware: mobile devices, multi-core processors and high-performance GPUs. With Servo, we are rethinking the browser at every level of the technology stack — from input parsing to page layout to graphics rendering — to optimize for power efficiency and maximum parallelism.&lt;br /&gt;
Servo builds on top of Rust to provide a secure and reliable foundation. Memory safety at the core of the platform ensures a high degree of assurance in the browser’s trusted computing base. 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;
=='''Background'''==&lt;br /&gt;
===Remote Developer Tools===&lt;br /&gt;
&lt;br /&gt;
Firefox supports remote developer tools - ie. communicating with an arbitrary server that implements a protocol for exposing information about web content. You can use the [https://developer.mozilla.org/en-US/docs/Tools Firefox developer tools] on your desktop to debug Web sites and Web apps running in other browsers or runtimes. The other browser might be on the same device as the tools themselves or on a different device, such as a phone connected over USB.&lt;br /&gt;
&lt;br /&gt;
=='''Project Description'''==&lt;br /&gt;
Servo implements a very basic developer tools server that currently supports executing JS remotely and investigating the DOM tree in the document inspector. We want to expand these capabilities by completing previous work that enables remote logging from web content, and add new capabilities to log HTTP requests and responses to allow for easier debugging of network-related problems in Servo.&amp;lt;ref&amp;gt;https://github.com/servo/servo/wiki/More-developer-tools-student-project&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The initial step included changes for enabling remote logging from the [http://developer.mozilla.org/en-US/docs/Tools/Web_Console Web Console] using 'console.log'. This was completed as part of the OSS project (Pull request [http://github.com/servo/servo/pull/5229 here]).&lt;br /&gt;
&lt;br /&gt;
In continuation, the objective of the project is to add support for logging HTTP requests and responses in the Web Console.&lt;br /&gt;
&lt;br /&gt;
=='''Requirement Analysis'''==&lt;br /&gt;
&lt;br /&gt;
To configure Firefox for remote debugging, please follow the instructions on [http://developer.mozilla.org/en-US/docs/Tools/Remote_Debugging/Thunderbird Setting up Firefox]&lt;br /&gt;
&lt;br /&gt;
Alternatively, to just view the Web Console, follow instructions [http://developer.mozilla.org/en-US/docs/Tools/Web_Console here].&lt;br /&gt;
&lt;br /&gt;
As mentioned above, Firefox provides the ability to debug a web page running on a remote server with its Developer Tools. The Message Display pane of the Web Console displays various kinds of messages: &lt;br /&gt;
* HTTP requests&lt;br /&gt;
* JavaScript warnings and errors&lt;br /&gt;
* CSS warnings, errors, and reflow events&lt;br /&gt;
* Security warnings and errors&lt;br /&gt;
* console API calls&lt;br /&gt;
* Input/output messages&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The Message Display pane looks like this:&lt;br /&gt;
&lt;br /&gt;
[[File:web_console_display_pane.jpg]]&lt;br /&gt;
&lt;br /&gt;
Open the Web Console from the Developer menu (or Ctrl+Shift+K) from a version of Firefox with Developer Tools extensions. Navigate to any web page and observe messages on the Web Console (Console tab). You may have to check the Log option under &amp;quot;Net&amp;quot; (the first option in black).&lt;br /&gt;
The log is cleared on every redirection/reload of a page. To avoid this, you can select the &amp;quot;Enable Persistent Logs&amp;quot; option in Settings.&lt;br /&gt;
&lt;br /&gt;
HTTP Requests are logged with lines that looks like this on the Web Console:&lt;br /&gt;
&lt;br /&gt;
[[File:HTTP_console_log.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Clicking on the message brings up a new window that gives more details about the HTTP request and the response.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:network_action_window.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Versions of Firefox in use today use [http://en.wikipedia.org/wiki/Gecko_%28software%29 Gecko] as the browser engine. The Developer Edition of Firefox includes complete support for the latest [https://developer.mozilla.org/en-US/docs/Tools Firefox Developer Tools]&lt;br /&gt;
&lt;br /&gt;
Servo so far implements partial support for Developer Tools, which does not include the logging of HTTP requests as shown above. The goal of this project is to implement capability for logging HTTP requests and responses on the Web Console.&lt;br /&gt;
When we run Servo with our changes on a webpage with the --devtools argument, and connect from an instance of Firefox, we should be able to see the HTTP requests and responses from the server appear on the log in the Web Console.&lt;br /&gt;
&lt;br /&gt;
=='''Implementation'''==&lt;br /&gt;
The following is a rough list of changes that will be required in the code to enable logging of HTTP messages. It includes adding types for HTTP request and response messages to the enum that represents messages exchanged between Servo and the debugger client. An &amp;quot;actor&amp;quot; is created to store the information that will be sent in these messages.&lt;br /&gt;
&lt;br /&gt;
*Add an HTTRequest variant to the DevtoolsControlMsg enum in devtools_traits/lib.rs, containing fields for the target url, the method, headers, and the request body. Use the types that are present in the LoadData struct in components/net/resource_task.rs.&lt;br /&gt;
*Add an HTTPResponse variant to the DevtoolsControlMsg enum containing fields for the response headers, status, and body. Use the same types that are present in the Metadata struct in components/net/resource_task.rs.&lt;br /&gt;
*Make the HTTP loader's load function take an optional Sender&amp;lt;DevtoolsControlMsg&amp;gt;. Use the cookies_chan argument as a model. Send HTTPRequest and HTTPResponse messages using this sender at the appropriate times.&lt;br /&gt;
*Create a NetworkEventActor actor in the devtools crate that stores the request and response information transmitted in the new messages. Add a String field to HTTPRequest and HTTPResponse which contains a unique ID that joins them - see Node::summarize for an example of creating this. Associate the unique IDs with the corresponding NetworkEventActor names via a hashtable.&lt;br /&gt;
*Send the networkEvent message when the HTTPRequest and HTTPResponse messages are received. Use the Firefox devtools code (onNetworkEvent) as a reference.&lt;br /&gt;
*Implement the getRequestHeaders, getRequestCookies, getRequestPostData, getReponseHeaders, getReponseCookies, and getResponseContent messages for NetworkEventActor.&lt;br /&gt;
&lt;br /&gt;
=='''Architecture'''==&lt;br /&gt;
The conceptual architecture of Mozilla Firefox running Gecko is represented in the following figure. This is from Grosskurth and Godfrey, A Reference Architecture for Web Browsers &amp;lt;ref&amp;gt;http://grosskurth.ca/papers/browser-refarch.pdf&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:mozilla_arch.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Component Diagrams===&lt;br /&gt;
Servo is designed to be highly parallel, with many components (rendering, layout, HTML parsing, image decoding, etc.) handled by fine-grained, isolated tasks. &lt;br /&gt;
&lt;br /&gt;
The following figures represent the browser architecture with all these components, and the Servo architecture &amp;lt;ref&amp;gt;http://www.joshmatthews.net/fosdemservo/&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Browser:&lt;br /&gt;
&lt;br /&gt;
[[File:browser_arch.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Servo Architecture:&lt;br /&gt;
&lt;br /&gt;
[[File:servo_arch.jpg]]&lt;br /&gt;
&lt;br /&gt;
=='''Design'''==&lt;br /&gt;
===enum in Rust===&lt;br /&gt;
Enums are datatypes with several alternate representations. A simple enum defines one or more constants with the same data type. In Rust, an enum can have complex variants though, like a struct. For example, consider an enum 'Shape' with variants 'Circle' and 'Triangle' each of which is a struct.&lt;br /&gt;
&lt;br /&gt;
    enum Shape {&lt;br /&gt;
        Circle { center: Point, radius: f64 },&lt;br /&gt;
        Triangle{ vert1: Point, vert2: Point, vert3: Point }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
A variable of type Shape can be resolved to its appropriate variant by using a 'match'.&lt;br /&gt;
&lt;br /&gt;
    fn area(sh: Shape) -&amp;gt; f64 {&lt;br /&gt;
        match sh {&lt;br /&gt;
            Circle(_, size) =&amp;gt; f64::consts::PI * size * size,&lt;br /&gt;
            Rectangle(Point { x, y }, Point { x: x2, y: y2 }) =&amp;gt; (x2 - x) * (y2 - y)&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
The Servo Developers Tools project has a 'DevtoolsControlMsg' enum which is used to instruct the devtools server to update its known actors/state according to changes in the browser. The current project requires the addition of two new variants to the 'DevtoolsControlMsg' enum, namely 'HTTRequest' and 'HTTResponse'.&lt;br /&gt;
&lt;br /&gt;
===Sender and Receiver===&lt;br /&gt;
&lt;br /&gt;
In Rust, a pipe is used for communication between tasks. A pipe is simply a pair of endpoints: one for sending messages and another for receiving messages(Sender and Receiver). The simplest way to create a pipe is to use the channel function to create a (Sender, Receiver) pair. In Rust parlance, a sender is a sending endpoint of a pipe, and a receiver is the receiving endpoint. A simple channel can be created as follows:&lt;br /&gt;
    let (tx, rx) = channel();&lt;br /&gt;
    spawn(proc() {&lt;br /&gt;
        tx.send(10i);&lt;br /&gt;
    });&lt;br /&gt;
    assert_eq!(rx.recv(), 10i);&lt;br /&gt;
&lt;br /&gt;
The sending half of the asynchronous channel type is Struct Sender&amp;lt;T&amp;gt; and the receiving half is the struct Receiver&amp;lt;T&amp;gt;&lt;br /&gt;
For the purpose of this project, we will be using the channel to send and receive messages. To log the HTTP requests and responses on the console, we can use a variant of the enum 'DevtoolsControlMsg'. This enum is used to send messages to the devtools server to update its actors/state according to changes in the browser. We now add HTTPRequest and HHTpResponse variant to the DevtoolsControlMsg enum. We can now use the HTTP loaders' load function to send the HTTPRequest and HHTPResponse to the main loop in the run_server, where it can be received using a receiver. This is done by adding an argument, Sender&amp;lt;DevtoolsControlMsg&amp;gt; to the load function.&lt;br /&gt;
&lt;br /&gt;
[[File:uml_enum.jpg]]&lt;br /&gt;
&lt;br /&gt;
=='''Design Patterns'''==&lt;br /&gt;
===Actor Model===&lt;br /&gt;
The actor model&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Actor_model&amp;lt;/ref&amp;gt; in computer science is a mathematical model of concurrent computation that treats &amp;quot;actors&amp;quot; as the universal primitives of concurrent computation: in response to a message that it receives, an actor can make local decisions, create more actors, send more messages, and determine how to respond to the next message received.&lt;br /&gt;
&lt;br /&gt;
The Actor model adopts the philosophy that everything is an actor. This is similar to the everything is an object philosophy used by some object-oriented programming languages, but differs in that object-oriented software is typically executed sequentially, while the Actor model is inherently concurrent.&lt;br /&gt;
&lt;br /&gt;
An actor is a computational entity that, in response to a message it receives, can concurrently:&lt;br /&gt;
*send a finite number of messages to other actors;&lt;br /&gt;
*create a finite number of new actors;&lt;br /&gt;
*designate the behavior to be used for the next message it receives.&lt;br /&gt;
&lt;br /&gt;
=='''UML Diagrams'''==&lt;br /&gt;
===='''Sequence Diagram'''====&lt;br /&gt;
&lt;br /&gt;
[[File:uml_seq1.jpg]]&lt;br /&gt;
&lt;br /&gt;
=='''Proposed Test Cases'''==&lt;br /&gt;
===='''Testing the feature'''====&lt;br /&gt;
The feature added will be tested using the following steps:&lt;br /&gt;
* Build Servo successfully with the changes (./mach build)&lt;br /&gt;
* Run Servo on a web page with the --devtools argument specifying a port number, say 6000 (./mach run [url] --devtools 6000)&lt;br /&gt;
* Open an instance of a recent version Firefox configured with Remote Debugging enabled.&lt;br /&gt;
* Connect to Servo running the web page on port 6000.&lt;br /&gt;
* Enable persistent logs in Settings. Select logging of Net messages from the Console.&lt;br /&gt;
* Navigate to another url from the webpage running Servo.&lt;br /&gt;
* The HTTP request and response messages should be logged on the Console.&lt;br /&gt;
&lt;br /&gt;
===='''Regression Testing'''====&lt;br /&gt;
We want to ensure that everything is in order after we have completed our changes; more importantly, that we have not broken any existing functionality. Mozilla has an automated workflow in place for running tests on pull requests submitted to Servo. Servo has a test suite which runs on every reviewed pull request, via [https://github.com/bors-servo bors-servo] and the buildbot.&lt;br /&gt;
&lt;br /&gt;
After it sees an approval on a reviewed pull requests, bors-servo automatically merges the changes&lt;br /&gt;
&lt;br /&gt;
[[File:bors-servo-merge.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
It starts off running a suite of regression tests, and any failure is reported. It can be issued a retry command once the fixes are in place.&lt;br /&gt;
&lt;br /&gt;
[[File:bors-servo-fail.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
When all tests pass, the changes are successfully merged into master. The following is the set of tests that will be run after the pull request is reviewed:&lt;br /&gt;
&lt;br /&gt;
[[File:bors-servo-success.jpg]]&lt;br /&gt;
&lt;br /&gt;
=='''Reference'''==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Amohanr</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015_M1503_EDTS&amp;diff=96421</id>
		<title>CSC/ECE 517 Spring 2015 M1503 EDTS</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015_M1503_EDTS&amp;diff=96421"/>
		<updated>2015-04-01T21:16:45Z</updated>

		<summary type="html">&lt;p&gt;Amohanr: /* Implementation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;font size=&amp;quot;5&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Extending Developer Tools for Servo&amp;lt;/b&amp;gt;&amp;lt;/font&amp;gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
=='''Introduction'''==&lt;br /&gt;
===Rust===&lt;br /&gt;
Rust is a general purpose, [http://en.wikipedia.org/wiki/Programming_paradigm#Multi-paradigm multi-paradigm], compiled programming language developed by [http://en.wikipedia.org/wiki/Mozilla Mozilla] Research. It is designed to be a &amp;quot;safe, concurrent, practical language&amp;quot;, supporting [http://en.wikipedia.org/wiki/Purely_functional pure-functional], [http://en.wikipedia.org/wiki/Actor_model concurrent-actor], [http://en.wikipedia.org/wiki/Procedural_programming imperative-procedural], and object-oriented styles.&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Rust_%28programming_language%29&amp;lt;/ref&amp;gt; Being a modern systems programming language focusing on safety and speed, it accomplishes these goals by being memory safe without using garbage collection.&amp;lt;ref&amp;gt;http://doc.rust-lang.org/nightly/intro.html&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Servo===&lt;br /&gt;
Servo is an experimental project to build a Web browser engine for a new generation of hardware: mobile devices, multi-core processors and high-performance GPUs. With Servo, we are rethinking the browser at every level of the technology stack — from input parsing to page layout to graphics rendering — to optimize for power efficiency and maximum parallelism.&lt;br /&gt;
Servo builds on top of Rust to provide a secure and reliable foundation. Memory safety at the core of the platform ensures a high degree of assurance in the browser’s trusted computing base. 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;
=='''Background'''==&lt;br /&gt;
===Remote Developer Tools===&lt;br /&gt;
&lt;br /&gt;
Firefox supports remote developer tools - ie. communicating with an arbitrary server that implements a protocol for exposing information about web content. You can use the [https://developer.mozilla.org/en-US/docs/Tools Firefox developer tools] on your desktop to debug Web sites and Web apps running in other browsers or runtimes. The other browser might be on the same device as the tools themselves or on a different device, such as a phone connected over USB.&lt;br /&gt;
&lt;br /&gt;
=='''Project Description'''==&lt;br /&gt;
Servo implements a very basic developer tools server that currently supports executing JS remotely and investigating the DOM tree in the document inspector. We want to expand these capabilities by completing previous work that enables remote logging from web content, and add new capabilities to log HTTP requests and responses to allow for easier debugging of network-related problems in Servo.&amp;lt;ref&amp;gt;https://github.com/servo/servo/wiki/More-developer-tools-student-project&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Requirement Analysis'''==&lt;br /&gt;
=='''Implementation'''==&lt;br /&gt;
*Add an HTTRequest variant to the DevtoolsControlMsg enum in devtools_traits/lib.rs, containing fields for the target url, the method, headers, and the request body. Use the types that are present in the LoadData struct in components/net/resource_task.rs.&lt;br /&gt;
*Add an HTTPResponse variant to the DevtoolsControlMsg enum containing fields for the response headers, status, and body. Use the same types that are present in the Metadata struct in components/net/resource_task.rs.&lt;br /&gt;
*Make the HTTP loader's load function take an optional Sender&amp;lt;DevtoolsControlMsg&amp;gt;. Use the cookies_chan argument as a model. Send HTTPRequest and HTTPResponse messages using this sender at the appropriate times.&lt;br /&gt;
*Create a NetworkEventActor actor in the devtools crate that stores the request and response information transmitted in the new messages. Add a String field to HTTPRequest and HTTPResponse which contains a unique ID that joins them - see Node::summarize for an example of creating this. Associate the unique IDs with the corresponding NetworkEventActor names via a hashtable.&lt;br /&gt;
*Send the networkEvent message when the HTTPRequest and HTTPResponse messages are received. Use the Firefox devtools code (onNetworkEvent) as a reference.&lt;br /&gt;
*Implement the getRequestHeaders, getRequestCookies, getRequestPostData, getReponseHeaders, getReponseCookies, and getResponseContent messages for NetworkEventActor.&lt;br /&gt;
&lt;br /&gt;
=='''Architecture'''==&lt;br /&gt;
&lt;br /&gt;
===enum===&lt;br /&gt;
Enums are datatypes with several alternate representations. A simple enum defines one or more constants with the same data type. In Rust, an enum can have complex variants though, like a struct. For example, consider an enum 'Shape' with variants 'Circle' and 'Triangle' each of which is a struct.&lt;br /&gt;
&lt;br /&gt;
    enum Shape {&lt;br /&gt;
        Circle { center: Point, radius: f64 },&lt;br /&gt;
        Triangle{ vert1: Point, vert2: Point, vert3: Point }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
A variable of type Shape can be resolved to its appropriate variant by using a 'match'.&lt;br /&gt;
&lt;br /&gt;
    fn area(sh: Shape) -&amp;gt; f64 {&lt;br /&gt;
        match sh {&lt;br /&gt;
            Circle(_, size) =&amp;gt; f64::consts::PI * size * size,&lt;br /&gt;
            Rectangle(Point { x, y }, Point { x: x2, y: y2 }) =&amp;gt; (x2 - x) * (y2 - y)&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
The Servo Developers Tools project has a 'DevtoolsControlMsg' enum which is used to instruct the devtools server to update its known actors/state according to changes in the browser. The current project requires the addition of two new variants to the 'DevtoolsControlMsg' enum, namely 'HTTRequest' and 'HTTResponse'.&lt;br /&gt;
&lt;br /&gt;
===Sender&amp;lt;DevtoolsControlMsg&amp;gt;===&lt;br /&gt;
&lt;br /&gt;
In Rust, a pipe is used for communication between tasks. A pipe is simply a pair of endpoints: one for sending messages and another for receiving messages(Sender and Receiver). The simplest way to create a pipe is to use the channel function to create a (Sender, Receiver) pair. In Rust parlance, a sender is a sending endpoint of a pipe, and a receiver is the receiving endpoint. A simple channel can be created as follows:&lt;br /&gt;
    let (tx, rx) = channel();&lt;br /&gt;
    spawn(proc() {&lt;br /&gt;
        tx.send(10i);&lt;br /&gt;
    });&lt;br /&gt;
    assert_eq!(rx.recv(), 10i);&lt;br /&gt;
In this project, whenever a HTTPRequest or a HTTPResponse is received, we are going to send a new message using a 'Sender' object that could send variants of the type 'DevtoolsControlMsg'. This 'Sender&amp;lt;DevtoolsControlMsg&amp;gt;' objects sends the messages at appropriate times in the HTTPLoader function.&lt;br /&gt;
&lt;br /&gt;
===NetworkEventActor===&lt;br /&gt;
&lt;br /&gt;
=='''Design Patterns'''==&lt;br /&gt;
===Actor Model&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Actor_model&amp;lt;/ref&amp;gt;===&lt;br /&gt;
The actor model in computer science is a mathematical model of concurrent computation that treats &amp;quot;actors&amp;quot; as the universal primitives of concurrent computation: in response to a message that it receives, an actor can make local decisions, create more actors, send more messages, and determine how to respond to the next message received.&lt;br /&gt;
&lt;br /&gt;
The Actor model adopts the philosophy that everything is an actor. This is similar to the everything is an object philosophy used by some object-oriented programming languages, but differs in that object-oriented software is typically executed sequentially, while the Actor model is inherently concurrent.&lt;br /&gt;
&lt;br /&gt;
An actor is a computational entity that, in response to a message it receives, can concurrently:&lt;br /&gt;
*send a finite number of messages to other actors;&lt;br /&gt;
*create a finite number of new actors;&lt;br /&gt;
*designate the behavior to be used for the next message it receives.&lt;br /&gt;
&lt;br /&gt;
=='''UML Diagrams'''==&lt;br /&gt;
=='''Proposed Test Cases'''==&lt;br /&gt;
&lt;br /&gt;
=='''Reference'''==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Amohanr</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015_M1503_EDTS&amp;diff=96420</id>
		<title>CSC/ECE 517 Spring 2015 M1503 EDTS</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015_M1503_EDTS&amp;diff=96420"/>
		<updated>2015-04-01T21:05:45Z</updated>

		<summary type="html">&lt;p&gt;Amohanr: /* Project Description */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;font size=&amp;quot;5&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Extending Developer Tools for Servo&amp;lt;/b&amp;gt;&amp;lt;/font&amp;gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
=='''Introduction'''==&lt;br /&gt;
===Rust===&lt;br /&gt;
Rust is a general purpose, [http://en.wikipedia.org/wiki/Programming_paradigm#Multi-paradigm multi-paradigm], compiled programming language developed by [http://en.wikipedia.org/wiki/Mozilla Mozilla] Research. It is designed to be a &amp;quot;safe, concurrent, practical language&amp;quot;, supporting [http://en.wikipedia.org/wiki/Purely_functional pure-functional], [http://en.wikipedia.org/wiki/Actor_model concurrent-actor], [http://en.wikipedia.org/wiki/Procedural_programming imperative-procedural], and object-oriented styles.&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Rust_%28programming_language%29&amp;lt;/ref&amp;gt; Being a modern systems programming language focusing on safety and speed, it accomplishes these goals by being memory safe without using garbage collection.&amp;lt;ref&amp;gt;http://doc.rust-lang.org/nightly/intro.html&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Servo===&lt;br /&gt;
Servo is an experimental project to build a Web browser engine for a new generation of hardware: mobile devices, multi-core processors and high-performance GPUs. With Servo, we are rethinking the browser at every level of the technology stack — from input parsing to page layout to graphics rendering — to optimize for power efficiency and maximum parallelism.&lt;br /&gt;
Servo builds on top of Rust to provide a secure and reliable foundation. Memory safety at the core of the platform ensures a high degree of assurance in the browser’s trusted computing base. 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;
=='''Background'''==&lt;br /&gt;
===Remote Developer Tools===&lt;br /&gt;
&lt;br /&gt;
Firefox supports remote developer tools - ie. communicating with an arbitrary server that implements a protocol for exposing information about web content. You can use the [https://developer.mozilla.org/en-US/docs/Tools Firefox developer tools] on your desktop to debug Web sites and Web apps running in other browsers or runtimes. The other browser might be on the same device as the tools themselves or on a different device, such as a phone connected over USB.&lt;br /&gt;
&lt;br /&gt;
=='''Project Description'''==&lt;br /&gt;
Servo implements a very basic developer tools server that currently supports executing JS remotely and investigating the DOM tree in the document inspector. We want to expand these capabilities by completing previous work that enables remote logging from web content, and add new capabilities to log HTTP requests and responses to allow for easier debugging of network-related problems in Servo.&amp;lt;ref&amp;gt;https://github.com/servo/servo/wiki/More-developer-tools-student-project&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Requirement Analysis'''==&lt;br /&gt;
=='''Implementation'''==&lt;br /&gt;
=='''Architecture'''==&lt;br /&gt;
&lt;br /&gt;
===enum===&lt;br /&gt;
Enums are datatypes with several alternate representations. A simple enum defines one or more constants with the same data type. In Rust, an enum can have complex variants though, like a struct. For example, consider an enum 'Shape' with variants 'Circle' and 'Triangle' each of which is a struct.&lt;br /&gt;
&lt;br /&gt;
    enum Shape {&lt;br /&gt;
        Circle { center: Point, radius: f64 },&lt;br /&gt;
        Triangle{ vert1: Point, vert2: Point, vert3: Point }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
A variable of type Shape can be resolved to its appropriate variant by using a 'match'.&lt;br /&gt;
&lt;br /&gt;
    fn area(sh: Shape) -&amp;gt; f64 {&lt;br /&gt;
        match sh {&lt;br /&gt;
            Circle(_, size) =&amp;gt; f64::consts::PI * size * size,&lt;br /&gt;
            Rectangle(Point { x, y }, Point { x: x2, y: y2 }) =&amp;gt; (x2 - x) * (y2 - y)&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
The Servo Developers Tools project has a 'DevtoolsControlMsg' enum which is used to instruct the devtools server to update its known actors/state according to changes in the browser. The current project requires the addition of two new variants to the 'DevtoolsControlMsg' enum, namely 'HTTRequest' and 'HTTResponse'.&lt;br /&gt;
&lt;br /&gt;
===Sender&amp;lt;DevtoolsControlMsg&amp;gt;===&lt;br /&gt;
&lt;br /&gt;
In Rust, a pipe is used for communication between tasks. A pipe is simply a pair of endpoints: one for sending messages and another for receiving messages(Sender and Receiver). The simplest way to create a pipe is to use the channel function to create a (Sender, Receiver) pair. In Rust parlance, a sender is a sending endpoint of a pipe, and a receiver is the receiving endpoint. A simple channel can be created as follows:&lt;br /&gt;
    let (tx, rx) = channel();&lt;br /&gt;
    spawn(proc() {&lt;br /&gt;
        tx.send(10i);&lt;br /&gt;
    });&lt;br /&gt;
    assert_eq!(rx.recv(), 10i);&lt;br /&gt;
In this project, whenever a HTTPRequest or a HTTPResponse is received, we are going to send a new message using a 'Sender' object that could send variants of the type 'DevtoolsControlMsg'. This 'Sender&amp;lt;DevtoolsControlMsg&amp;gt;' objects sends the messages at appropriate times in the HTTPLoader function.&lt;br /&gt;
&lt;br /&gt;
===NetworkEventActor===&lt;br /&gt;
&lt;br /&gt;
=='''Design Patterns'''==&lt;br /&gt;
===Actor Model&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Actor_model&amp;lt;/ref&amp;gt;===&lt;br /&gt;
The actor model in computer science is a mathematical model of concurrent computation that treats &amp;quot;actors&amp;quot; as the universal primitives of concurrent computation: in response to a message that it receives, an actor can make local decisions, create more actors, send more messages, and determine how to respond to the next message received.&lt;br /&gt;
&lt;br /&gt;
The Actor model adopts the philosophy that everything is an actor. This is similar to the everything is an object philosophy used by some object-oriented programming languages, but differs in that object-oriented software is typically executed sequentially, while the Actor model is inherently concurrent.&lt;br /&gt;
&lt;br /&gt;
An actor is a computational entity that, in response to a message it receives, can concurrently:&lt;br /&gt;
*send a finite number of messages to other actors;&lt;br /&gt;
*create a finite number of new actors;&lt;br /&gt;
*designate the behavior to be used for the next message it receives.&lt;br /&gt;
&lt;br /&gt;
=='''UML Diagrams'''==&lt;br /&gt;
=='''Proposed Test Cases'''==&lt;br /&gt;
&lt;br /&gt;
=='''Reference'''==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Amohanr</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015_M1503_EDTS&amp;diff=96419</id>
		<title>CSC/ECE 517 Spring 2015 M1503 EDTS</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015_M1503_EDTS&amp;diff=96419"/>
		<updated>2015-04-01T21:05:35Z</updated>

		<summary type="html">&lt;p&gt;Amohanr: /* Remote Developer Tools */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;font size=&amp;quot;5&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Extending Developer Tools for Servo&amp;lt;/b&amp;gt;&amp;lt;/font&amp;gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
=='''Introduction'''==&lt;br /&gt;
===Rust===&lt;br /&gt;
Rust is a general purpose, [http://en.wikipedia.org/wiki/Programming_paradigm#Multi-paradigm multi-paradigm], compiled programming language developed by [http://en.wikipedia.org/wiki/Mozilla Mozilla] Research. It is designed to be a &amp;quot;safe, concurrent, practical language&amp;quot;, supporting [http://en.wikipedia.org/wiki/Purely_functional pure-functional], [http://en.wikipedia.org/wiki/Actor_model concurrent-actor], [http://en.wikipedia.org/wiki/Procedural_programming imperative-procedural], and object-oriented styles.&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Rust_%28programming_language%29&amp;lt;/ref&amp;gt; Being a modern systems programming language focusing on safety and speed, it accomplishes these goals by being memory safe without using garbage collection.&amp;lt;ref&amp;gt;http://doc.rust-lang.org/nightly/intro.html&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Servo===&lt;br /&gt;
Servo is an experimental project to build a Web browser engine for a new generation of hardware: mobile devices, multi-core processors and high-performance GPUs. With Servo, we are rethinking the browser at every level of the technology stack — from input parsing to page layout to graphics rendering — to optimize for power efficiency and maximum parallelism.&lt;br /&gt;
Servo builds on top of Rust to provide a secure and reliable foundation. Memory safety at the core of the platform ensures a high degree of assurance in the browser’s trusted computing base. 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;
=='''Background'''==&lt;br /&gt;
===Remote Developer Tools===&lt;br /&gt;
&lt;br /&gt;
Firefox supports remote developer tools - ie. communicating with an arbitrary server that implements a protocol for exposing information about web content. You can use the [https://developer.mozilla.org/en-US/docs/Tools Firefox developer tools] on your desktop to debug Web sites and Web apps running in other browsers or runtimes. The other browser might be on the same device as the tools themselves or on a different device, such as a phone connected over USB.&lt;br /&gt;
&lt;br /&gt;
=='''Project Description'''==&lt;br /&gt;
=='''Requirement Analysis'''==&lt;br /&gt;
=='''Implementation'''==&lt;br /&gt;
=='''Architecture'''==&lt;br /&gt;
&lt;br /&gt;
===enum===&lt;br /&gt;
Enums are datatypes with several alternate representations. A simple enum defines one or more constants with the same data type. In Rust, an enum can have complex variants though, like a struct. For example, consider an enum 'Shape' with variants 'Circle' and 'Triangle' each of which is a struct.&lt;br /&gt;
&lt;br /&gt;
    enum Shape {&lt;br /&gt;
        Circle { center: Point, radius: f64 },&lt;br /&gt;
        Triangle{ vert1: Point, vert2: Point, vert3: Point }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
A variable of type Shape can be resolved to its appropriate variant by using a 'match'.&lt;br /&gt;
&lt;br /&gt;
    fn area(sh: Shape) -&amp;gt; f64 {&lt;br /&gt;
        match sh {&lt;br /&gt;
            Circle(_, size) =&amp;gt; f64::consts::PI * size * size,&lt;br /&gt;
            Rectangle(Point { x, y }, Point { x: x2, y: y2 }) =&amp;gt; (x2 - x) * (y2 - y)&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
The Servo Developers Tools project has a 'DevtoolsControlMsg' enum which is used to instruct the devtools server to update its known actors/state according to changes in the browser. The current project requires the addition of two new variants to the 'DevtoolsControlMsg' enum, namely 'HTTRequest' and 'HTTResponse'.&lt;br /&gt;
&lt;br /&gt;
===Sender&amp;lt;DevtoolsControlMsg&amp;gt;===&lt;br /&gt;
&lt;br /&gt;
In Rust, a pipe is used for communication between tasks. A pipe is simply a pair of endpoints: one for sending messages and another for receiving messages(Sender and Receiver). The simplest way to create a pipe is to use the channel function to create a (Sender, Receiver) pair. In Rust parlance, a sender is a sending endpoint of a pipe, and a receiver is the receiving endpoint. A simple channel can be created as follows:&lt;br /&gt;
    let (tx, rx) = channel();&lt;br /&gt;
    spawn(proc() {&lt;br /&gt;
        tx.send(10i);&lt;br /&gt;
    });&lt;br /&gt;
    assert_eq!(rx.recv(), 10i);&lt;br /&gt;
In this project, whenever a HTTPRequest or a HTTPResponse is received, we are going to send a new message using a 'Sender' object that could send variants of the type 'DevtoolsControlMsg'. This 'Sender&amp;lt;DevtoolsControlMsg&amp;gt;' objects sends the messages at appropriate times in the HTTPLoader function.&lt;br /&gt;
&lt;br /&gt;
===NetworkEventActor===&lt;br /&gt;
&lt;br /&gt;
=='''Design Patterns'''==&lt;br /&gt;
===Actor Model&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Actor_model&amp;lt;/ref&amp;gt;===&lt;br /&gt;
The actor model in computer science is a mathematical model of concurrent computation that treats &amp;quot;actors&amp;quot; as the universal primitives of concurrent computation: in response to a message that it receives, an actor can make local decisions, create more actors, send more messages, and determine how to respond to the next message received.&lt;br /&gt;
&lt;br /&gt;
The Actor model adopts the philosophy that everything is an actor. This is similar to the everything is an object philosophy used by some object-oriented programming languages, but differs in that object-oriented software is typically executed sequentially, while the Actor model is inherently concurrent.&lt;br /&gt;
&lt;br /&gt;
An actor is a computational entity that, in response to a message it receives, can concurrently:&lt;br /&gt;
*send a finite number of messages to other actors;&lt;br /&gt;
*create a finite number of new actors;&lt;br /&gt;
*designate the behavior to be used for the next message it receives.&lt;br /&gt;
&lt;br /&gt;
=='''UML Diagrams'''==&lt;br /&gt;
=='''Proposed Test Cases'''==&lt;br /&gt;
&lt;br /&gt;
=='''Reference'''==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Amohanr</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015_M1503_EDTS&amp;diff=96418</id>
		<title>CSC/ECE 517 Spring 2015 M1503 EDTS</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015_M1503_EDTS&amp;diff=96418"/>
		<updated>2015-04-01T21:04:07Z</updated>

		<summary type="html">&lt;p&gt;Amohanr: /* Actor Model */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;font size=&amp;quot;5&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Extending Developer Tools for Servo&amp;lt;/b&amp;gt;&amp;lt;/font&amp;gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
=='''Introduction'''==&lt;br /&gt;
===Rust===&lt;br /&gt;
Rust is a general purpose, [http://en.wikipedia.org/wiki/Programming_paradigm#Multi-paradigm multi-paradigm], compiled programming language developed by [http://en.wikipedia.org/wiki/Mozilla Mozilla] Research. It is designed to be a &amp;quot;safe, concurrent, practical language&amp;quot;, supporting [http://en.wikipedia.org/wiki/Purely_functional pure-functional], [http://en.wikipedia.org/wiki/Actor_model concurrent-actor], [http://en.wikipedia.org/wiki/Procedural_programming imperative-procedural], and object-oriented styles.&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Rust_%28programming_language%29&amp;lt;/ref&amp;gt; Being a modern systems programming language focusing on safety and speed, it accomplishes these goals by being memory safe without using garbage collection.&amp;lt;ref&amp;gt;http://doc.rust-lang.org/nightly/intro.html&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Servo===&lt;br /&gt;
Servo is an experimental project to build a Web browser engine for a new generation of hardware: mobile devices, multi-core processors and high-performance GPUs. With Servo, we are rethinking the browser at every level of the technology stack — from input parsing to page layout to graphics rendering — to optimize for power efficiency and maximum parallelism.&lt;br /&gt;
Servo builds on top of Rust to provide a secure and reliable foundation. Memory safety at the core of the platform ensures a high degree of assurance in the browser’s trusted computing base. 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;
=='''Background'''==&lt;br /&gt;
===Remote Developer Tools===&lt;br /&gt;
&lt;br /&gt;
Firefox supports remote developer tools - ie. communicating with an arbitrary server that implements a protocol for exposing information about web content. You can use the [https://developer.mozilla.org/en-US/docs/Tools Firefox developer tools] on your desktop to debug Web sites and Web apps running in other browsers or runtimes. The other browser might be on the same device as the tools themselves or on a different device, such as a phone connected over USB. &lt;br /&gt;
&lt;br /&gt;
Servo implements a very basic developer tools server that currently supports executing JS remotely and investigating the DOM tree in the document inspector. We want to expand these capabilities by completing previous work that enables remote logging from web content, and add new capabilities to log HTTP requests and responses to allow for easier debugging of network-related problems in Servo.&amp;lt;ref&amp;gt;https://github.com/servo/servo/wiki/More-developer-tools-student-project&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Project Description'''==&lt;br /&gt;
=='''Requirement Analysis'''==&lt;br /&gt;
=='''Implementation'''==&lt;br /&gt;
=='''Architecture'''==&lt;br /&gt;
&lt;br /&gt;
===enum===&lt;br /&gt;
Enums are datatypes with several alternate representations. A simple enum defines one or more constants with the same data type. In Rust, an enum can have complex variants though, like a struct. For example, consider an enum 'Shape' with variants 'Circle' and 'Triangle' each of which is a struct.&lt;br /&gt;
&lt;br /&gt;
    enum Shape {&lt;br /&gt;
        Circle { center: Point, radius: f64 },&lt;br /&gt;
        Triangle{ vert1: Point, vert2: Point, vert3: Point }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
A variable of type Shape can be resolved to its appropriate variant by using a 'match'.&lt;br /&gt;
&lt;br /&gt;
    fn area(sh: Shape) -&amp;gt; f64 {&lt;br /&gt;
        match sh {&lt;br /&gt;
            Circle(_, size) =&amp;gt; f64::consts::PI * size * size,&lt;br /&gt;
            Rectangle(Point { x, y }, Point { x: x2, y: y2 }) =&amp;gt; (x2 - x) * (y2 - y)&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
The Servo Developers Tools project has a 'DevtoolsControlMsg' enum which is used to instruct the devtools server to update its known actors/state according to changes in the browser. The current project requires the addition of two new variants to the 'DevtoolsControlMsg' enum, namely 'HTTRequest' and 'HTTResponse'.&lt;br /&gt;
&lt;br /&gt;
===Sender&amp;lt;DevtoolsControlMsg&amp;gt;===&lt;br /&gt;
&lt;br /&gt;
In Rust, a pipe is used for communication between tasks. A pipe is simply a pair of endpoints: one for sending messages and another for receiving messages(Sender and Receiver). The simplest way to create a pipe is to use the channel function to create a (Sender, Receiver) pair. In Rust parlance, a sender is a sending endpoint of a pipe, and a receiver is the receiving endpoint. A simple channel can be created as follows:&lt;br /&gt;
    let (tx, rx) = channel();&lt;br /&gt;
    spawn(proc() {&lt;br /&gt;
        tx.send(10i);&lt;br /&gt;
    });&lt;br /&gt;
    assert_eq!(rx.recv(), 10i);&lt;br /&gt;
In this project, whenever a HTTPRequest or a HTTPResponse is received, we are going to send a new message using a 'Sender' object that could send variants of the type 'DevtoolsControlMsg'. This 'Sender&amp;lt;DevtoolsControlMsg&amp;gt;' objects sends the messages at appropriate times in the HTTPLoader function.&lt;br /&gt;
&lt;br /&gt;
===NetworkEventActor===&lt;br /&gt;
&lt;br /&gt;
=='''Design Patterns'''==&lt;br /&gt;
===Actor Model&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Actor_model&amp;lt;/ref&amp;gt;===&lt;br /&gt;
The actor model in computer science is a mathematical model of concurrent computation that treats &amp;quot;actors&amp;quot; as the universal primitives of concurrent computation: in response to a message that it receives, an actor can make local decisions, create more actors, send more messages, and determine how to respond to the next message received.&lt;br /&gt;
&lt;br /&gt;
The Actor model adopts the philosophy that everything is an actor. This is similar to the everything is an object philosophy used by some object-oriented programming languages, but differs in that object-oriented software is typically executed sequentially, while the Actor model is inherently concurrent.&lt;br /&gt;
&lt;br /&gt;
An actor is a computational entity that, in response to a message it receives, can concurrently:&lt;br /&gt;
*send a finite number of messages to other actors;&lt;br /&gt;
*create a finite number of new actors;&lt;br /&gt;
*designate the behavior to be used for the next message it receives.&lt;br /&gt;
&lt;br /&gt;
=='''UML Diagrams'''==&lt;br /&gt;
=='''Proposed Test Cases'''==&lt;br /&gt;
&lt;br /&gt;
=='''Reference'''==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Amohanr</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015_M1503_EDTS&amp;diff=96100</id>
		<title>CSC/ECE 517 Spring 2015 M1503 EDTS</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015_M1503_EDTS&amp;diff=96100"/>
		<updated>2015-03-31T19:52:51Z</updated>

		<summary type="html">&lt;p&gt;Amohanr: /* Design Patterns */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;font size=&amp;quot;5&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Extending Developer Tools for Servo&amp;lt;/b&amp;gt;&amp;lt;/font&amp;gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
=='''Introduction'''==&lt;br /&gt;
===Rust===&lt;br /&gt;
Rust is a general purpose, [http://en.wikipedia.org/wiki/Programming_paradigm#Multi-paradigm multi-paradigm], compiled programming language developed by [http://en.wikipedia.org/wiki/Mozilla Mozilla] Research. It is designed to be a &amp;quot;safe, concurrent, practical language&amp;quot;, supporting [http://en.wikipedia.org/wiki/Purely_functional pure-functional], [http://en.wikipedia.org/wiki/Actor_model concurrent-actor], [http://en.wikipedia.org/wiki/Procedural_programming imperative-procedural], and object-oriented styles.&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Rust_%28programming_language%29&amp;lt;/ref&amp;gt; Being a modern systems programming language focusing on safety and speed, it accomplishes these goals by being memory safe without using garbage collection.&amp;lt;ref&amp;gt;http://doc.rust-lang.org/nightly/intro.html&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Servo===&lt;br /&gt;
Servo is an experimental project to build a Web browser engine for a new generation of hardware: mobile devices, multi-core processors and high-performance GPUs. With Servo, we are rethinking the browser at every level of the technology stack — from input parsing to page layout to graphics rendering — to optimize for power efficiency and maximum parallelism.&lt;br /&gt;
Servo builds on top of Rust to provide a secure and reliable foundation. Memory safety at the core of the platform ensures a high degree of assurance in the browser’s trusted computing base. 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;
=='''Background'''==&lt;br /&gt;
===Remote Developer Tools===&lt;br /&gt;
&lt;br /&gt;
Firefox supports remote developer tools - ie. communicating with an arbitrary server that implements a protocol for exposing information about web content. You can use the [https://developer.mozilla.org/en-US/docs/Tools Firefox developer tools] on your desktop to debug Web sites and Web apps running in other browsers or runtimes. The other browser might be on the same device as the tools themselves or on a different device, such as a phone connected over USB. &lt;br /&gt;
&lt;br /&gt;
Servo implements a very basic developer tools server that currently supports executing JS remotely and investigating the DOM tree in the document inspector. We want to expand these capabilities by completing previous work that enables remote logging from web content, and add new capabilities to log HTTP requests and responses to allow for easier debugging of network-related problems in Servo.&amp;lt;ref&amp;gt;https://github.com/servo/servo/wiki/More-developer-tools-student-project&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Project Description'''==&lt;br /&gt;
=='''Requirement Analysis'''==&lt;br /&gt;
=='''Implementation'''==&lt;br /&gt;
=='''Architecture'''==&lt;br /&gt;
=='''Design Patterns'''==&lt;br /&gt;
===Actor Model===&lt;br /&gt;
The actor model in computer science is a mathematical model of concurrent computation that treats &amp;quot;actors&amp;quot; as the universal primitives of concurrent computation: in response to a message that it receives, an actor can make local decisions, create more actors, send more messages, and determine how to respond to the next message received.&lt;br /&gt;
&lt;br /&gt;
The Actor model adopts the philosophy that everything is an actor. This is similar to the everything is an object philosophy used by some object-oriented programming languages, but differs in that object-oriented software is typically executed sequentially, while the Actor model is inherently concurrent.&lt;br /&gt;
&lt;br /&gt;
An actor is a computational entity that, in response to a message it receives, can concurrently:&lt;br /&gt;
*send a finite number of messages to other actors;&lt;br /&gt;
*create a finite number of new actors;&lt;br /&gt;
*designate the behavior to be used for the next message it receives.&lt;br /&gt;
&lt;br /&gt;
=='''UML Diagrams'''==&lt;br /&gt;
=='''Proposed Test Cases'''==&lt;br /&gt;
&lt;br /&gt;
=='''Reference'''==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Amohanr</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015_M1503_EDTS&amp;diff=96083</id>
		<title>CSC/ECE 517 Spring 2015 M1503 EDTS</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015_M1503_EDTS&amp;diff=96083"/>
		<updated>2015-03-31T16:22:25Z</updated>

		<summary type="html">&lt;p&gt;Amohanr: /* Background */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;font size=&amp;quot;5&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Extending Developer Tools for Servo&amp;lt;/b&amp;gt;&amp;lt;/font&amp;gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
=='''Introduction'''==&lt;br /&gt;
===Rust===&lt;br /&gt;
Rust is a general purpose, [http://en.wikipedia.org/wiki/Programming_paradigm#Multi-paradigm multi-paradigm], compiled programming language developed by [http://en.wikipedia.org/wiki/Mozilla Mozilla] Research. It is designed to be a &amp;quot;safe, concurrent, practical language&amp;quot;, supporting [http://en.wikipedia.org/wiki/Purely_functional pure-functional], [http://en.wikipedia.org/wiki/Actor_model concurrent-actor], [http://en.wikipedia.org/wiki/Procedural_programming imperative-procedural], and object-oriented styles.&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Rust_%28programming_language%29&amp;lt;/ref&amp;gt; Being a modern systems programming language focusing on safety and speed, it accomplishes these goals by being memory safe without using garbage collection.&amp;lt;ref&amp;gt;http://doc.rust-lang.org/nightly/intro.html&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Servo===&lt;br /&gt;
Servo is an experimental project to build a Web browser engine for a new generation of hardware: mobile devices, multi-core processors and high-performance GPUs. With Servo, we are rethinking the browser at every level of the technology stack — from input parsing to page layout to graphics rendering — to optimize for power efficiency and maximum parallelism.&lt;br /&gt;
Servo builds on top of Rust to provide a secure and reliable foundation. Memory safety at the core of the platform ensures a high degree of assurance in the browser’s trusted computing base. 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;
=='''Background'''==&lt;br /&gt;
===Remote Developer Tools===&lt;br /&gt;
&lt;br /&gt;
Firefox supports remote developer tools - ie. communicating with an arbitrary server that implements a protocol for exposing information about web content. You can use the [https://developer.mozilla.org/en-US/docs/Tools Firefox developer tools] on your desktop to debug Web sites and Web apps running in other browsers or runtimes. The other browser might be on the same device as the tools themselves or on a different device, such as a phone connected over USB. &lt;br /&gt;
&lt;br /&gt;
Servo implements a very basic developer tools server that currently supports executing JS remotely and investigating the DOM tree in the document inspector. We want to expand these capabilities by completing previous work that enables remote logging from web content, and add new capabilities to log HTTP requests and responses to allow for easier debugging of network-related problems in Servo.&amp;lt;ref&amp;gt;https://github.com/servo/servo/wiki/More-developer-tools-student-project&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Project Description'''==&lt;br /&gt;
=='''Requirement Analysis'''==&lt;br /&gt;
=='''Implementation'''==&lt;br /&gt;
=='''Architecture'''==&lt;br /&gt;
=='''Design Patterns'''==&lt;br /&gt;
=='''UML Diagrams'''==&lt;br /&gt;
=='''Proposed Test Cases'''==&lt;br /&gt;
&lt;br /&gt;
=='''Reference'''==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Amohanr</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015_M1503_EDTS&amp;diff=96061</id>
		<title>CSC/ECE 517 Spring 2015 M1503 EDTS</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015_M1503_EDTS&amp;diff=96061"/>
		<updated>2015-03-31T01:55:16Z</updated>

		<summary type="html">&lt;p&gt;Amohanr: /* Background */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;font size=&amp;quot;5&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Extending Developer Tools for Servo&amp;lt;/b&amp;gt;&amp;lt;/font&amp;gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
=='''Introduction'''==&lt;br /&gt;
===Servo===&lt;br /&gt;
===Rust===&lt;br /&gt;
&lt;br /&gt;
=='''Background'''==&lt;br /&gt;
===Remote Developer Tools===&lt;br /&gt;
&lt;br /&gt;
=='''Project Description'''==&lt;br /&gt;
=='''Requirement Analysis'''==&lt;br /&gt;
=='''Implementation'''==&lt;br /&gt;
=='''Architecture'''==&lt;br /&gt;
=='''Design Patterns'''==&lt;br /&gt;
=='''UML Diagrams'''==&lt;br /&gt;
=='''Proposed Test Cases'''==&lt;/div&gt;</summary>
		<author><name>Amohanr</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015_M1503_EDTS&amp;diff=96060</id>
		<title>CSC/ECE 517 Spring 2015 M1503 EDTS</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015_M1503_EDTS&amp;diff=96060"/>
		<updated>2015-03-31T01:54:38Z</updated>

		<summary type="html">&lt;p&gt;Amohanr: /* Introduction */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;font size=&amp;quot;5&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Extending Developer Tools for Servo&amp;lt;/b&amp;gt;&amp;lt;/font&amp;gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
=='''Introduction'''==&lt;br /&gt;
===Servo===&lt;br /&gt;
===Rust===&lt;br /&gt;
&lt;br /&gt;
=='''Background'''==&lt;br /&gt;
=='''Project Description'''==&lt;br /&gt;
=='''Requirement Analysis'''==&lt;br /&gt;
=='''Implementation'''==&lt;br /&gt;
=='''Architecture'''==&lt;br /&gt;
=='''Design Patterns'''==&lt;br /&gt;
=='''UML Diagrams'''==&lt;br /&gt;
=='''Proposed Test Cases'''==&lt;/div&gt;</summary>
		<author><name>Amohanr</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015_M1503_EDTS&amp;diff=96059</id>
		<title>CSC/ECE 517 Spring 2015 M1503 EDTS</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015_M1503_EDTS&amp;diff=96059"/>
		<updated>2015-03-31T01:31:12Z</updated>

		<summary type="html">&lt;p&gt;Amohanr: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;font size=&amp;quot;5&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Extending Developer Tools for Servo&amp;lt;/b&amp;gt;&amp;lt;/font&amp;gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
=='''Introduction'''==&lt;br /&gt;
=='''Background'''==&lt;br /&gt;
=='''Project Description'''==&lt;br /&gt;
=='''Requirement Analysis'''==&lt;br /&gt;
=='''Implementation'''==&lt;br /&gt;
=='''Architecture'''==&lt;br /&gt;
=='''Design Patterns'''==&lt;br /&gt;
=='''UML Diagrams'''==&lt;br /&gt;
=='''Proposed Test Cases'''==&lt;/div&gt;</summary>
		<author><name>Amohanr</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015_M1503_EDTS&amp;diff=96058</id>
		<title>CSC/ECE 517 Spring 2015 M1503 EDTS</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015_M1503_EDTS&amp;diff=96058"/>
		<updated>2015-03-31T01:27:51Z</updated>

		<summary type="html">&lt;p&gt;Amohanr: Created page with &amp;quot;&amp;lt;font size=&amp;quot;5&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Extending Developer Tools for Servo&amp;lt;/b&amp;gt;&amp;lt;/font&amp;gt;&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;font size=&amp;quot;5&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Extending Developer Tools for Servo&amp;lt;/b&amp;gt;&amp;lt;/font&amp;gt;&lt;/div&gt;</summary>
		<author><name>Amohanr</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015&amp;diff=96057</id>
		<title>CSC/ECE 517 Spring 2015</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015&amp;diff=96057"/>
		<updated>2015-03-31T01:27:19Z</updated>

		<summary type="html">&lt;p&gt;Amohanr: /* Final Project Design Document */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Writing Assignment 1==&lt;br /&gt;
*[[CSC/ECE 517 Spring 2015/ch1a 17 WL]]&lt;br /&gt;
*[[CSC/ECE 517 Spring 2015/ch1a 5 ZX]]&lt;br /&gt;
*[[CSC/ECE 517 Spring 2015/ch1a 6 TZ]]&lt;br /&gt;
*[[CSC/ECE 517 Spring 2015/ch1a 4 RW]]&lt;br /&gt;
*[[CSC/ECE 517 Spring 2015/ch1a 7 SA]]&lt;br /&gt;
*[[CSC/ECE 517 Spring 2015/ch1a 9 RA]]&lt;br /&gt;
*[[CSC/ECE 517 Spring 2015/ch1a 14 RI]]&lt;br /&gt;
*[[CSC/ECE 517 Spring 2015/ch1a 1 DZ]]&lt;br /&gt;
*[[CSC/ECE 517 Spring 2015/ch1a 20 HA]]&lt;br /&gt;
*[[CSC/ECE 517 Spring 2015/ch1a 3 RF]]&lt;br /&gt;
*[[CSC/ECE 517 Spring 2015/ch1a 12 LS]]&lt;br /&gt;
*[[CSC/ECE 517 Spring 2015/ch1a 13 MA]]&lt;br /&gt;
*[[CSC/ECE 517 Spring 2015/ch1a 2 WA]]&lt;br /&gt;
*[[CSC/ECE 517 Spring 2015/ch1b 21 QW]]&lt;br /&gt;
*[[CSC/ECE 517 Spring 2015/ch1b 23 MS]]&lt;br /&gt;
*[[CSC/ECE 517 Spring 2015/ch1b 10 GL]]&lt;br /&gt;
*[[CSC/ECE 517 Spring 2015/ch1b 27 VC]]&lt;br /&gt;
*[[CSC/ECE 517 Spring 2015/ch1b 22 SF]]&lt;br /&gt;
*[[CSC/ECE 517 Spring 2015/ch1b 15 SH]]&lt;br /&gt;
*[[CSC/ECE 517 Spring 2015/ch1b 18 AS]]&lt;br /&gt;
&lt;br /&gt;
==Writing Assignment 2==&lt;br /&gt;
*[[CSC/ECE 517 Spring 2015/oss E1502 wwj]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2014/oss E1508 MRS]]&lt;br /&gt;
*[[CSC/ECE 517 Spring 2015/oss E1504 IMV]]&lt;br /&gt;
*[[CSC/ECE 517 Spring 2015/oss E1505 xzl]]&lt;br /&gt;
*[[CSC/ECE 517 Spring 2015/oss E1509 lds]]&lt;br /&gt;
*[[CSC/ECE 517 Spring 2015/oss E1510 FLP]]&lt;br /&gt;
*[[CSC/ECE 517 Spring 2015/oss E1506 SYZ]]&lt;br /&gt;
*[[CSC/ECE 517 Spring 2015/oss S1504 AAC]]&lt;br /&gt;
*[[CSC/ECE 517 Spring 2015/oss E1507 DG]]&lt;br /&gt;
*[[CSC/ECE 517 Spring 2015/oss M1502 GVJ]]&lt;br /&gt;
*[[CSC/ECE 517 Spring 2015/oss M1503 EDT]]&lt;br /&gt;
*[[CSC/ECE 517 Spring 2015/oss E1503 RSA]]&lt;br /&gt;
*[[CSC/ECE 517 Spring 2015/oss E1501 YWS]]&lt;br /&gt;
*[[CSC/ECE 517 Spring 2015/oss S1501 OA]]&lt;br /&gt;
&lt;br /&gt;
==Final Project Design Document==&lt;br /&gt;
&lt;br /&gt;
*[[CSC/ECE 517 Spring 2015 E1526 MPRI]]&lt;br /&gt;
*[[CSC/ECE 517 Spring 2015 S1503 LWJZ]]&lt;br /&gt;
*[[CSC/ECE 517 Spring 2015 S1524 FSZZ]]&lt;br /&gt;
*[[CSC/ECE 517 Spring 2015 M1503 EDTS]]&lt;/div&gt;</summary>
		<author><name>Amohanr</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015/oss_M1503_EDT&amp;diff=95968</id>
		<title>CSC/ECE 517 Spring 2015/oss M1503 EDT</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015/oss_M1503_EDT&amp;diff=95968"/>
		<updated>2015-03-24T03:54:01Z</updated>

		<summary type="html">&lt;p&gt;Amohanr: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;font size=&amp;quot;5&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Extending Developer Tools for Servo&amp;lt;/b&amp;gt;&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Servo&amp;lt;ref&amp;gt;https://github.com/servo/servo/&amp;lt;/ref&amp;gt; is a prototype web browser engine written in the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[http://en.wikipedia.org/wiki/JavaScript RUST]&amp;lt;/span&amp;gt; language. Servo implements a very basic developer tools server that currently supports executing &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[http://en.wikipedia.org/wiki/JavaScript JavaScript]&amp;lt;/span&amp;gt; (JS) remotely and investigating the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://developer.mozilla.org/en-US/docs/Web/API/Document_Object_Model Document Object Model]&amp;lt;/span&amp;gt; (DOM) tree in the document inspector. We want to expand these capabilities by completing previous work that enables remote logging from web content, and add new capabilities to log HTTP requests and responses to allow for easier debugging of network-related problems in Servo.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
=='''Introduction'''==&lt;br /&gt;
Servo is a prototype web browser engine and is currently developed on 64bit OS X, 64bit Linux, and Android.It is developed using the RUST&amp;lt;ref&amp;gt;http://doc.rust-lang.org/book/README.html&amp;lt;/ref&amp;gt; language. &lt;br /&gt;
&lt;br /&gt;
=='''Running Servo'''==&lt;br /&gt;
===Installation===&lt;br /&gt;
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 libbz2-dev libosmesa6-dev&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
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 cmake bzip2-devel libXcursor-devel&lt;br /&gt;
pushd /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;
===Building===&lt;br /&gt;
Servo is built with Cargo, the Rust package manager. We also use Mozilla's Mach tools to orchestrate the build and other tasks.&lt;br /&gt;
Normal Build&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;
./mach build&lt;br /&gt;
./mach run tests/html/about-mozilla.html&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Running===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
./mach run [url]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Remote Developer Tools&amp;lt;ref&amp;gt;https://developer.mozilla.org/en-US/docs/Tools/Remote_Debugging&amp;lt;/ref&amp;gt;'''==&lt;br /&gt;
You can use remote developer tools, such as the one in Firefox to debug Web sites and Web apps running on different browsers. The other browser could either be on the same device or a different device. &lt;br /&gt;
Servo has a basic implementation of developer tools that supports executing JS remotely and investigating the DOM tree in the document inspector. As part of the project for extending the funcionalities to enable remote logging from web content, and add new capabilities to log HTTP requests and responses to allow for easier debugging of network-related problems in Servo, we performed some initial additions to the code to get the web console to print out log messages. &lt;br /&gt;
&lt;br /&gt;
The following changes were made to the ConsoleMsg struct in components/devtools/libs.rs:&lt;br /&gt;
*rename logLevel to level and make it a String&lt;br /&gt;
*rename timestamp to timeStamp&lt;br /&gt;
*add an arguments vector of Strings&lt;br /&gt;
*remove the message field and add the value to the arguments vector&lt;br /&gt;
*add filename, lineNumber, and columnNumber fields&lt;br /&gt;
&lt;br /&gt;
The following code snippets show the modified version:&lt;br /&gt;
&lt;br /&gt;
components/devtools/lib.rs:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    struct ConsoleMsg {&lt;br /&gt;
    level: String,&lt;br /&gt;
    timeStamp: u64,&lt;br /&gt;
    arguments: Vec&amp;lt;String&amp;gt;,&lt;br /&gt;
    filename: String,&lt;br /&gt;
    lineNumber: u32,&lt;br /&gt;
    columnNumber: u32,&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
 fn handle_console_message(actors: Arc&amp;lt;Mutex&amp;lt;ActorRegistry&amp;gt;&amp;gt;,&lt;br /&gt;
                           id: PipelineId,&lt;br /&gt;
                           console_message: ConsoleMessage,&lt;br /&gt;
                           actor_pipelines: &amp;amp;HashMap&amp;lt;PipelineId, String&amp;gt;) {&lt;br /&gt;
    let console_actor_name = find_console_actor(actors.clone(), id, actor_pipelines);&lt;br /&gt;
    let actors = actors.lock().unwrap();&lt;br /&gt;
    let console_actor = actors.find::&amp;lt;ConsoleActor&amp;gt;(console_actor_name.as_slice());&lt;br /&gt;
    match console_message {&lt;br /&gt;
        ConsoleMessage::LogMessage(message, filename, lineNumber, columnNumber) =&amp;gt; {&lt;br /&gt;
            let msg = ConsoleAPICall {&lt;br /&gt;
                from: console_actor.name.clone(),&lt;br /&gt;
                __type__: &amp;quot;consoleAPICall&amp;quot;.to_string(),&lt;br /&gt;
                message: ConsoleMsg {&lt;br /&gt;
                    level: &amp;quot;log&amp;quot;.to_string(),&lt;br /&gt;
                    timeStamp: precise_time_ns(),&lt;br /&gt;
                    arguments: vec!(message),&lt;br /&gt;
                    filename: filename,&lt;br /&gt;
                    lineNumber: lineNumber,&lt;br /&gt;
                    columnNumber: columnNumber,&lt;br /&gt;
                },&lt;br /&gt;
        };&lt;br /&gt;
        for stream in console_actor.streams.borrow_mut().iter_mut() {&lt;br /&gt;
            stream.write_json_packet(&amp;amp;msg);&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We also update the ConsoleMessage enum in components/devtools_traits/lib.rs to add fields filename, lineNumber, columnNumber&lt;br /&gt;
components/devtools_traits/lib.rs&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pub enum ConsoleMessage {&lt;br /&gt;
    // Log: message, filename, line number, column number&lt;br /&gt;
    LogMessage(String, String, u32, u32),&lt;br /&gt;
    //WarnMessage(String),&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
components/script/dom/console.rs&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
impl&amp;lt;'a&amp;gt; ConsoleMethods for JSRef&amp;lt;'a, Console&amp;gt; {&lt;br /&gt;
    fn Log(self, message: DOMString) {&lt;br /&gt;
        println!(&amp;quot;{}&amp;quot;, message);&lt;br /&gt;
        //TODO: Sending fake values for filename, lineNumber and columnNumber in LogMessage; adjust later&lt;br /&gt;
        propagate_console_msg(&amp;amp;self, ConsoleMessage::LogMessage(message, String::from_str(&amp;quot;test&amp;quot;), 1, 1));&lt;br /&gt;
    }&lt;br /&gt;
    .&lt;br /&gt;
    .&lt;br /&gt;
    .&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Connecting to Firefox==&lt;br /&gt;
Run Servo on a webpage with the --devtools 6000 argument, connect to it from a recent version of Firefox. Check &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://developer.mozilla.org/en-US/docs/Tools/Remote_Debugging/Thunderbird here]&amp;lt;/span&amp;gt; to see how to configure Firefox for this. You can now experiment with the document inspector and web console.&lt;br /&gt;
&lt;br /&gt;
=='''Conclusion'''==&lt;br /&gt;
After these changes were made, the message now logs on the web console. A video demonstration is available &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[http://www.screencast.com/t/nwN23WnG9 here].&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Amohanr</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015/oss_M1503_EDT&amp;diff=95967</id>
		<title>CSC/ECE 517 Spring 2015/oss M1503 EDT</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015/oss_M1503_EDT&amp;diff=95967"/>
		<updated>2015-03-24T03:47:50Z</updated>

		<summary type="html">&lt;p&gt;Amohanr: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;font size=&amp;quot;5&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Extending Developer Tools for Servo&amp;lt;/b&amp;gt;&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Servo&amp;lt;ref&amp;gt;https://github.com/servo/servo/&amp;lt;/ref&amp;gt; is a prototype web browser engine written in the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[http://en.wikipedia.org/wiki/JavaScript RUST]&amp;lt;/span&amp;gt; language. Servo implements a very basic developer tools server that currently supports executing &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[http://en.wikipedia.org/wiki/JavaScript JavaScript]&amp;lt;/span&amp;gt; (JS) remotely and investigating the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://developer.mozilla.org/en-US/docs/Web/API/Document_Object_Model Document Object Model]&amp;lt;/span&amp;gt; (DOM) tree in the document inspector. We want to expand these capabilities by completing previous work that enables remote logging from web content, and add new capabilities to log HTTP requests and responses to allow for easier debugging of network-related problems in Servo.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
=='''Introduction'''==&lt;br /&gt;
Servo is a prototype web browser engine and is currently developed on 64bit OS X, 64bit Linux, and Android.It is developed using the RUST&amp;lt;ref&amp;gt;http://doc.rust-lang.org/book/README.html&amp;lt;/ref&amp;gt; language. &lt;br /&gt;
&lt;br /&gt;
=='''Running Servo'''==&lt;br /&gt;
===Installation===&lt;br /&gt;
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 libbz2-dev libosmesa6-dev&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
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 cmake bzip2-devel libXcursor-devel&lt;br /&gt;
pushd /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;
===Building===&lt;br /&gt;
Servo is built with Cargo, the Rust package manager. We also use Mozilla's Mach tools to orchestrate the build and other tasks.&lt;br /&gt;
Normal Build&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;
./mach build&lt;br /&gt;
./mach run tests/html/about-mozilla.html&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Running===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
./mach run [url]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Remote Developer Tools&amp;lt;ref&amp;gt;https://developer.mozilla.org/en-US/docs/Tools/Remote_Debugging&amp;lt;/ref&amp;gt;'''==&lt;br /&gt;
You can use remote developer tools, such as the one in Firefox to debug Web sites and Web apps running on different browsers. The other browser could either be on the same device or a different device. &lt;br /&gt;
Servo has a basic implementation of developer tools that supports executing JS remotely and investigating the DOM tree in the document inspector. As part of the project for extending the funcionalities to enable remote logging from web content, and add new capabilities to log HTTP requests and responses to allow for easier debugging of network-related problems in Servo, we performed some initial additions to the code to get the web console to print out log messages. &lt;br /&gt;
&lt;br /&gt;
The following changes were made to the ConsoleMsg struct in components/devtools/libs.rs:&lt;br /&gt;
*rename logLevel to level and make it a String&lt;br /&gt;
*rename timestamp to timeStamp&lt;br /&gt;
*add an arguments vector of Strings&lt;br /&gt;
*remove the message field and add the value to the arguments vector&lt;br /&gt;
*add filename, lineNumber, and columnNumber fields&lt;br /&gt;
&lt;br /&gt;
The following code snippets show the modified version:&lt;br /&gt;
&lt;br /&gt;
components/devtools/lib.rs:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    struct ConsoleMsg {&lt;br /&gt;
    level: String,&lt;br /&gt;
    timeStamp: u64,&lt;br /&gt;
    arguments: Vec&amp;lt;String&amp;gt;,&lt;br /&gt;
    filename: String,&lt;br /&gt;
    lineNumber: u32,&lt;br /&gt;
    columnNumber: u32,&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
 fn handle_console_message(actors: Arc&amp;lt;Mutex&amp;lt;ActorRegistry&amp;gt;&amp;gt;,&lt;br /&gt;
                           id: PipelineId,&lt;br /&gt;
                           console_message: ConsoleMessage,&lt;br /&gt;
                           actor_pipelines: &amp;amp;HashMap&amp;lt;PipelineId, String&amp;gt;) {&lt;br /&gt;
    let console_actor_name = find_console_actor(actors.clone(), id, actor_pipelines);&lt;br /&gt;
    let actors = actors.lock().unwrap();&lt;br /&gt;
    let console_actor = actors.find::&amp;lt;ConsoleActor&amp;gt;(console_actor_name.as_slice());&lt;br /&gt;
    match console_message {&lt;br /&gt;
        ConsoleMessage::LogMessage(message, filename, lineNumber, columnNumber) =&amp;gt; {&lt;br /&gt;
            let msg = ConsoleAPICall {&lt;br /&gt;
                from: console_actor.name.clone(),&lt;br /&gt;
                __type__: &amp;quot;consoleAPICall&amp;quot;.to_string(),&lt;br /&gt;
                message: ConsoleMsg {&lt;br /&gt;
                    level: &amp;quot;log&amp;quot;.to_string(),&lt;br /&gt;
                    timeStamp: precise_time_ns(),&lt;br /&gt;
                    arguments: vec!(message),&lt;br /&gt;
                    filename: filename,&lt;br /&gt;
                    lineNumber: lineNumber,&lt;br /&gt;
                    columnNumber: columnNumber,&lt;br /&gt;
                },&lt;br /&gt;
        };&lt;br /&gt;
        for stream in console_actor.streams.borrow_mut().iter_mut() {&lt;br /&gt;
            stream.write_json_packet(&amp;amp;msg);&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We also update the ConsoleMessage enum in components/devtools_traits/lib.rs to add fields filename, lineNumber, columnNumber&lt;br /&gt;
components/devtools_traits/lib.rs&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pub enum ConsoleMessage {&lt;br /&gt;
    // Log: message, filename, line number, column number&lt;br /&gt;
    LogMessage(String, String, u32, u32),&lt;br /&gt;
    //WarnMessage(String),&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
components/script/dom/console.rs&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
impl&amp;lt;'a&amp;gt; ConsoleMethods for JSRef&amp;lt;'a, Console&amp;gt; {&lt;br /&gt;
    fn Log(self, message: DOMString) {&lt;br /&gt;
        println!(&amp;quot;{}&amp;quot;, message);&lt;br /&gt;
        //TODO: Sending fake values for filename, lineNumber and columnNumber in LogMessage; adjust later&lt;br /&gt;
        propagate_console_msg(&amp;amp;self, ConsoleMessage::LogMessage(message, String::from_str(&amp;quot;test&amp;quot;), 1, 1));&lt;br /&gt;
    }&lt;br /&gt;
    .&lt;br /&gt;
    .&lt;br /&gt;
    .&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Conclusion'''==&lt;br /&gt;
After these changes were made, the message now logs on the web console.&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Amohanr</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015/oss_M1503_EDT&amp;diff=95857</id>
		<title>CSC/ECE 517 Spring 2015/oss M1503 EDT</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015/oss_M1503_EDT&amp;diff=95857"/>
		<updated>2015-03-24T00:04:48Z</updated>

		<summary type="html">&lt;p&gt;Amohanr: /* Running */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;font size=&amp;quot;5&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Extending Developer Tools for Servo&amp;lt;/b&amp;gt;&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Servo&amp;lt;ref&amp;gt;https://github.com/servo/servo/&amp;lt;/ref&amp;gt; is a prototype web browser engine written in the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[http://en.wikipedia.org/wiki/JavaScript RUST]&amp;lt;/span&amp;gt; language. Servo implements a very basic developer tools server that currently supports executing &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[http://en.wikipedia.org/wiki/JavaScript JavaScript]&amp;lt;/span&amp;gt; (JS) remotely and investigating the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://developer.mozilla.org/en-US/docs/Web/API/Document_Object_Model Document Object Model]&amp;lt;/span&amp;gt; (DOM) tree in the document inspector. We want to expand these capabilities by completing previous work that enables remote logging from web content, and add new capabilities to log HTTP requests and responses to allow for easier debugging of network-related problems in Servo.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
=='''Introduction'''==&lt;br /&gt;
Servo is a prototype web browser engine and is currently developed on 64bit OS X, 64bit Linux, and Android.It is developed using the RUST&amp;lt;ref&amp;gt;http://doc.rust-lang.org/book/README.html&amp;lt;/ref&amp;gt; language. &lt;br /&gt;
&lt;br /&gt;
=='''Running Servo'''==&lt;br /&gt;
===Installation===&lt;br /&gt;
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 libbz2-dev libosmesa6-dev&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
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 cmake bzip2-devel libXcursor-devel&lt;br /&gt;
pushd /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;
===Building===&lt;br /&gt;
Servo is built with Cargo, the Rust package manager. We also use Mozilla's Mach tools to orchestrate the build and other tasks.&lt;br /&gt;
Normal Build&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;
./mach build&lt;br /&gt;
./mach run tests/html/about-mozilla.html&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Running===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
./mach run [url]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Remote Developer Tools&amp;lt;ref&amp;gt;https://developer.mozilla.org/en-US/docs/Tools/Remote_Debugging&amp;lt;/ref&amp;gt;'''==&lt;br /&gt;
You can use remote developer tools, such as the one in Firefox to debug Web sites and Web apps running on different browsers. The other browser could either be on the same device or a different device. &lt;br /&gt;
Servo has a basic implementation of developer tools that supports executing JS remotely and investigating the DOM tree in the document inspector. As part of the project for extending the funcionalities to enable remote logging from web content, and add new capabilities to log HTTP requests and responses to allow for easier debugging of network-related problems in Servo, we performed some initial additions to the code to get the web console to print out log messages. &lt;br /&gt;
&lt;br /&gt;
The following changes were made to the ConsoleMsg struct in components/devtools/libs.rs:&lt;br /&gt;
*rename logLevel to level and make it a String&lt;br /&gt;
*rename timestamp to timeStamp&lt;br /&gt;
*add an arguments vector of Strings&lt;br /&gt;
*remove the message field and add the value to the arguments vector&lt;br /&gt;
*add filename, lineNumber, and columnNumber fields&lt;br /&gt;
&lt;br /&gt;
The following code snippets show the modified version:&lt;br /&gt;
&lt;br /&gt;
components/devtools/lib.rs:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    struct ConsoleMsg {&lt;br /&gt;
    level: String,&lt;br /&gt;
    timeStamp: u64,&lt;br /&gt;
    arguments: Vec&amp;lt;String&amp;gt;,&lt;br /&gt;
    filename: String,&lt;br /&gt;
    lineNumber: u32,&lt;br /&gt;
    columnNumber: u32,&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
 fn handle_console_message(actors: Arc&amp;lt;Mutex&amp;lt;ActorRegistry&amp;gt;&amp;gt;,&lt;br /&gt;
                           id: PipelineId,&lt;br /&gt;
                           console_message: ConsoleMessage,&lt;br /&gt;
                           actor_pipelines: &amp;amp;HashMap&amp;lt;PipelineId, String&amp;gt;) {&lt;br /&gt;
    let console_actor_name = find_console_actor(actors.clone(), id, actor_pipelines);&lt;br /&gt;
    let actors = actors.lock().unwrap();&lt;br /&gt;
    let console_actor = actors.find::&amp;lt;ConsoleActor&amp;gt;(console_actor_name.as_slice());&lt;br /&gt;
    match console_message {&lt;br /&gt;
        ConsoleMessage::LogMessage(message, filename, lineNumber, columnNumber) =&amp;gt; {&lt;br /&gt;
            let msg = ConsoleAPICall {&lt;br /&gt;
                from: console_actor.name.clone(),&lt;br /&gt;
                __type__: &amp;quot;consoleAPICall&amp;quot;.to_string(),&lt;br /&gt;
                message: ConsoleMsg {&lt;br /&gt;
                    level: &amp;quot;log&amp;quot;.to_string(),&lt;br /&gt;
                    timeStamp: precise_time_ns(),&lt;br /&gt;
                    arguments: vec!(message),&lt;br /&gt;
                    filename: filename,&lt;br /&gt;
                    lineNumber: lineNumber,&lt;br /&gt;
                    columnNumber: columnNumber,&lt;br /&gt;
                },&lt;br /&gt;
        };&lt;br /&gt;
        for stream in console_actor.streams.borrow_mut().iter_mut() {&lt;br /&gt;
            stream.write_json_packet(&amp;amp;msg);&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
components/devtools_traits/lib.rs&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pub enum ConsoleMessage {&lt;br /&gt;
    // Log: message, filename, line number, column number&lt;br /&gt;
    LogMessage(String, String, u32, u32),&lt;br /&gt;
    //WarnMessage(String),&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
components/script/dom/console.rs&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
impl&amp;lt;'a&amp;gt; ConsoleMethods for JSRef&amp;lt;'a, Console&amp;gt; {&lt;br /&gt;
    fn Log(self, message: DOMString) {&lt;br /&gt;
        println!(&amp;quot;{}&amp;quot;, message);&lt;br /&gt;
        //TODO: Sending fake values for filename, lineNumber and columnNumber in LogMessage; adjust later&lt;br /&gt;
        propagate_console_msg(&amp;amp;self, ConsoleMessage::LogMessage(message, String::from_str(&amp;quot;test&amp;quot;), 1, 1));&lt;br /&gt;
    }&lt;br /&gt;
    .&lt;br /&gt;
    .&lt;br /&gt;
    .&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Amohanr</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015/oss_M1503_EDT&amp;diff=95856</id>
		<title>CSC/ECE 517 Spring 2015/oss M1503 EDT</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015/oss_M1503_EDT&amp;diff=95856"/>
		<updated>2015-03-24T00:03:25Z</updated>

		<summary type="html">&lt;p&gt;Amohanr: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;font size=&amp;quot;5&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Extending Developer Tools for Servo&amp;lt;/b&amp;gt;&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Servo&amp;lt;ref&amp;gt;https://github.com/servo/servo/&amp;lt;/ref&amp;gt; is a prototype web browser engine written in the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[http://en.wikipedia.org/wiki/JavaScript RUST]&amp;lt;/span&amp;gt; language. Servo implements a very basic developer tools server that currently supports executing &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[http://en.wikipedia.org/wiki/JavaScript JavaScript]&amp;lt;/span&amp;gt; (JS) remotely and investigating the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://developer.mozilla.org/en-US/docs/Web/API/Document_Object_Model Document Object Model]&amp;lt;/span&amp;gt; (DOM) tree in the document inspector. We want to expand these capabilities by completing previous work that enables remote logging from web content, and add new capabilities to log HTTP requests and responses to allow for easier debugging of network-related problems in Servo.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
=='''Introduction'''==&lt;br /&gt;
Servo is a prototype web browser engine and is currently developed on 64bit OS X, 64bit Linux, and Android.It is developed using the RUST&amp;lt;ref&amp;gt;http://doc.rust-lang.org/book/README.html&amp;lt;/ref&amp;gt; language. &lt;br /&gt;
&lt;br /&gt;
=='''Running Servo'''==&lt;br /&gt;
===Installation===&lt;br /&gt;
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 libbz2-dev libosmesa6-dev&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
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 cmake bzip2-devel libXcursor-devel&lt;br /&gt;
pushd /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;
===Building===&lt;br /&gt;
Servo is built with Cargo, the Rust package manager. We also use Mozilla's Mach tools to orchestrate the build and other tasks.&lt;br /&gt;
Normal Build&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;
./mach build&lt;br /&gt;
./mach run tests/html/about-mozilla.html&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Running===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
./mach run [url]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Remote Developer Tools'''==&amp;lt;ref&amp;gt;https://developer.mozilla.org/en-US/docs/Tools/Remote_Debugging&amp;lt;/ref&amp;gt;&lt;br /&gt;
You can use remote developer tools, such as the one in Firefox to debug Web sites and Web apps running on different browsers. The other browser could either be on the same device or a different device. &lt;br /&gt;
Servo has a basic implementation of developer tools that supports executing JS remotely and investigating the DOM tree in the document inspector. As part of the project for extending the funcionalities to enable remote logging from web content, and add new capabilities to log HTTP requests and responses to allow for easier debugging of network-related problems in Servo, we performed some initial additions to the code to get the web console to print out log messages. &lt;br /&gt;
&lt;br /&gt;
The following changes were made to the ConsoleMsg struct in components/devtools/libs.rs:&lt;br /&gt;
*rename logLevel to level and make it a String&lt;br /&gt;
*rename timestamp to timeStamp&lt;br /&gt;
*add an arguments vector of Strings&lt;br /&gt;
*remove the message field and add the value to the arguments vector&lt;br /&gt;
*add filename, lineNumber, and columnNumber fields&lt;br /&gt;
&lt;br /&gt;
The following code snippets show the modified version:&lt;br /&gt;
&lt;br /&gt;
components/devtools/lib.rs:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    struct ConsoleMsg {&lt;br /&gt;
    level: String,&lt;br /&gt;
    timeStamp: u64,&lt;br /&gt;
    arguments: Vec&amp;lt;String&amp;gt;,&lt;br /&gt;
    filename: String,&lt;br /&gt;
    lineNumber: u32,&lt;br /&gt;
    columnNumber: u32,&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
 fn handle_console_message(actors: Arc&amp;lt;Mutex&amp;lt;ActorRegistry&amp;gt;&amp;gt;,&lt;br /&gt;
                           id: PipelineId,&lt;br /&gt;
                           console_message: ConsoleMessage,&lt;br /&gt;
                           actor_pipelines: &amp;amp;HashMap&amp;lt;PipelineId, String&amp;gt;) {&lt;br /&gt;
    let console_actor_name = find_console_actor(actors.clone(), id, actor_pipelines);&lt;br /&gt;
    let actors = actors.lock().unwrap();&lt;br /&gt;
    let console_actor = actors.find::&amp;lt;ConsoleActor&amp;gt;(console_actor_name.as_slice());&lt;br /&gt;
    match console_message {&lt;br /&gt;
        ConsoleMessage::LogMessage(message, filename, lineNumber, columnNumber) =&amp;gt; {&lt;br /&gt;
            let msg = ConsoleAPICall {&lt;br /&gt;
                from: console_actor.name.clone(),&lt;br /&gt;
                __type__: &amp;quot;consoleAPICall&amp;quot;.to_string(),&lt;br /&gt;
                message: ConsoleMsg {&lt;br /&gt;
                    level: &amp;quot;log&amp;quot;.to_string(),&lt;br /&gt;
                    timeStamp: precise_time_ns(),&lt;br /&gt;
                    arguments: vec!(message),&lt;br /&gt;
                    filename: filename,&lt;br /&gt;
                    lineNumber: lineNumber,&lt;br /&gt;
                    columnNumber: columnNumber,&lt;br /&gt;
                },&lt;br /&gt;
        };&lt;br /&gt;
        for stream in console_actor.streams.borrow_mut().iter_mut() {&lt;br /&gt;
            stream.write_json_packet(&amp;amp;msg);&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
components/devtools_traits/lib.rs&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pub enum ConsoleMessage {&lt;br /&gt;
    // Log: message, filename, line number, column number&lt;br /&gt;
    LogMessage(String, String, u32, u32),&lt;br /&gt;
    //WarnMessage(String),&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
components/script/dom/console.rs&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
impl&amp;lt;'a&amp;gt; ConsoleMethods for JSRef&amp;lt;'a, Console&amp;gt; {&lt;br /&gt;
    fn Log(self, message: DOMString) {&lt;br /&gt;
        println!(&amp;quot;{}&amp;quot;, message);&lt;br /&gt;
        //TODO: Sending fake values for filename, lineNumber and columnNumber in LogMessage; adjust later&lt;br /&gt;
        propagate_console_msg(&amp;amp;self, ConsoleMessage::LogMessage(message, String::from_str(&amp;quot;test&amp;quot;), 1, 1));&lt;br /&gt;
    }&lt;br /&gt;
    .&lt;br /&gt;
    .&lt;br /&gt;
    .&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Amohanr</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015/oss_M1503_EDT&amp;diff=95854</id>
		<title>CSC/ECE 517 Spring 2015/oss M1503 EDT</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015/oss_M1503_EDT&amp;diff=95854"/>
		<updated>2015-03-24T00:02:05Z</updated>

		<summary type="html">&lt;p&gt;Amohanr: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;font size=&amp;quot;5&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Extending Developer Tools for Servo&amp;lt;/b&amp;gt;&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Servo&amp;lt;ref&amp;gt;https://github.com/servo/servo/&amp;lt;/ref&amp;gt; is a prototype web browser engine written in the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[http://en.wikipedia.org/wiki/JavaScript RUST]&amp;lt;/span&amp;gt; language. Servo implements a very basic developer tools server that currently supports executing &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[http://en.wikipedia.org/wiki/JavaScript JavaScript]&amp;lt;/span&amp;gt; (JS) remotely and investigating the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://developer.mozilla.org/en-US/docs/Web/API/Document_Object_Model Document Object Model]&amp;lt;/span&amp;gt; (DOM) tree in the document inspector. We want to expand these capabilities by completing previous work that enables remote logging from web content, and add new capabilities to log HTTP requests and responses to allow for easier debugging of network-related problems in Servo.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
=='''Introduction'''==&lt;br /&gt;
Servo is a prototype web browser engine and is currently developed on 64bit OS X, 64bit Linux, and Android.It is developed using the RUST&amp;lt;ref&amp;gt;http://doc.rust-lang.org/book/README.html&amp;lt;/ref&amp;gt; language. &lt;br /&gt;
&lt;br /&gt;
=='''Running Servo'''==&lt;br /&gt;
===Installation===&lt;br /&gt;
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 libbz2-dev libosmesa6-dev&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
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 cmake bzip2-devel libXcursor-devel&lt;br /&gt;
pushd /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;
===Building===&lt;br /&gt;
Servo is built with Cargo, the Rust package manager. We also use Mozilla's Mach tools to orchestrate the build and other tasks.&lt;br /&gt;
Normal Build&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;
./mach build&lt;br /&gt;
./mach run tests/html/about-mozilla.html&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Running===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
./mach run [url]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Remote Developer Tools'''==&lt;br /&gt;
You can use remote developer tools, such as the one in Firefox to debug Web sites and Web apps running on different browsers. The other browser could either be on the same device or a different device. &lt;br /&gt;
Servo has a basic implementation of developer tools that supports executing JS remotely and investigating the DOM tree in the document inspector. As part of the project for extending the funcionalities to enable remote logging from web content, and add new capabilities to log HTTP requests and responses to allow for easier debugging of network-related problems in Servo, we performed some initial additions to the code to get the web console to print out log messages. &lt;br /&gt;
&lt;br /&gt;
The following changes were made to the ConsoleMsg struct in components/devtools/libs.rs:&lt;br /&gt;
*rename logLevel to level and make it a String&lt;br /&gt;
*rename timestamp to timeStamp&lt;br /&gt;
*add an arguments vector of Strings&lt;br /&gt;
*remove the message field and add the value to the arguments vector&lt;br /&gt;
*add filename, lineNumber, and columnNumber fields&lt;br /&gt;
&lt;br /&gt;
The following code snippets show the modified version:&lt;br /&gt;
&lt;br /&gt;
components/devtools/lib.rs:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    struct ConsoleMsg {&lt;br /&gt;
    level: String,&lt;br /&gt;
    timeStamp: u64,&lt;br /&gt;
    arguments: Vec&amp;lt;String&amp;gt;,&lt;br /&gt;
    filename: String,&lt;br /&gt;
    lineNumber: u32,&lt;br /&gt;
    columnNumber: u32,&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
 fn handle_console_message(actors: Arc&amp;lt;Mutex&amp;lt;ActorRegistry&amp;gt;&amp;gt;,&lt;br /&gt;
                           id: PipelineId,&lt;br /&gt;
                           console_message: ConsoleMessage,&lt;br /&gt;
                           actor_pipelines: &amp;amp;HashMap&amp;lt;PipelineId, String&amp;gt;) {&lt;br /&gt;
    let console_actor_name = find_console_actor(actors.clone(), id, actor_pipelines);&lt;br /&gt;
    let actors = actors.lock().unwrap();&lt;br /&gt;
    let console_actor = actors.find::&amp;lt;ConsoleActor&amp;gt;(console_actor_name.as_slice());&lt;br /&gt;
    match console_message {&lt;br /&gt;
        ConsoleMessage::LogMessage(message, filename, lineNumber, columnNumber) =&amp;gt; {&lt;br /&gt;
            let msg = ConsoleAPICall {&lt;br /&gt;
                from: console_actor.name.clone(),&lt;br /&gt;
                __type__: &amp;quot;consoleAPICall&amp;quot;.to_string(),&lt;br /&gt;
                message: ConsoleMsg {&lt;br /&gt;
                    level: &amp;quot;log&amp;quot;.to_string(),&lt;br /&gt;
                    timeStamp: precise_time_ns(),&lt;br /&gt;
                    arguments: vec!(message),&lt;br /&gt;
                    filename: filename,&lt;br /&gt;
                    lineNumber: lineNumber,&lt;br /&gt;
                    columnNumber: columnNumber,&lt;br /&gt;
                },&lt;br /&gt;
        };&lt;br /&gt;
        for stream in console_actor.streams.borrow_mut().iter_mut() {&lt;br /&gt;
            stream.write_json_packet(&amp;amp;msg);&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
components/devtools_traits/lib.rs&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pub enum ConsoleMessage {&lt;br /&gt;
    // Log: message, filename, line number, column number&lt;br /&gt;
    LogMessage(String, String, u32, u32),&lt;br /&gt;
    //WarnMessage(String),&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
components/script/dom/console.rs&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
impl&amp;lt;'a&amp;gt; ConsoleMethods for JSRef&amp;lt;'a, Console&amp;gt; {&lt;br /&gt;
    fn Log(self, message: DOMString) {&lt;br /&gt;
        println!(&amp;quot;{}&amp;quot;, message);&lt;br /&gt;
        //TODO: Sending fake values for filename, lineNumber and columnNumber in LogMessage; adjust later&lt;br /&gt;
        propagate_console_msg(&amp;amp;self, ConsoleMessage::LogMessage(message, String::from_str(&amp;quot;test&amp;quot;), 1, 1));&lt;br /&gt;
    }&lt;br /&gt;
    .&lt;br /&gt;
    .&lt;br /&gt;
    .&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Amohanr</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015/oss_M1503_EDT&amp;diff=95853</id>
		<title>CSC/ECE 517 Spring 2015/oss M1503 EDT</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015/oss_M1503_EDT&amp;diff=95853"/>
		<updated>2015-03-24T00:01:39Z</updated>

		<summary type="html">&lt;p&gt;Amohanr: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;font size=&amp;quot;5&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Extending Developer Tools for Servo&amp;lt;/b&amp;gt;&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Servo&amp;lt;ref&amp;gt;https://github.com/servo/servo/&amp;lt;/ref&amp;gt; is a prototype web browser engine written in the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[http://en.wikipedia.org/wiki/JavaScript RUST]&amp;lt;/span&amp;gt; language. Servo implements a very basic developer tools server that currently supports executing &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[http://en.wikipedia.org/wiki/JavaScript JavaScript]&amp;lt;/span&amp;gt; (JS)remotely and investigating the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://developer.mozilla.org/en-US/docs/Web/API/Document_Object_Model Document Object Model]&amp;lt;/span&amp;gt; (DOM) tree in the document inspector. We want to expand these capabilities by completing previous work that enables remote logging from web content, and add new capabilities to log HTTP requests and responses to allow for easier debugging of network-related problems in Servo.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
=='''Introduction'''==&lt;br /&gt;
Servo is a prototype web browser engine and is currently developed on 64bit OS X, 64bit Linux, and Android.It is developed using the RUST&amp;lt;ref&amp;gt;http://doc.rust-lang.org/book/README.html&amp;lt;/ref&amp;gt; language. &lt;br /&gt;
&lt;br /&gt;
=='''Running Servo'''==&lt;br /&gt;
===Installation===&lt;br /&gt;
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 libbz2-dev libosmesa6-dev&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
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 cmake bzip2-devel libXcursor-devel&lt;br /&gt;
pushd /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;
===Building===&lt;br /&gt;
Servo is built with Cargo, the Rust package manager. We also use Mozilla's Mach tools to orchestrate the build and other tasks.&lt;br /&gt;
Normal Build&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;
./mach build&lt;br /&gt;
./mach run tests/html/about-mozilla.html&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Running===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
./mach run [url]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Remote Developer Tools'''==&lt;br /&gt;
You can use remote developer tools, such as the one in Firefox to debug Web sites and Web apps running on different browsers. The other browser could either be on the same device or a different device. &lt;br /&gt;
Servo has a basic implementation of developer tools that supports executing JS remotely and investigating the DOM tree in the document inspector. As part of the project for extending the funcionalities to enable remote logging from web content, and add new capabilities to log HTTP requests and responses to allow for easier debugging of network-related problems in Servo, we performed some initial additions to the code to get the web console to print out log messages. &lt;br /&gt;
&lt;br /&gt;
The following changes were made to the ConsoleMsg struct in components/devtools/libs.rs:&lt;br /&gt;
*rename logLevel to level and make it a String&lt;br /&gt;
*rename timestamp to timeStamp&lt;br /&gt;
*add an arguments vector of Strings&lt;br /&gt;
*remove the message field and add the value to the arguments vector&lt;br /&gt;
*add filename, lineNumber, and columnNumber fields&lt;br /&gt;
&lt;br /&gt;
The following code snippets show the modified version:&lt;br /&gt;
&lt;br /&gt;
components/devtools/lib.rs:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    struct ConsoleMsg {&lt;br /&gt;
    level: String,&lt;br /&gt;
    timeStamp: u64,&lt;br /&gt;
    arguments: Vec&amp;lt;String&amp;gt;,&lt;br /&gt;
    filename: String,&lt;br /&gt;
    lineNumber: u32,&lt;br /&gt;
    columnNumber: u32,&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
 fn handle_console_message(actors: Arc&amp;lt;Mutex&amp;lt;ActorRegistry&amp;gt;&amp;gt;,&lt;br /&gt;
                           id: PipelineId,&lt;br /&gt;
                           console_message: ConsoleMessage,&lt;br /&gt;
                           actor_pipelines: &amp;amp;HashMap&amp;lt;PipelineId, String&amp;gt;) {&lt;br /&gt;
    let console_actor_name = find_console_actor(actors.clone(), id, actor_pipelines);&lt;br /&gt;
    let actors = actors.lock().unwrap();&lt;br /&gt;
    let console_actor = actors.find::&amp;lt;ConsoleActor&amp;gt;(console_actor_name.as_slice());&lt;br /&gt;
    match console_message {&lt;br /&gt;
        ConsoleMessage::LogMessage(message, filename, lineNumber, columnNumber) =&amp;gt; {&lt;br /&gt;
            let msg = ConsoleAPICall {&lt;br /&gt;
                from: console_actor.name.clone(),&lt;br /&gt;
                __type__: &amp;quot;consoleAPICall&amp;quot;.to_string(),&lt;br /&gt;
                message: ConsoleMsg {&lt;br /&gt;
                    level: &amp;quot;log&amp;quot;.to_string(),&lt;br /&gt;
                    timeStamp: precise_time_ns(),&lt;br /&gt;
                    arguments: vec!(message),&lt;br /&gt;
                    filename: filename,&lt;br /&gt;
                    lineNumber: lineNumber,&lt;br /&gt;
                    columnNumber: columnNumber,&lt;br /&gt;
                },&lt;br /&gt;
        };&lt;br /&gt;
        for stream in console_actor.streams.borrow_mut().iter_mut() {&lt;br /&gt;
            stream.write_json_packet(&amp;amp;msg);&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
components/devtools_traits/lib.rs&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pub enum ConsoleMessage {&lt;br /&gt;
    // Log: message, filename, line number, column number&lt;br /&gt;
    LogMessage(String, String, u32, u32),&lt;br /&gt;
    //WarnMessage(String),&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
components/script/dom/console.rs&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
impl&amp;lt;'a&amp;gt; ConsoleMethods for JSRef&amp;lt;'a, Console&amp;gt; {&lt;br /&gt;
    fn Log(self, message: DOMString) {&lt;br /&gt;
        println!(&amp;quot;{}&amp;quot;, message);&lt;br /&gt;
        //TODO: Sending fake values for filename, lineNumber and columnNumber in LogMessage; adjust later&lt;br /&gt;
        propagate_console_msg(&amp;amp;self, ConsoleMessage::LogMessage(message, String::from_str(&amp;quot;test&amp;quot;), 1, 1));&lt;br /&gt;
    }&lt;br /&gt;
    .&lt;br /&gt;
    .&lt;br /&gt;
    .&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Amohanr</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015/oss_M1503_EDT&amp;diff=95849</id>
		<title>CSC/ECE 517 Spring 2015/oss M1503 EDT</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015/oss_M1503_EDT&amp;diff=95849"/>
		<updated>2015-03-23T23:59:12Z</updated>

		<summary type="html">&lt;p&gt;Amohanr: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;font size=&amp;quot;5&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Extending Developer Tools for Servo&amp;lt;/b&amp;gt;&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Servo&amp;lt;ref&amp;gt;https://github.com/servo/servo/&amp;lt;/ref&amp;gt; is a prototype web browser engine written in the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[http://en.wikipedia.org/wiki/JavaScript RUST]&amp;lt;/span&amp;gt; language. Servo implements a very basic developer tools server that currently supports executing &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/rust-lang/rust JavaScript]&amp;lt;/span&amp;gt; remotely and investigating the DOM tree in the document inspector. We want to expand these capabilities by completing previous work that enables remote logging from web content, and add new capabilities to log HTTP requests and responses to allow for easier debugging of network-related problems in Servo.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
=='''Introduction'''==&lt;br /&gt;
Servo is a prototype web browser engine and is currently developed on 64bit OS X, 64bit Linux, and Android.It is developed using the RUST&amp;lt;ref&amp;gt;http://doc.rust-lang.org/book/README.html&amp;lt;/ref&amp;gt; language. &lt;br /&gt;
&lt;br /&gt;
=='''Running Servo'''==&lt;br /&gt;
===Installation===&lt;br /&gt;
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 libbz2-dev libosmesa6-dev&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
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 cmake bzip2-devel libXcursor-devel&lt;br /&gt;
pushd /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;
===Building===&lt;br /&gt;
Servo is built with Cargo, the Rust package manager. We also use Mozilla's Mach tools to orchestrate the build and other tasks.&lt;br /&gt;
Normal Build&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;
./mach build&lt;br /&gt;
./mach run tests/html/about-mozilla.html&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Running===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
./mach run [url]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Remote Developer Tools'''==&lt;br /&gt;
You can use remote developer tools, such as the one in Firefox to debug Web sites and Web apps running on different browsers. The other browser could either be on the same device or a different device. &lt;br /&gt;
Servo has a basic implementation of developer tools that supports executing JS remotely and investigating the DOM tree in the document inspector. As part of the project for extending the funcionalities to enable remote logging from web content, and add new capabilities to log HTTP requests and responses to allow for easier debugging of network-related problems in Servo, we performed some initial additions to the code to get the web console to print out log messages. &lt;br /&gt;
&lt;br /&gt;
The following changes were made to the ConsoleMsg struct in components/devtools/libs.rs:&lt;br /&gt;
*rename logLevel to level and make it a String&lt;br /&gt;
*rename timestamp to timeStamp&lt;br /&gt;
*add an arguments vector of Strings&lt;br /&gt;
*remove the message field and add the value to the arguments vector&lt;br /&gt;
*add filename, lineNumber, and columnNumber fields&lt;br /&gt;
&lt;br /&gt;
The following code snippets show the modified version:&lt;br /&gt;
&lt;br /&gt;
components/devtools/lib.rs:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    struct ConsoleMsg {&lt;br /&gt;
    level: String,&lt;br /&gt;
    timeStamp: u64,&lt;br /&gt;
    arguments: Vec&amp;lt;String&amp;gt;,&lt;br /&gt;
    filename: String,&lt;br /&gt;
    lineNumber: u32,&lt;br /&gt;
    columnNumber: u32,&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
 fn handle_console_message(actors: Arc&amp;lt;Mutex&amp;lt;ActorRegistry&amp;gt;&amp;gt;,&lt;br /&gt;
                           id: PipelineId,&lt;br /&gt;
                           console_message: ConsoleMessage,&lt;br /&gt;
                           actor_pipelines: &amp;amp;HashMap&amp;lt;PipelineId, String&amp;gt;) {&lt;br /&gt;
    let console_actor_name = find_console_actor(actors.clone(), id, actor_pipelines);&lt;br /&gt;
    let actors = actors.lock().unwrap();&lt;br /&gt;
    let console_actor = actors.find::&amp;lt;ConsoleActor&amp;gt;(console_actor_name.as_slice());&lt;br /&gt;
    match console_message {&lt;br /&gt;
        ConsoleMessage::LogMessage(message, filename, lineNumber, columnNumber) =&amp;gt; {&lt;br /&gt;
            let msg = ConsoleAPICall {&lt;br /&gt;
                from: console_actor.name.clone(),&lt;br /&gt;
                __type__: &amp;quot;consoleAPICall&amp;quot;.to_string(),&lt;br /&gt;
                message: ConsoleMsg {&lt;br /&gt;
                    level: &amp;quot;log&amp;quot;.to_string(),&lt;br /&gt;
                    timeStamp: precise_time_ns(),&lt;br /&gt;
                    arguments: vec!(message),&lt;br /&gt;
                    filename: filename,&lt;br /&gt;
                    lineNumber: lineNumber,&lt;br /&gt;
                    columnNumber: columnNumber,&lt;br /&gt;
                },&lt;br /&gt;
        };&lt;br /&gt;
        for stream in console_actor.streams.borrow_mut().iter_mut() {&lt;br /&gt;
            stream.write_json_packet(&amp;amp;msg);&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
components/devtools_traits/lib.rs&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pub enum ConsoleMessage {&lt;br /&gt;
    // Log: message, filename, line number, column number&lt;br /&gt;
    LogMessage(String, String, u32, u32),&lt;br /&gt;
    //WarnMessage(String),&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
components/script/dom/console.rs&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
impl&amp;lt;'a&amp;gt; ConsoleMethods for JSRef&amp;lt;'a, Console&amp;gt; {&lt;br /&gt;
    fn Log(self, message: DOMString) {&lt;br /&gt;
        println!(&amp;quot;{}&amp;quot;, message);&lt;br /&gt;
        //TODO: Sending fake values for filename, lineNumber and columnNumber in LogMessage; adjust later&lt;br /&gt;
        propagate_console_msg(&amp;amp;self, ConsoleMessage::LogMessage(message, String::from_str(&amp;quot;test&amp;quot;), 1, 1));&lt;br /&gt;
    }&lt;br /&gt;
    .&lt;br /&gt;
    .&lt;br /&gt;
    .&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Amohanr</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015/oss_M1503_EDT&amp;diff=95847</id>
		<title>CSC/ECE 517 Spring 2015/oss M1503 EDT</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015/oss_M1503_EDT&amp;diff=95847"/>
		<updated>2015-03-23T23:55:41Z</updated>

		<summary type="html">&lt;p&gt;Amohanr: /* Remote Developer Tools */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;font size=&amp;quot;5&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Extending Developer Tools for Servo&amp;lt;/b&amp;gt;&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Servo&amp;lt;ref&amp;gt;https://github.com/servo/servo/&amp;lt;/ref&amp;gt; is a prototype web browser engine written in the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/rust-lang/rust RUST]&amp;lt;/span&amp;gt; language. Servo implements a very basic developer tools server that currently supports executing JS remotely and investigating the DOM tree in the document inspector. We want to expand these capabilities by completing previous work that enables remote logging from web content, and add new capabilities to log HTTP requests and responses to allow for easier debugging of network-related problems in Servo.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
=='''Introduction'''==&lt;br /&gt;
Servo is a prototype web browser engine and is currently developed on 64bit OS X, 64bit Linux, and Android.It is developed using the RUST&amp;lt;ref&amp;gt;http://doc.rust-lang.org/book/README.html&amp;lt;/ref&amp;gt; language. &lt;br /&gt;
&lt;br /&gt;
=='''Running Servo'''==&lt;br /&gt;
===Installation===&lt;br /&gt;
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 libbz2-dev libosmesa6-dev&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
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 cmake bzip2-devel libXcursor-devel&lt;br /&gt;
pushd /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;
===Building===&lt;br /&gt;
Servo is built with Cargo, the Rust package manager. We also use Mozilla's Mach tools to orchestrate the build and other tasks.&lt;br /&gt;
Normal Build&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;
./mach build&lt;br /&gt;
./mach run tests/html/about-mozilla.html&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Running===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
./mach run [url]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Remote Developer Tools'''==&lt;br /&gt;
You can use remote developer tools, such as the one in Firefox to debug Web sites and Web apps running on different browsers. The other browser could either be on the same device or a different device. &lt;br /&gt;
Servo has a basic implementation of developer tools that supports executing JS remotely and investigating the DOM tree in the document inspector. As part of the project for extending the funcionalities to enable remote logging from web content, and add new capabilities to log HTTP requests and responses to allow for easier debugging of network-related problems in Servo, we performed some initial additions to the code to get the web console to print out log messages. &lt;br /&gt;
&lt;br /&gt;
The following changes were made to the ConsoleMsg struct in components/devtools/libs.rs:&lt;br /&gt;
*rename logLevel to level and make it a String&lt;br /&gt;
*rename timestamp to timeStamp&lt;br /&gt;
*add an arguments vector of Strings&lt;br /&gt;
*remove the message field and add the value to the arguments vector&lt;br /&gt;
*add filename, lineNumber, and columnNumber fields&lt;br /&gt;
&lt;br /&gt;
The following code snippets show the modified version:&lt;br /&gt;
&lt;br /&gt;
components/devtools/lib.rs:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    struct ConsoleMsg {&lt;br /&gt;
    level: String,&lt;br /&gt;
    timeStamp: u64,&lt;br /&gt;
    arguments: Vec&amp;lt;String&amp;gt;,&lt;br /&gt;
    filename: String,&lt;br /&gt;
    lineNumber: u32,&lt;br /&gt;
    columnNumber: u32,&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
 fn handle_console_message(actors: Arc&amp;lt;Mutex&amp;lt;ActorRegistry&amp;gt;&amp;gt;,&lt;br /&gt;
                           id: PipelineId,&lt;br /&gt;
                           console_message: ConsoleMessage,&lt;br /&gt;
                           actor_pipelines: &amp;amp;HashMap&amp;lt;PipelineId, String&amp;gt;) {&lt;br /&gt;
    let console_actor_name = find_console_actor(actors.clone(), id, actor_pipelines);&lt;br /&gt;
    let actors = actors.lock().unwrap();&lt;br /&gt;
    let console_actor = actors.find::&amp;lt;ConsoleActor&amp;gt;(console_actor_name.as_slice());&lt;br /&gt;
    match console_message {&lt;br /&gt;
        ConsoleMessage::LogMessage(message, filename, lineNumber, columnNumber) =&amp;gt; {&lt;br /&gt;
            let msg = ConsoleAPICall {&lt;br /&gt;
                from: console_actor.name.clone(),&lt;br /&gt;
                __type__: &amp;quot;consoleAPICall&amp;quot;.to_string(),&lt;br /&gt;
                message: ConsoleMsg {&lt;br /&gt;
                    level: &amp;quot;log&amp;quot;.to_string(),&lt;br /&gt;
                    timeStamp: precise_time_ns(),&lt;br /&gt;
                    arguments: vec!(message),&lt;br /&gt;
                    filename: filename,&lt;br /&gt;
                    lineNumber: lineNumber,&lt;br /&gt;
                    columnNumber: columnNumber,&lt;br /&gt;
                },&lt;br /&gt;
        };&lt;br /&gt;
        for stream in console_actor.streams.borrow_mut().iter_mut() {&lt;br /&gt;
            stream.write_json_packet(&amp;amp;msg);&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
components/devtools_traits/lib.rs&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pub enum ConsoleMessage {&lt;br /&gt;
    // Log: message, filename, line number, column number&lt;br /&gt;
    LogMessage(String, String, u32, u32),&lt;br /&gt;
    //WarnMessage(String),&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
components/script/dom/console.rs&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
impl&amp;lt;'a&amp;gt; ConsoleMethods for JSRef&amp;lt;'a, Console&amp;gt; {&lt;br /&gt;
    fn Log(self, message: DOMString) {&lt;br /&gt;
        println!(&amp;quot;{}&amp;quot;, message);&lt;br /&gt;
        //TODO: Sending fake values for filename, lineNumber and columnNumber in LogMessage; adjust later&lt;br /&gt;
        propagate_console_msg(&amp;amp;self, ConsoleMessage::LogMessage(message, String::from_str(&amp;quot;test&amp;quot;), 1, 1));&lt;br /&gt;
    }&lt;br /&gt;
    .&lt;br /&gt;
    .&lt;br /&gt;
    .&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Amohanr</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015/oss_M1503_EDT&amp;diff=95846</id>
		<title>CSC/ECE 517 Spring 2015/oss M1503 EDT</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015/oss_M1503_EDT&amp;diff=95846"/>
		<updated>2015-03-23T23:53:29Z</updated>

		<summary type="html">&lt;p&gt;Amohanr: /* Remote Developer Tools */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;font size=&amp;quot;5&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Extending Developer Tools for Servo&amp;lt;/b&amp;gt;&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Servo&amp;lt;ref&amp;gt;https://github.com/servo/servo/&amp;lt;/ref&amp;gt; is a prototype web browser engine written in the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/rust-lang/rust RUST]&amp;lt;/span&amp;gt; language. Servo implements a very basic developer tools server that currently supports executing JS remotely and investigating the DOM tree in the document inspector. We want to expand these capabilities by completing previous work that enables remote logging from web content, and add new capabilities to log HTTP requests and responses to allow for easier debugging of network-related problems in Servo.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
=='''Introduction'''==&lt;br /&gt;
Servo is a prototype web browser engine and is currently developed on 64bit OS X, 64bit Linux, and Android.It is developed using the RUST&amp;lt;ref&amp;gt;http://doc.rust-lang.org/book/README.html&amp;lt;/ref&amp;gt; language. &lt;br /&gt;
&lt;br /&gt;
=='''Running Servo'''==&lt;br /&gt;
===Installation===&lt;br /&gt;
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 libbz2-dev libosmesa6-dev&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
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 cmake bzip2-devel libXcursor-devel&lt;br /&gt;
pushd /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;
===Building===&lt;br /&gt;
Servo is built with Cargo, the Rust package manager. We also use Mozilla's Mach tools to orchestrate the build and other tasks.&lt;br /&gt;
Normal Build&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;
./mach build&lt;br /&gt;
./mach run tests/html/about-mozilla.html&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Running===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
./mach run [url]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Remote Developer Tools'''==&lt;br /&gt;
You can use remote developer tools, such as the one in Firefox to debug Web sites and Web apps running on different browsers. The other browser could either be on the same device or a different device. &lt;br /&gt;
Servo has a basic implementation of developer tools that supports executing JS remotely and investigating the DOM tree in the document inspector. As part of the project for extending the funcionalities to enable remote logging from web content, and add new capabilities to log HTTP requests and responses to allow for easier debugging of network-related problems in Servo, we performed some initial additions to the code to get the web console to print out log messages. &lt;br /&gt;
&lt;br /&gt;
The following changes were made to the ConsoleMsg struct in components/devtools/libs.rs:&lt;br /&gt;
*rename logLevel to level and make it a String&lt;br /&gt;
*rename timestamp to timeStamp&lt;br /&gt;
*add an arguments vector of Strings&lt;br /&gt;
*remove the message field and add the value to the arguments vector&lt;br /&gt;
*add filename, lineNumber, and columnNumber fields&lt;br /&gt;
&lt;br /&gt;
The following code snippets show the modified version:&lt;br /&gt;
&lt;br /&gt;
components/devtools/lib.rs:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    struct ConsoleMsg {&lt;br /&gt;
    level: String,&lt;br /&gt;
    timeStamp: u64,&lt;br /&gt;
    arguments: Vec&amp;lt;String&amp;gt;,&lt;br /&gt;
    filename: String,&lt;br /&gt;
    lineNumber: u32,&lt;br /&gt;
    columnNumber: u32,&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
 fn handle_console_message(actors: Arc&amp;lt;Mutex&amp;lt;ActorRegistry&amp;gt;&amp;gt;,&lt;br /&gt;
                           id: PipelineId,&lt;br /&gt;
                           console_message: ConsoleMessage,&lt;br /&gt;
                           actor_pipelines: &amp;amp;HashMap&amp;lt;PipelineId, String&amp;gt;) {&lt;br /&gt;
    let console_actor_name = find_console_actor(actors.clone(), id, actor_pipelines);&lt;br /&gt;
    let actors = actors.lock().unwrap();&lt;br /&gt;
    let console_actor = actors.find::&amp;lt;ConsoleActor&amp;gt;(console_actor_name.as_slice());&lt;br /&gt;
    match console_message {&lt;br /&gt;
        ConsoleMessage::LogMessage(message, filename, lineNumber, columnNumber) =&amp;gt; {&lt;br /&gt;
            let msg = ConsoleAPICall {&lt;br /&gt;
                from: console_actor.name.clone(),&lt;br /&gt;
                __type__: &amp;quot;consoleAPICall&amp;quot;.to_string(),&lt;br /&gt;
                message: ConsoleMsg {&lt;br /&gt;
                    level: &amp;quot;log&amp;quot;.to_string(),&lt;br /&gt;
                    timeStamp: precise_time_ns(),&lt;br /&gt;
                    arguments: vec!(message),&lt;br /&gt;
                    filename: filename,&lt;br /&gt;
                    lineNumber: lineNumber,&lt;br /&gt;
                    columnNumber: columnNumber,&lt;br /&gt;
                },&lt;br /&gt;
        };&lt;br /&gt;
        for stream in console_actor.streams.borrow_mut().iter_mut() {&lt;br /&gt;
            stream.write_json_packet(&amp;amp;msg);&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
components/devtools_traits/lib.rs&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pub enum ConsoleMessage {&lt;br /&gt;
    // Log: message, filename, line number, column number&lt;br /&gt;
    LogMessage(String, String, u32, u32),&lt;br /&gt;
    //WarnMessage(String),&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Amohanr</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015/oss_M1503_EDT&amp;diff=95841</id>
		<title>CSC/ECE 517 Spring 2015/oss M1503 EDT</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015/oss_M1503_EDT&amp;diff=95841"/>
		<updated>2015-03-23T23:48:01Z</updated>

		<summary type="html">&lt;p&gt;Amohanr: /* Remote Developer Tools */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;font size=&amp;quot;5&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Extending Developer Tools for Servo&amp;lt;/b&amp;gt;&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Servo&amp;lt;ref&amp;gt;https://github.com/servo/servo/&amp;lt;/ref&amp;gt; is a prototype web browser engine written in the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/rust-lang/rust RUST]&amp;lt;/span&amp;gt; language. Servo implements a very basic developer tools server that currently supports executing JS remotely and investigating the DOM tree in the document inspector. We want to expand these capabilities by completing previous work that enables remote logging from web content, and add new capabilities to log HTTP requests and responses to allow for easier debugging of network-related problems in Servo.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
=='''Introduction'''==&lt;br /&gt;
Servo is a prototype web browser engine and is currently developed on 64bit OS X, 64bit Linux, and Android.It is developed using the RUST&amp;lt;ref&amp;gt;http://doc.rust-lang.org/book/README.html&amp;lt;/ref&amp;gt; language. &lt;br /&gt;
&lt;br /&gt;
=='''Running Servo'''==&lt;br /&gt;
===Installation===&lt;br /&gt;
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 libbz2-dev libosmesa6-dev&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
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 cmake bzip2-devel libXcursor-devel&lt;br /&gt;
pushd /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;
===Building===&lt;br /&gt;
Servo is built with Cargo, the Rust package manager. We also use Mozilla's Mach tools to orchestrate the build and other tasks.&lt;br /&gt;
Normal Build&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;
./mach build&lt;br /&gt;
./mach run tests/html/about-mozilla.html&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Running===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
./mach run [url]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Remote Developer Tools'''==&lt;br /&gt;
You can use remote developer tools, such as the one in Firefox to debug Web sites and Web apps running on different browsers. The other browser could either be on the same device or a different device. &lt;br /&gt;
Servo has a basic implementation of developer tools that supports executing JS remotely and investigating the DOM tree in the document inspector. As part of the project for extending the funcionalities to enable remote logging from web content, and add new capabilities to log HTTP requests and responses to allow for easier debugging of network-related problems in Servo, we performed some initial additions to the code to get the web console to print out log messages. &lt;br /&gt;
&lt;br /&gt;
The following changes were made to the ConsoleMsg struct in components/devtools/libs.rs:&lt;br /&gt;
*rename logLevel to level and make it a String&lt;br /&gt;
*rename timestamp to timeStamp&lt;br /&gt;
*add an arguments vector of Strings&lt;br /&gt;
*remove the message field and add the value to the arguments vector&lt;br /&gt;
*add filename, lineNumber, and columnNumber fields&lt;br /&gt;
&lt;br /&gt;
The following code snippets show the modified version:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
components/devtools/lib.rs:&lt;br /&gt;
&lt;br /&gt;
    struct ConsoleMsg {&lt;br /&gt;
    level: String,&lt;br /&gt;
    timeStamp: u64,&lt;br /&gt;
    arguments: Vec&amp;lt;String&amp;gt;,&lt;br /&gt;
    filename: String,&lt;br /&gt;
    lineNumber: u32,&lt;br /&gt;
    columnNumber: u32,&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
 fn handle_console_message(actors: Arc&amp;lt;Mutex&amp;lt;ActorRegistry&amp;gt;&amp;gt;,&lt;br /&gt;
                           id: PipelineId,&lt;br /&gt;
                           console_message: ConsoleMessage,&lt;br /&gt;
                           actor_pipelines: &amp;amp;HashMap&amp;lt;PipelineId, String&amp;gt;) {&lt;br /&gt;
    let console_actor_name = find_console_actor(actors.clone(), id, actor_pipelines);&lt;br /&gt;
    let actors = actors.lock().unwrap();&lt;br /&gt;
    let console_actor = actors.find::&amp;lt;ConsoleActor&amp;gt;(console_actor_name.as_slice());&lt;br /&gt;
    match console_message {&lt;br /&gt;
        ConsoleMessage::LogMessage(message, filename, lineNumber, columnNumber) =&amp;gt; {&lt;br /&gt;
            let msg = ConsoleAPICall {&lt;br /&gt;
                from: console_actor.name.clone(),&lt;br /&gt;
                __type__: &amp;quot;consoleAPICall&amp;quot;.to_string(),&lt;br /&gt;
                message: ConsoleMsg {&lt;br /&gt;
                    level: &amp;quot;log&amp;quot;.to_string(),&lt;br /&gt;
                    timeStamp: precise_time_ns(),&lt;br /&gt;
                    arguments: vec!(message),&lt;br /&gt;
                    filename: filename,&lt;br /&gt;
                    lineNumber: lineNumber,&lt;br /&gt;
                    columnNumber: columnNumber,&lt;br /&gt;
                },&lt;br /&gt;
        };&lt;br /&gt;
        for stream in console_actor.streams.borrow_mut().iter_mut() {&lt;br /&gt;
            stream.write_json_packet(&amp;amp;msg);&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Amohanr</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015/oss_M1503_EDT&amp;diff=95824</id>
		<title>CSC/ECE 517 Spring 2015/oss M1503 EDT</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015/oss_M1503_EDT&amp;diff=95824"/>
		<updated>2015-03-23T23:08:54Z</updated>

		<summary type="html">&lt;p&gt;Amohanr: /* Remote Developer Tools */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;font size=&amp;quot;5&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Extending Developer Tools for Servo&amp;lt;/b&amp;gt;&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Servo&amp;lt;ref&amp;gt;https://github.com/servo/servo/&amp;lt;/ref&amp;gt; is a prototype web browser engine written in the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/rust-lang/rust RUST]&amp;lt;/span&amp;gt; language. Servo implements a very basic developer tools server that currently supports executing JS remotely and investigating the DOM tree in the document inspector. We want to expand these capabilities by completing previous work that enables remote logging from web content, and add new capabilities to log HTTP requests and responses to allow for easier debugging of network-related problems in Servo.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
=='''Introduction'''==&lt;br /&gt;
Servo is a prototype web browser engine and is currently developed on 64bit OS X, 64bit Linux, and Android.It is developed using the RUST&amp;lt;ref&amp;gt;http://doc.rust-lang.org/book/README.html&amp;lt;/ref&amp;gt; language. &lt;br /&gt;
&lt;br /&gt;
=='''Running Servo'''==&lt;br /&gt;
===Installation===&lt;br /&gt;
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 libbz2-dev libosmesa6-dev&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
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 cmake bzip2-devel libXcursor-devel&lt;br /&gt;
pushd /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;
===Building===&lt;br /&gt;
Servo is built with Cargo, the Rust package manager. We also use Mozilla's Mach tools to orchestrate the build and other tasks.&lt;br /&gt;
Normal Build&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;
./mach build&lt;br /&gt;
./mach run tests/html/about-mozilla.html&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Running===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
./mach run [url]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Remote Developer Tools'''==&lt;br /&gt;
You can use remote developer tools, such as the one in Firefox to debug Web sites and Web apps running on different browsers. The other browser could either be on the same device or a different device. &lt;br /&gt;
Servo has a basic implementation of developer tools that supports executing JS remotely and investigating the DOM tree in the document inspector. As part of the project for extending the funcionalities to enable remote logging from web content, and add new capabilities to log HTTP requests and responses to allow for easier debugging of network-related problems in Servo, we performed some initial additions to the code to get the web console to print out log messages. &lt;br /&gt;
&lt;br /&gt;
The following changes were made to the ConsoleMsg struct in components/devtools/libs.rs:&lt;br /&gt;
*rename logLevel to level and make it a String&lt;br /&gt;
*rename timestamp to timeStamp&lt;br /&gt;
*add an arguments vector of Strings&lt;br /&gt;
*remove the message field and add the value to the arguments vector&lt;br /&gt;
*add filename, lineNumber, and columnNumber fields&lt;br /&gt;
&lt;br /&gt;
The following code snippets show the modified version:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Amohanr</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015/oss_M1503_EDT&amp;diff=95820</id>
		<title>CSC/ECE 517 Spring 2015/oss M1503 EDT</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015/oss_M1503_EDT&amp;diff=95820"/>
		<updated>2015-03-23T23:03:42Z</updated>

		<summary type="html">&lt;p&gt;Amohanr: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;font size=&amp;quot;5&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Extending Developer Tools for Servo&amp;lt;/b&amp;gt;&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Servo&amp;lt;ref&amp;gt;https://github.com/servo/servo/&amp;lt;/ref&amp;gt; is a prototype web browser engine written in the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/rust-lang/rust RUST]&amp;lt;/span&amp;gt; language. Servo implements a very basic developer tools server that currently supports executing JS remotely and investigating the DOM tree in the document inspector. We want to expand these capabilities by completing previous work that enables remote logging from web content, and add new capabilities to log HTTP requests and responses to allow for easier debugging of network-related problems in Servo.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
=='''Introduction'''==&lt;br /&gt;
Servo is a prototype web browser engine and is currently developed on 64bit OS X, 64bit Linux, and Android.It is developed using the RUST&amp;lt;ref&amp;gt;http://doc.rust-lang.org/book/README.html&amp;lt;/ref&amp;gt; language. &lt;br /&gt;
&lt;br /&gt;
=='''Running Servo'''==&lt;br /&gt;
===Installation===&lt;br /&gt;
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 libbz2-dev libosmesa6-dev&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
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 cmake bzip2-devel libXcursor-devel&lt;br /&gt;
pushd /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;
===Building===&lt;br /&gt;
Servo is built with Cargo, the Rust package manager. We also use Mozilla's Mach tools to orchestrate the build and other tasks.&lt;br /&gt;
Normal Build&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;
./mach build&lt;br /&gt;
./mach run tests/html/about-mozilla.html&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Running===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
./mach run [url]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Remote Developer Tools'''==&lt;br /&gt;
You can use remote developer tools, such as the one in Firefox to debug Web sites and Web apps running on different browsers. The other browser could either be on the same device or a different device. &lt;br /&gt;
Servo has a basic implementation of developer tools that supports executing JS remotely and investigating the DOM tree in the document inspector. As part of the project for extending the funcionalities to enable remote logging from web content, and add new capabilities to log HTTP requests and responses to allow for easier debugging of network-related problems in Servo, we performed some initial additions to the code to get the web console to print out log messages.&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Amohanr</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015/oss_M1503_EDT&amp;diff=95811</id>
		<title>CSC/ECE 517 Spring 2015/oss M1503 EDT</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015/oss_M1503_EDT&amp;diff=95811"/>
		<updated>2015-03-23T22:10:32Z</updated>

		<summary type="html">&lt;p&gt;Amohanr: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;font size=&amp;quot;5&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Extending Developer Tools for Servo&amp;lt;/b&amp;gt;&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Servo&amp;lt;ref&amp;gt;https://github.com/servo/servo/&amp;lt;/ref&amp;gt; is a prototype web browser engine written in the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/rust-lang/rust RUST]&amp;lt;/span&amp;gt; language. Servo implements a very basic developer tools server that currently supports executing JS remotely and investigating the DOM tree in the document inspector. We want to expand these capabilities by completing previous work that enables remote logging from web content, and add new capabilities to log HTTP requests and responses to allow for easier debugging of network-related problems in Servo.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
=='''Introduction'''==&lt;br /&gt;
Servo is a prototype web browser engine and is currently developed on 64bit OS X, 64bit Linux, and Android.It is developed using the RUST&amp;lt;ref&amp;gt;http://doc.rust-lang.org/book/README.html&amp;lt;/ref&amp;gt; language. &lt;br /&gt;
&lt;br /&gt;
=='''Running Servo'''==&lt;br /&gt;
===Installation===&lt;br /&gt;
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 libbz2-dev libosmesa6-dev&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
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 cmake bzip2-devel libXcursor-devel&lt;br /&gt;
pushd /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;
===Building===&lt;br /&gt;
Servo is built with Cargo, the Rust package manager. We also use Mozilla's Mach tools to orchestrate the build and other tasks.&lt;br /&gt;
Normal Build&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;
./mach build&lt;br /&gt;
./mach run tests/html/about-mozilla.html&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Running===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
./mach run [url]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Remote Developer Tools'''==&lt;br /&gt;
You can use remote developer tools, such as the one in Firefox to debug Web sites and Web apps running on different browsers. The other browser could either be on the same device or a different device. &lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Amohanr</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015/oss_M1503_EDT&amp;diff=95798</id>
		<title>CSC/ECE 517 Spring 2015/oss M1503 EDT</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015/oss_M1503_EDT&amp;diff=95798"/>
		<updated>2015-03-23T21:39:49Z</updated>

		<summary type="html">&lt;p&gt;Amohanr: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;font size=&amp;quot;5&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Extending Developer Tools for Servo&amp;lt;/b&amp;gt;&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Servo&amp;lt;ref&amp;gt;https://github.com/servo/servo/&amp;lt;/ref&amp;gt; is a prototype web browser engine written in the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/rust-lang/rust RUST]&amp;lt;/span&amp;gt; language. Servo implements a very basic developer tools server that currently supports executing JS remotely and investigating the DOM tree in the document inspector. We want to expand these capabilities by completing previous work that enables remote logging from web content, and add new capabilities to log HTTP requests and responses to allow for easier debugging of network-related problems in Servo.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
=='''Introduction'''==&lt;br /&gt;
Servo is a prototype web browser engine and is currently developed on 64bit OS X, 64bit Linux, and Android.It is developed using the RUST&amp;lt;ref&amp;gt;http://doc.rust-lang.org/book/README.html&amp;lt;/ref&amp;gt; language. &lt;br /&gt;
&lt;br /&gt;
=='''Running Servo'''==&lt;br /&gt;
===Installation===&lt;br /&gt;
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 libbz2-dev libosmesa6-dev&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
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 cmake bzip2-devel libXcursor-devel&lt;br /&gt;
pushd /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;
===Building===&lt;br /&gt;
Servo is built with Cargo, the Rust package manager. We also use Mozilla's Mach tools to orchestrate the build and other tasks.&lt;br /&gt;
Normal Build&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;
./mach build&lt;br /&gt;
./mach run tests/html/about-mozilla.html&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Running===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
./mach run [url]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Amohanr</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015/oss_M1503_EDT&amp;diff=95404</id>
		<title>CSC/ECE 517 Spring 2015/oss M1503 EDT</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015/oss_M1503_EDT&amp;diff=95404"/>
		<updated>2015-03-22T16:54:12Z</updated>

		<summary type="html">&lt;p&gt;Amohanr: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;font size=&amp;quot;5&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Extending Developer Tools for Servo&amp;lt;/b&amp;gt;&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Servo&amp;lt;ref&amp;gt;https://github.com/servo/servo/&amp;lt;/ref&amp;gt; is a prototype web browser engine written in the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/rust-lang/rust RUST]&amp;lt;/span&amp;gt; language. Servo implements a very basic developer tools server that currently supports executing JS remotely and investigating the DOM tree in the document inspector. We want to expand these capabilities by completing previous work that enables remote logging from web content, and add new capabilities to log HTTP requests and responses to allow for easier debugging of network-related problems in Servo.&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Amohanr</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015/oss_M1503_EDT&amp;diff=95403</id>
		<title>CSC/ECE 517 Spring 2015/oss M1503 EDT</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015/oss_M1503_EDT&amp;diff=95403"/>
		<updated>2015-03-22T16:51:12Z</updated>

		<summary type="html">&lt;p&gt;Amohanr: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;font size=&amp;quot;5&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Extending Developer Tools for Servo&amp;lt;/b&amp;gt;&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Servo&amp;lt;ref&amp;gt;https://github.com/servo/servo/&amp;lt;/ref&amp;gt; is a prototype web browser engine written in the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/rust-lang/rust RUST]&amp;lt;/span&amp;gt; language. Servo implements a very basic developer tools server that currently supports executing JS remotely and investigating the DOM tree in the document inspector. We want to expand these capabilities by completing previous work that enables remote logging from web content, and add new capabilities to log HTTP requests and responses to allow for easier debugging of network-related problems in Servo.&lt;/div&gt;</summary>
		<author><name>Amohanr</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015/oss_M1503_EDT&amp;diff=95402</id>
		<title>CSC/ECE 517 Spring 2015/oss M1503 EDT</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015/oss_M1503_EDT&amp;diff=95402"/>
		<updated>2015-03-22T16:50:32Z</updated>

		<summary type="html">&lt;p&gt;Amohanr: Created page with &amp;quot;&amp;lt;font size=&amp;quot;5&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Extending Developer Tools for Servo&amp;lt;/b&amp;gt;&amp;lt;/font&amp;gt;  Servo&amp;lt;ref&amp;gt;https://github.com/servo/servo&amp;lt;/ref&amp;gt; is a prototype web browser engine written in the &amp;lt;span class=&amp;quot;pla...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;font size=&amp;quot;5&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Extending Developer Tools for Servo&amp;lt;/b&amp;gt;&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Servo&amp;lt;ref&amp;gt;https://github.com/servo/servo&amp;lt;/ref&amp;gt; is a prototype web browser engine written in the &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/rust-lang/rust RUST]&amp;lt;/span&amp;gt; language. Servo implements a very basic developer tools server that currently supports executing JS remotely and investigating the DOM tree in the document inspector. We want to expand these capabilities by completing previous work that enables remote logging from web content, and add new capabilities to log HTTP requests and responses to allow for easier debugging of network-related problems in Servo.&lt;/div&gt;</summary>
		<author><name>Amohanr</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015&amp;diff=95401</id>
		<title>CSC/ECE 517 Spring 2015</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015&amp;diff=95401"/>
		<updated>2015-03-22T16:19:54Z</updated>

		<summary type="html">&lt;p&gt;Amohanr: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Writing Assignment 1==&lt;br /&gt;
*[[CSC/ECE 517 Spring 2015/ch1a 17 WL]]&lt;br /&gt;
*[[CSC/ECE 517 Spring 2015/ch1a 5 ZX]]&lt;br /&gt;
*[[CSC/ECE 517 Spring 2015/ch1a 6 TZ]]&lt;br /&gt;
*[[CSC/ECE 517 Spring 2015/ch1a 4 RW]]&lt;br /&gt;
*[[CSC/ECE 517 Spring 2015/ch1a 7 SA]]&lt;br /&gt;
*[[CSC/ECE 517 Spring 2015/ch1a 9 RA]]&lt;br /&gt;
*[[CSC/ECE 517 Spring 2015/ch1a 14 RI]]&lt;br /&gt;
*[[CSC/ECE 517 Spring 2015/ch1a 1 DZ]]&lt;br /&gt;
*[[CSC/ECE 517 Spring 2015/ch1a 20 HA]]&lt;br /&gt;
*[[CSC/ECE 517 Spring 2015/ch1a 3 RF]]&lt;br /&gt;
*[[CSC/ECE 517 Spring 2015/ch1a 12 LS]]&lt;br /&gt;
*[[CSC/ECE 517 Spring 2015/ch1a 13 MA]]&lt;br /&gt;
*[[CSC/ECE 517 Spring 2015/ch1a 2 WA]]&lt;br /&gt;
*[[CSC/ECE 517 Spring 2015/ch1b 21 QW]]&lt;br /&gt;
*[[CSC/ECE 517 Spring 2015/ch1b 23 MS]]&lt;br /&gt;
*[[CSC/ECE 517 Spring 2015/ch1b 10 GL]]&lt;br /&gt;
*[[CSC/ECE 517 Spring 2015/ch1b 27 VC]]&lt;br /&gt;
*[[CSC/ECE 517 Spring 2015/ch1b 22 SF]]&lt;br /&gt;
*[[CSC/ECE 517 Spring 2015/ch1b 15 SH]]&lt;br /&gt;
*[[CSC/ECE 517 Spring 2015/ch1b 18 AS]]&lt;br /&gt;
&lt;br /&gt;
==Writing Assignment 2==&lt;br /&gt;
*[[CSC/ECE 517 Fall 2014/oss E1502 wwj]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2014/oss E1508 MRS]]&lt;br /&gt;
*[[CSC/ECE 517 Spring 2015/oss E1504 IMV]]&lt;br /&gt;
*[[CSC/ECE 517 Spring 2015/oss E1505 xzl]]&lt;br /&gt;
*[[CSC/ECE 517 Spring 2015/oss E1509 lds]]&lt;br /&gt;
*[[CSC/ECE 517 Spring 2015/oss E1510 FLP]]&lt;br /&gt;
*[[CSC/ECE 517 Spring 2015/oss E1506 SYZ]]&lt;br /&gt;
*[[CSC/ECE 517 Spring 2015/oss S1504 AAC]]&lt;br /&gt;
*[[CSC/ECE 517 Spring 2015/oss E1507 DG]]&lt;br /&gt;
*[[CSC/ECE 517 Spring 2015/oss M1502 GVJ]]&lt;br /&gt;
*[[CSC/ECE 517 Spring 2015/oss M1503 EDT]]&lt;/div&gt;</summary>
		<author><name>Amohanr</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015/ch1b_18_AS&amp;diff=94257</id>
		<title>CSC/ECE 517 Spring 2015/ch1b 18 AS</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015/ch1b_18_AS&amp;diff=94257"/>
		<updated>2015-02-18T21:32:51Z</updated>

		<summary type="html">&lt;p&gt;Amohanr: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;font size=&amp;quot;5&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Apache Solr and Rails&amp;lt;/b&amp;gt;&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The topic write up for this page can be found [https://docs.google.com/document/d/1TgBtp7flIPKJwkkShgtcIkt--mtHuwVHsQX6Tpzj1rc here].&lt;br /&gt;
[[File: solr.jpg|right]]&lt;br /&gt;
Apache Solr&amp;lt;ref&amp;gt;http://lucene.apache.org/solr/&amp;lt;/ref&amp;gt; is a standalone, open-source enterprise search server, written in Java and created by Yonik Seely. It is a servlet that can run within a servlet container such as Apache Tomcat. It is a very popular, fast and scaleable open source enterprise search platform built on &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[http://lucene.apache.org/index.html Apache Lucene]&amp;lt;/span&amp;gt; search library. &lt;br /&gt;
&lt;br /&gt;
Rails is a ruby framwork used to develop web based application that incorporates the&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt; [http://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controllerRails MVC]&amp;lt;/span&amp;gt; architectural pattern. Websites using &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt; [http://rubyonrails.org/ Rails]&amp;lt;/span&amp;gt; can take advantage of the Solr search engine to provide very sophisticated and customizable search features. Rails integrates with Solr search server using Sunspot&amp;lt;ref&amp;gt;https://rubygems.org/gems/sunspot_rails&amp;lt;/ref&amp;gt;&amp;lt;ref&amp;gt;https://github.com/sunspot/sunspot&amp;lt;/ref&amp;gt; gem.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
=='''Introduction'''==&lt;br /&gt;
Apache Solr is a standalone enterprise search server with a &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[http://en.wikipedia.org/wiki/Representational_state_transfer REST]&amp;lt;/span&amp;gt;-like API. Solr is an indexing and searching framework which could be deployed and used with many web frameworks like Rails, Drupal, Django etc. Indexing could be done using JSON, XML, CSV or binary over Hyper text transfer protocol. It could be then queried using HTTP with a GET method and receive the JSON, XML, CSV or binary results. &lt;br /&gt;
&lt;br /&gt;
===Technology Stack&amp;lt;ref&amp;gt;http://www.slideshare.net/dkeener/rails-and-the-apache-solr-search-engine&amp;lt;/ref&amp;gt;===&lt;br /&gt;
Solr is built on top of Apache Lucene. It is a toolbox responsible for indexing, searching, spell-check and advance tokenization whereas Solr is a search server which inherits all the features of Lucene but also adds API integration, caching and most importantly a web admin interface. This feature makes Solr very easy to use in production environment. Both of these technology needs Java 1.4 or above. &lt;br /&gt;
[[File: structure_solr.png|center]]&lt;br /&gt;
Sunspot library interacts with Solr using a low-level interface called RSolr. It is a ruby client which integrates with the Solr API's to Rails through the use of Sunspot gem. Sunspot has a drop-in ActiveRecord support. Sunspot provides a easy abstraction to using the Solr search engine. The installation and application of Solr using Sunspot gem is discussed below.&lt;br /&gt;
&lt;br /&gt;
=='''Features&amp;lt;ref&amp;gt;http://lucene.apache.org/solr/features.html&amp;lt;/ref&amp;gt;'''==&lt;br /&gt;
Apache Solr has the following features &lt;br /&gt;
&lt;br /&gt;
*Enables full-text matching, powered by Lucene software&lt;br /&gt;
*Built to handle high volume traffic&lt;br /&gt;
*Provides &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[http://en.wikipedia.org/wiki/Faceted_search faceted]&amp;lt;/span&amp;gt; searching&lt;br /&gt;
*Provides features like suggester, spellcheck, clustering, auto-complete, highlighting&lt;br /&gt;
*Extensible through plugins&lt;br /&gt;
*Supports statistical and aggregate processing of text&lt;br /&gt;
*Supports rich format data such as PDF, Word, Powerpoint&lt;br /&gt;
&lt;br /&gt;
Rails uses the Sunspot Ruby library to integrate with the Solr search engine.&lt;br /&gt;
=='''Installation'''==&lt;br /&gt;
&lt;br /&gt;
Sunspot makes it easy to do full text searching through Solr. Sunspot comes as a gem and is installed in the usual way by adding it to the Gemfile and running bundle.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
gem 'sunspot_rails'&lt;br /&gt;
gem 'sunspot_solr' # optional pre-packaged Solr distribution for use in development&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
bundle install&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once the gem and its dependencies have installed we will need to generate Sunspot’s configuration file which we can do by running&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ rails g sunspot_rails:install&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This command creates a YML file at /config/sunspot.yml. We don’t need to make any changes to the default settings in this file.&lt;br /&gt;
Sunspot embeds Solr inside the gem so there’s no need to install it separately. This means that it works straight out of the box which makes it far more convenient to use in development. To get it up and running we run&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ rake sunspot:solr:start&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you’re running OS X Lion and you haven’t installed a Java runtime you’ll be prompted to do so when you run this command. You may also see a deprecation warning but this can be safely ignored. The command will also create some more configuration files for advanced configuration.&lt;br /&gt;
&lt;br /&gt;
=='''Usage and Examples&amp;lt;ref&amp;gt;http://outoftime.github.io/sunspot/docs/index.html&amp;lt;/ref&amp;gt;'''==&lt;br /&gt;
=== Indexing Objects ===&lt;br /&gt;
Add a searchable block to the objects you wish to index.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class Example &amp;lt; ActiveRecord::Base&lt;br /&gt;
  searchable do&lt;br /&gt;
    text :title, :body&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Text fields will be full-text searchable. Other fields which are outside the scope of searchable can be used to scope queries.&lt;br /&gt;
&lt;br /&gt;
=== Searching Objects ===&lt;br /&gt;
Now searching can be done simply by passing the query to search method in the respective class.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Example.search do&lt;br /&gt;
  fulltext 'query'&lt;br /&gt;
  with :conditions&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We can use many variations on the search now by changing the scope variables in the query.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Example of a Blog Search ===&lt;br /&gt;
Here we want to index the text fields. So, it is kept inside the searchable block.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class Blog &amp;lt; ActiveRecord::Base&lt;br /&gt;
  searchable do&lt;br /&gt;
    text :title, :body&lt;br /&gt;
    text :comments do&lt;br /&gt;
      comments.map { |comment| comment.body }&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    boolean :featured&lt;br /&gt;
    integer :blog_id&lt;br /&gt;
    integer :author_id&lt;br /&gt;
    integer :category_ids, :multiple =&amp;gt; true&lt;br /&gt;
    double  :average_rating&lt;br /&gt;
    time    :published_at&lt;br /&gt;
    time    :expired_at&lt;br /&gt;
&lt;br /&gt;
    string  :sort_title do&lt;br /&gt;
      title.downcase.gsub(/^(an?|the)/, '')&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now for searching the indexed objects we can use:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Blog.search do&lt;br /&gt;
  fulltext 'best author'&lt;br /&gt;
&lt;br /&gt;
  with :blog_id, 1&lt;br /&gt;
  with(:published_at).less_than Time.now&lt;br /&gt;
  order_by :published_at, :desc&lt;br /&gt;
  paginate :page =&amp;gt; 2, :per_page =&amp;gt; 15&lt;br /&gt;
  facet :category_ids, :author_id&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here the text fields are full text searchable and other attributes like blog_id, page, author_id is used to scope the query.&lt;br /&gt;
&lt;br /&gt;
=='''Extensions to Sunspot'''==&lt;br /&gt;
Though Sunspot is used primarily for indexing and searching, it could be further extended to support multiple features. Some of them are listed as:&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt; [http://en.wikipedia.org/wiki/Scope_%28computer_science%29 Scoping]&amp;lt;/span&amp;gt; scalar fields===&lt;br /&gt;
We can put Positive and negative restrictions along with conjunctions or disjunctions to scope the query.&lt;br /&gt;
&lt;br /&gt;
*Positive restrictions&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#Posts with a category of 1, 3, or 5&lt;br /&gt;
Blog.search do&lt;br /&gt;
  with(:category_ids, [1, 3, 5])&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Negative restrictions&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Blogs not in category 1 or 3&lt;br /&gt;
Blog.search do&lt;br /&gt;
  without(:category_ids, [1, 3])&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Disjunctions and Conjunctions&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Blogs that do not have an expired time or have not yet expired&lt;br /&gt;
Blog.search do&lt;br /&gt;
  any_of do&lt;br /&gt;
    with(:expired_at).greater_than(Time.now)&lt;br /&gt;
    with(:expired_at, nil)&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt; [http://en.wikipedia.org/wiki/Pagination Pagination]&amp;lt;/span&amp;gt;===&lt;br /&gt;
The search results given by Sunspot are paginated upto 30 items per page.&lt;br /&gt;
A custom number of results per page can be specified with the :per_page option to paginate:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
search = Blog.search do&lt;br /&gt;
  fulltext &amp;quot;pizza&amp;quot;&lt;br /&gt;
  paginate :page =&amp;gt; 1, :per_page =&amp;gt; 50&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Faceting===&lt;br /&gt;
&lt;br /&gt;
It is a feature of Solr that determines the number of documents that match a given search and an additional criterion. This allows you to build powerful drill-down interfaces for search.&lt;br /&gt;
In field facets each row represents a particular value for a given field. In query facets, each row represents an arbitrary scope.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Blogs that match 'war' returning counts for each :author_id&lt;br /&gt;
search = Blog.search do&lt;br /&gt;
  fulltext &amp;quot;war&amp;quot;&lt;br /&gt;
  facet :author_id&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
search.facet(:author_id).rows.each do |facet|&lt;br /&gt;
  puts &amp;quot;Author #{facet.value} has #{facet.count} war article!&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Ordering===&lt;br /&gt;
By default, Sunspot orders results by &amp;quot;score&amp;quot;: the Solr-determined relevancy metric. We can use order_by method to customize the search.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Order by average rating, descending&lt;br /&gt;
Blog.search do&lt;br /&gt;
  fulltext(&amp;quot;war&amp;quot;)&lt;br /&gt;
  order_by(:average_rating, :desc)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Highlighting===&lt;br /&gt;
It is the snippet of the matched part of the search result. It has to be stored in order to be produced.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
search = Blog.search do&lt;br /&gt;
  fulltext &amp;quot;war&amp;quot; do&lt;br /&gt;
    highlight :body&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It will highlight the word war in every result string.&lt;br /&gt;
&lt;br /&gt;
===Hits vs Results===&lt;br /&gt;
&lt;br /&gt;
Sunspot simply stores the type and primary key of objects in Solr. When results are retrieved, those primary keys are used to load the actual object like any relational database.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Using #results pulls in the records from the object-relational mapper&lt;br /&gt;
Blog.search.results.each do |result|&lt;br /&gt;
  puts result.body&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To get results without accessing the database, use hits:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Blog.search.hits.each do |hit|&lt;br /&gt;
  puts hit.stored(:body)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Reindexing===&lt;br /&gt;
Objects are automatically indexed to Solr as a part of the save callbacks but if there is a change in schema then reindexing is necessary.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
bundle exec rake sunspot:solr:reindex&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref&amp;gt;http://tech.favoritemedium.com/2010/01/full-text-search-in-rails-with-sunspot.html&amp;lt;/ref&amp;gt;&amp;lt;ref&amp;gt;http://www.linux-mag.com/id/7341/&amp;lt;/ref&amp;gt;Other interesting reads on the topic and referral links are mentioned below.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Amohanr</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015/ch1b_18_AS&amp;diff=94245</id>
		<title>CSC/ECE 517 Spring 2015/ch1b 18 AS</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015/ch1b_18_AS&amp;diff=94245"/>
		<updated>2015-02-18T20:22:05Z</updated>

		<summary type="html">&lt;p&gt;Amohanr: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;font size=&amp;quot;5&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Apache Solr and Rails&amp;lt;/b&amp;gt;&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The topic write up for this page can be found [https://docs.google.com/document/d/1TgBtp7flIPKJwkkShgtcIkt--mtHuwVHsQX6Tpzj1rc here].&lt;br /&gt;
[[File: solr.jpg|right]]&lt;br /&gt;
Apache Solr&amp;lt;ref&amp;gt;http://lucene.apache.org/solr/&amp;lt;/ref&amp;gt; is a standalone, open-source enterprise search server, written in Java and created by Yonik Seely. It is a servlet that can run within a servlet container such as Apache Tomcat. It has a &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[http://en.wikipedia.org/wiki/Representational_state_transfer REST]&amp;lt;/span&amp;gt;-like API. Solr is an indexing and searching framework which could be deployed and used with many web frameworks like Rails, Drupal, Django etc. Indexing could be done using JSON, XML, CSV or binary over Hyper text transfer protocol. It could be then queried using HTTP with a GET method and receive the JSON, XML, CSV or binary results. It is a very popular, fast and scaleable open source enterprise search platform built on &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[http://lucene.apache.org/index.html Apache Lucene]&amp;lt;/span&amp;gt; search library. &lt;br /&gt;
&lt;br /&gt;
Rails is a ruby framwork used to develop web based application that incorporates the&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt; [http://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controllerRails MVC]&amp;lt;/span&amp;gt; architectural pattern. Websites using &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt; [http://rubyonrails.org/ Rails]&amp;lt;/span&amp;gt; can take advantage of the Solr search engine to provide very sophisticated and customizable search features. Rails integrates with Solr search server using Sunspot&amp;lt;ref&amp;gt;https://rubygems.org/gems/sunspot_rails&amp;lt;/ref&amp;gt;&amp;lt;ref&amp;gt;https://github.com/sunspot/sunspot&amp;lt;/ref&amp;gt; gem.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
=='''Introduction'''==&lt;br /&gt;
Apache Solr is a standalone enterprise search server with a REST-like API. Indexing could be done using JSON, XML, CSV or binary over Hyper text transfer protocol. It could be then queried using HTTP with a GET method and receive the JSON, XML, CSV or binary results. It is a popular, scalable, blazing-fast, open source enterprise search platform built on Apache Lucene. Websites using rails can take advantage of the Solr search engine to provide sophisticated and customizable search features.&lt;br /&gt;
&lt;br /&gt;
===Technology Stack&amp;lt;ref&amp;gt;http://www.slideshare.net/dkeener/rails-and-the-apache-solr-search-engine&amp;lt;/ref&amp;gt;===&lt;br /&gt;
Solr is built on top of Apache Lucene. It is a toolbox responsible for indexing, searching, spell-check and advance tokenization whereas Solr is a search server which inherits all the features of Lucene but also adds API integration, caching and most importantly a web admin interface. This feature makes Solr very easy to use in production environment. Both of these technology needs Java 1.4 or above. &lt;br /&gt;
[[File: structure_solr.png|center]]&lt;br /&gt;
Sunspot library interacts with Solr using a low-level interface called RSolr. It is a ruby client which integrates with the Solr API's to Rails through the use of Sunspot gem. Sunspot has a drop-in ActiveRecord support. Sunspot provides a easy abstraction to using the Solr search engine. The installation and application of Solr using Sunspot gem is discussed below.&lt;br /&gt;
&lt;br /&gt;
=='''Features&amp;lt;ref&amp;gt;http://lucene.apache.org/solr/features.html&amp;lt;/ref&amp;gt;'''==&lt;br /&gt;
Apache Solr has the following features &lt;br /&gt;
&lt;br /&gt;
*Enables full-text matching, powered by Lucene software&lt;br /&gt;
*Built to handle high volume traffic&lt;br /&gt;
*Provides &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[http://en.wikipedia.org/wiki/Faceted_search faceted]&amp;lt;/span&amp;gt; searching&lt;br /&gt;
*Provides features like suggester, spellcheck, clustering, auto-complete, highlighting&lt;br /&gt;
*Extensible through plugins&lt;br /&gt;
*Supports statistical and aggregate processing of text&lt;br /&gt;
*Supports rich format data such as PDF, Word, Powerpoint&lt;br /&gt;
&lt;br /&gt;
Rails uses the Sunspot Ruby library to integrate with the Solr search engine.&lt;br /&gt;
=='''Installation'''==&lt;br /&gt;
&lt;br /&gt;
Sunspot makes it easy to do full text searching through Solr. Sunspot comes as a gem and is installed in the usual way by adding it to the Gemfile and running bundle.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
gem 'sunspot_rails'&lt;br /&gt;
gem 'sunspot_solr' # optional pre-packaged Solr distribution for use in development&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
bundle install&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once the gem and its dependencies have installed we will need to generate Sunspot’s configuration file which we can do by running&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ rails g sunspot_rails:install&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This command creates a YML file at /config/sunspot.yml. We don’t need to make any changes to the default settings in this file.&lt;br /&gt;
Sunspot embeds Solr inside the gem so there’s no need to install it separately. This means that it works straight out of the box which makes it far more convenient to use in development. To get it up and running we run&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ rake sunspot:solr:start&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you’re running OS X Lion and you haven’t installed a Java runtime you’ll be prompted to do so when you run this command. You may also see a deprecation warning but this can be safely ignored. The command will also create some more configuration files for advanced configuration.&lt;br /&gt;
&lt;br /&gt;
=='''Usage and Examples&amp;lt;ref&amp;gt;http://outoftime.github.io/sunspot/docs/index.html&amp;lt;/ref&amp;gt;'''==&lt;br /&gt;
=== Indexing Objects ===&lt;br /&gt;
Add a searchable block to the objects you wish to index.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class Example &amp;lt; ActiveRecord::Base&lt;br /&gt;
  searchable do&lt;br /&gt;
    text :title, :body&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Text fields will be full-text searchable. Other fields which are outside the scope of searchable can be used to scope queries.&lt;br /&gt;
&lt;br /&gt;
=== Searching Objects ===&lt;br /&gt;
Now searching can be done simply by passing the query to search method in the respective class.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Example.search do&lt;br /&gt;
  fulltext 'query'&lt;br /&gt;
  with :conditions&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We can use many variations on the search now by changing the scope variables in the query.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Example of a Blog Search ===&lt;br /&gt;
Here we want to index the text fields. So, it is kept inside the searchable block.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class Blog &amp;lt; ActiveRecord::Base&lt;br /&gt;
  searchable do&lt;br /&gt;
    text :title, :body&lt;br /&gt;
    text :comments do&lt;br /&gt;
      comments.map { |comment| comment.body }&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    boolean :featured&lt;br /&gt;
    integer :blog_id&lt;br /&gt;
    integer :author_id&lt;br /&gt;
    integer :category_ids, :multiple =&amp;gt; true&lt;br /&gt;
    double  :average_rating&lt;br /&gt;
    time    :published_at&lt;br /&gt;
    time    :expired_at&lt;br /&gt;
&lt;br /&gt;
    string  :sort_title do&lt;br /&gt;
      title.downcase.gsub(/^(an?|the)/, '')&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now for searching the indexed objects we can use:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Blog.search do&lt;br /&gt;
  fulltext 'best author'&lt;br /&gt;
&lt;br /&gt;
  with :blog_id, 1&lt;br /&gt;
  with(:published_at).less_than Time.now&lt;br /&gt;
  order_by :published_at, :desc&lt;br /&gt;
  paginate :page =&amp;gt; 2, :per_page =&amp;gt; 15&lt;br /&gt;
  facet :category_ids, :author_id&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here the text fields are full text searchable and other attributes like blog_id, page, author_id is used to scope the query.&lt;br /&gt;
&lt;br /&gt;
=='''Extensions to Sunspot'''==&lt;br /&gt;
Though Sunspot is used primarily for indexing and searching, it could be further extended to support multiple features. Some of them are listed as:&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt; [http://en.wikipedia.org/wiki/Scope_%28computer_science%29 Scoping]&amp;lt;/span&amp;gt; scalar fields===&lt;br /&gt;
We can put Positive and negative restrictions along with conjunctions or disjunctions to scope the query.&lt;br /&gt;
&lt;br /&gt;
*Positive restrictions&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#Posts with a category of 1, 3, or 5&lt;br /&gt;
Blog.search do&lt;br /&gt;
  with(:category_ids, [1, 3, 5])&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Negative restrictions&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Blogs not in category 1 or 3&lt;br /&gt;
Blog.search do&lt;br /&gt;
  without(:category_ids, [1, 3])&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Disjunctions and Conjunctions&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Blogs that do not have an expired time or have not yet expired&lt;br /&gt;
Blog.search do&lt;br /&gt;
  any_of do&lt;br /&gt;
    with(:expired_at).greater_than(Time.now)&lt;br /&gt;
    with(:expired_at, nil)&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt; [http://en.wikipedia.org/wiki/Pagination Pagination]&amp;lt;/span&amp;gt;===&lt;br /&gt;
The search results given by Sunspot are paginated upto 30 items per page.&lt;br /&gt;
A custom number of results per page can be specified with the :per_page option to paginate:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
search = Blog.search do&lt;br /&gt;
  fulltext &amp;quot;pizza&amp;quot;&lt;br /&gt;
  paginate :page =&amp;gt; 1, :per_page =&amp;gt; 50&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Faceting===&lt;br /&gt;
&lt;br /&gt;
It is a feature of Solr that determines the number of documents that match a given search and an additional criterion. This allows you to build powerful drill-down interfaces for search.&lt;br /&gt;
In field facets each row represents a particular value for a given field. In query facets, each row represents an arbitrary scope.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Blogs that match 'war' returning counts for each :author_id&lt;br /&gt;
search = Blog.search do&lt;br /&gt;
  fulltext &amp;quot;war&amp;quot;&lt;br /&gt;
  facet :author_id&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
search.facet(:author_id).rows.each do |facet|&lt;br /&gt;
  puts &amp;quot;Author #{facet.value} has #{facet.count} war article!&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Ordering===&lt;br /&gt;
By default, Sunspot orders results by &amp;quot;score&amp;quot;: the Solr-determined relevancy metric. We can use order_by method to customize the search.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Order by average rating, descending&lt;br /&gt;
Blog.search do&lt;br /&gt;
  fulltext(&amp;quot;war&amp;quot;)&lt;br /&gt;
  order_by(:average_rating, :desc)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Highlighting===&lt;br /&gt;
It is the snippet of the matched part of the search result. It has to be stored in order to be produced.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
search = Blog.search do&lt;br /&gt;
  fulltext &amp;quot;war&amp;quot; do&lt;br /&gt;
    highlight :body&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It will highlight the word war in every result string.&lt;br /&gt;
&lt;br /&gt;
===Hits vs Results===&lt;br /&gt;
&lt;br /&gt;
Sunspot simply stores the type and primary key of objects in Solr. When results are retrieved, those primary keys are used to load the actual object like any relational database.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Using #results pulls in the records from the object-relational mapper&lt;br /&gt;
Blog.search.results.each do |result|&lt;br /&gt;
  puts result.body&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To get results without accessing the database, use hits:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Blog.search.hits.each do |hit|&lt;br /&gt;
  puts hit.stored(:body)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Reindexing===&lt;br /&gt;
Objects are automatically indexed to Solr as a part of the save callbacks but if there is a change in schema then reindexing is necessary.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
bundle exec rake sunspot:solr:reindex&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref&amp;gt;http://tech.favoritemedium.com/2010/01/full-text-search-in-rails-with-sunspot.html&amp;lt;/ref&amp;gt;&amp;lt;ref&amp;gt;http://www.linux-mag.com/id/7341/&amp;lt;/ref&amp;gt;Other interesting reads on the topic and referral links are mentioned below.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Amohanr</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015/ch1b_18_AS&amp;diff=94238</id>
		<title>CSC/ECE 517 Spring 2015/ch1b 18 AS</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015/ch1b_18_AS&amp;diff=94238"/>
		<updated>2015-02-18T19:40:20Z</updated>

		<summary type="html">&lt;p&gt;Amohanr: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;font size=&amp;quot;5&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Apache Solr and Rails&amp;lt;/b&amp;gt;&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The topic write up for this page can be found [https://docs.google.com/document/d/1TgBtp7flIPKJwkkShgtcIkt--mtHuwVHsQX6Tpzj1rc here].&lt;br /&gt;
[[File: solr.jpg|right]]&lt;br /&gt;
Apache Solr&amp;lt;ref&amp;gt;http://lucene.apache.org/solr/&amp;lt;/ref&amp;gt; is a standalone, open-source enterprise search server, written in Java and created by Yonik Seely. It is a servlet that can run within a servlet container such as Apache Tomcat. It has a &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[http://en.wikipedia.org/wiki/Representational_state_transfer REST]&amp;lt;/span&amp;gt;-like API. Solr is an indexing and searching framework which could be deployed and used with many web frameworks like Rails, Drupal, Django etc. Indexing could be done using JSON, XML, CSV or binary over Hyper text transfer protocol. It could be then queried using HTTP with a GET method and receive the JSON, XML, CSV or binary results. It is a very popular, fast and scaleable open source enterprise search platform built on &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[http://lucene.apache.org/index.html Apache Lucene]&amp;lt;/span&amp;gt; search library. Websites using &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt; [http://rubyonrails.org/ Rails]&amp;lt;/span&amp;gt; can take advantage of the Solr search engine to provide very sophisticated and customizable search features. Rails integrates with Solr search server using Sunspot&amp;lt;ref&amp;gt;https://rubygems.org/gems/sunspot_rails&amp;lt;/ref&amp;gt;&amp;lt;ref&amp;gt;https://github.com/sunspot/sunspot&amp;lt;/ref&amp;gt; gem.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
=='''Introduction'''==&lt;br /&gt;
Apache Solr is a standalone enterprise search server with a REST-like API. Indexing could be done using JSON, XML, CSV or binary over Hyper text transfer protocol. It could be then queried using HTTP with a GET method and receive the JSON, XML, CSV or binary results. It is a popular, scalable, blazing-fast, open source enterprise search platform built on Apache Lucene. Websites using rails can take advantage of the Solr search engine to provide sophisticated and customizable search features.&lt;br /&gt;
&lt;br /&gt;
===Technology Stack&amp;lt;ref&amp;gt;http://www.slideshare.net/dkeener/rails-and-the-apache-solr-search-engine&amp;lt;/ref&amp;gt;===&lt;br /&gt;
Solr is built on top of Apache Lucene. It is a toolbox responsible for indexing, searching, spell-check and advance tokenization whereas Solr is a search server which inherits all the features of Lucene but also adds API integration, caching and most importantly a web admin interface. This feature makes Solr very easy to use in production environment. Both of these technology needs Java 1.4 or above. &lt;br /&gt;
[[File: structure_solr.png|center]]&lt;br /&gt;
Sunspot library interacts with Solr using a low-level interface called RSolr. It is a ruby client which integrates with the Solr API's to Rails through the use of Sunspot gem. Sunspot has a drop-in ActiveRecord support. Sunspot provides a easy abstraction to using the Solr search engine. The installation and application of Solr using Sunspot gem is discussed below.&lt;br /&gt;
&lt;br /&gt;
=='''Features&amp;lt;ref&amp;gt;http://lucene.apache.org/solr/features.html&amp;lt;/ref&amp;gt;'''==&lt;br /&gt;
Apache Solr has the following features &lt;br /&gt;
&lt;br /&gt;
*Enables full-text matching, powered by Lucene software&lt;br /&gt;
*Built to handle high volume traffic&lt;br /&gt;
*Provides &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[http://en.wikipedia.org/wiki/Faceted_search faceted]&amp;lt;/span&amp;gt; searching&lt;br /&gt;
*Provides features like suggester, spellcheck, clustering, auto-complete, highlighting&lt;br /&gt;
*Extensible through plugins&lt;br /&gt;
*Supports statistical and aggregate processing of text&lt;br /&gt;
*Supports rich format data such as PDF, Word, Powerpoint&lt;br /&gt;
&lt;br /&gt;
Rails uses the Sunspot Ruby library to integrate with the Solr search engine.&lt;br /&gt;
=='''Installation'''==&lt;br /&gt;
&lt;br /&gt;
Sunspot makes it easy to do full text searching through Solr. Sunspot comes as a gem and is installed in the usual way by adding it to the Gemfile and running bundle.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
gem 'sunspot_rails'&lt;br /&gt;
gem 'sunspot_solr' # optional pre-packaged Solr distribution for use in development&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
bundle install&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once the gem and its dependencies have installed we will need to generate Sunspot’s configuration file which we can do by running&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ rails g sunspot_rails:install&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This command creates a YML file at /config/sunspot.yml. We don’t need to make any changes to the default settings in this file.&lt;br /&gt;
Sunspot embeds Solr inside the gem so there’s no need to install it separately. This means that it works straight out of the box which makes it far more convenient to use in development. To get it up and running we run&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ rake sunspot:solr:start&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you’re running OS X Lion and you haven’t installed a Java runtime you’ll be prompted to do so when you run this command. You may also see a deprecation warning but this can be safely ignored. The command will also create some more configuration files for advanced configuration.&lt;br /&gt;
&lt;br /&gt;
=='''Usage and Examples&amp;lt;ref&amp;gt;http://outoftime.github.io/sunspot/docs/index.html&amp;lt;/ref&amp;gt;'''==&lt;br /&gt;
=== Indexing Objects ===&lt;br /&gt;
Add a searchable block to the objects you wish to index.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class Example &amp;lt; ActiveRecord::Base&lt;br /&gt;
  searchable do&lt;br /&gt;
    text :title, :body&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Text fields will be full-text searchable. Other fields which are outside the scope of searchable can be used to scope queries.&lt;br /&gt;
&lt;br /&gt;
=== Searching Objects ===&lt;br /&gt;
Now searching can be done simply by passing the query to search method in the respective class.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Example.search do&lt;br /&gt;
  fulltext 'query'&lt;br /&gt;
  with :conditions&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We can use many variations on the search now by changing the scope variables in the query.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Example of a Blog Search ===&lt;br /&gt;
Here we want to index the text fields. So, it is kept inside the searchable block.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class Blog &amp;lt; ActiveRecord::Base&lt;br /&gt;
  searchable do&lt;br /&gt;
    text :title, :body&lt;br /&gt;
    text :comments do&lt;br /&gt;
      comments.map { |comment| comment.body }&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    boolean :featured&lt;br /&gt;
    integer :blog_id&lt;br /&gt;
    integer :author_id&lt;br /&gt;
    integer :category_ids, :multiple =&amp;gt; true&lt;br /&gt;
    double  :average_rating&lt;br /&gt;
    time    :published_at&lt;br /&gt;
    time    :expired_at&lt;br /&gt;
&lt;br /&gt;
    string  :sort_title do&lt;br /&gt;
      title.downcase.gsub(/^(an?|the)/, '')&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now for searching the indexed objects we can use:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Blog.search do&lt;br /&gt;
  fulltext 'best author'&lt;br /&gt;
&lt;br /&gt;
  with :blog_id, 1&lt;br /&gt;
  with(:published_at).less_than Time.now&lt;br /&gt;
  order_by :published_at, :desc&lt;br /&gt;
  paginate :page =&amp;gt; 2, :per_page =&amp;gt; 15&lt;br /&gt;
  facet :category_ids, :author_id&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here the text fields are full text searchable and other attributes like blog_id, page, author_id is used to scope the query.&lt;br /&gt;
&lt;br /&gt;
=='''Extensions to Sunspot'''==&lt;br /&gt;
Though Sunspot is used primarily for indexing and searching, it could be further extended to support multiple features. Some of them are listed as:&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt; [http://en.wikipedia.org/wiki/Scope_%28computer_science%29 Scoping]&amp;lt;/span&amp;gt; scalar fields===&lt;br /&gt;
We can put Positive and negative restrictions along with conjunctions or disjunctions to scope the query.&lt;br /&gt;
&lt;br /&gt;
*Positive restrictions&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#Posts with a category of 1, 3, or 5&lt;br /&gt;
Blog.search do&lt;br /&gt;
  with(:category_ids, [1, 3, 5])&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Negative restrictions&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Blogs not in category 1 or 3&lt;br /&gt;
Blog.search do&lt;br /&gt;
  without(:category_ids, [1, 3])&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Disjunctions and Conjunctions&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Blogs that do not have an expired time or have not yet expired&lt;br /&gt;
Blog.search do&lt;br /&gt;
  any_of do&lt;br /&gt;
    with(:expired_at).greater_than(Time.now)&lt;br /&gt;
    with(:expired_at, nil)&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt; [http://en.wikipedia.org/wiki/Pagination Pagination]&amp;lt;/span&amp;gt;===&lt;br /&gt;
The search results given by Sunspot are paginated upto 30 items per page.&lt;br /&gt;
A custom number of results per page can be specified with the :per_page option to paginate:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
search = Blog.search do&lt;br /&gt;
  fulltext &amp;quot;pizza&amp;quot;&lt;br /&gt;
  paginate :page =&amp;gt; 1, :per_page =&amp;gt; 50&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Faceting===&lt;br /&gt;
&lt;br /&gt;
It is a feature of Solr that determines the number of documents that match a given search and an additional criterion. This allows you to build powerful drill-down interfaces for search.&lt;br /&gt;
In field facets each row represents a particular value for a given field. In query facets, each row represents an arbitrary scope.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Blogs that match 'war' returning counts for each :author_id&lt;br /&gt;
search = Blog.search do&lt;br /&gt;
  fulltext &amp;quot;war&amp;quot;&lt;br /&gt;
  facet :author_id&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
search.facet(:author_id).rows.each do |facet|&lt;br /&gt;
  puts &amp;quot;Author #{facet.value} has #{facet.count} war article!&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Ordering===&lt;br /&gt;
By default, Sunspot orders results by &amp;quot;score&amp;quot;: the Solr-determined relevancy metric. We can use order_by method to customize the search.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Order by average rating, descending&lt;br /&gt;
Blog.search do&lt;br /&gt;
  fulltext(&amp;quot;war&amp;quot;)&lt;br /&gt;
  order_by(:average_rating, :desc)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Highlighting===&lt;br /&gt;
It is the snippet of the matched part of the search result. It has to be stored in order to be produced.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
search = Blog.search do&lt;br /&gt;
  fulltext &amp;quot;war&amp;quot; do&lt;br /&gt;
    highlight :body&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It will highlight the word war in every result string.&lt;br /&gt;
&lt;br /&gt;
===Hits vs Results===&lt;br /&gt;
&lt;br /&gt;
Sunspot simply stores the type and primary key of objects in Solr. When results are retrieved, those primary keys are used to load the actual object like any relational database.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Using #results pulls in the records from the object-relational mapper&lt;br /&gt;
Blog.search.results.each do |result|&lt;br /&gt;
  puts result.body&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To get results without accessing the database, use hits:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Blog.search.hits.each do |hit|&lt;br /&gt;
  puts hit.stored(:body)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Reindexing===&lt;br /&gt;
Objects are automatically indexed to Solr as a part of the save callbacks but if there is a change in schema then reindexing is necessary.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
bundle exec rake sunspot:solr:reindex&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref&amp;gt;http://tech.favoritemedium.com/2010/01/full-text-search-in-rails-with-sunspot.html&amp;lt;/ref&amp;gt;&amp;lt;ref&amp;gt;http://www.linux-mag.com/id/7341/&amp;lt;/ref&amp;gt;Other interesting reads on the topic and referral links are mentioned below.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Amohanr</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015/ch1b_18_AS&amp;diff=94232</id>
		<title>CSC/ECE 517 Spring 2015/ch1b 18 AS</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015/ch1b_18_AS&amp;diff=94232"/>
		<updated>2015-02-18T18:55:23Z</updated>

		<summary type="html">&lt;p&gt;Amohanr: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;font size=&amp;quot;5&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Apache Solr and Rails&amp;lt;/b&amp;gt;&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The topic write up for this page can be found [https://docs.google.com/document/d/1TgBtp7flIPKJwkkShgtcIkt--mtHuwVHsQX6Tpzj1rc here].&lt;br /&gt;
[[File: solr.jpg|right]]&lt;br /&gt;
Apache Solr&amp;lt;ref&amp;gt;http://lucene.apache.org/solr/&amp;lt;/ref&amp;gt; is a standalone, open-source enterprise search server, written in Java and created by Yonik Seely. It has a &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[http://en.wikipedia.org/wiki/Representational_state_transfer REST]&amp;lt;/span&amp;gt;-like API. It is an indexing and searching framework which could be deployed and used with many web frameworks like Rails, Drupal, Django etc. Indexing could be done using JSON, XML, CSV or binary over Hyper text transfer protocol. It could be then queried using HTTP with a GET method and receive the JSON, XML, CSV or binary results. It is a very popular, fast and scaleable open source enterprise search platform built on &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[http://lucene.apache.org/index.html Apache Lucene]&amp;lt;/span&amp;gt; search library. Websites using &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt; [http://rubyonrails.org/ Rails]&amp;lt;/span&amp;gt; can take advantage of the Solr search engine to provide very sophisticated and customizable search features. Rails integrates with Solr search server using Sunspot&amp;lt;ref&amp;gt;https://rubygems.org/gems/sunspot_rails&amp;lt;/ref&amp;gt;&amp;lt;ref&amp;gt;https://github.com/sunspot/sunspot&amp;lt;/ref&amp;gt; gem.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
=='''Introduction'''==&lt;br /&gt;
Apache Solr is a standalone enterprise search server with a REST-like API. Indexing could be done using JSON, XML, CSV or binary over Hyper text transfer protocol. It could be then queried using HTTP with a GET method and receive the JSON, XML, CSV or binary results. It is a popular, scalable, blazing-fast, open source enterprise search platform built on Apache Lucene. Websites using rails can take advantage of the Solr search engine to provide sophisticated and customizable search features.&lt;br /&gt;
&lt;br /&gt;
===Technology Stack&amp;lt;ref&amp;gt;http://www.slideshare.net/dkeener/rails-and-the-apache-solr-search-engine&amp;lt;/ref&amp;gt;===&lt;br /&gt;
Solr is built on top of Apache Lucene. It is a toolbox responsible for indexing, searching, spell-check and advance tokenization whereas Solr is a search server which inherits all the features of Lucene but also adds API integration, caching and most importantly a web admin interface. This feature makes Solr very easy to use in production environment. Both of these technology needs Java 1.4 or above. &lt;br /&gt;
[[File: structure_solr.png|center]]&lt;br /&gt;
Sunspot library interacts with Solr using a low-level interface called RSolr. It is a ruby client which integrates with the Solr API's to Rails through the use of Sunspot gem. Sunspot has a drop-in ActiveRecord support. Sunspot provides a easy abstraction to using the Solr search engine. The installation and application of Solr using Sunspot gem is discussed below.&lt;br /&gt;
&lt;br /&gt;
=='''Features&amp;lt;ref&amp;gt;http://lucene.apache.org/solr/features.html&amp;lt;/ref&amp;gt;'''==&lt;br /&gt;
Apache Solr has the following features &lt;br /&gt;
&lt;br /&gt;
*Enables full-text matching, powered by Lucene software&lt;br /&gt;
*Built to handle high volume traffic&lt;br /&gt;
*Provides &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[http://en.wikipedia.org/wiki/Faceted_search faceted]&amp;lt;/span&amp;gt; searching&lt;br /&gt;
*Provides features like suggester, spellcheck, clustering, auto-complete, highlighting&lt;br /&gt;
*Extensible through plugins&lt;br /&gt;
*Supports statistical and aggregate processing of text&lt;br /&gt;
*Supports rich format data such as PDF, Word, Powerpoint&lt;br /&gt;
&lt;br /&gt;
Rails uses the Sunspot Ruby library to integrate with the Solr search engine.&lt;br /&gt;
=='''Installation'''==&lt;br /&gt;
&lt;br /&gt;
Sunspot makes it easy to do full text searching through Solr. Sunspot comes as a gem and is installed in the usual way by adding it to the Gemfile and running bundle.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
gem 'sunspot_rails'&lt;br /&gt;
gem 'sunspot_solr' # optional pre-packaged Solr distribution for use in development&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
bundle install&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once the gem and its dependencies have installed we will need to generate Sunspot’s configuration file which we can do by running&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ rails g sunspot_rails:install&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This command creates a YML file at /config/sunspot.yml. We don’t need to make any changes to the default settings in this file.&lt;br /&gt;
Sunspot embeds Solr inside the gem so there’s no need to install it separately. This means that it works straight out of the box which makes it far more convenient to use in development. To get it up and running we run&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ rake sunspot:solr:start&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you’re running OS X Lion and you haven’t installed a Java runtime you’ll be prompted to do so when you run this command. You may also see a deprecation warning but this can be safely ignored. The command will also create some more configuration files for advanced configuration.&lt;br /&gt;
&lt;br /&gt;
=='''Usage and Examples&amp;lt;ref&amp;gt;http://outoftime.github.io/sunspot/docs/index.html&amp;lt;/ref&amp;gt;'''==&lt;br /&gt;
=== Indexing Objects ===&lt;br /&gt;
Add a searchable block to the objects you wish to index.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class Example &amp;lt; ActiveRecord::Base&lt;br /&gt;
  searchable do&lt;br /&gt;
    text :title, :body&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Text fields will be full-text searchable. Other fields which are outside the scope of searchable can be used to scope queries.&lt;br /&gt;
&lt;br /&gt;
=== Searching Objects ===&lt;br /&gt;
Now searching can be done simply by passing the query to search method in the respective class.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Example.search do&lt;br /&gt;
  fulltext 'query'&lt;br /&gt;
  with :conditions&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We can use many variations on the search now by changing the scope variables in the query.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Example of a Blog Search ===&lt;br /&gt;
Here we want to index the text fields. So, it is kept inside the searchable block.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class Blog &amp;lt; ActiveRecord::Base&lt;br /&gt;
  searchable do&lt;br /&gt;
    text :title, :body&lt;br /&gt;
    text :comments do&lt;br /&gt;
      comments.map { |comment| comment.body }&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    boolean :featured&lt;br /&gt;
    integer :blog_id&lt;br /&gt;
    integer :author_id&lt;br /&gt;
    integer :category_ids, :multiple =&amp;gt; true&lt;br /&gt;
    double  :average_rating&lt;br /&gt;
    time    :published_at&lt;br /&gt;
    time    :expired_at&lt;br /&gt;
&lt;br /&gt;
    string  :sort_title do&lt;br /&gt;
      title.downcase.gsub(/^(an?|the)/, '')&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now for searching the indexed objects we can use:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Blog.search do&lt;br /&gt;
  fulltext 'best author'&lt;br /&gt;
&lt;br /&gt;
  with :blog_id, 1&lt;br /&gt;
  with(:published_at).less_than Time.now&lt;br /&gt;
  order_by :published_at, :desc&lt;br /&gt;
  paginate :page =&amp;gt; 2, :per_page =&amp;gt; 15&lt;br /&gt;
  facet :category_ids, :author_id&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here the text fields are full text searchable and other attributes like blog_id, page, author_id is used to scope the query.&lt;br /&gt;
&lt;br /&gt;
=='''Extensions to Sunspot'''==&lt;br /&gt;
Though Sunspot is used primarily for indexing and searching, it could be further extended to support multiple features. Some of them are listed as:&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt; [http://en.wikipedia.org/wiki/Scope_%28computer_science%29 Scoping]&amp;lt;/span&amp;gt; scalar fields===&lt;br /&gt;
We can put Positive and negative restrictions along with conjunctions or disjunctions to scope the query.&lt;br /&gt;
&lt;br /&gt;
*Positive restrictions&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#Posts with a category of 1, 3, or 5&lt;br /&gt;
Blog.search do&lt;br /&gt;
  with(:category_ids, [1, 3, 5])&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Negative restrictions&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Blogs not in category 1 or 3&lt;br /&gt;
Blog.search do&lt;br /&gt;
  without(:category_ids, [1, 3])&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Disjunctions and Conjunctions&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Blogs that do not have an expired time or have not yet expired&lt;br /&gt;
Blog.search do&lt;br /&gt;
  any_of do&lt;br /&gt;
    with(:expired_at).greater_than(Time.now)&lt;br /&gt;
    with(:expired_at, nil)&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt; [http://en.wikipedia.org/wiki/Pagination Pagination]&amp;lt;/span&amp;gt;===&lt;br /&gt;
The search results given by Sunspot are paginated upto 30 items per page.&lt;br /&gt;
A custom number of results per page can be specified with the :per_page option to paginate:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
search = Blog.search do&lt;br /&gt;
  fulltext &amp;quot;pizza&amp;quot;&lt;br /&gt;
  paginate :page =&amp;gt; 1, :per_page =&amp;gt; 50&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Faceting===&lt;br /&gt;
&lt;br /&gt;
It is a feature of Solr that determines the number of documents that match a given search and an additional criterion. This allows you to build powerful drill-down interfaces for search.&lt;br /&gt;
In field facets each row represents a particular value for a given field. In query facets, each row represents an arbitrary scope.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Blogs that match 'war' returning counts for each :author_id&lt;br /&gt;
search = Blog.search do&lt;br /&gt;
  fulltext &amp;quot;war&amp;quot;&lt;br /&gt;
  facet :author_id&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
search.facet(:author_id).rows.each do |facet|&lt;br /&gt;
  puts &amp;quot;Author #{facet.value} has #{facet.count} war article!&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Ordering===&lt;br /&gt;
By default, Sunspot orders results by &amp;quot;score&amp;quot;: the Solr-determined relevancy metric. We can use order_by method to customize the search.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Order by average rating, descending&lt;br /&gt;
Blog.search do&lt;br /&gt;
  fulltext(&amp;quot;war&amp;quot;)&lt;br /&gt;
  order_by(:average_rating, :desc)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Highlighting===&lt;br /&gt;
It is the snippet of the matched part of the search result. It has to be stored in order to be produced.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
search = Blog.search do&lt;br /&gt;
  fulltext &amp;quot;war&amp;quot; do&lt;br /&gt;
    highlight :body&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It will highlight the word war in every result string.&lt;br /&gt;
&lt;br /&gt;
===Hits vs Results===&lt;br /&gt;
&lt;br /&gt;
Sunspot simply stores the type and primary key of objects in Solr. When results are retrieved, those primary keys are used to load the actual object like any relational database.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Using #results pulls in the records from the object-relational mapper&lt;br /&gt;
Blog.search.results.each do |result|&lt;br /&gt;
  puts result.body&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To get results without accessing the database, use hits:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Blog.search.hits.each do |hit|&lt;br /&gt;
  puts hit.stored(:body)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Reindexing===&lt;br /&gt;
Objects are automatically indexed to Solr as a part of the save callbacks but if there is a change in schema then reindexing is necessary.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
bundle exec rake sunspot:solr:reindex&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref&amp;gt;http://tech.favoritemedium.com/2010/01/full-text-search-in-rails-with-sunspot.html&amp;lt;/ref&amp;gt;&amp;lt;ref&amp;gt;http://www.linux-mag.com/id/7341/&amp;lt;/ref&amp;gt;Other interesting reads on the topic and referral links are mentioned below.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Amohanr</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015/ch1b_18_AS&amp;diff=94229</id>
		<title>CSC/ECE 517 Spring 2015/ch1b 18 AS</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015/ch1b_18_AS&amp;diff=94229"/>
		<updated>2015-02-18T18:52:35Z</updated>

		<summary type="html">&lt;p&gt;Amohanr: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;font size=&amp;quot;5&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Apache Solr and Rails&amp;lt;/b&amp;gt;&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The topic write up for this page can be found [https://docs.google.com/document/d/1TgBtp7flIPKJwkkShgtcIkt--mtHuwVHsQX6Tpzj1rc here].&lt;br /&gt;
[[File: solr.jpg|right]]&lt;br /&gt;
Apache Solr&amp;lt;ref&amp;gt;http://lucene.apache.org/solr/&amp;lt;/ref&amp;gt; is a standalone, open-source enterprise search server created by Yonik Seely. It has a &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[http://en.wikipedia.org/wiki/Representational_state_transfer REST]&amp;lt;/span&amp;gt;-like API. It is an indexing and searching framework which could be deployed and used with many web frameworks like Rails, Drupal, Django etc. Indexing could be done using JSON, XML, CSV or binary over Hyper text transfer protocol. It could be then queried using HTTP with a GET method and receive the JSON, XML, CSV or binary results. It is a very popular, fast and scaleable open source enterprise search platform built on &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[http://lucene.apache.org/index.html Apache Lucene]&amp;lt;/span&amp;gt; search library. Websites using &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt; [http://rubyonrails.org/ Rails]&amp;lt;/span&amp;gt; can take advantage of the Solr search engine to provide very sophisticated and customizable search features. Rails integrates with Solr search server using Sunspot&amp;lt;ref&amp;gt;https://rubygems.org/gems/sunspot_rails&amp;lt;/ref&amp;gt;&amp;lt;ref&amp;gt;https://github.com/sunspot/sunspot&amp;lt;/ref&amp;gt; gem.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
=='''Introduction'''==&lt;br /&gt;
Apache Solr is a standalone enterprise search server with a REST-like API. Indexing could be done using JSON, XML, CSV or binary over Hyper text transfer protocol. It could be then queried using HTTP with a GET method and receive the JSON, XML, CSV or binary results. It is a popular, scalable, blazing-fast, open source enterprise search platform built on Apache Lucene. Websites using rails can take advantage of the Solr search engine to provide sophisticated and customizable search features.&lt;br /&gt;
&lt;br /&gt;
===Technology Stack&amp;lt;ref&amp;gt;http://www.slideshare.net/dkeener/rails-and-the-apache-solr-search-engine&amp;lt;/ref&amp;gt;===&lt;br /&gt;
Solr is built on top of Apache Lucene. It is a toolbox responsible for indexing, searching, spell-check and advance tokenization whereas Solr is a search server which inherits all the features of Lucene but also adds API integration, caching and most importantly a web admin interface. This feature makes Solr very easy to use in production environment. Both of these technology needs Java 1.4 or above. &lt;br /&gt;
[[File: structure_solr.png|center]]&lt;br /&gt;
Sunspot library interacts with Solr using a low-level interface called RSolr. It is a ruby client which integrates with the Solr API's to Rails through the use of Sunspot gem. Sunspot has a drop-in ActiveRecord support. Sunspot provides a easy abstraction to using the Solr search engine. The installation and application of Solr using Sunspot gem is discussed below.&lt;br /&gt;
&lt;br /&gt;
=='''Features&amp;lt;ref&amp;gt;http://lucene.apache.org/solr/features.html&amp;lt;/ref&amp;gt;'''==&lt;br /&gt;
Apache Solr has the following features &lt;br /&gt;
&lt;br /&gt;
*Enables full-text matching, powered by Lucene software&lt;br /&gt;
*Built to handle high volume traffic&lt;br /&gt;
*Provides &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[http://en.wikipedia.org/wiki/Faceted_search faceted]&amp;lt;/span&amp;gt; searching&lt;br /&gt;
*Provides features like suggester, spellcheck, clustering, auto-complete, highlighting&lt;br /&gt;
*Extensible through plugins&lt;br /&gt;
*Supports statistical and aggregate processing of text&lt;br /&gt;
*Supports rich format data such as PDF, Word, Powerpoint&lt;br /&gt;
&lt;br /&gt;
Rails uses the Sunspot Ruby library to integrate with the Solr search engine.&lt;br /&gt;
=='''Installation'''==&lt;br /&gt;
&lt;br /&gt;
Sunspot makes it easy to do full text searching through Solr. Sunspot comes as a gem and is installed in the usual way by adding it to the Gemfile and running bundle.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
gem 'sunspot_rails'&lt;br /&gt;
gem 'sunspot_solr' # optional pre-packaged Solr distribution for use in development&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
bundle install&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once the gem and its dependencies have installed we will need to generate Sunspot’s configuration file which we can do by running&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ rails g sunspot_rails:install&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This command creates a YML file at /config/sunspot.yml. We don’t need to make any changes to the default settings in this file.&lt;br /&gt;
Sunspot embeds Solr inside the gem so there’s no need to install it separately. This means that it works straight out of the box which makes it far more convenient to use in development. To get it up and running we run&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ rake sunspot:solr:start&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you’re running OS X Lion and you haven’t installed a Java runtime you’ll be prompted to do so when you run this command. You may also see a deprecation warning but this can be safely ignored. The command will also create some more configuration files for advanced configuration.&lt;br /&gt;
&lt;br /&gt;
=='''Usage and Examples&amp;lt;ref&amp;gt;http://outoftime.github.io/sunspot/docs/index.html&amp;lt;/ref&amp;gt;'''==&lt;br /&gt;
=== Indexing Objects ===&lt;br /&gt;
Add a searchable block to the objects you wish to index.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class Example &amp;lt; ActiveRecord::Base&lt;br /&gt;
  searchable do&lt;br /&gt;
    text :title, :body&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Text fields will be full-text searchable. Other fields which are outside the scope of searchable can be used to scope queries.&lt;br /&gt;
&lt;br /&gt;
=== Searching Objects ===&lt;br /&gt;
Now searching can be done simply by passing the query to search method in the respective class.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Example.search do&lt;br /&gt;
  fulltext 'query'&lt;br /&gt;
  with :conditions&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We can use many variations on the search now by changing the scope variables in the query.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Example of a Blog Search ===&lt;br /&gt;
Here we want to index the text fields. So, it is kept inside the searchable block.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class Blog &amp;lt; ActiveRecord::Base&lt;br /&gt;
  searchable do&lt;br /&gt;
    text :title, :body&lt;br /&gt;
    text :comments do&lt;br /&gt;
      comments.map { |comment| comment.body }&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    boolean :featured&lt;br /&gt;
    integer :blog_id&lt;br /&gt;
    integer :author_id&lt;br /&gt;
    integer :category_ids, :multiple =&amp;gt; true&lt;br /&gt;
    double  :average_rating&lt;br /&gt;
    time    :published_at&lt;br /&gt;
    time    :expired_at&lt;br /&gt;
&lt;br /&gt;
    string  :sort_title do&lt;br /&gt;
      title.downcase.gsub(/^(an?|the)/, '')&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now for searching the indexed objects we can use:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Blog.search do&lt;br /&gt;
  fulltext 'best author'&lt;br /&gt;
&lt;br /&gt;
  with :blog_id, 1&lt;br /&gt;
  with(:published_at).less_than Time.now&lt;br /&gt;
  order_by :published_at, :desc&lt;br /&gt;
  paginate :page =&amp;gt; 2, :per_page =&amp;gt; 15&lt;br /&gt;
  facet :category_ids, :author_id&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here the text fields are full text searchable and other attributes like blog_id, page, author_id is used to scope the query.&lt;br /&gt;
&lt;br /&gt;
=='''Extensions to Sunspot'''==&lt;br /&gt;
Though Sunspot is used primarily for indexing and searching, it could be further extended to support multiple features. Some of them are listed as:&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt; [http://en.wikipedia.org/wiki/Scope_%28computer_science%29 Scoping]&amp;lt;/span&amp;gt; scalar fields===&lt;br /&gt;
We can put Positive and negative restrictions along with conjunctions or disjunctions to scope the query.&lt;br /&gt;
&lt;br /&gt;
*Positive restrictions&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#Posts with a category of 1, 3, or 5&lt;br /&gt;
Blog.search do&lt;br /&gt;
  with(:category_ids, [1, 3, 5])&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Negative restrictions&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Blogs not in category 1 or 3&lt;br /&gt;
Blog.search do&lt;br /&gt;
  without(:category_ids, [1, 3])&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Disjunctions and Conjunctions&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Blogs that do not have an expired time or have not yet expired&lt;br /&gt;
Blog.search do&lt;br /&gt;
  any_of do&lt;br /&gt;
    with(:expired_at).greater_than(Time.now)&lt;br /&gt;
    with(:expired_at, nil)&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt; [http://en.wikipedia.org/wiki/Pagination Pagination]&amp;lt;/span&amp;gt;===&lt;br /&gt;
The search results given by Sunspot are paginated upto 30 items per page.&lt;br /&gt;
A custom number of results per page can be specified with the :per_page option to paginate:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
search = Blog.search do&lt;br /&gt;
  fulltext &amp;quot;pizza&amp;quot;&lt;br /&gt;
  paginate :page =&amp;gt; 1, :per_page =&amp;gt; 50&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Faceting===&lt;br /&gt;
&lt;br /&gt;
It is a feature of Solr that determines the number of documents that match a given search and an additional criterion. This allows you to build powerful drill-down interfaces for search.&lt;br /&gt;
In field facets each row represents a particular value for a given field. In query facets, each row represents an arbitrary scope.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Blogs that match 'war' returning counts for each :author_id&lt;br /&gt;
search = Blog.search do&lt;br /&gt;
  fulltext &amp;quot;war&amp;quot;&lt;br /&gt;
  facet :author_id&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
search.facet(:author_id).rows.each do |facet|&lt;br /&gt;
  puts &amp;quot;Author #{facet.value} has #{facet.count} war article!&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Ordering===&lt;br /&gt;
By default, Sunspot orders results by &amp;quot;score&amp;quot;: the Solr-determined relevancy metric. We can use order_by method to customize the search.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Order by average rating, descending&lt;br /&gt;
Blog.search do&lt;br /&gt;
  fulltext(&amp;quot;war&amp;quot;)&lt;br /&gt;
  order_by(:average_rating, :desc)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Highlighting===&lt;br /&gt;
It is the snippet of the matched part of the search result. It has to be stored in order to be produced.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
search = Blog.search do&lt;br /&gt;
  fulltext &amp;quot;war&amp;quot; do&lt;br /&gt;
    highlight :body&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It will highlight the word war in every result string.&lt;br /&gt;
&lt;br /&gt;
===Hits vs Results===&lt;br /&gt;
&lt;br /&gt;
Sunspot simply stores the type and primary key of objects in Solr. When results are retrieved, those primary keys are used to load the actual object like any relational database.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Using #results pulls in the records from the object-relational mapper&lt;br /&gt;
Blog.search.results.each do |result|&lt;br /&gt;
  puts result.body&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To get results without accessing the database, use hits:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Blog.search.hits.each do |hit|&lt;br /&gt;
  puts hit.stored(:body)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Reindexing===&lt;br /&gt;
Objects are automatically indexed to Solr as a part of the save callbacks but if there is a change in schema then reindexing is necessary.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
bundle exec rake sunspot:solr:reindex&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref&amp;gt;http://tech.favoritemedium.com/2010/01/full-text-search-in-rails-with-sunspot.html&amp;lt;/ref&amp;gt;&amp;lt;ref&amp;gt;http://www.linux-mag.com/id/7341/&amp;lt;/ref&amp;gt;Other interesting reads on the topic and referral links are mentioned below.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Amohanr</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015/ch1b_18_AS&amp;diff=94224</id>
		<title>CSC/ECE 517 Spring 2015/ch1b 18 AS</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015/ch1b_18_AS&amp;diff=94224"/>
		<updated>2015-02-18T18:31:50Z</updated>

		<summary type="html">&lt;p&gt;Amohanr: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;font size=&amp;quot;5&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Apache Solr and Rails&amp;lt;/b&amp;gt;&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The topic write up for this page can be found [https://docs.google.com/document/d/1TgBtp7flIPKJwkkShgtcIkt--mtHuwVHsQX6Tpzj1rc here].&lt;br /&gt;
[[File: solr.jpg|right]]&lt;br /&gt;
Apache Solr&amp;lt;ref&amp;gt;http://lucene.apache.org/solr/&amp;lt;/ref&amp;gt; is a standalone, open-source enterprise search server created by Yonik Seely. It has a &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[http://en.wikipedia.org/wiki/Representational_state_transfer REST]&amp;lt;/span&amp;gt;-like API. It is a indexing and searching framework which could be deployed and used with many web frameworks like Rails, Drupal, Django etc. Indexing could be done using JSON, XML, CSV or binary over Hyper text transfer protocol. It could be then queried using HTTP with a GET method and receive the JSON, XML, CSV or binary results. It is a very popular, fast and scaleable open source enterprise search platform built on &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[http://lucene.apache.org/index.html Apache Lucene]&amp;lt;/span&amp;gt; search library. Websites using &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt; [http://rubyonrails.org/ Rails]&amp;lt;/span&amp;gt; can take advantage of the Solr search engine to provide very sophisticated and customizable search features. Rails integrates with Solr search server using Sunspot&amp;lt;ref&amp;gt;https://rubygems.org/gems/sunspot_rails&amp;lt;/ref&amp;gt;&amp;lt;ref&amp;gt;https://github.com/sunspot/sunspot&amp;lt;/ref&amp;gt; gem.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
=='''Introduction'''==&lt;br /&gt;
Apache Solr is a standalone enterprise search server with a REST-like API. Indexing could be done using JSON, XML, CSV or binary over Hyper text transfer protocol. It could be then queried using HTTP with a GET method and receive the JSON, XML, CSV or binary results. It is a popular, scalable, blazing-fast, open source enterprise search platform built on Apache Lucene. Websites using rails can take advantage of the Solr search engine to provide sophisticated and customizable search features.&lt;br /&gt;
&lt;br /&gt;
===Technology Stack&amp;lt;ref&amp;gt;http://www.slideshare.net/dkeener/rails-and-the-apache-solr-search-engine&amp;lt;/ref&amp;gt;===&lt;br /&gt;
Solr is built on top of Apache Lucene. It is a toolbox responsible for indexing, searching, spell-check and advance tokenization whereas Solr is a search server which inherits all the features of Lucene but also adds API integration, caching and most importantly a web admin interface. This feature makes Solr very easy to use in production environment. Both of these technology needs Java 1.4 or above. &lt;br /&gt;
[[File: structure_solr.png|center]]&lt;br /&gt;
Sunspot library interacts with Solr using a low-level interface called RSolr. It is a ruby client which integrates with the Solr API's to Rails through the use of Sunspot gem. Sunspot has a drop-in ActiveRecord support. We can call Sunspot as the high level client of Solr. We will be talking about the installation and application of Solr using Sunspot gem in the section below.&lt;br /&gt;
&lt;br /&gt;
=='''Features&amp;lt;ref&amp;gt;http://lucene.apache.org/solr/features.html&amp;lt;/ref&amp;gt;'''==&lt;br /&gt;
Apache Solr has the following features &lt;br /&gt;
&lt;br /&gt;
*Enables full-text matching, powered by Lucene software&lt;br /&gt;
*Built to handle high volume traffic&lt;br /&gt;
*Provides &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[http://en.wikipedia.org/wiki/Faceted_search faceted]&amp;lt;/span&amp;gt; searching&lt;br /&gt;
*Provides features like suggester, spellcheck, clustering, auto-complete, highlighting&lt;br /&gt;
*Extensible through plugins&lt;br /&gt;
*Supports statistical and aggregate processing of text&lt;br /&gt;
*Supports rich format data such as PDF, Word, Powerpoint&lt;br /&gt;
&lt;br /&gt;
Rails uses the Sunspot Ruby library to integrate with the Solr search engine.&lt;br /&gt;
=='''Installation'''==&lt;br /&gt;
&lt;br /&gt;
Sunspot makes it easy to do full text searching through Solr. Sunspot comes as a gem and is installed in the usual way by adding it to the Gemfile and running bundle.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
gem 'sunspot_rails'&lt;br /&gt;
gem 'sunspot_solr' # optional pre-packaged Solr distribution for use in development&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
bundle install&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once the gem and its dependencies have installed we will need to generate Sunspot’s configuration file which we can do by running&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ rails g sunspot_rails:install&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This command creates a YML file at /config/sunspot.yml. We don’t need to make any changes to the default settings in this file.&lt;br /&gt;
Sunspot embeds Solr inside the gem so there’s no need to install it separately. This means that it works straight out of the box which makes it far more convenient to use in development. To get it up and running we run&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ rake sunspot:solr:start&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you’re running OS X Lion and you haven’t installed a Java runtime you’ll be prompted to do so when you run this command. You may also see a deprecation warning but this can be safely ignored. The command will also create some more configuration files for advanced configuration.&lt;br /&gt;
&lt;br /&gt;
=='''Usage and Examples&amp;lt;ref&amp;gt;http://outoftime.github.io/sunspot/docs/index.html&amp;lt;/ref&amp;gt;'''==&lt;br /&gt;
=== Indexing Objects ===&lt;br /&gt;
Add a searchable block to the objects you wish to index.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class Example &amp;lt; ActiveRecord::Base&lt;br /&gt;
  searchable do&lt;br /&gt;
    text :title, :body&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Text fields will be full-text searchable. Other fields which are outside the scope of searchable can be used to scope queries.&lt;br /&gt;
&lt;br /&gt;
=== Searching Objects ===&lt;br /&gt;
Now searching can be done simply by passing the query to search method in the respective class.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Example.search do&lt;br /&gt;
  fulltext 'query'&lt;br /&gt;
  with :conditions&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We can use many variations on the search now by changing the scope variables in the query.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Example of a Blog Search ===&lt;br /&gt;
Here we want to index the text fields. So, it is kept inside the searchable block.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class Blog &amp;lt; ActiveRecord::Base&lt;br /&gt;
  searchable do&lt;br /&gt;
    text :title, :body&lt;br /&gt;
    text :comments do&lt;br /&gt;
      comments.map { |comment| comment.body }&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    boolean :featured&lt;br /&gt;
    integer :blog_id&lt;br /&gt;
    integer :author_id&lt;br /&gt;
    integer :category_ids, :multiple =&amp;gt; true&lt;br /&gt;
    double  :average_rating&lt;br /&gt;
    time    :published_at&lt;br /&gt;
    time    :expired_at&lt;br /&gt;
&lt;br /&gt;
    string  :sort_title do&lt;br /&gt;
      title.downcase.gsub(/^(an?|the)/, '')&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now for searching the indexed objects we can use:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Blog.search do&lt;br /&gt;
  fulltext 'best author'&lt;br /&gt;
&lt;br /&gt;
  with :blog_id, 1&lt;br /&gt;
  with(:published_at).less_than Time.now&lt;br /&gt;
  order_by :published_at, :desc&lt;br /&gt;
  paginate :page =&amp;gt; 2, :per_page =&amp;gt; 15&lt;br /&gt;
  facet :category_ids, :author_id&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here the text fields are full text searchable and other attributes like blog_id, page, author_id is used to scope the query.&lt;br /&gt;
&lt;br /&gt;
=='''Extensions to Sunspot'''==&lt;br /&gt;
Though Sunspot is used primarily for indexing and searching, it could be further extended to support multiple features. Some of them are listed as:&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt; [http://en.wikipedia.org/wiki/Scope_%28computer_science%29 Scoping]&amp;lt;/span&amp;gt; scalar fields===&lt;br /&gt;
We can put Positive and negative restrictions along with conjunctions or disjunctions to scope the query.&lt;br /&gt;
&lt;br /&gt;
*Positive restrictions&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#Posts with a category of 1, 3, or 5&lt;br /&gt;
Blog.search do&lt;br /&gt;
  with(:category_ids, [1, 3, 5])&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Negative restrictions&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Blogs not in category 1 or 3&lt;br /&gt;
Blog.search do&lt;br /&gt;
  without(:category_ids, [1, 3])&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Disjunctions and Conjunctions&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Blogs that do not have an expired time or have not yet expired&lt;br /&gt;
Blog.search do&lt;br /&gt;
  any_of do&lt;br /&gt;
    with(:expired_at).greater_than(Time.now)&lt;br /&gt;
    with(:expired_at, nil)&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt; [http://en.wikipedia.org/wiki/Pagination Pagination]&amp;lt;/span&amp;gt;===&lt;br /&gt;
The search results given by Sunspot are paginated upto 30 items per page.&lt;br /&gt;
A custom number of results per page can be specified with the :per_page option to paginate:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
search = Blog.search do&lt;br /&gt;
  fulltext &amp;quot;pizza&amp;quot;&lt;br /&gt;
  paginate :page =&amp;gt; 1, :per_page =&amp;gt; 50&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Faceting===&lt;br /&gt;
&lt;br /&gt;
It is a feature of Solr that determines the number of documents that match a given search and an additional criterion. This allows you to build powerful drill-down interfaces for search.&lt;br /&gt;
In field facets each row represents a particular value for a given field. In query facets, each row represents an arbitrary scope.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Blogs that match 'war' returning counts for each :author_id&lt;br /&gt;
search = Blog.search do&lt;br /&gt;
  fulltext &amp;quot;war&amp;quot;&lt;br /&gt;
  facet :author_id&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
search.facet(:author_id).rows.each do |facet|&lt;br /&gt;
  puts &amp;quot;Author #{facet.value} has #{facet.count} war article!&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Ordering===&lt;br /&gt;
By default, Sunspot orders results by &amp;quot;score&amp;quot;: the Solr-determined relevancy metric. We can use order_by method to customize the search.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Order by average rating, descending&lt;br /&gt;
Blog.search do&lt;br /&gt;
  fulltext(&amp;quot;war&amp;quot;)&lt;br /&gt;
  order_by(:average_rating, :desc)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Highlighting===&lt;br /&gt;
It is the snippet of the matched part of the search result. It has to be stored in order to be produced.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
search = Blog.search do&lt;br /&gt;
  fulltext &amp;quot;war&amp;quot; do&lt;br /&gt;
    highlight :body&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It will highlight the word war in every result string.&lt;br /&gt;
&lt;br /&gt;
===Hits vs Results===&lt;br /&gt;
&lt;br /&gt;
Sunspot simply stores the type and primary key of objects in Solr. When results are retrieved, those primary keys are used to load the actual object like any relational database.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Using #results pulls in the records from the object-relational mapper&lt;br /&gt;
Blog.search.results.each do |result|&lt;br /&gt;
  puts result.body&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To get results without accessing the database, use hits:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Blog.search.hits.each do |hit|&lt;br /&gt;
  puts hit.stored(:body)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Reindexing===&lt;br /&gt;
Objects are automatically indexed to Solr as a part of the save callbacks but if there is a change in schema then reindexing is necessary.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
bundle exec rake sunspot:solr:reindex&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref&amp;gt;http://tech.favoritemedium.com/2010/01/full-text-search-in-rails-with-sunspot.html&amp;lt;/ref&amp;gt;&amp;lt;ref&amp;gt;http://www.linux-mag.com/id/7341/&amp;lt;/ref&amp;gt;Other interesting reads on the topic and referral links are mentioned below.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Amohanr</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015/ch1b_18_AS&amp;diff=94164</id>
		<title>CSC/ECE 517 Spring 2015/ch1b 18 AS</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015/ch1b_18_AS&amp;diff=94164"/>
		<updated>2015-02-18T01:17:28Z</updated>

		<summary type="html">&lt;p&gt;Amohanr: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;font size=&amp;quot;5&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Apache Solr and Rails&amp;lt;/b&amp;gt;&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File: solr.jpg|right]]&lt;br /&gt;
Apache Solr&amp;lt;ref&amp;gt;http://lucene.apache.org/solr/&amp;lt;/ref&amp;gt; is a standalone, open-source enterprise search server created by Yonik Seely. It has a &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[http://en.wikipedia.org/wiki/Representational_state_transfer REST]&amp;lt;/span&amp;gt;-like API. It is a indexing and searching framework which could be deployed and used with many web frameworks like Rails, Drupal, Django etc. Indexing could be done using JSON, XML, CSV or binary over Hyper text transfer protocol. It could be then queried using HTTP with a GET method and receive the JSON, XML, CSV or binary results. It is a popular, scalable, blazing-fast, open source enterprise search platform built on &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[http://lucene.apache.org/index.html Apache Lucene]&amp;lt;/span&amp;gt; search library. Websites using &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt; [http://rubyonrails.org/ Rails]&amp;lt;/span&amp;gt; can take advantage of the Solr search engine to provide sophisticated and customizable search features. Ruby/Rails integrates with Solr search server using Sunspot&amp;lt;ref&amp;gt;https://rubygems.org/gems/sunspot_rails&amp;lt;/ref&amp;gt; library and does a full text search.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
=='''Introduction'''==&lt;br /&gt;
Apache Solr is a standalone enterprise search server with a REST-like API. Indexing could be done using JSON, XML, CSV or binary over Hyper text transfer protocol. It could be then queried using HTTP with a GET method and receive the JSON, XML, CSV or binary results. It is a popular, scalable, blazing-fast, open source enterprise search platform built on Apache Lucene. Websites using rails can take advantage of the Solr search engine to provide sophisticated and customizable search features.&lt;br /&gt;
&lt;br /&gt;
===Technology Stack&amp;lt;ref&amp;gt;http://www.slideshare.net/dkeener/rails-and-the-apache-solr-search-engine&amp;lt;/ref&amp;gt;===&lt;br /&gt;
Solr is built on top of Apache Lucene. It is a toolbox responsible for indexing, searching, spell-check and advance tokenization whereas Solr is a search server which inherits all the features of Lucene but also adds API integration, caching and most importantly a web admin interface. This feature makes Solr very easy to use in production environment. Both of these technology needs Java 1.4 or above. &lt;br /&gt;
[[File: structure_solr.png|center]]&lt;br /&gt;
Sunspot library interacts with Solr using a low-level interface called RSolr. It is a ruby client which integrates the Solr API's to Rails through the use of Sunspot gem. Sunspot has a drop-in ActiveRecord support. We can call Sunspot as the high level client of Solr. We will be talking about the installation and application of Solr using Sunspot gem in the section below.&lt;br /&gt;
&lt;br /&gt;
=='''Features&amp;lt;ref&amp;gt;http://lucene.apache.org/solr/features.html&amp;lt;/ref&amp;gt;'''==&lt;br /&gt;
Apache Solr has the following features &lt;br /&gt;
&lt;br /&gt;
*Enables full-text matching, powered by Lucence software&lt;br /&gt;
*Built to handle high volume traffic&lt;br /&gt;
*Provides &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[http://en.wikipedia.org/wiki/Faceted_search faceted]&amp;lt;/span&amp;gt; searching&lt;br /&gt;
*Provides features like suggester, spellcheck, clustering, auto-complete, highlighting&lt;br /&gt;
*Extensible through plugins&lt;br /&gt;
*Supports statistical and aggregate processing of text&lt;br /&gt;
*Supports rich format data such as PDF, Word, Pwerpoint&lt;br /&gt;
&lt;br /&gt;
Rails uses the Sunspot Ruby library to integrate with the Solr search engine.&lt;br /&gt;
=='''Installation and Uses&amp;lt;ref&amp;gt;http://outoftime.github.io/sunspot/docs/index.html&amp;lt;/ref&amp;gt;'''==&lt;br /&gt;
&lt;br /&gt;
===Installing Sunspot Gem===&lt;br /&gt;
Sunspot makes it easy to do full text searching through Solr. Sunspot comes as a gem and is installed in the usual way by adding it to the Gemfile and running bundle.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
gem 'sunspot_rails'&lt;br /&gt;
gem 'sunspot_solr' # optional pre-packaged Solr distribution for use in development&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Bundle it.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
bundle install&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once the gem and its dependencies have installed we will need to generate Sunspot’s configuration file which we can do by running&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ rails g sunspot_rails:install&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This command creates a YML file at /config/sunspot.yml. We don’t need to make any changes to the default settings in this file.&lt;br /&gt;
Sunspot embeds Solr inside the gem so there’s no need to install it separately. This means that it works straight out of the box which makes it far more convenient to use in development. To get it up and running we run&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ rake sunspot:solr:start&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you’re running OS X Lion and you haven’t installed a Java runtime you’ll be prompted to do so when you run this command. You may also see a deprecation warning but this can be safely ignored. The command will also create some more configuration files for advanced configuration.&lt;br /&gt;
&lt;br /&gt;
=== Indexing Objects ===&lt;br /&gt;
Add a searchable block to the objects you wish to index.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class Example &amp;lt; ActiveRecord::Base&lt;br /&gt;
  searchable do&lt;br /&gt;
    text :title, :body&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Text fields will be full-text searchable. Other fields which are outside the scope of searchable can be used to scope queries.&lt;br /&gt;
&lt;br /&gt;
=== Searching Objects ===&lt;br /&gt;
Now searching can be done simply by passing the query to search method in the respective class.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Example.search do&lt;br /&gt;
  fulltext 'query'&lt;br /&gt;
  with :conditions&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We can use many variations on the search now by changing the scope variables in the query.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Amohanr</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015/ch1b_18_AS&amp;diff=94156</id>
		<title>CSC/ECE 517 Spring 2015/ch1b 18 AS</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2015/ch1b_18_AS&amp;diff=94156"/>
		<updated>2015-02-18T00:44:28Z</updated>

		<summary type="html">&lt;p&gt;Amohanr: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;font size=&amp;quot;5&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Apache Solr and Rails&amp;lt;/b&amp;gt;&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File: solr.jpg|right]]&lt;br /&gt;
Apache Solr&amp;lt;ref&amp;gt;http://lucene.apache.org/solr/&amp;lt;/ref&amp;gt; is a standalone, open-source enterprise search server created by Yonik Seely. It has a &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[http://en.wikipedia.org/wiki/Representational_state_transfer REST]&amp;lt;/span&amp;gt;-like API. It is a indexing and searching framework which could be deployed and used with many web frameworks like Rails, Drupal, Django etc. Indexing could be done using JSON, XML, CSV or binary over Hyper text transfer protocol. It could be then queried using HTTP with a GET method and receive the JSON, XML, CSV or binary results. It is a popular, scalable, blazing-fast, open source enterprise search platform built on &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[http://lucene.apache.org/index.html Apache Lucene]&amp;lt;/span&amp;gt; search library. Websites using &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt; [http://rubyonrails.org/ Rails]&amp;lt;/span&amp;gt; can take advantage of the Solr search engine to provide sophisticated and customizable search features. Ruby/Rails integrates with Solr search server using Sunspot&amp;lt;ref&amp;gt;https://rubygems.org/gems/sunspot_rails&amp;lt;/ref&amp;gt; library and does a full text search.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
=='''Introduction'''==&lt;br /&gt;
Apache Solr is a standalone enterprise search server with a REST-like API. Indexing could be done using JSON, XML, CSV or binary over Hyper text transfer protocol. It could be then queried using HTTP with a GET method and receive the JSON, XML, CSV or binary results. It is a popular, scalable, blazing-fast, open source enterprise search platform built on Apache Lucene. Websites using rails can take advantage of the Solr search engine to provide sophisticated and customizable search features.&lt;br /&gt;
&lt;br /&gt;
===Technology Stack&amp;lt;ref&amp;gt;http://www.slideshare.net/dkeener/rails-and-the-apache-solr-search-engine&amp;lt;/ref&amp;gt;===&lt;br /&gt;
Solr is built on top of Apache Lucene. It is a toolbox responsible for indexing, searching, spell-check and advance tokenization whereas Solr is a search server which inherits all the features of Lucene but also adds API integration, caching and most importantly a web admin interface. This feature makes Solr very easy to use in production environment. Both of these technology needs Java 1.4 or above. &lt;br /&gt;
[[File: structure_solr.png|center]]&lt;br /&gt;
Solr is integrated with Rails using a client called Rsolr. It is a low level ruby client which integrates the Solr API's to Rails through the use of Sunspot gem. Sunspot has a drop-in ActiveRecord support. We can call Sunspot as the high level client of Solr. We will be talking about the installation and application of Solr using Sunspot gem in the section below.&lt;br /&gt;
&lt;br /&gt;
=='''Features&amp;lt;ref&amp;gt;http://lucene.apache.org/solr/features.html&amp;lt;/ref&amp;gt;'''==&lt;br /&gt;
Apache Solr has the following features &lt;br /&gt;
&lt;br /&gt;
*Enables full-text matching, powered by Lucence software&lt;br /&gt;
*Built to handle high volume traffic&lt;br /&gt;
*Provides &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[http://en.wikipedia.org/wiki/Faceted_search faceted]&amp;lt;/span&amp;gt; searching&lt;br /&gt;
*Provides features like suggester, spellcheck, clustering, auto-complete, highlighting&lt;br /&gt;
*Extensible through plugins&lt;br /&gt;
*Supports statistical and aggregate processing of text&lt;br /&gt;
*Supports rich format data such as PDF, Word, Pwerpoint&lt;br /&gt;
&lt;br /&gt;
Rails uses the Sunspot Ruby library to integrate with the Solr search engine.&lt;br /&gt;
=='''Installation and Uses&amp;lt;ref&amp;gt;http://outoftime.github.io/sunspot/docs/index.html&amp;lt;/ref&amp;gt;'''==&lt;br /&gt;
&lt;br /&gt;
===Installing Sunspot Gem===&lt;br /&gt;
Sunspot makes it easy to do full text searching through Solr. Sunspot comes as a gem and is installed in the usual way by adding it to the Gemfile and running bundle.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
gem 'sunspot_rails'&lt;br /&gt;
gem 'sunspot_solr' # optional pre-packaged Solr distribution for use in development&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Bundle it.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
bundle install&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once the gem and its dependencies have installed we will need to generate Sunspot’s configuration file which we can do by running&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ rails g sunspot_rails:install&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This command creates a YML file at /config/sunspot.yml. We don’t need to make any changes to the default settings in this file.&lt;br /&gt;
Sunspot embeds Solr inside the gem so there’s no need to install it separately. This means that it works straight out of the box which makes it far more convenient to use in development. To get it up and running we run&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ rake sunspot:solr:start&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you’re running OS X Lion and you haven’t installed a Java runtime you’ll be prompted to do so when you run this command. You may also see a deprecation warning but this can be safely ignored. The command will also create some more configuration files for advanced configuration.&lt;br /&gt;
&lt;br /&gt;
=== Indexing Objects ===&lt;br /&gt;
Add a searchable block to the objects you wish to index.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class Example &amp;lt; ActiveRecord::Base&lt;br /&gt;
  searchable do&lt;br /&gt;
    text :title, :body&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Text fields will be full-text searchable. Other fields which are outside the scope of searchable can be used to scope queries.&lt;br /&gt;
&lt;br /&gt;
=== Searching Objects ===&lt;br /&gt;
Now searching can be done simply by passing the query to search method in the respective class.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Example.search do&lt;br /&gt;
  fulltext 'query'&lt;br /&gt;
  with :conditions&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We can use many variations on the search now by changing the scope variables in the query.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Amohanr</name></author>
	</entry>
</feed>