<?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=Vboddul</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=Vboddul"/>
	<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=Special:Contributions/Vboddul"/>
	<updated>2026-06-06T07:33:25Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.41.0</generator>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/oss_M1456_kdv&amp;diff=90503</id>
		<title>CSC/ECE 517 Fall 2014/oss M1456 kdv</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/oss_M1456_kdv&amp;diff=90503"/>
		<updated>2014-10-29T14:47:06Z</updated>

		<summary type="html">&lt;p&gt;Vboddul: /* Conclusion */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;='''Implement MIME sniffing - spec'''=&lt;br /&gt;
&lt;br /&gt;
This article is about the open source project M 1456: Implement MIME&amp;lt;ref&amp;gt;https://mimesniff.spec.whatwg.org/&amp;lt;/ref&amp;gt; sniffing - spec &amp;lt;ref&amp;gt;https://github.com/servo/servo/issues/3144&amp;lt;/ref&amp;gt;, which is part of the Servo Parallel Browser Project. Servo is prototype web browser engine which is currently under development and is written in [http://doc.rust-lang.org/guide.html Rust] language. Here you can find a brief Background information about MIME sniffing in servo, rust programming language, the initial step and the first step implemented in the project.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== '''Background Information''' ==&lt;br /&gt;
When we do a HTTP web request which declares the type of its content (using the Content-Type header), it's very easy to decide how to present it - if it's an image, decode it; if it's an HTML page, parse and display it. When no such header is present, Servo currently falters (such as loading an image file or video file from disk, as in [https://github.com/servo/servo/pull/3131 #3131]). In this case, we want to implement the &amp;quot;sniffing&amp;quot; specification, which looks at the starting byte content of the resource and guesses what manner of content is being received. For example, If its an image we can use image rendering and a video rendering can be used for a video file. &lt;br /&gt;
&lt;br /&gt;
==='''What is Servo?'''===&lt;br /&gt;
Servo&amp;lt;ref&amp;gt;https://www.mozilla.org/en-US/research/projects/&amp;lt;/ref&amp;gt; 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;
&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.&lt;br /&gt;
&lt;br /&gt;
Github link to [https://github.com/servo/servo Servo] Project.&lt;br /&gt;
&lt;br /&gt;
==='''Rust Programming Language'''=== &lt;br /&gt;
Rust&amp;lt;ref&amp;gt;https://www.mozilla.org/en-US/research/projects/&amp;lt;/ref&amp;gt; is a new programming language for developing reliable and efficient systems. It's designed to support concurrency and parallelism in building platforms that take full advantage of modern hardware. Its static type system is safe and expressive and it provides strong guarantees about isolation, concurrency execution and memory safety.&lt;br /&gt;
&lt;br /&gt;
Rust combines powerful and flexible modern programming constructs with a clear performance model to make program efficiency predictable and manageable. One important way it achieves this is by allowing fine-grained control over memory allocation through contiguous records and stack allocation. This control is balanced with the absolute requirement of safety: Rust’s type system and runtime guarantee the absence of data races, buffer overflow, stack overflow or access to uninitialized or deallocated memory.&lt;br /&gt;
&lt;br /&gt;
Github link to [https://github.com/rust-lang/rust Rust language].&lt;br /&gt;
&lt;br /&gt;
=='''Implement MIME sniffing'''==&lt;br /&gt;
&lt;br /&gt;
==='''Initial Step'''===&lt;br /&gt;
As part of initial step we first [https://github.com/servo/servo Build Servo]. Learned how to create tasks in Rust, then spawn a new sniffer [http://doc.rust-lang.org/guide.html#tasks task] in the load method in resource_task.rs, by creating a sender and receiver pair as well - this task would read all the available data from the new receiver, and send it immediately via the original sender, while the new sender gets handed off to the factory function that is executed. All web pages continued to load unchanged after rebuilding our code.&lt;br /&gt;
&lt;br /&gt;
==='''Classes'''===&lt;br /&gt;
As part of OSS Servo project we worked on below Class files.&lt;br /&gt;
&lt;br /&gt;
'''Modify'''&lt;br /&gt;
* components/net/resource_task.rs&lt;br /&gt;
&lt;br /&gt;
'''Create'''&lt;br /&gt;
* components/net/sniffer_task.rs&lt;br /&gt;
&lt;br /&gt;
'''Delete'''&lt;br /&gt;
* none&lt;br /&gt;
&lt;br /&gt;
==='''Step 1'''===&lt;br /&gt;
* For every resource request (Example: file, http, data or any kind of request) in load method, it would interpose a sniffer task which sniffs all the data, parse the headers if required and return it. Below is the code snippet of the modified &amp;lt;code&amp;gt; resouce_task.rs &amp;lt;/code&amp;gt; file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    fn load(&amp;amp;self, load_data: LoadData, start_chan: Sender&amp;lt;LoadResponse&amp;gt;) {&lt;br /&gt;
        let mut load_data = load_data;&lt;br /&gt;
        load_data.headers.user_agent = self.user_agent.clone();&lt;br /&gt;
&lt;br /&gt;
        // Create new communication channel, create new sniffer task,&lt;br /&gt;
        // send all the data to the new sniffer task with the send&lt;br /&gt;
        // end of the pipe, receive all the data.&lt;br /&gt;
&lt;br /&gt;
        let sniffer_task = sniffer_task::new_sniffer_task(start_chan.clone());&lt;br /&gt;
&lt;br /&gt;
        let loader = match load_data.url.scheme.as_slice() {&lt;br /&gt;
            &amp;quot;file&amp;quot; =&amp;gt; file_loader::factory,&lt;br /&gt;
            &amp;quot;http&amp;quot; | &amp;quot;https&amp;quot; =&amp;gt; http_loader::factory,&lt;br /&gt;
            &amp;quot;data&amp;quot; =&amp;gt; data_loader::factory,&lt;br /&gt;
            &amp;quot;about&amp;quot; =&amp;gt; about_loader::factory,&lt;br /&gt;
            _ =&amp;gt; {&lt;br /&gt;
                debug!(&amp;quot;resource_task: no loader for scheme {:s}&amp;quot;, load_data.url.scheme);&lt;br /&gt;
                start_sending(start_chan, Metadata::default(load_data.url))&lt;br /&gt;
                    .send(Done(Err(&amp;quot;no loader for scheme&amp;quot;.to_string())));&lt;br /&gt;
                return&lt;br /&gt;
            }&lt;br /&gt;
        };&lt;br /&gt;
        debug!(&amp;quot;resource_task: loading url: {:s}&amp;quot;, load_data.url.serialize());&lt;br /&gt;
&lt;br /&gt;
        loader(load_data, sniffer_task);&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* The function which gets called in the load method is &amp;lt;code&amp;gt; new_sniffer_task&amp;lt;/code&amp;gt;. The sniffer task creates a channel and then call &amp;lt;code&amp;gt; SnifferManager &amp;lt;/code&amp;gt; which creates SnifferManager struct with channel information. &amp;lt;code&amp;gt; SnifferManager &amp;lt;/code&amp;gt;  waits for input on the new receiver and passes it on to the old sender, while handing off the new sender to the factory function. Below is the code snippet of the new &amp;lt;code&amp;gt;sniffer_task.rs&amp;lt;/code&amp;gt; file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
struct SnifferManager {&lt;br /&gt;
  data_receiver: Receiver&amp;lt;LoadResponse&amp;gt;,&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
impl SnifferManager {&lt;br /&gt;
  fn new(data_receiver: Receiver &amp;lt;LoadResponse&amp;gt;) -&amp;gt; SnifferManager {&lt;br /&gt;
    SnifferManager {&lt;br /&gt;
      data_receiver: data_receiver,&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
impl SnifferManager {&lt;br /&gt;
  fn start(&amp;amp;self, next_rx: Sender&amp;lt;LoadResponse&amp;gt;) {&lt;br /&gt;
    loop {&lt;br /&gt;
      self.load(next_rx.clone(), self.data_receiver.recv());&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  fn load(&amp;amp;self, next_rx: Sender&amp;lt;LoadResponse&amp;gt;, snif_data: LoadResponse) {&lt;br /&gt;
    next_rx.send(snif_data);&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Design Patterns==&lt;br /&gt;
&lt;br /&gt;
We used the [http://en.wikipedia.org/wiki/Command_pattern command design pattern] in our project. As Wikipedia states, command pattern is a design pattern that in which an &amp;quot;object is used to represent and encapsulate all the information needed to call a method at a later time&amp;quot;. &amp;lt;ref name=&amp;quot;commandDesignPatternWiki&amp;quot;&amp;gt;http://en.wikipedia.org/wiki/Command_pattern&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
In our specific case, the object is the Sniffer Task. A new Sniffer Task is created via the &amp;lt;code&amp;gt; new_sniffer_task&amp;lt;/code&amp;gt; function. When the sniffer task is created, it is isolated and it encapsulates all the information needed to sniff the MIME data out of the URI/file. Since it's isolated, the only way to communicate between the Sniffer Task and the main servo process is by using channels and using &amp;lt;code&amp;gt;send&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;receive&amp;lt;/code&amp;gt; functions to pass data around. For example, in the load function in SnifferManager in &amp;lt;code&amp;gt;sniffer_task.rs&amp;lt;/code&amp;gt;, we use &amp;lt;code&amp;gt;send&amp;lt;/code&amp;gt; to send the data back to the next processing pipeline.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
fn load(&amp;amp;self, next_rx: Sender&amp;lt;LoadResponse&amp;gt;, snif_data: LoadResponse) {&lt;br /&gt;
  next_rx.send(snif_data);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are a few benefits that command design pattern provides. Firstly, since the code block is encapsulated, it is independent and can be modified and switched out easily. This makes maintaining the code very easy. Secondly, because the code blocks has all the resources it needs to perform it's task (in our case, sniffing the MIME), we can easily take it and run it in a different process parallel to the main servo process.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Sniffer Task Project Build==&lt;br /&gt;
&lt;br /&gt;
* After the code changes we Build servo project by running below command.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt; ./mach build &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Tested the code by passing html webpage request.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;./mach run tests/html/about-mozilla.html &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Conclusion==&lt;br /&gt;
As part of OSS Servo project we have created a new &amp;lt;code&amp;gt;sniffer_task.rs&amp;lt;/code&amp;gt; and modified &amp;lt;code&amp;gt;resource_task.rs&amp;lt;/code&amp;gt; load method. Then created a merge request [https://github.com/servo/servo/pull/3766 M1456-Implement MIME sniffing initial Step] and got feedback from Josh were we addressed the issues. Few open issues would be addressed as part of Final OSS project.&lt;br /&gt;
&lt;br /&gt;
==Future Development Scope==&lt;br /&gt;
&lt;br /&gt;
==='''Step 2'''===&lt;br /&gt;
Move from a 1:1 sniffer:request task model to a shared sniffer task - create the sniffing task in ResourceTask::start, store the created sender in a field, and hand off clones of this sender to the factory function. The sniffer task will now also have to be sent the original sender as well, since it is not available at task creation.&lt;br /&gt;
&lt;br /&gt;
==='''Step 3'''===&lt;br /&gt;
When the headers are received, implement the [https://mimesniff.spec.whatwg.org/#handling-a-resource sniffing heuristic algorithm].&lt;br /&gt;
&lt;br /&gt;
==='''Step 4'''===&lt;br /&gt;
Implement the mime type matching algorithm, one category at a time - look for a good way to store the patterns and resulting types to minimize code duplication.&lt;br /&gt;
&lt;br /&gt;
==='''Step 5'''===&lt;br /&gt;
Ensure that the resulting mime type is present in the load that the consumer receives&lt;br /&gt;
&lt;br /&gt;
==='''Step 6'''===&lt;br /&gt;
Write tests that demonstrate working sniffing (for example, loading images with no/wrong extension)&lt;br /&gt;
&lt;br /&gt;
=='''Appendix'''==&lt;br /&gt;
==='''Setting up Servo'''===&lt;br /&gt;
There are two main steps to set up the environment for this project. Linux environment is preferred for setting up the environment as it is simple and easy.&lt;br /&gt;
&lt;br /&gt;
:* [https://github.com/mozilla/rust/wiki/Note-getting-started-developing-Rust Build Rust] &amp;lt;ref&amp;gt; https://github.com/mozilla/rust/wiki/Note-getting-started-developing-Rust &amp;lt;/ref&amp;gt;&lt;br /&gt;
:* [https://github.com/servo/servo Build Servo] &amp;lt;ref&amp;gt; https://github.com/servo/servo &amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Vboddul</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/oss_M1456_kdv&amp;diff=90502</id>
		<title>CSC/ECE 517 Fall 2014/oss M1456 kdv</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/oss_M1456_kdv&amp;diff=90502"/>
		<updated>2014-10-29T14:44:45Z</updated>

		<summary type="html">&lt;p&gt;Vboddul: Added conclusion&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;='''Implement MIME sniffing - spec'''=&lt;br /&gt;
&lt;br /&gt;
This article is about the open source project M 1456: Implement MIME&amp;lt;ref&amp;gt;https://mimesniff.spec.whatwg.org/&amp;lt;/ref&amp;gt; sniffing - spec &amp;lt;ref&amp;gt;https://github.com/servo/servo/issues/3144&amp;lt;/ref&amp;gt;, which is part of the Servo Parallel Browser Project. Servo is prototype web browser engine which is currently under development and is written in [http://doc.rust-lang.org/guide.html Rust] language. Here you can find a brief Background information about MIME sniffing in servo, rust programming language, the initial step and the first step implemented in the project.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== '''Background Information''' ==&lt;br /&gt;
When we do a HTTP web request which declares the type of its content (using the Content-Type header), it's very easy to decide how to present it - if it's an image, decode it; if it's an HTML page, parse and display it. When no such header is present, Servo currently falters (such as loading an image file or video file from disk, as in [https://github.com/servo/servo/pull/3131 #3131]). In this case, we want to implement the &amp;quot;sniffing&amp;quot; specification, which looks at the starting byte content of the resource and guesses what manner of content is being received. For example, If its an image we can use image rendering and a video rendering can be used for a video file. &lt;br /&gt;
&lt;br /&gt;
==='''What is Servo?'''===&lt;br /&gt;
Servo&amp;lt;ref&amp;gt;https://www.mozilla.org/en-US/research/projects/&amp;lt;/ref&amp;gt; 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;
&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.&lt;br /&gt;
&lt;br /&gt;
Github link to [https://github.com/servo/servo Servo] Project.&lt;br /&gt;
&lt;br /&gt;
==='''Rust Programming Language'''=== &lt;br /&gt;
Rust&amp;lt;ref&amp;gt;https://www.mozilla.org/en-US/research/projects/&amp;lt;/ref&amp;gt; is a new programming language for developing reliable and efficient systems. It's designed to support concurrency and parallelism in building platforms that take full advantage of modern hardware. Its static type system is safe and expressive and it provides strong guarantees about isolation, concurrency execution and memory safety.&lt;br /&gt;
&lt;br /&gt;
Rust combines powerful and flexible modern programming constructs with a clear performance model to make program efficiency predictable and manageable. One important way it achieves this is by allowing fine-grained control over memory allocation through contiguous records and stack allocation. This control is balanced with the absolute requirement of safety: Rust’s type system and runtime guarantee the absence of data races, buffer overflow, stack overflow or access to uninitialized or deallocated memory.&lt;br /&gt;
&lt;br /&gt;
Github link to [https://github.com/rust-lang/rust Rust language].&lt;br /&gt;
&lt;br /&gt;
=='''Implement MIME sniffing'''==&lt;br /&gt;
&lt;br /&gt;
==='''Initial Step'''===&lt;br /&gt;
As part of initial step we first [https://github.com/servo/servo Build Servo]. Learned how to create tasks in Rust, then spawn a new sniffer [http://doc.rust-lang.org/guide.html#tasks task] in the load method in resource_task.rs, by creating a sender and receiver pair as well - this task would read all the available data from the new receiver, and send it immediately via the original sender, while the new sender gets handed off to the factory function that is executed. All web pages continued to load unchanged after rebuilding our code.&lt;br /&gt;
&lt;br /&gt;
==='''Classes'''===&lt;br /&gt;
As part of OSS Servo project we worked on below Class files.&lt;br /&gt;
&lt;br /&gt;
'''Modify'''&lt;br /&gt;
* components/net/resource_task.rs&lt;br /&gt;
&lt;br /&gt;
'''Create'''&lt;br /&gt;
* components/net/sniffer_task.rs&lt;br /&gt;
&lt;br /&gt;
'''Delete'''&lt;br /&gt;
* none&lt;br /&gt;
&lt;br /&gt;
==='''Step 1'''===&lt;br /&gt;
* For every resource request (Example: file, http, data or any kind of request) in load method, it would interpose a sniffer task which sniffs all the data, parse the headers if required and return it. Below is the code snippet of the modified &amp;lt;code&amp;gt; resouce_task.rs &amp;lt;/code&amp;gt; file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    fn load(&amp;amp;self, load_data: LoadData, start_chan: Sender&amp;lt;LoadResponse&amp;gt;) {&lt;br /&gt;
        let mut load_data = load_data;&lt;br /&gt;
        load_data.headers.user_agent = self.user_agent.clone();&lt;br /&gt;
&lt;br /&gt;
        // Create new communication channel, create new sniffer task,&lt;br /&gt;
        // send all the data to the new sniffer task with the send&lt;br /&gt;
        // end of the pipe, receive all the data.&lt;br /&gt;
&lt;br /&gt;
        let sniffer_task = sniffer_task::new_sniffer_task(start_chan.clone());&lt;br /&gt;
&lt;br /&gt;
        let loader = match load_data.url.scheme.as_slice() {&lt;br /&gt;
            &amp;quot;file&amp;quot; =&amp;gt; file_loader::factory,&lt;br /&gt;
            &amp;quot;http&amp;quot; | &amp;quot;https&amp;quot; =&amp;gt; http_loader::factory,&lt;br /&gt;
            &amp;quot;data&amp;quot; =&amp;gt; data_loader::factory,&lt;br /&gt;
            &amp;quot;about&amp;quot; =&amp;gt; about_loader::factory,&lt;br /&gt;
            _ =&amp;gt; {&lt;br /&gt;
                debug!(&amp;quot;resource_task: no loader for scheme {:s}&amp;quot;, load_data.url.scheme);&lt;br /&gt;
                start_sending(start_chan, Metadata::default(load_data.url))&lt;br /&gt;
                    .send(Done(Err(&amp;quot;no loader for scheme&amp;quot;.to_string())));&lt;br /&gt;
                return&lt;br /&gt;
            }&lt;br /&gt;
        };&lt;br /&gt;
        debug!(&amp;quot;resource_task: loading url: {:s}&amp;quot;, load_data.url.serialize());&lt;br /&gt;
&lt;br /&gt;
        loader(load_data, sniffer_task);&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* The function which gets called in the load method is &amp;lt;code&amp;gt; new_sniffer_task&amp;lt;/code&amp;gt;. The sniffer task creates a channel and then call &amp;lt;code&amp;gt; SnifferManager &amp;lt;/code&amp;gt; which creates SnifferManager struct with channel information. &amp;lt;code&amp;gt; SnifferManager &amp;lt;/code&amp;gt;  waits for input on the new receiver and passes it on to the old sender, while handing off the new sender to the factory function. Below is the code snippet of the new &amp;lt;code&amp;gt;sniffer_task.rs&amp;lt;/code&amp;gt; file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
struct SnifferManager {&lt;br /&gt;
  data_receiver: Receiver&amp;lt;LoadResponse&amp;gt;,&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
impl SnifferManager {&lt;br /&gt;
  fn new(data_receiver: Receiver &amp;lt;LoadResponse&amp;gt;) -&amp;gt; SnifferManager {&lt;br /&gt;
    SnifferManager {&lt;br /&gt;
      data_receiver: data_receiver,&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
impl SnifferManager {&lt;br /&gt;
  fn start(&amp;amp;self, next_rx: Sender&amp;lt;LoadResponse&amp;gt;) {&lt;br /&gt;
    loop {&lt;br /&gt;
      self.load(next_rx.clone(), self.data_receiver.recv());&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  fn load(&amp;amp;self, next_rx: Sender&amp;lt;LoadResponse&amp;gt;, snif_data: LoadResponse) {&lt;br /&gt;
    next_rx.send(snif_data);&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Design Patterns==&lt;br /&gt;
&lt;br /&gt;
We used the [http://en.wikipedia.org/wiki/Command_pattern command design pattern] in our project. As Wikipedia states, command pattern is a design pattern that in which an &amp;quot;object is used to represent and encapsulate all the information needed to call a method at a later time&amp;quot;. &amp;lt;ref name=&amp;quot;commandDesignPatternWiki&amp;quot;&amp;gt;http://en.wikipedia.org/wiki/Command_pattern&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
In our specific case, the object is the Sniffer Task. A new Sniffer Task is created via the &amp;lt;code&amp;gt; new_sniffer_task&amp;lt;/code&amp;gt; function. When the sniffer task is created, it is isolated and it encapsulates all the information needed to sniff the MIME data out of the URI/file. Since it's isolated, the only way to communicate between the Sniffer Task and the main servo process is by using channels and using &amp;lt;code&amp;gt;send&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;receive&amp;lt;/code&amp;gt; functions to pass data around. For example, in the load function in SnifferManager in &amp;lt;code&amp;gt;sniffer_task.rs&amp;lt;/code&amp;gt;, we use &amp;lt;code&amp;gt;send&amp;lt;/code&amp;gt; to send the data back to the next processing pipeline.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
fn load(&amp;amp;self, next_rx: Sender&amp;lt;LoadResponse&amp;gt;, snif_data: LoadResponse) {&lt;br /&gt;
  next_rx.send(snif_data);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are a few benefits that command design pattern provides. Firstly, since the code block is encapsulated, it is independent and can be modified and switched out easily. This makes maintaining the code very easy. Secondly, because the code blocks has all the resources it needs to perform it's task (in our case, sniffing the MIME), we can easily take it and run it in a different process parallel to the main servo process.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Sniffer Task Project Build==&lt;br /&gt;
&lt;br /&gt;
* After the code changes we Build servo project by running below command.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt; ./mach build &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Tested the code by passing html webpage request.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;./mach run tests/html/about-mozilla.html &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Conclusion==&lt;br /&gt;
As part of OSS Servo project we have created a new &amp;lt;code&amp;gt;sniffer_task.rs&amp;lt;/code&amp;gt; and modified &amp;lt;code&amp;gt;resource_task.rs&amp;lt;/code&amp;gt; load method. And created a merge request [https://github.com/servo/servo/pull/3766 M1456-Implement MIME sniffing initial Step] and got feedback from Josh.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Future Development Scope==&lt;br /&gt;
&lt;br /&gt;
==='''Step 2'''===&lt;br /&gt;
Move from a 1:1 sniffer:request task model to a shared sniffer task - create the sniffing task in ResourceTask::start, store the created sender in a field, and hand off clones of this sender to the factory function. The sniffer task will now also have to be sent the original sender as well, since it is not available at task creation.&lt;br /&gt;
&lt;br /&gt;
==='''Step 3'''===&lt;br /&gt;
When the headers are received, implement the [https://mimesniff.spec.whatwg.org/#handling-a-resource sniffing heuristic algorithm].&lt;br /&gt;
&lt;br /&gt;
==='''Step 4'''===&lt;br /&gt;
Implement the mime type matching algorithm, one category at a time - look for a good way to store the patterns and resulting types to minimize code duplication.&lt;br /&gt;
&lt;br /&gt;
==='''Step 5'''===&lt;br /&gt;
Ensure that the resulting mime type is present in the load that the consumer receives&lt;br /&gt;
&lt;br /&gt;
==='''Step 6'''===&lt;br /&gt;
Write tests that demonstrate working sniffing (for example, loading images with no/wrong extension)&lt;br /&gt;
&lt;br /&gt;
=='''Appendix'''==&lt;br /&gt;
==='''Setting up Servo'''===&lt;br /&gt;
There are two main steps to set up the environment for this project. Linux environment is preferred for setting up the environment as it is simple and easy.&lt;br /&gt;
&lt;br /&gt;
:* [https://github.com/mozilla/rust/wiki/Note-getting-started-developing-Rust Build Rust] &amp;lt;ref&amp;gt; https://github.com/mozilla/rust/wiki/Note-getting-started-developing-Rust &amp;lt;/ref&amp;gt;&lt;br /&gt;
:* [https://github.com/servo/servo Build Servo] &amp;lt;ref&amp;gt; https://github.com/servo/servo &amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Vboddul</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/oss_M1456_kdv&amp;diff=90499</id>
		<title>CSC/ECE 517 Fall 2014/oss M1456 kdv</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/oss_M1456_kdv&amp;diff=90499"/>
		<updated>2014-10-29T14:32:16Z</updated>

		<summary type="html">&lt;p&gt;Vboddul: /* Future Development */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;='''Implement MIME sniffing - spec'''=&lt;br /&gt;
&lt;br /&gt;
This article is about the open source project M 1456: Implement MIME&amp;lt;ref&amp;gt;https://mimesniff.spec.whatwg.org/&amp;lt;/ref&amp;gt; sniffing - spec &amp;lt;ref&amp;gt;https://github.com/servo/servo/issues/3144&amp;lt;/ref&amp;gt;, which is part of the Servo Parallel Browser Project. Servo is prototype web browser engine which is currently under development and is written in [http://doc.rust-lang.org/guide.html Rust] language. Here you can find a brief Background information about MIME sniffing in servo, rust programming language, the initial step and the first step implemented in the project.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== '''Background Information''' ==&lt;br /&gt;
When we do a HTTP web request which declares the type of its content (using the Content-Type header), it's very easy to decide how to present it - if it's an image, decode it; if it's an HTML page, parse and display it. When no such header is present, Servo currently falters (such as loading an image file or video file from disk, as in [https://github.com/servo/servo/pull/3131 #3131]). In this case, we want to implement the &amp;quot;sniffing&amp;quot; specification, which looks at the starting byte content of the resource and guesses what manner of content is being received. For example, If its an image we can use image rendering and a video rendering can be used for a video file. &lt;br /&gt;
&lt;br /&gt;
==='''What is Servo?'''===&lt;br /&gt;
Servo&amp;lt;ref&amp;gt;https://www.mozilla.org/en-US/research/projects/&amp;lt;/ref&amp;gt; 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;
&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.&lt;br /&gt;
&lt;br /&gt;
Github link to [https://github.com/servo/servo Servo] Project.&lt;br /&gt;
&lt;br /&gt;
==='''Rust Programming Language'''=== &lt;br /&gt;
Rust&amp;lt;ref&amp;gt;https://www.mozilla.org/en-US/research/projects/&amp;lt;/ref&amp;gt; is a new programming language for developing reliable and efficient systems. It's designed to support concurrency and parallelism in building platforms that take full advantage of modern hardware. Its static type system is safe and expressive and it provides strong guarantees about isolation, concurrency execution and memory safety.&lt;br /&gt;
&lt;br /&gt;
Rust combines powerful and flexible modern programming constructs with a clear performance model to make program efficiency predictable and manageable. One important way it achieves this is by allowing fine-grained control over memory allocation through contiguous records and stack allocation. This control is balanced with the absolute requirement of safety: Rust’s type system and runtime guarantee the absence of data races, buffer overflow, stack overflow or access to uninitialized or deallocated memory.&lt;br /&gt;
&lt;br /&gt;
Github link to [https://github.com/rust-lang/rust Rust language].&lt;br /&gt;
&lt;br /&gt;
=='''Implement MIME sniffing'''==&lt;br /&gt;
&lt;br /&gt;
==='''Initial Step'''===&lt;br /&gt;
As part of initial step we first [https://github.com/servo/servo Build Servo]. Learned how to create tasks in Rust, then spawn a new sniffer [http://doc.rust-lang.org/guide.html#tasks task] in the load method in resource_task.rs, by creating a sender and receiver pair as well - this task would read all the available data from the new receiver, and send it immediately via the original sender, while the new sender gets handed off to the factory function that is executed. All web pages continued to load unchanged after rebuilding our code.&lt;br /&gt;
&lt;br /&gt;
==='''Classes'''===&lt;br /&gt;
As part of OSS Servo project we worked on below Class files.&lt;br /&gt;
&lt;br /&gt;
'''Modify'''&lt;br /&gt;
* components/net/resource_task.rs&lt;br /&gt;
&lt;br /&gt;
'''Create'''&lt;br /&gt;
* components/net/sniffer_task.rs&lt;br /&gt;
&lt;br /&gt;
'''Delete'''&lt;br /&gt;
* none&lt;br /&gt;
&lt;br /&gt;
==='''Step 1'''===&lt;br /&gt;
* For every resource request (Example: file, http, data or any kind of request) in load method, it would interpose a sniffer task which sniffs all the data, parse the headers if required and return it. Below is the code snippet of the modified &amp;lt;code&amp;gt; resouce_task.rs &amp;lt;/code&amp;gt; file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    fn load(&amp;amp;self, load_data: LoadData, start_chan: Sender&amp;lt;LoadResponse&amp;gt;) {&lt;br /&gt;
        let mut load_data = load_data;&lt;br /&gt;
        load_data.headers.user_agent = self.user_agent.clone();&lt;br /&gt;
&lt;br /&gt;
        // Create new communication channel, create new sniffer task,&lt;br /&gt;
        // send all the data to the new sniffer task with the send&lt;br /&gt;
        // end of the pipe, receive all the data.&lt;br /&gt;
&lt;br /&gt;
        let sniffer_task = sniffer_task::new_sniffer_task(start_chan.clone());&lt;br /&gt;
&lt;br /&gt;
        let loader = match load_data.url.scheme.as_slice() {&lt;br /&gt;
            &amp;quot;file&amp;quot; =&amp;gt; file_loader::factory,&lt;br /&gt;
            &amp;quot;http&amp;quot; | &amp;quot;https&amp;quot; =&amp;gt; http_loader::factory,&lt;br /&gt;
            &amp;quot;data&amp;quot; =&amp;gt; data_loader::factory,&lt;br /&gt;
            &amp;quot;about&amp;quot; =&amp;gt; about_loader::factory,&lt;br /&gt;
            _ =&amp;gt; {&lt;br /&gt;
                debug!(&amp;quot;resource_task: no loader for scheme {:s}&amp;quot;, load_data.url.scheme);&lt;br /&gt;
                start_sending(start_chan, Metadata::default(load_data.url))&lt;br /&gt;
                    .send(Done(Err(&amp;quot;no loader for scheme&amp;quot;.to_string())));&lt;br /&gt;
                return&lt;br /&gt;
            }&lt;br /&gt;
        };&lt;br /&gt;
        debug!(&amp;quot;resource_task: loading url: {:s}&amp;quot;, load_data.url.serialize());&lt;br /&gt;
&lt;br /&gt;
        loader(load_data, sniffer_task);&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* The function which gets called in the load method is &amp;lt;code&amp;gt; new_sniffer_task&amp;lt;/code&amp;gt;. The sniffer task creates a channel and then call &amp;lt;code&amp;gt; SnifferManager &amp;lt;/code&amp;gt; which creates SnifferManager struct with channel information. &amp;lt;code&amp;gt; SnifferManager &amp;lt;/code&amp;gt;  waits for input on the new receiver and passes it on to the old sender, while handing off the new sender to the factory function. Below is the code snippet of the new &amp;lt;code&amp;gt;sniffer_task.rs&amp;lt;/code&amp;gt; file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
struct SnifferManager {&lt;br /&gt;
  data_receiver: Receiver&amp;lt;LoadResponse&amp;gt;,&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
impl SnifferManager {&lt;br /&gt;
  fn new(data_receiver: Receiver &amp;lt;LoadResponse&amp;gt;) -&amp;gt; SnifferManager {&lt;br /&gt;
    SnifferManager {&lt;br /&gt;
      data_receiver: data_receiver,&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
impl SnifferManager {&lt;br /&gt;
  fn start(&amp;amp;self, next_rx: Sender&amp;lt;LoadResponse&amp;gt;) {&lt;br /&gt;
    loop {&lt;br /&gt;
      self.load(next_rx.clone(), self.data_receiver.recv());&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  fn load(&amp;amp;self, next_rx: Sender&amp;lt;LoadResponse&amp;gt;, snif_data: LoadResponse) {&lt;br /&gt;
    next_rx.send(snif_data);&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Design Patterns==&lt;br /&gt;
&lt;br /&gt;
We used the [http://en.wikipedia.org/wiki/Command_pattern command design pattern] in our project. As Wikipedia states, command pattern is a design pattern that in which an &amp;quot;object is used to represent and encapsulate all the information needed to call a method at a later time&amp;quot;. &amp;lt;ref name=&amp;quot;commandDesignPatternWiki&amp;quot;&amp;gt;http://en.wikipedia.org/wiki/Command_pattern&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
In our specific case, the object is the Sniffer Task. A new Sniffer Task is created via the &amp;lt;code&amp;gt; new_sniffer_task&amp;lt;/code&amp;gt; function. When the sniffer task is created, it is isolated and it encapsulates all the information needed to sniff the MIME data out of the URI/file. Since it's isolated, the only way to communicate between the Sniffer Task and the main servo process is by using channels and using &amp;lt;code&amp;gt;send&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;receive&amp;lt;/code&amp;gt; functions to pass data around. For example, in the load function in SnifferManager in &amp;lt;code&amp;gt;sniffer_task.rs&amp;lt;/code&amp;gt;, we use &amp;lt;code&amp;gt;send&amp;lt;/code&amp;gt; to send the data back to the next processing pipeline.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
fn load(&amp;amp;self, next_rx: Sender&amp;lt;LoadResponse&amp;gt;, snif_data: LoadResponse) {&lt;br /&gt;
  next_rx.send(snif_data);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are a few benefits that command design pattern provides. Firstly, since the code block is encapsulated, it is independent and can be modified and switched out easily. This makes maintaining the code very easy. Secondly, because the code blocks has all the resources it needs to perform it's task (in our case, sniffing the MIME), we can easily take it and run it in a different process parallel to the main servo process.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Sniffer Task Project Build==&lt;br /&gt;
&lt;br /&gt;
* After the code changes we Build servo project by running below command.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt; ./mach build &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Tested the code by passing html webpage request.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;./mach run tests/html/about-mozilla.html &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Future Development Scope==&lt;br /&gt;
&lt;br /&gt;
==='''Step 2'''===&lt;br /&gt;
Move from a 1:1 sniffer:request task model to a shared sniffer task - create the sniffing task in ResourceTask::start, store the created sender in a field, and hand off clones of this sender to the factory function. The sniffer task will now also have to be sent the original sender as well, since it is not available at task creation.&lt;br /&gt;
&lt;br /&gt;
==='''Step 3'''===&lt;br /&gt;
When the headers are received, implement the [https://mimesniff.spec.whatwg.org/#handling-a-resource sniffing heuristic algorithm].&lt;br /&gt;
&lt;br /&gt;
==='''Step 4'''===&lt;br /&gt;
Implement the mime type matching algorithm, one category at a time - look for a good way to store the patterns and resulting types to minimize code duplication.&lt;br /&gt;
&lt;br /&gt;
==='''Step 5'''===&lt;br /&gt;
Ensure that the resulting mime type is present in the load that the consumer receives&lt;br /&gt;
&lt;br /&gt;
==='''Step 6'''===&lt;br /&gt;
Write tests that demonstrate working sniffing (for example, loading images with no/wrong extension)&lt;br /&gt;
&lt;br /&gt;
=='''Appendix'''==&lt;br /&gt;
==='''Setting up Servo'''===&lt;br /&gt;
There are two main steps to set up the environment for this project. Linux environment is preferred for setting up the environment as it is simple and easy.&lt;br /&gt;
&lt;br /&gt;
:* [https://github.com/mozilla/rust/wiki/Note-getting-started-developing-Rust Build Rust] &amp;lt;ref&amp;gt; https://github.com/mozilla/rust/wiki/Note-getting-started-developing-Rust &amp;lt;/ref&amp;gt;&lt;br /&gt;
:* [https://github.com/servo/servo Build Servo] &amp;lt;ref&amp;gt; https://github.com/servo/servo &amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Vboddul</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/oss_M1456_kdv&amp;diff=90498</id>
		<title>CSC/ECE 517 Fall 2014/oss M1456 kdv</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/oss_M1456_kdv&amp;diff=90498"/>
		<updated>2014-10-29T14:31:51Z</updated>

		<summary type="html">&lt;p&gt;Vboddul: /* Sniffer Task Project Build */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;='''Implement MIME sniffing - spec'''=&lt;br /&gt;
&lt;br /&gt;
This article is about the open source project M 1456: Implement MIME&amp;lt;ref&amp;gt;https://mimesniff.spec.whatwg.org/&amp;lt;/ref&amp;gt; sniffing - spec &amp;lt;ref&amp;gt;https://github.com/servo/servo/issues/3144&amp;lt;/ref&amp;gt;, which is part of the Servo Parallel Browser Project. Servo is prototype web browser engine which is currently under development and is written in [http://doc.rust-lang.org/guide.html Rust] language. Here you can find a brief Background information about MIME sniffing in servo, rust programming language, the initial step and the first step implemented in the project.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== '''Background Information''' ==&lt;br /&gt;
When we do a HTTP web request which declares the type of its content (using the Content-Type header), it's very easy to decide how to present it - if it's an image, decode it; if it's an HTML page, parse and display it. When no such header is present, Servo currently falters (such as loading an image file or video file from disk, as in [https://github.com/servo/servo/pull/3131 #3131]). In this case, we want to implement the &amp;quot;sniffing&amp;quot; specification, which looks at the starting byte content of the resource and guesses what manner of content is being received. For example, If its an image we can use image rendering and a video rendering can be used for a video file. &lt;br /&gt;
&lt;br /&gt;
==='''What is Servo?'''===&lt;br /&gt;
Servo&amp;lt;ref&amp;gt;https://www.mozilla.org/en-US/research/projects/&amp;lt;/ref&amp;gt; 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;
&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.&lt;br /&gt;
&lt;br /&gt;
Github link to [https://github.com/servo/servo Servo] Project.&lt;br /&gt;
&lt;br /&gt;
==='''Rust Programming Language'''=== &lt;br /&gt;
Rust&amp;lt;ref&amp;gt;https://www.mozilla.org/en-US/research/projects/&amp;lt;/ref&amp;gt; is a new programming language for developing reliable and efficient systems. It's designed to support concurrency and parallelism in building platforms that take full advantage of modern hardware. Its static type system is safe and expressive and it provides strong guarantees about isolation, concurrency execution and memory safety.&lt;br /&gt;
&lt;br /&gt;
Rust combines powerful and flexible modern programming constructs with a clear performance model to make program efficiency predictable and manageable. One important way it achieves this is by allowing fine-grained control over memory allocation through contiguous records and stack allocation. This control is balanced with the absolute requirement of safety: Rust’s type system and runtime guarantee the absence of data races, buffer overflow, stack overflow or access to uninitialized or deallocated memory.&lt;br /&gt;
&lt;br /&gt;
Github link to [https://github.com/rust-lang/rust Rust language].&lt;br /&gt;
&lt;br /&gt;
=='''Implement MIME sniffing'''==&lt;br /&gt;
&lt;br /&gt;
==='''Initial Step'''===&lt;br /&gt;
As part of initial step we first [https://github.com/servo/servo Build Servo]. Learned how to create tasks in Rust, then spawn a new sniffer [http://doc.rust-lang.org/guide.html#tasks task] in the load method in resource_task.rs, by creating a sender and receiver pair as well - this task would read all the available data from the new receiver, and send it immediately via the original sender, while the new sender gets handed off to the factory function that is executed. All web pages continued to load unchanged after rebuilding our code.&lt;br /&gt;
&lt;br /&gt;
==='''Classes'''===&lt;br /&gt;
As part of OSS Servo project we worked on below Class files.&lt;br /&gt;
&lt;br /&gt;
'''Modify'''&lt;br /&gt;
* components/net/resource_task.rs&lt;br /&gt;
&lt;br /&gt;
'''Create'''&lt;br /&gt;
* components/net/sniffer_task.rs&lt;br /&gt;
&lt;br /&gt;
'''Delete'''&lt;br /&gt;
* none&lt;br /&gt;
&lt;br /&gt;
==='''Step 1'''===&lt;br /&gt;
* For every resource request (Example: file, http, data or any kind of request) in load method, it would interpose a sniffer task which sniffs all the data, parse the headers if required and return it. Below is the code snippet of the modified &amp;lt;code&amp;gt; resouce_task.rs &amp;lt;/code&amp;gt; file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    fn load(&amp;amp;self, load_data: LoadData, start_chan: Sender&amp;lt;LoadResponse&amp;gt;) {&lt;br /&gt;
        let mut load_data = load_data;&lt;br /&gt;
        load_data.headers.user_agent = self.user_agent.clone();&lt;br /&gt;
&lt;br /&gt;
        // Create new communication channel, create new sniffer task,&lt;br /&gt;
        // send all the data to the new sniffer task with the send&lt;br /&gt;
        // end of the pipe, receive all the data.&lt;br /&gt;
&lt;br /&gt;
        let sniffer_task = sniffer_task::new_sniffer_task(start_chan.clone());&lt;br /&gt;
&lt;br /&gt;
        let loader = match load_data.url.scheme.as_slice() {&lt;br /&gt;
            &amp;quot;file&amp;quot; =&amp;gt; file_loader::factory,&lt;br /&gt;
            &amp;quot;http&amp;quot; | &amp;quot;https&amp;quot; =&amp;gt; http_loader::factory,&lt;br /&gt;
            &amp;quot;data&amp;quot; =&amp;gt; data_loader::factory,&lt;br /&gt;
            &amp;quot;about&amp;quot; =&amp;gt; about_loader::factory,&lt;br /&gt;
            _ =&amp;gt; {&lt;br /&gt;
                debug!(&amp;quot;resource_task: no loader for scheme {:s}&amp;quot;, load_data.url.scheme);&lt;br /&gt;
                start_sending(start_chan, Metadata::default(load_data.url))&lt;br /&gt;
                    .send(Done(Err(&amp;quot;no loader for scheme&amp;quot;.to_string())));&lt;br /&gt;
                return&lt;br /&gt;
            }&lt;br /&gt;
        };&lt;br /&gt;
        debug!(&amp;quot;resource_task: loading url: {:s}&amp;quot;, load_data.url.serialize());&lt;br /&gt;
&lt;br /&gt;
        loader(load_data, sniffer_task);&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* The function which gets called in the load method is &amp;lt;code&amp;gt; new_sniffer_task&amp;lt;/code&amp;gt;. The sniffer task creates a channel and then call &amp;lt;code&amp;gt; SnifferManager &amp;lt;/code&amp;gt; which creates SnifferManager struct with channel information. &amp;lt;code&amp;gt; SnifferManager &amp;lt;/code&amp;gt;  waits for input on the new receiver and passes it on to the old sender, while handing off the new sender to the factory function. Below is the code snippet of the new &amp;lt;code&amp;gt;sniffer_task.rs&amp;lt;/code&amp;gt; file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
struct SnifferManager {&lt;br /&gt;
  data_receiver: Receiver&amp;lt;LoadResponse&amp;gt;,&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
impl SnifferManager {&lt;br /&gt;
  fn new(data_receiver: Receiver &amp;lt;LoadResponse&amp;gt;) -&amp;gt; SnifferManager {&lt;br /&gt;
    SnifferManager {&lt;br /&gt;
      data_receiver: data_receiver,&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
impl SnifferManager {&lt;br /&gt;
  fn start(&amp;amp;self, next_rx: Sender&amp;lt;LoadResponse&amp;gt;) {&lt;br /&gt;
    loop {&lt;br /&gt;
      self.load(next_rx.clone(), self.data_receiver.recv());&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  fn load(&amp;amp;self, next_rx: Sender&amp;lt;LoadResponse&amp;gt;, snif_data: LoadResponse) {&lt;br /&gt;
    next_rx.send(snif_data);&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Design Patterns==&lt;br /&gt;
&lt;br /&gt;
We used the [http://en.wikipedia.org/wiki/Command_pattern command design pattern] in our project. As Wikipedia states, command pattern is a design pattern that in which an &amp;quot;object is used to represent and encapsulate all the information needed to call a method at a later time&amp;quot;. &amp;lt;ref name=&amp;quot;commandDesignPatternWiki&amp;quot;&amp;gt;http://en.wikipedia.org/wiki/Command_pattern&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
In our specific case, the object is the Sniffer Task. A new Sniffer Task is created via the &amp;lt;code&amp;gt; new_sniffer_task&amp;lt;/code&amp;gt; function. When the sniffer task is created, it is isolated and it encapsulates all the information needed to sniff the MIME data out of the URI/file. Since it's isolated, the only way to communicate between the Sniffer Task and the main servo process is by using channels and using &amp;lt;code&amp;gt;send&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;receive&amp;lt;/code&amp;gt; functions to pass data around. For example, in the load function in SnifferManager in &amp;lt;code&amp;gt;sniffer_task.rs&amp;lt;/code&amp;gt;, we use &amp;lt;code&amp;gt;send&amp;lt;/code&amp;gt; to send the data back to the next processing pipeline.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
fn load(&amp;amp;self, next_rx: Sender&amp;lt;LoadResponse&amp;gt;, snif_data: LoadResponse) {&lt;br /&gt;
  next_rx.send(snif_data);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are a few benefits that command design pattern provides. Firstly, since the code block is encapsulated, it is independent and can be modified and switched out easily. This makes maintaining the code very easy. Secondly, because the code blocks has all the resources it needs to perform it's task (in our case, sniffing the MIME), we can easily take it and run it in a different process parallel to the main servo process.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Sniffer Task Project Build==&lt;br /&gt;
&lt;br /&gt;
* After the code changes we Build servo project by running below command.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt; ./mach build &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Tested the code by passing html webpage request.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;./mach run tests/html/about-mozilla.html &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Future Development==&lt;br /&gt;
&lt;br /&gt;
==='''Step 2'''===&lt;br /&gt;
Move from a 1:1 sniffer:request task model to a shared sniffer task - create the sniffing task in ResourceTask::start, store the created sender in a field, and hand off clones of this sender to the factory function. The sniffer task will now also have to be sent the original sender as well, since it is not available at task creation.&lt;br /&gt;
&lt;br /&gt;
==='''Step 3'''===&lt;br /&gt;
When the headers are received, implement the [https://mimesniff.spec.whatwg.org/#handling-a-resource sniffing heuristic algorithm].&lt;br /&gt;
&lt;br /&gt;
==='''Step 4'''===&lt;br /&gt;
Implement the mime type matching algorithm, one category at a time - look for a good way to store the patterns and resulting types to minimize code duplication.&lt;br /&gt;
&lt;br /&gt;
==='''Step 5'''===&lt;br /&gt;
Ensure that the resulting mime type is present in the load that the consumer receives&lt;br /&gt;
&lt;br /&gt;
==='''Step 6'''===&lt;br /&gt;
Write tests that demonstrate working sniffing (for example, loading images with no/wrong extension)&lt;br /&gt;
&lt;br /&gt;
=='''Appendix'''==&lt;br /&gt;
==='''Setting up Servo'''===&lt;br /&gt;
There are two main steps to set up the environment for this project. Linux environment is preferred for setting up the environment as it is simple and easy.&lt;br /&gt;
&lt;br /&gt;
:* [https://github.com/mozilla/rust/wiki/Note-getting-started-developing-Rust Build Rust] &amp;lt;ref&amp;gt; https://github.com/mozilla/rust/wiki/Note-getting-started-developing-Rust &amp;lt;/ref&amp;gt;&lt;br /&gt;
:* [https://github.com/servo/servo Build Servo] &amp;lt;ref&amp;gt; https://github.com/servo/servo &amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Vboddul</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/oss_M1456_kdv&amp;diff=90497</id>
		<title>CSC/ECE 517 Fall 2014/oss M1456 kdv</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/oss_M1456_kdv&amp;diff=90497"/>
		<updated>2014-10-29T14:31:11Z</updated>

		<summary type="html">&lt;p&gt;Vboddul: /* Sniffer Task Poject Build */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;='''Implement MIME sniffing - spec'''=&lt;br /&gt;
&lt;br /&gt;
This article is about the open source project M 1456: Implement MIME&amp;lt;ref&amp;gt;https://mimesniff.spec.whatwg.org/&amp;lt;/ref&amp;gt; sniffing - spec &amp;lt;ref&amp;gt;https://github.com/servo/servo/issues/3144&amp;lt;/ref&amp;gt;, which is part of the Servo Parallel Browser Project. Servo is prototype web browser engine which is currently under development and is written in [http://doc.rust-lang.org/guide.html Rust] language. Here you can find a brief Background information about MIME sniffing in servo, rust programming language, the initial step and the first step implemented in the project.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== '''Background Information''' ==&lt;br /&gt;
When we do a HTTP web request which declares the type of its content (using the Content-Type header), it's very easy to decide how to present it - if it's an image, decode it; if it's an HTML page, parse and display it. When no such header is present, Servo currently falters (such as loading an image file or video file from disk, as in [https://github.com/servo/servo/pull/3131 #3131]). In this case, we want to implement the &amp;quot;sniffing&amp;quot; specification, which looks at the starting byte content of the resource and guesses what manner of content is being received. For example, If its an image we can use image rendering and a video rendering can be used for a video file. &lt;br /&gt;
&lt;br /&gt;
==='''What is Servo?'''===&lt;br /&gt;
Servo&amp;lt;ref&amp;gt;https://www.mozilla.org/en-US/research/projects/&amp;lt;/ref&amp;gt; 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;
&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.&lt;br /&gt;
&lt;br /&gt;
Github link to [https://github.com/servo/servo Servo] Project.&lt;br /&gt;
&lt;br /&gt;
==='''Rust Programming Language'''=== &lt;br /&gt;
Rust&amp;lt;ref&amp;gt;https://www.mozilla.org/en-US/research/projects/&amp;lt;/ref&amp;gt; is a new programming language for developing reliable and efficient systems. It's designed to support concurrency and parallelism in building platforms that take full advantage of modern hardware. Its static type system is safe and expressive and it provides strong guarantees about isolation, concurrency execution and memory safety.&lt;br /&gt;
&lt;br /&gt;
Rust combines powerful and flexible modern programming constructs with a clear performance model to make program efficiency predictable and manageable. One important way it achieves this is by allowing fine-grained control over memory allocation through contiguous records and stack allocation. This control is balanced with the absolute requirement of safety: Rust’s type system and runtime guarantee the absence of data races, buffer overflow, stack overflow or access to uninitialized or deallocated memory.&lt;br /&gt;
&lt;br /&gt;
Github link to [https://github.com/rust-lang/rust Rust language].&lt;br /&gt;
&lt;br /&gt;
=='''Implement MIME sniffing'''==&lt;br /&gt;
&lt;br /&gt;
==='''Initial Step'''===&lt;br /&gt;
As part of initial step we first [https://github.com/servo/servo Build Servo]. Learned how to create tasks in Rust, then spawn a new sniffer [http://doc.rust-lang.org/guide.html#tasks task] in the load method in resource_task.rs, by creating a sender and receiver pair as well - this task would read all the available data from the new receiver, and send it immediately via the original sender, while the new sender gets handed off to the factory function that is executed. All web pages continued to load unchanged after rebuilding our code.&lt;br /&gt;
&lt;br /&gt;
==='''Classes'''===&lt;br /&gt;
As part of OSS Servo project we worked on below Class files.&lt;br /&gt;
&lt;br /&gt;
'''Modify'''&lt;br /&gt;
* components/net/resource_task.rs&lt;br /&gt;
&lt;br /&gt;
'''Create'''&lt;br /&gt;
* components/net/sniffer_task.rs&lt;br /&gt;
&lt;br /&gt;
'''Delete'''&lt;br /&gt;
* none&lt;br /&gt;
&lt;br /&gt;
==='''Step 1'''===&lt;br /&gt;
* For every resource request (Example: file, http, data or any kind of request) in load method, it would interpose a sniffer task which sniffs all the data, parse the headers if required and return it. Below is the code snippet of the modified &amp;lt;code&amp;gt; resouce_task.rs &amp;lt;/code&amp;gt; file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    fn load(&amp;amp;self, load_data: LoadData, start_chan: Sender&amp;lt;LoadResponse&amp;gt;) {&lt;br /&gt;
        let mut load_data = load_data;&lt;br /&gt;
        load_data.headers.user_agent = self.user_agent.clone();&lt;br /&gt;
&lt;br /&gt;
        // Create new communication channel, create new sniffer task,&lt;br /&gt;
        // send all the data to the new sniffer task with the send&lt;br /&gt;
        // end of the pipe, receive all the data.&lt;br /&gt;
&lt;br /&gt;
        let sniffer_task = sniffer_task::new_sniffer_task(start_chan.clone());&lt;br /&gt;
&lt;br /&gt;
        let loader = match load_data.url.scheme.as_slice() {&lt;br /&gt;
            &amp;quot;file&amp;quot; =&amp;gt; file_loader::factory,&lt;br /&gt;
            &amp;quot;http&amp;quot; | &amp;quot;https&amp;quot; =&amp;gt; http_loader::factory,&lt;br /&gt;
            &amp;quot;data&amp;quot; =&amp;gt; data_loader::factory,&lt;br /&gt;
            &amp;quot;about&amp;quot; =&amp;gt; about_loader::factory,&lt;br /&gt;
            _ =&amp;gt; {&lt;br /&gt;
                debug!(&amp;quot;resource_task: no loader for scheme {:s}&amp;quot;, load_data.url.scheme);&lt;br /&gt;
                start_sending(start_chan, Metadata::default(load_data.url))&lt;br /&gt;
                    .send(Done(Err(&amp;quot;no loader for scheme&amp;quot;.to_string())));&lt;br /&gt;
                return&lt;br /&gt;
            }&lt;br /&gt;
        };&lt;br /&gt;
        debug!(&amp;quot;resource_task: loading url: {:s}&amp;quot;, load_data.url.serialize());&lt;br /&gt;
&lt;br /&gt;
        loader(load_data, sniffer_task);&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* The function which gets called in the load method is &amp;lt;code&amp;gt; new_sniffer_task&amp;lt;/code&amp;gt;. The sniffer task creates a channel and then call &amp;lt;code&amp;gt; SnifferManager &amp;lt;/code&amp;gt; which creates SnifferManager struct with channel information. &amp;lt;code&amp;gt; SnifferManager &amp;lt;/code&amp;gt;  waits for input on the new receiver and passes it on to the old sender, while handing off the new sender to the factory function. Below is the code snippet of the new &amp;lt;code&amp;gt;sniffer_task.rs&amp;lt;/code&amp;gt; file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
struct SnifferManager {&lt;br /&gt;
  data_receiver: Receiver&amp;lt;LoadResponse&amp;gt;,&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
impl SnifferManager {&lt;br /&gt;
  fn new(data_receiver: Receiver &amp;lt;LoadResponse&amp;gt;) -&amp;gt; SnifferManager {&lt;br /&gt;
    SnifferManager {&lt;br /&gt;
      data_receiver: data_receiver,&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
impl SnifferManager {&lt;br /&gt;
  fn start(&amp;amp;self, next_rx: Sender&amp;lt;LoadResponse&amp;gt;) {&lt;br /&gt;
    loop {&lt;br /&gt;
      self.load(next_rx.clone(), self.data_receiver.recv());&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  fn load(&amp;amp;self, next_rx: Sender&amp;lt;LoadResponse&amp;gt;, snif_data: LoadResponse) {&lt;br /&gt;
    next_rx.send(snif_data);&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Design Patterns==&lt;br /&gt;
&lt;br /&gt;
We used the [http://en.wikipedia.org/wiki/Command_pattern command design pattern] in our project. As Wikipedia states, command pattern is a design pattern that in which an &amp;quot;object is used to represent and encapsulate all the information needed to call a method at a later time&amp;quot;. &amp;lt;ref name=&amp;quot;commandDesignPatternWiki&amp;quot;&amp;gt;http://en.wikipedia.org/wiki/Command_pattern&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
In our specific case, the object is the Sniffer Task. A new Sniffer Task is created via the &amp;lt;code&amp;gt; new_sniffer_task&amp;lt;/code&amp;gt; function. When the sniffer task is created, it is isolated and it encapsulates all the information needed to sniff the MIME data out of the URI/file. Since it's isolated, the only way to communicate between the Sniffer Task and the main servo process is by using channels and using &amp;lt;code&amp;gt;send&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;receive&amp;lt;/code&amp;gt; functions to pass data around. For example, in the load function in SnifferManager in &amp;lt;code&amp;gt;sniffer_task.rs&amp;lt;/code&amp;gt;, we use &amp;lt;code&amp;gt;send&amp;lt;/code&amp;gt; to send the data back to the next processing pipeline.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
fn load(&amp;amp;self, next_rx: Sender&amp;lt;LoadResponse&amp;gt;, snif_data: LoadResponse) {&lt;br /&gt;
  next_rx.send(snif_data);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are a few benefits that command design pattern provides. Firstly, since the code block is encapsulated, it is independent and can be modified and switched out easily. This makes maintaining the code very easy. Secondly, because the code blocks has all the resources it needs to perform it's task (in our case, sniffing the MIME), we can easily take it and run it in a different process parallel to the main servo process.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Sniffer Task Project Build==&lt;br /&gt;
&lt;br /&gt;
* After the code changes we Build servo project by running below command.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt; ./mach build &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Tested the code by passing html webpage.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;./mach run tests/html/about-mozilla.html &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Future Development==&lt;br /&gt;
&lt;br /&gt;
==='''Step 2'''===&lt;br /&gt;
Move from a 1:1 sniffer:request task model to a shared sniffer task - create the sniffing task in ResourceTask::start, store the created sender in a field, and hand off clones of this sender to the factory function. The sniffer task will now also have to be sent the original sender as well, since it is not available at task creation.&lt;br /&gt;
&lt;br /&gt;
==='''Step 3'''===&lt;br /&gt;
When the headers are received, implement the [https://mimesniff.spec.whatwg.org/#handling-a-resource sniffing heuristic algorithm].&lt;br /&gt;
&lt;br /&gt;
==='''Step 4'''===&lt;br /&gt;
Implement the mime type matching algorithm, one category at a time - look for a good way to store the patterns and resulting types to minimize code duplication.&lt;br /&gt;
&lt;br /&gt;
==='''Step 5'''===&lt;br /&gt;
Ensure that the resulting mime type is present in the load that the consumer receives&lt;br /&gt;
&lt;br /&gt;
==='''Step 6'''===&lt;br /&gt;
Write tests that demonstrate working sniffing (for example, loading images with no/wrong extension)&lt;br /&gt;
&lt;br /&gt;
=='''Appendix'''==&lt;br /&gt;
==='''Setting up Servo'''===&lt;br /&gt;
There are two main steps to set up the environment for this project. Linux environment is preferred for setting up the environment as it is simple and easy.&lt;br /&gt;
&lt;br /&gt;
:* [https://github.com/mozilla/rust/wiki/Note-getting-started-developing-Rust Build Rust] &amp;lt;ref&amp;gt; https://github.com/mozilla/rust/wiki/Note-getting-started-developing-Rust &amp;lt;/ref&amp;gt;&lt;br /&gt;
:* [https://github.com/servo/servo Build Servo] &amp;lt;ref&amp;gt; https://github.com/servo/servo &amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Vboddul</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/oss_M1456_kdv&amp;diff=90496</id>
		<title>CSC/ECE 517 Fall 2014/oss M1456 kdv</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/oss_M1456_kdv&amp;diff=90496"/>
		<updated>2014-10-29T14:30:50Z</updated>

		<summary type="html">&lt;p&gt;Vboddul: Build servo project&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;='''Implement MIME sniffing - spec'''=&lt;br /&gt;
&lt;br /&gt;
This article is about the open source project M 1456: Implement MIME&amp;lt;ref&amp;gt;https://mimesniff.spec.whatwg.org/&amp;lt;/ref&amp;gt; sniffing - spec &amp;lt;ref&amp;gt;https://github.com/servo/servo/issues/3144&amp;lt;/ref&amp;gt;, which is part of the Servo Parallel Browser Project. Servo is prototype web browser engine which is currently under development and is written in [http://doc.rust-lang.org/guide.html Rust] language. Here you can find a brief Background information about MIME sniffing in servo, rust programming language, the initial step and the first step implemented in the project.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== '''Background Information''' ==&lt;br /&gt;
When we do a HTTP web request which declares the type of its content (using the Content-Type header), it's very easy to decide how to present it - if it's an image, decode it; if it's an HTML page, parse and display it. When no such header is present, Servo currently falters (such as loading an image file or video file from disk, as in [https://github.com/servo/servo/pull/3131 #3131]). In this case, we want to implement the &amp;quot;sniffing&amp;quot; specification, which looks at the starting byte content of the resource and guesses what manner of content is being received. For example, If its an image we can use image rendering and a video rendering can be used for a video file. &lt;br /&gt;
&lt;br /&gt;
==='''What is Servo?'''===&lt;br /&gt;
Servo&amp;lt;ref&amp;gt;https://www.mozilla.org/en-US/research/projects/&amp;lt;/ref&amp;gt; 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;
&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.&lt;br /&gt;
&lt;br /&gt;
Github link to [https://github.com/servo/servo Servo] Project.&lt;br /&gt;
&lt;br /&gt;
==='''Rust Programming Language'''=== &lt;br /&gt;
Rust&amp;lt;ref&amp;gt;https://www.mozilla.org/en-US/research/projects/&amp;lt;/ref&amp;gt; is a new programming language for developing reliable and efficient systems. It's designed to support concurrency and parallelism in building platforms that take full advantage of modern hardware. Its static type system is safe and expressive and it provides strong guarantees about isolation, concurrency execution and memory safety.&lt;br /&gt;
&lt;br /&gt;
Rust combines powerful and flexible modern programming constructs with a clear performance model to make program efficiency predictable and manageable. One important way it achieves this is by allowing fine-grained control over memory allocation through contiguous records and stack allocation. This control is balanced with the absolute requirement of safety: Rust’s type system and runtime guarantee the absence of data races, buffer overflow, stack overflow or access to uninitialized or deallocated memory.&lt;br /&gt;
&lt;br /&gt;
Github link to [https://github.com/rust-lang/rust Rust language].&lt;br /&gt;
&lt;br /&gt;
=='''Implement MIME sniffing'''==&lt;br /&gt;
&lt;br /&gt;
==='''Initial Step'''===&lt;br /&gt;
As part of initial step we first [https://github.com/servo/servo Build Servo]. Learned how to create tasks in Rust, then spawn a new sniffer [http://doc.rust-lang.org/guide.html#tasks task] in the load method in resource_task.rs, by creating a sender and receiver pair as well - this task would read all the available data from the new receiver, and send it immediately via the original sender, while the new sender gets handed off to the factory function that is executed. All web pages continued to load unchanged after rebuilding our code.&lt;br /&gt;
&lt;br /&gt;
==='''Classes'''===&lt;br /&gt;
As part of OSS Servo project we worked on below Class files.&lt;br /&gt;
&lt;br /&gt;
'''Modify'''&lt;br /&gt;
* components/net/resource_task.rs&lt;br /&gt;
&lt;br /&gt;
'''Create'''&lt;br /&gt;
* components/net/sniffer_task.rs&lt;br /&gt;
&lt;br /&gt;
'''Delete'''&lt;br /&gt;
* none&lt;br /&gt;
&lt;br /&gt;
==='''Step 1'''===&lt;br /&gt;
* For every resource request (Example: file, http, data or any kind of request) in load method, it would interpose a sniffer task which sniffs all the data, parse the headers if required and return it. Below is the code snippet of the modified &amp;lt;code&amp;gt; resouce_task.rs &amp;lt;/code&amp;gt; file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    fn load(&amp;amp;self, load_data: LoadData, start_chan: Sender&amp;lt;LoadResponse&amp;gt;) {&lt;br /&gt;
        let mut load_data = load_data;&lt;br /&gt;
        load_data.headers.user_agent = self.user_agent.clone();&lt;br /&gt;
&lt;br /&gt;
        // Create new communication channel, create new sniffer task,&lt;br /&gt;
        // send all the data to the new sniffer task with the send&lt;br /&gt;
        // end of the pipe, receive all the data.&lt;br /&gt;
&lt;br /&gt;
        let sniffer_task = sniffer_task::new_sniffer_task(start_chan.clone());&lt;br /&gt;
&lt;br /&gt;
        let loader = match load_data.url.scheme.as_slice() {&lt;br /&gt;
            &amp;quot;file&amp;quot; =&amp;gt; file_loader::factory,&lt;br /&gt;
            &amp;quot;http&amp;quot; | &amp;quot;https&amp;quot; =&amp;gt; http_loader::factory,&lt;br /&gt;
            &amp;quot;data&amp;quot; =&amp;gt; data_loader::factory,&lt;br /&gt;
            &amp;quot;about&amp;quot; =&amp;gt; about_loader::factory,&lt;br /&gt;
            _ =&amp;gt; {&lt;br /&gt;
                debug!(&amp;quot;resource_task: no loader for scheme {:s}&amp;quot;, load_data.url.scheme);&lt;br /&gt;
                start_sending(start_chan, Metadata::default(load_data.url))&lt;br /&gt;
                    .send(Done(Err(&amp;quot;no loader for scheme&amp;quot;.to_string())));&lt;br /&gt;
                return&lt;br /&gt;
            }&lt;br /&gt;
        };&lt;br /&gt;
        debug!(&amp;quot;resource_task: loading url: {:s}&amp;quot;, load_data.url.serialize());&lt;br /&gt;
&lt;br /&gt;
        loader(load_data, sniffer_task);&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* The function which gets called in the load method is &amp;lt;code&amp;gt; new_sniffer_task&amp;lt;/code&amp;gt;. The sniffer task creates a channel and then call &amp;lt;code&amp;gt; SnifferManager &amp;lt;/code&amp;gt; which creates SnifferManager struct with channel information. &amp;lt;code&amp;gt; SnifferManager &amp;lt;/code&amp;gt;  waits for input on the new receiver and passes it on to the old sender, while handing off the new sender to the factory function. Below is the code snippet of the new &amp;lt;code&amp;gt;sniffer_task.rs&amp;lt;/code&amp;gt; file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
struct SnifferManager {&lt;br /&gt;
  data_receiver: Receiver&amp;lt;LoadResponse&amp;gt;,&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
impl SnifferManager {&lt;br /&gt;
  fn new(data_receiver: Receiver &amp;lt;LoadResponse&amp;gt;) -&amp;gt; SnifferManager {&lt;br /&gt;
    SnifferManager {&lt;br /&gt;
      data_receiver: data_receiver,&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
impl SnifferManager {&lt;br /&gt;
  fn start(&amp;amp;self, next_rx: Sender&amp;lt;LoadResponse&amp;gt;) {&lt;br /&gt;
    loop {&lt;br /&gt;
      self.load(next_rx.clone(), self.data_receiver.recv());&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  fn load(&amp;amp;self, next_rx: Sender&amp;lt;LoadResponse&amp;gt;, snif_data: LoadResponse) {&lt;br /&gt;
    next_rx.send(snif_data);&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Design Patterns==&lt;br /&gt;
&lt;br /&gt;
We used the [http://en.wikipedia.org/wiki/Command_pattern command design pattern] in our project. As Wikipedia states, command pattern is a design pattern that in which an &amp;quot;object is used to represent and encapsulate all the information needed to call a method at a later time&amp;quot;. &amp;lt;ref name=&amp;quot;commandDesignPatternWiki&amp;quot;&amp;gt;http://en.wikipedia.org/wiki/Command_pattern&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
In our specific case, the object is the Sniffer Task. A new Sniffer Task is created via the &amp;lt;code&amp;gt; new_sniffer_task&amp;lt;/code&amp;gt; function. When the sniffer task is created, it is isolated and it encapsulates all the information needed to sniff the MIME data out of the URI/file. Since it's isolated, the only way to communicate between the Sniffer Task and the main servo process is by using channels and using &amp;lt;code&amp;gt;send&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;receive&amp;lt;/code&amp;gt; functions to pass data around. For example, in the load function in SnifferManager in &amp;lt;code&amp;gt;sniffer_task.rs&amp;lt;/code&amp;gt;, we use &amp;lt;code&amp;gt;send&amp;lt;/code&amp;gt; to send the data back to the next processing pipeline.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
fn load(&amp;amp;self, next_rx: Sender&amp;lt;LoadResponse&amp;gt;, snif_data: LoadResponse) {&lt;br /&gt;
  next_rx.send(snif_data);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are a few benefits that command design pattern provides. Firstly, since the code block is encapsulated, it is independent and can be modified and switched out easily. This makes maintaining the code very easy. Secondly, because the code blocks has all the resources it needs to perform it's task (in our case, sniffing the MIME), we can easily take it and run it in a different process parallel to the main servo process.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Sniffer Task Poject Build==&lt;br /&gt;
&lt;br /&gt;
* After the code changes we Build servo project by running below command.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt; ./mach build &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Tested the code by passing html webpage.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;./mach run tests/html/about-mozilla.html &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Future Development==&lt;br /&gt;
&lt;br /&gt;
==='''Step 2'''===&lt;br /&gt;
Move from a 1:1 sniffer:request task model to a shared sniffer task - create the sniffing task in ResourceTask::start, store the created sender in a field, and hand off clones of this sender to the factory function. The sniffer task will now also have to be sent the original sender as well, since it is not available at task creation.&lt;br /&gt;
&lt;br /&gt;
==='''Step 3'''===&lt;br /&gt;
When the headers are received, implement the [https://mimesniff.spec.whatwg.org/#handling-a-resource sniffing heuristic algorithm].&lt;br /&gt;
&lt;br /&gt;
==='''Step 4'''===&lt;br /&gt;
Implement the mime type matching algorithm, one category at a time - look for a good way to store the patterns and resulting types to minimize code duplication.&lt;br /&gt;
&lt;br /&gt;
==='''Step 5'''===&lt;br /&gt;
Ensure that the resulting mime type is present in the load that the consumer receives&lt;br /&gt;
&lt;br /&gt;
==='''Step 6'''===&lt;br /&gt;
Write tests that demonstrate working sniffing (for example, loading images with no/wrong extension)&lt;br /&gt;
&lt;br /&gt;
=='''Appendix'''==&lt;br /&gt;
==='''Setting up Servo'''===&lt;br /&gt;
There are two main steps to set up the environment for this project. Linux environment is preferred for setting up the environment as it is simple and easy.&lt;br /&gt;
&lt;br /&gt;
:* [https://github.com/mozilla/rust/wiki/Note-getting-started-developing-Rust Build Rust] &amp;lt;ref&amp;gt; https://github.com/mozilla/rust/wiki/Note-getting-started-developing-Rust &amp;lt;/ref&amp;gt;&lt;br /&gt;
:* [https://github.com/servo/servo Build Servo] &amp;lt;ref&amp;gt; https://github.com/servo/servo &amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Vboddul</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/oss_M1456_kdv&amp;diff=90494</id>
		<title>CSC/ECE 517 Fall 2014/oss M1456 kdv</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/oss_M1456_kdv&amp;diff=90494"/>
		<updated>2014-10-29T14:25:55Z</updated>

		<summary type="html">&lt;p&gt;Vboddul: /* Step 1 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;='''Implement MIME sniffing - spec'''=&lt;br /&gt;
&lt;br /&gt;
This article is about the open source project M 1456: Implement MIME&amp;lt;ref&amp;gt;https://mimesniff.spec.whatwg.org/&amp;lt;/ref&amp;gt; sniffing - spec &amp;lt;ref&amp;gt;https://github.com/servo/servo/issues/3144&amp;lt;/ref&amp;gt;, which is part of the Servo Parallel Browser Project. Servo is prototype web browser engine which is currently under development and is written in [http://doc.rust-lang.org/guide.html Rust] language. Here you can find a brief Background information about MIME sniffing in servo, rust programming language, the initial step and the first step implemented in the project.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== '''Background Information''' ==&lt;br /&gt;
When we do a HTTP web request which declares the type of its content (using the Content-Type header), it's very easy to decide how to present it - if it's an image, decode it; if it's an HTML page, parse and display it. When no such header is present, Servo currently falters (such as loading an image file or video file from disk, as in [https://github.com/servo/servo/pull/3131 #3131]). In this case, we want to implement the &amp;quot;sniffing&amp;quot; specification, which looks at the starting byte content of the resource and guesses what manner of content is being received. For example, If its an image we can use image rendering and a video rendering can be used for a video file. &lt;br /&gt;
&lt;br /&gt;
==='''What is Servo?'''===&lt;br /&gt;
Servo&amp;lt;ref&amp;gt;https://www.mozilla.org/en-US/research/projects/&amp;lt;/ref&amp;gt; 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;
&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.&lt;br /&gt;
&lt;br /&gt;
Github link to [https://github.com/servo/servo Servo] Project.&lt;br /&gt;
&lt;br /&gt;
==='''Rust Programming Language'''=== &lt;br /&gt;
Rust&amp;lt;ref&amp;gt;https://www.mozilla.org/en-US/research/projects/&amp;lt;/ref&amp;gt; is a new programming language for developing reliable and efficient systems. It's designed to support concurrency and parallelism in building platforms that take full advantage of modern hardware. Its static type system is safe and expressive and it provides strong guarantees about isolation, concurrency execution and memory safety.&lt;br /&gt;
&lt;br /&gt;
Rust combines powerful and flexible modern programming constructs with a clear performance model to make program efficiency predictable and manageable. One important way it achieves this is by allowing fine-grained control over memory allocation through contiguous records and stack allocation. This control is balanced with the absolute requirement of safety: Rust’s type system and runtime guarantee the absence of data races, buffer overflow, stack overflow or access to uninitialized or deallocated memory.&lt;br /&gt;
&lt;br /&gt;
Github link to [https://github.com/rust-lang/rust Rust language].&lt;br /&gt;
&lt;br /&gt;
=='''Implement MIME sniffing'''==&lt;br /&gt;
&lt;br /&gt;
==='''Initial Step'''===&lt;br /&gt;
As part of initial step we first [https://github.com/servo/servo Build Servo]. Learned how to create tasks in Rust, then spawn a new sniffer [http://doc.rust-lang.org/guide.html#tasks task] in the load method in resource_task.rs, by creating a sender and receiver pair as well - this task would read all the available data from the new receiver, and send it immediately via the original sender, while the new sender gets handed off to the factory function that is executed. All web pages continued to load unchanged after rebuilding our code.&lt;br /&gt;
&lt;br /&gt;
==='''Classes'''===&lt;br /&gt;
As part of OSS Servo project we worked on below Class files.&lt;br /&gt;
&lt;br /&gt;
'''Modify'''&lt;br /&gt;
* components/net/resource_task.rs&lt;br /&gt;
&lt;br /&gt;
'''Create'''&lt;br /&gt;
* components/net/sniffer_task.rs&lt;br /&gt;
&lt;br /&gt;
'''Delete'''&lt;br /&gt;
* none&lt;br /&gt;
&lt;br /&gt;
==='''Step 1'''===&lt;br /&gt;
* For every resource request (Example: file, http, data or any kind of request) in load method, it would interpose a sniffer task which sniffs all the data, parse the headers if required and return it. Below is the code snippet of the modified &amp;lt;code&amp;gt; resouce_task.rs &amp;lt;/code&amp;gt; file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    fn load(&amp;amp;self, load_data: LoadData, start_chan: Sender&amp;lt;LoadResponse&amp;gt;) {&lt;br /&gt;
        let mut load_data = load_data;&lt;br /&gt;
        load_data.headers.user_agent = self.user_agent.clone();&lt;br /&gt;
&lt;br /&gt;
        // Create new communication channel, create new sniffer task,&lt;br /&gt;
        // send all the data to the new sniffer task with the send&lt;br /&gt;
        // end of the pipe, receive all the data.&lt;br /&gt;
&lt;br /&gt;
        let sniffer_task = sniffer_task::new_sniffer_task(start_chan.clone());&lt;br /&gt;
&lt;br /&gt;
        let loader = match load_data.url.scheme.as_slice() {&lt;br /&gt;
            &amp;quot;file&amp;quot; =&amp;gt; file_loader::factory,&lt;br /&gt;
            &amp;quot;http&amp;quot; | &amp;quot;https&amp;quot; =&amp;gt; http_loader::factory,&lt;br /&gt;
            &amp;quot;data&amp;quot; =&amp;gt; data_loader::factory,&lt;br /&gt;
            &amp;quot;about&amp;quot; =&amp;gt; about_loader::factory,&lt;br /&gt;
            _ =&amp;gt; {&lt;br /&gt;
                debug!(&amp;quot;resource_task: no loader for scheme {:s}&amp;quot;, load_data.url.scheme);&lt;br /&gt;
                start_sending(start_chan, Metadata::default(load_data.url))&lt;br /&gt;
                    .send(Done(Err(&amp;quot;no loader for scheme&amp;quot;.to_string())));&lt;br /&gt;
                return&lt;br /&gt;
            }&lt;br /&gt;
        };&lt;br /&gt;
        debug!(&amp;quot;resource_task: loading url: {:s}&amp;quot;, load_data.url.serialize());&lt;br /&gt;
&lt;br /&gt;
        loader(load_data, sniffer_task);&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* The function which gets called in the load method is &amp;lt;code&amp;gt; new_sniffer_task&amp;lt;/code&amp;gt;. The sniffer task creates a channel and then call &amp;lt;code&amp;gt; SnifferManager &amp;lt;/code&amp;gt; which creates SnifferManager struct with channel information. &amp;lt;code&amp;gt; SnifferManager &amp;lt;/code&amp;gt;  waits for input on the new receiver and passes it on to the old sender, while handing off the new sender to the factory function. Below is the code snippet of the new &amp;lt;code&amp;gt;sniffer_task.rs&amp;lt;/code&amp;gt; file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
struct SnifferManager {&lt;br /&gt;
  data_receiver: Receiver&amp;lt;LoadResponse&amp;gt;,&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
impl SnifferManager {&lt;br /&gt;
  fn new(data_receiver: Receiver &amp;lt;LoadResponse&amp;gt;) -&amp;gt; SnifferManager {&lt;br /&gt;
    SnifferManager {&lt;br /&gt;
      data_receiver: data_receiver,&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
impl SnifferManager {&lt;br /&gt;
  fn start(&amp;amp;self, next_rx: Sender&amp;lt;LoadResponse&amp;gt;) {&lt;br /&gt;
    loop {&lt;br /&gt;
      self.load(next_rx.clone(), self.data_receiver.recv());&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  fn load(&amp;amp;self, next_rx: Sender&amp;lt;LoadResponse&amp;gt;, snif_data: LoadResponse) {&lt;br /&gt;
    next_rx.send(snif_data);&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Design Patterns==&lt;br /&gt;
&lt;br /&gt;
We used the [http://en.wikipedia.org/wiki/Command_pattern command design pattern] in our project. As Wikipedia states, command pattern is a design pattern that in which an &amp;quot;object is used to represent and encapsulate all the information needed to call a method at a later time&amp;quot;. &amp;lt;ref name=&amp;quot;commandDesignPatternWiki&amp;quot;&amp;gt;http://en.wikipedia.org/wiki/Command_pattern&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
In our specific case, the object is the Sniffer Task. A new Sniffer Task is created via the &amp;lt;code&amp;gt; new_sniffer_task&amp;lt;/code&amp;gt; function. When the sniffer task is created, it is isolated and it encapsulates all the information needed to sniff the MIME data out of the URI/file. Since it's isolated, the only way to communicate between the Sniffer Task and the main servo process is by using channels and using &amp;lt;code&amp;gt;send&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;receive&amp;lt;/code&amp;gt; functions to pass data around. For example, in the load function in SnifferManager in &amp;lt;code&amp;gt;sniffer_task.rs&amp;lt;/code&amp;gt;, we use &amp;lt;code&amp;gt;send&amp;lt;/code&amp;gt; to send the data back to the next processing pipeline.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
fn load(&amp;amp;self, next_rx: Sender&amp;lt;LoadResponse&amp;gt;, snif_data: LoadResponse) {&lt;br /&gt;
  next_rx.send(snif_data);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are a few benefits that command design pattern provides. Firstly, since the code block is encapsulated, it is independent and can be modified and switched out easily. This makes maintaining the code very easy. Secondly, because the code blocks has all the resources it needs to perform it's task (in our case, sniffing the MIME), we can easily take it and run it in a different process parallel to the main servo process.&lt;br /&gt;
&lt;br /&gt;
==Future Development==&lt;br /&gt;
&lt;br /&gt;
==='''Step 2'''===&lt;br /&gt;
Move from a 1:1 sniffer:request task model to a shared sniffer task - create the sniffing task in ResourceTask::start, store the created sender in a field, and hand off clones of this sender to the factory function. The sniffer task will now also have to be sent the original sender as well, since it is not available at task creation.&lt;br /&gt;
&lt;br /&gt;
==='''Step 3'''===&lt;br /&gt;
When the headers are received, implement the [https://mimesniff.spec.whatwg.org/#handling-a-resource sniffing heuristic algorithm].&lt;br /&gt;
&lt;br /&gt;
==='''Step 4'''===&lt;br /&gt;
Implement the mime type matching algorithm, one category at a time - look for a good way to store the patterns and resulting types to minimize code duplication.&lt;br /&gt;
&lt;br /&gt;
==='''Step 5'''===&lt;br /&gt;
Ensure that the resulting mime type is present in the load that the consumer receives&lt;br /&gt;
&lt;br /&gt;
==='''Step 6'''===&lt;br /&gt;
Write tests that demonstrate working sniffing (for example, loading images with no/wrong extension)&lt;br /&gt;
&lt;br /&gt;
=='''Appendix'''==&lt;br /&gt;
==='''Setting up Servo'''===&lt;br /&gt;
There are two main steps to set up the environment for this project. Linux environment is preferred for setting up the environment as it is simple and easy.&lt;br /&gt;
&lt;br /&gt;
:* [https://github.com/mozilla/rust/wiki/Note-getting-started-developing-Rust Build Rust] &amp;lt;ref&amp;gt; https://github.com/mozilla/rust/wiki/Note-getting-started-developing-Rust &amp;lt;/ref&amp;gt;&lt;br /&gt;
:* [https://github.com/servo/servo Build Servo] &amp;lt;ref&amp;gt; https://github.com/servo/servo &amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Vboddul</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/oss_M1456_kdv&amp;diff=90493</id>
		<title>CSC/ECE 517 Fall 2014/oss M1456 kdv</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/oss_M1456_kdv&amp;diff=90493"/>
		<updated>2014-10-29T14:25:45Z</updated>

		<summary type="html">&lt;p&gt;Vboddul: /* Step 1 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;='''Implement MIME sniffing - spec'''=&lt;br /&gt;
&lt;br /&gt;
This article is about the open source project M 1456: Implement MIME&amp;lt;ref&amp;gt;https://mimesniff.spec.whatwg.org/&amp;lt;/ref&amp;gt; sniffing - spec &amp;lt;ref&amp;gt;https://github.com/servo/servo/issues/3144&amp;lt;/ref&amp;gt;, which is part of the Servo Parallel Browser Project. Servo is prototype web browser engine which is currently under development and is written in [http://doc.rust-lang.org/guide.html Rust] language. Here you can find a brief Background information about MIME sniffing in servo, rust programming language, the initial step and the first step implemented in the project.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== '''Background Information''' ==&lt;br /&gt;
When we do a HTTP web request which declares the type of its content (using the Content-Type header), it's very easy to decide how to present it - if it's an image, decode it; if it's an HTML page, parse and display it. When no such header is present, Servo currently falters (such as loading an image file or video file from disk, as in [https://github.com/servo/servo/pull/3131 #3131]). In this case, we want to implement the &amp;quot;sniffing&amp;quot; specification, which looks at the starting byte content of the resource and guesses what manner of content is being received. For example, If its an image we can use image rendering and a video rendering can be used for a video file. &lt;br /&gt;
&lt;br /&gt;
==='''What is Servo?'''===&lt;br /&gt;
Servo&amp;lt;ref&amp;gt;https://www.mozilla.org/en-US/research/projects/&amp;lt;/ref&amp;gt; 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;
&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.&lt;br /&gt;
&lt;br /&gt;
Github link to [https://github.com/servo/servo Servo] Project.&lt;br /&gt;
&lt;br /&gt;
==='''Rust Programming Language'''=== &lt;br /&gt;
Rust&amp;lt;ref&amp;gt;https://www.mozilla.org/en-US/research/projects/&amp;lt;/ref&amp;gt; is a new programming language for developing reliable and efficient systems. It's designed to support concurrency and parallelism in building platforms that take full advantage of modern hardware. Its static type system is safe and expressive and it provides strong guarantees about isolation, concurrency execution and memory safety.&lt;br /&gt;
&lt;br /&gt;
Rust combines powerful and flexible modern programming constructs with a clear performance model to make program efficiency predictable and manageable. One important way it achieves this is by allowing fine-grained control over memory allocation through contiguous records and stack allocation. This control is balanced with the absolute requirement of safety: Rust’s type system and runtime guarantee the absence of data races, buffer overflow, stack overflow or access to uninitialized or deallocated memory.&lt;br /&gt;
&lt;br /&gt;
Github link to [https://github.com/rust-lang/rust Rust language].&lt;br /&gt;
&lt;br /&gt;
=='''Implement MIME sniffing'''==&lt;br /&gt;
&lt;br /&gt;
==='''Initial Step'''===&lt;br /&gt;
As part of initial step we first [https://github.com/servo/servo Build Servo]. Learned how to create tasks in Rust, then spawn a new sniffer [http://doc.rust-lang.org/guide.html#tasks task] in the load method in resource_task.rs, by creating a sender and receiver pair as well - this task would read all the available data from the new receiver, and send it immediately via the original sender, while the new sender gets handed off to the factory function that is executed. All web pages continued to load unchanged after rebuilding our code.&lt;br /&gt;
&lt;br /&gt;
==='''Classes'''===&lt;br /&gt;
As part of OSS Servo project we worked on below Class files.&lt;br /&gt;
&lt;br /&gt;
'''Modify'''&lt;br /&gt;
* components/net/resource_task.rs&lt;br /&gt;
&lt;br /&gt;
'''Create'''&lt;br /&gt;
* components/net/sniffer_task.rs&lt;br /&gt;
&lt;br /&gt;
'''Delete'''&lt;br /&gt;
* none&lt;br /&gt;
&lt;br /&gt;
==='''Step 1'''===&lt;br /&gt;
* For every resource request(Example: file, http, data or any kind of request) in load method, it would interpose a sniffer task which sniffs all the data, parse the headers if required and return it. Below is the code snippet of the modified &amp;lt;code&amp;gt; resouce_task.rs &amp;lt;/code&amp;gt; file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    fn load(&amp;amp;self, load_data: LoadData, start_chan: Sender&amp;lt;LoadResponse&amp;gt;) {&lt;br /&gt;
        let mut load_data = load_data;&lt;br /&gt;
        load_data.headers.user_agent = self.user_agent.clone();&lt;br /&gt;
&lt;br /&gt;
        // Create new communication channel, create new sniffer task,&lt;br /&gt;
        // send all the data to the new sniffer task with the send&lt;br /&gt;
        // end of the pipe, receive all the data.&lt;br /&gt;
&lt;br /&gt;
        let sniffer_task = sniffer_task::new_sniffer_task(start_chan.clone());&lt;br /&gt;
&lt;br /&gt;
        let loader = match load_data.url.scheme.as_slice() {&lt;br /&gt;
            &amp;quot;file&amp;quot; =&amp;gt; file_loader::factory,&lt;br /&gt;
            &amp;quot;http&amp;quot; | &amp;quot;https&amp;quot; =&amp;gt; http_loader::factory,&lt;br /&gt;
            &amp;quot;data&amp;quot; =&amp;gt; data_loader::factory,&lt;br /&gt;
            &amp;quot;about&amp;quot; =&amp;gt; about_loader::factory,&lt;br /&gt;
            _ =&amp;gt; {&lt;br /&gt;
                debug!(&amp;quot;resource_task: no loader for scheme {:s}&amp;quot;, load_data.url.scheme);&lt;br /&gt;
                start_sending(start_chan, Metadata::default(load_data.url))&lt;br /&gt;
                    .send(Done(Err(&amp;quot;no loader for scheme&amp;quot;.to_string())));&lt;br /&gt;
                return&lt;br /&gt;
            }&lt;br /&gt;
        };&lt;br /&gt;
        debug!(&amp;quot;resource_task: loading url: {:s}&amp;quot;, load_data.url.serialize());&lt;br /&gt;
&lt;br /&gt;
        loader(load_data, sniffer_task);&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* The function which gets called in the load method is &amp;lt;code&amp;gt; new_sniffer_task&amp;lt;/code&amp;gt;. The sniffer task creates a channel and then call &amp;lt;code&amp;gt; SnifferManager &amp;lt;/code&amp;gt; which creates SnifferManager struct with channel information. &amp;lt;code&amp;gt; SnifferManager &amp;lt;/code&amp;gt;  waits for input on the new receiver and passes it on to the old sender, while handing off the new sender to the factory function. Below is the code snippet of the new &amp;lt;code&amp;gt;sniffer_task.rs&amp;lt;/code&amp;gt; file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
struct SnifferManager {&lt;br /&gt;
  data_receiver: Receiver&amp;lt;LoadResponse&amp;gt;,&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
impl SnifferManager {&lt;br /&gt;
  fn new(data_receiver: Receiver &amp;lt;LoadResponse&amp;gt;) -&amp;gt; SnifferManager {&lt;br /&gt;
    SnifferManager {&lt;br /&gt;
      data_receiver: data_receiver,&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
impl SnifferManager {&lt;br /&gt;
  fn start(&amp;amp;self, next_rx: Sender&amp;lt;LoadResponse&amp;gt;) {&lt;br /&gt;
    loop {&lt;br /&gt;
      self.load(next_rx.clone(), self.data_receiver.recv());&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  fn load(&amp;amp;self, next_rx: Sender&amp;lt;LoadResponse&amp;gt;, snif_data: LoadResponse) {&lt;br /&gt;
    next_rx.send(snif_data);&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Design Patterns==&lt;br /&gt;
&lt;br /&gt;
We used the [http://en.wikipedia.org/wiki/Command_pattern command design pattern] in our project. As Wikipedia states, command pattern is a design pattern that in which an &amp;quot;object is used to represent and encapsulate all the information needed to call a method at a later time&amp;quot;. &amp;lt;ref name=&amp;quot;commandDesignPatternWiki&amp;quot;&amp;gt;http://en.wikipedia.org/wiki/Command_pattern&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
In our specific case, the object is the Sniffer Task. A new Sniffer Task is created via the &amp;lt;code&amp;gt; new_sniffer_task&amp;lt;/code&amp;gt; function. When the sniffer task is created, it is isolated and it encapsulates all the information needed to sniff the MIME data out of the URI/file. Since it's isolated, the only way to communicate between the Sniffer Task and the main servo process is by using channels and using &amp;lt;code&amp;gt;send&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;receive&amp;lt;/code&amp;gt; functions to pass data around. For example, in the load function in SnifferManager in &amp;lt;code&amp;gt;sniffer_task.rs&amp;lt;/code&amp;gt;, we use &amp;lt;code&amp;gt;send&amp;lt;/code&amp;gt; to send the data back to the next processing pipeline.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
fn load(&amp;amp;self, next_rx: Sender&amp;lt;LoadResponse&amp;gt;, snif_data: LoadResponse) {&lt;br /&gt;
  next_rx.send(snif_data);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are a few benefits that command design pattern provides. Firstly, since the code block is encapsulated, it is independent and can be modified and switched out easily. This makes maintaining the code very easy. Secondly, because the code blocks has all the resources it needs to perform it's task (in our case, sniffing the MIME), we can easily take it and run it in a different process parallel to the main servo process.&lt;br /&gt;
&lt;br /&gt;
==Future Development==&lt;br /&gt;
&lt;br /&gt;
==='''Step 2'''===&lt;br /&gt;
Move from a 1:1 sniffer:request task model to a shared sniffer task - create the sniffing task in ResourceTask::start, store the created sender in a field, and hand off clones of this sender to the factory function. The sniffer task will now also have to be sent the original sender as well, since it is not available at task creation.&lt;br /&gt;
&lt;br /&gt;
==='''Step 3'''===&lt;br /&gt;
When the headers are received, implement the [https://mimesniff.spec.whatwg.org/#handling-a-resource sniffing heuristic algorithm].&lt;br /&gt;
&lt;br /&gt;
==='''Step 4'''===&lt;br /&gt;
Implement the mime type matching algorithm, one category at a time - look for a good way to store the patterns and resulting types to minimize code duplication.&lt;br /&gt;
&lt;br /&gt;
==='''Step 5'''===&lt;br /&gt;
Ensure that the resulting mime type is present in the load that the consumer receives&lt;br /&gt;
&lt;br /&gt;
==='''Step 6'''===&lt;br /&gt;
Write tests that demonstrate working sniffing (for example, loading images with no/wrong extension)&lt;br /&gt;
&lt;br /&gt;
=='''Appendix'''==&lt;br /&gt;
==='''Setting up Servo'''===&lt;br /&gt;
There are two main steps to set up the environment for this project. Linux environment is preferred for setting up the environment as it is simple and easy.&lt;br /&gt;
&lt;br /&gt;
:* [https://github.com/mozilla/rust/wiki/Note-getting-started-developing-Rust Build Rust] &amp;lt;ref&amp;gt; https://github.com/mozilla/rust/wiki/Note-getting-started-developing-Rust &amp;lt;/ref&amp;gt;&lt;br /&gt;
:* [https://github.com/servo/servo Build Servo] &amp;lt;ref&amp;gt; https://github.com/servo/servo &amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Vboddul</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/oss_M1456_kdv&amp;diff=90491</id>
		<title>CSC/ECE 517 Fall 2014/oss M1456 kdv</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/oss_M1456_kdv&amp;diff=90491"/>
		<updated>2014-10-29T14:24:58Z</updated>

		<summary type="html">&lt;p&gt;Vboddul: /* Classes */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;='''Implement MIME sniffing - spec'''=&lt;br /&gt;
&lt;br /&gt;
This article is about the open source project M 1456: Implement MIME&amp;lt;ref&amp;gt;https://mimesniff.spec.whatwg.org/&amp;lt;/ref&amp;gt; sniffing - spec &amp;lt;ref&amp;gt;https://github.com/servo/servo/issues/3144&amp;lt;/ref&amp;gt;, which is part of the Servo Parallel Browser Project. Servo is prototype web browser engine which is currently under development and is written in [http://doc.rust-lang.org/guide.html Rust] language. Here you can find a brief Background information about MIME sniffing in servo, rust programming language, the initial step and the first step implemented in the project.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== '''Background Information''' ==&lt;br /&gt;
When we do a HTTP web request which declares the type of its content (using the Content-Type header), it's very easy to decide how to present it - if it's an image, decode it; if it's an HTML page, parse and display it. When no such header is present, Servo currently falters (such as loading an image file or video file from disk, as in [https://github.com/servo/servo/pull/3131 #3131]). In this case, we want to implement the &amp;quot;sniffing&amp;quot; specification, which looks at the starting byte content of the resource and guesses what manner of content is being received. For example, If its an image we can use image rendering and a video rendering can be used for a video file. &lt;br /&gt;
&lt;br /&gt;
==='''What is Servo?'''===&lt;br /&gt;
Servo&amp;lt;ref&amp;gt;https://www.mozilla.org/en-US/research/projects/&amp;lt;/ref&amp;gt; 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;
&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.&lt;br /&gt;
&lt;br /&gt;
Github link to [https://github.com/servo/servo Servo] Project.&lt;br /&gt;
&lt;br /&gt;
==='''Rust Programming Language'''=== &lt;br /&gt;
Rust&amp;lt;ref&amp;gt;https://www.mozilla.org/en-US/research/projects/&amp;lt;/ref&amp;gt; is a new programming language for developing reliable and efficient systems. It's designed to support concurrency and parallelism in building platforms that take full advantage of modern hardware. Its static type system is safe and expressive and it provides strong guarantees about isolation, concurrency execution and memory safety.&lt;br /&gt;
&lt;br /&gt;
Rust combines powerful and flexible modern programming constructs with a clear performance model to make program efficiency predictable and manageable. One important way it achieves this is by allowing fine-grained control over memory allocation through contiguous records and stack allocation. This control is balanced with the absolute requirement of safety: Rust’s type system and runtime guarantee the absence of data races, buffer overflow, stack overflow or access to uninitialized or deallocated memory.&lt;br /&gt;
&lt;br /&gt;
Github link to [https://github.com/rust-lang/rust Rust language].&lt;br /&gt;
&lt;br /&gt;
=='''Implement MIME sniffing'''==&lt;br /&gt;
&lt;br /&gt;
==='''Initial Step'''===&lt;br /&gt;
As part of initial step we first [https://github.com/servo/servo Build Servo]. Learned how to create tasks in Rust, then spawn a new sniffer [http://doc.rust-lang.org/guide.html#tasks task] in the load method in resource_task.rs, by creating a sender and receiver pair as well - this task would read all the available data from the new receiver, and send it immediately via the original sender, while the new sender gets handed off to the factory function that is executed. All web pages continued to load unchanged after rebuilding our code.&lt;br /&gt;
&lt;br /&gt;
==='''Classes'''===&lt;br /&gt;
As part of OSS Servo project we worked on below Class files.&lt;br /&gt;
&lt;br /&gt;
'''Modify'''&lt;br /&gt;
* components/net/resource_task.rs&lt;br /&gt;
&lt;br /&gt;
'''Create'''&lt;br /&gt;
* components/net/sniffer_task.rs&lt;br /&gt;
&lt;br /&gt;
'''Delete'''&lt;br /&gt;
* none&lt;br /&gt;
&lt;br /&gt;
==='''Step 1'''===&lt;br /&gt;
* For every resource request(Example: file, http, data or any kind of request) in load method, it would interpose a sniffer task which sniffs all the data, parse the headers if required and return it. Below is the code snippet of the modified resouce_task.rs class file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    fn load(&amp;amp;self, load_data: LoadData, start_chan: Sender&amp;lt;LoadResponse&amp;gt;) {&lt;br /&gt;
        let mut load_data = load_data;&lt;br /&gt;
        load_data.headers.user_agent = self.user_agent.clone();&lt;br /&gt;
&lt;br /&gt;
        // Create new communication channel, create new sniffer task,&lt;br /&gt;
        // send all the data to the new sniffer task with the send&lt;br /&gt;
        // end of the pipe, receive all the data.&lt;br /&gt;
&lt;br /&gt;
        let sniffer_task = sniffer_task::new_sniffer_task(start_chan.clone());&lt;br /&gt;
&lt;br /&gt;
        let loader = match load_data.url.scheme.as_slice() {&lt;br /&gt;
            &amp;quot;file&amp;quot; =&amp;gt; file_loader::factory,&lt;br /&gt;
            &amp;quot;http&amp;quot; | &amp;quot;https&amp;quot; =&amp;gt; http_loader::factory,&lt;br /&gt;
            &amp;quot;data&amp;quot; =&amp;gt; data_loader::factory,&lt;br /&gt;
            &amp;quot;about&amp;quot; =&amp;gt; about_loader::factory,&lt;br /&gt;
            _ =&amp;gt; {&lt;br /&gt;
                debug!(&amp;quot;resource_task: no loader for scheme {:s}&amp;quot;, load_data.url.scheme);&lt;br /&gt;
                start_sending(start_chan, Metadata::default(load_data.url))&lt;br /&gt;
                    .send(Done(Err(&amp;quot;no loader for scheme&amp;quot;.to_string())));&lt;br /&gt;
                return&lt;br /&gt;
            }&lt;br /&gt;
        };&lt;br /&gt;
        debug!(&amp;quot;resource_task: loading url: {:s}&amp;quot;, load_data.url.serialize());&lt;br /&gt;
&lt;br /&gt;
        loader(load_data, sniffer_task);&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* The function which gets called in the load method is &amp;lt;code&amp;gt; new_sniffer_task&amp;lt;/code&amp;gt;. The sniffer task creates a channel and then call &amp;lt;code&amp;gt; SnifferManager &amp;lt;/code&amp;gt; which creates SnifferManager struct with channel information. &amp;lt;code&amp;gt; SnifferManager &amp;lt;/code&amp;gt;  waits for input on the new receiver and passes it on to the old sender, while handing off the new sender to the factory function. Below is the code snippet of the new &amp;lt;code&amp;gt;sniffer_task.rs&amp;lt;/code&amp;gt; file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
struct SnifferManager {&lt;br /&gt;
  data_receiver: Receiver&amp;lt;LoadResponse&amp;gt;,&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
impl SnifferManager {&lt;br /&gt;
  fn new(data_receiver: Receiver &amp;lt;LoadResponse&amp;gt;) -&amp;gt; SnifferManager {&lt;br /&gt;
    SnifferManager {&lt;br /&gt;
      data_receiver: data_receiver,&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
impl SnifferManager {&lt;br /&gt;
  fn start(&amp;amp;self, next_rx: Sender&amp;lt;LoadResponse&amp;gt;) {&lt;br /&gt;
    loop {&lt;br /&gt;
      self.load(next_rx.clone(), self.data_receiver.recv());&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  fn load(&amp;amp;self, next_rx: Sender&amp;lt;LoadResponse&amp;gt;, snif_data: LoadResponse) {&lt;br /&gt;
    next_rx.send(snif_data);&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==Design Patterns==&lt;br /&gt;
&lt;br /&gt;
We used the [http://en.wikipedia.org/wiki/Command_pattern command design pattern] in our project. As Wikipedia states, command pattern is a design pattern that in which an &amp;quot;object is used to represent and encapsulate all the information needed to call a method at a later time&amp;quot;. &amp;lt;ref name=&amp;quot;commandDesignPatternWiki&amp;quot;&amp;gt;http://en.wikipedia.org/wiki/Command_pattern&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
In our specific case, the object is the Sniffer Task. A new Sniffer Task is created via the &amp;lt;code&amp;gt; new_sniffer_task&amp;lt;/code&amp;gt; function. When the sniffer task is created, it is isolated and it encapsulates all the information needed to sniff the MIME data out of the URI/file. Since it's isolated, the only way to communicate between the Sniffer Task and the main servo process is by using channels and using &amp;lt;code&amp;gt;send&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;receive&amp;lt;/code&amp;gt; functions to pass data around. For example, in the load function in SnifferManager in &amp;lt;code&amp;gt;sniffer_task.rs&amp;lt;/code&amp;gt;, we use &amp;lt;code&amp;gt;send&amp;lt;/code&amp;gt; to send the data back to the next processing pipeline.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
fn load(&amp;amp;self, next_rx: Sender&amp;lt;LoadResponse&amp;gt;, snif_data: LoadResponse) {&lt;br /&gt;
  next_rx.send(snif_data);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are a few benefits that command design pattern provides. Firstly, since the code block is encapsulated, it is independent and can be modified and switched out easily. This makes maintaining the code very easy. Secondly, because the code blocks has all the resources it needs to perform it's task (in our case, sniffing the MIME), we can easily take it and run it in a different process parallel to the main servo process.&lt;br /&gt;
&lt;br /&gt;
==Future Development==&lt;br /&gt;
&lt;br /&gt;
==='''Step 2'''===&lt;br /&gt;
Move from a 1:1 sniffer:request task model to a shared sniffer task - create the sniffing task in ResourceTask::start, store the created sender in a field, and hand off clones of this sender to the factory function. The sniffer task will now also have to be sent the original sender as well, since it is not available at task creation.&lt;br /&gt;
&lt;br /&gt;
==='''Step 3'''===&lt;br /&gt;
When the headers are received, implement the [https://mimesniff.spec.whatwg.org/#handling-a-resource sniffing heuristic algorithm].&lt;br /&gt;
&lt;br /&gt;
==='''Step 4'''===&lt;br /&gt;
Implement the mime type matching algorithm, one category at a time - look for a good way to store the patterns and resulting types to minimize code duplication.&lt;br /&gt;
&lt;br /&gt;
==='''Step 5'''===&lt;br /&gt;
Ensure that the resulting mime type is present in the load that the consumer receives&lt;br /&gt;
&lt;br /&gt;
==='''Step 6'''===&lt;br /&gt;
Write tests that demonstrate working sniffing (for example, loading images with no/wrong extension)&lt;br /&gt;
&lt;br /&gt;
=='''Appendix'''==&lt;br /&gt;
==='''Setting up Servo'''===&lt;br /&gt;
There are two main steps to set up the environment for this project. Linux environment is preferred for setting up the environment as it is simple and easy.&lt;br /&gt;
&lt;br /&gt;
:* [https://github.com/mozilla/rust/wiki/Note-getting-started-developing-Rust Build Rust] &amp;lt;ref&amp;gt; https://github.com/mozilla/rust/wiki/Note-getting-started-developing-Rust &amp;lt;/ref&amp;gt;&lt;br /&gt;
:* [https://github.com/servo/servo Build Servo] &amp;lt;ref&amp;gt; https://github.com/servo/servo &amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Vboddul</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/oss_M1456_kdv&amp;diff=90489</id>
		<title>CSC/ECE 517 Fall 2014/oss M1456 kdv</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/oss_M1456_kdv&amp;diff=90489"/>
		<updated>2014-10-29T14:23:47Z</updated>

		<summary type="html">&lt;p&gt;Vboddul: modified Step 1&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;='''Implement MIME sniffing - spec'''=&lt;br /&gt;
&lt;br /&gt;
This article is about the open source project M 1456: Implement MIME&amp;lt;ref&amp;gt;https://mimesniff.spec.whatwg.org/&amp;lt;/ref&amp;gt; sniffing - spec &amp;lt;ref&amp;gt;https://github.com/servo/servo/issues/3144&amp;lt;/ref&amp;gt;, which is part of the Servo Parallel Browser Project. Servo is prototype web browser engine which is currently under development and is written in [http://doc.rust-lang.org/guide.html Rust] language. Here you can find a brief Background information about MIME sniffing in servo, rust programming language, the initial step and the first step implemented in the project.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== '''Background Information''' ==&lt;br /&gt;
When we do a HTTP web request which declares the type of its content (using the Content-Type header), it's very easy to decide how to present it - if it's an image, decode it; if it's an HTML page, parse and display it. When no such header is present, Servo currently falters (such as loading an image file or video file from disk, as in [https://github.com/servo/servo/pull/3131 #3131]). In this case, we want to implement the &amp;quot;sniffing&amp;quot; specification, which looks at the starting byte content of the resource and guesses what manner of content is being received. For example, If its an image we can use image rendering and a video rendering can be used for a video file. &lt;br /&gt;
&lt;br /&gt;
==='''What is Servo?'''===&lt;br /&gt;
Servo&amp;lt;ref&amp;gt;https://www.mozilla.org/en-US/research/projects/&amp;lt;/ref&amp;gt; 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;
&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.&lt;br /&gt;
&lt;br /&gt;
Github link to [https://github.com/servo/servo Servo] Project.&lt;br /&gt;
&lt;br /&gt;
==='''Rust Programming Language'''=== &lt;br /&gt;
Rust&amp;lt;ref&amp;gt;https://www.mozilla.org/en-US/research/projects/&amp;lt;/ref&amp;gt; is a new programming language for developing reliable and efficient systems. It's designed to support concurrency and parallelism in building platforms that take full advantage of modern hardware. Its static type system is safe and expressive and it provides strong guarantees about isolation, concurrency execution and memory safety.&lt;br /&gt;
&lt;br /&gt;
Rust combines powerful and flexible modern programming constructs with a clear performance model to make program efficiency predictable and manageable. One important way it achieves this is by allowing fine-grained control over memory allocation through contiguous records and stack allocation. This control is balanced with the absolute requirement of safety: Rust’s type system and runtime guarantee the absence of data races, buffer overflow, stack overflow or access to uninitialized or deallocated memory.&lt;br /&gt;
&lt;br /&gt;
Github link to [https://github.com/rust-lang/rust Rust language].&lt;br /&gt;
&lt;br /&gt;
=='''Implement MIME sniffing'''==&lt;br /&gt;
&lt;br /&gt;
==='''Initial Step'''===&lt;br /&gt;
As part of initial step we first [https://github.com/servo/servo Build Servo]. Learned how to create tasks in Rust, then spawn a new sniffer [http://doc.rust-lang.org/guide.html#tasks task] in the load method in resource_task.rs, by creating a sender and receiver pair as well - this task would read all the available data from the new receiver, and send it immediately via the original sender, while the new sender gets handed off to the factory function that is executed. All web pages continued to load unchanged after rebuilding our code.&lt;br /&gt;
&lt;br /&gt;
==='''Classes'''===&lt;br /&gt;
For our code changes we worked on below Class files.&lt;br /&gt;
'''Modify'''&lt;br /&gt;
* components/net/resource_task.rs&lt;br /&gt;
&lt;br /&gt;
'''Create'''&lt;br /&gt;
* components/net/sniffer_task.rs&lt;br /&gt;
&lt;br /&gt;
'''Delete'''&lt;br /&gt;
* none&lt;br /&gt;
&lt;br /&gt;
==='''Step 1'''===&lt;br /&gt;
* For every resource request(Example: file, http, data or any kind of request) in load method, it would interpose a sniffer task which sniffs all the data, parse the headers if required and return it. Below is the code snippet of the modified resouce_task.rs class file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    fn load(&amp;amp;self, load_data: LoadData, start_chan: Sender&amp;lt;LoadResponse&amp;gt;) {&lt;br /&gt;
        let mut load_data = load_data;&lt;br /&gt;
        load_data.headers.user_agent = self.user_agent.clone();&lt;br /&gt;
&lt;br /&gt;
        // Create new communication channel, create new sniffer task,&lt;br /&gt;
        // send all the data to the new sniffer task with the send&lt;br /&gt;
        // end of the pipe, receive all the data.&lt;br /&gt;
&lt;br /&gt;
        let sniffer_task = sniffer_task::new_sniffer_task(start_chan.clone());&lt;br /&gt;
&lt;br /&gt;
        let loader = match load_data.url.scheme.as_slice() {&lt;br /&gt;
            &amp;quot;file&amp;quot; =&amp;gt; file_loader::factory,&lt;br /&gt;
            &amp;quot;http&amp;quot; | &amp;quot;https&amp;quot; =&amp;gt; http_loader::factory,&lt;br /&gt;
            &amp;quot;data&amp;quot; =&amp;gt; data_loader::factory,&lt;br /&gt;
            &amp;quot;about&amp;quot; =&amp;gt; about_loader::factory,&lt;br /&gt;
            _ =&amp;gt; {&lt;br /&gt;
                debug!(&amp;quot;resource_task: no loader for scheme {:s}&amp;quot;, load_data.url.scheme);&lt;br /&gt;
                start_sending(start_chan, Metadata::default(load_data.url))&lt;br /&gt;
                    .send(Done(Err(&amp;quot;no loader for scheme&amp;quot;.to_string())));&lt;br /&gt;
                return&lt;br /&gt;
            }&lt;br /&gt;
        };&lt;br /&gt;
        debug!(&amp;quot;resource_task: loading url: {:s}&amp;quot;, load_data.url.serialize());&lt;br /&gt;
&lt;br /&gt;
        loader(load_data, sniffer_task);&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* The function which gets called in the load method is &amp;lt;code&amp;gt; new_sniffer_task&amp;lt;/code&amp;gt;. The sniffer task creates a channel and then call &amp;lt;code&amp;gt; SnifferManager &amp;lt;/code&amp;gt; which creates SnifferManager struct with channel information. &amp;lt;code&amp;gt; SnifferManager &amp;lt;/code&amp;gt;  waits for input on the new receiver and passes it on to the old sender, while handing off the new sender to the factory function. Below is the code snippet of the new &amp;lt;code&amp;gt;sniffer_task.rs&amp;lt;/code&amp;gt; file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
struct SnifferManager {&lt;br /&gt;
  data_receiver: Receiver&amp;lt;LoadResponse&amp;gt;,&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
impl SnifferManager {&lt;br /&gt;
  fn new(data_receiver: Receiver &amp;lt;LoadResponse&amp;gt;) -&amp;gt; SnifferManager {&lt;br /&gt;
    SnifferManager {&lt;br /&gt;
      data_receiver: data_receiver,&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
impl SnifferManager {&lt;br /&gt;
  fn start(&amp;amp;self, next_rx: Sender&amp;lt;LoadResponse&amp;gt;) {&lt;br /&gt;
    loop {&lt;br /&gt;
      self.load(next_rx.clone(), self.data_receiver.recv());&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  fn load(&amp;amp;self, next_rx: Sender&amp;lt;LoadResponse&amp;gt;, snif_data: LoadResponse) {&lt;br /&gt;
    next_rx.send(snif_data);&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==Design Patterns==&lt;br /&gt;
&lt;br /&gt;
We used the [http://en.wikipedia.org/wiki/Command_pattern command design pattern] in our project. As Wikipedia states, command pattern is a design pattern that in which an &amp;quot;object is used to represent and encapsulate all the information needed to call a method at a later time&amp;quot;. &amp;lt;ref name=&amp;quot;commandDesignPatternWiki&amp;quot;&amp;gt;http://en.wikipedia.org/wiki/Command_pattern&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
In our specific case, the object is the Sniffer Task. A new Sniffer Task is created via the &amp;lt;code&amp;gt; new_sniffer_task&amp;lt;/code&amp;gt; function. When the sniffer task is created, it is isolated and it encapsulates all the information needed to sniff the MIME data out of the URI/file. Since it's isolated, the only way to communicate between the Sniffer Task and the main servo process is by using channels and using &amp;lt;code&amp;gt;send&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;receive&amp;lt;/code&amp;gt; functions to pass data around. For example, in the load function in SnifferManager in &amp;lt;code&amp;gt;sniffer_task.rs&amp;lt;/code&amp;gt;, we use &amp;lt;code&amp;gt;send&amp;lt;/code&amp;gt; to send the data back to the next processing pipeline.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
fn load(&amp;amp;self, next_rx: Sender&amp;lt;LoadResponse&amp;gt;, snif_data: LoadResponse) {&lt;br /&gt;
  next_rx.send(snif_data);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are a few benefits that command design pattern provides. Firstly, since the code block is encapsulated, it is independent and can be modified and switched out easily. This makes maintaining the code very easy. Secondly, because the code blocks has all the resources it needs to perform it's task (in our case, sniffing the MIME), we can easily take it and run it in a different process parallel to the main servo process.&lt;br /&gt;
&lt;br /&gt;
==Future Development==&lt;br /&gt;
&lt;br /&gt;
==='''Step 2'''===&lt;br /&gt;
Move from a 1:1 sniffer:request task model to a shared sniffer task - create the sniffing task in ResourceTask::start, store the created sender in a field, and hand off clones of this sender to the factory function. The sniffer task will now also have to be sent the original sender as well, since it is not available at task creation.&lt;br /&gt;
&lt;br /&gt;
==='''Step 3'''===&lt;br /&gt;
When the headers are received, implement the [https://mimesniff.spec.whatwg.org/#handling-a-resource sniffing heuristic algorithm].&lt;br /&gt;
&lt;br /&gt;
==='''Step 4'''===&lt;br /&gt;
Implement the mime type matching algorithm, one category at a time - look for a good way to store the patterns and resulting types to minimize code duplication.&lt;br /&gt;
&lt;br /&gt;
==='''Step 5'''===&lt;br /&gt;
Ensure that the resulting mime type is present in the load that the consumer receives&lt;br /&gt;
&lt;br /&gt;
==='''Step 6'''===&lt;br /&gt;
Write tests that demonstrate working sniffing (for example, loading images with no/wrong extension)&lt;br /&gt;
&lt;br /&gt;
=='''Appendix'''==&lt;br /&gt;
==='''Setting up Servo'''===&lt;br /&gt;
There are two main steps to set up the environment for this project. Linux environment is preferred for setting up the environment as it is simple and easy.&lt;br /&gt;
&lt;br /&gt;
:* [https://github.com/mozilla/rust/wiki/Note-getting-started-developing-Rust Build Rust] &amp;lt;ref&amp;gt; https://github.com/mozilla/rust/wiki/Note-getting-started-developing-Rust &amp;lt;/ref&amp;gt;&lt;br /&gt;
:* [https://github.com/servo/servo Build Servo] &amp;lt;ref&amp;gt; https://github.com/servo/servo &amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Vboddul</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/oss_M1456_kdv&amp;diff=90485</id>
		<title>CSC/ECE 517 Fall 2014/oss M1456 kdv</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/oss_M1456_kdv&amp;diff=90485"/>
		<updated>2014-10-29T13:47:59Z</updated>

		<summary type="html">&lt;p&gt;Vboddul: /* Classes */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;='''Implement MIME sniffing - spec'''=&lt;br /&gt;
&lt;br /&gt;
This article is about the open source project M 1456: Implement MIME&amp;lt;ref&amp;gt;https://mimesniff.spec.whatwg.org/&amp;lt;/ref&amp;gt; sniffing - spec &amp;lt;ref&amp;gt;https://github.com/servo/servo/issues/3144&amp;lt;/ref&amp;gt;, which is part of the Servo Parallel Browser Project. Servo is prototype web browser engine which is currently under development and is written in [http://doc.rust-lang.org/guide.html Rust] language. Here you can find a brief Background information about MIME sniffing in servo, rust programming language, the initial step and the first step implemented in the project.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== '''Background Information''' ==&lt;br /&gt;
When we do a HTTP web request which declares the type of its content (using the Content-Type header), it's very easy to decide how to present it - if it's an image, decode it; if it's an HTML page, parse and display it. When no such header is present, Servo currently falters (such as loading an image file or video file from disk, as in [https://github.com/servo/servo/pull/3131 #3131]). In this case, we want to implement the &amp;quot;sniffing&amp;quot; specification, which looks at the starting byte content of the resource and guesses what manner of content is being received. For example, If its an image we can use image rendering and a video rendering can be used for a video file. &lt;br /&gt;
&lt;br /&gt;
==='''What is Servo?'''===&lt;br /&gt;
Servo&amp;lt;ref&amp;gt;https://www.mozilla.org/en-US/research/projects/&amp;lt;/ref&amp;gt; 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;
&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.&lt;br /&gt;
&lt;br /&gt;
Github link to [https://github.com/servo/servo Servo] Project.&lt;br /&gt;
&lt;br /&gt;
==='''Rust Programming Language'''=== &lt;br /&gt;
Rust&amp;lt;ref&amp;gt;https://www.mozilla.org/en-US/research/projects/&amp;lt;/ref&amp;gt; is a new programming language for developing reliable and efficient systems. It's designed to support concurrency and parallelism in building platforms that take full advantage of modern hardware. Its static type system is safe and expressive and it provides strong guarantees about isolation, concurrency execution and memory safety.&lt;br /&gt;
&lt;br /&gt;
Rust combines powerful and flexible modern programming constructs with a clear performance model to make program efficiency predictable and manageable. One important way it achieves this is by allowing fine-grained control over memory allocation through contiguous records and stack allocation. This control is balanced with the absolute requirement of safety: Rust’s type system and runtime guarantee the absence of data races, buffer overflow, stack overflow or access to uninitialized or deallocated memory.&lt;br /&gt;
&lt;br /&gt;
Github link to [https://github.com/rust-lang/rust Rust language].&lt;br /&gt;
&lt;br /&gt;
=='''Implement MIME sniffing'''==&lt;br /&gt;
&lt;br /&gt;
==='''Initial Step'''===&lt;br /&gt;
As part of initial step we first [https://github.com/servo/servo Build Servo]. Learned how to create tasks in Rust, then spawn a new sniffer [http://doc.rust-lang.org/guide.html#tasks task] in the load method in resource_task.rs, by creating a sender and receiver pair as well - this task would read all the available data from the new receiver, and send it immediately via the original sender, while the new sender gets handed off to the factory function that is executed. All web pages continued to load unchanged after rebuilding our code.&lt;br /&gt;
&lt;br /&gt;
==='''Step 1'''===&lt;br /&gt;
Interpose a sniffer in every resource request in the load method in resouce_task.rs - make a new sender/receiver pair, spawn a task that waits for input on the new receiver and passes it on to the old sender, while handing off the new sender to the factory function.&lt;br /&gt;
&lt;br /&gt;
===='''Classes'''====&lt;br /&gt;
'''Modify'''&lt;br /&gt;
* components/net/resource_task.rs&lt;br /&gt;
&lt;br /&gt;
'''Create'''&lt;br /&gt;
* components/net/sniffer_task.rs&lt;br /&gt;
&lt;br /&gt;
'''Delete'''&lt;br /&gt;
* none&lt;br /&gt;
&lt;br /&gt;
==Design Patterns==&lt;br /&gt;
&lt;br /&gt;
We used the [http://en.wikipedia.org/wiki/Command_pattern command design pattern] in our project. As Wikipedia states, command pattern is a design pattern that in which an &amp;quot;object is used to represent and encapsulate all the information needed to call a method at a later time&amp;quot;. &amp;lt;ref name=&amp;quot;commandDesignPatternWiki&amp;quot;&amp;gt;http://en.wikipedia.org/wiki/Command_pattern&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
In our specific case, the object is the Sniffer Task. A new Sniffer Task is created via the &amp;lt;code&amp;gt; new_sniffer_task&amp;lt;/code&amp;gt; function. When the sniffer task is created, it is isolated and it encapsulates all the information needed to sniff the MIME data out of the URI/file. Since it's isolated, the only way to communicate between the Sniffer Task and the main servo process is by using channels and using &amp;lt;code&amp;gt;send&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;receive&amp;lt;/code&amp;gt; functions to pass data around. For example, in the load function in SnifferManager in &amp;lt;code&amp;gt;sniffer_task.rs&amp;lt;/code&amp;gt;, we use &amp;lt;code&amp;gt;send&amp;lt;/code&amp;gt; to send the data back to the next processing pipeline.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
fn load(&amp;amp;self, next_rx: Sender&amp;lt;LoadResponse&amp;gt;, snif_data: LoadResponse) {&lt;br /&gt;
  next_rx.send(snif_data);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are a few benefits that command design pattern provides. Firstly, since the code block is encapsulated, it is independent and can be modified and switched out easily. This makes maintaining the code very easy. Secondly, because the code blocks has all the resources it needs to perform it's task (in our case, sniffing the MIME), we can easily take it and run it in a different process parallel to the main servo process.&lt;br /&gt;
&lt;br /&gt;
==Future Development==&lt;br /&gt;
&lt;br /&gt;
==='''Step 2'''===&lt;br /&gt;
Move from a 1:1 sniffer:request task model to a shared sniffer task - create the sniffing task in ResourceTask::start, store the created sender in a field, and hand off clones of this sender to the factory function. The sniffer task will now also have to be sent the original sender as well, since it is not available at task creation.&lt;br /&gt;
&lt;br /&gt;
==='''Step 3'''===&lt;br /&gt;
When the headers are received, implement the [https://mimesniff.spec.whatwg.org/#handling-a-resource sniffing heuristic algorithm].&lt;br /&gt;
&lt;br /&gt;
==='''Step 4'''===&lt;br /&gt;
Implement the mime type matching algorithm, one category at a time - look for a good way to store the patterns and resulting types to minimize code duplication.&lt;br /&gt;
&lt;br /&gt;
==='''Step 5'''===&lt;br /&gt;
Ensure that the resulting mime type is present in the load that the consumer receives&lt;br /&gt;
&lt;br /&gt;
==='''Step 6'''===&lt;br /&gt;
Write tests that demonstrate working sniffing (for example, loading images with no/wrong extension)&lt;br /&gt;
&lt;br /&gt;
=='''Appendix'''==&lt;br /&gt;
==='''Setting up Servo'''===&lt;br /&gt;
There are two main steps to set up the environment for this project. Linux environment is preferred for setting up the environment as it is simple and easy.&lt;br /&gt;
&lt;br /&gt;
:* [https://github.com/mozilla/rust/wiki/Note-getting-started-developing-Rust Build Rust] &amp;lt;ref&amp;gt; https://github.com/mozilla/rust/wiki/Note-getting-started-developing-Rust &amp;lt;/ref&amp;gt;&lt;br /&gt;
:* [https://github.com/servo/servo Build Servo] &amp;lt;ref&amp;gt; https://github.com/servo/servo &amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Vboddul</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/oss_M1456_kdv&amp;diff=90484</id>
		<title>CSC/ECE 517 Fall 2014/oss M1456 kdv</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/oss_M1456_kdv&amp;diff=90484"/>
		<updated>2014-10-29T13:47:05Z</updated>

		<summary type="html">&lt;p&gt;Vboddul: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;='''Implement MIME sniffing - spec'''=&lt;br /&gt;
&lt;br /&gt;
This article is about the open source project M 1456: Implement MIME&amp;lt;ref&amp;gt;https://mimesniff.spec.whatwg.org/&amp;lt;/ref&amp;gt; sniffing - spec &amp;lt;ref&amp;gt;https://github.com/servo/servo/issues/3144&amp;lt;/ref&amp;gt;, which is part of the Servo Parallel Browser Project. Servo is prototype web browser engine which is currently under development and is written in [http://doc.rust-lang.org/guide.html Rust] language. Here you can find a brief Background information about MIME sniffing in servo, rust programming language, the initial step and the first step implemented in the project.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== '''Background Information''' ==&lt;br /&gt;
When we do a HTTP web request which declares the type of its content (using the Content-Type header), it's very easy to decide how to present it - if it's an image, decode it; if it's an HTML page, parse and display it. When no such header is present, Servo currently falters (such as loading an image file or video file from disk, as in [https://github.com/servo/servo/pull/3131 #3131]). In this case, we want to implement the &amp;quot;sniffing&amp;quot; specification, which looks at the starting byte content of the resource and guesses what manner of content is being received. For example, If its an image we can use image rendering and a video rendering can be used for a video file. &lt;br /&gt;
&lt;br /&gt;
==='''What is Servo?'''===&lt;br /&gt;
Servo&amp;lt;ref&amp;gt;https://www.mozilla.org/en-US/research/projects/&amp;lt;/ref&amp;gt; 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;
&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.&lt;br /&gt;
&lt;br /&gt;
Github link to [https://github.com/servo/servo Servo] Project.&lt;br /&gt;
&lt;br /&gt;
==='''Rust Programming Language'''=== &lt;br /&gt;
Rust&amp;lt;ref&amp;gt;https://www.mozilla.org/en-US/research/projects/&amp;lt;/ref&amp;gt; is a new programming language for developing reliable and efficient systems. It's designed to support concurrency and parallelism in building platforms that take full advantage of modern hardware. Its static type system is safe and expressive and it provides strong guarantees about isolation, concurrency execution and memory safety.&lt;br /&gt;
&lt;br /&gt;
Rust combines powerful and flexible modern programming constructs with a clear performance model to make program efficiency predictable and manageable. One important way it achieves this is by allowing fine-grained control over memory allocation through contiguous records and stack allocation. This control is balanced with the absolute requirement of safety: Rust’s type system and runtime guarantee the absence of data races, buffer overflow, stack overflow or access to uninitialized or deallocated memory.&lt;br /&gt;
&lt;br /&gt;
Github link to [https://github.com/rust-lang/rust Rust language].&lt;br /&gt;
&lt;br /&gt;
=='''Implement MIME sniffing'''==&lt;br /&gt;
&lt;br /&gt;
==='''Initial Step'''===&lt;br /&gt;
As part of initial step we first [https://github.com/servo/servo Build Servo]. Learned how to create tasks in Rust, then spawn a new sniffer [http://doc.rust-lang.org/guide.html#tasks task] in the load method in resource_task.rs, by creating a sender and receiver pair as well - this task would read all the available data from the new receiver, and send it immediately via the original sender, while the new sender gets handed off to the factory function that is executed. All web pages continued to load unchanged after rebuilding our code.&lt;br /&gt;
&lt;br /&gt;
==='''Step 1'''===&lt;br /&gt;
Interpose a sniffer in every resource request in the load method in resouce_task.rs - make a new sender/receiver pair, spawn a task that waits for input on the new receiver and passes it on to the old sender, while handing off the new sender to the factory function.&lt;br /&gt;
&lt;br /&gt;
===='''Classes'''====&lt;br /&gt;
Modify&lt;br /&gt;
&lt;br /&gt;
● components/net/resource_task.rs&lt;br /&gt;
&lt;br /&gt;
Create&lt;br /&gt;
&lt;br /&gt;
● components/net/sniffer_task.rs&lt;br /&gt;
&lt;br /&gt;
Delete&lt;br /&gt;
&lt;br /&gt;
● none&lt;br /&gt;
&lt;br /&gt;
==Design Patterns==&lt;br /&gt;
&lt;br /&gt;
We used the [http://en.wikipedia.org/wiki/Command_pattern command design pattern] in our project. As Wikipedia states, command pattern is a design pattern that in which an &amp;quot;object is used to represent and encapsulate all the information needed to call a method at a later time&amp;quot;. &amp;lt;ref name=&amp;quot;commandDesignPatternWiki&amp;quot;&amp;gt;http://en.wikipedia.org/wiki/Command_pattern&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
In our specific case, the object is the Sniffer Task. A new Sniffer Task is created via the &amp;lt;code&amp;gt; new_sniffer_task&amp;lt;/code&amp;gt; function. When the sniffer task is created, it is isolated and it encapsulates all the information needed to sniff the MIME data out of the URI/file. Since it's isolated, the only way to communicate between the Sniffer Task and the main servo process is by using channels and using &amp;lt;code&amp;gt;send&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;receive&amp;lt;/code&amp;gt; functions to pass data around. For example, in the load function in SnifferManager in &amp;lt;code&amp;gt;sniffer_task.rs&amp;lt;/code&amp;gt;, we use &amp;lt;code&amp;gt;send&amp;lt;/code&amp;gt; to send the data back to the next processing pipeline.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
fn load(&amp;amp;self, next_rx: Sender&amp;lt;LoadResponse&amp;gt;, snif_data: LoadResponse) {&lt;br /&gt;
  next_rx.send(snif_data);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are a few benefits that command design pattern provides. Firstly, since the code block is encapsulated, it is independent and can be modified and switched out easily. This makes maintaining the code very easy. Secondly, because the code blocks has all the resources it needs to perform it's task (in our case, sniffing the MIME), we can easily take it and run it in a different process parallel to the main servo process.&lt;br /&gt;
&lt;br /&gt;
==Future Development==&lt;br /&gt;
&lt;br /&gt;
==='''Step 2'''===&lt;br /&gt;
Move from a 1:1 sniffer:request task model to a shared sniffer task - create the sniffing task in ResourceTask::start, store the created sender in a field, and hand off clones of this sender to the factory function. The sniffer task will now also have to be sent the original sender as well, since it is not available at task creation.&lt;br /&gt;
&lt;br /&gt;
==='''Step 3'''===&lt;br /&gt;
When the headers are received, implement the [https://mimesniff.spec.whatwg.org/#handling-a-resource sniffing heuristic algorithm].&lt;br /&gt;
&lt;br /&gt;
==='''Step 4'''===&lt;br /&gt;
Implement the mime type matching algorithm, one category at a time - look for a good way to store the patterns and resulting types to minimize code duplication.&lt;br /&gt;
&lt;br /&gt;
==='''Step 5'''===&lt;br /&gt;
Ensure that the resulting mime type is present in the load that the consumer receives&lt;br /&gt;
&lt;br /&gt;
==='''Step 6'''===&lt;br /&gt;
Write tests that demonstrate working sniffing (for example, loading images with no/wrong extension)&lt;br /&gt;
&lt;br /&gt;
=='''Appendix'''==&lt;br /&gt;
==='''Setting up Servo'''===&lt;br /&gt;
There are two main steps to set up the environment for this project. Linux environment is preferred for setting up the environment as it is simple and easy.&lt;br /&gt;
&lt;br /&gt;
:* [https://github.com/mozilla/rust/wiki/Note-getting-started-developing-Rust Build Rust] &amp;lt;ref&amp;gt; https://github.com/mozilla/rust/wiki/Note-getting-started-developing-Rust &amp;lt;/ref&amp;gt;&lt;br /&gt;
:* [https://github.com/servo/servo Build Servo] &amp;lt;ref&amp;gt; https://github.com/servo/servo &amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Vboddul</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/oss_M1456_kdv&amp;diff=90479</id>
		<title>CSC/ECE 517 Fall 2014/oss M1456 kdv</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/oss_M1456_kdv&amp;diff=90479"/>
		<updated>2014-10-29T13:42:01Z</updated>

		<summary type="html">&lt;p&gt;Vboddul: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;='''Implement MIME sniffing - spec'''=&lt;br /&gt;
&lt;br /&gt;
This article is about the open source project M 1456: Implement MIME&amp;lt;ref&amp;gt;https://mimesniff.spec.whatwg.org/&amp;lt;/ref&amp;gt; sniffing - spec &amp;lt;ref&amp;gt;https://github.com/servo/servo/issues/3144&amp;lt;/ref&amp;gt;, which is part of the Servo Parallel Browser Project. Servo is prototype web browser engine which is currently under development and is written in [http://doc.rust-lang.org/guide.html Rust] language. Here you can find a brief Background information about MIME sniffing in servo, rust programming language, the initial step and the first step implemented in the project.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== '''Background Information''' ==&lt;br /&gt;
When we do a HTTP web request which declares the type of its content (using the Content-Type header), it's very easy to decide how to present it - if it's an image, decode it; if it's an HTML page, parse and display it. When no such header is present, Servo currently falters (such as loading an image file or video file from disk, as in [https://github.com/servo/servo/pull/3131 #3131]). In this case, we want to implement the &amp;quot;sniffing&amp;quot; specification, which looks at the starting byte content of the resource and guesses what manner of content is being received. For example, If its an image we can use image rendering and a video rendering can be used for a video file. &lt;br /&gt;
&lt;br /&gt;
==='''What is Servo?'''===&lt;br /&gt;
Servo&amp;lt;ref&amp;gt;https://www.mozilla.org/en-US/research/projects/&amp;lt;/ref&amp;gt; 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;
&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.&lt;br /&gt;
&lt;br /&gt;
Github link to [https://github.com/servo/servo Servo] Project.&lt;br /&gt;
&lt;br /&gt;
==='''Rust Programming Language'''=== &lt;br /&gt;
Rust&amp;lt;ref&amp;gt;https://www.mozilla.org/en-US/research/projects/&amp;lt;/ref&amp;gt; is a new programming language for developing reliable and efficient systems. It's designed to support concurrency and parallelism in building platforms that take full advantage of modern hardware. Its static type system is safe and expressive and it provides strong guarantees about isolation, concurrency execution and memory safety.&lt;br /&gt;
&lt;br /&gt;
Rust combines powerful and flexible modern programming constructs with a clear performance model to make program efficiency predictable and manageable. One important way it achieves this is by allowing fine-grained control over memory allocation through contiguous records and stack allocation. This control is balanced with the absolute requirement of safety: Rust’s type system and runtime guarantee the absence of data races, buffer overflow, stack overflow or access to uninitialized or deallocated memory.&lt;br /&gt;
&lt;br /&gt;
Github link to [https://github.com/rust-lang/rust Rust language].&lt;br /&gt;
&lt;br /&gt;
=='''Implement MIME sniffing'''==&lt;br /&gt;
&lt;br /&gt;
==='''Initial Step'''===&lt;br /&gt;
As part of initial step we first [https://github.com/servo/servo Build Servo]. Learned how to create tasks in Rust, then spawn a new sniffer [http://doc.rust-lang.org/guide.html#tasks task] in the load method in resource_task.rs, by creating a sender and receiver pair as well - this task would read all the available data from the new receiver, and send it immediately via the original sender, while the new sender gets handed off to the factory function that is executed. All web pages continued to load unchanged after rebuilding our code.&lt;br /&gt;
&lt;br /&gt;
==='''Step 1'''===&lt;br /&gt;
Interpose a sniffer in every resource request in the load method in resouce_task.rs - make a new sender/receiver pair, spawn a task that waits for input on the new receiver and passes it on to the old sender, while handing off the new sender to the factory function.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Design Patterns==&lt;br /&gt;
&lt;br /&gt;
We used the [http://en.wikipedia.org/wiki/Command_pattern command design pattern] in our project. As Wikipedia states, command pattern is a design pattern that in which an &amp;quot;object is used to represent and encapsulate all the information needed to call a method at a later time&amp;quot;. &amp;lt;ref name=&amp;quot;commandDesignPatternWiki&amp;quot;&amp;gt;http://en.wikipedia.org/wiki/Command_pattern&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
In our specific case, the object is the Sniffer Task. A new Sniffer Task is created via the &amp;lt;code&amp;gt; new_sniffer_task&amp;lt;/code&amp;gt; function. When the sniffer task is created, it is isolated and it encapsulates all the information needed to sniff the MIME data out of the URI/file. Since it's isolated, the only way to communicate between the Sniffer Task and the main servo process is by using channels and using &amp;lt;code&amp;gt;send&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;receive&amp;lt;/code&amp;gt; functions to pass data around. For example, in the load function in SnifferManager in &amp;lt;code&amp;gt;sniffer_task.rs&amp;lt;/code&amp;gt;, we use &amp;lt;code&amp;gt;send&amp;lt;/code&amp;gt; to send the data back to the next processing pipeline.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
fn load(&amp;amp;self, next_rx: Sender&amp;lt;LoadResponse&amp;gt;, snif_data: LoadResponse) {&lt;br /&gt;
  next_rx.send(snif_data);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are a few benefits that command design pattern provides. Firstly, since the code block is encapsulated, it is independent and can be modified and switched out easily. This makes maintaining the code very easy. Secondly, because the code blocks has all the resources it needs to perform it's task (in our case, sniffing the MIME), we can easily take it and run it in a different process parallel to the main servo process.&lt;br /&gt;
&lt;br /&gt;
==Future Development==&lt;br /&gt;
&lt;br /&gt;
==='''Step 2'''===&lt;br /&gt;
Move from a 1:1 sniffer:request task model to a shared sniffer task - create the sniffing task in ResourceTask::start, store the created sender in a field, and hand off clones of this sender to the factory function. The sniffer task will now also have to be sent the original sender as well, since it is not available at task creation.&lt;br /&gt;
&lt;br /&gt;
==='''Step 3'''===&lt;br /&gt;
When the headers are received, implement the [https://mimesniff.spec.whatwg.org/#handling-a-resource sniffing heuristic algorithm].&lt;br /&gt;
&lt;br /&gt;
==='''Step 4'''===&lt;br /&gt;
Implement the mime type matching algorithm, one category at a time - look for a good way to store the patterns and resulting types to minimize code duplication.&lt;br /&gt;
&lt;br /&gt;
==='''Step 5'''===&lt;br /&gt;
Ensure that the resulting mime type is present in the load that the consumer receives&lt;br /&gt;
&lt;br /&gt;
==='''Step 6'''===&lt;br /&gt;
Write tests that demonstrate working sniffing (for example, loading images with no/wrong extension)&lt;br /&gt;
&lt;br /&gt;
=='''Appendix'''==&lt;br /&gt;
==='''Setting up Servo'''===&lt;br /&gt;
There are two main steps to set up the environment for this project. Linux environment is preferred for setting up the environment as it is simple and easy.&lt;br /&gt;
&lt;br /&gt;
:* [https://github.com/mozilla/rust/wiki/Note-getting-started-developing-Rust Build Rust] &amp;lt;ref&amp;gt; https://github.com/mozilla/rust/wiki/Note-getting-started-developing-Rust &amp;lt;/ref&amp;gt;&lt;br /&gt;
:* [https://github.com/servo/servo Build Servo] &amp;lt;ref&amp;gt; https://github.com/servo/servo &amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Vboddul</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/oss_M1456_kdv&amp;diff=90478</id>
		<title>CSC/ECE 517 Fall 2014/oss M1456 kdv</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/oss_M1456_kdv&amp;diff=90478"/>
		<updated>2014-10-29T13:40:31Z</updated>

		<summary type="html">&lt;p&gt;Vboddul: modified initial step&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;='''Implement MIME sniffing - spec'''=&lt;br /&gt;
&lt;br /&gt;
This article is about the open source project M 1456: Implement MIME&amp;lt;ref&amp;gt;https://mimesniff.spec.whatwg.org/&amp;lt;/ref&amp;gt; sniffing - spec &amp;lt;ref&amp;gt;https://github.com/servo/servo/issues/3144&amp;lt;/ref&amp;gt;, which is part of the Servo Parallel Browser Project. Servo is prototype web browser engine which is currently under development and is written in [http://doc.rust-lang.org/guide.html Rust] language. Here you can find a brief Background information about MIME sniffing in servo, rust programming language, the initial step and the first step implemented in the project.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== '''Background Information''' ==&lt;br /&gt;
When we do a HTTP web request which declares the type of its content (using the Content-Type header), it's very easy to decide how to present it - if it's an image, decode it; if it's an HTML page, parse and display it. When no such header is present, Servo currently falters (such as loading an image file or video file from disk, as in [https://github.com/servo/servo/pull/3131 #3131]). In this case, we want to implement the &amp;quot;sniffing&amp;quot; specification, which looks at the starting byte content of the resource and guesses what manner of content is being received. For example, If its an image we can use image rendering and a video rendering can be used for a video file. &lt;br /&gt;
&lt;br /&gt;
==='''What is Servo?'''===&lt;br /&gt;
Servo&amp;lt;ref&amp;gt;https://www.mozilla.org/en-US/research/projects/&amp;lt;/ref&amp;gt; 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;
&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.&lt;br /&gt;
&lt;br /&gt;
Github link to [https://github.com/servo/servo Servo] Project.&lt;br /&gt;
&lt;br /&gt;
==='''Rust Programming Language'''=== &lt;br /&gt;
Rust&amp;lt;ref&amp;gt;https://www.mozilla.org/en-US/research/projects/&amp;lt;/ref&amp;gt; is a new programming language for developing reliable and efficient systems. It's designed to support concurrency and parallelism in building platforms that take full advantage of modern hardware. Its static type system is safe and expressive and it provides strong guarantees about isolation, concurrency execution and memory safety.&lt;br /&gt;
&lt;br /&gt;
Rust combines powerful and flexible modern programming constructs with a clear performance model to make program efficiency predictable and manageable. One important way it achieves this is by allowing fine-grained control over memory allocation through contiguous records and stack allocation. This control is balanced with the absolute requirement of safety: Rust’s type system and runtime guarantee the absence of data races, buffer overflow, stack overflow or access to uninitialized or deallocated memory.&lt;br /&gt;
&lt;br /&gt;
Github link to [https://github.com/rust-lang/rust Rust language].&lt;br /&gt;
&lt;br /&gt;
=='''Implement MIME sniffing'''==&lt;br /&gt;
&lt;br /&gt;
==='''Initial Step'''===&lt;br /&gt;
As part of initial step we first Build Servo. Learned how to create tasks in Rust, then spawn a new sniffer [http://doc.rust-lang.org/guide.html#tasks task] in the load method in resource_task.rs, by creating a sender and receiver pair as well - this task would read all the available data from the new receiver, and send it immediately via the original sender, while the new sender gets handed off to the factory function that is executed. All web pages continued to load unchanged after rebuilding our code.&lt;br /&gt;
&lt;br /&gt;
==='''Step 1'''===&lt;br /&gt;
Interpose a sniffer in every resource request in the load method in resouce_task.rs - make a new sender/receiver pair, spawn a task that waits for input on the new receiver and passes it on to the old sender, while handing off the new sender to the factory function.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Design Patterns==&lt;br /&gt;
&lt;br /&gt;
We used the [http://en.wikipedia.org/wiki/Command_pattern command design pattern] in our project. As Wikipedia states, command pattern is a design pattern that in which an &amp;quot;object is used to represent and encapsulate all the information needed to call a method at a later time&amp;quot;. &amp;lt;ref name=&amp;quot;commandDesignPatternWiki&amp;quot;&amp;gt;http://en.wikipedia.org/wiki/Command_pattern&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
In our specific case, the object is the Sniffer Task. A new Sniffer Task is created via the &amp;lt;code&amp;gt; new_sniffer_task&amp;lt;/code&amp;gt; function. When the sniffer task is created, it is isolated and it encapsulates all the information needed to sniff the MIME data out of the URI/file. Since it's isolated, the only way to communicate between the Sniffer Task and the main servo process is by using channels and using &amp;lt;code&amp;gt;send&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;receive&amp;lt;/code&amp;gt; functions to pass data around. For example, in the load function in SnifferManager in &amp;lt;code&amp;gt;sniffer_task.rs&amp;lt;/code&amp;gt;, we use &amp;lt;code&amp;gt;send&amp;lt;/code&amp;gt; to send the data back to the next processing pipeline.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
fn load(&amp;amp;self, next_rx: Sender&amp;lt;LoadResponse&amp;gt;, snif_data: LoadResponse) {&lt;br /&gt;
  next_rx.send(snif_data);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are a few benefits that command design pattern provides. Firstly, since the code block is encapsulated, it is independent and can be modified and switched out easily. This makes maintaining the code very easy. Secondly, because the code blocks has all the resources it needs to perform it's task (in our case, sniffing the MIME), we can easily take it and run it in a different process parallel to the main servo process.&lt;br /&gt;
&lt;br /&gt;
==Future Development==&lt;br /&gt;
&lt;br /&gt;
==='''Step 2'''===&lt;br /&gt;
Move from a 1:1 sniffer:request task model to a shared sniffer task - create the sniffing task in ResourceTask::start, store the created sender in a field, and hand off clones of this sender to the factory function. The sniffer task will now also have to be sent the original sender as well, since it is not available at task creation.&lt;br /&gt;
&lt;br /&gt;
==='''Step 3'''===&lt;br /&gt;
When the headers are received, implement the [https://mimesniff.spec.whatwg.org/#handling-a-resource sniffing heuristic algorithm].&lt;br /&gt;
&lt;br /&gt;
==='''Step 4'''===&lt;br /&gt;
Implement the mime type matching algorithm, one category at a time - look for a good way to store the patterns and resulting types to minimize code duplication.&lt;br /&gt;
&lt;br /&gt;
==='''Step 5'''===&lt;br /&gt;
Ensure that the resulting mime type is present in the load that the consumer receives&lt;br /&gt;
&lt;br /&gt;
==='''Step 6'''===&lt;br /&gt;
Write tests that demonstrate working sniffing (for example, loading images with no/wrong extension)&lt;br /&gt;
&lt;br /&gt;
=='''Appendix'''==&lt;br /&gt;
==='''Setting up Servo'''===&lt;br /&gt;
There are two main steps to set up the environment for this project. Linux environment is preferred for setting up the environment as it is simple and easy.&lt;br /&gt;
&lt;br /&gt;
:* [https://github.com/mozilla/rust/wiki/Note-getting-started-developing-Rust Build Rust] &amp;lt;ref&amp;gt; https://github.com/mozilla/rust/wiki/Note-getting-started-developing-Rust &amp;lt;/ref&amp;gt;&lt;br /&gt;
:* [https://github.com/servo/servo Build Servo] &amp;lt;ref&amp;gt; https://github.com/servo/servo &amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Vboddul</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/oss_M1456_kdv&amp;diff=90473</id>
		<title>CSC/ECE 517 Fall 2014/oss M1456 kdv</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/oss_M1456_kdv&amp;diff=90473"/>
		<updated>2014-10-29T13:35:05Z</updated>

		<summary type="html">&lt;p&gt;Vboddul: modified background information&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;='''Implement MIME sniffing - spec'''=&lt;br /&gt;
&lt;br /&gt;
This article is about the open source project M 1456: Implement MIME&amp;lt;ref&amp;gt;https://mimesniff.spec.whatwg.org/&amp;lt;/ref&amp;gt; sniffing - spec &amp;lt;ref&amp;gt;https://github.com/servo/servo/issues/3144&amp;lt;/ref&amp;gt;, which is part of the Servo Parallel Browser Project. Servo is prototype web browser engine which is currently under development and is written in [http://doc.rust-lang.org/guide.html Rust] language. Here you can find a brief Background information about MIME sniffing in servo, rust programming language, the initial step and the first step implemented in the project.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== '''Background Information''' ==&lt;br /&gt;
When we do a HTTP web request which declares the type of its content (using the Content-Type header), it's very easy to decide how to present it - if it's an image, decode it; if it's an HTML page, parse and display it. When no such header is present, Servo currently falters (such as loading an image file or video file from disk, as in [https://github.com/servo/servo/pull/3131 #3131]). In this case, we want to implement the &amp;quot;sniffing&amp;quot; specification, which looks at the starting byte content of the resource and guesses what manner of content is being received. For example, If its an image we can use image rendering and a video rendering can be used for a video file. &lt;br /&gt;
&lt;br /&gt;
==='''What is Servo?'''===&lt;br /&gt;
Servo&amp;lt;ref&amp;gt;https://www.mozilla.org/en-US/research/projects/&amp;lt;/ref&amp;gt; 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;
&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.&lt;br /&gt;
&lt;br /&gt;
Github link to [https://github.com/servo/servo Servo] Project.&lt;br /&gt;
&lt;br /&gt;
==='''Rust Programming Language'''=== &lt;br /&gt;
Rust&amp;lt;ref&amp;gt;https://www.mozilla.org/en-US/research/projects/&amp;lt;/ref&amp;gt; is a new programming language for developing reliable and efficient systems. It's designed to support concurrency and parallelism in building platforms that take full advantage of modern hardware. Its static type system is safe and expressive and it provides strong guarantees about isolation, concurrency execution and memory safety.&lt;br /&gt;
&lt;br /&gt;
Rust combines powerful and flexible modern programming constructs with a clear performance model to make program efficiency predictable and manageable. One important way it achieves this is by allowing fine-grained control over memory allocation through contiguous records and stack allocation. This control is balanced with the absolute requirement of safety: Rust’s type system and runtime guarantee the absence of data races, buffer overflow, stack overflow or access to uninitialized or deallocated memory.&lt;br /&gt;
&lt;br /&gt;
Github link to [https://github.com/rust-lang/rust Rust language].&lt;br /&gt;
&lt;br /&gt;
=='''Implement MIME sniffing'''==&lt;br /&gt;
&lt;br /&gt;
==='''Initial Step'''===&lt;br /&gt;
Build Servo. Learn about tasks in Rust, then spawn a new sniffer [http://doc.rust-lang.org/guide.html#tasks task] in the load method in resource_task.rs, creating a sender and receiver pair as well - the task should read all available data from the new receiver, and send it immediately via the original sender, while the new sender gets handed off to the factory function that is executed. All web pages should continue to load unchanged after rebuilding.&lt;br /&gt;
&lt;br /&gt;
==='''Step 1'''===&lt;br /&gt;
interpose a sniffer in every resource request in the load method in resouce_task.rs - make a new sender/receiver pair, spawn a task that waits for input on the new receiver and passes it on to the old sender, while handing off the new sender to the factory function.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Design Patterns==&lt;br /&gt;
&lt;br /&gt;
We used the [http://en.wikipedia.org/wiki/Command_pattern command design pattern] in our project. As Wikipedia states, command pattern is a design pattern that in which an &amp;quot;object is used to represent and encapsulate all the information needed to call a method at a later time&amp;quot;. &amp;lt;ref name=&amp;quot;commandDesignPatternWiki&amp;quot;&amp;gt;http://en.wikipedia.org/wiki/Command_pattern&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
In our specific case, the object is the Sniffer Task. A new Sniffer Task is created via the &amp;lt;code&amp;gt; new_sniffer_task&amp;lt;/code&amp;gt; function. When the sniffer task is created, it is isolated and it encapsulates all the information needed to sniff the MIME data out of the URI/file. Since it's isolated, the only way to communicate between the Sniffer Task and the main servo process is by using channels and using &amp;lt;code&amp;gt;send&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;receive&amp;lt;/code&amp;gt; functions to pass data around. For example, in the load function in SnifferManager in &amp;lt;code&amp;gt;sniffer_task.rs&amp;lt;/code&amp;gt;, we use &amp;lt;code&amp;gt;send&amp;lt;/code&amp;gt; to send the data back to the next processing pipeline.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
fn load(&amp;amp;self, next_rx: Sender&amp;lt;LoadResponse&amp;gt;, snif_data: LoadResponse) {&lt;br /&gt;
  next_rx.send(snif_data);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are a few benefits that command design pattern provides. Firstly, since the code block is encapsulated, it is independent and can be modified and switched out easily. This makes maintaining the code very easy. Secondly, because the code blocks has all the resources it needs to perform it's task (in our case, sniffing the MIME), we can easily take it and run it in a different process parallel to the main servo process.&lt;br /&gt;
&lt;br /&gt;
==Future Development==&lt;br /&gt;
&lt;br /&gt;
==='''Step 2'''===&lt;br /&gt;
Move from a 1:1 sniffer:request task model to a shared sniffer task - create the sniffing task in ResourceTask::start, store the created sender in a field, and hand off clones of this sender to the factory function. The sniffer task will now also have to be sent the original sender as well, since it is not available at task creation.&lt;br /&gt;
&lt;br /&gt;
==='''Step 3'''===&lt;br /&gt;
When the headers are received, implement the [https://mimesniff.spec.whatwg.org/#handling-a-resource sniffing heuristic algorithm].&lt;br /&gt;
&lt;br /&gt;
==='''Step 4'''===&lt;br /&gt;
Implement the mime type matching algorithm, one category at a time - look for a good way to store the patterns and resulting types to minimize code duplication.&lt;br /&gt;
&lt;br /&gt;
==='''Step 5'''===&lt;br /&gt;
Ensure that the resulting mime type is present in the load that the consumer receives&lt;br /&gt;
&lt;br /&gt;
==='''Step 6'''===&lt;br /&gt;
Write tests that demonstrate working sniffing (for example, loading images with no/wrong extension)&lt;br /&gt;
&lt;br /&gt;
=='''Appendix'''==&lt;br /&gt;
==='''Setting up Servo'''===&lt;br /&gt;
There are two main steps to set up the environment for this project. Linux environment is preferred for setting up the environment as it is simple and easy.&lt;br /&gt;
&lt;br /&gt;
:* [https://github.com/mozilla/rust/wiki/Note-getting-started-developing-Rust Build Rust] &amp;lt;ref&amp;gt; https://github.com/mozilla/rust/wiki/Note-getting-started-developing-Rust &amp;lt;/ref&amp;gt;&lt;br /&gt;
:* [https://github.com/servo/servo Build Servo] &amp;lt;ref&amp;gt; https://github.com/servo/servo &amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Vboddul</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/oss_M1456_kdv&amp;diff=90221</id>
		<title>CSC/ECE 517 Fall 2014/oss M1456 kdv</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/oss_M1456_kdv&amp;diff=90221"/>
		<updated>2014-10-29T01:19:20Z</updated>

		<summary type="html">&lt;p&gt;Vboddul: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;='''Implement MIME sniffing - spec'''=&lt;br /&gt;
&lt;br /&gt;
This article is about the open source project M 1456: Implement MIME&amp;lt;ref&amp;gt;https://mimesniff.spec.whatwg.org/&amp;lt;/ref&amp;gt; sniffing - spec &amp;lt;ref&amp;gt;https://github.com/servo/servo/issues/3144&amp;lt;/ref&amp;gt;, which is part of the Servo Parallel Browser Project. Servo is prototype web browser engine which is currently under development and is written in [http://doc.rust-lang.org/guide.html Rust] language. Here you can find a brief Background information about MIME sniffing in servo, rust programming language, the initial step and the first step implemented in the project.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== '''Background Information''' ==&lt;br /&gt;
When an HTTP resource declares the type of its content (using the Content-Type header), it's very easy to decide how to present it - if it's an image, decode it; if it's an HTML page, parse and display it. When no such header is present, Servo currently falters (such as loading an image file from disk, as in [https://github.com/servo/servo/pull/3131 #3131]). We want to implement the &amp;quot;sniffing&amp;quot; specification, which looks at the starting byte content of the resource and guesses what manner of content is being received.&lt;br /&gt;
&lt;br /&gt;
==='''What is Servo?'''===&lt;br /&gt;
Servo&amp;lt;ref&amp;gt;https://www.mozilla.org/en-US/research/projects/&amp;lt;/ref&amp;gt; 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;
&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.&lt;br /&gt;
&lt;br /&gt;
Github link to [https://github.com/servo/servo Servo] Project.&lt;br /&gt;
&lt;br /&gt;
==='''Rust Programming Language'''=== &lt;br /&gt;
Rust&amp;lt;ref&amp;gt;https://www.mozilla.org/en-US/research/projects/&amp;lt;/ref&amp;gt; is a new programming language for developing reliable and efficient systems. It's designed to support concurrency and parallelism in building platforms that take full advantage of modern hardware. Its static type system is safe and expressive and it provides strong guarantees about isolation, concurrency execution and memory safety.&lt;br /&gt;
&lt;br /&gt;
Rust combines powerful and flexible modern programming constructs with a clear performance model to make program efficiency predictable and manageable. One important way it achieves this is by allowing fine-grained control over memory allocation through contiguous records and stack allocation. This control is balanced with the absolute requirement of safety: Rust’s type system and runtime guarantee the absence of data races, buffer overflow, stack overflow or access to uninitialized or deallocated memory.&lt;br /&gt;
&lt;br /&gt;
Github link to [https://github.com/rust-lang/rust Rust language].&lt;br /&gt;
&lt;br /&gt;
=='''Implement MIME sniffing'''==&lt;br /&gt;
&lt;br /&gt;
==='''Initial Step'''===&lt;br /&gt;
Build Servo. Learn about tasks in Rust, then spawn a new sniffer [http://doc.rust-lang.org/guide.html#tasks task] in the load method in resource_task.rs, creating a sender and receiver pair as well - the task should read all available data from the new receiver, and send it immediately via the original sender, while the new sender gets handed off to the factory function that is executed. All web pages should continue to load unchanged after rebuilding.&lt;br /&gt;
&lt;br /&gt;
==='''Step 1'''===&lt;br /&gt;
interpose a sniffer in every resource request in the load method in resouce_task.rs - make a new sender/receiver pair, spawn a task that waits for input on the new receiver and passes it on to the old sender, while handing off the new sender to the factory function.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Design Patterns==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Future Development==&lt;br /&gt;
&lt;br /&gt;
==='''Step 2'''===&lt;br /&gt;
Move from a 1:1 sniffer:request task model to a shared sniffer task - create the sniffing task in ResourceTask::start, store the created sender in a field, and hand off clones of this sender to the factory function. The sniffer task will now also have to be sent the original sender as well, since it is not available at task creation.&lt;br /&gt;
&lt;br /&gt;
==='''Step 3'''===&lt;br /&gt;
When the headers are received, implement the [https://mimesniff.spec.whatwg.org/#handling-a-resource sniffing heuristic algorithm].&lt;br /&gt;
&lt;br /&gt;
==='''Step 4'''===&lt;br /&gt;
Implement the mime type matching algorithm, one category at a time - look for a good way to store the patterns and resulting types to minimize code duplication.&lt;br /&gt;
&lt;br /&gt;
==='''Step 5'''===&lt;br /&gt;
Ensure that the resulting mime type is present in the load that the consumer receives&lt;br /&gt;
&lt;br /&gt;
==='''Step 6'''===&lt;br /&gt;
Write tests that demonstrate working sniffing (for example, loading images with no/wrong extension)&lt;br /&gt;
&lt;br /&gt;
=='''Appendix'''==&lt;br /&gt;
==='''Setting up Servo'''===&lt;br /&gt;
There are two main steps to set up the environment for this project. Linux environment is preferred for setting up the environment as it is simple and easy.&lt;br /&gt;
&lt;br /&gt;
:* [https://github.com/mozilla/rust/wiki/Note-getting-started-developing-Rust Build Rust] &amp;lt;ref&amp;gt; https://github.com/mozilla/rust/wiki/Note-getting-started-developing-Rust &amp;lt;/ref&amp;gt;&lt;br /&gt;
:* [https://github.com/servo/servo Build Servo] &amp;lt;ref&amp;gt; https://github.com/servo/servo &amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Vboddul</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/oss_M1456_kdv&amp;diff=90216</id>
		<title>CSC/ECE 517 Fall 2014/oss M1456 kdv</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/oss_M1456_kdv&amp;diff=90216"/>
		<updated>2014-10-29T01:12:44Z</updated>

		<summary type="html">&lt;p&gt;Vboddul: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;='''Implement MIME sniffing - spec'''=&lt;br /&gt;
&lt;br /&gt;
This article is about the open source project M 1456: Implement MIME&amp;lt;ref&amp;gt;https://mimesniff.spec.whatwg.org/&amp;lt;/ref&amp;gt; sniffing - spec &amp;lt;ref&amp;gt;https://github.com/servo/servo/issues/3144&amp;lt;/ref&amp;gt;, which is part of the Servo Parallel Browser Project. Servo is prototype web browser engine which is currently under development and is written in [http://doc.rust-lang.org/guide.html Rust] language. Here you can find a brief Background information about MIME sniffing in servo, rust programming language, the initial step and the first step implemented in the project.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== '''Background Information''' ==&lt;br /&gt;
When an HTTP resource declares the type of its content (using the Content-Type header), it's very easy to decide how to present it - if it's an image, decode it; if it's an HTML page, parse and display it. When no such header is present, Servo currently falters (such as loading an image file from disk, as in [https://github.com/servo/servo/pull/3131 #3131]). We want to implement the &amp;quot;sniffing&amp;quot; specification, which looks at the starting byte content of the resource and guesses what manner of content is being received.&lt;br /&gt;
&lt;br /&gt;
==='''What is Servo?'''===&lt;br /&gt;
Servo&amp;lt;ref&amp;gt;https://www.mozilla.org/en-US/research/projects/&amp;lt;/ref&amp;gt; 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;
&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.&lt;br /&gt;
&lt;br /&gt;
Github link to [https://github.com/servo/servo Servo] Project.&lt;br /&gt;
&lt;br /&gt;
==='''Rust Programming Language'''=== &lt;br /&gt;
Rust&amp;lt;ref&amp;gt;https://www.mozilla.org/en-US/research/projects/&amp;lt;/ref&amp;gt; is a new programming language for developing reliable and efficient systems. It's designed to support concurrency and parallelism in building platforms that take full advantage of modern hardware. Its static type system is safe and expressive and it provides strong guarantees about isolation, concurrency execution and memory safety.&lt;br /&gt;
&lt;br /&gt;
Rust combines powerful and flexible modern programming constructs with a clear performance model to make program efficiency predictable and manageable. One important way it achieves this is by allowing fine-grained control over memory allocation through contiguous records and stack allocation. This control is balanced with the absolute requirement of safety: Rust’s type system and runtime guarantee the absence of data races, buffer overflow, stack overflow or access to uninitialized or deallocated memory.&lt;br /&gt;
&lt;br /&gt;
Github link to [https://github.com/rust-lang/rust Rust language].&lt;br /&gt;
&lt;br /&gt;
=='''Implement MIME sniffing'''==&lt;br /&gt;
&lt;br /&gt;
==='''Initial Step'''===&lt;br /&gt;
Build Servo. Learn about tasks in Rust, then spawn a new sniffer [http://doc.rust-lang.org/guide.html#tasks task] in the load method in resource_task.rs, creating a sender and receiver pair as well - the task should read all available data from the new receiver, and send it immediately via the original sender, while the new sender gets handed off to the factory function that is executed. All web pages should continue to load unchanged after rebuilding.&lt;br /&gt;
&lt;br /&gt;
==='''Step 1'''===&lt;br /&gt;
interpose a sniffer in every resource request in the load method in resouce_task.rs - make a new sender/receiver pair, spawn a task that waits for input on the new receiver and passes it on to the old sender, while handing off the new sender to the factory function.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Future Development==&lt;br /&gt;
&lt;br /&gt;
==='''Step 2'''===&lt;br /&gt;
Move from a 1:1 sniffer:request task model to a shared sniffer task - create the sniffing task in ResourceTask::start, store the created sender in a field, and hand off clones of this sender to the factory function. The sniffer task will now also have to be sent the original sender as well, since it is not available at task creation.&lt;br /&gt;
&lt;br /&gt;
==='''Step 3'''===&lt;br /&gt;
When the headers are received, implement the [https://mimesniff.spec.whatwg.org/#handling-a-resource sniffing heuristic algorithm].&lt;br /&gt;
&lt;br /&gt;
==='''Step 4'''===&lt;br /&gt;
Implement the mime type matching algorithm, one category at a time - look for a good way to store the patterns and resulting types to minimize code duplication.&lt;br /&gt;
&lt;br /&gt;
==='''Step 5'''===&lt;br /&gt;
Ensure that the resulting mime type is present in the load that the consumer receives&lt;br /&gt;
&lt;br /&gt;
==='''Step 6'''===&lt;br /&gt;
Write tests that demonstrate working sniffing (for example, loading images with no/wrong extension)&lt;br /&gt;
&lt;br /&gt;
=='''Appendix'''==&lt;br /&gt;
==='''Setting up Servo'''===&lt;br /&gt;
There are two main steps to set up the environment for this project. Linux environment is preferred for setting up the environment as it is simple and easy.&lt;br /&gt;
&lt;br /&gt;
:* [https://github.com/mozilla/rust/wiki/Note-getting-started-developing-Rust Build Rust] &amp;lt;ref&amp;gt; https://github.com/mozilla/rust/wiki/Note-getting-started-developing-Rust &amp;lt;/ref&amp;gt;&lt;br /&gt;
:* [https://github.com/servo/servo Build Servo] &amp;lt;ref&amp;gt; https://github.com/servo/servo &amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Vboddul</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/oss_M1456_kdv&amp;diff=90210</id>
		<title>CSC/ECE 517 Fall 2014/oss M1456 kdv</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/oss_M1456_kdv&amp;diff=90210"/>
		<updated>2014-10-29T01:04:41Z</updated>

		<summary type="html">&lt;p&gt;Vboddul: /* Implement MIME sniffing - spec */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;='''Implement MIME sniffing - spec'''=&lt;br /&gt;
&lt;br /&gt;
This article is about the open source project M 1456: Implement MIME&amp;lt;ref&amp;gt;https://mimesniff.spec.whatwg.org/&amp;lt;/ref&amp;gt; sniffing - spec &amp;lt;ref&amp;gt;https://github.com/servo/servo/issues/3144&amp;lt;/ref&amp;gt;, which is part of the Servo Parallel Browser Project. Servo is prototype web browser engine which is currently under development and is written in [http://doc.rust-lang.org/guide.html Rust] language. Here you can find a brief Background information about MIME sniffing in servo, rust programming language, the initial step and the first step implemented in the project.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== '''Background Information''' ==&lt;br /&gt;
When an HTTP resource declares the type of its content (using the Content-Type header), it's very easy to decide how to present it - if it's an image, decode it; if it's an HTML page, parse and display it. When no such header is present, Servo currently falters (such as loading an image file from disk, as in [https://github.com/servo/servo/pull/3131 #3131]). We want to implement the &amp;quot;sniffing&amp;quot; specification, which looks at the starting byte content of the resource and guesses what manner of content is being received.&lt;br /&gt;
&lt;br /&gt;
==='''What is Servo?'''===&lt;br /&gt;
Servo&amp;lt;ref&amp;gt;https://www.mozilla.org/en-US/research/projects/&amp;lt;/ref&amp;gt; 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;
&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.&lt;br /&gt;
&lt;br /&gt;
Github link to [https://github.com/servo/servo Servo] Project.&lt;br /&gt;
&lt;br /&gt;
==='''Rust Programming Language'''=== &lt;br /&gt;
Rust&amp;lt;ref&amp;gt;https://www.mozilla.org/en-US/research/projects/&amp;lt;/ref&amp;gt; is a new programming language for developing reliable and efficient systems. It's designed to support concurrency and parallelism in building platforms that take full advantage of modern hardware. Its static type system is safe and expressive and it provides strong guarantees about isolation, concurrency execution and memory safety.&lt;br /&gt;
&lt;br /&gt;
Rust combines powerful and flexible modern programming constructs with a clear performance model to make program efficiency predictable and manageable. One important way it achieves this is by allowing fine-grained control over memory allocation through contiguous records and stack allocation. This control is balanced with the absolute requirement of safety: Rust’s type system and runtime guarantee the absence of data races, buffer overflow, stack overflow or access to uninitialized or deallocated memory.&lt;br /&gt;
&lt;br /&gt;
Github link to [https://github.com/rust-lang/rust Rust language].&lt;br /&gt;
&lt;br /&gt;
=='''Implement MIME sniffing'''==&lt;br /&gt;
&lt;br /&gt;
==='''Initial Step'''===&lt;br /&gt;
Build Servo. Learn about tasks in Rust, then spawn a new sniffer [http://doc.rust-lang.org/guide.html#tasks task] in the load method in resource_task.rs, creating a sender and receiver pair as well - the task should read all available data from the new receiver, and send it immediately via the original sender, while the new sender gets handed off to the factory function that is executed. All web pages should continue to load unchanged after rebuilding.&lt;br /&gt;
&lt;br /&gt;
==='''Step 1'''===&lt;br /&gt;
interpose a sniffer in every resource request in the load method in resouce_task.rs - make a new sender/receiver pair, spawn a task that waits for input on the new receiver and passes it on to the old sender, while handing off the new sender to the factory function.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Appendix'''==&lt;br /&gt;
==='''Setting up Servo'''===&lt;br /&gt;
There are two main steps to set up the environment for this project. Linux environment is preferred for setting up the environment as it is simple and easy.&lt;br /&gt;
&lt;br /&gt;
:* [https://github.com/mozilla/rust/wiki/Note-getting-started-developing-Rust Build Rust] &amp;lt;ref&amp;gt; https://github.com/mozilla/rust/wiki/Note-getting-started-developing-Rust &amp;lt;/ref&amp;gt;&lt;br /&gt;
:* [https://github.com/servo/servo Build Servo] &amp;lt;ref&amp;gt; https://github.com/servo/servo &amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Vboddul</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/oss_M1456_kdv&amp;diff=90201</id>
		<title>CSC/ECE 517 Fall 2014/oss M1456 kdv</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/oss_M1456_kdv&amp;diff=90201"/>
		<updated>2014-10-29T00:57:07Z</updated>

		<summary type="html">&lt;p&gt;Vboddul: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;='''Implement MIME sniffing - spec'''=&lt;br /&gt;
&lt;br /&gt;
This article is about the open source project M 1456: Implement MIME&amp;lt;ref&amp;gt;https://mimesniff.spec.whatwg.org/&amp;lt;/ref&amp;gt; sniffing - spec &amp;lt;ref&amp;gt;https://github.com/servo/servo/issues/3144&amp;lt;/ref&amp;gt;, which is part of the Servo Parallel Browser Project. Servo is prototype web browser engine which is currently under development and is written in [http://doc.rust-lang.org/guide.html Rust] language. Here you can find a brief Background information about MIME sniffing in servo, rust programming language, the initial step and the first step implemented in the project.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== '''Background Information''' ==&lt;br /&gt;
When an HTTP resource declares the type of its content (using the Content-Type header), it's very easy to decide how to present it - if it's an image, decode it; if it's an HTML page, parse and display it. When no such header is present, Servo currently falters (such as loading an image file from disk, as in [https://github.com/servo/servo/pull/3131 #3131]). We want to implement the &amp;quot;sniffing&amp;quot; specification, which looks at the starting byte content of the resource and guesses what manner of content is being received.&lt;br /&gt;
&lt;br /&gt;
==='''What is Servo?'''===&lt;br /&gt;
&lt;br /&gt;
==='''Rust'''=== &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Implement MIME sniffing'''==&lt;br /&gt;
&lt;br /&gt;
==='''Initial Step'''===&lt;br /&gt;
Build Servo. Learn about tasks in Rust, then spawn a new sniffer [http://doc.rust-lang.org/guide.html#tasks task] in the load method in resource_task.rs, creating a sender and receiver pair as well - the task should read all available data from the new receiver, and send it immediately via the original sender, while the new sender gets handed off to the factory function that is executed. All web pages should continue to load unchanged after rebuilding.&lt;br /&gt;
&lt;br /&gt;
==='''Step 1'''===&lt;br /&gt;
interpose a sniffer in every resource request in the load method in resouce_task.rs - make a new sender/receiver pair, spawn a task that waits for input on the new receiver and passes it on to the old sender, while handing off the new sender to the factory function.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Appendix'''==&lt;br /&gt;
==='''Setting up Servo'''===&lt;br /&gt;
There are two main steps to set up the environment for this project. Linux environment is preferred for setting up the environment as it is simple and easy.&lt;br /&gt;
&lt;br /&gt;
:* [https://github.com/mozilla/rust/wiki/Note-getting-started-developing-Rust Build Rust] &amp;lt;ref&amp;gt; https://github.com/mozilla/rust/wiki/Note-getting-started-developing-Rust &amp;lt;/ref&amp;gt;&lt;br /&gt;
:* [https://github.com/servo/servo Build Servo] &amp;lt;ref&amp;gt; https://github.com/servo/servo &amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Vboddul</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/oss_M1456_kdv&amp;diff=90200</id>
		<title>CSC/ECE 517 Fall 2014/oss M1456 kdv</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/oss_M1456_kdv&amp;diff=90200"/>
		<updated>2014-10-29T00:54:47Z</updated>

		<summary type="html">&lt;p&gt;Vboddul: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;='''Implement MIME sniffing - spec'''=&lt;br /&gt;
&lt;br /&gt;
This article is about the open source project M 1456: Implement MIME sniffing - spec &amp;lt;ref&amp;gt;https://github.com/servo/servo/issues/3144&amp;lt;/ref&amp;gt;, which is part of the Servo Parallel Browser Project. Servo is prototype web browser engine which is currently under development and is written in [http://doc.rust-lang.org/guide.html Rust] language. Here you can find a brief Background information about MIME sniffing in servo, rust programming language, the initial step and the first step implemented in the project.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== '''Background Information''' ==&lt;br /&gt;
When an HTTP resource declares the type of its content (using the Content-Type header), it's very easy to decide how to present it - if it's an image, decode it; if it's an HTML page, parse and display it. When no such header is present, Servo currently falters (such as loading an image file from disk, as in [https://github.com/servo/servo/pull/3131 #3131]). We want to implement the &amp;quot;sniffing&amp;quot; specification, which looks at the starting byte content of the resource and guesses what manner of content is being received.&lt;br /&gt;
&lt;br /&gt;
==='''What is Servo?'''===&lt;br /&gt;
&lt;br /&gt;
==='''Rust'''=== &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Implement MIME sniffing'''==&lt;br /&gt;
&lt;br /&gt;
==='''Initial Step'''===&lt;br /&gt;
Build Servo. Learn about tasks in Rust, then spawn a new sniffer [http://doc.rust-lang.org/guide.html#tasks task] in the load method in resource_task.rs, creating a sender and receiver pair as well - the task should read all available data from the new receiver, and send it immediately via the original sender, while the new sender gets handed off to the factory function that is executed. All web pages should continue to load unchanged after rebuilding.&lt;br /&gt;
&lt;br /&gt;
==='''Step 1'''===&lt;br /&gt;
interpose a sniffer in every resource request in the load method in resouce_task.rs - make a new sender/receiver pair, spawn a task that waits for input on the new receiver and passes it on to the old sender, while handing off the new sender to the factory function.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Appendix'''==&lt;br /&gt;
==='''Setting up Servo'''===&lt;br /&gt;
There are two main steps to set up the environment for this project. Linux environment is preferred for setting up the environment as it is simple and easy.&lt;br /&gt;
&lt;br /&gt;
:* [https://github.com/mozilla/rust/wiki/Note-getting-started-developing-Rust Build Rust] &amp;lt;ref&amp;gt; https://github.com/mozilla/rust/wiki/Note-getting-started-developing-Rust &amp;lt;/ref&amp;gt;&lt;br /&gt;
:* [https://github.com/servo/servo Build Servo] &amp;lt;ref&amp;gt; https://github.com/servo/servo &amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Vboddul</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/oss_M1456_kdv&amp;diff=90199</id>
		<title>CSC/ECE 517 Fall 2014/oss M1456 kdv</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/oss_M1456_kdv&amp;diff=90199"/>
		<updated>2014-10-29T00:54:05Z</updated>

		<summary type="html">&lt;p&gt;Vboddul: /* Implement MIME sniffing - spec */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;='''Implement MIME sniffing - spec'''=&lt;br /&gt;
&lt;br /&gt;
This article is about the open source project M 1456: Implement MIME sniffing - spec &amp;lt;ref&amp;gt;https://github.com/servo/servo/issues/3144&amp;lt;/ref&amp;gt;, which is part of the Servo Parallel Browser Project. Servo is prototype web browser engine which is currently under development and is written in Rust&amp;lt;ref&amp;gt;http://doc.rust-lang.org/guide.html&amp;lt;/ref&amp;gt; language. Here you can find a brief Background information about MIME sniffing in servo, rust programming language, the initial step and the first step implemented in the project.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== '''Background Information''' ==&lt;br /&gt;
When an HTTP resource declares the type of its content (using the Content-Type header), it's very easy to decide how to present it - if it's an image, decode it; if it's an HTML page, parse and display it. When no such header is present, Servo currently falters (such as loading an image file from disk, as in [https://github.com/servo/servo/pull/3131 #3131]). We want to implement the &amp;quot;sniffing&amp;quot; specification, which looks at the starting byte content of the resource and guesses what manner of content is being received.&lt;br /&gt;
&lt;br /&gt;
==='''What is Servo?'''===&lt;br /&gt;
&lt;br /&gt;
==='''Rust'''=== &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Implement MIME sniffing'''==&lt;br /&gt;
&lt;br /&gt;
==='''Initial Step'''===&lt;br /&gt;
Build Servo. Learn about tasks in Rust, then spawn a new sniffer [http://doc.rust-lang.org/guide.html#tasks task] in the load method in resource_task.rs, creating a sender and receiver pair as well - the task should read all available data from the new receiver, and send it immediately via the original sender, while the new sender gets handed off to the factory function that is executed. All web pages should continue to load unchanged after rebuilding.&lt;br /&gt;
&lt;br /&gt;
==='''Step 1'''===&lt;br /&gt;
interpose a sniffer in every resource request in the load method in resouce_task.rs - make a new sender/receiver pair, spawn a task that waits for input on the new receiver and passes it on to the old sender, while handing off the new sender to the factory function.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Appendix'''==&lt;br /&gt;
==='''Setting up Servo'''===&lt;br /&gt;
There are two main steps to set up the environment for this project. Linux environment is preferred for setting up the environment as it is simple and easy.&lt;br /&gt;
&lt;br /&gt;
:* [https://github.com/mozilla/rust/wiki/Note-getting-started-developing-Rust Build Rust] &amp;lt;ref&amp;gt; https://github.com/mozilla/rust/wiki/Note-getting-started-developing-Rust &amp;lt;/ref&amp;gt;&lt;br /&gt;
:* [https://github.com/servo/servo Build Servo] &amp;lt;ref&amp;gt; https://github.com/servo/servo &amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Vboddul</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/oss_M1456_kdv&amp;diff=90021</id>
		<title>CSC/ECE 517 Fall 2014/oss M1456 kdv</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/oss_M1456_kdv&amp;diff=90021"/>
		<updated>2014-10-27T22:39:22Z</updated>

		<summary type="html">&lt;p&gt;Vboddul: /* Setting up Servo */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;='''Implement MIME sniffing - spec'''=&lt;br /&gt;
&lt;br /&gt;
This article is about the open source project M 1456: Implement MIME sniffing - spec &amp;lt;ref&amp;gt;https://github.com/servo/servo/issues/3144&amp;lt;/ref&amp;gt;, which is part of the Servo Parallel Browser Project. Here you can find a brief Background information about MIME sniffing in servo, rust programming language, the initial step and the first step implemented in the project.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== '''Background Information''' ==&lt;br /&gt;
When an HTTP resource declares the type of its content (using the Content-Type header), it's very easy to decide how to present it - if it's an image, decode it; if it's an HTML page, parse and display it. When no such header is present, Servo currently falters (such as loading an image file from disk, as in [https://github.com/servo/servo/pull/3131 #3131]). We want to implement the &amp;quot;sniffing&amp;quot; specification, which looks at the starting byte content of the resource and guesses what manner of content is being received.&lt;br /&gt;
&lt;br /&gt;
==='''What is Servo?'''===&lt;br /&gt;
&lt;br /&gt;
==='''Rust'''=== &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Implement MIME sniffing'''==&lt;br /&gt;
&lt;br /&gt;
==='''Initial Step'''===&lt;br /&gt;
Build Servo. Learn about tasks in Rust, then spawn a new sniffer [http://doc.rust-lang.org/guide.html#tasks task] in the load method in resource_task.rs, creating a sender and receiver pair as well - the task should read all available data from the new receiver, and send it immediately via the original sender, while the new sender gets handed off to the factory function that is executed. All web pages should continue to load unchanged after rebuilding.&lt;br /&gt;
&lt;br /&gt;
==='''Step 1'''===&lt;br /&gt;
interpose a sniffer in every resource request in the load method in resouce_task.rs - make a new sender/receiver pair, spawn a task that waits for input on the new receiver and passes it on to the old sender, while handing off the new sender to the factory function.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Appendix'''==&lt;br /&gt;
==='''Setting up Servo'''===&lt;br /&gt;
There are two main steps to set up the environment for this project. Linux environment is preferred for setting up the environment as it is simple and easy.&lt;br /&gt;
&lt;br /&gt;
:* [https://github.com/mozilla/rust/wiki/Note-getting-started-developing-Rust Build Rust] &amp;lt;ref&amp;gt; https://github.com/mozilla/rust/wiki/Note-getting-started-developing-Rust &amp;lt;/ref&amp;gt;&lt;br /&gt;
:* [https://github.com/servo/servo Build Servo] &amp;lt;ref&amp;gt; https://github.com/servo/servo &amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Vboddul</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/oss_M1456_kdv&amp;diff=90020</id>
		<title>CSC/ECE 517 Fall 2014/oss M1456 kdv</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/oss_M1456_kdv&amp;diff=90020"/>
		<updated>2014-10-27T22:39:01Z</updated>

		<summary type="html">&lt;p&gt;Vboddul: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;='''Implement MIME sniffing - spec'''=&lt;br /&gt;
&lt;br /&gt;
This article is about the open source project M 1456: Implement MIME sniffing - spec &amp;lt;ref&amp;gt;https://github.com/servo/servo/issues/3144&amp;lt;/ref&amp;gt;, which is part of the Servo Parallel Browser Project. Here you can find a brief Background information about MIME sniffing in servo, rust programming language, the initial step and the first step implemented in the project.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== '''Background Information''' ==&lt;br /&gt;
When an HTTP resource declares the type of its content (using the Content-Type header), it's very easy to decide how to present it - if it's an image, decode it; if it's an HTML page, parse and display it. When no such header is present, Servo currently falters (such as loading an image file from disk, as in [https://github.com/servo/servo/pull/3131 #3131]). We want to implement the &amp;quot;sniffing&amp;quot; specification, which looks at the starting byte content of the resource and guesses what manner of content is being received.&lt;br /&gt;
&lt;br /&gt;
==='''What is Servo?'''===&lt;br /&gt;
&lt;br /&gt;
==='''Rust'''=== &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Implement MIME sniffing'''==&lt;br /&gt;
&lt;br /&gt;
==='''Initial Step'''===&lt;br /&gt;
Build Servo. Learn about tasks in Rust, then spawn a new sniffer [http://doc.rust-lang.org/guide.html#tasks task] in the load method in resource_task.rs, creating a sender and receiver pair as well - the task should read all available data from the new receiver, and send it immediately via the original sender, while the new sender gets handed off to the factory function that is executed. All web pages should continue to load unchanged after rebuilding.&lt;br /&gt;
&lt;br /&gt;
==='''Step 1'''===&lt;br /&gt;
interpose a sniffer in every resource request in the load method in resouce_task.rs - make a new sender/receiver pair, spawn a task that waits for input on the new receiver and passes it on to the old sender, while handing off the new sender to the factory function.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Appendix'''==&lt;br /&gt;
===''Setting up Servo''===&lt;br /&gt;
There are two main steps to set up the environment for this project. Linux environment is preferred for setting up the environment as it is simple and easy.&lt;br /&gt;
&lt;br /&gt;
:* [https://github.com/mozilla/rust/wiki/Note-getting-started-developing-Rust Build Rust] &amp;lt;ref&amp;gt; https://github.com/mozilla/rust/wiki/Note-getting-started-developing-Rust &amp;lt;/ref&amp;gt;&lt;br /&gt;
:* [https://github.com/servo/servo Build Servo] &amp;lt;ref&amp;gt; https://github.com/servo/servo &amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Vboddul</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/oss_M1456_kdv&amp;diff=90017</id>
		<title>CSC/ECE 517 Fall 2014/oss M1456 kdv</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/oss_M1456_kdv&amp;diff=90017"/>
		<updated>2014-10-27T22:38:21Z</updated>

		<summary type="html">&lt;p&gt;Vboddul: /* What is Servo? */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;='''Implement MIME sniffing - spec'''=&lt;br /&gt;
&lt;br /&gt;
This article is about the open source project M 1456: Implement MIME sniffing - spec &amp;lt;ref&amp;gt;https://github.com/servo/servo/issues/3144&amp;lt;/ref&amp;gt;, which is part of the Servo Parallel Browser Project. Here you can find a brief Background information about MIME sniffing in servo, rust programming language, the initial step and the first step implemented in the project.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== '''Background Information''' ==&lt;br /&gt;
When an HTTP resource declares the type of its content (using the Content-Type header), it's very easy to decide how to present it - if it's an image, decode it; if it's an HTML page, parse and display it. When no such header is present, Servo currently falters (such as loading an image file from disk, as in [https://github.com/servo/servo/pull/3131 #3131]). We want to implement the &amp;quot;sniffing&amp;quot; specification, which looks at the starting byte content of the resource and guesses what manner of content is being received.&lt;br /&gt;
&lt;br /&gt;
===''What is Servo?''===&lt;br /&gt;
&lt;br /&gt;
===''Rust''=== &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Implement MIME sniffing'''==&lt;br /&gt;
&lt;br /&gt;
==='''Initial Step'''===&lt;br /&gt;
Build Servo. Learn about tasks in Rust, then spawn a new sniffer [http://doc.rust-lang.org/guide.html#tasks task] in the load method in resource_task.rs, creating a sender and receiver pair as well - the task should read all available data from the new receiver, and send it immediately via the original sender, while the new sender gets handed off to the factory function that is executed. All web pages should continue to load unchanged after rebuilding.&lt;br /&gt;
&lt;br /&gt;
==='''Step 1'''===&lt;br /&gt;
interpose a sniffer in every resource request in the load method in resouce_task.rs - make a new sender/receiver pair, spawn a task that waits for input on the new receiver and passes it on to the old sender, while handing off the new sender to the factory function.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Appendix'''==&lt;br /&gt;
===''Setting up Servo''===&lt;br /&gt;
There are two main steps to set up the environment for this project. Linux environment is preferred for setting up the environment as it is simple and easy.&lt;br /&gt;
&lt;br /&gt;
:* [https://github.com/mozilla/rust/wiki/Note-getting-started-developing-Rust Build Rust] &amp;lt;ref&amp;gt; https://github.com/mozilla/rust/wiki/Note-getting-started-developing-Rust &amp;lt;/ref&amp;gt;&lt;br /&gt;
:* [https://github.com/servo/servo Build Servo] &amp;lt;ref&amp;gt; https://github.com/servo/servo &amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Vboddul</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/oss_M1456_kdv&amp;diff=90016</id>
		<title>CSC/ECE 517 Fall 2014/oss M1456 kdv</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/oss_M1456_kdv&amp;diff=90016"/>
		<updated>2014-10-27T22:37:56Z</updated>

		<summary type="html">&lt;p&gt;Vboddul: /* Implement MIME sniffing - spec */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;='''Implement MIME sniffing - spec'''=&lt;br /&gt;
&lt;br /&gt;
This article is about the open source project M 1456: Implement MIME sniffing - spec &amp;lt;ref&amp;gt;https://github.com/servo/servo/issues/3144&amp;lt;/ref&amp;gt;, which is part of the Servo Parallel Browser Project. Here you can find a brief Background information about MIME sniffing in servo, rust programming language, the initial step and the first step implemented in the project.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== '''Background Information''' ==&lt;br /&gt;
When an HTTP resource declares the type of its content (using the Content-Type header), it's very easy to decide how to present it - if it's an image, decode it; if it's an HTML page, parse and display it. When no such header is present, Servo currently falters (such as loading an image file from disk, as in [https://github.com/servo/servo/pull/3131 #3131]). We want to implement the &amp;quot;sniffing&amp;quot; specification, which looks at the starting byte content of the resource and guesses what manner of content is being received.&lt;br /&gt;
&lt;br /&gt;
===''What is Servo?''=== &lt;br /&gt;
&lt;br /&gt;
===''Rust''=== &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Implement MIME sniffing'''==&lt;br /&gt;
&lt;br /&gt;
==='''Initial Step'''===&lt;br /&gt;
Build Servo. Learn about tasks in Rust, then spawn a new sniffer [http://doc.rust-lang.org/guide.html#tasks task] in the load method in resource_task.rs, creating a sender and receiver pair as well - the task should read all available data from the new receiver, and send it immediately via the original sender, while the new sender gets handed off to the factory function that is executed. All web pages should continue to load unchanged after rebuilding.&lt;br /&gt;
&lt;br /&gt;
==='''Step 1'''===&lt;br /&gt;
interpose a sniffer in every resource request in the load method in resouce_task.rs - make a new sender/receiver pair, spawn a task that waits for input on the new receiver and passes it on to the old sender, while handing off the new sender to the factory function.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Appendix'''==&lt;br /&gt;
===''Setting up Servo''===&lt;br /&gt;
There are two main steps to set up the environment for this project. Linux environment is preferred for setting up the environment as it is simple and easy.&lt;br /&gt;
&lt;br /&gt;
:* [https://github.com/mozilla/rust/wiki/Note-getting-started-developing-Rust Build Rust] &amp;lt;ref&amp;gt; https://github.com/mozilla/rust/wiki/Note-getting-started-developing-Rust &amp;lt;/ref&amp;gt;&lt;br /&gt;
:* [https://github.com/servo/servo Build Servo] &amp;lt;ref&amp;gt; https://github.com/servo/servo &amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Vboddul</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/oss_M1456_kdv&amp;diff=90013</id>
		<title>CSC/ECE 517 Fall 2014/oss M1456 kdv</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/oss_M1456_kdv&amp;diff=90013"/>
		<updated>2014-10-27T22:36:56Z</updated>

		<summary type="html">&lt;p&gt;Vboddul: /* Implement MIME sniffing - spec */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;='''Implement MIME sniffing - spec'''=&lt;br /&gt;
&lt;br /&gt;
This article is about the open source project M 1456: Implement MIME sniffing - spec &amp;lt;ref&amp;gt;https://github.com/servo/servo/issues/3144&amp;lt;/ref&amp;gt;, which is part of the Servo Parallel Browser Project. Here you can find a brief Background information about MIME sniffing in servo project, rust programming language, the initial step and the first step implemented in this particular project.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== '''Background Information''' ==&lt;br /&gt;
When an HTTP resource declares the type of its content (using the Content-Type header), it's very easy to decide how to present it - if it's an image, decode it; if it's an HTML page, parse and display it. When no such header is present, Servo currently falters (such as loading an image file from disk, as in [https://github.com/servo/servo/pull/3131 #3131]). We want to implement the &amp;quot;sniffing&amp;quot; specification, which looks at the starting byte content of the resource and guesses what manner of content is being received.&lt;br /&gt;
&lt;br /&gt;
===''What is Servo?''=== &lt;br /&gt;
&lt;br /&gt;
===''Rust''=== &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Implement MIME sniffing'''==&lt;br /&gt;
&lt;br /&gt;
==='''Initial Step'''===&lt;br /&gt;
Build Servo. Learn about tasks in Rust, then spawn a new sniffer [http://doc.rust-lang.org/guide.html#tasks task] in the load method in resource_task.rs, creating a sender and receiver pair as well - the task should read all available data from the new receiver, and send it immediately via the original sender, while the new sender gets handed off to the factory function that is executed. All web pages should continue to load unchanged after rebuilding.&lt;br /&gt;
&lt;br /&gt;
==='''Step 1'''===&lt;br /&gt;
interpose a sniffer in every resource request in the load method in resouce_task.rs - make a new sender/receiver pair, spawn a task that waits for input on the new receiver and passes it on to the old sender, while handing off the new sender to the factory function.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Appendix'''==&lt;br /&gt;
===''Setting up Servo''===&lt;br /&gt;
There are two main steps to set up the environment for this project. Linux environment is preferred for setting up the environment as it is simple and easy.&lt;br /&gt;
&lt;br /&gt;
:* [https://github.com/mozilla/rust/wiki/Note-getting-started-developing-Rust Build Rust] &amp;lt;ref&amp;gt; https://github.com/mozilla/rust/wiki/Note-getting-started-developing-Rust &amp;lt;/ref&amp;gt;&lt;br /&gt;
:* [https://github.com/servo/servo Build Servo] &amp;lt;ref&amp;gt; https://github.com/servo/servo &amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Vboddul</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/oss_M1456_kdv&amp;diff=90012</id>
		<title>CSC/ECE 517 Fall 2014/oss M1456 kdv</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/oss_M1456_kdv&amp;diff=90012"/>
		<updated>2014-10-27T22:35:06Z</updated>

		<summary type="html">&lt;p&gt;Vboddul: /* Implement MIME sniffing - spec */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;='''Implement MIME sniffing - spec'''=&lt;br /&gt;
&lt;br /&gt;
This article is about the open source project M 1456: Implement MIME sniffing - spec &amp;lt;ref&amp;gt;https://github.com/servo/servo/issues/3144&amp;lt;/ref&amp;gt;, which is a part of the ongoing development of the Servo Parallel Browser Project. Here you can find a brief Background information about MIME sniffing in servo project, rust programming language, the initial step and the first step implemented in this particular project.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== '''Background Information''' ==&lt;br /&gt;
When an HTTP resource declares the type of its content (using the Content-Type header), it's very easy to decide how to present it - if it's an image, decode it; if it's an HTML page, parse and display it. When no such header is present, Servo currently falters (such as loading an image file from disk, as in [https://github.com/servo/servo/pull/3131 #3131]). We want to implement the &amp;quot;sniffing&amp;quot; specification, which looks at the starting byte content of the resource and guesses what manner of content is being received.&lt;br /&gt;
&lt;br /&gt;
===''What is Servo?''=== &lt;br /&gt;
&lt;br /&gt;
===''Rust''=== &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Implement MIME sniffing'''==&lt;br /&gt;
&lt;br /&gt;
==='''Initial Step'''===&lt;br /&gt;
Build Servo. Learn about tasks in Rust, then spawn a new sniffer [http://doc.rust-lang.org/guide.html#tasks task] in the load method in resource_task.rs, creating a sender and receiver pair as well - the task should read all available data from the new receiver, and send it immediately via the original sender, while the new sender gets handed off to the factory function that is executed. All web pages should continue to load unchanged after rebuilding.&lt;br /&gt;
&lt;br /&gt;
==='''Step 1'''===&lt;br /&gt;
interpose a sniffer in every resource request in the load method in resouce_task.rs - make a new sender/receiver pair, spawn a task that waits for input on the new receiver and passes it on to the old sender, while handing off the new sender to the factory function.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Appendix'''==&lt;br /&gt;
===''Setting up Servo''===&lt;br /&gt;
There are two main steps to set up the environment for this project. Linux environment is preferred for setting up the environment as it is simple and easy.&lt;br /&gt;
&lt;br /&gt;
:* [https://github.com/mozilla/rust/wiki/Note-getting-started-developing-Rust Build Rust] &amp;lt;ref&amp;gt; https://github.com/mozilla/rust/wiki/Note-getting-started-developing-Rust &amp;lt;/ref&amp;gt;&lt;br /&gt;
:* [https://github.com/servo/servo Build Servo] &amp;lt;ref&amp;gt; https://github.com/servo/servo &amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Vboddul</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/oss_M1456_kdv&amp;diff=90001</id>
		<title>CSC/ECE 517 Fall 2014/oss M1456 kdv</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/oss_M1456_kdv&amp;diff=90001"/>
		<updated>2014-10-27T22:08:39Z</updated>

		<summary type="html">&lt;p&gt;Vboddul: /* Implement MIME sniffing - spec */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;='''Implement MIME sniffing - spec'''=&lt;br /&gt;
&lt;br /&gt;
This article is about the project [https://github.com/servo/servo/issues/3144 M 1456: Implement MIME sniffing - spec], which is a part of the ongoing development on the Servo browser. Here you can find a brief description about the servo project, rust programming language, requirements of this particular project, setting up of the development environment and other relevant details.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== '''Introduction''' ==&lt;br /&gt;
==='' What is Servo?''=== &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Implement MIME sniffing'''==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Appendix'''==&lt;br /&gt;
===''Setting up Servo''===&lt;br /&gt;
There are two main steps to set up the environment for this project. Linux environment is preferred for setting up the environment as it is simple and easy.&lt;br /&gt;
&lt;br /&gt;
:* [https://github.com/mozilla/rust/wiki/Note-getting-started-developing-Rust Build Rust] &amp;lt;ref&amp;gt; https://github.com/mozilla/rust/wiki/Note-getting-started-developing-Rust &amp;lt;/ref&amp;gt;&lt;br /&gt;
:* [https://github.com/servo/servo Build Servo] &amp;lt;ref&amp;gt; https://github.com/servo/servo &amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Vboddul</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/oss_M1456_kdv&amp;diff=89999</id>
		<title>CSC/ECE 517 Fall 2014/oss M1456 kdv</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/oss_M1456_kdv&amp;diff=89999"/>
		<updated>2014-10-27T22:07:11Z</updated>

		<summary type="html">&lt;p&gt;Vboddul: /* Implement MIME sniffing - spec */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;='''Implement MIME sniffing - spec'''=&lt;br /&gt;
&lt;br /&gt;
This article is about the project M 1456: Implement MIME sniffing - spec&amp;lt;ref&amp;gt; https://github.com/servo/servo/issues/3144 &amp;lt;/ref&amp;gt;, which is a part of the ongoing development on the Servo browser. Here you can find a brief description about the servo project, rust programming language, requirements of this particular project, setting up of the development environment and other relevant details.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== '''Introduction''' ==&lt;br /&gt;
==='' What is Servo?''=== &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Implement MIME sniffing'''==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Appendix'''==&lt;br /&gt;
===''Setting up Servo''===&lt;br /&gt;
There are two main steps to set up the environment for this project. Linux environment is preferred for setting up the environment as it is simple and easy.&lt;br /&gt;
&lt;br /&gt;
:* [https://github.com/mozilla/rust/wiki/Note-getting-started-developing-Rust Build Rust] &amp;lt;ref&amp;gt; https://github.com/mozilla/rust/wiki/Note-getting-started-developing-Rust &amp;lt;/ref&amp;gt;&lt;br /&gt;
:* [https://github.com/servo/servo Build Servo] &amp;lt;ref&amp;gt; https://github.com/servo/servo &amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Vboddul</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/oss_M1456_kdv&amp;diff=89650</id>
		<title>CSC/ECE 517 Fall 2014/oss M1456 kdv</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/oss_M1456_kdv&amp;diff=89650"/>
		<updated>2014-10-26T14:26:00Z</updated>

		<summary type="html">&lt;p&gt;Vboddul: /* Setting up Servo */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;='''Implement MIME sniffing - spec'''=&lt;br /&gt;
&lt;br /&gt;
This article is about the project M 1456: Implement MIME sniffing - spec, which is a part of the ongoing development on the Servo browser. Here you can find a brief description about the servo project, rust programming language, requirements of this particular project, setting up of the development environment and other relevant details.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== '''Introduction''' ==&lt;br /&gt;
==='' What is Servo?''=== &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Implement MIME sniffing'''==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Appendix'''==&lt;br /&gt;
===''Setting up Servo''===&lt;br /&gt;
There are two main steps to set up the environment for this project. Linux environment is preferred for setting up the environment as it is simple and easy.&lt;br /&gt;
&lt;br /&gt;
:* [https://github.com/mozilla/rust/wiki/Note-getting-started-developing-Rust Build Rust] &amp;lt;ref&amp;gt; https://github.com/mozilla/rust/wiki/Note-getting-started-developing-Rust &amp;lt;/ref&amp;gt;&lt;br /&gt;
:* [https://github.com/servo/servo Build Servo] &amp;lt;ref&amp;gt; https://github.com/servo/servo &amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Vboddul</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/oss_M1456_kdv&amp;diff=89649</id>
		<title>CSC/ECE 517 Fall 2014/oss M1456 kdv</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/oss_M1456_kdv&amp;diff=89649"/>
		<updated>2014-10-26T14:24:33Z</updated>

		<summary type="html">&lt;p&gt;Vboddul: Created Wiki page and added page structure&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;='''Implement MIME sniffing - spec'''=&lt;br /&gt;
&lt;br /&gt;
This article is about the project M 1456: Implement MIME sniffing - spec, which is a part of the ongoing development on the Servo browser. Here you can find a brief description about the servo project, rust programming language, requirements of this particular project, setting up of the development environment and other relevant details.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== '''Introduction''' ==&lt;br /&gt;
==='' What is Servo?''=== &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Implement MIME sniffing'''==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Appendix'''==&lt;br /&gt;
===''Setting up Servo''===&lt;br /&gt;
There are two main steps to set up the environment for this project. Linux environment is preferred for setting up the environment as it is simple and easy.&lt;br /&gt;
&lt;br /&gt;
:* [https://github.com/mozilla/rust/wiki/Note-getting-started-developing-Rust Build Rust] &amp;lt;ref&amp;gt; https://github.com/mozilla/rust/wiki/Note-getting-started-developing-Rust &amp;lt;/ref&amp;gt;&lt;br /&gt;
:* [https://github.com/mozilla/servo Build Servo] &amp;lt;ref&amp;gt; https://github.com/mozilla/servo &amp;lt;/ref&amp;gt;&lt;br /&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>Vboddul</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014&amp;diff=89648</id>
		<title>CSC/ECE 517 Fall 2014</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014&amp;diff=89648"/>
		<updated>2014-10-26T14:18:32Z</updated>

		<summary type="html">&lt;p&gt;Vboddul: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;*[[CSC/ECE_517_Fall_2014/sample_page]]&lt;br /&gt;
*[[CSC/ECE_517_Fall_2014/ch1a 22 as]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2014/ch1a 19 mx]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2014/ch1a 3 zq]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2014/ch1a 4 lf]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2014/ch1a 4 wl]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2014/ch1a a7 ch]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2014/ch1a 25 rs]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2014/ch1a 25 jf]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2014/ch1a 8 os]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2014/ch1a 8 sn]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2014/ch1a 15 gs]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2014/ch1a 10 hu]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2014/ch1a 20 kv]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2014/ch1a 21 as]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2014/ch1a 24 sa]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2014/ch1a 26 sn]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2014/ch1a 6 rl]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2014/ch1a 2 ss]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2014/ch1a 16 av]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2014/ch1a 1 rm]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2014/ch1a 1 sj]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2014/ch1a 23 ss]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2014/ch1a 20 rn]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2014/ch1a 22 sp]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2014/ch1a 26 gn]]&lt;br /&gt;
&lt;br /&gt;
*[[CSC/ECE 517 Fall 2014/ch1a 13 va]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2014/ch1a 9 aa]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2014/ch1a 9 kn]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2014/ch1a 11 ap]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2014/ch1a 25 ks]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2014/ch1a 7 kz]]&lt;br /&gt;
*[[CSC/ECE_517_Fall_2014/ch1a_6_bn]]&lt;br /&gt;
*[[CSC/ECE_517_Fall_2014/ch1a 10 zz]]&lt;br /&gt;
*[[CSC/ECE_517_Fall_2014/ch1a 16 va]]&lt;br /&gt;
*[[CSC/ECE_517_Fall_2014/ch1a F1415 rv]]&lt;br /&gt;
*[[CSC/ECE_517_Fall_2014/ch1a_3_cp]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2014/ch1b 26 sa]]&lt;br /&gt;
*[[CSC/ECE_517_Fall_2014/ch1b_28_cg]]&lt;br /&gt;
*[[CSC/ECE_517_Fall_2014/ch1b 29 ry]]&lt;br /&gt;
*[[CSC/ECE_517_Fall_2014/ch1b 30 cs]]&lt;br /&gt;
*[[CSC/ECE_517_Fall_2014/ch1b_33_jy]]&lt;br /&gt;
*[[CSC/ECE_517_Fall_2014/ch1b_27_js]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2014/oss E1465 oak]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2014/oss_M1456_kdv]]&lt;/div&gt;</summary>
		<author><name>Vboddul</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014&amp;diff=89647</id>
		<title>CSC/ECE 517 Fall 2014</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014&amp;diff=89647"/>
		<updated>2014-10-26T14:17:54Z</updated>

		<summary type="html">&lt;p&gt;Vboddul: Added Wiki Link for OSS - M 1456: Implement MIME sniffing - spec&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;*[[CSC/ECE_517_Fall_2014/sample_page]]&lt;br /&gt;
*[[CSC/ECE_517_Fall_2014/ch1a 22 as]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2014/ch1a 19 mx]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2014/ch1a 3 zq]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2014/ch1a 4 lf]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2014/ch1a 4 wl]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2014/ch1a a7 ch]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2014/ch1a 25 rs]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2014/ch1a 25 jf]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2014/ch1a 8 os]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2014/ch1a 8 sn]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2014/ch1a 15 gs]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2014/ch1a 10 hu]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2014/ch1a 20 kv]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2014/ch1a 21 as]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2014/ch1a 24 sa]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2014/ch1a 26 sn]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2014/ch1a 6 rl]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2014/ch1a 2 ss]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2014/ch1a 16 av]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2014/ch1a 1 rm]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2014/ch1a 1 sj]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2014/ch1a 23 ss]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2014/ch1a 20 rn]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2014/ch1a 22 sp]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2014/ch1a 26 gn]]&lt;br /&gt;
&lt;br /&gt;
*[[CSC/ECE 517 Fall 2014/ch1a 13 va]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2014/ch1a 9 aa]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2014/ch1a 9 kn]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2014/ch1a 11 ap]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2014/ch1a 25 ks]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2014/ch1a 7 kz]]&lt;br /&gt;
*[[CSC/ECE_517_Fall_2014/ch1a_6_bn]]&lt;br /&gt;
*[[CSC/ECE_517_Fall_2014/ch1a 10 zz]]&lt;br /&gt;
*[[CSC/ECE_517_Fall_2014/ch1a 16 va]]&lt;br /&gt;
*[[CSC/ECE_517_Fall_2014/ch1a F1415 rv]]&lt;br /&gt;
*[[CSC/ECE_517_Fall_2014/ch1a_3_cp]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2014/ch1b 26 sa]]&lt;br /&gt;
*[[CSC/ECE_517_Fall_2014/ch1b_28_cg]]&lt;br /&gt;
*[[CSC/ECE_517_Fall_2014/ch1b 29 ry]]&lt;br /&gt;
*[[CSC/ECE_517_Fall_2014/ch1b 30 cs]]&lt;br /&gt;
*[[CSC/ECE_517_Fall_2014/ch1b_33_jy]]&lt;br /&gt;
*[[CSC/ECE_517_Fall_2014/ch1b_27_js]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2014/oss E1465 oak]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2014/oss M1456 kdv]]&lt;/div&gt;</summary>
		<author><name>Vboddul</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/ch1a_13_va&amp;diff=88689</id>
		<title>CSC/ECE 517 Fall 2014/ch1a 13 va</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/ch1a_13_va&amp;diff=88689"/>
		<updated>2014-09-26T03:20:42Z</updated>

		<summary type="html">&lt;p&gt;Vboddul: /* Comparison of Swift with Objective-C */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Playgrounds with Swift in XCode v6.0''' ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;float: right; border:1px solid grey;&amp;quot;&amp;gt;&lt;br /&gt;
[[File:swift-xcode.jpg]]&lt;br /&gt;
[[File:playgrounds.png|center|Fig 1: Playgrounds with Swift in Xcode v6.0 ]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;On June 2, 2014 at the [http://en.wikipedia.org/wiki/Apple_Worldwide_Developers_Conference World Wide Developers Conference], Apple announced version 6 of Xcode. Features include Playgrounds live debugging tools, as well as an entirely new programming language called Swift. A key element of the Swift system is its ability to be cleanly debugged and run within the development environment, using a [http://en.wikipedia.org/wiki/Read–eval–print_loop read–eval–print loop (REPL)]&amp;lt;ref&amp;gt;[http://en.wikipedia.org/wiki/Swift_(programming_language) Swift]&amp;lt;/ref&amp;gt;, giving it interactive properties more in common with scripting systems like Python than traditional systems programming languages. The REPL is further enhanced with the new 'playgrounds' concept; 'playgrounds' are interactive views running within the Xcode environment that respond to code or debugger changes on-the-fly. If the code in question changes over time or with regard to some other ranged input value, the view can be used with the Timeline Assistant to demonstrate the output in an animated fashion.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Apple claims that Swift &amp;quot;is the first industrial-quality systems programming language that is as expressive and enjoyable as a scripting language.&amp;quot;&amp;lt;ref name=&amp;quot;Topic&amp;quot;&amp;gt;[https://docs.google.com/a/ncsu.edu/document/d/1eq3XHiUUBIrEBx-R2Mgolaw7HttSgzPniwDLEF5oVk0/edit# Topic Document]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=Background=&lt;br /&gt;
&lt;br /&gt;
===Xcode===&lt;br /&gt;
Xcode is an [http://en.wikipedia.org/wiki/Integrated_development_environment Integrated Development Environment] (IDE) developed by Apple for developing software for iOS and OS X. The Xcode suite consists of the IDE, Apple’s developer documentation and a built-in interface builder. It is shipped free with Mac OS X 10.3, but is able to develop OS X applications that can run on any version of OS X. It extends and replaces Apple's earlier tool, Project Builder, which was inherited from [http://en.wikipedia.org/wiki/NeXT NeXT]. However, Xcode officially does not work on Mac OS X 10.2.It works hand in hand with Interface Builder (also inherited from NeXT), a graphical tool used to create user interfaces.&lt;br /&gt;
&lt;br /&gt;
Xcode includes GCC, and can compile [http://en.wikipedia.org/wiki/C C], [http://en.wikipedia.org/wiki/C%2B%2B C++], Objective C++, [http://en.wikipedia.org/wiki/java Java], and [http://en.wikipedia.org/wiki/Objective-C Objective C] source code with a variety of programming models, including but not limited to [http://en.wikipedia.org/wiki/Cocoa_(API) Cocoa], Carbon, and Java.&lt;br /&gt;
The latest Xcode version 6 includes Playgrounds which has an interactive sidebar to display the results of the code on-the-fly.&lt;br /&gt;
&lt;br /&gt;
===Swift===&lt;br /&gt;
Swift&amp;lt;ref&amp;gt;[https://developer.apple.com/swift/ Introduction to Swift]&amp;lt;/ref&amp;gt; is a new programming language that adopts safe programming patterns and makes programming flexible. Swift combines the best of both C and Objective-C. It integrates both - the procedural features like types and operators as well as the object-oriented features such as classes and protocols.  It adopts readability and dynamic object model from Objective-C and has added new features like blocks, collection literals and modules, fast performance. Swift has many advantages over Objective-C, like being more type-safe, having more natural and concise syntax, no need for header/implementation files. It has simplified memory management with [http://en.wikipedia.org/wiki/Automatic_Reference_Counting Automatic Reference Counting]. Swift is a fast and powerful programming language that is easier and more fun to implement.&lt;br /&gt;
&lt;br /&gt;
=Playgrounds=&lt;br /&gt;
Playgrounds&amp;lt;ref&amp;gt;[http://www.raywenderlich.com/74438/swift-tutorial-a-quick-start Playgrounds]&amp;lt;/ref&amp;gt; enable the interactive experience of a script language, even though Swift compiles to highly-optimized native code. Type a line of code and the result appears immediately. If the code runs over time, for instance through a loop, its progress can be seen in the Timeline assistant. The Timeline displays variables in a graph, draws each step when composing a view, and can play an animated SpriteKit scene.&lt;br /&gt;
&lt;br /&gt;
===Getting Started with Playgrounds===&lt;br /&gt;
On opening Xcode6, select &amp;quot;Get started with a Playground&amp;quot;. Default is a Hello Playgrounds program.&amp;lt;ref&amp;gt;[https://www.youtube.com/watch?v=A0C6L4XmrZM Introduction to Swift Playground]&amp;lt;/ref&amp;gt;&lt;br /&gt;
[[File: pgstart.png|frame|center]]&lt;br /&gt;
&lt;br /&gt;
Playgrounds with Swift introduce user friendly, clean code. Writing code in poetry-method has become simpler with Swift. Inclusion of packages is not necessary and heavy syntax can be ignored.&lt;br /&gt;
Creation of class is not required while writing code in Swift. Writing &amp;quot;str&amp;quot; in Swift would display the value of &amp;quot;str&amp;quot; on Playground directly.&lt;br /&gt;
Semicolons are not required at the end of each line. Datatype can be stated in the code, but it is not required as Swift implicitly assigns the datatype.&lt;br /&gt;
&lt;br /&gt;
[[File:swiftpic3.png|frame|center]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If the datatype of a variable is explicitly stated, the variable cannot be assigned a value that does not belong to its datatype. Such an assignment results in an error. Swift introduces a new keyword &amp;quot;let&amp;quot; for declaring constants. If the value of a constant declared with &amp;quot;let&amp;quot; is changed, an error is displayed.&lt;br /&gt;
While iterating through a loop in Swift, the value of the iterator is shown on the console on-the-fly.&lt;br /&gt;
&lt;br /&gt;
==More About Playgrounds==&lt;br /&gt;
Playgrounds files are used for testing and prototyping code. The results in the sidebar are displayed in black but during the modification of the code, the results temporarily change to gray during processing. ImageView can be used to display images&amp;lt;ref&amp;gt;[http://www.sitepoint.com/introduction-swift-programming-language/ More about Playground]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File: codesnippet.jpg|frame|center]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Read-Eval-Print-Loop (REPL)===&lt;br /&gt;
REPL (Read Evaluate Print Loop)&amp;lt;ref&amp;gt;[http://swiftlanguagetutorials.com/apple-swift-language-code-menu/apple-swift-language-faq/205-swift-language-faq-what-is-an-xcode-playground REPL]&amp;lt;/ref&amp;gt; is an interactive version of Swift. It is a procedure that loops in following iterations:&amp;lt;br&amp;gt;&lt;br /&gt;
''Read'':   Read is called and characters in user input are read.&amp;lt;br&amp;gt;&lt;br /&gt;
''Eval(uate)'': The input is then evaluated and returned&amp;lt;br&amp;gt;&lt;br /&gt;
''Print'': The evaluated result in printed in a textual representation for the users&amp;lt;br&amp;gt;&lt;br /&gt;
REPL in Swift enables the user to evaluate and interact with his code in a script-like environment.&lt;br /&gt;
&lt;br /&gt;
===Viewing Result===&lt;br /&gt;
To view graphical display of results, like images or strings, click on the Quick Look ([[File:quicklook.png|quicklook.png]] ) button. Access to Quick Look buttons can be gained by moving the pointer along the right edge of the sidebar.&amp;lt;ref&amp;gt;[https://developer.apple.com/library/ios/recipes/xcode_help-source_editor/chapters/ExploringandEvaluatingSwiftCodeinaPlayground.html  View Results in Playground]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:swift.jpg|frame|center]]&lt;br /&gt;
&lt;br /&gt;
Assistant Editor button can be used to examine values that change throughout the execution of the code.&amp;lt;br&amp;gt;&lt;br /&gt;
i.	Interim value of a code like for loop can be viewed through Value History button ([[File:history.png]]) &amp;lt;br&amp;gt;&lt;br /&gt;
ii.	Live view item can be used to view the drawing results. Live view item draws itself in response to the code.&lt;br /&gt;
&lt;br /&gt;
===Timeline===&lt;br /&gt;
The progress of results can be seen on the timeline. The time limit can also be set for the timeline to play back values. An item can be collapsed or expanded by clicking on the expression at the top of the item. An item can be removed from the timeline by clicking on the close button on the upper left corner of the item. The timeline can be closed by clicking on the close button on the Assistant Editor jump bar. It can be opened by clicking on the Assistant Editor button in the workspace toolbar or by clicking any Value History button.&lt;br /&gt;
The value of iterator in a loop can be seen by viewing the timeline. The timeline can display different types of items depending on the input. The value of iterator is shown as graph where the x-axis represents the execution time in seconds and the y-axis represents different values for the iterator. The graph changes on changing the value of the iterator&amp;lt;ref&amp;gt;[https://www.youtube.com/watch?v=F9T551Y0mYo Timeline]&amp;lt;/ref&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
[[File:assistantpic5.png|frame|center]]&lt;br /&gt;
&lt;br /&gt;
===Error===&lt;br /&gt;
The error messages in Playground is shown as a ! icon. The details about the error can be viewed by clicking on this icon. The image below shows the error message that will be displayed if a variable declared as a string is assigned an integer value.&lt;br /&gt;
&lt;br /&gt;
[[File:swiftpic5.png|frame|center]]&lt;br /&gt;
&lt;br /&gt;
===Limitations of Playground&amp;lt;ref&amp;gt;[http://rshankar.com/xcode-6-and-playground/ Limitations of Playground]&amp;lt;/ref&amp;gt;===&lt;br /&gt;
i      Playgrounds should not be used for performance testing as logging of results will dominate the runtime. &amp;lt;br&amp;gt;&lt;br /&gt;
ii     Playground does not support On-device execution. &amp;lt;br&amp;gt;&lt;br /&gt;
iii    Does not support custom entitlements.&amp;lt;br&amp;gt;&lt;br /&gt;
iv    Playgrounds can not be used for things that require user-interactions&lt;br /&gt;
&lt;br /&gt;
===Issues in Beta Playground===&lt;br /&gt;
&lt;br /&gt;
i. There are some flaws in beta release which can harm the system of user, like erasing hard drive.&lt;br /&gt;
&lt;br /&gt;
ii. It was reported by 9to5Mac that a developer discovered that the application is not sandboxed, i.e., Swift code entered in a playground has access to the entire computer sytem. The realtime nature of Playgrounds means that you don't even have to press ENTER to start the erasing process!&amp;lt;ref name= &amp;quot;issues in beta playground&amp;quot;&amp;gt;[http://swiftlanguagetutorials.com/apple-swift-language-code-menu/apple-swift-language-faq/205-swift-language-faq-what-is-an-xcode-playground Issues in beta Playground]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Comparison of Swift with Objective-C=&lt;br /&gt;
&lt;br /&gt;
A comparison of  Xcode Objective-C and Xcode6 with Swift &amp;lt;ref&amp;gt;[http://blog.shinetech.com/2014/07/22/swift-from-an-objective-c-developers-perspective/ Swift and Objective C]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*In Swift unlike Objective-C, type annotations are not required. The Swift compiler infers the data type and as a result the code size is reduced.&lt;br /&gt;
*Objective-C provides dynamic runtime, however, in Swift, the compiler checks all the types when a method is called; instead of dynamic invocation. This enables to find more errors and at the same time increases the speed.&lt;br /&gt;
*Unlike Objective-C, Swift uses closures instead of blocks to pass functions. Closures are easy to write and read.&lt;br /&gt;
* Instead of using “nil” as in Objective-C, “optionals” are introduces in Swift to handle absence of a value. In Objective-C only objects can be nil but in Swift any value can be set to nil.&lt;br /&gt;
*Swift introduces generics that were not present in Objective-C. With generics,  a placeholder can be used first and its specific type can be defined later.&lt;br /&gt;
&lt;br /&gt;
In summary, Swift combines the advantages of Objective-C and modern scripting languages. It is faster than Objective-C. It has clean code and powerful debugging tools.&lt;br /&gt;
&lt;br /&gt;
=Comparison of Swift with Python=&lt;br /&gt;
&lt;br /&gt;
Apple’s developers used Python as a benchmark against Swift and Objective-C. A lot of discussion is on-going about the comparison between Python and Swift. This comparison is possibly because of the ease of development and readability that Swift provides. This expressiveness in Swift is similar to Python. At the same time Swift is compiled and is much faster. While a lot of people are excited about the ease of programming and the performance that Swift provides, there are others who think that Swift still has a long way to go before it can be compared with something as powerful as Python. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Release History=&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;font-size: 100%; text-align: center; width: auto;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
! Date&lt;br /&gt;
! Release Notes&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 6/2/2014&lt;br /&gt;
| Swift Launched&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 9/9/2014&lt;br /&gt;
| Swift version 1.0 is now GM&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=See Also=&lt;br /&gt;
* http://en.wikipedia.org/wiki/Xcode&lt;br /&gt;
* http://en.wikipedia.org/wiki/Swift_(programming_language)&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Vboddul</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/ch1a_13_va&amp;diff=88687</id>
		<title>CSC/ECE 517 Fall 2014/ch1a 13 va</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/ch1a_13_va&amp;diff=88687"/>
		<updated>2014-09-26T03:19:38Z</updated>

		<summary type="html">&lt;p&gt;Vboddul: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Playgrounds with Swift in XCode v6.0''' ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;float: right; border:1px solid grey;&amp;quot;&amp;gt;&lt;br /&gt;
[[File:swift-xcode.jpg]]&lt;br /&gt;
[[File:playgrounds.png|center|Fig 1: Playgrounds with Swift in Xcode v6.0 ]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;On June 2, 2014 at the [http://en.wikipedia.org/wiki/Apple_Worldwide_Developers_Conference World Wide Developers Conference], Apple announced version 6 of Xcode. Features include Playgrounds live debugging tools, as well as an entirely new programming language called Swift. A key element of the Swift system is its ability to be cleanly debugged and run within the development environment, using a [http://en.wikipedia.org/wiki/Read–eval–print_loop read–eval–print loop (REPL)]&amp;lt;ref&amp;gt;[http://en.wikipedia.org/wiki/Swift_(programming_language) Swift]&amp;lt;/ref&amp;gt;, giving it interactive properties more in common with scripting systems like Python than traditional systems programming languages. The REPL is further enhanced with the new 'playgrounds' concept; 'playgrounds' are interactive views running within the Xcode environment that respond to code or debugger changes on-the-fly. If the code in question changes over time or with regard to some other ranged input value, the view can be used with the Timeline Assistant to demonstrate the output in an animated fashion.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Apple claims that Swift &amp;quot;is the first industrial-quality systems programming language that is as expressive and enjoyable as a scripting language.&amp;quot;&amp;lt;ref name=&amp;quot;Topic&amp;quot;&amp;gt;[https://docs.google.com/a/ncsu.edu/document/d/1eq3XHiUUBIrEBx-R2Mgolaw7HttSgzPniwDLEF5oVk0/edit# Topic Document]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=Background=&lt;br /&gt;
&lt;br /&gt;
===Xcode===&lt;br /&gt;
Xcode is an [http://en.wikipedia.org/wiki/Integrated_development_environment Integrated Development Environment] (IDE) developed by Apple for developing software for iOS and OS X. The Xcode suite consists of the IDE, Apple’s developer documentation and a built-in interface builder. It is shipped free with Mac OS X 10.3, but is able to develop OS X applications that can run on any version of OS X. It extends and replaces Apple's earlier tool, Project Builder, which was inherited from [http://en.wikipedia.org/wiki/NeXT NeXT]. However, Xcode officially does not work on Mac OS X 10.2.It works hand in hand with Interface Builder (also inherited from NeXT), a graphical tool used to create user interfaces.&lt;br /&gt;
&lt;br /&gt;
Xcode includes GCC, and can compile [http://en.wikipedia.org/wiki/C C], [http://en.wikipedia.org/wiki/C%2B%2B C++], Objective C++, [http://en.wikipedia.org/wiki/java Java], and [http://en.wikipedia.org/wiki/Objective-C Objective C] source code with a variety of programming models, including but not limited to [http://en.wikipedia.org/wiki/Cocoa_(API) Cocoa], Carbon, and Java.&lt;br /&gt;
The latest Xcode version 6 includes Playgrounds which has an interactive sidebar to display the results of the code on-the-fly.&lt;br /&gt;
&lt;br /&gt;
===Swift===&lt;br /&gt;
Swift&amp;lt;ref&amp;gt;[https://developer.apple.com/swift/ Introduction to Swift]&amp;lt;/ref&amp;gt; is a new programming language that adopts safe programming patterns and makes programming flexible. Swift combines the best of both C and Objective-C. It integrates both - the procedural features like types and operators as well as the object-oriented features such as classes and protocols.  It adopts readability and dynamic object model from Objective-C and has added new features like blocks, collection literals and modules, fast performance. Swift has many advantages over Objective-C, like being more type-safe, having more natural and concise syntax, no need for header/implementation files. It has simplified memory management with [http://en.wikipedia.org/wiki/Automatic_Reference_Counting Automatic Reference Counting]. Swift is a fast and powerful programming language that is easier and more fun to implement.&lt;br /&gt;
&lt;br /&gt;
=Playgrounds=&lt;br /&gt;
Playgrounds&amp;lt;ref&amp;gt;[http://www.raywenderlich.com/74438/swift-tutorial-a-quick-start Playgrounds]&amp;lt;/ref&amp;gt; enable the interactive experience of a script language, even though Swift compiles to highly-optimized native code. Type a line of code and the result appears immediately. If the code runs over time, for instance through a loop, its progress can be seen in the Timeline assistant. The Timeline displays variables in a graph, draws each step when composing a view, and can play an animated SpriteKit scene.&lt;br /&gt;
&lt;br /&gt;
===Getting Started with Playgrounds===&lt;br /&gt;
On opening Xcode6, select &amp;quot;Get started with a Playground&amp;quot;. Default is a Hello Playgrounds program.&amp;lt;ref&amp;gt;[https://www.youtube.com/watch?v=A0C6L4XmrZM Introduction to Swift Playground]&amp;lt;/ref&amp;gt;&lt;br /&gt;
[[File: pgstart.png|frame|center]]&lt;br /&gt;
&lt;br /&gt;
Playgrounds with Swift introduce user friendly, clean code. Writing code in poetry-method has become simpler with Swift. Inclusion of packages is not necessary and heavy syntax can be ignored.&lt;br /&gt;
Creation of class is not required while writing code in Swift. Writing &amp;quot;str&amp;quot; in Swift would display the value of &amp;quot;str&amp;quot; on Playground directly.&lt;br /&gt;
Semicolons are not required at the end of each line. Datatype can be stated in the code, but it is not required as Swift implicitly assigns the datatype.&lt;br /&gt;
&lt;br /&gt;
[[File:swiftpic3.png|frame|center]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If the datatype of a variable is explicitly stated, the variable cannot be assigned a value that does not belong to its datatype. Such an assignment results in an error. Swift introduces a new keyword &amp;quot;let&amp;quot; for declaring constants. If the value of a constant declared with &amp;quot;let&amp;quot; is changed, an error is displayed.&lt;br /&gt;
While iterating through a loop in Swift, the value of the iterator is shown on the console on-the-fly.&lt;br /&gt;
&lt;br /&gt;
==More About Playgrounds==&lt;br /&gt;
Playgrounds files are used for testing and prototyping code. The results in the sidebar are displayed in black but during the modification of the code, the results temporarily change to gray during processing. ImageView can be used to display images&amp;lt;ref&amp;gt;[http://www.sitepoint.com/introduction-swift-programming-language/ More about Playground]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File: codesnippet.jpg|frame|center]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Read-Eval-Print-Loop (REPL)===&lt;br /&gt;
REPL (Read Evaluate Print Loop)&amp;lt;ref&amp;gt;[http://swiftlanguagetutorials.com/apple-swift-language-code-menu/apple-swift-language-faq/205-swift-language-faq-what-is-an-xcode-playground REPL]&amp;lt;/ref&amp;gt; is an interactive version of Swift. It is a procedure that loops in following iterations:&amp;lt;br&amp;gt;&lt;br /&gt;
''Read'':   Read is called and characters in user input are read.&amp;lt;br&amp;gt;&lt;br /&gt;
''Eval(uate)'': The input is then evaluated and returned&amp;lt;br&amp;gt;&lt;br /&gt;
''Print'': The evaluated result in printed in a textual representation for the users&amp;lt;br&amp;gt;&lt;br /&gt;
REPL in Swift enables the user to evaluate and interact with his code in a script-like environment.&lt;br /&gt;
&lt;br /&gt;
===Viewing Result===&lt;br /&gt;
To view graphical display of results, like images or strings, click on the Quick Look ([[File:quicklook.png|quicklook.png]] ) button. Access to Quick Look buttons can be gained by moving the pointer along the right edge of the sidebar.&amp;lt;ref&amp;gt;[https://developer.apple.com/library/ios/recipes/xcode_help-source_editor/chapters/ExploringandEvaluatingSwiftCodeinaPlayground.html  View Results in Playground]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:swift.jpg|frame|center]]&lt;br /&gt;
&lt;br /&gt;
Assistant Editor button can be used to examine values that change throughout the execution of the code.&amp;lt;br&amp;gt;&lt;br /&gt;
i.	Interim value of a code like for loop can be viewed through Value History button ([[File:history.png]]) &amp;lt;br&amp;gt;&lt;br /&gt;
ii.	Live view item can be used to view the drawing results. Live view item draws itself in response to the code.&lt;br /&gt;
&lt;br /&gt;
===Timeline===&lt;br /&gt;
The progress of results can be seen on the timeline. The time limit can also be set for the timeline to play back values. An item can be collapsed or expanded by clicking on the expression at the top of the item. An item can be removed from the timeline by clicking on the close button on the upper left corner of the item. The timeline can be closed by clicking on the close button on the Assistant Editor jump bar. It can be opened by clicking on the Assistant Editor button in the workspace toolbar or by clicking any Value History button.&lt;br /&gt;
The value of iterator in a loop can be seen by viewing the timeline. The timeline can display different types of items depending on the input. The value of iterator is shown as graph where the x-axis represents the execution time in seconds and the y-axis represents different values for the iterator. The graph changes on changing the value of the iterator&amp;lt;ref&amp;gt;[https://www.youtube.com/watch?v=F9T551Y0mYo Timeline]&amp;lt;/ref&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
[[File:assistantpic5.png|frame|center]]&lt;br /&gt;
&lt;br /&gt;
===Error===&lt;br /&gt;
The error messages in Playground is shown as a ! icon. The details about the error can be viewed by clicking on this icon. The image below shows the error message that will be displayed if a variable declared as a string is assigned an integer value.&lt;br /&gt;
&lt;br /&gt;
[[File:swiftpic5.png|frame|center]]&lt;br /&gt;
&lt;br /&gt;
===Limitations of Playground&amp;lt;ref&amp;gt;[http://rshankar.com/xcode-6-and-playground/ Limitations of Playground]&amp;lt;/ref&amp;gt;===&lt;br /&gt;
i      Playgrounds should not be used for performance testing as logging of results will dominate the runtime. &amp;lt;br&amp;gt;&lt;br /&gt;
ii     Playground does not support On-device execution. &amp;lt;br&amp;gt;&lt;br /&gt;
iii    Does not support custom entitlements.&amp;lt;br&amp;gt;&lt;br /&gt;
iv    Playgrounds can not be used for things that require user-interactions&lt;br /&gt;
&lt;br /&gt;
===Issues in Beta Playground===&lt;br /&gt;
&lt;br /&gt;
i. There are some flaws in beta release which can harm the system of user, like erasing hard drive.&lt;br /&gt;
&lt;br /&gt;
ii. It was reported by 9to5Mac that a developer discovered that the application is not sandboxed, i.e., Swift code entered in a playground has access to the entire computer sytem. The realtime nature of Playgrounds means that you don't even have to press ENTER to start the erasing process!&amp;lt;ref name= &amp;quot;issues in beta playground&amp;quot;&amp;gt;[http://swiftlanguagetutorials.com/apple-swift-language-code-menu/apple-swift-language-faq/205-swift-language-faq-what-is-an-xcode-playground Issues in beta Playground]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Comparison of Swift with Objective-C=&lt;br /&gt;
&lt;br /&gt;
A comparison of  Xcode Objective-C and Xcode6 with Swift &amp;lt;ref&amp;gt;[http://blog.shinetech.com/2014/07/22/swift-from-an-objective-c-developers-perspective/]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*In Swift unlike Objective-C, type annotations are not required. The Swift compiler infers the data type and as a result the code size is reduced.&lt;br /&gt;
*Objective-C provides dynamic runtime, however, in Swift, the compiler checks all the types when a method is called; instead of dynamic invocation. This enables to find more errors and at the same time increases the speed.&lt;br /&gt;
*Unlike Objective-C, Swift uses closures instead of blocks to pass functions. Closures are easy to write and read.&lt;br /&gt;
* Instead of using “nil” as in Objective-C, “optionals” are introduces in Swift to handle absence of a value. In Objective-C only objects can be nil but in Swift any value can be set to nil.&lt;br /&gt;
*Swift introduces generics that were not present in Objective-C. With generics,  a placeholder can be used first and its specific type can be defined later.&lt;br /&gt;
&lt;br /&gt;
In summary, Swift combines the advantages of Objective-C and modern scripting languages. It is faster than Objective-C. It has clean code and powerful debugging tools.&lt;br /&gt;
&lt;br /&gt;
=Comparison of Swift with Python=&lt;br /&gt;
&lt;br /&gt;
Apple’s developers used Python as a benchmark against Swift and Objective-C. A lot of discussion is on-going about the comparison between Python and Swift. This comparison is possibly because of the ease of development and readability that Swift provides. This expressiveness in Swift is similar to Python. At the same time Swift is compiled and is much faster. While a lot of people are excited about the ease of programming and the performance that Swift provides, there are others who think that Swift still has a long way to go before it can be compared with something as powerful as Python. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Release History=&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;font-size: 100%; text-align: center; width: auto;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
! Date&lt;br /&gt;
! Release Notes&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 6/2/2014&lt;br /&gt;
| Swift Launched&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 9/9/2014&lt;br /&gt;
| Swift version 1.0 is now GM&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=See Also=&lt;br /&gt;
* http://en.wikipedia.org/wiki/Xcode&lt;br /&gt;
* http://en.wikipedia.org/wiki/Swift_(programming_language)&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Vboddul</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/ch1a_13_va&amp;diff=88649</id>
		<title>CSC/ECE 517 Fall 2014/ch1a 13 va</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/ch1a_13_va&amp;diff=88649"/>
		<updated>2014-09-26T02:36:35Z</updated>

		<summary type="html">&lt;p&gt;Vboddul: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Playgrounds with Swift in XCode v6.0''' ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;float: right; border:1px solid grey;&amp;quot;&amp;gt;&lt;br /&gt;
[[File:swift-xcode.jpg]]&lt;br /&gt;
[[File:playgrounds.png|center|Fig 1: Playgrounds with Swift in Xcode v6.0 ]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;On June 2, 2014 at the [http://en.wikipedia.org/wiki/Apple_Worldwide_Developers_Conference World Wide Developers Conference], Apple announced version 6 of Xcode. Features include Playgrounds live debugging tools, as well as an entirely new programming language called Swift. A key element of the Swift system is its ability to be cleanly debugged and run within the development environment, using a [http://en.wikipedia.org/wiki/Read–eval–print_loop read–eval–print loop (REPL)]&amp;lt;ref&amp;gt;[http://en.wikipedia.org/wiki/Swift_(programming_language) Swift]&amp;lt;/ref&amp;gt;, giving it interactive properties more in common with scripting systems like Python than traditional systems programming languages. The REPL is further enhanced with the new 'playgrounds' concept; 'playgrounds' are interactive views running within the Xcode environment that respond to code or debugger changes on-the-fly. If the code in question changes over time or with regard to some other ranged input value, the view can be used with the Timeline Assistant to demonstrate the output in an animated fashion.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Apple claims that Swift &amp;quot;is the first industrial-quality systems programming language that is as expressive and enjoyable as a scripting language.&amp;quot;&amp;lt;ref name=&amp;quot;Topic&amp;quot;&amp;gt;[https://docs.google.com/a/ncsu.edu/document/d/1eq3XHiUUBIrEBx-R2Mgolaw7HttSgzPniwDLEF5oVk0/edit# Topic Document]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=Background=&lt;br /&gt;
&lt;br /&gt;
===Xcode===&lt;br /&gt;
Xcode is an [http://en.wikipedia.org/wiki/Integrated_development_environment Integrated Development Environment] (IDE) developed by Apple for developing software for iOS and OS X. The Xcode suite consists of the IDE, Apple’s developer documentation and a built-in interface builder. It is shipped free with Mac OS X 10.3, but is able to develop OS X applications that can run on any version of OS X. It extends and replaces Apple's earlier tool, Project Builder, which was inherited from [http://en.wikipedia.org/wiki/NeXT NeXT]. However, Xcode officially does not work on Mac OS X 10.2.It works hand in hand with Interface Builder (also inherited from NeXT), a graphical tool used to create user interfaces.&lt;br /&gt;
&lt;br /&gt;
Xcode includes GCC, and can compile [http://en.wikipedia.org/wiki/C C], [http://en.wikipedia.org/wiki/C%2B%2B C++], Objective C++, [http://en.wikipedia.org/wiki/java Java], and [http://en.wikipedia.org/wiki/Objective-C Objective C] source code with a variety of programming models, including but not limited to [http://en.wikipedia.org/wiki/Cocoa_(API) Cocoa], Carbon, and Java.&lt;br /&gt;
The latest Xcode version 6 includes Playgrounds which has an interactive sidebar to display the results of the code on-the-fly.&lt;br /&gt;
&lt;br /&gt;
===Swift===&lt;br /&gt;
Swift&amp;lt;ref&amp;gt;[https://developer.apple.com/swift/ Introduction to Swift]&amp;lt;/ref&amp;gt; is a new programming language that adopts safe programming patterns and makes programming flexible. Swift combines the best of both C and Objective-C. It integrates both - the procedural features like types and operators as well as the object-oriented features such as classes and protocols.  It adopts readability and dynamic object model from Objective-C and has added new features like blocks, collection literals and modules, fast performance. Swift has many advantages over Objective-C, like being more type-safe, having more natural and concise syntax, no need for header/implementation files. It has simplified memory management with [http://en.wikipedia.org/wiki/Automatic_Reference_Counting Automatic Reference Counting]. Swift is a fast and powerful programming language that is easier and more fun to implement.&lt;br /&gt;
&lt;br /&gt;
=Playgrounds=&lt;br /&gt;
Playgrounds&amp;lt;ref&amp;gt;[http://www.raywenderlich.com/74438/swift-tutorial-a-quick-start Playgrounds]&amp;lt;/ref&amp;gt; enable the interactive experience of a script language, even though Swift compiles to highly-optimized native code. Type a line of code and the result appears immediately. If the code runs over time, for instance through a loop, its progress can be seen in the Timeline assistant. The Timeline displays variables in a graph, draws each step when composing a view, and can play an animated SpriteKit scene.&lt;br /&gt;
&lt;br /&gt;
===Getting Started with Playgrounds===&lt;br /&gt;
On opening Xcode6, select &amp;quot;Get started with a Playground&amp;quot;. Default is a Hello Playgrounds program.&amp;lt;ref&amp;gt;[https://www.youtube.com/watch?v=A0C6L4XmrZM Introduction to Swift Playground]&amp;lt;/ref&amp;gt;&lt;br /&gt;
[[File: pgstart.png|frame|center]]&lt;br /&gt;
&lt;br /&gt;
Playgrounds with Swift introduce user friendly, clean code. Writing code in poetry-method has become simpler with Swift. Inclusion of packages is not necessary and heavy syntax can be ignored.&lt;br /&gt;
Creation of class is not required while writing code in Swift. Writing &amp;quot;str&amp;quot; in Swift would display the value of &amp;quot;str&amp;quot; on Playground directly.&lt;br /&gt;
Semicolons are not required at the end of each line. Datatype can be stated in the code, but it is not required as Swift implicitly assigns the datatype.&lt;br /&gt;
&lt;br /&gt;
[[File:swiftpic3.png|frame|center]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If the datatype of a variable is explicitly stated, the variable cannot be assigned a value that does not belong to its datatype. Such an assignment results in an error. Swift introduces a new keyword &amp;quot;let&amp;quot; for declaring constants. If the value of a constant declared with &amp;quot;let&amp;quot; is changed, an error is displayed.&lt;br /&gt;
While iterating through a loop in Swift, the value of the iterator is shown on the console on-the-fly.&lt;br /&gt;
&lt;br /&gt;
==More About Playgrounds==&lt;br /&gt;
Playgrounds files are used for testing and prototyping code. The results in the sidebar are displayed in black but during the modification of the code, the results temporarily change to gray during processing. ImageView can be used to display images&amp;lt;ref&amp;gt;[http://www.sitepoint.com/introduction-swift-programming-language/ More about Playground]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File: codesnippet.jpg|frame|center]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Read-Eval-Print-Loop (REPL)===&lt;br /&gt;
REPL (Read Evaluate Print Loop)&amp;lt;ref&amp;gt;[http://swiftlanguagetutorials.com/apple-swift-language-code-menu/apple-swift-language-faq/205-swift-language-faq-what-is-an-xcode-playground REPL]&amp;lt;/ref&amp;gt; is an interactive version of Swift. It is a procedure that loops in following iterations:&amp;lt;br&amp;gt;&lt;br /&gt;
''Read'':   Read is called and characters in user input are read.&amp;lt;br&amp;gt;&lt;br /&gt;
''Eval(uate)'': The input is then evaluated and returned&amp;lt;br&amp;gt;&lt;br /&gt;
''Print'': The evaluated result in printed in a textual representation for the users&amp;lt;br&amp;gt;&lt;br /&gt;
REPL in Swift enables the user to evaluate and interact with his code in a script-like environment.&lt;br /&gt;
&lt;br /&gt;
===Viewing Result===&lt;br /&gt;
To view graphical display of results, like images or strings, click on the Quick Look ([[File:quicklook.png|quicklook.png]] ) button. Access to Quick Look buttons can be gained by moving the pointer along the right edge of the sidebar.&amp;lt;ref&amp;gt;[https://developer.apple.com/library/ios/recipes/xcode_help-source_editor/chapters/ExploringandEvaluatingSwiftCodeinaPlayground.html  View Results in Playground]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:swift.jpg|frame|center]]&lt;br /&gt;
&lt;br /&gt;
Assistant Editor button can be used to examine values that change throughout the execution of the code.&amp;lt;br&amp;gt;&lt;br /&gt;
i.	Interim value of a code like for loop can be viewed through Value History button ([[File:history.png]]) &amp;lt;br&amp;gt;&lt;br /&gt;
ii.	Live view item can be used to view the drawing results. Live view item draws itself in response to the code.&lt;br /&gt;
&lt;br /&gt;
===Timeline===&lt;br /&gt;
The progress of results can be seen on the timeline. The time limit can also be set for the timeline to play back values. An item can be collapsed or expanded by clicking on the expression at the top of the item. An item can be removed from the timeline by clicking on the close button on the upper left corner of the item. The timeline can be closed by clicking on the close button on the Assistant Editor jump bar. It can be opened by clicking on the Assistant Editor button in the workspace toolbar or by clicking any Value History button.&lt;br /&gt;
The value of iterator in a loop can be seen by viewing the timeline. The timeline can display different types of items depending on the input. The value of iterator is shown as graph where the x-axis represents the execution time in seconds and the y-axis represents different values for the iterator. The graph changes on changing the value of the iterator&amp;lt;ref&amp;gt;[https://www.youtube.com/watch?v=F9T551Y0mYo Timeline]&amp;lt;/ref&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
[[File:assistantpic5.png|frame|center]]&lt;br /&gt;
&lt;br /&gt;
===Error===&lt;br /&gt;
The error messages in Playground is shown as a ! icon. The details about the error can be viewed by clicking on this icon. The image below shows the error message that will be displayed if a variable declared as a string is assigned an integer value.&lt;br /&gt;
&lt;br /&gt;
[[File:swiftpic5.png|frame|center]]&lt;br /&gt;
&lt;br /&gt;
===Limitations of Playground&amp;lt;ref&amp;gt;[http://rshankar.com/xcode-6-and-playground/ Limitations of Playground]&amp;lt;/ref&amp;gt;===&lt;br /&gt;
i      Playgrounds should not be used for performance testing as logging of results will dominate the runtime. &amp;lt;br&amp;gt;&lt;br /&gt;
ii     Playground does not support On-device execution. &amp;lt;br&amp;gt;&lt;br /&gt;
iii    Does not support custom entitlements.&amp;lt;br&amp;gt;&lt;br /&gt;
iv    Playgrounds can not be used for things that require user-interactions&lt;br /&gt;
&lt;br /&gt;
===Issues in Beta Playground===&lt;br /&gt;
&lt;br /&gt;
i. There are some flaws in beta release which can harm the system of user, like erasing hard drive.&lt;br /&gt;
&lt;br /&gt;
ii. It was reported by 9to5Mac that a developer discovered that the application is not sandboxed, i.e., Swift code entered in a playground has access to the entire computer sytem. The realtime nature of Playgrounds means that you don't even have to press ENTER to start the erasing process!&amp;lt;ref name= &amp;quot;issues in beta playground&amp;quot;&amp;gt;[http://swiftlanguagetutorials.com/apple-swift-language-code-menu/apple-swift-language-faq/205-swift-language-faq-what-is-an-xcode-playground Issues in beta Playground]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Comparison of Swift with Python=&lt;br /&gt;
&lt;br /&gt;
Apple’s developers used Python as a benchmark against Swift and Objective-C. A lot of discussion is on-going about the comparison between Python and Swift. This comparison is possibly because of the ease of development and readability that Swift provides. This expressiveness in Swift is similar to Python. At the same time Swift is compiled and is much faster. While a lot of people are excited about the ease of programming and the performance that Swift provides, there are others who think that Swift still has a long way to go before it can be compared with something as powerful as Python. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Release History=&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;font-size: 100%; text-align: center; width: auto;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
! Date&lt;br /&gt;
! Release Notes&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 6/2/2014&lt;br /&gt;
| Swift Launched&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 9/9/2014&lt;br /&gt;
| Swift version 1.0 is now GM&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=See Also=&lt;br /&gt;
* http://en.wikipedia.org/wiki/Xcode&lt;br /&gt;
* http://en.wikipedia.org/wiki/Swift_(programming_language)&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Vboddul</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/ch1a_13_va&amp;diff=88623</id>
		<title>CSC/ECE 517 Fall 2014/ch1a 13 va</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/ch1a_13_va&amp;diff=88623"/>
		<updated>2014-09-26T01:59:13Z</updated>

		<summary type="html">&lt;p&gt;Vboddul: /* Release History */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Playgrounds with Swift in XCode v6.0''' ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;float: right; border:1px solid grey;&amp;quot;&amp;gt;&lt;br /&gt;
[[File:swift-xcode.jpg]]&lt;br /&gt;
[[File:playgrounds.png|center|Fig 1: Playgrounds with Swift in Xcode v6.0 ]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;On June 2, 2014 at the [http://en.wikipedia.org/wiki/Apple_Worldwide_Developers_Conference World Wide Developers Conference], Apple announced version 6 of Xcode. Features include Playgrounds live debugging tools, as well as an entirely new programming language called Swift. A key element of the Swift system is its ability to be cleanly debugged and run within the development environment, using a [http://en.wikipedia.org/wiki/Read–eval–print_loop read–eval–print loop (REPL)], giving it interactive properties more in common with scripting systems like Python than traditional systems programming languages. The REPL is further enhanced with the new 'playgrounds' concept; 'playgrounds' are interactive views running within the Xcode environment that respond to code or debugger changes on-the-fly. If the code in question changes over time or with regard to some other ranged input value, the view can be used with the Timeline Assistant to demonstrate the output in an animated fashion.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Apple claims that Swift &amp;quot;is the first industrial-quality systems programming language that is as expressive and enjoyable as a scripting language.&amp;quot;&amp;lt;ref name=&amp;quot;Topic&amp;quot;&amp;gt;[https://docs.google.com/a/ncsu.edu/document/d/1eq3XHiUUBIrEBx-R2Mgolaw7HttSgzPniwDLEF5oVk0/edit# Topic Document]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=Background=&lt;br /&gt;
&lt;br /&gt;
===Xcode===&lt;br /&gt;
Xcode is an [http://en.wikipedia.org/wiki/Integrated_development_environment Integrated Development Environment] (IDE) developed by Apple for developing software for iOS and OS X. The Xcode suite consists of the IDE, Apple’s developer documentation and a built-in interface builder. It is shipped free with Mac OS X 10.3, but is able to develop OS X applications that can run on any version of OS X. It extends and replaces Apple's earlier tool, Project Builder, which was inherited from [http://en.wikipedia.org/wiki/NeXT NeXT]. However, Xcode officially does not work in Mac OS X 10.2.It works hand in hand with Interface Builder (also inherited from NeXT), a graphical tool used to create user interfaces.&lt;br /&gt;
&lt;br /&gt;
Xcode includes GCC, and can compile [http://en.wikipedia.org/wiki/C C], [http://en.wikipedia.org/wiki/C%2B%2B C++], Objective C++, [http://en.wikipedia.org/wiki/java Java], and [http://en.wikipedia.org/wiki/Objective-C Objective C] source code with a variety of programming models, including but not limited to [http://en.wikipedia.org/wiki/Cocoa_(API) Cocoa], Carbon, and Java.&lt;br /&gt;
The latest Xcode version 6 includes Playgrounds which has an interactive sidebar to display the results of the code on-the-fly.&lt;br /&gt;
&lt;br /&gt;
===Swift===&lt;br /&gt;
Swift&amp;lt;ref&amp;gt;[https://developer.apple.com/swift/ Introduction to Swift]&amp;lt;/ref&amp;gt; is a new programming language that adopts safe programming patterns and makes programming flexible. Swift combines the best of both C and Objective-C. It integrates both - the procedural features like types and operators as well as the object-oriented features such as classes and protocols.  It adopts readability and dynamic object model from Objective-C and has added new features like blocks, collection literals and modules, fast performance. Swift has many advantages over Objective-C, like being more type-safe, having more natural and concise syntax, no need for header/implementation files. It has simplified memory management with [http://en.wikipedia.org/wiki/Automatic_Reference_Counting Automatic Reference Counting]. Swift is a fast and powerful programming language that is easier and more fun to implement.&lt;br /&gt;
&lt;br /&gt;
=Playgrounds=&lt;br /&gt;
Playgrounds&amp;lt;ref&amp;gt;[http://www.raywenderlich.com/74438/swift-tutorial-a-quick-start Playgrounds]&amp;lt;/ref&amp;gt; enable the interactive experience of a script language, even though Swift compiles to highly-optimized native code. Type a line of code and the result appears immediately. If your code runs over time, for instance through a loop, you can watch its progress in the Timeline assistant. The Timeline displays variables in a graph, draws each step when composing a view, and can play an animated SpriteKit scene.&lt;br /&gt;
&lt;br /&gt;
===Getting Started with Playgrounds===&lt;br /&gt;
On opening Xcode6, select &amp;quot;Get started with a Playground&amp;quot;. Default is a Hello Playgrounds program.&amp;lt;ref&amp;gt;[https://www.youtube.com/watch?v=A0C6L4XmrZM Introduction to Swift Playground]&amp;lt;/ref&amp;gt;&lt;br /&gt;
[[File: pgstart.png|frame|center]]&lt;br /&gt;
&lt;br /&gt;
Playgrounds with Swift introduce user friendly, clean code. Writing code in poetry-method has become simpler with Swift. Inclusion of packages is not necessary and heavy syntax can be ignored.&lt;br /&gt;
Creation of class is not required while writing code in Swift. Writing &amp;quot;str&amp;quot; in Swift would display the value of &amp;quot;str&amp;quot; on Playground directly.&lt;br /&gt;
Semicolons are not required at the end of each line. Datatype can be stated in the code, but it is not required as Swift implicitly assigns the datatype.&lt;br /&gt;
&lt;br /&gt;
[[File:swiftpic3.png|frame|center]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If the datatype of a variable is explicitly stated, the variable cannot be assigned a value that does not belong to its datatype. Such an assignment results in an error. Swift introduces a new keyword &amp;quot;let&amp;quot; for declaring constants. If the value of a constant declared with &amp;quot;let&amp;quot; is changed, an error is displayed.&lt;br /&gt;
While iterating through a loop in Swift, the value of the iterator is shown on the console on-the-fly.&lt;br /&gt;
&lt;br /&gt;
==More About Playgrounds==&lt;br /&gt;
Playgrounds files are used for testing and prototyping code. The results in the sidebar are displayed in black but during the modification of the code, the results temporarily change to gray during processing. ImageView can be used to display images&amp;lt;ref&amp;gt;[http://www.sitepoint.com/introduction-swift-programming-language/ More about Playground]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File: codesnippet.jpg|frame|center]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Read-Eval-Print-Loop (REPL)===&lt;br /&gt;
REPL (Read Evaluate Print Loop)&amp;lt;ref&amp;gt;[http://swiftlanguagetutorials.com/apple-swift-language-code-menu/apple-swift-language-faq/205-swift-language-faq-what-is-an-xcode-playground REPL]&amp;lt;/ref&amp;gt; is an interactive version of Swift. It is a procedure that loops in following iterations:&amp;lt;br&amp;gt;&lt;br /&gt;
''Read'':   Read is called and characters in user input are read.&amp;lt;br&amp;gt;&lt;br /&gt;
''Eval(uate)'': The input is then evaluated and returned&amp;lt;br&amp;gt;&lt;br /&gt;
''Print'': The evaluated result in printed in a textual representation for the users&amp;lt;br&amp;gt;&lt;br /&gt;
REPL in Swift enables the user to evaluate and interact with his code in a script-like environment.&lt;br /&gt;
&lt;br /&gt;
===Viewing Result===&lt;br /&gt;
To view graphical display of results, like images or strings, you can click on the Quick Look ([[File:quicklook.png|quicklook.png]] ) button. Access to Quick Look buttons can be gained by moving the pointer along the right edge of the sidebar.&amp;lt;ref&amp;gt;[https://developer.apple.com/library/ios/recipes/xcode_help-source_editor/chapters/ExploringandEvaluatingSwiftCodeinaPlayground.html  View Results in Playground]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:swift.jpg|frame|center]]&lt;br /&gt;
&lt;br /&gt;
Assistant Editor button can be used to examine values that change throughout the execution of the code.&amp;lt;br&amp;gt;&lt;br /&gt;
i.	Interim value of a code like for loop can be viewed through Value History button ([[File:history.png]]) &amp;lt;br&amp;gt;&lt;br /&gt;
ii.	Live view item can be used to view the drawing results. Live view item draws itself in response to the code.&lt;br /&gt;
&lt;br /&gt;
===Timeline===&lt;br /&gt;
The progress of results can be seen on the timeline. The time limit can also be set for the timeline to play back values. An item can be collapsed or expanded by clicking on the expression at the top of the item. An item can be removed from the timeline by clicking on the close button on the upper left corner of the item. The timeline can be closed by clicking on the close button on the Assistant Editor jump bar. It can be opened by clicking on the Assistant Editor button in the workspace toolbar or by clicking any Value History button.&lt;br /&gt;
The value of iterator in a loop can be seen by viewing the timeline. The timeline can display different types of items depending on the input. The value of iterator is shown as graph where the x-axis represents the execution time in seconds and the y-axis represents different values for the iterator. The graph changes on changing the value of the iterator&amp;lt;ref&amp;gt;[https://www.youtube.com/watch?v=F9T551Y0mYo Timeline]&amp;lt;/ref&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
[[File:assistantpic5.png|frame|center]]&lt;br /&gt;
&lt;br /&gt;
===Error===&lt;br /&gt;
The error messages in Playground is shown as a ! icon. The details about the error can be viewed by clicking on this icon. The image below shows the error message that will be displayed if a variable declared as a string is assigned an integer value.&lt;br /&gt;
&lt;br /&gt;
[[File:swiftpic5.png|frame|center]]&lt;br /&gt;
&lt;br /&gt;
===Limitations of Playground&amp;lt;ref&amp;gt;[http://rshankar.com/xcode-6-and-playground/ Limitations of Playground]&amp;lt;/ref&amp;gt;===&lt;br /&gt;
i      Playgrounds should not be used for performance testing as logging of results will dominate the runtime. &amp;lt;br&amp;gt;&lt;br /&gt;
ii     Playground does not support On-device execution. &amp;lt;br&amp;gt;&lt;br /&gt;
iii    Does not support custom entitlements.&amp;lt;br&amp;gt;&lt;br /&gt;
iv    Playgrounds can not be used for things that require user-interactions&lt;br /&gt;
&lt;br /&gt;
===Issues in Beta Playground===&lt;br /&gt;
&lt;br /&gt;
i. There are some flaws in beta release which can harm the system of user, like erasing hard drive.&lt;br /&gt;
&lt;br /&gt;
ii. It was reported by 9to5Mac that a developer discovered that the application is not sandboxed, i.e., Swift code entered in a playground has access to the entire computer sytem. The realtime nature of Playgrounds means that you don't even have to press ENTER to start the erasing process!&amp;lt;ref name= &amp;quot;issues in beta playground&amp;quot;&amp;gt;[http://swiftlanguagetutorials.com/apple-swift-language-code-menu/apple-swift-language-faq/205-swift-language-faq-what-is-an-xcode-playground Issues in beta Playground]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Release History=&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;font-size: 100%; text-align: center; width: auto;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
! Date&lt;br /&gt;
! Release Notes&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 6/2/2014&lt;br /&gt;
| Swift Launched&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 9/9/2014&lt;br /&gt;
| Swift version 1.0 is now GM&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=See Also=&lt;br /&gt;
* http://en.wikipedia.org/wiki/Xcode&lt;br /&gt;
* http://en.wikipedia.org/wiki/Swift_(programming_language)&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Vboddul</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/ch1a_13_va&amp;diff=88621</id>
		<title>CSC/ECE 517 Fall 2014/ch1a 13 va</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/ch1a_13_va&amp;diff=88621"/>
		<updated>2014-09-26T01:58:23Z</updated>

		<summary type="html">&lt;p&gt;Vboddul: /* Release History */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Playgrounds with Swift in XCode v6.0''' ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;float: right; border:1px solid grey;&amp;quot;&amp;gt;&lt;br /&gt;
[[File:swift-xcode.jpg]]&lt;br /&gt;
[[File:playgrounds.png|center|Fig 1: Playgrounds with Swift in Xcode v6.0 ]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;On June 2, 2014 at the [http://en.wikipedia.org/wiki/Apple_Worldwide_Developers_Conference World Wide Developers Conference], Apple announced version 6 of Xcode. Features include Playgrounds live debugging tools, as well as an entirely new programming language called Swift. A key element of the Swift system is its ability to be cleanly debugged and run within the development environment, using a [http://en.wikipedia.org/wiki/Read–eval–print_loop read–eval–print loop (REPL)], giving it interactive properties more in common with scripting systems like Python than traditional systems programming languages. The REPL is further enhanced with the new 'playgrounds' concept; 'playgrounds' are interactive views running within the Xcode environment that respond to code or debugger changes on-the-fly. If the code in question changes over time or with regard to some other ranged input value, the view can be used with the Timeline Assistant to demonstrate the output in an animated fashion.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Apple claims that Swift &amp;quot;is the first industrial-quality systems programming language that is as expressive and enjoyable as a scripting language.&amp;quot;&amp;lt;ref name=&amp;quot;Topic&amp;quot;&amp;gt;[https://docs.google.com/a/ncsu.edu/document/d/1eq3XHiUUBIrEBx-R2Mgolaw7HttSgzPniwDLEF5oVk0/edit# Topic Document]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=Background=&lt;br /&gt;
&lt;br /&gt;
===Xcode===&lt;br /&gt;
Xcode is an [http://en.wikipedia.org/wiki/Integrated_development_environment Integrated Development Environment] (IDE) developed by Apple for developing software for iOS and OS X. The Xcode suite consists of the IDE, Apple’s developer documentation and a built-in interface builder. It is shipped free with Mac OS X 10.3, but is able to develop OS X applications that can run on any version of OS X. It extends and replaces Apple's earlier tool, Project Builder, which was inherited from [http://en.wikipedia.org/wiki/NeXT NeXT]. However, Xcode officially does not work in Mac OS X 10.2.It works hand in hand with Interface Builder (also inherited from NeXT), a graphical tool used to create user interfaces.&lt;br /&gt;
&lt;br /&gt;
Xcode includes GCC, and can compile [http://en.wikipedia.org/wiki/C C], [http://en.wikipedia.org/wiki/C%2B%2B C++], Objective C++, [http://en.wikipedia.org/wiki/java Java], and [http://en.wikipedia.org/wiki/Objective-C Objective C] source code with a variety of programming models, including but not limited to [http://en.wikipedia.org/wiki/Cocoa_(API) Cocoa], Carbon, and Java.&lt;br /&gt;
The latest Xcode version 6 includes Playgrounds which has an interactive sidebar to display the results of the code on-the-fly.&lt;br /&gt;
&lt;br /&gt;
===Swift===&lt;br /&gt;
Swift&amp;lt;ref&amp;gt;[https://developer.apple.com/swift/ Introduction to Swift]&amp;lt;/ref&amp;gt; is a new programming language that adopts safe programming patterns and makes programming flexible. Swift combines the best of both C and Objective-C. It integrates both - the procedural features like types and operators as well as the object-oriented features such as classes and protocols.  It adopts readability and dynamic object model from Objective-C and has added new features like blocks, collection literals and modules, fast performance. Swift has many advantages over Objective-C, like being more type-safe, having more natural and concise syntax, no need for header/implementation files. It has simplified memory management with [http://en.wikipedia.org/wiki/Automatic_Reference_Counting Automatic Reference Counting]. Swift is a fast and powerful programming language that is easier and more fun to implement.&lt;br /&gt;
&lt;br /&gt;
=Playgrounds=&lt;br /&gt;
Playgrounds&amp;lt;ref&amp;gt;[http://www.raywenderlich.com/74438/swift-tutorial-a-quick-start Playgrounds]&amp;lt;/ref&amp;gt; enable the interactive experience of a script language, even though Swift compiles to highly-optimized native code. Type a line of code and the result appears immediately. If your code runs over time, for instance through a loop, you can watch its progress in the Timeline assistant. The Timeline displays variables in a graph, draws each step when composing a view, and can play an animated SpriteKit scene.&lt;br /&gt;
&lt;br /&gt;
===Getting Started with Playgrounds===&lt;br /&gt;
On opening Xcode6, select &amp;quot;Get started with a Playground&amp;quot;. Default is a Hello Playgrounds program.&amp;lt;ref&amp;gt;[https://www.youtube.com/watch?v=A0C6L4XmrZM Introduction to Swift Playground]&amp;lt;/ref&amp;gt;&lt;br /&gt;
[[File: pgstart.png|frame|center]]&lt;br /&gt;
&lt;br /&gt;
Playgrounds with Swift introduce user friendly, clean code. Writing code in poetry-method has become simpler with Swift. Inclusion of packages is not necessary and heavy syntax can be ignored.&lt;br /&gt;
Creation of class is not required while writing code in Swift. Writing &amp;quot;str&amp;quot; in Swift would display the value of &amp;quot;str&amp;quot; on Playground directly.&lt;br /&gt;
Semicolons are not required at the end of each line. Datatype can be stated in the code, but it is not required as Swift implicitly assigns the datatype.&lt;br /&gt;
&lt;br /&gt;
[[File:swiftpic3.png|frame|center]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If the datatype of a variable is explicitly stated, the variable cannot be assigned a value that does not belong to its datatype. Such an assignment results in an error. Swift introduces a new keyword &amp;quot;let&amp;quot; for declaring constants. If the value of a constant declared with &amp;quot;let&amp;quot; is changed, an error is displayed.&lt;br /&gt;
While iterating through a loop in Swift, the value of the iterator is shown on the console on-the-fly.&lt;br /&gt;
&lt;br /&gt;
==More About Playgrounds==&lt;br /&gt;
Playgrounds files are used for testing and prototyping code. The results in the sidebar are displayed in black but during the modification of the code, the results temporarily change to gray during processing. ImageView can be used to display images&amp;lt;ref&amp;gt;[http://www.sitepoint.com/introduction-swift-programming-language/ More about Playground]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File: codesnippet.jpg|frame|center]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Read-Eval-Print-Loop (REPL)===&lt;br /&gt;
REPL (Read Evaluate Print Loop)&amp;lt;ref&amp;gt;[http://swiftlanguagetutorials.com/apple-swift-language-code-menu/apple-swift-language-faq/205-swift-language-faq-what-is-an-xcode-playground REPL]&amp;lt;/ref&amp;gt; is an interactive version of Swift. It is a procedure that loops in following iterations:&amp;lt;br&amp;gt;&lt;br /&gt;
''Read'':   Read is called and characters in user input are read.&amp;lt;br&amp;gt;&lt;br /&gt;
''Eval(uate)'': The input is then evaluated and returned&amp;lt;br&amp;gt;&lt;br /&gt;
''Print'': The evaluated result in printed in a textual representation for the users&amp;lt;br&amp;gt;&lt;br /&gt;
REPL in Swift enables the user to evaluate and interact with his code in a script-like environment.&lt;br /&gt;
&lt;br /&gt;
===Viewing Result===&lt;br /&gt;
To view graphical display of results, like images or strings, you can click on the Quick Look ([[File:quicklook.png|quicklook.png]] ) button. Access to Quick Look buttons can be gained by moving the pointer along the right edge of the sidebar.&amp;lt;ref&amp;gt;[https://developer.apple.com/library/ios/recipes/xcode_help-source_editor/chapters/ExploringandEvaluatingSwiftCodeinaPlayground.html  View Results in Playground]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:swift.jpg|frame|center]]&lt;br /&gt;
&lt;br /&gt;
Assistant Editor button can be used to examine values that change throughout the execution of the code.&amp;lt;br&amp;gt;&lt;br /&gt;
i.	Interim value of a code like for loop can be viewed through Value History button ([[File:history.png]]) &amp;lt;br&amp;gt;&lt;br /&gt;
ii.	Live view item can be used to view the drawing results. Live view item draws itself in response to the code.&lt;br /&gt;
&lt;br /&gt;
===Timeline===&lt;br /&gt;
The progress of results can be seen on the timeline. The time limit can also be set for the timeline to play back values. An item can be collapsed or expanded by clicking on the expression at the top of the item. An item can be removed from the timeline by clicking on the close button on the upper left corner of the item. The timeline can be closed by clicking on the close button on the Assistant Editor jump bar. It can be opened by clicking on the Assistant Editor button in the workspace toolbar or by clicking any Value History button.&lt;br /&gt;
The value of iterator in a loop can be seen by viewing the timeline. The timeline can display different types of items depending on the input. The value of iterator is shown as graph where the x-axis represents the execution time in seconds and the y-axis represents different values for the iterator. The graph changes on changing the value of the iterator&amp;lt;ref&amp;gt;[https://www.youtube.com/watch?v=F9T551Y0mYo Timeline]&amp;lt;/ref&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
[[File:assistantpic5.png|frame|center]]&lt;br /&gt;
&lt;br /&gt;
===Error===&lt;br /&gt;
The error messages in Playground is shown as a ! icon. The details about the error can be viewed by clicking on this icon. The image below shows the error message that will be displayed if a variable declared as a string is assigned an integer value.&lt;br /&gt;
&lt;br /&gt;
[[File:swiftpic5.png|frame|center]]&lt;br /&gt;
&lt;br /&gt;
===Limitations of Playground&amp;lt;ref&amp;gt;[http://rshankar.com/xcode-6-and-playground/ Limitations of Playground]&amp;lt;/ref&amp;gt;===&lt;br /&gt;
i      Playgrounds should not be used for performance testing as logging of results will dominate the runtime. &amp;lt;br&amp;gt;&lt;br /&gt;
ii     Playground does not support On-device execution. &amp;lt;br&amp;gt;&lt;br /&gt;
iii    Does not support custom entitlements.&amp;lt;br&amp;gt;&lt;br /&gt;
iv    Playgrounds can not be used for things that require user-interactions&lt;br /&gt;
&lt;br /&gt;
===Issues in Beta Playground===&lt;br /&gt;
&lt;br /&gt;
i. There are some flaws in beta release which can harm the system of user, like erasing hard drive.&lt;br /&gt;
&lt;br /&gt;
ii. It was reported by 9to5Mac that a developer discovered that the application is not sandboxed, i.e., Swift code entered in a playground has access to the entire computer sytem. The realtime nature of Playgrounds means that you don't even have to press ENTER to start the erasing process!&amp;lt;ref name= &amp;quot;issues in beta playground&amp;quot;&amp;gt;[http://swiftlanguagetutorials.com/apple-swift-language-code-menu/apple-swift-language-faq/205-swift-language-faq-what-is-an-xcode-playground Issues in beta Playground]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Release History=&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;font-size: 100%; text-align: center; width: auto;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
! Date&lt;br /&gt;
! Release Notes&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 6/2/2014&lt;br /&gt;
| Swift Launched&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 9/9/2014&lt;br /&gt;
| Swift 1.0&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=See Also=&lt;br /&gt;
* http://en.wikipedia.org/wiki/Xcode&lt;br /&gt;
* http://en.wikipedia.org/wiki/Swift_(programming_language)&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Vboddul</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/ch1a_13_va&amp;diff=88620</id>
		<title>CSC/ECE 517 Fall 2014/ch1a 13 va</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/ch1a_13_va&amp;diff=88620"/>
		<updated>2014-09-26T01:57:54Z</updated>

		<summary type="html">&lt;p&gt;Vboddul: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Playgrounds with Swift in XCode v6.0''' ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;float: right; border:1px solid grey;&amp;quot;&amp;gt;&lt;br /&gt;
[[File:swift-xcode.jpg]]&lt;br /&gt;
[[File:playgrounds.png|center|Fig 1: Playgrounds with Swift in Xcode v6.0 ]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;On June 2, 2014 at the [http://en.wikipedia.org/wiki/Apple_Worldwide_Developers_Conference World Wide Developers Conference], Apple announced version 6 of Xcode. Features include Playgrounds live debugging tools, as well as an entirely new programming language called Swift. A key element of the Swift system is its ability to be cleanly debugged and run within the development environment, using a [http://en.wikipedia.org/wiki/Read–eval–print_loop read–eval–print loop (REPL)], giving it interactive properties more in common with scripting systems like Python than traditional systems programming languages. The REPL is further enhanced with the new 'playgrounds' concept; 'playgrounds' are interactive views running within the Xcode environment that respond to code or debugger changes on-the-fly. If the code in question changes over time or with regard to some other ranged input value, the view can be used with the Timeline Assistant to demonstrate the output in an animated fashion.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Apple claims that Swift &amp;quot;is the first industrial-quality systems programming language that is as expressive and enjoyable as a scripting language.&amp;quot;&amp;lt;ref name=&amp;quot;Topic&amp;quot;&amp;gt;[https://docs.google.com/a/ncsu.edu/document/d/1eq3XHiUUBIrEBx-R2Mgolaw7HttSgzPniwDLEF5oVk0/edit# Topic Document]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=Background=&lt;br /&gt;
&lt;br /&gt;
===Xcode===&lt;br /&gt;
Xcode is an [http://en.wikipedia.org/wiki/Integrated_development_environment Integrated Development Environment] (IDE) developed by Apple for developing software for iOS and OS X. The Xcode suite consists of the IDE, Apple’s developer documentation and a built-in interface builder. It is shipped free with Mac OS X 10.3, but is able to develop OS X applications that can run on any version of OS X. It extends and replaces Apple's earlier tool, Project Builder, which was inherited from [http://en.wikipedia.org/wiki/NeXT NeXT]. However, Xcode officially does not work in Mac OS X 10.2.It works hand in hand with Interface Builder (also inherited from NeXT), a graphical tool used to create user interfaces.&lt;br /&gt;
&lt;br /&gt;
Xcode includes GCC, and can compile [http://en.wikipedia.org/wiki/C C], [http://en.wikipedia.org/wiki/C%2B%2B C++], Objective C++, [http://en.wikipedia.org/wiki/java Java], and [http://en.wikipedia.org/wiki/Objective-C Objective C] source code with a variety of programming models, including but not limited to [http://en.wikipedia.org/wiki/Cocoa_(API) Cocoa], Carbon, and Java.&lt;br /&gt;
The latest Xcode version 6 includes Playgrounds which has an interactive sidebar to display the results of the code on-the-fly.&lt;br /&gt;
&lt;br /&gt;
===Swift===&lt;br /&gt;
Swift&amp;lt;ref&amp;gt;[https://developer.apple.com/swift/ Introduction to Swift]&amp;lt;/ref&amp;gt; is a new programming language that adopts safe programming patterns and makes programming flexible. Swift combines the best of both C and Objective-C. It integrates both - the procedural features like types and operators as well as the object-oriented features such as classes and protocols.  It adopts readability and dynamic object model from Objective-C and has added new features like blocks, collection literals and modules, fast performance. Swift has many advantages over Objective-C, like being more type-safe, having more natural and concise syntax, no need for header/implementation files. It has simplified memory management with [http://en.wikipedia.org/wiki/Automatic_Reference_Counting Automatic Reference Counting]. Swift is a fast and powerful programming language that is easier and more fun to implement.&lt;br /&gt;
&lt;br /&gt;
=Playgrounds=&lt;br /&gt;
Playgrounds&amp;lt;ref&amp;gt;[http://www.raywenderlich.com/74438/swift-tutorial-a-quick-start Playgrounds]&amp;lt;/ref&amp;gt; enable the interactive experience of a script language, even though Swift compiles to highly-optimized native code. Type a line of code and the result appears immediately. If your code runs over time, for instance through a loop, you can watch its progress in the Timeline assistant. The Timeline displays variables in a graph, draws each step when composing a view, and can play an animated SpriteKit scene.&lt;br /&gt;
&lt;br /&gt;
===Getting Started with Playgrounds===&lt;br /&gt;
On opening Xcode6, select &amp;quot;Get started with a Playground&amp;quot;. Default is a Hello Playgrounds program.&amp;lt;ref&amp;gt;[https://www.youtube.com/watch?v=A0C6L4XmrZM Introduction to Swift Playground]&amp;lt;/ref&amp;gt;&lt;br /&gt;
[[File: pgstart.png|frame|center]]&lt;br /&gt;
&lt;br /&gt;
Playgrounds with Swift introduce user friendly, clean code. Writing code in poetry-method has become simpler with Swift. Inclusion of packages is not necessary and heavy syntax can be ignored.&lt;br /&gt;
Creation of class is not required while writing code in Swift. Writing &amp;quot;str&amp;quot; in Swift would display the value of &amp;quot;str&amp;quot; on Playground directly.&lt;br /&gt;
Semicolons are not required at the end of each line. Datatype can be stated in the code, but it is not required as Swift implicitly assigns the datatype.&lt;br /&gt;
&lt;br /&gt;
[[File:swiftpic3.png|frame|center]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If the datatype of a variable is explicitly stated, the variable cannot be assigned a value that does not belong to its datatype. Such an assignment results in an error. Swift introduces a new keyword &amp;quot;let&amp;quot; for declaring constants. If the value of a constant declared with &amp;quot;let&amp;quot; is changed, an error is displayed.&lt;br /&gt;
While iterating through a loop in Swift, the value of the iterator is shown on the console on-the-fly.&lt;br /&gt;
&lt;br /&gt;
==More About Playgrounds==&lt;br /&gt;
Playgrounds files are used for testing and prototyping code. The results in the sidebar are displayed in black but during the modification of the code, the results temporarily change to gray during processing. ImageView can be used to display images&amp;lt;ref&amp;gt;[http://www.sitepoint.com/introduction-swift-programming-language/ More about Playground]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File: codesnippet.jpg|frame|center]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Read-Eval-Print-Loop (REPL)===&lt;br /&gt;
REPL (Read Evaluate Print Loop)&amp;lt;ref&amp;gt;[http://swiftlanguagetutorials.com/apple-swift-language-code-menu/apple-swift-language-faq/205-swift-language-faq-what-is-an-xcode-playground REPL]&amp;lt;/ref&amp;gt; is an interactive version of Swift. It is a procedure that loops in following iterations:&amp;lt;br&amp;gt;&lt;br /&gt;
''Read'':   Read is called and characters in user input are read.&amp;lt;br&amp;gt;&lt;br /&gt;
''Eval(uate)'': The input is then evaluated and returned&amp;lt;br&amp;gt;&lt;br /&gt;
''Print'': The evaluated result in printed in a textual representation for the users&amp;lt;br&amp;gt;&lt;br /&gt;
REPL in Swift enables the user to evaluate and interact with his code in a script-like environment.&lt;br /&gt;
&lt;br /&gt;
===Viewing Result===&lt;br /&gt;
To view graphical display of results, like images or strings, you can click on the Quick Look ([[File:quicklook.png|quicklook.png]] ) button. Access to Quick Look buttons can be gained by moving the pointer along the right edge of the sidebar.&amp;lt;ref&amp;gt;[https://developer.apple.com/library/ios/recipes/xcode_help-source_editor/chapters/ExploringandEvaluatingSwiftCodeinaPlayground.html  View Results in Playground]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:swift.jpg|frame|center]]&lt;br /&gt;
&lt;br /&gt;
Assistant Editor button can be used to examine values that change throughout the execution of the code.&amp;lt;br&amp;gt;&lt;br /&gt;
i.	Interim value of a code like for loop can be viewed through Value History button ([[File:history.png]]) &amp;lt;br&amp;gt;&lt;br /&gt;
ii.	Live view item can be used to view the drawing results. Live view item draws itself in response to the code.&lt;br /&gt;
&lt;br /&gt;
===Timeline===&lt;br /&gt;
The progress of results can be seen on the timeline. The time limit can also be set for the timeline to play back values. An item can be collapsed or expanded by clicking on the expression at the top of the item. An item can be removed from the timeline by clicking on the close button on the upper left corner of the item. The timeline can be closed by clicking on the close button on the Assistant Editor jump bar. It can be opened by clicking on the Assistant Editor button in the workspace toolbar or by clicking any Value History button.&lt;br /&gt;
The value of iterator in a loop can be seen by viewing the timeline. The timeline can display different types of items depending on the input. The value of iterator is shown as graph where the x-axis represents the execution time in seconds and the y-axis represents different values for the iterator. The graph changes on changing the value of the iterator&amp;lt;ref&amp;gt;[https://www.youtube.com/watch?v=F9T551Y0mYo Timeline]&amp;lt;/ref&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
[[File:assistantpic5.png|frame|center]]&lt;br /&gt;
&lt;br /&gt;
===Error===&lt;br /&gt;
The error messages in Playground is shown as a ! icon. The details about the error can be viewed by clicking on this icon. The image below shows the error message that will be displayed if a variable declared as a string is assigned an integer value.&lt;br /&gt;
&lt;br /&gt;
[[File:swiftpic5.png|frame|center]]&lt;br /&gt;
&lt;br /&gt;
===Limitations of Playground&amp;lt;ref&amp;gt;[http://rshankar.com/xcode-6-and-playground/ Limitations of Playground]&amp;lt;/ref&amp;gt;===&lt;br /&gt;
i      Playgrounds should not be used for performance testing as logging of results will dominate the runtime. &amp;lt;br&amp;gt;&lt;br /&gt;
ii     Playground does not support On-device execution. &amp;lt;br&amp;gt;&lt;br /&gt;
iii    Does not support custom entitlements.&amp;lt;br&amp;gt;&lt;br /&gt;
iv    Playgrounds can not be used for things that require user-interactions&lt;br /&gt;
&lt;br /&gt;
===Issues in Beta Playground===&lt;br /&gt;
&lt;br /&gt;
i. There are some flaws in beta release which can harm the system of user, like erasing hard drive.&lt;br /&gt;
&lt;br /&gt;
ii. It was reported by 9to5Mac that a developer discovered that the application is not sandboxed, i.e., Swift code entered in a playground has access to the entire computer sytem. The realtime nature of Playgrounds means that you don't even have to press ENTER to start the erasing process!&amp;lt;ref name= &amp;quot;issues in beta playground&amp;quot;&amp;gt;[http://swiftlanguagetutorials.com/apple-swift-language-code-menu/apple-swift-language-faq/205-swift-language-faq-what-is-an-xcode-playground Issues in beta Playground]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Release History=&lt;br /&gt;
* On September 9th 2014, Apple published in their developer's blog that 'Swift Has Reached 1.0'.&lt;br /&gt;
* On September 15th 2014, Apple announced Xcode 6.1 beta 2.&amp;lt;ref&amp;gt;[https://developer.apple.com/news/ Apple Developer News and Updates]&amp;lt;/ref&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;font-size: 80%; text-align: center; width: auto;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
! Date&lt;br /&gt;
! Release Notes&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 6/2/2014&lt;br /&gt;
| Swift Launched&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 9/9/2014&lt;br /&gt;
| Swift 1.0&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=See Also=&lt;br /&gt;
* http://en.wikipedia.org/wiki/Xcode&lt;br /&gt;
* http://en.wikipedia.org/wiki/Swift_(programming_language)&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Vboddul</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/ch1a_13_va&amp;diff=87772</id>
		<title>CSC/ECE 517 Fall 2014/ch1a 13 va</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/ch1a_13_va&amp;diff=87772"/>
		<updated>2014-09-20T03:19:05Z</updated>

		<summary type="html">&lt;p&gt;Vboddul: /* Playgrounds with Swift in XCode v6.0 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Playgrounds with Swift in XCode v6.0''' ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;float: right; border:1px solid grey;&amp;quot;&amp;gt;&lt;br /&gt;
[[File:swift-xcode.jpg]]&lt;br /&gt;
[[File:playgrounds.png|center|Fig 1: Playgrounds with Swift in Xcode v6.0 ]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;On June 2, 2014 at the [http://en.wikipedia.org/wiki/Apple_Worldwide_Developers_Conference World Wide Developers Conference], Apple announced version 6 of Xcode. Features include Playgrounds live debugging tools, as well as an entirely new programming language called Swift. A key element of the Swift system is its ability to be cleanly debugged and run within the development environment, using a [http://en.wikipedia.org/wiki/Read–eval–print_loop read–eval–print loop (REPL)], giving it interactive properties more in common with scripting systems like Python than traditional systems programming languages. The REPL is further enhanced with the new 'playgrounds' concept; 'playgrounds' are interactive views running within the Xcode environment that respond to code or debugger changes on-the-fly. If the code in question changes over time or with regard to some other ranged input value, the view can be used with the Timeline Assistant to demonstrate the output in an animated fashion.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Apple claims that Swift &amp;quot;is the first industrial-quality systems programming language that is as expressive and enjoyable as a scripting language.&amp;quot;&amp;lt;ref name=&amp;quot;Topic&amp;quot;&amp;gt;[https://docs.google.com/a/ncsu.edu/document/d/1eq3XHiUUBIrEBx-R2Mgolaw7HttSgzPniwDLEF5oVk0/edit# Topic Document]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=Background=&lt;br /&gt;
&lt;br /&gt;
===Xcode===&lt;br /&gt;
Xcode is an [http://en.wikipedia.org/wiki/Integrated_development_environment Integrated Development Environment] (IDE) developed by Apple for developing software for iOS and OS X. The Xcode suite consists of the IDE, Apple’s developer documentation and a built-in interface builder. It is shipped free with Mac OS X 10.3, but is able to develop OS X applications that can run on any version of OS X. It extends and replaces Apple's earlier tool, Project Builder, which was inherited from [http://en.wikipedia.org/wiki/NeXT NeXT]. However, Xcode officially does not work in Mac OS X 10.2.It works hand in hand with Interface Builder (also inherited from NeXT), a graphical tool used to create user interfaces.&lt;br /&gt;
&lt;br /&gt;
Xcode includes GCC, and can compile [http://en.wikipedia.org/wiki/C C], [http://en.wikipedia.org/wiki/C%2B%2B C++], Objective C++, [http://en.wikipedia.org/wiki/java Java], and [http://en.wikipedia.org/wiki/Objective-C Objective C] source code with a variety of programming models, including but not limited to [http://en.wikipedia.org/wiki/Cocoa_(API) Cocoa], Carbon, and Java.&lt;br /&gt;
The latest Xcode version 6 includes Playgrounds which has an interactive sidebar to display the results of the code on-the-fly.&lt;br /&gt;
&lt;br /&gt;
===Swift===&lt;br /&gt;
Swift&amp;lt;ref&amp;gt;[https://developer.apple.com/swift/ Introduction to Swift]&amp;lt;/ref&amp;gt; is a new programming language that adopts safe programming patterns and makes programming flexible. Swift combines the best of both C and Objective-C. It integrates both - the procedural features like types and operators as well as the object-oriented features such as classes and protocols.  It adopts readability and dynamic object model from Objective-C and has added new features like blocks, collection literals and modules, fast performance. Swift has many advantages over Objective-C, like being more type-safe, having more natural and concise syntax, no need for header/implementation files. It has simplified memory management with [http://en.wikipedia.org/wiki/Automatic_Reference_Counting Automatic Reference Counting]. Swift is a fast and powerful programming language that is easier and more fun to implement.&lt;br /&gt;
&lt;br /&gt;
=Playgrounds=&lt;br /&gt;
Playgrounds&amp;lt;ref&amp;gt;[http://www.raywenderlich.com/74438/swift-tutorial-a-quick-start Playgrounds]&amp;lt;/ref&amp;gt; enable the interactive experience of a script language, even though Swift compiles to highly-optimized native code. Type a line of code and the result appears immediately. If your code runs over time, for instance through a loop, you can watch its progress in the Timeline assistant. The Timeline displays variables in a graph, draws each step when composing a view, and can play an animated SpriteKit scene.&lt;br /&gt;
&lt;br /&gt;
===Getting Started with Playgrounds===&lt;br /&gt;
On opening Xcode6, select &amp;quot;Get started with a Playground&amp;quot;. Default is a Hello Playgrounds program.&amp;lt;ref&amp;gt;[https://www.youtube.com/watch?v=A0C6L4XmrZM Introduction to Swift Playground]&amp;lt;/ref&amp;gt;&lt;br /&gt;
[[File: pgstart.png|frame|center]]&lt;br /&gt;
&lt;br /&gt;
Playgrounds with Swift introduce user friendly, clean code. Writing code in poetry-method has become simpler with Swift. Inclusion of packages is not necessary and heavy syntax can be ignored.&lt;br /&gt;
Creation of class is not required while writing code in Swift. Writing &amp;quot;str&amp;quot; in Swift would display the value of &amp;quot;str&amp;quot; on Playground directly.&lt;br /&gt;
Semicolons are not required at the end of each line. Datatype can be stated in the code, but it is not required as Swift implicitly assigns the datatype.&lt;br /&gt;
&lt;br /&gt;
[[File:swiftpic3.png|frame|center]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If the datatype of a variable is explicitly stated, the variable cannot be assigned a value that does not belong to its datatype. Such an assignment results in an error. Swift introduces a new keyword &amp;quot;let&amp;quot; for declaring constants. If the value of a constant declared with &amp;quot;let&amp;quot; is changed, an error is displayed.&lt;br /&gt;
While iterating through a loop in Swift, the value of the iterator is shown on the console on-the-fly.&lt;br /&gt;
&lt;br /&gt;
==More About Playgrounds==&lt;br /&gt;
Playgrounds files are used for testing and prototyping code. The results in the sidebar are displayed in black but during the modification of the code, the results temporarily change to gray during processing. ImageView can be used to display images&amp;lt;ref&amp;gt;[http://www.sitepoint.com/introduction-swift-programming-language/ More about Playground]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File: codesnippet.jpg|frame|center]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Read-Eval-Print-Loop (REPL)===&lt;br /&gt;
REPL (Read Evaluate Print Loop)&amp;lt;ref&amp;gt;[http://swiftlanguagetutorials.com/apple-swift-language-code-menu/apple-swift-language-faq/205-swift-language-faq-what-is-an-xcode-playground REPL]&amp;lt;/ref&amp;gt; is an interactive version of Swift. It is a procedure that loops in following iterations:&amp;lt;br&amp;gt;&lt;br /&gt;
''Read'':   Read is called and characters in user input are read.&amp;lt;br&amp;gt;&lt;br /&gt;
''Eval(uate)'': The input is then evaluated and returned&amp;lt;br&amp;gt;&lt;br /&gt;
''Print'': The evaluated result in printed in a textual representation for the users&amp;lt;br&amp;gt;&lt;br /&gt;
REPL in Swift enables the user to evaluate and interact with his code in a script-like environment.&lt;br /&gt;
&lt;br /&gt;
===Viewing Result===&lt;br /&gt;
To view graphical display of results, like images or strings, you can click on the Quick Look ([[File:quicklook.png|quicklook.png]] ) button. Access to Quick Look buttons can be gained by moving the pointer along the right edge of the sidebar.&amp;lt;ref&amp;gt;[https://developer.apple.com/library/ios/recipes/xcode_help-source_editor/chapters/ExploringandEvaluatingSwiftCodeinaPlayground.html  View Results in Playground]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:swift.jpg|frame|center]]&lt;br /&gt;
&lt;br /&gt;
Assistant Editor button can be used to examine values that change throughout the execution of the code.&amp;lt;br&amp;gt;&lt;br /&gt;
i.	Interim value of a code like for loop can be viewed through Value History button ([[File:history.png]]) &amp;lt;br&amp;gt;&lt;br /&gt;
ii.	Live view item can be used to view the drawing results. Live view item draws itself in response to the code.&lt;br /&gt;
&lt;br /&gt;
===Timeline===&lt;br /&gt;
The progress of results can be seen on the timeline. The time limit can also be set for the timeline to play back values. An item can be collapsed or expanded by clicking on the expression at the top of the item. An item can be removed from the timeline by clicking on the close button on the upper left corner of the item. The timeline can be closed by clicking on the close button on the Assistant Editor jump bar. It can be opened by clicking on the Assistant Editor button in the workspace toolbar or by clicking any Value History button.&lt;br /&gt;
The value of iterator in a loop can be seen by viewing the timeline. The timeline can display different types of items depending on the input. The value of iterator is shown as graph where the x-axis represents the execution time in seconds and the y-axis represents different values for the iterator. The graph changes on changing the value of the iterator&amp;lt;ref&amp;gt;[https://www.youtube.com/watch?v=F9T551Y0mYo Timeline]&amp;lt;/ref&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
[[File:assistantpic5.png|frame|center]]&lt;br /&gt;
&lt;br /&gt;
===Error===&lt;br /&gt;
The error messages in Playground is shown as a ! icon. The details about the error can be viewed by clicking on this icon. The image below shows the error message that will be displayed if a variable declared as a string is assigned an integer value.&lt;br /&gt;
&lt;br /&gt;
[[File:swiftpic5.png|frame|center]]&lt;br /&gt;
&lt;br /&gt;
===Limitations of Playground&amp;lt;ref&amp;gt;[http://rshankar.com/xcode-6-and-playground/ Limitations of Playground]&amp;lt;/ref&amp;gt;===&lt;br /&gt;
i      Playgrounds should not be used for performance testing as logging of results will dominate the runtime. &amp;lt;br&amp;gt;&lt;br /&gt;
ii     Playground does not support On-device execution. &amp;lt;br&amp;gt;&lt;br /&gt;
iii    Does not support custom entitlements.&amp;lt;br&amp;gt;&lt;br /&gt;
iv    Playgrounds can not be used for things that require user-interactions&lt;br /&gt;
&lt;br /&gt;
===Issues in Beta Playground===&lt;br /&gt;
&lt;br /&gt;
i. There are some flaws in beta release which can harm the system of user, like erasing hard drive.&lt;br /&gt;
&lt;br /&gt;
ii. It was reported by 9to5Mac that a developer discovered that the application is not sandboxed, i.e., Swift code entered in a playground has access to the entire computer sytem. The realtime nature of Playgrounds means that you don't even have to press ENTER to start the erasing process!&amp;lt;ref name= &amp;quot;issues in beta playground&amp;quot;&amp;gt;[http://swiftlanguagetutorials.com/apple-swift-language-code-menu/apple-swift-language-faq/205-swift-language-faq-what-is-an-xcode-playground Issues in beta Playground]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Recent Updates=&lt;br /&gt;
* On September 9th 2014, Apple published in their developer's blog that 'Swift Has Reached 1.0'.&lt;br /&gt;
* On September 15th 2014, Apple announced Xcode 6.1 beta 2.&amp;lt;ref&amp;gt;[https://developer.apple.com/news/ Apple Developer News and Updates]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=See Also=&lt;br /&gt;
* http://en.wikipedia.org/wiki/Xcode&lt;br /&gt;
* http://en.wikipedia.org/wiki/Swift_(programming_language)&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Vboddul</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/ch1a_13_va&amp;diff=87771</id>
		<title>CSC/ECE 517 Fall 2014/ch1a 13 va</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/ch1a_13_va&amp;diff=87771"/>
		<updated>2014-09-20T03:18:40Z</updated>

		<summary type="html">&lt;p&gt;Vboddul: /* Playgrounds with Swift in XCode v6.0 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Playgrounds with Swift in XCode v6.0''' ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;float: right; border:1px solid grey;&amp;quot;&amp;gt;&lt;br /&gt;
[[File:swift-xcode.jpg]]&lt;br /&gt;
[[File:playgrounds.png|center|Fig 1: Playgrounds with Swift in Xcode v6.0 ]]&lt;br /&gt;
Playgrounds with Swift in XCode&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;On June 2, 2014 at the [http://en.wikipedia.org/wiki/Apple_Worldwide_Developers_Conference World Wide Developers Conference], Apple announced version 6 of Xcode. Features include Playgrounds live debugging tools, as well as an entirely new programming language called Swift. A key element of the Swift system is its ability to be cleanly debugged and run within the development environment, using a [http://en.wikipedia.org/wiki/Read–eval–print_loop read–eval–print loop (REPL)], giving it interactive properties more in common with scripting systems like Python than traditional systems programming languages. The REPL is further enhanced with the new 'playgrounds' concept; 'playgrounds' are interactive views running within the Xcode environment that respond to code or debugger changes on-the-fly. If the code in question changes over time or with regard to some other ranged input value, the view can be used with the Timeline Assistant to demonstrate the output in an animated fashion.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Apple claims that Swift &amp;quot;is the first industrial-quality systems programming language that is as expressive and enjoyable as a scripting language.&amp;quot;&amp;lt;ref name=&amp;quot;Topic&amp;quot;&amp;gt;[https://docs.google.com/a/ncsu.edu/document/d/1eq3XHiUUBIrEBx-R2Mgolaw7HttSgzPniwDLEF5oVk0/edit# Topic Document]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=Background=&lt;br /&gt;
&lt;br /&gt;
===Xcode===&lt;br /&gt;
Xcode is an [http://en.wikipedia.org/wiki/Integrated_development_environment Integrated Development Environment] (IDE) developed by Apple for developing software for iOS and OS X. The Xcode suite consists of the IDE, Apple’s developer documentation and a built-in interface builder. It is shipped free with Mac OS X 10.3, but is able to develop OS X applications that can run on any version of OS X. It extends and replaces Apple's earlier tool, Project Builder, which was inherited from [http://en.wikipedia.org/wiki/NeXT NeXT]. However, Xcode officially does not work in Mac OS X 10.2.It works hand in hand with Interface Builder (also inherited from NeXT), a graphical tool used to create user interfaces.&lt;br /&gt;
&lt;br /&gt;
Xcode includes GCC, and can compile [http://en.wikipedia.org/wiki/C C], [http://en.wikipedia.org/wiki/C%2B%2B C++], Objective C++, [http://en.wikipedia.org/wiki/java Java], and [http://en.wikipedia.org/wiki/Objective-C Objective C] source code with a variety of programming models, including but not limited to [http://en.wikipedia.org/wiki/Cocoa_(API) Cocoa], Carbon, and Java.&lt;br /&gt;
The latest Xcode version 6 includes Playgrounds which has an interactive sidebar to display the results of the code on-the-fly.&lt;br /&gt;
&lt;br /&gt;
===Swift===&lt;br /&gt;
Swift&amp;lt;ref&amp;gt;[https://developer.apple.com/swift/ Introduction to Swift]&amp;lt;/ref&amp;gt; is a new programming language that adopts safe programming patterns and makes programming flexible. Swift combines the best of both C and Objective-C. It integrates both - the procedural features like types and operators as well as the object-oriented features such as classes and protocols.  It adopts readability and dynamic object model from Objective-C and has added new features like blocks, collection literals and modules, fast performance. Swift has many advantages over Objective-C, like being more type-safe, having more natural and concise syntax, no need for header/implementation files. It has simplified memory management with [http://en.wikipedia.org/wiki/Automatic_Reference_Counting Automatic Reference Counting]. Swift is a fast and powerful programming language that is easier and more fun to implement.&lt;br /&gt;
&lt;br /&gt;
=Playgrounds=&lt;br /&gt;
Playgrounds&amp;lt;ref&amp;gt;[http://www.raywenderlich.com/74438/swift-tutorial-a-quick-start Playgrounds]&amp;lt;/ref&amp;gt; enable the interactive experience of a script language, even though Swift compiles to highly-optimized native code. Type a line of code and the result appears immediately. If your code runs over time, for instance through a loop, you can watch its progress in the Timeline assistant. The Timeline displays variables in a graph, draws each step when composing a view, and can play an animated SpriteKit scene.&lt;br /&gt;
&lt;br /&gt;
===Getting Started with Playgrounds===&lt;br /&gt;
On opening Xcode6, select &amp;quot;Get started with a Playground&amp;quot;. Default is a Hello Playgrounds program.&amp;lt;ref&amp;gt;[https://www.youtube.com/watch?v=A0C6L4XmrZM Introduction to Swift Playground]&amp;lt;/ref&amp;gt;&lt;br /&gt;
[[File: pgstart.png|frame|center]]&lt;br /&gt;
&lt;br /&gt;
Playgrounds with Swift introduce user friendly, clean code. Writing code in poetry-method has become simpler with Swift. Inclusion of packages is not necessary and heavy syntax can be ignored.&lt;br /&gt;
Creation of class is not required while writing code in Swift. Writing &amp;quot;str&amp;quot; in Swift would display the value of &amp;quot;str&amp;quot; on Playground directly.&lt;br /&gt;
Semicolons are not required at the end of each line. Datatype can be stated in the code, but it is not required as Swift implicitly assigns the datatype.&lt;br /&gt;
&lt;br /&gt;
[[File:swiftpic3.png|frame|center]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If the datatype of a variable is explicitly stated, the variable cannot be assigned a value that does not belong to its datatype. Such an assignment results in an error. Swift introduces a new keyword &amp;quot;let&amp;quot; for declaring constants. If the value of a constant declared with &amp;quot;let&amp;quot; is changed, an error is displayed.&lt;br /&gt;
While iterating through a loop in Swift, the value of the iterator is shown on the console on-the-fly.&lt;br /&gt;
&lt;br /&gt;
==More About Playgrounds==&lt;br /&gt;
Playgrounds files are used for testing and prototyping code. The results in the sidebar are displayed in black but during the modification of the code, the results temporarily change to gray during processing. ImageView can be used to display images&amp;lt;ref&amp;gt;[http://www.sitepoint.com/introduction-swift-programming-language/ More about Playground]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File: codesnippet.jpg|frame|center]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Read-Eval-Print-Loop (REPL)===&lt;br /&gt;
REPL (Read Evaluate Print Loop)&amp;lt;ref&amp;gt;[http://swiftlanguagetutorials.com/apple-swift-language-code-menu/apple-swift-language-faq/205-swift-language-faq-what-is-an-xcode-playground REPL]&amp;lt;/ref&amp;gt; is an interactive version of Swift. It is a procedure that loops in following iterations:&amp;lt;br&amp;gt;&lt;br /&gt;
''Read'':   Read is called and characters in user input are read.&amp;lt;br&amp;gt;&lt;br /&gt;
''Eval(uate)'': The input is then evaluated and returned&amp;lt;br&amp;gt;&lt;br /&gt;
''Print'': The evaluated result in printed in a textual representation for the users&amp;lt;br&amp;gt;&lt;br /&gt;
REPL in Swift enables the user to evaluate and interact with his code in a script-like environment.&lt;br /&gt;
&lt;br /&gt;
===Viewing Result===&lt;br /&gt;
To view graphical display of results, like images or strings, you can click on the Quick Look ([[File:quicklook.png|quicklook.png]] ) button. Access to Quick Look buttons can be gained by moving the pointer along the right edge of the sidebar.&amp;lt;ref&amp;gt;[https://developer.apple.com/library/ios/recipes/xcode_help-source_editor/chapters/ExploringandEvaluatingSwiftCodeinaPlayground.html  View Results in Playground]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:swift.jpg|frame|center]]&lt;br /&gt;
&lt;br /&gt;
Assistant Editor button can be used to examine values that change throughout the execution of the code.&amp;lt;br&amp;gt;&lt;br /&gt;
i.	Interim value of a code like for loop can be viewed through Value History button ([[File:history.png]]) &amp;lt;br&amp;gt;&lt;br /&gt;
ii.	Live view item can be used to view the drawing results. Live view item draws itself in response to the code.&lt;br /&gt;
&lt;br /&gt;
===Timeline===&lt;br /&gt;
The progress of results can be seen on the timeline. The time limit can also be set for the timeline to play back values. An item can be collapsed or expanded by clicking on the expression at the top of the item. An item can be removed from the timeline by clicking on the close button on the upper left corner of the item. The timeline can be closed by clicking on the close button on the Assistant Editor jump bar. It can be opened by clicking on the Assistant Editor button in the workspace toolbar or by clicking any Value History button.&lt;br /&gt;
The value of iterator in a loop can be seen by viewing the timeline. The timeline can display different types of items depending on the input. The value of iterator is shown as graph where the x-axis represents the execution time in seconds and the y-axis represents different values for the iterator. The graph changes on changing the value of the iterator&amp;lt;ref&amp;gt;[https://www.youtube.com/watch?v=F9T551Y0mYo Timeline]&amp;lt;/ref&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
[[File:assistantpic5.png|frame|center]]&lt;br /&gt;
&lt;br /&gt;
===Error===&lt;br /&gt;
The error messages in Playground is shown as a ! icon. The details about the error can be viewed by clicking on this icon. The image below shows the error message that will be displayed if a variable declared as a string is assigned an integer value.&lt;br /&gt;
&lt;br /&gt;
[[File:swiftpic5.png|frame|center]]&lt;br /&gt;
&lt;br /&gt;
===Limitations of Playground&amp;lt;ref&amp;gt;[http://rshankar.com/xcode-6-and-playground/ Limitations of Playground]&amp;lt;/ref&amp;gt;===&lt;br /&gt;
i      Playgrounds should not be used for performance testing as logging of results will dominate the runtime. &amp;lt;br&amp;gt;&lt;br /&gt;
ii     Playground does not support On-device execution. &amp;lt;br&amp;gt;&lt;br /&gt;
iii    Does not support custom entitlements.&amp;lt;br&amp;gt;&lt;br /&gt;
iv    Playgrounds can not be used for things that require user-interactions&lt;br /&gt;
&lt;br /&gt;
===Issues in Beta Playground===&lt;br /&gt;
&lt;br /&gt;
i. There are some flaws in beta release which can harm the system of user, like erasing hard drive.&lt;br /&gt;
&lt;br /&gt;
ii. It was reported by 9to5Mac that a developer discovered that the application is not sandboxed, i.e., Swift code entered in a playground has access to the entire computer sytem. The realtime nature of Playgrounds means that you don't even have to press ENTER to start the erasing process!&amp;lt;ref name= &amp;quot;issues in beta playground&amp;quot;&amp;gt;[http://swiftlanguagetutorials.com/apple-swift-language-code-menu/apple-swift-language-faq/205-swift-language-faq-what-is-an-xcode-playground Issues in beta Playground]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Recent Updates=&lt;br /&gt;
* On September 9th 2014, Apple published in their developer's blog that 'Swift Has Reached 1.0'.&lt;br /&gt;
* On September 15th 2014, Apple announced Xcode 6.1 beta 2.&amp;lt;ref&amp;gt;[https://developer.apple.com/news/ Apple Developer News and Updates]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=See Also=&lt;br /&gt;
* http://en.wikipedia.org/wiki/Xcode&lt;br /&gt;
* http://en.wikipedia.org/wiki/Swift_(programming_language)&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Vboddul</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/ch1a_13_va&amp;diff=87764</id>
		<title>CSC/ECE 517 Fall 2014/ch1a 13 va</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/ch1a_13_va&amp;diff=87764"/>
		<updated>2014-09-20T03:16:53Z</updated>

		<summary type="html">&lt;p&gt;Vboddul: /* References */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Playgrounds with Swift in XCode v6.0''' ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;float: right; border:1px solid grey;&amp;quot;&amp;gt;&lt;br /&gt;
[[File:swift-xcode.jpg]]&lt;br /&gt;
[[File:playgrounds.png|center|Fig 1: Playgrounds with Swift in Xcode v6.0 ]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;On June 2, 2014 at the [http://en.wikipedia.org/wiki/Apple_Worldwide_Developers_Conference World Wide Developers Conference], Apple announced version 6 of Xcode. Features include Playgrounds live debugging tools, as well as an entirely new programming language called Swift. A key element of the Swift system is its ability to be cleanly debugged and run within the development environment, using a [http://en.wikipedia.org/wiki/Read–eval–print_loop read–eval–print loop (REPL)], giving it interactive properties more in common with scripting systems like Python than traditional systems programming languages. The REPL is further enhanced with the new 'playgrounds' concept; 'playgrounds' are interactive views running within the Xcode environment that respond to code or debugger changes on-the-fly. If the code in question changes over time or with regard to some other ranged input value, the view can be used with the Timeline Assistant to demonstrate the output in an animated fashion.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Apple claims that Swift &amp;quot;is the first industrial-quality systems programming language that is as expressive and enjoyable as a scripting language.&amp;quot;&amp;lt;ref name=&amp;quot;Topic&amp;quot;&amp;gt;[https://docs.google.com/a/ncsu.edu/document/d/1eq3XHiUUBIrEBx-R2Mgolaw7HttSgzPniwDLEF5oVk0/edit# Topic Document]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=Background=&lt;br /&gt;
&lt;br /&gt;
===Xcode===&lt;br /&gt;
Xcode is an [http://en.wikipedia.org/wiki/Integrated_development_environment Integrated Development Environment] (IDE) developed by Apple for developing software for iOS and OS X. The Xcode suite consists of the IDE, Apple’s developer documentation and a built-in interface builder. It is shipped free with Mac OS X 10.3, but is able to develop OS X applications that can run on any version of OS X. It extends and replaces Apple's earlier tool, Project Builder, which was inherited from [http://en.wikipedia.org/wiki/NeXT NeXT]. However, Xcode officially does not work in Mac OS X 10.2.It works hand in hand with Interface Builder (also inherited from NeXT), a graphical tool used to create user interfaces.&lt;br /&gt;
&lt;br /&gt;
Xcode includes GCC, and can compile [http://en.wikipedia.org/wiki/C C], [http://en.wikipedia.org/wiki/C%2B%2B C++], Objective C++, [http://en.wikipedia.org/wiki/java Java], and [http://en.wikipedia.org/wiki/Objective-C Objective C] source code with a variety of programming models, including but not limited to [http://en.wikipedia.org/wiki/Cocoa_(API) Cocoa], Carbon, and Java.&lt;br /&gt;
The latest Xcode version 6 includes Playgrounds which has an interactive sidebar to display the results of the code on-the-fly.&lt;br /&gt;
&lt;br /&gt;
===Swift===&lt;br /&gt;
Swift&amp;lt;ref&amp;gt;[https://developer.apple.com/swift/ Introduction to Swift]&amp;lt;/ref&amp;gt; is a new programming language that adopts safe programming patterns and makes programming flexible. Swift combines the best of both C and Objective-C. It integrates both - the procedural features like types and operators as well as the object-oriented features such as classes and protocols.  It adopts readability and dynamic object model from Objective-C and has added new features like blocks, collection literals and modules, fast performance. Swift has many advantages over Objective-C, like being more type-safe, having more natural and concise syntax, no need for header/implementation files. It has simplified memory management with [http://en.wikipedia.org/wiki/Automatic_Reference_Counting Automatic Reference Counting]. Swift is a fast and powerful programming language that is easier and more fun to implement.&lt;br /&gt;
&lt;br /&gt;
=Playgrounds=&lt;br /&gt;
Playgrounds&amp;lt;ref&amp;gt;[http://www.raywenderlich.com/74438/swift-tutorial-a-quick-start Playgrounds]&amp;lt;/ref&amp;gt; enable the interactive experience of a script language, even though Swift compiles to highly-optimized native code. Type a line of code and the result appears immediately. If your code runs over time, for instance through a loop, you can watch its progress in the Timeline assistant. The Timeline displays variables in a graph, draws each step when composing a view, and can play an animated SpriteKit scene.&lt;br /&gt;
&lt;br /&gt;
===Getting Started with Playgrounds===&lt;br /&gt;
On opening Xcode6, select &amp;quot;Get started with a Playground&amp;quot;. Default is a Hello Playgrounds program.&amp;lt;ref&amp;gt;[https://www.youtube.com/watch?v=A0C6L4XmrZM Introduction to Swift Playground]&amp;lt;/ref&amp;gt;&lt;br /&gt;
[[File: pgstart.png|frame|center]]&lt;br /&gt;
&lt;br /&gt;
Playgrounds with Swift introduce user friendly, clean code. Writing code in poetry-method has become simpler with Swift. Inclusion of packages is not necessary and heavy syntax can be ignored.&lt;br /&gt;
Creation of class is not required while writing code in Swift. Writing &amp;quot;str&amp;quot; in Swift would display the value of &amp;quot;str&amp;quot; on Playground directly.&lt;br /&gt;
Semicolons are not required at the end of each line. Datatype can be stated in the code, but it is not required as Swift implicitly assigns the datatype.&lt;br /&gt;
&lt;br /&gt;
[[File:swiftpic3.png|frame|center]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If the datatype of a variable is explicitly stated, the variable cannot be assigned a value that does not belong to its datatype. Such an assignment results in an error. Swift introduces a new keyword &amp;quot;let&amp;quot; for declaring constants. If the value of a constant declared with &amp;quot;let&amp;quot; is changed, an error is displayed.&lt;br /&gt;
While iterating through a loop in Swift, the value of the iterator is shown on the console on-the-fly.&lt;br /&gt;
&lt;br /&gt;
==More About Playgrounds==&lt;br /&gt;
Playgrounds files are used for testing and prototyping code. The results in the sidebar are displayed in black but during the modification of the code, the results temporarily change to gray during processing. ImageView can be used to display images&amp;lt;ref&amp;gt;[http://www.sitepoint.com/introduction-swift-programming-language/ More about Playground]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File: codesnippet.jpg|frame|center]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Read-Eval-Print-Loop (REPL)===&lt;br /&gt;
REPL (Read Evaluate Print Loop)&amp;lt;ref&amp;gt;[http://swiftlanguagetutorials.com/apple-swift-language-code-menu/apple-swift-language-faq/205-swift-language-faq-what-is-an-xcode-playground REPL]&amp;lt;/ref&amp;gt; is an interactive version of Swift. It is a procedure that loops in following iterations:&amp;lt;br&amp;gt;&lt;br /&gt;
''Read'':   Read is called and characters in user input are read.&amp;lt;br&amp;gt;&lt;br /&gt;
''Eval(uate)'': The input is then evaluated and returned&amp;lt;br&amp;gt;&lt;br /&gt;
''Print'': The evaluated result in printed in a textual representation for the users&amp;lt;br&amp;gt;&lt;br /&gt;
REPL in Swift enables the user to evaluate and interact with his code in a script-like environment.&lt;br /&gt;
&lt;br /&gt;
===Viewing Result===&lt;br /&gt;
To view graphical display of results, like images or strings, you can click on the Quick Look ([[File:quicklook.png|quicklook.png]] ) button. Access to Quick Look buttons can be gained by moving the pointer along the right edge of the sidebar.&amp;lt;ref&amp;gt;[https://developer.apple.com/library/ios/recipes/xcode_help-source_editor/chapters/ExploringandEvaluatingSwiftCodeinaPlayground.html  View Results in Playground]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:swift.jpg|frame|center]]&lt;br /&gt;
&lt;br /&gt;
Assistant Editor button can be used to examine values that change throughout the execution of the code.&amp;lt;br&amp;gt;&lt;br /&gt;
i.	Interim value of a code like for loop can be viewed through Value History button ([[File:history.png]]) &amp;lt;br&amp;gt;&lt;br /&gt;
ii.	Live view item can be used to view the drawing results. Live view item draws itself in response to the code.&lt;br /&gt;
&lt;br /&gt;
===Timeline===&lt;br /&gt;
The progress of results can be seen on the timeline. The time limit can also be set for the timeline to play back values. An item can be collapsed or expanded by clicking on the expression at the top of the item. An item can be removed from the timeline by clicking on the close button on the upper left corner of the item. The timeline can be closed by clicking on the close button on the Assistant Editor jump bar. It can be opened by clicking on the Assistant Editor button in the workspace toolbar or by clicking any Value History button.&lt;br /&gt;
The value of iterator in a loop can be seen by viewing the timeline. The timeline can display different types of items depending on the input. The value of iterator is shown as graph where the x-axis represents the execution time in seconds and the y-axis represents different values for the iterator. The graph changes on changing the value of the iterator&amp;lt;ref&amp;gt;[https://www.youtube.com/watch?v=F9T551Y0mYo Timeline]&amp;lt;/ref&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
[[File:assistantpic5.png|frame|center]]&lt;br /&gt;
&lt;br /&gt;
===Error===&lt;br /&gt;
The error messages in Playground is shown as a ! icon. The details about the error can be viewed by clicking on this icon. The image below shows the error message that will be displayed if a variable declared as a string is assigned an integer value.&lt;br /&gt;
&lt;br /&gt;
[[File:swiftpic5.png|frame|center]]&lt;br /&gt;
&lt;br /&gt;
===Limitations of Playground&amp;lt;ref&amp;gt;[http://rshankar.com/xcode-6-and-playground/ Limitations of Playground]&amp;lt;/ref&amp;gt;===&lt;br /&gt;
i      Playgrounds should not be used for performance testing as logging of results will dominate the runtime. &amp;lt;br&amp;gt;&lt;br /&gt;
ii     Playground does not support On-device execution. &amp;lt;br&amp;gt;&lt;br /&gt;
iii    Does not support custom entitlements.&amp;lt;br&amp;gt;&lt;br /&gt;
iv    Playgrounds can not be used for things that require user-interactions&lt;br /&gt;
&lt;br /&gt;
===Issues in Beta Playground===&lt;br /&gt;
&lt;br /&gt;
i. There are some flaws in beta release which can harm the system of user, like erasing hard drive.&lt;br /&gt;
&lt;br /&gt;
ii. It was reported by 9to5Mac that a developer discovered that the application is not sandboxed, i.e., Swift code entered in a playground has access to the entire computer sytem. The realtime nature of Playgrounds means that you don't even have to press ENTER to start the erasing process!&amp;lt;ref name= &amp;quot;issues in beta playground&amp;quot;&amp;gt;[http://swiftlanguagetutorials.com/apple-swift-language-code-menu/apple-swift-language-faq/205-swift-language-faq-what-is-an-xcode-playground Issues in beta Playground]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Recent Updates=&lt;br /&gt;
* On September 9th 2014, Apple published in their developer's blog that 'Swift Has Reached 1.0'.&lt;br /&gt;
* On September 15th 2014, Apple announced Xcode 6.1 beta 2.&amp;lt;ref&amp;gt;[https://developer.apple.com/news/ Apple Developer News and Updates]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=See Also=&lt;br /&gt;
* http://en.wikipedia.org/wiki/Xcode&lt;br /&gt;
* http://en.wikipedia.org/wiki/Swift_(programming_language)&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Vboddul</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/ch1a_13_va&amp;diff=87762</id>
		<title>CSC/ECE 517 Fall 2014/ch1a 13 va</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/ch1a_13_va&amp;diff=87762"/>
		<updated>2014-09-20T03:16:36Z</updated>

		<summary type="html">&lt;p&gt;Vboddul: /* More About Playgrounds */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Playgrounds with Swift in XCode v6.0''' ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;float: right; border:1px solid grey;&amp;quot;&amp;gt;&lt;br /&gt;
[[File:swift-xcode.jpg]]&lt;br /&gt;
[[File:playgrounds.png|center|Fig 1: Playgrounds with Swift in Xcode v6.0 ]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;On June 2, 2014 at the [http://en.wikipedia.org/wiki/Apple_Worldwide_Developers_Conference World Wide Developers Conference], Apple announced version 6 of Xcode. Features include Playgrounds live debugging tools, as well as an entirely new programming language called Swift. A key element of the Swift system is its ability to be cleanly debugged and run within the development environment, using a [http://en.wikipedia.org/wiki/Read–eval–print_loop read–eval–print loop (REPL)], giving it interactive properties more in common with scripting systems like Python than traditional systems programming languages. The REPL is further enhanced with the new 'playgrounds' concept; 'playgrounds' are interactive views running within the Xcode environment that respond to code or debugger changes on-the-fly. If the code in question changes over time or with regard to some other ranged input value, the view can be used with the Timeline Assistant to demonstrate the output in an animated fashion.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Apple claims that Swift &amp;quot;is the first industrial-quality systems programming language that is as expressive and enjoyable as a scripting language.&amp;quot;&amp;lt;ref name=&amp;quot;Topic&amp;quot;&amp;gt;[https://docs.google.com/a/ncsu.edu/document/d/1eq3XHiUUBIrEBx-R2Mgolaw7HttSgzPniwDLEF5oVk0/edit# Topic Document]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=Background=&lt;br /&gt;
&lt;br /&gt;
===Xcode===&lt;br /&gt;
Xcode is an [http://en.wikipedia.org/wiki/Integrated_development_environment Integrated Development Environment] (IDE) developed by Apple for developing software for iOS and OS X. The Xcode suite consists of the IDE, Apple’s developer documentation and a built-in interface builder. It is shipped free with Mac OS X 10.3, but is able to develop OS X applications that can run on any version of OS X. It extends and replaces Apple's earlier tool, Project Builder, which was inherited from [http://en.wikipedia.org/wiki/NeXT NeXT]. However, Xcode officially does not work in Mac OS X 10.2.It works hand in hand with Interface Builder (also inherited from NeXT), a graphical tool used to create user interfaces.&lt;br /&gt;
&lt;br /&gt;
Xcode includes GCC, and can compile [http://en.wikipedia.org/wiki/C C], [http://en.wikipedia.org/wiki/C%2B%2B C++], Objective C++, [http://en.wikipedia.org/wiki/java Java], and [http://en.wikipedia.org/wiki/Objective-C Objective C] source code with a variety of programming models, including but not limited to [http://en.wikipedia.org/wiki/Cocoa_(API) Cocoa], Carbon, and Java.&lt;br /&gt;
The latest Xcode version 6 includes Playgrounds which has an interactive sidebar to display the results of the code on-the-fly.&lt;br /&gt;
&lt;br /&gt;
===Swift===&lt;br /&gt;
Swift&amp;lt;ref&amp;gt;[https://developer.apple.com/swift/ Introduction to Swift]&amp;lt;/ref&amp;gt; is a new programming language that adopts safe programming patterns and makes programming flexible. Swift combines the best of both C and Objective-C. It integrates both - the procedural features like types and operators as well as the object-oriented features such as classes and protocols.  It adopts readability and dynamic object model from Objective-C and has added new features like blocks, collection literals and modules, fast performance. Swift has many advantages over Objective-C, like being more type-safe, having more natural and concise syntax, no need for header/implementation files. It has simplified memory management with [http://en.wikipedia.org/wiki/Automatic_Reference_Counting Automatic Reference Counting]. Swift is a fast and powerful programming language that is easier and more fun to implement.&lt;br /&gt;
&lt;br /&gt;
=Playgrounds=&lt;br /&gt;
Playgrounds&amp;lt;ref&amp;gt;[http://www.raywenderlich.com/74438/swift-tutorial-a-quick-start Playgrounds]&amp;lt;/ref&amp;gt; enable the interactive experience of a script language, even though Swift compiles to highly-optimized native code. Type a line of code and the result appears immediately. If your code runs over time, for instance through a loop, you can watch its progress in the Timeline assistant. The Timeline displays variables in a graph, draws each step when composing a view, and can play an animated SpriteKit scene.&lt;br /&gt;
&lt;br /&gt;
===Getting Started with Playgrounds===&lt;br /&gt;
On opening Xcode6, select &amp;quot;Get started with a Playground&amp;quot;. Default is a Hello Playgrounds program.&amp;lt;ref&amp;gt;[https://www.youtube.com/watch?v=A0C6L4XmrZM Introduction to Swift Playground]&amp;lt;/ref&amp;gt;&lt;br /&gt;
[[File: pgstart.png|frame|center]]&lt;br /&gt;
&lt;br /&gt;
Playgrounds with Swift introduce user friendly, clean code. Writing code in poetry-method has become simpler with Swift. Inclusion of packages is not necessary and heavy syntax can be ignored.&lt;br /&gt;
Creation of class is not required while writing code in Swift. Writing &amp;quot;str&amp;quot; in Swift would display the value of &amp;quot;str&amp;quot; on Playground directly.&lt;br /&gt;
Semicolons are not required at the end of each line. Datatype can be stated in the code, but it is not required as Swift implicitly assigns the datatype.&lt;br /&gt;
&lt;br /&gt;
[[File:swiftpic3.png|frame|center]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If the datatype of a variable is explicitly stated, the variable cannot be assigned a value that does not belong to its datatype. Such an assignment results in an error. Swift introduces a new keyword &amp;quot;let&amp;quot; for declaring constants. If the value of a constant declared with &amp;quot;let&amp;quot; is changed, an error is displayed.&lt;br /&gt;
While iterating through a loop in Swift, the value of the iterator is shown on the console on-the-fly.&lt;br /&gt;
&lt;br /&gt;
==More About Playgrounds==&lt;br /&gt;
Playgrounds files are used for testing and prototyping code. The results in the sidebar are displayed in black but during the modification of the code, the results temporarily change to gray during processing. ImageView can be used to display images&amp;lt;ref&amp;gt;[http://www.sitepoint.com/introduction-swift-programming-language/ More about Playground]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File: codesnippet.jpg|frame|center]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Read-Eval-Print-Loop (REPL)===&lt;br /&gt;
REPL (Read Evaluate Print Loop)&amp;lt;ref&amp;gt;[http://swiftlanguagetutorials.com/apple-swift-language-code-menu/apple-swift-language-faq/205-swift-language-faq-what-is-an-xcode-playground REPL]&amp;lt;/ref&amp;gt; is an interactive version of Swift. It is a procedure that loops in following iterations:&amp;lt;br&amp;gt;&lt;br /&gt;
''Read'':   Read is called and characters in user input are read.&amp;lt;br&amp;gt;&lt;br /&gt;
''Eval(uate)'': The input is then evaluated and returned&amp;lt;br&amp;gt;&lt;br /&gt;
''Print'': The evaluated result in printed in a textual representation for the users&amp;lt;br&amp;gt;&lt;br /&gt;
REPL in Swift enables the user to evaluate and interact with his code in a script-like environment.&lt;br /&gt;
&lt;br /&gt;
===Viewing Result===&lt;br /&gt;
To view graphical display of results, like images or strings, you can click on the Quick Look ([[File:quicklook.png|quicklook.png]] ) button. Access to Quick Look buttons can be gained by moving the pointer along the right edge of the sidebar.&amp;lt;ref&amp;gt;[https://developer.apple.com/library/ios/recipes/xcode_help-source_editor/chapters/ExploringandEvaluatingSwiftCodeinaPlayground.html  View Results in Playground]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:swift.jpg|frame|center]]&lt;br /&gt;
&lt;br /&gt;
Assistant Editor button can be used to examine values that change throughout the execution of the code.&amp;lt;br&amp;gt;&lt;br /&gt;
i.	Interim value of a code like for loop can be viewed through Value History button ([[File:history.png]]) &amp;lt;br&amp;gt;&lt;br /&gt;
ii.	Live view item can be used to view the drawing results. Live view item draws itself in response to the code.&lt;br /&gt;
&lt;br /&gt;
===Timeline===&lt;br /&gt;
The progress of results can be seen on the timeline. The time limit can also be set for the timeline to play back values. An item can be collapsed or expanded by clicking on the expression at the top of the item. An item can be removed from the timeline by clicking on the close button on the upper left corner of the item. The timeline can be closed by clicking on the close button on the Assistant Editor jump bar. It can be opened by clicking on the Assistant Editor button in the workspace toolbar or by clicking any Value History button.&lt;br /&gt;
The value of iterator in a loop can be seen by viewing the timeline. The timeline can display different types of items depending on the input. The value of iterator is shown as graph where the x-axis represents the execution time in seconds and the y-axis represents different values for the iterator. The graph changes on changing the value of the iterator&amp;lt;ref&amp;gt;[https://www.youtube.com/watch?v=F9T551Y0mYo Timeline]&amp;lt;/ref&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
[[File:assistantpic5.png|frame|center]]&lt;br /&gt;
&lt;br /&gt;
===Error===&lt;br /&gt;
The error messages in Playground is shown as a ! icon. The details about the error can be viewed by clicking on this icon. The image below shows the error message that will be displayed if a variable declared as a string is assigned an integer value.&lt;br /&gt;
&lt;br /&gt;
[[File:swiftpic5.png|frame|center]]&lt;br /&gt;
&lt;br /&gt;
===Limitations of Playground&amp;lt;ref&amp;gt;[http://rshankar.com/xcode-6-and-playground/ Limitations of Playground]&amp;lt;/ref&amp;gt;===&lt;br /&gt;
i      Playgrounds should not be used for performance testing as logging of results will dominate the runtime. &amp;lt;br&amp;gt;&lt;br /&gt;
ii     Playground does not support On-device execution. &amp;lt;br&amp;gt;&lt;br /&gt;
iii    Does not support custom entitlements.&amp;lt;br&amp;gt;&lt;br /&gt;
iv    Playgrounds can not be used for things that require user-interactions&lt;br /&gt;
&lt;br /&gt;
===Issues in Beta Playground===&lt;br /&gt;
&lt;br /&gt;
i. There are some flaws in beta release which can harm the system of user, like erasing hard drive.&lt;br /&gt;
&lt;br /&gt;
ii. It was reported by 9to5Mac that a developer discovered that the application is not sandboxed, i.e., Swift code entered in a playground has access to the entire computer sytem. The realtime nature of Playgrounds means that you don't even have to press ENTER to start the erasing process!&amp;lt;ref name= &amp;quot;issues in beta playground&amp;quot;&amp;gt;[http://swiftlanguagetutorials.com/apple-swift-language-code-menu/apple-swift-language-faq/205-swift-language-faq-what-is-an-xcode-playground Issues in beta Playground]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Recent Updates=&lt;br /&gt;
* On September 9th 2014, Apple published in their developer's blog that 'Swift Has Reached 1.0'.&lt;br /&gt;
* On September 15th 2014, Apple announced Xcode 6.1 beta 2.&amp;lt;ref&amp;gt;[https://developer.apple.com/news/ Apple Developer News and Updates]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=See Also=&lt;br /&gt;
* http://en.wikipedia.org/wiki/Xcode&lt;br /&gt;
* http://en.wikipedia.org/wiki/Swift_(programming_language)&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
* http://www.sitepoint.com/introduction-swift-programming-language/&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Vboddul</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/ch1a_13_va&amp;diff=87760</id>
		<title>CSC/ECE 517 Fall 2014/ch1a 13 va</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/ch1a_13_va&amp;diff=87760"/>
		<updated>2014-09-20T03:15:19Z</updated>

		<summary type="html">&lt;p&gt;Vboddul: /* References */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Playgrounds with Swift in XCode v6.0''' ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;float: right; border:1px solid grey;&amp;quot;&amp;gt;&lt;br /&gt;
[[File:swift-xcode.jpg]]&lt;br /&gt;
[[File:playgrounds.png|center|Fig 1: Playgrounds with Swift in Xcode v6.0 ]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;On June 2, 2014 at the [http://en.wikipedia.org/wiki/Apple_Worldwide_Developers_Conference World Wide Developers Conference], Apple announced version 6 of Xcode. Features include Playgrounds live debugging tools, as well as an entirely new programming language called Swift. A key element of the Swift system is its ability to be cleanly debugged and run within the development environment, using a [http://en.wikipedia.org/wiki/Read–eval–print_loop read–eval–print loop (REPL)], giving it interactive properties more in common with scripting systems like Python than traditional systems programming languages. The REPL is further enhanced with the new 'playgrounds' concept; 'playgrounds' are interactive views running within the Xcode environment that respond to code or debugger changes on-the-fly. If the code in question changes over time or with regard to some other ranged input value, the view can be used with the Timeline Assistant to demonstrate the output in an animated fashion.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Apple claims that Swift &amp;quot;is the first industrial-quality systems programming language that is as expressive and enjoyable as a scripting language.&amp;quot;&amp;lt;ref name=&amp;quot;Topic&amp;quot;&amp;gt;[https://docs.google.com/a/ncsu.edu/document/d/1eq3XHiUUBIrEBx-R2Mgolaw7HttSgzPniwDLEF5oVk0/edit# Topic Document]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=Background=&lt;br /&gt;
&lt;br /&gt;
===Xcode===&lt;br /&gt;
Xcode is an [http://en.wikipedia.org/wiki/Integrated_development_environment Integrated Development Environment] (IDE) developed by Apple for developing software for iOS and OS X. The Xcode suite consists of the IDE, Apple’s developer documentation and a built-in interface builder. It is shipped free with Mac OS X 10.3, but is able to develop OS X applications that can run on any version of OS X. It extends and replaces Apple's earlier tool, Project Builder, which was inherited from [http://en.wikipedia.org/wiki/NeXT NeXT]. However, Xcode officially does not work in Mac OS X 10.2.It works hand in hand with Interface Builder (also inherited from NeXT), a graphical tool used to create user interfaces.&lt;br /&gt;
&lt;br /&gt;
Xcode includes GCC, and can compile [http://en.wikipedia.org/wiki/C C], [http://en.wikipedia.org/wiki/C%2B%2B C++], Objective C++, [http://en.wikipedia.org/wiki/java Java], and [http://en.wikipedia.org/wiki/Objective-C Objective C] source code with a variety of programming models, including but not limited to [http://en.wikipedia.org/wiki/Cocoa_(API) Cocoa], Carbon, and Java.&lt;br /&gt;
The latest Xcode version 6 includes Playgrounds which has an interactive sidebar to display the results of the code on-the-fly.&lt;br /&gt;
&lt;br /&gt;
===Swift===&lt;br /&gt;
Swift&amp;lt;ref&amp;gt;[https://developer.apple.com/swift/ Introduction to Swift]&amp;lt;/ref&amp;gt; is a new programming language that adopts safe programming patterns and makes programming flexible. Swift combines the best of both C and Objective-C. It integrates both - the procedural features like types and operators as well as the object-oriented features such as classes and protocols.  It adopts readability and dynamic object model from Objective-C and has added new features like blocks, collection literals and modules, fast performance. Swift has many advantages over Objective-C, like being more type-safe, having more natural and concise syntax, no need for header/implementation files. It has simplified memory management with [http://en.wikipedia.org/wiki/Automatic_Reference_Counting Automatic Reference Counting]. Swift is a fast and powerful programming language that is easier and more fun to implement.&lt;br /&gt;
&lt;br /&gt;
=Playgrounds=&lt;br /&gt;
Playgrounds&amp;lt;ref&amp;gt;[http://www.raywenderlich.com/74438/swift-tutorial-a-quick-start Playgrounds]&amp;lt;/ref&amp;gt; enable the interactive experience of a script language, even though Swift compiles to highly-optimized native code. Type a line of code and the result appears immediately. If your code runs over time, for instance through a loop, you can watch its progress in the Timeline assistant. The Timeline displays variables in a graph, draws each step when composing a view, and can play an animated SpriteKit scene.&lt;br /&gt;
&lt;br /&gt;
===Getting Started with Playgrounds===&lt;br /&gt;
On opening Xcode6, select &amp;quot;Get started with a Playground&amp;quot;. Default is a Hello Playgrounds program.&amp;lt;ref&amp;gt;[https://www.youtube.com/watch?v=A0C6L4XmrZM Introduction to Swift Playground]&amp;lt;/ref&amp;gt;&lt;br /&gt;
[[File: pgstart.png|frame|center]]&lt;br /&gt;
&lt;br /&gt;
Playgrounds with Swift introduce user friendly, clean code. Writing code in poetry-method has become simpler with Swift. Inclusion of packages is not necessary and heavy syntax can be ignored.&lt;br /&gt;
Creation of class is not required while writing code in Swift. Writing &amp;quot;str&amp;quot; in Swift would display the value of &amp;quot;str&amp;quot; on Playground directly.&lt;br /&gt;
Semicolons are not required at the end of each line. Datatype can be stated in the code, but it is not required as Swift implicitly assigns the datatype.&lt;br /&gt;
&lt;br /&gt;
[[File:swiftpic3.png|frame|center]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If the datatype of a variable is explicitly stated, the variable cannot be assigned a value that does not belong to its datatype. Such an assignment results in an error. Swift introduces a new keyword &amp;quot;let&amp;quot; for declaring constants. If the value of a constant declared with &amp;quot;let&amp;quot; is changed, an error is displayed.&lt;br /&gt;
While iterating through a loop in Swift, the value of the iterator is shown on the console on-the-fly.&lt;br /&gt;
&lt;br /&gt;
==More About Playgrounds==&lt;br /&gt;
Playgrounds files are used for testing and prototyping code. The results in the sidebar are displayed in black but during the modification of the code, the results temporarily change to gray during processing. ImageView can be used to display images.&lt;br /&gt;
&lt;br /&gt;
[[File: codesnippet.jpg|frame|center]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Read-Eval-Print-Loop (REPL)===&lt;br /&gt;
REPL (Read Evaluate Print Loop)&amp;lt;ref&amp;gt;[http://swiftlanguagetutorials.com/apple-swift-language-code-menu/apple-swift-language-faq/205-swift-language-faq-what-is-an-xcode-playground REPL]&amp;lt;/ref&amp;gt; is an interactive version of Swift. It is a procedure that loops in following iterations:&amp;lt;br&amp;gt;&lt;br /&gt;
''Read'':   Read is called and characters in user input are read.&amp;lt;br&amp;gt;&lt;br /&gt;
''Eval(uate)'': The input is then evaluated and returned&amp;lt;br&amp;gt;&lt;br /&gt;
''Print'': The evaluated result in printed in a textual representation for the users&amp;lt;br&amp;gt;&lt;br /&gt;
REPL in Swift enables the user to evaluate and interact with his code in a script-like environment.&lt;br /&gt;
&lt;br /&gt;
===Viewing Result===&lt;br /&gt;
To view graphical display of results, like images or strings, you can click on the Quick Look ([[File:quicklook.png|quicklook.png]] ) button. Access to Quick Look buttons can be gained by moving the pointer along the right edge of the sidebar.&amp;lt;ref&amp;gt;[https://developer.apple.com/library/ios/recipes/xcode_help-source_editor/chapters/ExploringandEvaluatingSwiftCodeinaPlayground.html  View Results in Playground]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:swift.jpg|frame|center]]&lt;br /&gt;
&lt;br /&gt;
Assistant Editor button can be used to examine values that change throughout the execution of the code.&amp;lt;br&amp;gt;&lt;br /&gt;
i.	Interim value of a code like for loop can be viewed through Value History button ([[File:history.png]]) &amp;lt;br&amp;gt;&lt;br /&gt;
ii.	Live view item can be used to view the drawing results. Live view item draws itself in response to the code.&lt;br /&gt;
&lt;br /&gt;
===Timeline===&lt;br /&gt;
The progress of results can be seen on the timeline. The time limit can also be set for the timeline to play back values. An item can be collapsed or expanded by clicking on the expression at the top of the item. An item can be removed from the timeline by clicking on the close button on the upper left corner of the item. The timeline can be closed by clicking on the close button on the Assistant Editor jump bar. It can be opened by clicking on the Assistant Editor button in the workspace toolbar or by clicking any Value History button.&lt;br /&gt;
The value of iterator in a loop can be seen by viewing the timeline. The timeline can display different types of items depending on the input. The value of iterator is shown as graph where the x-axis represents the execution time in seconds and the y-axis represents different values for the iterator. The graph changes on changing the value of the iterator&amp;lt;ref&amp;gt;[https://www.youtube.com/watch?v=F9T551Y0mYo Timeline]&amp;lt;/ref&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
[[File:assistantpic5.png|frame|center]]&lt;br /&gt;
&lt;br /&gt;
===Error===&lt;br /&gt;
The error messages in Playground is shown as a ! icon. The details about the error can be viewed by clicking on this icon. The image below shows the error message that will be displayed if a variable declared as a string is assigned an integer value.&lt;br /&gt;
&lt;br /&gt;
[[File:swiftpic5.png|frame|center]]&lt;br /&gt;
&lt;br /&gt;
===Limitations of Playground&amp;lt;ref&amp;gt;[http://rshankar.com/xcode-6-and-playground/ Limitations of Playground]&amp;lt;/ref&amp;gt;===&lt;br /&gt;
i      Playgrounds should not be used for performance testing as logging of results will dominate the runtime. &amp;lt;br&amp;gt;&lt;br /&gt;
ii     Playground does not support On-device execution. &amp;lt;br&amp;gt;&lt;br /&gt;
iii    Does not support custom entitlements.&amp;lt;br&amp;gt;&lt;br /&gt;
iv    Playgrounds can not be used for things that require user-interactions&lt;br /&gt;
&lt;br /&gt;
===Issues in Beta Playground===&lt;br /&gt;
&lt;br /&gt;
i. There are some flaws in beta release which can harm the system of user, like erasing hard drive.&lt;br /&gt;
&lt;br /&gt;
ii. It was reported by 9to5Mac that a developer discovered that the application is not sandboxed, i.e., Swift code entered in a playground has access to the entire computer sytem. The realtime nature of Playgrounds means that you don't even have to press ENTER to start the erasing process!&amp;lt;ref name= &amp;quot;issues in beta playground&amp;quot;&amp;gt;[http://swiftlanguagetutorials.com/apple-swift-language-code-menu/apple-swift-language-faq/205-swift-language-faq-what-is-an-xcode-playground Issues in beta Playground]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Recent Updates=&lt;br /&gt;
* On September 9th 2014, Apple published in their developer's blog that 'Swift Has Reached 1.0'.&lt;br /&gt;
* On September 15th 2014, Apple announced Xcode 6.1 beta 2.&amp;lt;ref&amp;gt;[https://developer.apple.com/news/ Apple Developer News and Updates]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=See Also=&lt;br /&gt;
* http://en.wikipedia.org/wiki/Xcode&lt;br /&gt;
* http://en.wikipedia.org/wiki/Swift_(programming_language)&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
* http://www.sitepoint.com/introduction-swift-programming-language/&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Vboddul</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/ch1a_13_va&amp;diff=87757</id>
		<title>CSC/ECE 517 Fall 2014/ch1a 13 va</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/ch1a_13_va&amp;diff=87757"/>
		<updated>2014-09-20T03:13:20Z</updated>

		<summary type="html">&lt;p&gt;Vboddul: /* Timeline */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Playgrounds with Swift in XCode v6.0''' ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;float: right; border:1px solid grey;&amp;quot;&amp;gt;&lt;br /&gt;
[[File:swift-xcode.jpg]]&lt;br /&gt;
[[File:playgrounds.png|center|Fig 1: Playgrounds with Swift in Xcode v6.0 ]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;On June 2, 2014 at the [http://en.wikipedia.org/wiki/Apple_Worldwide_Developers_Conference World Wide Developers Conference], Apple announced version 6 of Xcode. Features include Playgrounds live debugging tools, as well as an entirely new programming language called Swift. A key element of the Swift system is its ability to be cleanly debugged and run within the development environment, using a [http://en.wikipedia.org/wiki/Read–eval–print_loop read–eval–print loop (REPL)], giving it interactive properties more in common with scripting systems like Python than traditional systems programming languages. The REPL is further enhanced with the new 'playgrounds' concept; 'playgrounds' are interactive views running within the Xcode environment that respond to code or debugger changes on-the-fly. If the code in question changes over time or with regard to some other ranged input value, the view can be used with the Timeline Assistant to demonstrate the output in an animated fashion.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Apple claims that Swift &amp;quot;is the first industrial-quality systems programming language that is as expressive and enjoyable as a scripting language.&amp;quot;&amp;lt;ref name=&amp;quot;Topic&amp;quot;&amp;gt;[https://docs.google.com/a/ncsu.edu/document/d/1eq3XHiUUBIrEBx-R2Mgolaw7HttSgzPniwDLEF5oVk0/edit# Topic Document]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=Background=&lt;br /&gt;
&lt;br /&gt;
===Xcode===&lt;br /&gt;
Xcode is an [http://en.wikipedia.org/wiki/Integrated_development_environment Integrated Development Environment] (IDE) developed by Apple for developing software for iOS and OS X. The Xcode suite consists of the IDE, Apple’s developer documentation and a built-in interface builder. It is shipped free with Mac OS X 10.3, but is able to develop OS X applications that can run on any version of OS X. It extends and replaces Apple's earlier tool, Project Builder, which was inherited from [http://en.wikipedia.org/wiki/NeXT NeXT]. However, Xcode officially does not work in Mac OS X 10.2.It works hand in hand with Interface Builder (also inherited from NeXT), a graphical tool used to create user interfaces.&lt;br /&gt;
&lt;br /&gt;
Xcode includes GCC, and can compile [http://en.wikipedia.org/wiki/C C], [http://en.wikipedia.org/wiki/C%2B%2B C++], Objective C++, [http://en.wikipedia.org/wiki/java Java], and [http://en.wikipedia.org/wiki/Objective-C Objective C] source code with a variety of programming models, including but not limited to [http://en.wikipedia.org/wiki/Cocoa_(API) Cocoa], Carbon, and Java.&lt;br /&gt;
The latest Xcode version 6 includes Playgrounds which has an interactive sidebar to display the results of the code on-the-fly.&lt;br /&gt;
&lt;br /&gt;
===Swift===&lt;br /&gt;
Swift&amp;lt;ref&amp;gt;[https://developer.apple.com/swift/ Introduction to Swift]&amp;lt;/ref&amp;gt; is a new programming language that adopts safe programming patterns and makes programming flexible. Swift combines the best of both C and Objective-C. It integrates both - the procedural features like types and operators as well as the object-oriented features such as classes and protocols.  It adopts readability and dynamic object model from Objective-C and has added new features like blocks, collection literals and modules, fast performance. Swift has many advantages over Objective-C, like being more type-safe, having more natural and concise syntax, no need for header/implementation files. It has simplified memory management with [http://en.wikipedia.org/wiki/Automatic_Reference_Counting Automatic Reference Counting]. Swift is a fast and powerful programming language that is easier and more fun to implement.&lt;br /&gt;
&lt;br /&gt;
=Playgrounds=&lt;br /&gt;
Playgrounds&amp;lt;ref&amp;gt;[http://www.raywenderlich.com/74438/swift-tutorial-a-quick-start Playgrounds]&amp;lt;/ref&amp;gt; enable the interactive experience of a script language, even though Swift compiles to highly-optimized native code. Type a line of code and the result appears immediately. If your code runs over time, for instance through a loop, you can watch its progress in the Timeline assistant. The Timeline displays variables in a graph, draws each step when composing a view, and can play an animated SpriteKit scene.&lt;br /&gt;
&lt;br /&gt;
===Getting Started with Playgrounds===&lt;br /&gt;
On opening Xcode6, select &amp;quot;Get started with a Playground&amp;quot;. Default is a Hello Playgrounds program.&amp;lt;ref&amp;gt;[https://www.youtube.com/watch?v=A0C6L4XmrZM Introduction to Swift Playground]&amp;lt;/ref&amp;gt;&lt;br /&gt;
[[File: pgstart.png|frame|center]]&lt;br /&gt;
&lt;br /&gt;
Playgrounds with Swift introduce user friendly, clean code. Writing code in poetry-method has become simpler with Swift. Inclusion of packages is not necessary and heavy syntax can be ignored.&lt;br /&gt;
Creation of class is not required while writing code in Swift. Writing &amp;quot;str&amp;quot; in Swift would display the value of &amp;quot;str&amp;quot; on Playground directly.&lt;br /&gt;
Semicolons are not required at the end of each line. Datatype can be stated in the code, but it is not required as Swift implicitly assigns the datatype.&lt;br /&gt;
&lt;br /&gt;
[[File:swiftpic3.png|frame|center]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If the datatype of a variable is explicitly stated, the variable cannot be assigned a value that does not belong to its datatype. Such an assignment results in an error. Swift introduces a new keyword &amp;quot;let&amp;quot; for declaring constants. If the value of a constant declared with &amp;quot;let&amp;quot; is changed, an error is displayed.&lt;br /&gt;
While iterating through a loop in Swift, the value of the iterator is shown on the console on-the-fly.&lt;br /&gt;
&lt;br /&gt;
==More About Playgrounds==&lt;br /&gt;
Playgrounds files are used for testing and prototyping code. The results in the sidebar are displayed in black but during the modification of the code, the results temporarily change to gray during processing. ImageView can be used to display images.&lt;br /&gt;
&lt;br /&gt;
[[File: codesnippet.jpg|frame|center]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Read-Eval-Print-Loop (REPL)===&lt;br /&gt;
REPL (Read Evaluate Print Loop)&amp;lt;ref&amp;gt;[http://swiftlanguagetutorials.com/apple-swift-language-code-menu/apple-swift-language-faq/205-swift-language-faq-what-is-an-xcode-playground REPL]&amp;lt;/ref&amp;gt; is an interactive version of Swift. It is a procedure that loops in following iterations:&amp;lt;br&amp;gt;&lt;br /&gt;
''Read'':   Read is called and characters in user input are read.&amp;lt;br&amp;gt;&lt;br /&gt;
''Eval(uate)'': The input is then evaluated and returned&amp;lt;br&amp;gt;&lt;br /&gt;
''Print'': The evaluated result in printed in a textual representation for the users&amp;lt;br&amp;gt;&lt;br /&gt;
REPL in Swift enables the user to evaluate and interact with his code in a script-like environment.&lt;br /&gt;
&lt;br /&gt;
===Viewing Result===&lt;br /&gt;
To view graphical display of results, like images or strings, you can click on the Quick Look ([[File:quicklook.png|quicklook.png]] ) button. Access to Quick Look buttons can be gained by moving the pointer along the right edge of the sidebar.&amp;lt;ref&amp;gt;[https://developer.apple.com/library/ios/recipes/xcode_help-source_editor/chapters/ExploringandEvaluatingSwiftCodeinaPlayground.html  View Results in Playground]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:swift.jpg|frame|center]]&lt;br /&gt;
&lt;br /&gt;
Assistant Editor button can be used to examine values that change throughout the execution of the code.&amp;lt;br&amp;gt;&lt;br /&gt;
i.	Interim value of a code like for loop can be viewed through Value History button ([[File:history.png]]) &amp;lt;br&amp;gt;&lt;br /&gt;
ii.	Live view item can be used to view the drawing results. Live view item draws itself in response to the code.&lt;br /&gt;
&lt;br /&gt;
===Timeline===&lt;br /&gt;
The progress of results can be seen on the timeline. The time limit can also be set for the timeline to play back values. An item can be collapsed or expanded by clicking on the expression at the top of the item. An item can be removed from the timeline by clicking on the close button on the upper left corner of the item. The timeline can be closed by clicking on the close button on the Assistant Editor jump bar. It can be opened by clicking on the Assistant Editor button in the workspace toolbar or by clicking any Value History button.&lt;br /&gt;
The value of iterator in a loop can be seen by viewing the timeline. The timeline can display different types of items depending on the input. The value of iterator is shown as graph where the x-axis represents the execution time in seconds and the y-axis represents different values for the iterator. The graph changes on changing the value of the iterator&amp;lt;ref&amp;gt;[https://www.youtube.com/watch?v=F9T551Y0mYo Timeline]&amp;lt;/ref&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
[[File:assistantpic5.png|frame|center]]&lt;br /&gt;
&lt;br /&gt;
===Error===&lt;br /&gt;
The error messages in Playground is shown as a ! icon. The details about the error can be viewed by clicking on this icon. The image below shows the error message that will be displayed if a variable declared as a string is assigned an integer value.&lt;br /&gt;
&lt;br /&gt;
[[File:swiftpic5.png|frame|center]]&lt;br /&gt;
&lt;br /&gt;
===Limitations of Playground&amp;lt;ref&amp;gt;[http://rshankar.com/xcode-6-and-playground/ Limitations of Playground]&amp;lt;/ref&amp;gt;===&lt;br /&gt;
i      Playgrounds should not be used for performance testing as logging of results will dominate the runtime. &amp;lt;br&amp;gt;&lt;br /&gt;
ii     Playground does not support On-device execution. &amp;lt;br&amp;gt;&lt;br /&gt;
iii    Does not support custom entitlements.&amp;lt;br&amp;gt;&lt;br /&gt;
iv    Playgrounds can not be used for things that require user-interactions&lt;br /&gt;
&lt;br /&gt;
===Issues in Beta Playground===&lt;br /&gt;
&lt;br /&gt;
i. There are some flaws in beta release which can harm the system of user, like erasing hard drive.&lt;br /&gt;
&lt;br /&gt;
ii. It was reported by 9to5Mac that a developer discovered that the application is not sandboxed, i.e., Swift code entered in a playground has access to the entire computer sytem. The realtime nature of Playgrounds means that you don't even have to press ENTER to start the erasing process!&amp;lt;ref name= &amp;quot;issues in beta playground&amp;quot;&amp;gt;[http://swiftlanguagetutorials.com/apple-swift-language-code-menu/apple-swift-language-faq/205-swift-language-faq-what-is-an-xcode-playground Issues in beta Playground]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Recent Updates=&lt;br /&gt;
* On September 9th 2014, Apple published in their developer's blog that 'Swift Has Reached 1.0'.&lt;br /&gt;
* On September 15th 2014, Apple announced Xcode 6.1 beta 2.&amp;lt;ref&amp;gt;[https://developer.apple.com/news/ Apple Developer News and Updates]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=See Also=&lt;br /&gt;
* http://en.wikipedia.org/wiki/Xcode&lt;br /&gt;
* http://en.wikipedia.org/wiki/Swift_(programming_language)&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
* https://www.youtube.com/watch?v=F9T551Y0mYo&amp;lt;br&amp;gt;&lt;br /&gt;
* http://www.youtube.com/watch?v=sp8-jf20HNA&amp;lt;br&amp;gt;&lt;br /&gt;
* https://www.youtube.com/watch?v=xtZl1_zc3gg&amp;lt;br&amp;gt;&lt;br /&gt;
* http://blog.teamtreehouse.com/an-absolute-beginners-guide-to-swift&amp;lt;br&amp;gt;&lt;br /&gt;
* http://www.sitepoint.com/introduction-swift-programming-language/&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Vboddul</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/ch1a_13_va&amp;diff=87753</id>
		<title>CSC/ECE 517 Fall 2014/ch1a 13 va</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/ch1a_13_va&amp;diff=87753"/>
		<updated>2014-09-20T03:12:03Z</updated>

		<summary type="html">&lt;p&gt;Vboddul: /* References */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Playgrounds with Swift in XCode v6.0''' ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;float: right; border:1px solid grey;&amp;quot;&amp;gt;&lt;br /&gt;
[[File:swift-xcode.jpg]]&lt;br /&gt;
[[File:playgrounds.png|center|Fig 1: Playgrounds with Swift in Xcode v6.0 ]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;On June 2, 2014 at the [http://en.wikipedia.org/wiki/Apple_Worldwide_Developers_Conference World Wide Developers Conference], Apple announced version 6 of Xcode. Features include Playgrounds live debugging tools, as well as an entirely new programming language called Swift. A key element of the Swift system is its ability to be cleanly debugged and run within the development environment, using a [http://en.wikipedia.org/wiki/Read–eval–print_loop read–eval–print loop (REPL)], giving it interactive properties more in common with scripting systems like Python than traditional systems programming languages. The REPL is further enhanced with the new 'playgrounds' concept; 'playgrounds' are interactive views running within the Xcode environment that respond to code or debugger changes on-the-fly. If the code in question changes over time or with regard to some other ranged input value, the view can be used with the Timeline Assistant to demonstrate the output in an animated fashion.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Apple claims that Swift &amp;quot;is the first industrial-quality systems programming language that is as expressive and enjoyable as a scripting language.&amp;quot;&amp;lt;ref name=&amp;quot;Topic&amp;quot;&amp;gt;[https://docs.google.com/a/ncsu.edu/document/d/1eq3XHiUUBIrEBx-R2Mgolaw7HttSgzPniwDLEF5oVk0/edit# Topic Document]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=Background=&lt;br /&gt;
&lt;br /&gt;
===Xcode===&lt;br /&gt;
Xcode is an [http://en.wikipedia.org/wiki/Integrated_development_environment Integrated Development Environment] (IDE) developed by Apple for developing software for iOS and OS X. The Xcode suite consists of the IDE, Apple’s developer documentation and a built-in interface builder. It is shipped free with Mac OS X 10.3, but is able to develop OS X applications that can run on any version of OS X. It extends and replaces Apple's earlier tool, Project Builder, which was inherited from [http://en.wikipedia.org/wiki/NeXT NeXT]. However, Xcode officially does not work in Mac OS X 10.2.It works hand in hand with Interface Builder (also inherited from NeXT), a graphical tool used to create user interfaces.&lt;br /&gt;
&lt;br /&gt;
Xcode includes GCC, and can compile [http://en.wikipedia.org/wiki/C C], [http://en.wikipedia.org/wiki/C%2B%2B C++], Objective C++, [http://en.wikipedia.org/wiki/java Java], and [http://en.wikipedia.org/wiki/Objective-C Objective C] source code with a variety of programming models, including but not limited to [http://en.wikipedia.org/wiki/Cocoa_(API) Cocoa], Carbon, and Java.&lt;br /&gt;
The latest Xcode version 6 includes Playgrounds which has an interactive sidebar to display the results of the code on-the-fly.&lt;br /&gt;
&lt;br /&gt;
===Swift===&lt;br /&gt;
Swift&amp;lt;ref&amp;gt;[https://developer.apple.com/swift/ Introduction to Swift]&amp;lt;/ref&amp;gt; is a new programming language that adopts safe programming patterns and makes programming flexible. Swift combines the best of both C and Objective-C. It integrates both - the procedural features like types and operators as well as the object-oriented features such as classes and protocols.  It adopts readability and dynamic object model from Objective-C and has added new features like blocks, collection literals and modules, fast performance. Swift has many advantages over Objective-C, like being more type-safe, having more natural and concise syntax, no need for header/implementation files. It has simplified memory management with [http://en.wikipedia.org/wiki/Automatic_Reference_Counting Automatic Reference Counting]. Swift is a fast and powerful programming language that is easier and more fun to implement.&lt;br /&gt;
&lt;br /&gt;
=Playgrounds=&lt;br /&gt;
Playgrounds&amp;lt;ref&amp;gt;[http://www.raywenderlich.com/74438/swift-tutorial-a-quick-start Playgrounds]&amp;lt;/ref&amp;gt; enable the interactive experience of a script language, even though Swift compiles to highly-optimized native code. Type a line of code and the result appears immediately. If your code runs over time, for instance through a loop, you can watch its progress in the Timeline assistant. The Timeline displays variables in a graph, draws each step when composing a view, and can play an animated SpriteKit scene.&lt;br /&gt;
&lt;br /&gt;
===Getting Started with Playgrounds===&lt;br /&gt;
On opening Xcode6, select &amp;quot;Get started with a Playground&amp;quot;. Default is a Hello Playgrounds program.&amp;lt;ref&amp;gt;[https://www.youtube.com/watch?v=A0C6L4XmrZM Introduction to Swift Playground]&amp;lt;/ref&amp;gt;&lt;br /&gt;
[[File: pgstart.png|frame|center]]&lt;br /&gt;
&lt;br /&gt;
Playgrounds with Swift introduce user friendly, clean code. Writing code in poetry-method has become simpler with Swift. Inclusion of packages is not necessary and heavy syntax can be ignored.&lt;br /&gt;
Creation of class is not required while writing code in Swift. Writing &amp;quot;str&amp;quot; in Swift would display the value of &amp;quot;str&amp;quot; on Playground directly.&lt;br /&gt;
Semicolons are not required at the end of each line. Datatype can be stated in the code, but it is not required as Swift implicitly assigns the datatype.&lt;br /&gt;
&lt;br /&gt;
[[File:swiftpic3.png|frame|center]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If the datatype of a variable is explicitly stated, the variable cannot be assigned a value that does not belong to its datatype. Such an assignment results in an error. Swift introduces a new keyword &amp;quot;let&amp;quot; for declaring constants. If the value of a constant declared with &amp;quot;let&amp;quot; is changed, an error is displayed.&lt;br /&gt;
While iterating through a loop in Swift, the value of the iterator is shown on the console on-the-fly.&lt;br /&gt;
&lt;br /&gt;
==More About Playgrounds==&lt;br /&gt;
Playgrounds files are used for testing and prototyping code. The results in the sidebar are displayed in black but during the modification of the code, the results temporarily change to gray during processing. ImageView can be used to display images.&lt;br /&gt;
&lt;br /&gt;
[[File: codesnippet.jpg|frame|center]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Read-Eval-Print-Loop (REPL)===&lt;br /&gt;
REPL (Read Evaluate Print Loop)&amp;lt;ref&amp;gt;[http://swiftlanguagetutorials.com/apple-swift-language-code-menu/apple-swift-language-faq/205-swift-language-faq-what-is-an-xcode-playground REPL]&amp;lt;/ref&amp;gt; is an interactive version of Swift. It is a procedure that loops in following iterations:&amp;lt;br&amp;gt;&lt;br /&gt;
''Read'':   Read is called and characters in user input are read.&amp;lt;br&amp;gt;&lt;br /&gt;
''Eval(uate)'': The input is then evaluated and returned&amp;lt;br&amp;gt;&lt;br /&gt;
''Print'': The evaluated result in printed in a textual representation for the users&amp;lt;br&amp;gt;&lt;br /&gt;
REPL in Swift enables the user to evaluate and interact with his code in a script-like environment.&lt;br /&gt;
&lt;br /&gt;
===Viewing Result===&lt;br /&gt;
To view graphical display of results, like images or strings, you can click on the Quick Look ([[File:quicklook.png|quicklook.png]] ) button. Access to Quick Look buttons can be gained by moving the pointer along the right edge of the sidebar.&amp;lt;ref&amp;gt;[https://developer.apple.com/library/ios/recipes/xcode_help-source_editor/chapters/ExploringandEvaluatingSwiftCodeinaPlayground.html  View Results in Playground]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:swift.jpg|frame|center]]&lt;br /&gt;
&lt;br /&gt;
Assistant Editor button can be used to examine values that change throughout the execution of the code.&amp;lt;br&amp;gt;&lt;br /&gt;
i.	Interim value of a code like for loop can be viewed through Value History button ([[File:history.png]]) &amp;lt;br&amp;gt;&lt;br /&gt;
ii.	Live view item can be used to view the drawing results. Live view item draws itself in response to the code.&lt;br /&gt;
&lt;br /&gt;
===Timeline===&lt;br /&gt;
The progress of results can be seen on the timeline. The time limit can also be set for the timeline to play back values. An item can be collapsed or expanded by clicking on the expression at the top of the item. An item can be removed from the timeline by clicking on the close button on the upper left corner of the item. The timeline can be closed by clicking on the close button on the Assistant Editor jump bar. It can be opened by clicking on the Assistant Editor button in the workspace toolbar or by clicking any Value History button.&lt;br /&gt;
The value of iterator in a loop can be seen by viewing the timeline. The timeline can display different types of items depending on the input. The value of iterator is shown as graph where the x-axis represents the execution time in seconds and the y-axis represents different values for the iterator. The graph changes on changing the value of the iterator:&lt;br /&gt;
&lt;br /&gt;
[[File:assistantpic5.png|frame|center]]&lt;br /&gt;
&lt;br /&gt;
===Error===&lt;br /&gt;
The error messages in Playground is shown as a ! icon. The details about the error can be viewed by clicking on this icon. The image below shows the error message that will be displayed if a variable declared as a string is assigned an integer value.&lt;br /&gt;
&lt;br /&gt;
[[File:swiftpic5.png|frame|center]]&lt;br /&gt;
&lt;br /&gt;
===Limitations of Playground&amp;lt;ref&amp;gt;[http://rshankar.com/xcode-6-and-playground/ Limitations of Playground]&amp;lt;/ref&amp;gt;===&lt;br /&gt;
i      Playgrounds should not be used for performance testing as logging of results will dominate the runtime. &amp;lt;br&amp;gt;&lt;br /&gt;
ii     Playground does not support On-device execution. &amp;lt;br&amp;gt;&lt;br /&gt;
iii    Does not support custom entitlements.&amp;lt;br&amp;gt;&lt;br /&gt;
iv    Playgrounds can not be used for things that require user-interactions&lt;br /&gt;
&lt;br /&gt;
===Issues in Beta Playground===&lt;br /&gt;
&lt;br /&gt;
i. There are some flaws in beta release which can harm the system of user, like erasing hard drive.&lt;br /&gt;
&lt;br /&gt;
ii. It was reported by 9to5Mac that a developer discovered that the application is not sandboxed, i.e., Swift code entered in a playground has access to the entire computer sytem. The realtime nature of Playgrounds means that you don't even have to press ENTER to start the erasing process!&amp;lt;ref name= &amp;quot;issues in beta playground&amp;quot;&amp;gt;[http://swiftlanguagetutorials.com/apple-swift-language-code-menu/apple-swift-language-faq/205-swift-language-faq-what-is-an-xcode-playground Issues in beta Playground]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Recent Updates=&lt;br /&gt;
* On September 9th 2014, Apple published in their developer's blog that 'Swift Has Reached 1.0'.&lt;br /&gt;
* On September 15th 2014, Apple announced Xcode 6.1 beta 2.&amp;lt;ref&amp;gt;[https://developer.apple.com/news/ Apple Developer News and Updates]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=See Also=&lt;br /&gt;
* http://en.wikipedia.org/wiki/Xcode&lt;br /&gt;
* http://en.wikipedia.org/wiki/Swift_(programming_language)&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
* https://www.youtube.com/watch?v=F9T551Y0mYo&amp;lt;br&amp;gt;&lt;br /&gt;
* http://www.youtube.com/watch?v=sp8-jf20HNA&amp;lt;br&amp;gt;&lt;br /&gt;
* https://www.youtube.com/watch?v=xtZl1_zc3gg&amp;lt;br&amp;gt;&lt;br /&gt;
* http://blog.teamtreehouse.com/an-absolute-beginners-guide-to-swift&amp;lt;br&amp;gt;&lt;br /&gt;
* http://www.sitepoint.com/introduction-swift-programming-language/&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Vboddul</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/ch1a_13_va&amp;diff=87752</id>
		<title>CSC/ECE 517 Fall 2014/ch1a 13 va</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/ch1a_13_va&amp;diff=87752"/>
		<updated>2014-09-20T03:11:41Z</updated>

		<summary type="html">&lt;p&gt;Vboddul: /* Swift */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Playgrounds with Swift in XCode v6.0''' ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;float: right; border:1px solid grey;&amp;quot;&amp;gt;&lt;br /&gt;
[[File:swift-xcode.jpg]]&lt;br /&gt;
[[File:playgrounds.png|center|Fig 1: Playgrounds with Swift in Xcode v6.0 ]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;On June 2, 2014 at the [http://en.wikipedia.org/wiki/Apple_Worldwide_Developers_Conference World Wide Developers Conference], Apple announced version 6 of Xcode. Features include Playgrounds live debugging tools, as well as an entirely new programming language called Swift. A key element of the Swift system is its ability to be cleanly debugged and run within the development environment, using a [http://en.wikipedia.org/wiki/Read–eval–print_loop read–eval–print loop (REPL)], giving it interactive properties more in common with scripting systems like Python than traditional systems programming languages. The REPL is further enhanced with the new 'playgrounds' concept; 'playgrounds' are interactive views running within the Xcode environment that respond to code or debugger changes on-the-fly. If the code in question changes over time or with regard to some other ranged input value, the view can be used with the Timeline Assistant to demonstrate the output in an animated fashion.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Apple claims that Swift &amp;quot;is the first industrial-quality systems programming language that is as expressive and enjoyable as a scripting language.&amp;quot;&amp;lt;ref name=&amp;quot;Topic&amp;quot;&amp;gt;[https://docs.google.com/a/ncsu.edu/document/d/1eq3XHiUUBIrEBx-R2Mgolaw7HttSgzPniwDLEF5oVk0/edit# Topic Document]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=Background=&lt;br /&gt;
&lt;br /&gt;
===Xcode===&lt;br /&gt;
Xcode is an [http://en.wikipedia.org/wiki/Integrated_development_environment Integrated Development Environment] (IDE) developed by Apple for developing software for iOS and OS X. The Xcode suite consists of the IDE, Apple’s developer documentation and a built-in interface builder. It is shipped free with Mac OS X 10.3, but is able to develop OS X applications that can run on any version of OS X. It extends and replaces Apple's earlier tool, Project Builder, which was inherited from [http://en.wikipedia.org/wiki/NeXT NeXT]. However, Xcode officially does not work in Mac OS X 10.2.It works hand in hand with Interface Builder (also inherited from NeXT), a graphical tool used to create user interfaces.&lt;br /&gt;
&lt;br /&gt;
Xcode includes GCC, and can compile [http://en.wikipedia.org/wiki/C C], [http://en.wikipedia.org/wiki/C%2B%2B C++], Objective C++, [http://en.wikipedia.org/wiki/java Java], and [http://en.wikipedia.org/wiki/Objective-C Objective C] source code with a variety of programming models, including but not limited to [http://en.wikipedia.org/wiki/Cocoa_(API) Cocoa], Carbon, and Java.&lt;br /&gt;
The latest Xcode version 6 includes Playgrounds which has an interactive sidebar to display the results of the code on-the-fly.&lt;br /&gt;
&lt;br /&gt;
===Swift===&lt;br /&gt;
Swift&amp;lt;ref&amp;gt;[https://developer.apple.com/swift/ Introduction to Swift]&amp;lt;/ref&amp;gt; is a new programming language that adopts safe programming patterns and makes programming flexible. Swift combines the best of both C and Objective-C. It integrates both - the procedural features like types and operators as well as the object-oriented features such as classes and protocols.  It adopts readability and dynamic object model from Objective-C and has added new features like blocks, collection literals and modules, fast performance. Swift has many advantages over Objective-C, like being more type-safe, having more natural and concise syntax, no need for header/implementation files. It has simplified memory management with [http://en.wikipedia.org/wiki/Automatic_Reference_Counting Automatic Reference Counting]. Swift is a fast and powerful programming language that is easier and more fun to implement.&lt;br /&gt;
&lt;br /&gt;
=Playgrounds=&lt;br /&gt;
Playgrounds&amp;lt;ref&amp;gt;[http://www.raywenderlich.com/74438/swift-tutorial-a-quick-start Playgrounds]&amp;lt;/ref&amp;gt; enable the interactive experience of a script language, even though Swift compiles to highly-optimized native code. Type a line of code and the result appears immediately. If your code runs over time, for instance through a loop, you can watch its progress in the Timeline assistant. The Timeline displays variables in a graph, draws each step when composing a view, and can play an animated SpriteKit scene.&lt;br /&gt;
&lt;br /&gt;
===Getting Started with Playgrounds===&lt;br /&gt;
On opening Xcode6, select &amp;quot;Get started with a Playground&amp;quot;. Default is a Hello Playgrounds program.&amp;lt;ref&amp;gt;[https://www.youtube.com/watch?v=A0C6L4XmrZM Introduction to Swift Playground]&amp;lt;/ref&amp;gt;&lt;br /&gt;
[[File: pgstart.png|frame|center]]&lt;br /&gt;
&lt;br /&gt;
Playgrounds with Swift introduce user friendly, clean code. Writing code in poetry-method has become simpler with Swift. Inclusion of packages is not necessary and heavy syntax can be ignored.&lt;br /&gt;
Creation of class is not required while writing code in Swift. Writing &amp;quot;str&amp;quot; in Swift would display the value of &amp;quot;str&amp;quot; on Playground directly.&lt;br /&gt;
Semicolons are not required at the end of each line. Datatype can be stated in the code, but it is not required as Swift implicitly assigns the datatype.&lt;br /&gt;
&lt;br /&gt;
[[File:swiftpic3.png|frame|center]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If the datatype of a variable is explicitly stated, the variable cannot be assigned a value that does not belong to its datatype. Such an assignment results in an error. Swift introduces a new keyword &amp;quot;let&amp;quot; for declaring constants. If the value of a constant declared with &amp;quot;let&amp;quot; is changed, an error is displayed.&lt;br /&gt;
While iterating through a loop in Swift, the value of the iterator is shown on the console on-the-fly.&lt;br /&gt;
&lt;br /&gt;
==More About Playgrounds==&lt;br /&gt;
Playgrounds files are used for testing and prototyping code. The results in the sidebar are displayed in black but during the modification of the code, the results temporarily change to gray during processing. ImageView can be used to display images.&lt;br /&gt;
&lt;br /&gt;
[[File: codesnippet.jpg|frame|center]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Read-Eval-Print-Loop (REPL)===&lt;br /&gt;
REPL (Read Evaluate Print Loop)&amp;lt;ref&amp;gt;[http://swiftlanguagetutorials.com/apple-swift-language-code-menu/apple-swift-language-faq/205-swift-language-faq-what-is-an-xcode-playground REPL]&amp;lt;/ref&amp;gt; is an interactive version of Swift. It is a procedure that loops in following iterations:&amp;lt;br&amp;gt;&lt;br /&gt;
''Read'':   Read is called and characters in user input are read.&amp;lt;br&amp;gt;&lt;br /&gt;
''Eval(uate)'': The input is then evaluated and returned&amp;lt;br&amp;gt;&lt;br /&gt;
''Print'': The evaluated result in printed in a textual representation for the users&amp;lt;br&amp;gt;&lt;br /&gt;
REPL in Swift enables the user to evaluate and interact with his code in a script-like environment.&lt;br /&gt;
&lt;br /&gt;
===Viewing Result===&lt;br /&gt;
To view graphical display of results, like images or strings, you can click on the Quick Look ([[File:quicklook.png|quicklook.png]] ) button. Access to Quick Look buttons can be gained by moving the pointer along the right edge of the sidebar.&amp;lt;ref&amp;gt;[https://developer.apple.com/library/ios/recipes/xcode_help-source_editor/chapters/ExploringandEvaluatingSwiftCodeinaPlayground.html  View Results in Playground]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:swift.jpg|frame|center]]&lt;br /&gt;
&lt;br /&gt;
Assistant Editor button can be used to examine values that change throughout the execution of the code.&amp;lt;br&amp;gt;&lt;br /&gt;
i.	Interim value of a code like for loop can be viewed through Value History button ([[File:history.png]]) &amp;lt;br&amp;gt;&lt;br /&gt;
ii.	Live view item can be used to view the drawing results. Live view item draws itself in response to the code.&lt;br /&gt;
&lt;br /&gt;
===Timeline===&lt;br /&gt;
The progress of results can be seen on the timeline. The time limit can also be set for the timeline to play back values. An item can be collapsed or expanded by clicking on the expression at the top of the item. An item can be removed from the timeline by clicking on the close button on the upper left corner of the item. The timeline can be closed by clicking on the close button on the Assistant Editor jump bar. It can be opened by clicking on the Assistant Editor button in the workspace toolbar or by clicking any Value History button.&lt;br /&gt;
The value of iterator in a loop can be seen by viewing the timeline. The timeline can display different types of items depending on the input. The value of iterator is shown as graph where the x-axis represents the execution time in seconds and the y-axis represents different values for the iterator. The graph changes on changing the value of the iterator:&lt;br /&gt;
&lt;br /&gt;
[[File:assistantpic5.png|frame|center]]&lt;br /&gt;
&lt;br /&gt;
===Error===&lt;br /&gt;
The error messages in Playground is shown as a ! icon. The details about the error can be viewed by clicking on this icon. The image below shows the error message that will be displayed if a variable declared as a string is assigned an integer value.&lt;br /&gt;
&lt;br /&gt;
[[File:swiftpic5.png|frame|center]]&lt;br /&gt;
&lt;br /&gt;
===Limitations of Playground&amp;lt;ref&amp;gt;[http://rshankar.com/xcode-6-and-playground/ Limitations of Playground]&amp;lt;/ref&amp;gt;===&lt;br /&gt;
i      Playgrounds should not be used for performance testing as logging of results will dominate the runtime. &amp;lt;br&amp;gt;&lt;br /&gt;
ii     Playground does not support On-device execution. &amp;lt;br&amp;gt;&lt;br /&gt;
iii    Does not support custom entitlements.&amp;lt;br&amp;gt;&lt;br /&gt;
iv    Playgrounds can not be used for things that require user-interactions&lt;br /&gt;
&lt;br /&gt;
===Issues in Beta Playground===&lt;br /&gt;
&lt;br /&gt;
i. There are some flaws in beta release which can harm the system of user, like erasing hard drive.&lt;br /&gt;
&lt;br /&gt;
ii. It was reported by 9to5Mac that a developer discovered that the application is not sandboxed, i.e., Swift code entered in a playground has access to the entire computer sytem. The realtime nature of Playgrounds means that you don't even have to press ENTER to start the erasing process!&amp;lt;ref name= &amp;quot;issues in beta playground&amp;quot;&amp;gt;[http://swiftlanguagetutorials.com/apple-swift-language-code-menu/apple-swift-language-faq/205-swift-language-faq-what-is-an-xcode-playground Issues in beta Playground]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Recent Updates=&lt;br /&gt;
* On September 9th 2014, Apple published in their developer's blog that 'Swift Has Reached 1.0'.&lt;br /&gt;
* On September 15th 2014, Apple announced Xcode 6.1 beta 2.&amp;lt;ref&amp;gt;[https://developer.apple.com/news/ Apple Developer News and Updates]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=See Also=&lt;br /&gt;
* http://en.wikipedia.org/wiki/Xcode&lt;br /&gt;
* http://en.wikipedia.org/wiki/Swift_(programming_language)&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
* https://developer.apple.com/swift/&amp;lt;br&amp;gt;&lt;br /&gt;
* https://www.youtube.com/watch?v=A0C6L4XmrZM&amp;lt;br&amp;gt;&lt;br /&gt;
* https://www.youtube.com/watch?v=F9T551Y0mYo&amp;lt;br&amp;gt;&lt;br /&gt;
* http://www.youtube.com/watch?v=sp8-jf20HNA&amp;lt;br&amp;gt;&lt;br /&gt;
* https://www.youtube.com/watch?v=xtZl1_zc3gg&amp;lt;br&amp;gt;&lt;br /&gt;
* http://blog.teamtreehouse.com/an-absolute-beginners-guide-to-swift&amp;lt;br&amp;gt;&lt;br /&gt;
* http://www.sitepoint.com/introduction-swift-programming-language/&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Vboddul</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/ch1a_13_va&amp;diff=87748</id>
		<title>CSC/ECE 517 Fall 2014/ch1a 13 va</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/ch1a_13_va&amp;diff=87748"/>
		<updated>2014-09-20T03:10:33Z</updated>

		<summary type="html">&lt;p&gt;Vboddul: /* References */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Playgrounds with Swift in XCode v6.0''' ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;float: right; border:1px solid grey;&amp;quot;&amp;gt;&lt;br /&gt;
[[File:swift-xcode.jpg]]&lt;br /&gt;
[[File:playgrounds.png|center|Fig 1: Playgrounds with Swift in Xcode v6.0 ]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;On June 2, 2014 at the [http://en.wikipedia.org/wiki/Apple_Worldwide_Developers_Conference World Wide Developers Conference], Apple announced version 6 of Xcode. Features include Playgrounds live debugging tools, as well as an entirely new programming language called Swift. A key element of the Swift system is its ability to be cleanly debugged and run within the development environment, using a [http://en.wikipedia.org/wiki/Read–eval–print_loop read–eval–print loop (REPL)], giving it interactive properties more in common with scripting systems like Python than traditional systems programming languages. The REPL is further enhanced with the new 'playgrounds' concept; 'playgrounds' are interactive views running within the Xcode environment that respond to code or debugger changes on-the-fly. If the code in question changes over time or with regard to some other ranged input value, the view can be used with the Timeline Assistant to demonstrate the output in an animated fashion.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Apple claims that Swift &amp;quot;is the first industrial-quality systems programming language that is as expressive and enjoyable as a scripting language.&amp;quot;&amp;lt;ref name=&amp;quot;Topic&amp;quot;&amp;gt;[https://docs.google.com/a/ncsu.edu/document/d/1eq3XHiUUBIrEBx-R2Mgolaw7HttSgzPniwDLEF5oVk0/edit# Topic Document]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=Background=&lt;br /&gt;
&lt;br /&gt;
===Xcode===&lt;br /&gt;
Xcode is an [http://en.wikipedia.org/wiki/Integrated_development_environment Integrated Development Environment] (IDE) developed by Apple for developing software for iOS and OS X. The Xcode suite consists of the IDE, Apple’s developer documentation and a built-in interface builder. It is shipped free with Mac OS X 10.3, but is able to develop OS X applications that can run on any version of OS X. It extends and replaces Apple's earlier tool, Project Builder, which was inherited from [http://en.wikipedia.org/wiki/NeXT NeXT]. However, Xcode officially does not work in Mac OS X 10.2.It works hand in hand with Interface Builder (also inherited from NeXT), a graphical tool used to create user interfaces.&lt;br /&gt;
&lt;br /&gt;
Xcode includes GCC, and can compile [http://en.wikipedia.org/wiki/C C], [http://en.wikipedia.org/wiki/C%2B%2B C++], Objective C++, [http://en.wikipedia.org/wiki/java Java], and [http://en.wikipedia.org/wiki/Objective-C Objective C] source code with a variety of programming models, including but not limited to [http://en.wikipedia.org/wiki/Cocoa_(API) Cocoa], Carbon, and Java.&lt;br /&gt;
The latest Xcode version 6 includes Playgrounds which has an interactive sidebar to display the results of the code on-the-fly.&lt;br /&gt;
&lt;br /&gt;
===Swift===&lt;br /&gt;
Swift is a new programming language that adopts safe programming patterns and makes programming flexible. Swift combines the best of both C and Objective-C. It integrates both - the procedural features like types and operators as well as the object-oriented features such as classes and protocols.  It adopts readability and dynamic object model from Objective-C and has added new features like blocks, collection literals and modules, fast performance. Swift has many advantages over Objective-C, like being more type-safe, having more natural and concise syntax, no need for header/implementation files. It has simplified memory management with [http://en.wikipedia.org/wiki/Automatic_Reference_Counting Automatic Reference Counting]. Swift is a fast and powerful programming language that is easier and more fun to implement.&lt;br /&gt;
&lt;br /&gt;
=Playgrounds=&lt;br /&gt;
Playgrounds&amp;lt;ref&amp;gt;[http://www.raywenderlich.com/74438/swift-tutorial-a-quick-start Playgrounds]&amp;lt;/ref&amp;gt; enable the interactive experience of a script language, even though Swift compiles to highly-optimized native code. Type a line of code and the result appears immediately. If your code runs over time, for instance through a loop, you can watch its progress in the Timeline assistant. The Timeline displays variables in a graph, draws each step when composing a view, and can play an animated SpriteKit scene.&lt;br /&gt;
&lt;br /&gt;
===Getting Started with Playgrounds===&lt;br /&gt;
On opening Xcode6, select &amp;quot;Get started with a Playground&amp;quot;. Default is a Hello Playgrounds program.&amp;lt;ref&amp;gt;[https://www.youtube.com/watch?v=A0C6L4XmrZM Introduction to Swift Playground]&amp;lt;/ref&amp;gt;&lt;br /&gt;
[[File: pgstart.png|frame|center]]&lt;br /&gt;
&lt;br /&gt;
Playgrounds with Swift introduce user friendly, clean code. Writing code in poetry-method has become simpler with Swift. Inclusion of packages is not necessary and heavy syntax can be ignored.&lt;br /&gt;
Creation of class is not required while writing code in Swift. Writing &amp;quot;str&amp;quot; in Swift would display the value of &amp;quot;str&amp;quot; on Playground directly.&lt;br /&gt;
Semicolons are not required at the end of each line. Datatype can be stated in the code, but it is not required as Swift implicitly assigns the datatype.&lt;br /&gt;
&lt;br /&gt;
[[File:swiftpic3.png|frame|center]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If the datatype of a variable is explicitly stated, the variable cannot be assigned a value that does not belong to its datatype. Such an assignment results in an error. Swift introduces a new keyword &amp;quot;let&amp;quot; for declaring constants. If the value of a constant declared with &amp;quot;let&amp;quot; is changed, an error is displayed.&lt;br /&gt;
While iterating through a loop in Swift, the value of the iterator is shown on the console on-the-fly.&lt;br /&gt;
&lt;br /&gt;
==More About Playgrounds==&lt;br /&gt;
Playgrounds files are used for testing and prototyping code. The results in the sidebar are displayed in black but during the modification of the code, the results temporarily change to gray during processing. ImageView can be used to display images.&lt;br /&gt;
&lt;br /&gt;
[[File: codesnippet.jpg|frame|center]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Read-Eval-Print-Loop (REPL)===&lt;br /&gt;
REPL (Read Evaluate Print Loop)&amp;lt;ref&amp;gt;[http://swiftlanguagetutorials.com/apple-swift-language-code-menu/apple-swift-language-faq/205-swift-language-faq-what-is-an-xcode-playground REPL]&amp;lt;/ref&amp;gt; is an interactive version of Swift. It is a procedure that loops in following iterations:&amp;lt;br&amp;gt;&lt;br /&gt;
''Read'':   Read is called and characters in user input are read.&amp;lt;br&amp;gt;&lt;br /&gt;
''Eval(uate)'': The input is then evaluated and returned&amp;lt;br&amp;gt;&lt;br /&gt;
''Print'': The evaluated result in printed in a textual representation for the users&amp;lt;br&amp;gt;&lt;br /&gt;
REPL in Swift enables the user to evaluate and interact with his code in a script-like environment.&lt;br /&gt;
&lt;br /&gt;
===Viewing Result===&lt;br /&gt;
To view graphical display of results, like images or strings, you can click on the Quick Look ([[File:quicklook.png|quicklook.png]] ) button. Access to Quick Look buttons can be gained by moving the pointer along the right edge of the sidebar.&amp;lt;ref&amp;gt;[https://developer.apple.com/library/ios/recipes/xcode_help-source_editor/chapters/ExploringandEvaluatingSwiftCodeinaPlayground.html  View Results in Playground]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:swift.jpg|frame|center]]&lt;br /&gt;
&lt;br /&gt;
Assistant Editor button can be used to examine values that change throughout the execution of the code.&amp;lt;br&amp;gt;&lt;br /&gt;
i.	Interim value of a code like for loop can be viewed through Value History button ([[File:history.png]]) &amp;lt;br&amp;gt;&lt;br /&gt;
ii.	Live view item can be used to view the drawing results. Live view item draws itself in response to the code.&lt;br /&gt;
&lt;br /&gt;
===Timeline===&lt;br /&gt;
The progress of results can be seen on the timeline. The time limit can also be set for the timeline to play back values. An item can be collapsed or expanded by clicking on the expression at the top of the item. An item can be removed from the timeline by clicking on the close button on the upper left corner of the item. The timeline can be closed by clicking on the close button on the Assistant Editor jump bar. It can be opened by clicking on the Assistant Editor button in the workspace toolbar or by clicking any Value History button.&lt;br /&gt;
The value of iterator in a loop can be seen by viewing the timeline. The timeline can display different types of items depending on the input. The value of iterator is shown as graph where the x-axis represents the execution time in seconds and the y-axis represents different values for the iterator. The graph changes on changing the value of the iterator:&lt;br /&gt;
&lt;br /&gt;
[[File:assistantpic5.png|frame|center]]&lt;br /&gt;
&lt;br /&gt;
===Error===&lt;br /&gt;
The error messages in Playground is shown as a ! icon. The details about the error can be viewed by clicking on this icon. The image below shows the error message that will be displayed if a variable declared as a string is assigned an integer value.&lt;br /&gt;
&lt;br /&gt;
[[File:swiftpic5.png|frame|center]]&lt;br /&gt;
&lt;br /&gt;
===Limitations of Playground&amp;lt;ref&amp;gt;[http://rshankar.com/xcode-6-and-playground/ Limitations of Playground]&amp;lt;/ref&amp;gt;===&lt;br /&gt;
i      Playgrounds should not be used for performance testing as logging of results will dominate the runtime. &amp;lt;br&amp;gt;&lt;br /&gt;
ii     Playground does not support On-device execution. &amp;lt;br&amp;gt;&lt;br /&gt;
iii    Does not support custom entitlements.&amp;lt;br&amp;gt;&lt;br /&gt;
iv    Playgrounds can not be used for things that require user-interactions&lt;br /&gt;
&lt;br /&gt;
===Issues in Beta Playground===&lt;br /&gt;
&lt;br /&gt;
i. There are some flaws in beta release which can harm the system of user, like erasing hard drive.&lt;br /&gt;
&lt;br /&gt;
ii. It was reported by 9to5Mac that a developer discovered that the application is not sandboxed, i.e., Swift code entered in a playground has access to the entire computer sytem. The realtime nature of Playgrounds means that you don't even have to press ENTER to start the erasing process!&amp;lt;ref name= &amp;quot;issues in beta playground&amp;quot;&amp;gt;[http://swiftlanguagetutorials.com/apple-swift-language-code-menu/apple-swift-language-faq/205-swift-language-faq-what-is-an-xcode-playground Issues in beta Playground]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Recent Updates=&lt;br /&gt;
* On September 9th 2014, Apple published in their developer's blog that 'Swift Has Reached 1.0'.&lt;br /&gt;
* On September 15th 2014, Apple announced Xcode 6.1 beta 2.&amp;lt;ref&amp;gt;[https://developer.apple.com/news/ Apple Developer News and Updates]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=See Also=&lt;br /&gt;
* http://en.wikipedia.org/wiki/Xcode&lt;br /&gt;
* http://en.wikipedia.org/wiki/Swift_(programming_language)&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
* https://developer.apple.com/swift/&amp;lt;br&amp;gt;&lt;br /&gt;
* https://www.youtube.com/watch?v=A0C6L4XmrZM&amp;lt;br&amp;gt;&lt;br /&gt;
* https://www.youtube.com/watch?v=F9T551Y0mYo&amp;lt;br&amp;gt;&lt;br /&gt;
* http://www.youtube.com/watch?v=sp8-jf20HNA&amp;lt;br&amp;gt;&lt;br /&gt;
* https://www.youtube.com/watch?v=xtZl1_zc3gg&amp;lt;br&amp;gt;&lt;br /&gt;
* http://blog.teamtreehouse.com/an-absolute-beginners-guide-to-swift&amp;lt;br&amp;gt;&lt;br /&gt;
* http://www.sitepoint.com/introduction-swift-programming-language/&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Vboddul</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/ch1a_13_va&amp;diff=87747</id>
		<title>CSC/ECE 517 Fall 2014/ch1a 13 va</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/ch1a_13_va&amp;diff=87747"/>
		<updated>2014-09-20T03:10:12Z</updated>

		<summary type="html">&lt;p&gt;Vboddul: /* Read-Eval-Print-Loop (REPL) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Playgrounds with Swift in XCode v6.0''' ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;float: right; border:1px solid grey;&amp;quot;&amp;gt;&lt;br /&gt;
[[File:swift-xcode.jpg]]&lt;br /&gt;
[[File:playgrounds.png|center|Fig 1: Playgrounds with Swift in Xcode v6.0 ]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;On June 2, 2014 at the [http://en.wikipedia.org/wiki/Apple_Worldwide_Developers_Conference World Wide Developers Conference], Apple announced version 6 of Xcode. Features include Playgrounds live debugging tools, as well as an entirely new programming language called Swift. A key element of the Swift system is its ability to be cleanly debugged and run within the development environment, using a [http://en.wikipedia.org/wiki/Read–eval–print_loop read–eval–print loop (REPL)], giving it interactive properties more in common with scripting systems like Python than traditional systems programming languages. The REPL is further enhanced with the new 'playgrounds' concept; 'playgrounds' are interactive views running within the Xcode environment that respond to code or debugger changes on-the-fly. If the code in question changes over time or with regard to some other ranged input value, the view can be used with the Timeline Assistant to demonstrate the output in an animated fashion.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Apple claims that Swift &amp;quot;is the first industrial-quality systems programming language that is as expressive and enjoyable as a scripting language.&amp;quot;&amp;lt;ref name=&amp;quot;Topic&amp;quot;&amp;gt;[https://docs.google.com/a/ncsu.edu/document/d/1eq3XHiUUBIrEBx-R2Mgolaw7HttSgzPniwDLEF5oVk0/edit# Topic Document]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=Background=&lt;br /&gt;
&lt;br /&gt;
===Xcode===&lt;br /&gt;
Xcode is an [http://en.wikipedia.org/wiki/Integrated_development_environment Integrated Development Environment] (IDE) developed by Apple for developing software for iOS and OS X. The Xcode suite consists of the IDE, Apple’s developer documentation and a built-in interface builder. It is shipped free with Mac OS X 10.3, but is able to develop OS X applications that can run on any version of OS X. It extends and replaces Apple's earlier tool, Project Builder, which was inherited from [http://en.wikipedia.org/wiki/NeXT NeXT]. However, Xcode officially does not work in Mac OS X 10.2.It works hand in hand with Interface Builder (also inherited from NeXT), a graphical tool used to create user interfaces.&lt;br /&gt;
&lt;br /&gt;
Xcode includes GCC, and can compile [http://en.wikipedia.org/wiki/C C], [http://en.wikipedia.org/wiki/C%2B%2B C++], Objective C++, [http://en.wikipedia.org/wiki/java Java], and [http://en.wikipedia.org/wiki/Objective-C Objective C] source code with a variety of programming models, including but not limited to [http://en.wikipedia.org/wiki/Cocoa_(API) Cocoa], Carbon, and Java.&lt;br /&gt;
The latest Xcode version 6 includes Playgrounds which has an interactive sidebar to display the results of the code on-the-fly.&lt;br /&gt;
&lt;br /&gt;
===Swift===&lt;br /&gt;
Swift is a new programming language that adopts safe programming patterns and makes programming flexible. Swift combines the best of both C and Objective-C. It integrates both - the procedural features like types and operators as well as the object-oriented features such as classes and protocols.  It adopts readability and dynamic object model from Objective-C and has added new features like blocks, collection literals and modules, fast performance. Swift has many advantages over Objective-C, like being more type-safe, having more natural and concise syntax, no need for header/implementation files. It has simplified memory management with [http://en.wikipedia.org/wiki/Automatic_Reference_Counting Automatic Reference Counting]. Swift is a fast and powerful programming language that is easier and more fun to implement.&lt;br /&gt;
&lt;br /&gt;
=Playgrounds=&lt;br /&gt;
Playgrounds&amp;lt;ref&amp;gt;[http://www.raywenderlich.com/74438/swift-tutorial-a-quick-start Playgrounds]&amp;lt;/ref&amp;gt; enable the interactive experience of a script language, even though Swift compiles to highly-optimized native code. Type a line of code and the result appears immediately. If your code runs over time, for instance through a loop, you can watch its progress in the Timeline assistant. The Timeline displays variables in a graph, draws each step when composing a view, and can play an animated SpriteKit scene.&lt;br /&gt;
&lt;br /&gt;
===Getting Started with Playgrounds===&lt;br /&gt;
On opening Xcode6, select &amp;quot;Get started with a Playground&amp;quot;. Default is a Hello Playgrounds program.&amp;lt;ref&amp;gt;[https://www.youtube.com/watch?v=A0C6L4XmrZM Introduction to Swift Playground]&amp;lt;/ref&amp;gt;&lt;br /&gt;
[[File: pgstart.png|frame|center]]&lt;br /&gt;
&lt;br /&gt;
Playgrounds with Swift introduce user friendly, clean code. Writing code in poetry-method has become simpler with Swift. Inclusion of packages is not necessary and heavy syntax can be ignored.&lt;br /&gt;
Creation of class is not required while writing code in Swift. Writing &amp;quot;str&amp;quot; in Swift would display the value of &amp;quot;str&amp;quot; on Playground directly.&lt;br /&gt;
Semicolons are not required at the end of each line. Datatype can be stated in the code, but it is not required as Swift implicitly assigns the datatype.&lt;br /&gt;
&lt;br /&gt;
[[File:swiftpic3.png|frame|center]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If the datatype of a variable is explicitly stated, the variable cannot be assigned a value that does not belong to its datatype. Such an assignment results in an error. Swift introduces a new keyword &amp;quot;let&amp;quot; for declaring constants. If the value of a constant declared with &amp;quot;let&amp;quot; is changed, an error is displayed.&lt;br /&gt;
While iterating through a loop in Swift, the value of the iterator is shown on the console on-the-fly.&lt;br /&gt;
&lt;br /&gt;
==More About Playgrounds==&lt;br /&gt;
Playgrounds files are used for testing and prototyping code. The results in the sidebar are displayed in black but during the modification of the code, the results temporarily change to gray during processing. ImageView can be used to display images.&lt;br /&gt;
&lt;br /&gt;
[[File: codesnippet.jpg|frame|center]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Read-Eval-Print-Loop (REPL)===&lt;br /&gt;
REPL (Read Evaluate Print Loop)&amp;lt;ref&amp;gt;[http://swiftlanguagetutorials.com/apple-swift-language-code-menu/apple-swift-language-faq/205-swift-language-faq-what-is-an-xcode-playground REPL]&amp;lt;/ref&amp;gt; is an interactive version of Swift. It is a procedure that loops in following iterations:&amp;lt;br&amp;gt;&lt;br /&gt;
''Read'':   Read is called and characters in user input are read.&amp;lt;br&amp;gt;&lt;br /&gt;
''Eval(uate)'': The input is then evaluated and returned&amp;lt;br&amp;gt;&lt;br /&gt;
''Print'': The evaluated result in printed in a textual representation for the users&amp;lt;br&amp;gt;&lt;br /&gt;
REPL in Swift enables the user to evaluate and interact with his code in a script-like environment.&lt;br /&gt;
&lt;br /&gt;
===Viewing Result===&lt;br /&gt;
To view graphical display of results, like images or strings, you can click on the Quick Look ([[File:quicklook.png|quicklook.png]] ) button. Access to Quick Look buttons can be gained by moving the pointer along the right edge of the sidebar.&amp;lt;ref&amp;gt;[https://developer.apple.com/library/ios/recipes/xcode_help-source_editor/chapters/ExploringandEvaluatingSwiftCodeinaPlayground.html  View Results in Playground]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:swift.jpg|frame|center]]&lt;br /&gt;
&lt;br /&gt;
Assistant Editor button can be used to examine values that change throughout the execution of the code.&amp;lt;br&amp;gt;&lt;br /&gt;
i.	Interim value of a code like for loop can be viewed through Value History button ([[File:history.png]]) &amp;lt;br&amp;gt;&lt;br /&gt;
ii.	Live view item can be used to view the drawing results. Live view item draws itself in response to the code.&lt;br /&gt;
&lt;br /&gt;
===Timeline===&lt;br /&gt;
The progress of results can be seen on the timeline. The time limit can also be set for the timeline to play back values. An item can be collapsed or expanded by clicking on the expression at the top of the item. An item can be removed from the timeline by clicking on the close button on the upper left corner of the item. The timeline can be closed by clicking on the close button on the Assistant Editor jump bar. It can be opened by clicking on the Assistant Editor button in the workspace toolbar or by clicking any Value History button.&lt;br /&gt;
The value of iterator in a loop can be seen by viewing the timeline. The timeline can display different types of items depending on the input. The value of iterator is shown as graph where the x-axis represents the execution time in seconds and the y-axis represents different values for the iterator. The graph changes on changing the value of the iterator:&lt;br /&gt;
&lt;br /&gt;
[[File:assistantpic5.png|frame|center]]&lt;br /&gt;
&lt;br /&gt;
===Error===&lt;br /&gt;
The error messages in Playground is shown as a ! icon. The details about the error can be viewed by clicking on this icon. The image below shows the error message that will be displayed if a variable declared as a string is assigned an integer value.&lt;br /&gt;
&lt;br /&gt;
[[File:swiftpic5.png|frame|center]]&lt;br /&gt;
&lt;br /&gt;
===Limitations of Playground&amp;lt;ref&amp;gt;[http://rshankar.com/xcode-6-and-playground/ Limitations of Playground]&amp;lt;/ref&amp;gt;===&lt;br /&gt;
i      Playgrounds should not be used for performance testing as logging of results will dominate the runtime. &amp;lt;br&amp;gt;&lt;br /&gt;
ii     Playground does not support On-device execution. &amp;lt;br&amp;gt;&lt;br /&gt;
iii    Does not support custom entitlements.&amp;lt;br&amp;gt;&lt;br /&gt;
iv    Playgrounds can not be used for things that require user-interactions&lt;br /&gt;
&lt;br /&gt;
===Issues in Beta Playground===&lt;br /&gt;
&lt;br /&gt;
i. There are some flaws in beta release which can harm the system of user, like erasing hard drive.&lt;br /&gt;
&lt;br /&gt;
ii. It was reported by 9to5Mac that a developer discovered that the application is not sandboxed, i.e., Swift code entered in a playground has access to the entire computer sytem. The realtime nature of Playgrounds means that you don't even have to press ENTER to start the erasing process!&amp;lt;ref name= &amp;quot;issues in beta playground&amp;quot;&amp;gt;[http://swiftlanguagetutorials.com/apple-swift-language-code-menu/apple-swift-language-faq/205-swift-language-faq-what-is-an-xcode-playground Issues in beta Playground]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Recent Updates=&lt;br /&gt;
* On September 9th 2014, Apple published in their developer's blog that 'Swift Has Reached 1.0'.&lt;br /&gt;
* On September 15th 2014, Apple announced Xcode 6.1 beta 2.&amp;lt;ref&amp;gt;[https://developer.apple.com/news/ Apple Developer News and Updates]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=See Also=&lt;br /&gt;
* http://en.wikipedia.org/wiki/Xcode&lt;br /&gt;
* http://en.wikipedia.org/wiki/Swift_(programming_language)&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
* http://swiftlanguagetutorials.com/apple-swift-language-code-menu/apple-swift-language-faq/205-swift-language-faq-what-is-an-xcode-playground&amp;lt;br&amp;gt;&lt;br /&gt;
* http://rshankar.com/xcode-6-and-playground/&amp;lt;br&amp;gt;&lt;br /&gt;
* https://developer.apple.com/swift/&amp;lt;br&amp;gt;&lt;br /&gt;
* https://www.youtube.com/watch?v=A0C6L4XmrZM&amp;lt;br&amp;gt;&lt;br /&gt;
* https://www.youtube.com/watch?v=F9T551Y0mYo&amp;lt;br&amp;gt;&lt;br /&gt;
* http://www.youtube.com/watch?v=sp8-jf20HNA&amp;lt;br&amp;gt;&lt;br /&gt;
* https://www.youtube.com/watch?v=xtZl1_zc3gg&amp;lt;br&amp;gt;&lt;br /&gt;
* http://blog.teamtreehouse.com/an-absolute-beginners-guide-to-swift&amp;lt;br&amp;gt;&lt;br /&gt;
* http://www.sitepoint.com/introduction-swift-programming-language/&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Vboddul</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/ch1a_13_va&amp;diff=87745</id>
		<title>CSC/ECE 517 Fall 2014/ch1a 13 va</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2014/ch1a_13_va&amp;diff=87745"/>
		<updated>2014-09-20T03:09:00Z</updated>

		<summary type="html">&lt;p&gt;Vboddul: /* Limitations of Playground */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Playgrounds with Swift in XCode v6.0''' ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;float: right; border:1px solid grey;&amp;quot;&amp;gt;&lt;br /&gt;
[[File:swift-xcode.jpg]]&lt;br /&gt;
[[File:playgrounds.png|center|Fig 1: Playgrounds with Swift in Xcode v6.0 ]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;On June 2, 2014 at the [http://en.wikipedia.org/wiki/Apple_Worldwide_Developers_Conference World Wide Developers Conference], Apple announced version 6 of Xcode. Features include Playgrounds live debugging tools, as well as an entirely new programming language called Swift. A key element of the Swift system is its ability to be cleanly debugged and run within the development environment, using a [http://en.wikipedia.org/wiki/Read–eval–print_loop read–eval–print loop (REPL)], giving it interactive properties more in common with scripting systems like Python than traditional systems programming languages. The REPL is further enhanced with the new 'playgrounds' concept; 'playgrounds' are interactive views running within the Xcode environment that respond to code or debugger changes on-the-fly. If the code in question changes over time or with regard to some other ranged input value, the view can be used with the Timeline Assistant to demonstrate the output in an animated fashion.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Apple claims that Swift &amp;quot;is the first industrial-quality systems programming language that is as expressive and enjoyable as a scripting language.&amp;quot;&amp;lt;ref name=&amp;quot;Topic&amp;quot;&amp;gt;[https://docs.google.com/a/ncsu.edu/document/d/1eq3XHiUUBIrEBx-R2Mgolaw7HttSgzPniwDLEF5oVk0/edit# Topic Document]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=Background=&lt;br /&gt;
&lt;br /&gt;
===Xcode===&lt;br /&gt;
Xcode is an [http://en.wikipedia.org/wiki/Integrated_development_environment Integrated Development Environment] (IDE) developed by Apple for developing software for iOS and OS X. The Xcode suite consists of the IDE, Apple’s developer documentation and a built-in interface builder. It is shipped free with Mac OS X 10.3, but is able to develop OS X applications that can run on any version of OS X. It extends and replaces Apple's earlier tool, Project Builder, which was inherited from [http://en.wikipedia.org/wiki/NeXT NeXT]. However, Xcode officially does not work in Mac OS X 10.2.It works hand in hand with Interface Builder (also inherited from NeXT), a graphical tool used to create user interfaces.&lt;br /&gt;
&lt;br /&gt;
Xcode includes GCC, and can compile [http://en.wikipedia.org/wiki/C C], [http://en.wikipedia.org/wiki/C%2B%2B C++], Objective C++, [http://en.wikipedia.org/wiki/java Java], and [http://en.wikipedia.org/wiki/Objective-C Objective C] source code with a variety of programming models, including but not limited to [http://en.wikipedia.org/wiki/Cocoa_(API) Cocoa], Carbon, and Java.&lt;br /&gt;
The latest Xcode version 6 includes Playgrounds which has an interactive sidebar to display the results of the code on-the-fly.&lt;br /&gt;
&lt;br /&gt;
===Swift===&lt;br /&gt;
Swift is a new programming language that adopts safe programming patterns and makes programming flexible. Swift combines the best of both C and Objective-C. It integrates both - the procedural features like types and operators as well as the object-oriented features such as classes and protocols.  It adopts readability and dynamic object model from Objective-C and has added new features like blocks, collection literals and modules, fast performance. Swift has many advantages over Objective-C, like being more type-safe, having more natural and concise syntax, no need for header/implementation files. It has simplified memory management with [http://en.wikipedia.org/wiki/Automatic_Reference_Counting Automatic Reference Counting]. Swift is a fast and powerful programming language that is easier and more fun to implement.&lt;br /&gt;
&lt;br /&gt;
=Playgrounds=&lt;br /&gt;
Playgrounds&amp;lt;ref&amp;gt;[http://www.raywenderlich.com/74438/swift-tutorial-a-quick-start Playgrounds]&amp;lt;/ref&amp;gt; enable the interactive experience of a script language, even though Swift compiles to highly-optimized native code. Type a line of code and the result appears immediately. If your code runs over time, for instance through a loop, you can watch its progress in the Timeline assistant. The Timeline displays variables in a graph, draws each step when composing a view, and can play an animated SpriteKit scene.&lt;br /&gt;
&lt;br /&gt;
===Getting Started with Playgrounds===&lt;br /&gt;
On opening Xcode6, select &amp;quot;Get started with a Playground&amp;quot;. Default is a Hello Playgrounds program.&amp;lt;ref&amp;gt;[https://www.youtube.com/watch?v=A0C6L4XmrZM Introduction to Swift Playground]&amp;lt;/ref&amp;gt;&lt;br /&gt;
[[File: pgstart.png|frame|center]]&lt;br /&gt;
&lt;br /&gt;
Playgrounds with Swift introduce user friendly, clean code. Writing code in poetry-method has become simpler with Swift. Inclusion of packages is not necessary and heavy syntax can be ignored.&lt;br /&gt;
Creation of class is not required while writing code in Swift. Writing &amp;quot;str&amp;quot; in Swift would display the value of &amp;quot;str&amp;quot; on Playground directly.&lt;br /&gt;
Semicolons are not required at the end of each line. Datatype can be stated in the code, but it is not required as Swift implicitly assigns the datatype.&lt;br /&gt;
&lt;br /&gt;
[[File:swiftpic3.png|frame|center]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If the datatype of a variable is explicitly stated, the variable cannot be assigned a value that does not belong to its datatype. Such an assignment results in an error. Swift introduces a new keyword &amp;quot;let&amp;quot; for declaring constants. If the value of a constant declared with &amp;quot;let&amp;quot; is changed, an error is displayed.&lt;br /&gt;
While iterating through a loop in Swift, the value of the iterator is shown on the console on-the-fly.&lt;br /&gt;
&lt;br /&gt;
==More About Playgrounds==&lt;br /&gt;
Playgrounds files are used for testing and prototyping code. The results in the sidebar are displayed in black but during the modification of the code, the results temporarily change to gray during processing. ImageView can be used to display images.&lt;br /&gt;
&lt;br /&gt;
[[File: codesnippet.jpg|frame|center]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Read-Eval-Print-Loop (REPL)===&lt;br /&gt;
REPL (Read Evaluate Print Loop) is an interactive version of Swift. It is a procedure that loops in following iterations:&amp;lt;br&amp;gt;&lt;br /&gt;
''Read'':   Read is called and characters in user input are read.&amp;lt;br&amp;gt;&lt;br /&gt;
''Eval(uate)'': The input is then evaluated and returned&amp;lt;br&amp;gt;&lt;br /&gt;
''Print'': The evaluated result in printed in a textual representation for the users&amp;lt;br&amp;gt;&lt;br /&gt;
REPL in Swift enables the user to evaluate and interact with his code in a script-like environment.&lt;br /&gt;
&lt;br /&gt;
===Viewing Result===&lt;br /&gt;
To view graphical display of results, like images or strings, you can click on the Quick Look ([[File:quicklook.png|quicklook.png]] ) button. Access to Quick Look buttons can be gained by moving the pointer along the right edge of the sidebar.&amp;lt;ref&amp;gt;[https://developer.apple.com/library/ios/recipes/xcode_help-source_editor/chapters/ExploringandEvaluatingSwiftCodeinaPlayground.html  View Results in Playground]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:swift.jpg|frame|center]]&lt;br /&gt;
&lt;br /&gt;
Assistant Editor button can be used to examine values that change throughout the execution of the code.&amp;lt;br&amp;gt;&lt;br /&gt;
i.	Interim value of a code like for loop can be viewed through Value History button ([[File:history.png]]) &amp;lt;br&amp;gt;&lt;br /&gt;
ii.	Live view item can be used to view the drawing results. Live view item draws itself in response to the code.&lt;br /&gt;
&lt;br /&gt;
===Timeline===&lt;br /&gt;
The progress of results can be seen on the timeline. The time limit can also be set for the timeline to play back values. An item can be collapsed or expanded by clicking on the expression at the top of the item. An item can be removed from the timeline by clicking on the close button on the upper left corner of the item. The timeline can be closed by clicking on the close button on the Assistant Editor jump bar. It can be opened by clicking on the Assistant Editor button in the workspace toolbar or by clicking any Value History button.&lt;br /&gt;
The value of iterator in a loop can be seen by viewing the timeline. The timeline can display different types of items depending on the input. The value of iterator is shown as graph where the x-axis represents the execution time in seconds and the y-axis represents different values for the iterator. The graph changes on changing the value of the iterator:&lt;br /&gt;
&lt;br /&gt;
[[File:assistantpic5.png|frame|center]]&lt;br /&gt;
&lt;br /&gt;
===Error===&lt;br /&gt;
The error messages in Playground is shown as a ! icon. The details about the error can be viewed by clicking on this icon. The image below shows the error message that will be displayed if a variable declared as a string is assigned an integer value.&lt;br /&gt;
&lt;br /&gt;
[[File:swiftpic5.png|frame|center]]&lt;br /&gt;
&lt;br /&gt;
===Limitations of Playground&amp;lt;ref&amp;gt;[http://rshankar.com/xcode-6-and-playground/ Limitations of Playground]&amp;lt;/ref&amp;gt;===&lt;br /&gt;
i      Playgrounds should not be used for performance testing as logging of results will dominate the runtime. &amp;lt;br&amp;gt;&lt;br /&gt;
ii     Playground does not support On-device execution. &amp;lt;br&amp;gt;&lt;br /&gt;
iii    Does not support custom entitlements.&amp;lt;br&amp;gt;&lt;br /&gt;
iv    Playgrounds can not be used for things that require user-interactions&lt;br /&gt;
&lt;br /&gt;
===Issues in Beta Playground===&lt;br /&gt;
&lt;br /&gt;
i. There are some flaws in beta release which can harm the system of user, like erasing hard drive.&lt;br /&gt;
&lt;br /&gt;
ii. It was reported by 9to5Mac that a developer discovered that the application is not sandboxed, i.e., Swift code entered in a playground has access to the entire computer sytem. The realtime nature of Playgrounds means that you don't even have to press ENTER to start the erasing process!&amp;lt;ref name= &amp;quot;issues in beta playground&amp;quot;&amp;gt;[http://swiftlanguagetutorials.com/apple-swift-language-code-menu/apple-swift-language-faq/205-swift-language-faq-what-is-an-xcode-playground Issues in beta Playground]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Recent Updates=&lt;br /&gt;
* On September 9th 2014, Apple published in their developer's blog that 'Swift Has Reached 1.0'.&lt;br /&gt;
* On September 15th 2014, Apple announced Xcode 6.1 beta 2.&amp;lt;ref&amp;gt;[https://developer.apple.com/news/ Apple Developer News and Updates]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=See Also=&lt;br /&gt;
* http://en.wikipedia.org/wiki/Xcode&lt;br /&gt;
* http://en.wikipedia.org/wiki/Swift_(programming_language)&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
* http://swiftlanguagetutorials.com/apple-swift-language-code-menu/apple-swift-language-faq/205-swift-language-faq-what-is-an-xcode-playground&amp;lt;br&amp;gt;&lt;br /&gt;
* http://rshankar.com/xcode-6-and-playground/&amp;lt;br&amp;gt;&lt;br /&gt;
* https://developer.apple.com/swift/&amp;lt;br&amp;gt;&lt;br /&gt;
* https://www.youtube.com/watch?v=A0C6L4XmrZM&amp;lt;br&amp;gt;&lt;br /&gt;
* https://www.youtube.com/watch?v=F9T551Y0mYo&amp;lt;br&amp;gt;&lt;br /&gt;
* http://www.youtube.com/watch?v=sp8-jf20HNA&amp;lt;br&amp;gt;&lt;br /&gt;
* https://www.youtube.com/watch?v=xtZl1_zc3gg&amp;lt;br&amp;gt;&lt;br /&gt;
* http://blog.teamtreehouse.com/an-absolute-beginners-guide-to-swift&amp;lt;br&amp;gt;&lt;br /&gt;
* http://www.sitepoint.com/introduction-swift-programming-language/&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Vboddul</name></author>
	</entry>
</feed>