<?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=Skmuppal</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=Skmuppal"/>
	<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=Special:Contributions/Skmuppal"/>
	<updated>2026-08-19T22:42:31Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.41.0</generator>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2020_-_E2021._Allow_reviewers_to_bid_on_what_to_review&amp;diff=134304</id>
		<title>CSC/ECE 517 Spring 2020 - E2021. Allow reviewers to bid on what to review</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2020_-_E2021._Allow_reviewers_to_bid_on_what_to_review&amp;diff=134304"/>
		<updated>2020-04-25T04:58:31Z</updated>

		<summary type="html">&lt;p&gt;Skmuppal: /* Run Bidding Assignment Location Changed */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== '''Problem Statement''' ==&lt;br /&gt;
The reviews performed by the students right now are being assigned on a first-come-first-serve basis. The task at hand is to implement a procedure so that the students can bid on the reviews that they would like to review, similar to the procedure of the assignment of the topics. The difference between the two procedures is that the assignment of the topic is a one-one mapping, i.e. a team is assigned to a single topic, whereas the assignment of the reviews is many-many mapping with each review being assigned to different students and each student assigned to different reviews.&lt;br /&gt;
&lt;br /&gt;
=== '''The need for a bidding system for reviews''' ===&lt;br /&gt;
&lt;br /&gt;
The bidding process, when implemented for reviews of projects, will hold several advantages. &lt;br /&gt;
&lt;br /&gt;
1. The users will be able to bid for reviewing the projects that would interest them. This will incentivize them to get a better understanding of the project requirements and provide the necessary feedback in a very informed manner.&lt;br /&gt;
&lt;br /&gt;
2. With the help of color coding, the students will be able to decide on the probability of being assigned to a particular review, that could help them in bidding wisely.&lt;br /&gt;
&lt;br /&gt;
3. It provides the team members working on the project, a very informed feedback on how to enhance their project. Because,the feedback is from people who really are interested on the project.&lt;br /&gt;
&lt;br /&gt;
4. It also helps the instructor in receiving more well-written, useful and meaningful feedback on what projects are more in demand among the students, which would be further useful in crafting the academic projects.&lt;br /&gt;
&lt;br /&gt;
=== '''What needs to be done'''===&lt;br /&gt;
The following are the tasks that are to be done-&lt;br /&gt;
&lt;br /&gt;
1. Implement Gale-Shapely version for many-to-many matching situations on a web service as mentioned in the paper [https://www.tayfunsonmez.net/wp-content/uploads/2013/10/AbdulkadirogluSonmez-AER20031.pdf].&lt;br /&gt;
&lt;br /&gt;
The Gale-Shapely version for many-to-many matching is an intelligent algorithm that allows users to achieve the review they will need. For example, let us consider a situation where user 'A' wants the review assigned to user 'B' and user 'B' wants the review assigned to user 'A'. Considering that it will motivate the students if they get the project that they would like to review, this mutual exchange between them would be beneficial. This classical problem can be solved using the following algorithm.&lt;br /&gt;
&lt;br /&gt;
[[File:bid.png |center|]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Motivation'''&lt;br /&gt;
&lt;br /&gt;
From a set '''R''' of available review topics, the user u from set '''U''' have to be matched with a pre-configured number of topics r1,r2,r3.....rk. So,the idea is to record the user priority and time-stamp at which r is bid. This information can then be used to change the color of the review in real time, which could further let the users know that their bid for this particular bis cannot be given a top priority. Once the bidding timeline is past, the recorded information for each bis is then fed to the algorithm, which would then match user u to review r1,r2,r3...rk.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''How should the algorithm match students '''S''' to the Review set '''R ''' ?&lt;br /&gt;
&lt;br /&gt;
The algorithm has to initially append additional reviews randomly in case, the user did not bid for the required number of reviews. Then based on the input data of the list for each student, which contains the topic,time-stamp and priority it has to allot the review to a student with earliest time stamp and highest priority.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Algorithm Steps'''&lt;br /&gt;
&lt;br /&gt;
1) Let the user bid, these bids will have time-stamps and priority(determined by the color of the bid at that time stamp).&lt;br /&gt;
&lt;br /&gt;
2) There will be cycles links of length 1 between the person who owns every review currently,which generates a directed acyclic graph.&lt;br /&gt;
&lt;br /&gt;
3) We the will need to break all the cycles in the graph and assign the reviews to which the user is pointing at. The top is represent as [ TOP(i) ]&lt;br /&gt;
&lt;br /&gt;
4) We can repeat this order until we have exhausted our preference list where all the assigned reviews are constantly deleted.&lt;br /&gt;
&lt;br /&gt;
5) We will repeat this process for all the slots of the bidding until the users gets all these review slots filled, making it many to many.&lt;br /&gt;
&lt;br /&gt;
[[File:bid1.png |center|]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
From the diagram we can see that the three users are represented as u1, u2, u3 and the the three reviews are r1,r2,r3. &lt;br /&gt;
&lt;br /&gt;
In '''phase 1''' : All users want the review 1 so all of them point to r1 and we see r1 is owned by u1 and r2 is owned by u2 and r3 by u3.&lt;br /&gt;
&lt;br /&gt;
In '''phase 2''' : u1 is assigned r1 and now u2 points to r3 which is now its highest priority because r1 is removed and similarly u3 points to r2.&lt;br /&gt;
&lt;br /&gt;
In '''phase 3''' : r2 is assigned to u3 and and r3 is assigned to u2, thus satisfying all.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
2. Add the front end code to allow the bidding on topics and call the appropriate web services from the lottery controller. This is similar to the already implemented bidding process on topics [https://github.com/expertiza/expertiza/pull/778/commits].&lt;br /&gt;
&lt;br /&gt;
'''Flow chart for this us functionality would involve :'''&lt;br /&gt;
&lt;br /&gt;
[[File:flow.png |center|]]&lt;br /&gt;
&lt;br /&gt;
=== '''Previous Work''' ===&lt;br /&gt;
The latest implementation of the problem was E1986 [https://github.com/expertiza/expertiza/pull/1629][https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2019_-_E1986._Allow_reviewers_to_bid_on_what_to_review#Project_Mentor].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We can see that they have figured out the issues with the bidding assignement being one to one and not many to one and have succesfully used the Gale-Shapely version for many-to-many matching algorithm to solve the issues. They have also fixed a few problems with the UI that were being faced with the buttons and writing proper test cases.&lt;br /&gt;
 &lt;br /&gt;
From the previous implementations we can see that the following files were modified in order to get the required implementation they have modified the following files :&lt;br /&gt;
&lt;br /&gt;
'''Modified Files'''&lt;br /&gt;
&lt;br /&gt;
routes.rb&lt;br /&gt;
&lt;br /&gt;
app/views/student_task/view.html.erb&lt;br /&gt;
&lt;br /&gt;
app/views/assignments/edit.html.erb&lt;br /&gt;
&lt;br /&gt;
app/controllers/student_task_controller&lt;br /&gt;
&lt;br /&gt;
'''New Files'''&lt;br /&gt;
&lt;br /&gt;
app/controllers/review_bidding.rb&lt;br /&gt;
&lt;br /&gt;
app/models/review_bidding_controller.rb&lt;br /&gt;
&lt;br /&gt;
app/views/sign_up_sheet/review_bid.html.erb&lt;br /&gt;
&lt;br /&gt;
Source Code for the Web Service&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== '''Problems found in previous work''' ===&lt;br /&gt;
The problems in the previous work were given-&lt;br /&gt;
&lt;br /&gt;
1. The link to the run bidding assignment is on the Review Strategy tab instead of the actions associated with an assignment like the topic assignment. This is an inconsistency in the UI that needs to be remedied.&lt;br /&gt;
&lt;br /&gt;
2. All of the implementation code was put in the controller which is inappropriate for a controller. The code should probably be in the corresponding model file.&lt;br /&gt;
&lt;br /&gt;
3. The tests that they have written are not adequate.&lt;br /&gt;
&lt;br /&gt;
4. It does not allow the Instructor, to decide to whether to allow the bidding for reviews or not.&lt;br /&gt;
&lt;br /&gt;
=='''Improvements Made'''==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==='''Run Bidding Assignment Location Changed'''===&lt;br /&gt;
'''Change the location of the running bidding assignment to the appropriate location. This is because it is inconsistent with the UI and will require changes.''' &lt;br /&gt;
&lt;br /&gt;
The part of the code that requires modification is- app/views/assignments/edit.html.erb&lt;br /&gt;
&lt;br /&gt;
[[File:tab.PNG |center|]]&lt;br /&gt;
&lt;br /&gt;
As we can see from the code attached we need to move this code away from the Review Strategy tab.&lt;br /&gt;
&lt;br /&gt;
[[File:ButtonChanged.PNG |center|]]&lt;br /&gt;
&lt;br /&gt;
[[File:intelligent.jpeg |center|]]&lt;br /&gt;
&lt;br /&gt;
We have also added a checkbox to check if the algorithm is run or not based on the value of the checkbox that is ticked.&lt;br /&gt;
&lt;br /&gt;
[[File:ff1.PNG |center|]]&lt;br /&gt;
&lt;br /&gt;
'''Webservice : '''&lt;br /&gt;
&lt;br /&gt;
The previous team had not set up the web service as internet-facing. It was only working on their local system because they were facing issues with the flask framework setup. We have successfully setup up the web service call and made it internet facing.&lt;br /&gt;
&lt;br /&gt;
The code can be found at the following repository: https://github.com/akashsrikanth2310/expertiza-topic-bidding which is hosted using Heroku and can be accessed from the expertiza application.&lt;br /&gt;
&lt;br /&gt;
Various refactors on the code were also performed the changes are shown below.&lt;br /&gt;
&lt;br /&gt;
==='''Refactoring to maintain DRY'''===&lt;br /&gt;
Write the code where it is suitable, following the DRY principles.&lt;br /&gt;
&lt;br /&gt;
The first file where we want to apply the principle to is the: app/controllers/review_bidding_controller.rb&lt;br /&gt;
&lt;br /&gt;
The code is shown below: &lt;br /&gt;
&lt;br /&gt;
'''Previous Implementation :'''&lt;br /&gt;
[[File:r1.PNG |center|]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
From this, we can see the entire method can be moved to the model to reduce the stress on the model. The assignment participant code is moved to the controller thereby making it easier to perform separations of the model, view, and controller. Also in the below code attached we try to move the entire assignment_bidding_data to the model as well.&lt;br /&gt;
&lt;br /&gt;
'''Previous Implementation :'''&lt;br /&gt;
[[File:a1.PNG]]&lt;br /&gt;
&lt;br /&gt;
The implemented changes by moving the code to the model are shown in the code attached below. WE can see that both the method has been successfully moved to the model and thereby reducing the stress on the controller. The assignment_reviewers function is the function that will return the participant ids of all the reviewers who have a topic that is assigned to them. It will run a for loop to get the details and return an array of reviewers with assigned topics.&lt;br /&gt;
&lt;br /&gt;
'''Current Implementation :'''&lt;br /&gt;
[[File:s1.PNG |center|]]&lt;br /&gt;
&lt;br /&gt;
The other function that we choose to move to controller hence to make sure the computations are performed only the model side is first the reviewer_bidding_data &lt;br /&gt;
&lt;br /&gt;
'''Previous Implementation :'''&lt;br /&gt;
[[File:a2.PNG |center|]]&lt;br /&gt;
&lt;br /&gt;
The function reviewer_self topic shown below was also moved.&lt;br /&gt;
&lt;br /&gt;
'''Previous Implementation :'''&lt;br /&gt;
[[File:a3.PNG |center|]]&lt;br /&gt;
&lt;br /&gt;
The new code that is attached to the model is shown below&lt;br /&gt;
The reviewer_bidding_data file creates a hash of all values tat is required for a bidding value its has will hold keys and values for {'priority' =&amp;gt; [], 'time' =&amp;gt; =&amp;gt; [] , 'tid' =&amp;gt; [] , 'otid' =&amp;gt; self_topic} it runs through the bids and get the required cols to add to the hash.&lt;br /&gt;
&lt;br /&gt;
'''Current Implementation :'''&lt;br /&gt;
[[File:s2.PNG |center|]]&lt;br /&gt;
&lt;br /&gt;
The reviwer_self_topic is used to get the necessary self topic that is been assigned to the reviewer and the values will be returned based on what is been assigned.&lt;br /&gt;
&lt;br /&gt;
'''Current Implementation :'''&lt;br /&gt;
[[File:s3.PNG |center|]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the same file, we notice the method: get_quartiles(topic_id) which assigns colors to the topics based on how much in demand they are. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:quar.PNG |center|]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We would like to again reduce the assignment statements and move the entire if structure to the model to return the colors reducing stress on the controller.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==='''Writing Suitable Tests'''===&lt;br /&gt;
Write suitable tests to ensure that the implementation is working.&lt;br /&gt;
&lt;br /&gt;
The previous implementation gave their try on implementing the required test but all of them are commented out. So, they are required to be redone during this implementation.&lt;br /&gt;
&lt;br /&gt;
'''Previous Implementation'''&lt;br /&gt;
[[File:test.PNG |center|]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Previous Implementation'''&lt;br /&gt;
We can see that the previous implementation has all the tests removed, the changed test cases are shown in the testing subtopic.&lt;br /&gt;
[[File:test1.PNG |center|]]&lt;br /&gt;
&lt;br /&gt;
'''Current Implementation'''&lt;br /&gt;
The current testing implementation has been shown below, in the '''Plan for Testing''' section.&lt;br /&gt;
&lt;br /&gt;
== '''Plan for Testing'''==&lt;br /&gt;
&lt;br /&gt;
=== '''Test Cases'''===&lt;br /&gt;
&lt;br /&gt;
'''Manual Testing :''' &lt;br /&gt;
There are a few cases that need to be tested.&lt;br /&gt;
&lt;br /&gt;
1. The first case would be to test for the scenario, where no reviewer bids i.e. no one has given a preference of any sort. Then the bidding algorithm should assign reviews randomly. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
2. The other case would be when all reviewers have selected a different project as their preference, at different times. This is an ideal scenario given that the reviewer cannot bid for his own project.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3. The other scenario would be when everyone selects the same project at the same or different times and does not provide any other choice or preference. This can be the scenario if one project is relatively interesting or easy to review in comparison to the others in the roster.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
4. Another scenario would be if some projects haven't been selected at all for reviewing, this case arises if the particular project may require additional effort on the part of the reviewing to successfully complete the review.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
5. A usual scenario is that the reviewers select all or most of the projects, and each project is on at least one reviewer's biding list.&lt;br /&gt;
&lt;br /&gt;
Automatic testing : &lt;br /&gt;
&lt;br /&gt;
Few tests have been written for both the controller and the models :&lt;br /&gt;
&lt;br /&gt;
the file we can see that tests were written for the controller that checks if the web-service call is fine. The Call to the webservice is made and check if the response code returned is fine. It checks if the right status code is returned on processing. Also it eventually checks for the json data being returned succesffuly.&lt;br /&gt;
&lt;br /&gt;
[[File:e1.PNG |center|]]&lt;br /&gt;
&lt;br /&gt;
The screenshot of the passed tests are shown below :&lt;br /&gt;
&lt;br /&gt;
[[File:ss.jpeg |center|]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The other tests that are written are for the model. It check if the model has validations of the priority, participant_id and topic_id to be the right values as set in the database also it checks if the values returned from participant_id and topic_id are integers.&lt;br /&gt;
&lt;br /&gt;
[[File:e2.PNG |center|]]&lt;br /&gt;
&lt;br /&gt;
The other tests written checks if the assignment id is assigned right and if its an integer. It also checks if the assignment_reviewers returns an array and if the assignment_bidding_data will return a hash value in return. The review_bidding_data is also checked for the right hash values.&lt;br /&gt;
&lt;br /&gt;
[[File:e3.PNG |center|]]&lt;br /&gt;
&lt;br /&gt;
The screenshot of the passed tests are shown below : &lt;br /&gt;
&lt;br /&gt;
[[File:Chill1.PNG |center|]]&lt;br /&gt;
&lt;br /&gt;
In all of the above cases, all the projects have to be assigned to at least one reviewer so that every project has been peer-reviewed.&lt;br /&gt;
&lt;br /&gt;
== '''References''' ==&lt;br /&gt;
[1] [https://www.tayfunsonmez.net/wp-content/uploads/2013/10/AbdulkadirogluSonmez-AER20031.pdf School Choice: A Mechanism Design Approach] by Atila Abdulkadiroğlu and Tayfun Sönmez.&lt;br /&gt;
&lt;br /&gt;
[2] [https://github.com/expertiza/expertiza/pull/778/commits Bidding Interface Implementation].&lt;br /&gt;
&lt;br /&gt;
[3] [https://github.com/expertiza/expertiza/pull/1629 E1986 Pull Request].&lt;br /&gt;
&lt;br /&gt;
[4] [https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2019_-_E1986._Allow_reviewers_to_bid_on_what_to_review#Project_Mentor E1986 Wiki page].&lt;/div&gt;</summary>
		<author><name>Skmuppal</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Intelligent.jpeg&amp;diff=134302</id>
		<title>File:Intelligent.jpeg</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Intelligent.jpeg&amp;diff=134302"/>
		<updated>2020-04-25T04:55:25Z</updated>

		<summary type="html">&lt;p&gt;Skmuppal: Skmuppal uploaded a new version of File:Intelligent.jpeg&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Skmuppal</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Intelligent.jpeg&amp;diff=134299</id>
		<title>File:Intelligent.jpeg</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Intelligent.jpeg&amp;diff=134299"/>
		<updated>2020-04-25T04:47:54Z</updated>

		<summary type="html">&lt;p&gt;Skmuppal: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Skmuppal</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Checkbox.png&amp;diff=133951</id>
		<title>File:Checkbox.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Checkbox.png&amp;diff=133951"/>
		<updated>2020-04-24T22:39:32Z</updated>

		<summary type="html">&lt;p&gt;Skmuppal: Skmuppal uploaded a new version of File:Checkbox.png&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Skmuppal</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Inconsitency.png&amp;diff=133939</id>
		<title>File:Inconsitency.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Inconsitency.png&amp;diff=133939"/>
		<updated>2020-04-24T22:19:03Z</updated>

		<summary type="html">&lt;p&gt;Skmuppal: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Skmuppal</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2020_-_E2021._Allow_reviewers_to_bid_on_what_to_review&amp;diff=133937</id>
		<title>CSC/ECE 517 Spring 2020 - E2021. Allow reviewers to bid on what to review</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2020_-_E2021._Allow_reviewers_to_bid_on_what_to_review&amp;diff=133937"/>
		<updated>2020-04-24T22:14:04Z</updated>

		<summary type="html">&lt;p&gt;Skmuppal: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== '''Problem Statement''' ==&lt;br /&gt;
The reviews performed by the students right now are being assigned on a first-come-first-serve basis. The task at hand is to implement a procedure so that the students can bid on the reviews that they would like to review, similar to the procedure of the assignment of the topics. The difference between the two procedures is that the assignment of the topic is a one-one mapping, i.e. a team is assigned to a single topic, whereas the assignment of the reviews is many-many mapping with each review being assigned to different students and each student assigned to different reviews.&lt;br /&gt;
&lt;br /&gt;
=== '''The need for a bidding system for reviews''' ===&lt;br /&gt;
&lt;br /&gt;
The bidding process, when implemented for reviews of projects, will hold several advantages. &lt;br /&gt;
&lt;br /&gt;
1. The users will be able to bid for reviewing the projects that would interest them. This will incentivize them to get a better understanding of the project requirements and provide the necessary feedback in a very informed manner.&lt;br /&gt;
&lt;br /&gt;
2. With the help of color coding, the students will be able to decide on the probability of being assigned to a particular review, that could help them in bidding wisely.&lt;br /&gt;
&lt;br /&gt;
3. It provides the team members working on the project, a very informed feedback on how to enhance their project. Because,the feedback is from people who really are interested on the project.&lt;br /&gt;
&lt;br /&gt;
4. It also helps the instructor in receiving more well-written, useful and meaningful feedback on what projects are more in demand among the students, which would be further useful in crafting the academic projects.&lt;br /&gt;
&lt;br /&gt;
=== '''What needs to be done'''===&lt;br /&gt;
The following are the tasks that are to be done-&lt;br /&gt;
&lt;br /&gt;
1. Implement Gale-Shapely version for many-to-many matching situations on a web service as mentioned in the paper [https://www.tayfunsonmez.net/wp-content/uploads/2013/10/AbdulkadirogluSonmez-AER20031.pdf].&lt;br /&gt;
&lt;br /&gt;
The Gale-Shapely version for many-to-many matching is an intelligent algorithm that allows users to achieve the review they will need. For example, let us consider a situation where user 'A' wants the review assigned to user 'B' and user 'B' wants the review assigned to user 'A'. Considering that it will motivate the students if they get the project that they would like to review, this mutual exchange between them would be beneficial. This classical problem can be solved using the following algorithm.&lt;br /&gt;
&lt;br /&gt;
[[File:bid.png |center|]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Motivation'''&lt;br /&gt;
&lt;br /&gt;
From a set '''R''' of available review topics, the user u from set '''U''' have to be matched with a pre-configured number of topics r1,r2,r3.....rk. So,the idea is to record the user priority and time-stamp at which r is bid. This information can then be used to change the color of the review in real time, which could further let the users know that their bid for this particular bis cannot be given a top priority. Once the bidding timeline is past, the recorded information for each bis is then fed to the algorithm, which would then match user u to review r1,r2,r3...rk.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''How should the algorithm match students '''S''' to the Review set '''R ''' ?&lt;br /&gt;
&lt;br /&gt;
The algorithm has to initially append additional reviews randomly in case, the user did not bid for the required number of reviews. Then based on the input data of the list for each student, which contains the topic,time-stamp and priority it has to allot the review to a student with earliest time stamp and highest priority.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Algorithm Steps'''&lt;br /&gt;
&lt;br /&gt;
1) Let the user bid, these bids will have time-stamps and priority(determined by the color of the bid at that time stamp).&lt;br /&gt;
&lt;br /&gt;
2) There will be cycles links of length 1 between the person who owns every review currently,which generates a directed acyclic graph.&lt;br /&gt;
&lt;br /&gt;
3) We the will need to break all the cycles in the graph and assign the reviews to which the user is pointing at. The top is represent as [ TOP(i) ]&lt;br /&gt;
&lt;br /&gt;
4) We can repeat this order until we have exhausted our preference list where all the assigned reviews are constantly deleted.&lt;br /&gt;
&lt;br /&gt;
5) We will repeat this process for all the slots of the bidding until the users gets all these review slots filled, making it many to many.&lt;br /&gt;
&lt;br /&gt;
[[File:bid1.png |center|]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
From the diagram we can see that the three users are represented as u1, u2, u3 and the the three reviews are r1,r2,r3. &lt;br /&gt;
&lt;br /&gt;
In '''phase 1''' : All users want the review 1 so all of them point to r1 and we see r1 is owned by u1 and r2 is owned by u2 and r3 by u3.&lt;br /&gt;
&lt;br /&gt;
In '''phase 2''' : u1 is assigned r1 and now u2 points to r3 which is now its highest priority because r1 is removed and similarly u3 points to r2.&lt;br /&gt;
&lt;br /&gt;
In '''phase 3''' : r2 is assigned to u3 and and r3 is assigned to u2, thus satisfying all.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
2. Add the front end code to allow the bidding on topics and call the appropriate web services from the lottery controller. This is similar to the already implemented bidding process on topics [https://github.com/expertiza/expertiza/pull/778/commits].&lt;br /&gt;
&lt;br /&gt;
'''Flow chart for this us functionality would involve :'''&lt;br /&gt;
&lt;br /&gt;
[[File:flow.png |center|]]&lt;br /&gt;
&lt;br /&gt;
=== '''Previous Work''' ===&lt;br /&gt;
The latest implementation of the problem was E1986 [https://github.com/expertiza/expertiza/pull/1629][https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2019_-_E1986._Allow_reviewers_to_bid_on_what_to_review#Project_Mentor].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We can see that they have figured out the issues with the bidding assignement being one to one and not many to one and have succesfully used the Gale-Shapely version for many-to-many matching algorithm to solve the issues. They have also fixed a few problems with the UI that were being faced with the buttons and writing proper test cases.&lt;br /&gt;
 &lt;br /&gt;
From the previous implementations we can see that the following files were modified in order to get the required implementation they have modified the following files :&lt;br /&gt;
&lt;br /&gt;
'''Modified Files'''&lt;br /&gt;
&lt;br /&gt;
routes.rb&lt;br /&gt;
&lt;br /&gt;
app/views/student_task/view.html.erb&lt;br /&gt;
&lt;br /&gt;
app/views/assignments/edit.html.erb&lt;br /&gt;
&lt;br /&gt;
app/controllers/student_task_controller&lt;br /&gt;
&lt;br /&gt;
'''New Files'''&lt;br /&gt;
&lt;br /&gt;
app/controllers/review_bidding.rb&lt;br /&gt;
&lt;br /&gt;
app/models/review_bidding_controller.rb&lt;br /&gt;
&lt;br /&gt;
app/views/sign_up_sheet/review_bid.html.erb&lt;br /&gt;
&lt;br /&gt;
Source Code for the Web Service&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== '''Problems found in previous work''' ===&lt;br /&gt;
The problems in the previous work were given-&lt;br /&gt;
&lt;br /&gt;
1. The link to the run bidding assignment is on the Review Strategy tab instead of the actions associated with an assignment like the topic assignment. This is an inconsistency in the UI that needs to be remedied.&lt;br /&gt;
&lt;br /&gt;
2. All of the implementation code was put in the controller which is inappropriate for a controller. The code should probably be in the corresponding model file.&lt;br /&gt;
&lt;br /&gt;
3. The tests that they have written are not adequate.&lt;br /&gt;
&lt;br /&gt;
4. It does not allow the Instructor, to decide to whether allow the bidding for reviews or not.&lt;br /&gt;
&lt;br /&gt;
=== '''Suggested Improvements'''===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
1. Change the location of the running bidding assignment to the appropriate location. This is because it is inconsistent with the UI and will require changes. &lt;br /&gt;
&lt;br /&gt;
The part of the code that requires modification is- app/views/assignments/edit.html.erb&lt;br /&gt;
&lt;br /&gt;
[[File:tab.PNG |center|]]&lt;br /&gt;
&lt;br /&gt;
As we can see from the code attached we need to move this code away from the Review Strategy tab.&lt;br /&gt;
&lt;br /&gt;
[[File:Locationchange.PNG |center|]]&lt;br /&gt;
&lt;br /&gt;
2. Write the code where it is suitable, following the DRY principles.&lt;br /&gt;
&lt;br /&gt;
The first file where we want to apply the principle to is the: app/controllers/review_bidding_controller.rb&lt;br /&gt;
&lt;br /&gt;
The code is shown below: &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:rbid.PNG |center|]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
From this, we can see there are a lot of assignment operations taking place which could be toned down a bit by choosing the exact variable required for the class. Also, the loop that runs in the controller appending values to signed_up_topics = [] should be moved to the model class and reduce the stress on the controller. Also the code  @bids = team_id.nil? ? [] : ReviewBid.where(participant_id:@participant,assignment_id:@assignment.id).order(:priority) in pretty deep coupled and could be broken down and moved to the model.&lt;br /&gt;
&lt;br /&gt;
In the same file, we notice the method: get_quartiles(topic_id) which assigns colors to the topics based on how much in demand they are. &lt;br /&gt;
&lt;br /&gt;
[[File:quar.PNG |center|]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We would like to again reduce the assignment statements and move the entire if structure to the model to return the colors reducing stress on the controller.&lt;br /&gt;
&lt;br /&gt;
The next function in this file is set_priority, where we want to rewrite the if structure because we fell its too long and has a very convoluted structure to it. The code shown below clearly shows the multiple nested if structs that we want to remove. Having multiple if structs could fail the code at unexpected edge points.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:set.PNG |center|]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3. Write suitable tests to ensure that the implementation is working.&lt;br /&gt;
&lt;br /&gt;
The previous implementation gave their try on implementing the required test but all of them are commented out. So, they are required to be redone during this implementation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:test.PNG |center|]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:test1.PNG |center|]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
4. Make sure the reviewer cannot bid for his own project.&lt;br /&gt;
&lt;br /&gt;
This was done in the previous implementation in both using the set_priority and review_bid methods, but the structure is pretty complex to these and we would like to work on reducing the complexity of these functions and also moving parts of these codes to the model.&lt;br /&gt;
&lt;br /&gt;
=== '''Plan for Testing'''===&lt;br /&gt;
&lt;br /&gt;
As of now, and as far as we understood the feature.&lt;br /&gt;
&lt;br /&gt;
=== '''Test Cases'''===&lt;br /&gt;
&lt;br /&gt;
There are a few cases that need to be tested.&lt;br /&gt;
&lt;br /&gt;
1. The first case would be to test for the scenario, where no reviewer bids i.e. no one has given a preference of any sort. Then the bidding algorithm should assign reviews randomly. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
2. The other case would be when all reviewers have selected a different project as their preference, at different times. This is an ideal scenario given that the reviewer cannot bid for his own project.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3. The other scenario would be when everyone selects the same project at the same or different times and does not provide any other choice or preference. This can be the scenario if one project is relatively interesting or easy to review in comparison to the others in the roster.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
4. Another scenario would be if some projects haven't been selected at all for reviewing, this case arises if the particular project may require additional effort on the part of the reviewing to successfully complete the review.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
5. A usual scenario is that the reviewers select all or most of the projects, and each project is on at least one reviewer's biding list.&lt;br /&gt;
&lt;br /&gt;
In all of the above cases, all the projects have to be assigned to at least one reviewer so that every project has been peer-reviewed.&lt;br /&gt;
&lt;br /&gt;
== '''References''' ==&lt;br /&gt;
[1] [https://www.tayfunsonmez.net/wp-content/uploads/2013/10/AbdulkadirogluSonmez-AER20031.pdf School Choice: A Mechanism Design Approach] by Atila Abdulkadiroğlu and Tayfun Sönmez.&lt;br /&gt;
&lt;br /&gt;
[2] [https://github.com/expertiza/expertiza/pull/778/commits Bidding Interface Implementation].&lt;br /&gt;
&lt;br /&gt;
[3] [https://github.com/expertiza/expertiza/pull/1629 E1986 Pull Request].&lt;br /&gt;
&lt;br /&gt;
[4] [https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2019_-_E1986._Allow_reviewers_to_bid_on_what_to_review#Project_Mentor E1986 Wiki page].&lt;/div&gt;</summary>
		<author><name>Skmuppal</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Asset_location_change.png&amp;diff=133936</id>
		<title>File:Asset location change.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Asset_location_change.png&amp;diff=133936"/>
		<updated>2020-04-24T22:11:24Z</updated>

		<summary type="html">&lt;p&gt;Skmuppal: Skmuppal uploaded a new version of File:Asset location change.png&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Skmuppal</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Asset_location_change.png&amp;diff=133929</id>
		<title>File:Asset location change.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Asset_location_change.png&amp;diff=133929"/>
		<updated>2020-04-24T22:02:15Z</updated>

		<summary type="html">&lt;p&gt;Skmuppal: Skmuppal uploaded a new version of File:Asset location change.png&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Skmuppal</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2020_-_E2021._Allow_reviewers_to_bid_on_what_to_review&amp;diff=133928</id>
		<title>CSC/ECE 517 Spring 2020 - E2021. Allow reviewers to bid on what to review</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2020_-_E2021._Allow_reviewers_to_bid_on_what_to_review&amp;diff=133928"/>
		<updated>2020-04-24T21:59:26Z</updated>

		<summary type="html">&lt;p&gt;Skmuppal: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== '''Problem Statement''' ==&lt;br /&gt;
The reviews performed by the students right now are being assigned on a first-come-first-serve basis. The task at hand is to implement a procedure so that the students can bid on the reviews that they would like to review, similar to the procedure of the assignment of the topics. The difference between the two procedures is that the assignment of the topic is a one-one mapping, i.e. a team is assigned to a single topic, whereas the assignment of the reviews is many-many mapping with each review being assigned to different students and each student assigned to different reviews.&lt;br /&gt;
&lt;br /&gt;
=== '''The need for a bidding system for reviews''' ===&lt;br /&gt;
&lt;br /&gt;
The bidding process, when implemented for reviews of projects, will hold several advantages. &lt;br /&gt;
&lt;br /&gt;
1. The users will be able to bid for reviewing the projects that would interest them. This will incentivize them to get a better understanding of the project requirements and provide the necessary feedback in a very informed manner.&lt;br /&gt;
&lt;br /&gt;
2. With the help of color coding, the students will be able to decide on the probability of being assigned to a particular review, that could help them in bidding wisely.&lt;br /&gt;
&lt;br /&gt;
3. It provides the team members working on the project, a very informed feedback on how to enhance their project. Because,the feedback is from people who really are interested on the project.&lt;br /&gt;
&lt;br /&gt;
4. It also helps the instructor in receiving more well-written, useful and meaningful feedback on what projects are more in demand among the students, which would be further useful in crafting the academic projects.&lt;br /&gt;
&lt;br /&gt;
=== '''What needs to be done'''===&lt;br /&gt;
The following are the tasks that are to be done-&lt;br /&gt;
&lt;br /&gt;
1. Implement Gale-Shapely version for many-to-many matching situations on a web service as mentioned in the paper [https://www.tayfunsonmez.net/wp-content/uploads/2013/10/AbdulkadirogluSonmez-AER20031.pdf].&lt;br /&gt;
&lt;br /&gt;
The Gale-Shapely version for many-to-many matching is an intelligent algorithm that allows users to achieve the review they will need. For example, let us consider a situation where user 'A' wants the review assigned to user 'B' and user 'B' wants the review assigned to user 'A'. Considering that it will motivate the students if they get the project that they would like to review, this mutual exchange between them would be beneficial. This classical problem can be solved using the following algorithm.&lt;br /&gt;
&lt;br /&gt;
[[File:bid.png |center|]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Motivation'''&lt;br /&gt;
&lt;br /&gt;
From a set '''R''' of available review topics, the user u from set '''U''' have to be matched with a pre-configured number of topics r1,r2,r3.....rk. So,the idea is to record the user priority and time-stamp at which r is bid. This information can then be used to change the color of the review in real time, which could further let the users know that their bid for this particular bis cannot be given a top priority. Once the bidding timeline is past, the recorded information for each bis is then fed to the algorithm, which would then match user u to review r1,r2,r3...rk.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''How should the algorithm match students '''S''' to the Review set '''R ''' ?&lt;br /&gt;
&lt;br /&gt;
The algorithm has to initially append additional reviews randomly in case, the user did not bid for the required number of reviews. Then based on the input data of the list for each student, which contains the topic,time-stamp and priority it has to allot the review to a student with earliest time stamp and highest priority.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Algorithm Steps'''&lt;br /&gt;
&lt;br /&gt;
1) Let the user bid, these bids will have time-stamps and priority(determined by the color of the bid at that time stamp).&lt;br /&gt;
&lt;br /&gt;
2) There will be cycles links of length 1 between the person who owns every review currently,which generates a directed acyclic graph.&lt;br /&gt;
&lt;br /&gt;
3) We the will need to break all the cycles in the graph and assign the reviews to which the user is pointing at. The top is represent as [ TOP(i) ]&lt;br /&gt;
&lt;br /&gt;
4) We can repeat this order until we have exhausted our preference list where all the assigned reviews are constantly deleted.&lt;br /&gt;
&lt;br /&gt;
5) We will repeat this process for all the slots of the bidding until the users gets all these review slots filled, making it many to many.&lt;br /&gt;
&lt;br /&gt;
[[File:bid1.png |center|]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
From the diagram we can see that the three users are represented as u1, u2, u3 and the the three reviews are r1,r2,r3. &lt;br /&gt;
&lt;br /&gt;
In '''phase 1''' : All users want the review 1 so all of them point to r1 and we see r1 is owned by u1 and r2 is owned by u2 and r3 by u3.&lt;br /&gt;
&lt;br /&gt;
In '''phase 2''' : u1 is assigned r1 and now u2 points to r3 which is now its highest priority because r1 is removed and similarly u3 points to r2.&lt;br /&gt;
&lt;br /&gt;
In '''phase 3''' : r2 is assigned to u3 and and r3 is assigned to u2, thus satisfying all.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
2. Add the front end code to allow the bidding on topics and call the appropriate web services from the lottery controller. This is similar to the already implemented bidding process on topics [https://github.com/expertiza/expertiza/pull/778/commits].&lt;br /&gt;
&lt;br /&gt;
'''Flow chart for this us functionality would involve :'''&lt;br /&gt;
&lt;br /&gt;
[[File:flow.png |center|]]&lt;br /&gt;
&lt;br /&gt;
=== '''Previous Work''' ===&lt;br /&gt;
The latest implementation of the problem was E1986 [https://github.com/expertiza/expertiza/pull/1629][https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2019_-_E1986._Allow_reviewers_to_bid_on_what_to_review#Project_Mentor].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We can see that they have figured out the issues with the bidding assignement being one to one and not many to one and have succesfully used the Gale-Shapely version for many-to-many matching algorithm to solve the issues. They have also fixed a few problems with the UI that were being faced with the buttons and writing proper test cases.&lt;br /&gt;
 &lt;br /&gt;
From the previous implementations we can see that the following files were modified in order to get the required implementation they have modified the following files :&lt;br /&gt;
&lt;br /&gt;
'''Modified Files'''&lt;br /&gt;
&lt;br /&gt;
routes.rb&lt;br /&gt;
&lt;br /&gt;
app/views/student_task/view.html.erb&lt;br /&gt;
&lt;br /&gt;
app/views/assignments/edit.html.erb&lt;br /&gt;
&lt;br /&gt;
app/controllers/student_task_controller&lt;br /&gt;
&lt;br /&gt;
'''New Files'''&lt;br /&gt;
&lt;br /&gt;
app/controllers/review_bidding.rb&lt;br /&gt;
&lt;br /&gt;
app/models/review_bidding_controller.rb&lt;br /&gt;
&lt;br /&gt;
app/views/sign_up_sheet/review_bid.html.erb&lt;br /&gt;
&lt;br /&gt;
Source Code for the Web Service&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== '''Problems found in previous work''' ===&lt;br /&gt;
The problems in the previous work were given-&lt;br /&gt;
&lt;br /&gt;
1. The link to the run bidding assignment is on the Review Strategy tab instead of the actions associated with an assignment like the topic assignment. This is an inconsistency in the UI that needs to be remedied.&lt;br /&gt;
&lt;br /&gt;
2. All of the implementation code was put in the controller which is inappropriate for a controller. The code should probably be in the corresponding model file.&lt;br /&gt;
&lt;br /&gt;
3. The tests that they have written are not adequate.&lt;br /&gt;
&lt;br /&gt;
4. It does not allow the Instructor, to decide to whether allow the bidding for reviews or not.&lt;br /&gt;
&lt;br /&gt;
=== '''Suggested Improvements'''===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
1. Change the location of the running bidding assignment to the appropriate location. This is because it is inconsistent with the UI and will require changes. &lt;br /&gt;
&lt;br /&gt;
The part of the code that requires modification is- app/views/assignments/edit.html.erb&lt;br /&gt;
&lt;br /&gt;
[[File:tab.PNG |center|]]&lt;br /&gt;
&lt;br /&gt;
As we can see from the code attached we need to move this code away from the Review Strategy tab.&lt;br /&gt;
&lt;br /&gt;
[[File:Locationchange.png]]&lt;br /&gt;
&lt;br /&gt;
2. Write the code where it is suitable, following the DRY principles.&lt;br /&gt;
&lt;br /&gt;
The first file where we want to apply the principle to is the: app/controllers/review_bidding_controller.rb&lt;br /&gt;
&lt;br /&gt;
The code is shown below: &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:rbid.PNG |center|]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
From this, we can see there are a lot of assignment operations taking place which could be toned down a bit by choosing the exact variable required for the class. Also, the loop that runs in the controller appending values to signed_up_topics = [] should be moved to the model class and reduce the stress on the controller. Also the code  @bids = team_id.nil? ? [] : ReviewBid.where(participant_id:@participant,assignment_id:@assignment.id).order(:priority) in pretty deep coupled and could be broken down and moved to the model.&lt;br /&gt;
&lt;br /&gt;
In the same file, we notice the method: get_quartiles(topic_id) which assigns colors to the topics based on how much in demand they are. &lt;br /&gt;
&lt;br /&gt;
[[File:quar.PNG |center|]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We would like to again reduce the assignment statements and move the entire if structure to the model to return the colors reducing stress on the controller.&lt;br /&gt;
&lt;br /&gt;
The next function in this file is set_priority, where we want to rewrite the if structure because we fell its too long and has a very convoluted structure to it. The code shown below clearly shows the multiple nested if structs that we want to remove. Having multiple if structs could fail the code at unexpected edge points.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:set.PNG |center|]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3. Write suitable tests to ensure that the implementation is working.&lt;br /&gt;
&lt;br /&gt;
The previous implementation gave their try on implementing the required test but all of them are commented out. So, they are required to be redone during this implementation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:test.PNG |center|]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:test1.PNG |center|]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
4. Make sure the reviewer cannot bid for his own project.&lt;br /&gt;
&lt;br /&gt;
This was done in the previous implementation in both using the set_priority and review_bid methods, but the structure is pretty complex to these and we would like to work on reducing the complexity of these functions and also moving parts of these codes to the model.&lt;br /&gt;
&lt;br /&gt;
=== '''Plan for Testing'''===&lt;br /&gt;
&lt;br /&gt;
As of now, and as far as we understood the feature.&lt;br /&gt;
&lt;br /&gt;
=== '''Test Cases'''===&lt;br /&gt;
&lt;br /&gt;
There are a few cases that need to be tested.&lt;br /&gt;
&lt;br /&gt;
1. The first case would be to test for the scenario, where no reviewer bids i.e. no one has given a preference of any sort. Then the bidding algorithm should assign reviews randomly. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
2. The other case would be when all reviewers have selected a different project as their preference, at different times. This is an ideal scenario given that the reviewer cannot bid for his own project.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3. The other scenario would be when everyone selects the same project at the same or different times and does not provide any other choice or preference. This can be the scenario if one project is relatively interesting or easy to review in comparison to the others in the roster.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
4. Another scenario would be if some projects haven't been selected at all for reviewing, this case arises if the particular project may require additional effort on the part of the reviewing to successfully complete the review.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
5. A usual scenario is that the reviewers select all or most of the projects, and each project is on at least one reviewer's biding list.&lt;br /&gt;
&lt;br /&gt;
In all of the above cases, all the projects have to be assigned to at least one reviewer so that every project has been peer-reviewed.&lt;br /&gt;
&lt;br /&gt;
== '''References''' ==&lt;br /&gt;
[1] [https://www.tayfunsonmez.net/wp-content/uploads/2013/10/AbdulkadirogluSonmez-AER20031.pdf School Choice: A Mechanism Design Approach] by Atila Abdulkadiroğlu and Tayfun Sönmez.&lt;br /&gt;
&lt;br /&gt;
[2] [https://github.com/expertiza/expertiza/pull/778/commits Bidding Interface Implementation].&lt;br /&gt;
&lt;br /&gt;
[3] [https://github.com/expertiza/expertiza/pull/1629 E1986 Pull Request].&lt;br /&gt;
&lt;br /&gt;
[4] [https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2019_-_E1986._Allow_reviewers_to_bid_on_what_to_review#Project_Mentor E1986 Wiki page].&lt;/div&gt;</summary>
		<author><name>Skmuppal</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Asset_location_change.png&amp;diff=133926</id>
		<title>File:Asset location change.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Asset_location_change.png&amp;diff=133926"/>
		<updated>2020-04-24T21:56:38Z</updated>

		<summary type="html">&lt;p&gt;Skmuppal: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Skmuppal</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2020_-_E2021._Allow_reviewers_to_bid_on_what_to_review&amp;diff=133420</id>
		<title>CSC/ECE 517 Spring 2020 - E2021. Allow reviewers to bid on what to review</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2020_-_E2021._Allow_reviewers_to_bid_on_what_to_review&amp;diff=133420"/>
		<updated>2020-04-14T00:35:31Z</updated>

		<summary type="html">&lt;p&gt;Skmuppal: /* Plan for Testing */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== '''Motivation''' ==&lt;br /&gt;
&lt;br /&gt;
Currently, the projects to review are assigned to the reviewers on a first come first serve basis. This policy does not let the reviewers investigate and learn from the projects they are specifically interested in. Therefore, the idea here is to let the students decide on what projects they wish to review in a fair manner by placing a bidding policy.&lt;br /&gt;
&lt;br /&gt;
== '''Problem Statement''' ==&lt;br /&gt;
The reviews performed by the students right now are being assigned on a first-come-first-serve basis. The task at hand is to implement a procedure so that the students can bid on the reviews that they would like to review, similar to the procedure of the assignment of the topics. The difference between the two procedures is that the assignment of the topic is a one-one mapping, i.e. a team is assigned to a single topic, whereas the assignment of the reviews is many-many mapping with each review being assigned to different students and each student assigned to different reviews.&lt;br /&gt;
&lt;br /&gt;
=== '''The need for a bidding system for reviews''' ===&lt;br /&gt;
&lt;br /&gt;
The bidding process, when implemented for reviews of projects, will hold several advantages. &lt;br /&gt;
&lt;br /&gt;
1. The users will be able to bid for reviews that interest them. This will incentivize them to get a better understanding of the project requirements and provide the necessary feedback in an informed manner.&lt;br /&gt;
&lt;br /&gt;
2. Bidding provides the users receiving feedback a very informed report on how to enhance their project. This will help them get better results for their respective projects.&lt;br /&gt;
&lt;br /&gt;
3. The bidding also gives an advantage to the instructor because the instructor will now be able to receive more well-written, useful and meaningful feedback that will be more useful in their academic projects.&lt;br /&gt;
&lt;br /&gt;
=== '''What needs to be done'''===&lt;br /&gt;
The following are the tasks that are to be done-&lt;br /&gt;
&lt;br /&gt;
1. Implement top trading cycles on a web service as mentioned in the paper [https://www.tayfunsonmez.net/wp-content/uploads/2013/10/AbdulkadirogluSonmez-AER20031.pdf].&lt;br /&gt;
&lt;br /&gt;
The top trading cycles is an intelligent algorithm that allows users to achieve the review they will need. For example, let us consider a situation where user 'A' wants the review assigned to user 'B' and user 'B' wants the review assigned to user 'A'. Considering that it will motivate the students if they get the project that they would like to review, this mutual exchange between them would be beneficial. It can be solved using the top trading cycles algorithm.&lt;br /&gt;
&lt;br /&gt;
[[File:bid.png |center|]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Algorithm Steps'''&lt;br /&gt;
&lt;br /&gt;
1) Let the user bid, these bids will point to the reviews they are requesting for in the graph.&lt;br /&gt;
&lt;br /&gt;
2) There will be cycles links of length 1 between the person who owns ever review currently, a directed acyclic graph.&lt;br /&gt;
&lt;br /&gt;
3) We will need to break all the cycles in the graph and assign the reviews to which the user is pointing at. The top is represent as [ TOP(i) ]&lt;br /&gt;
&lt;br /&gt;
4) We can repeat this order until we have exhausted our preference list where all the assigned houses are constantly deleted.&lt;br /&gt;
&lt;br /&gt;
5) we will repeat this bidding process for all slot of the bidding until the user gets all this review slots filled, making it many to many.&lt;br /&gt;
&lt;br /&gt;
[[File:bid1.png |center|]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
From the diagram we can see that the three users are represented as u1, u2, u3 and the the three reviews are r1,r2,r3. &lt;br /&gt;
&lt;br /&gt;
In '''phase 1''' : all users want the review 1 so all of them point to r1 and we see r1 is owned by u1 and r2 is owned by u2 and r3 by u3.&lt;br /&gt;
&lt;br /&gt;
In '''phase 2''' : u1 is assigned r1 and now u2 points to r3 which is now its highest priority because r1 is removed and similarly u3 points to r2.&lt;br /&gt;
&lt;br /&gt;
In '''phase 3''': r2 is assigned to u3 and and r3 is assigned to u2, thus satisfying all.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
2. Add the front end code to allow the bidding on topics and call the appropriate web services from the lottery controller. This is similar to the already implemented bidding process on topics [https://github.com/expertiza/expertiza/pull/778/commits].&lt;br /&gt;
&lt;br /&gt;
'''flow chart for this us functionality would involve :'''&lt;br /&gt;
&lt;br /&gt;
[[File:flow.png |center|]]&lt;br /&gt;
&lt;br /&gt;
=== '''Previous Work''' ===&lt;br /&gt;
The latest implementation of the problem was E1986 [https://github.com/expertiza/expertiza/pull/1629][https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2019_-_E1986._Allow_reviewers_to_bid_on_what_to_review#Project_Mentor].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We can see that they have figured out the issues with the bidding assignement being one to one and not many to one and have succesfully used the Gale-Shapely version for many-to-many matching algorithm to solve the issues. They have also fixed a few problems with the UI that were being faced with the buttons and writing proper test cases.&lt;br /&gt;
 &lt;br /&gt;
From the previous implementations we can see that the following files were modified in order to get the required implementation they have modified the following files :&lt;br /&gt;
&lt;br /&gt;
'''Modified Files'''&lt;br /&gt;
&lt;br /&gt;
routes.rb&lt;br /&gt;
&lt;br /&gt;
app/views/student_task/view.html.erb&lt;br /&gt;
&lt;br /&gt;
app/views/assignments/edit.html.erb&lt;br /&gt;
&lt;br /&gt;
app/controllers/student_task_controller&lt;br /&gt;
&lt;br /&gt;
'''New Files'''&lt;br /&gt;
&lt;br /&gt;
app/controllers/review_bidding.rb&lt;br /&gt;
&lt;br /&gt;
app/models/review_bidding_controller.rb&lt;br /&gt;
&lt;br /&gt;
app/views/sign_up_sheet/review_bid.html.erb&lt;br /&gt;
&lt;br /&gt;
Source Code for the Web Service&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== '''Problems found in previous work''' ===&lt;br /&gt;
The problems in the previous work were given-&lt;br /&gt;
&lt;br /&gt;
1. The link to the run bidding assignment is on the Review Strategy tab instead of the actions associated with an assignment like the topic assignment. This is an inconsistency in the UI that needs to be remedied.&lt;br /&gt;
&lt;br /&gt;
2. All of the implementation code was put in the controller which is inappropriate for a controller. The code should probably be in the corresponding model file.&lt;br /&gt;
&lt;br /&gt;
3. The tests that they have written are not adequate.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== '''Suggested Improvements'''===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
1. Change the location of the running bidding assignment to the appropriate location. This is because it is inconsistent with the UI and will require changes. &lt;br /&gt;
&lt;br /&gt;
The part of the code that requires modification is : app/views/assignments/edit.html.erb&lt;br /&gt;
&lt;br /&gt;
[[File:tab.PNG |center|]]&lt;br /&gt;
&lt;br /&gt;
As we can see from the code attached we need to move this code away from the Review Strategy tab.&lt;br /&gt;
&lt;br /&gt;
2. Write the code where it is suitable, following the DRY principles.&lt;br /&gt;
&lt;br /&gt;
3. Write suitable tests to ensure that the implementation is working.&lt;br /&gt;
&lt;br /&gt;
4. Make sure the reviewer can't bid for his own project.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== '''Plan for Testing'''===&lt;br /&gt;
&lt;br /&gt;
As of now, and as far as we understood the feature.&lt;br /&gt;
&lt;br /&gt;
There are a few cases that need to be tested.&lt;br /&gt;
&lt;br /&gt;
1) The first case would be to test for the scenario, where no reviewer bids i.e. no one has given a preference of any sort. Then the bidding algorithm should assign reviews randomly. &lt;br /&gt;
&lt;br /&gt;
2) The other case would be when all reviewers have selected a different project as their preference, at different times. This is an ideal scenario given that the reviewer cannot bid for his own project.&lt;br /&gt;
&lt;br /&gt;
3) The other scenario would be when everyone selects the same project at the same or different times and doesn't provide any other choice or preference. This can be the scenario if one project is relatively interesting or easy to review in comparison to the others in the roster.&lt;br /&gt;
&lt;br /&gt;
4) Another scenario would be if some projects haven't been selected at all for reviewing, this case arises if the particular project may require additional effort on the part of the reviewing to successfully complete the review.&lt;br /&gt;
&lt;br /&gt;
5) A usual scenario is that the reviewers select all or most of the projects, and each project is on at least one reviewers biding list.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In all of the above cases, all the projects have to be assigned to at least one reviewer so that every project has been peer-reviewed.&lt;br /&gt;
&lt;br /&gt;
== '''References''' ==&lt;br /&gt;
[1] [https://www.tayfunsonmez.net/wp-content/uploads/2013/10/AbdulkadirogluSonmez-AER20031.pdf School Choice: A Mechanism Design Approach] by Atila Abdulkadiroğlu and Tayfun Sönmez.&lt;br /&gt;
&lt;br /&gt;
[2] [https://github.com/expertiza/expertiza/pull/778/commits Bidding Interface Implementation].&lt;br /&gt;
&lt;br /&gt;
[3] [https://github.com/expertiza/expertiza/pull/1629 E1986 Pull Request].&lt;br /&gt;
&lt;br /&gt;
[4] [https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2019_-_E1986._Allow_reviewers_to_bid_on_what_to_review#Project_Mentor E1986 Wiki page].&lt;/div&gt;</summary>
		<author><name>Skmuppal</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2020_-_E2021._Allow_reviewers_to_bid_on_what_to_review&amp;diff=133413</id>
		<title>CSC/ECE 517 Spring 2020 - E2021. Allow reviewers to bid on what to review</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2020_-_E2021._Allow_reviewers_to_bid_on_what_to_review&amp;diff=133413"/>
		<updated>2020-04-14T00:31:29Z</updated>

		<summary type="html">&lt;p&gt;Skmuppal: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== '''Motivation''' ==&lt;br /&gt;
&lt;br /&gt;
Currently, the projects to review are assigned to the reviewers on a first come first serve basis. This policy does not let the reviewers investigate and learn from the projects they are specifically interested in. Therefore, the idea here is to let the students decide on what projects they wish to review in a fair manner by placing a bidding policy.&lt;br /&gt;
&lt;br /&gt;
== '''Problem Statement''' ==&lt;br /&gt;
The reviews performed by the students right now are being assigned on a first-come-first-serve basis. The task at hand is to implement a procedure so that the students can bid on the reviews that they would like to review, similar to the procedure of the assignment of the topics. The difference between the two procedures is that the assignment of the topic is a one-one mapping, i.e. a team is assigned to a single topic, whereas the assignment of the reviews is many-many mapping with each review being assigned to different students and each student assigned to different reviews.&lt;br /&gt;
&lt;br /&gt;
=== '''The need for a bidding system for reviews''' ===&lt;br /&gt;
&lt;br /&gt;
The bidding process, when implemented for reviews of projects, will hold several advantages. &lt;br /&gt;
&lt;br /&gt;
1. The users will be able to bid for reviews that interest them. This will incentivize them to get a better understanding of the project requirements and provide the necessary feedback in an informed manner.&lt;br /&gt;
&lt;br /&gt;
2. Bidding provides the users receiving feedback a very informed report on how to enhance their project. This will help them get better results for their respective projects.&lt;br /&gt;
&lt;br /&gt;
3. The bidding also gives an advantage to the instructor because the instructor will now be able to receive more well-written, useful and meaningful feedback that will be more useful in their academic projects.&lt;br /&gt;
&lt;br /&gt;
=== '''What needs to be done'''===&lt;br /&gt;
The following are the tasks that are to be done-&lt;br /&gt;
&lt;br /&gt;
1. Implement top trading cycles on a web service as mentioned in the paper [https://www.tayfunsonmez.net/wp-content/uploads/2013/10/AbdulkadirogluSonmez-AER20031.pdf].&lt;br /&gt;
&lt;br /&gt;
The top trading cycles is an intelligent algorithm that allows users to achieve the review they will need. For example, let us consider a situation where user 'A' wants the review assigned to user 'B' and user 'B' wants the review assigned to user 'A'. Considering that it will motivate the students if they get the project that they would like to review, this mutual exchange between them would be beneficial. It can be solved using the top trading cycles algorithm.&lt;br /&gt;
&lt;br /&gt;
[[File:bid.png |center|]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Algorithm Steps'''&lt;br /&gt;
&lt;br /&gt;
1) Let the user bid, these bids will point to the reviews they are requesting for in the graph.&lt;br /&gt;
&lt;br /&gt;
2) There will be cycles links of length 1 between the person who owns ever review currently, a directed acyclic graph.&lt;br /&gt;
&lt;br /&gt;
3) We will need to break all the cycles in the graph and assign the reviews to which the user is pointing at. The top is represent as [ TOP(i) ]&lt;br /&gt;
&lt;br /&gt;
4) We can repeat this order until we have exhausted our preference list where all the assigned houses are constantly deleted.&lt;br /&gt;
&lt;br /&gt;
5) we will repeat this bidding process for all slot of the bidding until the user gets all this review slots filled, making it many to many.&lt;br /&gt;
&lt;br /&gt;
[[File:bid1.png |center|]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
From the diagram we can see that the three users are represented as u1, u2, u3 and the the three reviews are r1,r2,r3. &lt;br /&gt;
&lt;br /&gt;
In '''phase 1''' : all users want the review 1 so all of them point to r1 and we see r1 is owned by u1 and r2 is owned by u2 and r3 by u3.&lt;br /&gt;
&lt;br /&gt;
In '''phase 2''' : u1 is assigned r1 and now u2 points to r3 which is now its highest priority because r1 is removed and similarly u3 points to r2.&lt;br /&gt;
&lt;br /&gt;
In '''phase 3''': r2 is assigned to u3 and and r3 is assigned to u2, thus satisfying all.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
2. Add the front end code to allow the bidding on topics and call the appropriate web services from the lottery controller. This is similar to the already implemented bidding process on topics [https://github.com/expertiza/expertiza/pull/778/commits].&lt;br /&gt;
&lt;br /&gt;
'''flow chart for this us functionality would involve :'''&lt;br /&gt;
&lt;br /&gt;
[[File:flow.png |center|]]&lt;br /&gt;
&lt;br /&gt;
=== '''Previous Work''' ===&lt;br /&gt;
The latest implementation of the problem was E1986 [https://github.com/expertiza/expertiza/pull/1629][https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2019_-_E1986._Allow_reviewers_to_bid_on_what_to_review#Project_Mentor].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We can see that they have figured out the issues with the bidding assignement being one to one and not many to one and have succesfully used the Gale-Shapely version for many-to-many matching algorithm to solve the issues. They have also fixed a few problems with the UI that were being faced with the buttons and writing proper test cases.&lt;br /&gt;
 &lt;br /&gt;
From the previous implementations we can see that the following files were modified in order to get the required implementation they have modified the following files :&lt;br /&gt;
&lt;br /&gt;
'''Modified Files'''&lt;br /&gt;
&lt;br /&gt;
routes.rb&lt;br /&gt;
&lt;br /&gt;
app/views/student_task/view.html.erb&lt;br /&gt;
&lt;br /&gt;
app/views/assignments/edit.html.erb&lt;br /&gt;
&lt;br /&gt;
app/controllers/student_task_controller&lt;br /&gt;
&lt;br /&gt;
'''New Files'''&lt;br /&gt;
&lt;br /&gt;
app/controllers/review_bidding.rb&lt;br /&gt;
&lt;br /&gt;
app/models/review_bidding_controller.rb&lt;br /&gt;
&lt;br /&gt;
app/views/sign_up_sheet/review_bid.html.erb&lt;br /&gt;
&lt;br /&gt;
Source Code for the Web Service&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== '''Problems found in previous work''' ===&lt;br /&gt;
The problems in the previous work were given-&lt;br /&gt;
&lt;br /&gt;
1. The link to the run bidding assignment is on the Review Strategy tab instead of the actions associated with an assignment like the topic assignment. This is an inconsistency in the UI that needs to be remedied.&lt;br /&gt;
&lt;br /&gt;
2. All of the implementation code was put in the controller which is inappropriate for a controller. The code should probably be in the corresponding model file.&lt;br /&gt;
&lt;br /&gt;
3. The tests that they have written are not adequate.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== '''Suggested Improvements'''===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
1. Change the location of the running bidding assignment to the appropriate location. This is because it is inconsistent with the UI and will require changes. &lt;br /&gt;
&lt;br /&gt;
The part of the code that requires modification is : app/views/assignments/edit.html.erb&lt;br /&gt;
&lt;br /&gt;
[[File:tab.PNG |center|]]&lt;br /&gt;
&lt;br /&gt;
As we can see from the code attached we need to move this code away from the Review Strategy tab.&lt;br /&gt;
&lt;br /&gt;
2. Write the code where it is suitable, following the DRY principles.&lt;br /&gt;
&lt;br /&gt;
3. Write suitable tests to ensure that the implementation is working.&lt;br /&gt;
&lt;br /&gt;
4. Make sure the reviewer can't bid for his own project.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== '''Plan for Testing'''===&lt;br /&gt;
&lt;br /&gt;
As of now, and as far as we understood the feature.&lt;br /&gt;
&lt;br /&gt;
There are a few cases that need to be tested.&lt;br /&gt;
&lt;br /&gt;
1) The first case would be to test for the scenario, where no reviewer bids i.e. no one has given a preference of any sort. Then the bidding algorithm should assign reviews randomly. &lt;br /&gt;
&lt;br /&gt;
2) The other case would be when all reviewers have selected a different project as their preference, at different times. This is an ideal scenario given that the reviewer cannot bid for his own project.&lt;br /&gt;
&lt;br /&gt;
3) The other scenario would be when everyone selects the same project at the same or different times and doesn't provide any other choice or preference. This can be the scenario if one project is relatively interesting or easy to review in comparison to the others in the roster.&lt;br /&gt;
&lt;br /&gt;
4) Another scenario would be if some projects haven't been selected at all for reviewing, this case arises if the particular project may require additional effort on the part of the reviewing to successfully complete the review.&lt;br /&gt;
&lt;br /&gt;
5) A usual scenario is that the reviewers select all or most of the projects, and each project is on at least one reviewers biding list.&lt;br /&gt;
&lt;br /&gt;
== '''References''' ==&lt;br /&gt;
[1] [https://www.tayfunsonmez.net/wp-content/uploads/2013/10/AbdulkadirogluSonmez-AER20031.pdf School Choice: A Mechanism Design Approach] by Atila Abdulkadiroğlu and Tayfun Sönmez.&lt;br /&gt;
&lt;br /&gt;
[2] [https://github.com/expertiza/expertiza/pull/778/commits Bidding Interface Implementation].&lt;br /&gt;
&lt;br /&gt;
[3] [https://github.com/expertiza/expertiza/pull/1629 E1986 Pull Request].&lt;br /&gt;
&lt;br /&gt;
[4] [https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2019_-_E1986._Allow_reviewers_to_bid_on_what_to_review#Project_Mentor E1986 Wiki page].&lt;/div&gt;</summary>
		<author><name>Skmuppal</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2020_-_M2000._Implement_ImageBitMap_web_API&amp;diff=132520</id>
		<title>CSC/ECE 517 Spring 2020 - M2000. Implement ImageBitMap web API</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2020_-_M2000._Implement_ImageBitMap_web_API&amp;diff=132520"/>
		<updated>2020-03-31T22:40:26Z</updated>

		<summary type="html">&lt;p&gt;Skmuppal: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;A new browser technology that is being implemented with the new rust language to take advantage of the concurrency features of the language is the servo. [https://en.wikipedia.org/wiki/Rust_(programming_language)]. It is an innovation that will be using compiling in a very synchronous style as well as support things like web assembly code. It was an implementation that was a result of the effort of Mozilla research with aid from Samsung to help port it to android and arm processors. The servo does not yet have any support for the ImageBitmap which eventually makes it difficult to write it to the canvas in real-time without any undue latency in the process. This could lead to servo being slow and having very little graphical support, hence it will be requiring to implement support for ImageBitmap to make sure the process is smooth and efficient for graphical canvas support.&lt;br /&gt;
&lt;br /&gt;
=='''Pull Request'''==&lt;br /&gt;
&lt;br /&gt;
The pull request for this implementation has been merged.[https://github.com/servo/servo/pull/26009]&lt;br /&gt;
&lt;br /&gt;
It passes all the test cases and also the build is passing.[https://github.com/servo/servo/pull/26009]&lt;br /&gt;
&lt;br /&gt;
It contains only one commit as the servo DOM peer had asked us to squash all the commits into one for easier integration into the master servo implementation.&lt;br /&gt;
&lt;br /&gt;
The whole list of commits can be found in the [https://github.com/servo/servo/pull/26009/commits/8c405546a2023c3e098d9450c2d755392d3d5c9c log details] of that commit.&lt;br /&gt;
&lt;br /&gt;
=='''Comments for the code'''==&lt;br /&gt;
&lt;br /&gt;
We will not be having detailed comments for each function of the code, because the servo community does not encourage comments which are not required. &lt;br /&gt;
&lt;br /&gt;
The comments that are more than what is required will fail the servo build checks.&lt;br /&gt;
&lt;br /&gt;
To make up for that, we try to explain wherever possible the code that we have written in this documentation.&lt;br /&gt;
&lt;br /&gt;
=='''Introduction'''==&lt;br /&gt;
&lt;br /&gt;
===Servo===&lt;br /&gt;
Servo [https://en.wikipedia.org/wiki/Servo_(layout_engine)] which is born as an intention from Mozilla to produce an open-source web engine that will work on the rust language implementation[https://www.rust-lang.org/]. It works on a parallel setup where the various rendering activities take place in a highly parallel nature.&lt;br /&gt;
&lt;br /&gt;
The entire nature of flow for the servo is shown in the below diagram:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Flowofservo.png ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here we can see that the servo parses the contents of html and css using dom, which runs on the rust scripts and produces a flow tree using the styling elements. It then renders them as layers which are produced as output using composition.[https://www.slideshare.net/SamsungOSG/how-servo-renders-the-web-52095380]&lt;br /&gt;
&lt;br /&gt;
===Rust===&lt;br /&gt;
Rust [https://doc.rust-lang.org/book/index.html] Rust again is born out of an intention from Mozilla to implement a programming language that is highly efficient for parallel processing that will make sure the threads are safe in execution and implementation. It is being used in the servo browser.&lt;br /&gt;
&lt;br /&gt;
===DOM===&lt;br /&gt;
DOM stands for Document Object Model. It is a method that is being used by web-browsers to effectively arrange web pages and use them in a structured manner. Servo also uses the concept of dom to efficiently access the structure of how the web pages are stored and used effectively.&lt;br /&gt;
&lt;br /&gt;
the general dom structure is shown below that has all head and body elements with a hyperlink :&lt;br /&gt;
&lt;br /&gt;
[[File:dom.png ]]&lt;br /&gt;
&lt;br /&gt;
===Scope===&lt;br /&gt;
Several browsers that we know have the ability to create images of bitmaps that can be reproduced for graphical purposes on canvas elements. The new servo browser from Mozilla is something that has canvas, thus the aim would be to implement code to support imagebitmap() for canvas in the servo.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Untitled_Diagram_(14).png ]]&lt;br /&gt;
&lt;br /&gt;
===Image Bitmap===&lt;br /&gt;
&lt;br /&gt;
Interface for imagebitmap[https://developer.mozilla.org/en-US/docs/Web/API/ImageBitmap] is something that represents an image which is a bitmap that can be drawn to a  &amp;lt;canvas&amp;gt; [https://developer.mozilla.org/en-US/docs/Web/HTML/Element/canvas] without undue latency. the createimagebitmap() factory method is used to produce these images for implementation.&lt;br /&gt;
&lt;br /&gt;
The general flow of an imagebitmap method would be : &lt;br /&gt;
&lt;br /&gt;
[[File:bitmapgeneral.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here we see that the browser holds the main thread which will request the worker thread to obtain the URL that is being passed and uses it to create the image bitmap, Once the image has been created we will be transferring it back to the main thread where the canvas would be drawing the image created.[https://developers.google.com/web/updates/2016/03/createimagebitmap-in-chrome-50]&lt;br /&gt;
&lt;br /&gt;
===Implementation Steps===&lt;br /&gt;
&lt;br /&gt;
The following steps have been implemented:&lt;br /&gt;
&lt;br /&gt;
Step 1- add a ImageBitmap WebIDL interface to components/script/dom/webidls &lt;br /&gt;
&lt;br /&gt;
Step 2- Implement its Rust code in components/script/dom/imagebitmap.rs that is backed by a Vec&amp;lt;u8&amp;gt; buffer&lt;br /&gt;
&lt;br /&gt;
=='''Design Pattern'''==&lt;br /&gt;
&lt;br /&gt;
Our project will not require any design patterns as it will only require the implementation of the methods. Please see below for the steps required in the implementation.&lt;br /&gt;
&lt;br /&gt;
=='''Implementation'''==&lt;br /&gt;
&lt;br /&gt;
The following are the steps that are present it the implementation project description [https://github.com/servo/servo/wiki/Implement-ImageBitmap-project].&lt;br /&gt;
&lt;br /&gt;
'''Step 1:''' add a ImageBitmap WebIDL interface [https://github.com/SasiDharKM/servo/blob/master/components/script/dom/webidls/ImageBitmap.webidl] to components/script/dom/webidls &lt;br /&gt;
&lt;br /&gt;
The webidl information is from the official standard webidl[https://html.spec.whatwg.org/multipage/imagebitmap-and-animations.html#imagebitmap].&lt;br /&gt;
&lt;br /&gt;
Please note that we have removed the &amp;quot;Serializable&amp;quot; and &amp;quot;Transferable&amp;quot; components from the webidl as they are not required for this implementation.&lt;br /&gt;
&lt;br /&gt;
[[File:Webidl.PNG]]&lt;br /&gt;
&lt;br /&gt;
From the implemented the imagebitmap webidl for the dom struct that will be taking the height and width as its attributes.&lt;br /&gt;
&lt;br /&gt;
The webidl specifies that it will hold an interface of the imagebitmap which will have attributes of height and width as unsigned long integers represent as the below diagram.&lt;br /&gt;
&lt;br /&gt;
[[File:bitmap.png]]&lt;br /&gt;
&lt;br /&gt;
enum specifies the various options that are available to the input image type that could be CanvasImageSouce or Blob or ImageData. The options will be used to manipulated these input types specifically - ImageOrientation, preMulitplyAlpha,ColourSpaceCoversion,ResizeQuality&lt;br /&gt;
&lt;br /&gt;
[[File:enum.png]]&lt;br /&gt;
&lt;br /&gt;
The imagebitmap options dictionary will be creating key-value pairs for these with initial default values as seen in the image below :&lt;br /&gt;
&lt;br /&gt;
[[File:dict.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Step 2:''' Create a imagebitmap.rs code implementation [https://github.com/SasiDharKM/servo/blob/master/components/script/dom/imagebitmap.rs] for the webidl&lt;br /&gt;
&lt;br /&gt;
Below we have implemented the image bitmap rust code that uses all the crates[https://doc.rust-lang.org/book/ch07-01-packages-and-crates.html]. Crates are the packages for rust implementation that can be imported.&lt;br /&gt;
&lt;br /&gt;
[[File:rs_crates.PNG]]&lt;br /&gt;
&lt;br /&gt;
The code here creates the crates for the rust implementation. The bitmap options are bound followed by binding to dom root and global scope. Fallible is used to check errors, Reflector is used to link the js side to the rust code. We also use vector of u8 charset to store the bitmap implementation &lt;br /&gt;
&lt;br /&gt;
In the below image we can see the way the reflector object in the above code is used to access and link the javascript objects using rust. The rust node contains the reflector which is using to bind the javascript object every time a thing is manipulated on the rust side.&lt;br /&gt;
&lt;br /&gt;
'''Reflector design in dom'''&lt;br /&gt;
&lt;br /&gt;
[[File:Reflector.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The dom_struct is the DOM structure that the ImageBitMap data has from the javascript object. It consists of the following-&lt;br /&gt;
&lt;br /&gt;
1. Reflector - a reflector has the pointer to the required JavaScript object.&lt;br /&gt;
&lt;br /&gt;
2. width and height - the width and the height part of the ImageBitMap's data as mentioned in the webidl file. The required datatype[https://doc.rust-lang.org/book/ch03-02-data-types.html] is 32-bit unsigned integers, denoted by u32.&lt;br /&gt;
&lt;br /&gt;
3. As the imagebitmap needs to be implemented backed b a &amp;lt;Vec8&amp;gt; buffer, as mentioned in the problem statement, the DomRefCell&amp;lt;Vec&amp;lt;u8&amp;gt;&amp;gt; has been used. Where, u8 stands for 8-bit unsigned integer, which is used to hold the data of colour model[https://en.wikipedia.org/wiki/Color_model] and DOMRefCell is the RefCell[https://doc.rust-lang.org/std/cell/struct.RefCell.html] equivalent for the DOM implementation. RefCell is a wrapper used to make the data mutable, which is a required property here as the colour data might be altering.&lt;br /&gt;
&lt;br /&gt;
[[File:rs_dom_struct.PNG]]&lt;br /&gt;
&lt;br /&gt;
The image below shows how this struct is organised&lt;br /&gt;
&lt;br /&gt;
[[File:struct.png]]&lt;br /&gt;
&lt;br /&gt;
Here we implement the code that reads in the various attributes and the javascript objects required (shown below). We use the words '''impl ImageBitmap'''[https://doc.rust-lang.org/std/keyword.impl.html] which means the implementation of the ImageBitmap type. It will be using the '''newinherited''' and the '''new''' methods to obtain the required javascript objects and resolve the intended promises.&lt;br /&gt;
&lt;br /&gt;
'''new_inheritence''' method is where the new instance of the ImageBitmap is created. '''new''' method is where the javascript object is connected to the ImageBitmap object[https://jeenalee.com/2016/10/03/implementing-doge-for-servo.html].&lt;br /&gt;
&lt;br /&gt;
[[File:rs_impl_ibm.PNG]]&lt;br /&gt;
&lt;br /&gt;
Here we implement the code for the getter methods for '''height''' and '''width''' attributes for an ImageBitmap object. We use '''impl ImageBitmapMethods for ImageBitmap''' here which includes only the methods that are required as part of the implementation of the ImageBitmap.&lt;br /&gt;
&lt;br /&gt;
[[File:rs_impl_methods.PNG]]&lt;br /&gt;
&lt;br /&gt;
The height and width attributes are as shown below :&lt;br /&gt;
&lt;br /&gt;
[[File:hw.png]]&lt;br /&gt;
&lt;br /&gt;
The detailed description of the algorithm that has been implemented can be seen in the HTML Standard [https://html.spec.whatwg.org/multipage/imagebitmap-and-animations.html#imagebitmap].&lt;br /&gt;
&lt;br /&gt;
'''Note''': Please note that the implementation does not have detailed comments as we were asked to remove them since they are against the servo implementation guidelines.&lt;br /&gt;
&lt;br /&gt;
=='''How to Setup and Run'''==&lt;br /&gt;
The following are the steps to build the servo.&lt;br /&gt;
&lt;br /&gt;
1. git clone the servo repository&lt;br /&gt;
&lt;br /&gt;
2. setup all the pre-requisites[https://github.com/servo/servo/blob/master/README.md#on-windows-msvc]&lt;br /&gt;
&lt;br /&gt;
3. switch into the &amp;quot;servo&amp;quot; directory - cd servo&lt;br /&gt;
&lt;br /&gt;
4. build the project using:&lt;br /&gt;
&lt;br /&gt;
4.1. For Windows&lt;br /&gt;
&lt;br /&gt;
     mach.bat build -dev&lt;br /&gt;
 &lt;br /&gt;
     run the project using:&lt;br /&gt;
&lt;br /&gt;
     mach run -d -- https://github.com&lt;br /&gt;
&lt;br /&gt;
4.2. For Linux / Mac-OS&lt;br /&gt;
     &lt;br /&gt;
     ./mach build --dev&lt;br /&gt;
&lt;br /&gt;
     run the project using:&lt;br /&gt;
&lt;br /&gt;
     ./mach run --release tests/html/about-mozilla.html&lt;br /&gt;
&lt;br /&gt;
=='''Test_Plan and Testing'''==&lt;br /&gt;
&lt;br /&gt;
Upon successful completion of the setup and building the whole browser engine. You should get an output that is something similar to the image below.&lt;br /&gt;
&lt;br /&gt;
[[File:Freak2.PNG]]&lt;br /&gt;
&lt;br /&gt;
===Servo Building Test===&lt;br /&gt;
&lt;br /&gt;
-&amp;gt; This completes the first step of testing as you will able to successfully run the software.&lt;br /&gt;
&lt;br /&gt;
'''Note''': Please be aware that your system may hang up during the process as it involves compiling the whole code from source and this involves usage of the whole processing power of the local system. Don't fret yet, the system will come back to its normal state after the build is completed. &lt;br /&gt;
&lt;br /&gt;
'''Note''': Time to compile depends on the CPU clock speed, and varies widely.&lt;br /&gt;
&lt;br /&gt;
===Servo Tidiness test===&lt;br /&gt;
&lt;br /&gt;
-&amp;gt; The next part of the testing involves checking for file tidiness, i.e. checking if all standards of the servo have been met.&lt;br /&gt;
&lt;br /&gt;
Running the below command will test for the same.&lt;br /&gt;
 [FOR LINUX / MAC-OS]&lt;br /&gt;
&lt;br /&gt;
     ./mach test-tidy&lt;br /&gt;
     ./mach fmt&lt;br /&gt;
&lt;br /&gt;
 [FOR WINDOWS]&lt;br /&gt;
&lt;br /&gt;
     mach.bat test-tidy&lt;br /&gt;
     mach.bat fmt&lt;br /&gt;
&lt;br /&gt;
The output should be similar to the below picture which shows that the tests that were passed.&lt;br /&gt;
&lt;br /&gt;
[[File:Freak.PNG]]&lt;br /&gt;
&lt;br /&gt;
===Servo automated Unit-Testing===&lt;br /&gt;
&lt;br /&gt;
-&amp;gt; The next part of testing is the unit-tests&lt;br /&gt;
&lt;br /&gt;
Running the below command will run all unit-tests&lt;br /&gt;
 [FOR LINUX / MAC-OS]&lt;br /&gt;
&lt;br /&gt;
     ./mach test-unit&lt;br /&gt;
&lt;br /&gt;
 [FOR WINDOWS]&lt;br /&gt;
&lt;br /&gt;
     mach.bat test-unit&lt;br /&gt;
&lt;br /&gt;
'''Note''': The output is too large to include everything here as images, and this [https://community-tc.services.mozilla.com/tasks/Zwl0KyYhTCSa6mEQ1QpsNg/runs/0/logs/https%3A%2F%2Fcommunity-tc.services.mozilla.com%2Fapi%2Fqueue%2Fv1%2Ftask%2FZwl0KyYhTCSa6mEQ1QpsNg%2Fruns%2F0%2Fartifacts%2Fpublic%2Flogs%2Flive.log LOG FILE] has the full details of all the unit-tests passed.&lt;br /&gt;
&lt;br /&gt;
===Servo Automated WPT Tests===&lt;br /&gt;
&lt;br /&gt;
-&amp;gt; Then the next steps involve running the servo-provided automated WPT [Web Platform Tests] that are relevant for our implementation.&lt;br /&gt;
&lt;br /&gt;
I am providing the commands to run the [https://github.com/servo/servo/blob/master/tests/wpt/README.md#running-the-tests WPT tests WPT Tests] on linux.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    ./mach test-wpt tests/wpt/web-platform-tests/html/dom/idlharness.https.html&lt;br /&gt;
&lt;br /&gt;
To save the log results to a file, for example wpt.log&lt;br /&gt;
&lt;br /&gt;
    ./mach test-wpt tests/wpt/web-platform-tests/html/dom/idlharness.https.html --log-raw wpt_dom.log&lt;br /&gt;
&lt;br /&gt;
Once the test results are saved to the log, we need to [https://github.com/servo/servo/blob/master/tests/wpt/README.md#updating-test-expectations update the test expectations].&lt;br /&gt;
&lt;br /&gt;
    ./mach update-wpt wpt_dom.log&lt;br /&gt;
&lt;br /&gt;
Now to test another relevant feature for the above implementation and save it to a log file named wpt_interface-objects.log&lt;br /&gt;
&lt;br /&gt;
     ./mach test-wpt tests/wpt/web-platform-tests/workers/semantics/interface-objects/001.worker.js --log-raw wpt_interface-objects.log&lt;br /&gt;
&lt;br /&gt;
     ./mach update-wpt wpt_interface-objects.log [ UPDATING TEST EXPECTATIONS ]&lt;br /&gt;
&lt;br /&gt;
'''Note''': The output can also be viewed in this [https://community-tc.services.mozilla.com/tasks/f-RoigFcT3iUzkSg9OunvA/runs/0/logs/https%3A%2F%2Fcommunity-tc.services.mozilla.com%2Fapi%2Fqueue%2Fv1%2Ftask%2Ff-RoigFcT3iUzkSg9OunvA%2Fruns%2F0%2Fartifacts%2Fpublic%2Flogs%2Flive.log LOG_FILE] link.&lt;br /&gt;
&lt;br /&gt;
===Manifest Update===&lt;br /&gt;
&lt;br /&gt;
Now to cap it all off,  we need to [https://github.com/servo/servo/blob/master/tests/wpt/README.md#updating-the-wpt-manifest update the WPT manifest] so that all the changes have been registered and reflected appropriately.&lt;br /&gt;
&lt;br /&gt;
It can be done by the command below.&lt;br /&gt;
&lt;br /&gt;
   ./mach update-manifest&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This finishes the testing for the code and you can see that the test coverage has increased.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&lt;br /&gt;
[1] [https://en.wikipedia.org/wiki/Rust_(programming_language) Rust Language Wikipedia]&lt;br /&gt;
&lt;br /&gt;
[2] [https://en.wikipedia.org/wiki/Servo_(software) Servo Software Wikipedia]&lt;br /&gt;
&lt;br /&gt;
[3] [https://www.rust-lang.org/ Rust Language Official Website]&lt;br /&gt;
&lt;br /&gt;
[4] [https://www.slideshare.net/SamsungOSG/how-servo-renders-the-web-52095380 servo working architecture]&lt;br /&gt;
&lt;br /&gt;
[5] [https://doc.rust-lang.org/book/index.html Rust Language Textbook]&lt;br /&gt;
&lt;br /&gt;
[6] [https://developer.mozilla.org/en-US/docs/Web/API/ImageBitmap ImageBitmap API Standard]&lt;br /&gt;
&lt;br /&gt;
[7] [https://developer.mozilla.org/en-US/docs/Web/HTML/Element/canvas Canvas Element]&lt;br /&gt;
&lt;br /&gt;
[8] [https://developers.google.com/web/updates/2016/03/createimagebitmap-in-chrome-50 Bitmap flow]&lt;br /&gt;
&lt;br /&gt;
[9] [https://github.com/servo/servo/wiki/Implement-ImageBitmap-project Implement ImageBitmap problem statement]&lt;br /&gt;
&lt;br /&gt;
[10] [https://github.com/SasiDharKM/servo/blob/master/components/script/dom/webidls/ImageBitmap.webidl ImageBitmap WebIDL code]&lt;br /&gt;
&lt;br /&gt;
[12] [https://html.spec.whatwg.org/multipage/imagebitmap-and-animations.html#imagebitmap ImageBitmap WebIDL Standard]&lt;br /&gt;
&lt;br /&gt;
[13] [https://github.com/SasiDharKM/servo/blob/master/components/script/dom/imagebitmap.rs ImageBitmap Rust code]&lt;br /&gt;
&lt;br /&gt;
[14] [https://doc.rust-lang.org/book/ch07-01-packages-and-crates.html Crates and Packages for Rust]&lt;br /&gt;
&lt;br /&gt;
[14] [https://doc.rust-lang.org/book/ch03-02-data-types.html Data Types in Rust]&lt;br /&gt;
&lt;br /&gt;
[15] [https://en.wikipedia.org/wiki/Color_model Color Model Wikipedia]&lt;br /&gt;
&lt;br /&gt;
[16] [https://doc.rust-lang.org/std/cell/struct.RefCell.html RefCell in Rust]&lt;br /&gt;
&lt;br /&gt;
[17] [https://doc.rust-lang.org/std/keyword.impl.html impl Keyword in Rust]&lt;br /&gt;
&lt;br /&gt;
[18] [https://jeenalee.com/2016/10/03/implementing-doge-for-servo.html Implement a new DOM tutorial]&lt;br /&gt;
&lt;br /&gt;
[19] [https://html.spec.whatwg.org/multipage/imagebitmap-and-animations.html#imagebitmap ImageBitmap Algorithm]&lt;br /&gt;
&lt;br /&gt;
[20] [https://github.com/servo/servo/pull/26009 ImageBitmap Implementation pull request]&lt;br /&gt;
&lt;br /&gt;
[21] [https://github.com/servo/servo/blob/master/README.md#on-windows-msvc Build Pre-requisites for Rust]&lt;br /&gt;
&lt;br /&gt;
[22] [https://github.com/servo/servo/blob/master/tests/wpt/README.md Testing the Servo Code]&lt;/div&gt;</summary>
		<author><name>Skmuppal</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2020_-_M2000._Implement_ImageBitMap_web_API&amp;diff=132519</id>
		<title>CSC/ECE 517 Spring 2020 - M2000. Implement ImageBitMap web API</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2020_-_M2000._Implement_ImageBitMap_web_API&amp;diff=132519"/>
		<updated>2020-03-31T22:32:01Z</updated>

		<summary type="html">&lt;p&gt;Skmuppal: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;A new browser technology that is being implemented with the new rust language to take advantage of the concurrency features of the language is the servo. [https://en.wikipedia.org/wiki/Rust_(programming_language)]. It is an innovation that will be using compiling in a very synchronous style as well as support things like web assembly code. It was an implementation that was a result of the effort of Mozilla research with aid from Samsung to help port it to android and arm processors. The servo does not yet have any support for the ImageBitmap which eventually makes it difficult to write it to the canvas in real-time without any undue latency in the process. This could lead to servo being slow and having very little graphical support, hence it will be requiring to implement support for ImageBitmap to make sure the process is smooth and efficient for graphical canvas support.&lt;br /&gt;
&lt;br /&gt;
=='''Pull Request'''==&lt;br /&gt;
&lt;br /&gt;
The pull request for this implementation has been merged.[https://github.com/servo/servo/pull/26009]&lt;br /&gt;
&lt;br /&gt;
It passes all the test cases and also the build is passing.[https://github.com/servo/servo/pull/26009]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Comments for the code'''==&lt;br /&gt;
&lt;br /&gt;
We will not be having detailed comments for each function of the code, because the servo community does not encourage comments which are not required. &lt;br /&gt;
&lt;br /&gt;
The comments that are more than what is required will fail the servo build checks.&lt;br /&gt;
&lt;br /&gt;
To make up for that, we try to explain wherever possible the code that we have written in this documentation.&lt;br /&gt;
&lt;br /&gt;
=='''Introduction'''==&lt;br /&gt;
&lt;br /&gt;
===Servo===&lt;br /&gt;
Servo [https://en.wikipedia.org/wiki/Servo_(layout_engine)] which is born as an intention from Mozilla to produce an open-source web engine that will work on the rust language implementation[https://www.rust-lang.org/]. It works on a parallel setup where the various rendering activities take place in a highly parallel nature.&lt;br /&gt;
&lt;br /&gt;
The entire nature of flow for the servo is shown in the below diagram:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Flowofservo.png ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here we can see that the servo parses the contents of html and css using dom, which runs on the rust scripts and produces a flow tree using the styling elements. It then renders them as layers which are produced as output using composition.[https://www.slideshare.net/SamsungOSG/how-servo-renders-the-web-52095380]&lt;br /&gt;
&lt;br /&gt;
===Rust===&lt;br /&gt;
Rust [https://doc.rust-lang.org/book/index.html] Rust again is born out of an intention from Mozilla to implement a programming language that is highly efficient for parallel processing that will make sure the threads are safe in execution and implementation. It is being used in the servo browser.&lt;br /&gt;
&lt;br /&gt;
===DOM===&lt;br /&gt;
DOM stands for Document Object Model. It is a method that is being used by web-browsers to effectively arrange web pages and use them in a structured manner. Servo also uses the concept of dom to efficiently access the structure of how the web pages are stored and used effectively.&lt;br /&gt;
&lt;br /&gt;
the general dom structure is shown below that has all head and body elements with a hyperlink :&lt;br /&gt;
&lt;br /&gt;
[[File:dom.png ]]&lt;br /&gt;
&lt;br /&gt;
===Scope===&lt;br /&gt;
Several browsers that we know have the ability to create images of bitmaps that can be reproduced for graphical purposes on canvas elements. The new servo browser from Mozilla is something that has canvas, thus the aim would be to implement code to support imagebitmap() for canvas in the servo.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Untitled_Diagram_(14).png ]]&lt;br /&gt;
&lt;br /&gt;
===Image Bitmap===&lt;br /&gt;
&lt;br /&gt;
Interface for imagebitmap[https://developer.mozilla.org/en-US/docs/Web/API/ImageBitmap] is something that represents an image which is a bitmap that can be drawn to a  &amp;lt;canvas&amp;gt; [https://developer.mozilla.org/en-US/docs/Web/HTML/Element/canvas] without undue latency. the createimagebitmap() factory method is used to produce these images for implementation.&lt;br /&gt;
&lt;br /&gt;
The general flow of an imagebitmap method would be : &lt;br /&gt;
&lt;br /&gt;
[[File:bitmapgeneral.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here we see that the browser holds the main thread which will request the worker thread to obtain the URL that is being passed and uses it to create the image bitmap, Once the image has been created we will be transferring it back to the main thread where the canvas would be drawing the image created.[https://developers.google.com/web/updates/2016/03/createimagebitmap-in-chrome-50]&lt;br /&gt;
&lt;br /&gt;
===Implementation Steps===&lt;br /&gt;
&lt;br /&gt;
The following steps have been implemented:&lt;br /&gt;
&lt;br /&gt;
Step 1- add a ImageBitmap WebIDL interface to components/script/dom/webidls &lt;br /&gt;
&lt;br /&gt;
Step 2- Implement its Rust code in components/script/dom/imagebitmap.rs that is backed by a Vec&amp;lt;u8&amp;gt; buffer&lt;br /&gt;
&lt;br /&gt;
=='''Design Pattern'''==&lt;br /&gt;
&lt;br /&gt;
Our project will not require any design patterns as it will only require the implementation of the methods. Please see below for the steps required in the implementation.&lt;br /&gt;
&lt;br /&gt;
=='''Implementation'''==&lt;br /&gt;
&lt;br /&gt;
The following are the steps that are present it the implementation project description [https://github.com/servo/servo/wiki/Implement-ImageBitmap-project].&lt;br /&gt;
&lt;br /&gt;
'''Step 1:''' add a ImageBitmap WebIDL interface [https://github.com/SasiDharKM/servo/blob/master/components/script/dom/webidls/ImageBitmap.webidl] to components/script/dom/webidls &lt;br /&gt;
&lt;br /&gt;
The webidl information is from the official standard webidl[https://html.spec.whatwg.org/multipage/imagebitmap-and-animations.html#imagebitmap].&lt;br /&gt;
&lt;br /&gt;
Please note that we have removed the &amp;quot;Serializable&amp;quot; and &amp;quot;Transferable&amp;quot; components from the webidl as they are not required for this implementation.&lt;br /&gt;
&lt;br /&gt;
[[File:Webidl.PNG]]&lt;br /&gt;
&lt;br /&gt;
From the implemented the imagebitmap webidl for the dom struct that will be taking the height and width as its attributes.&lt;br /&gt;
&lt;br /&gt;
The webidl specifies that it will hold an interface of the imagebitmap which will have attributes of height and width as unsigned long integers represent as the below diagram.&lt;br /&gt;
&lt;br /&gt;
[[File:bitmap.png]]&lt;br /&gt;
&lt;br /&gt;
enum specifies the various options that are available to the input image type that could be CanvasImageSouce or Blob or ImageData. The options will be used to manipulated these input types specifically - ImageOrientation, preMulitplyAlpha,ColourSpaceCoversion,ResizeQuality&lt;br /&gt;
&lt;br /&gt;
[[File:enum.png]]&lt;br /&gt;
&lt;br /&gt;
The imagebitmap options dictionary will be creating key-value pairs for these with initial default values as seen in the image below :&lt;br /&gt;
&lt;br /&gt;
[[File:dict.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Step 2:''' Create a imagebitmap.rs code implementation [https://github.com/SasiDharKM/servo/blob/master/components/script/dom/imagebitmap.rs] for the webidl&lt;br /&gt;
&lt;br /&gt;
Below we have implemented the image bitmap rust code that uses all the crates[https://doc.rust-lang.org/book/ch07-01-packages-and-crates.html]. Crates are the packages for rust implementation that can be imported.&lt;br /&gt;
&lt;br /&gt;
[[File:rs_crates.PNG]]&lt;br /&gt;
&lt;br /&gt;
The code here creates the crates for the rust implementation. The bitmap options are bound followed by binding to dom root and global scope. Fallible is used to check errors, Reflector is used to link the js side to the rust code. We also use vector of u8 charset to store the bitmap implementation &lt;br /&gt;
&lt;br /&gt;
In the below image we can see the way the reflector object in the above code is used to access and link the javascript objects using rust. The rust node contains the reflector which is using to bind the javascript object every time a thing is manipulated on the rust side.&lt;br /&gt;
&lt;br /&gt;
'''Reflector design in dom'''&lt;br /&gt;
&lt;br /&gt;
[[File:Reflector.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The dom_struct is the DOM structure that the ImageBitMap data has from the javascript object. It consists of the following-&lt;br /&gt;
&lt;br /&gt;
1. Reflector - a reflector has the pointer to the required JavaScript object.&lt;br /&gt;
&lt;br /&gt;
2. width and height - the width and the height part of the ImageBitMap's data as mentioned in the webidl file. The required datatype[https://doc.rust-lang.org/book/ch03-02-data-types.html] is 32-bit unsigned integers, denoted by u32.&lt;br /&gt;
&lt;br /&gt;
3. As the imagebitmap needs to be implemented backed b a &amp;lt;Vec8&amp;gt; buffer, as mentioned in the problem statement, the DomRefCell&amp;lt;Vec&amp;lt;u8&amp;gt;&amp;gt; has been used. Where, u8 stands for 8-bit unsigned integer, which is used to hold the data of colour model[https://en.wikipedia.org/wiki/Color_model] and DOMRefCell is the RefCell[https://doc.rust-lang.org/std/cell/struct.RefCell.html] equivalent for the DOM implementation. RefCell is a wrapper used to make the data mutable, which is a required property here as the colour data might be altering.&lt;br /&gt;
&lt;br /&gt;
[[File:rs_dom_struct.PNG]]&lt;br /&gt;
&lt;br /&gt;
The image below shows how this struct is organised&lt;br /&gt;
&lt;br /&gt;
[[File:struct.png]]&lt;br /&gt;
&lt;br /&gt;
Here we implement the code that reads in the various attributes and the javascript objects required (shown below). We use the words '''impl ImageBitmap'''[https://doc.rust-lang.org/std/keyword.impl.html] which means the implementation of the ImageBitmap type. It will be using the '''newinherited''' and the '''new''' methods to obtain the required javascript objects and resolve the intended promises.&lt;br /&gt;
&lt;br /&gt;
'''new_inheritence''' method is where the new instance of the ImageBitmap is created. '''new''' method is where the javascript object is connected to the ImageBitmap object[https://jeenalee.com/2016/10/03/implementing-doge-for-servo.html].&lt;br /&gt;
&lt;br /&gt;
[[File:rs_impl_ibm.PNG]]&lt;br /&gt;
&lt;br /&gt;
Here we implement the code for the getter methods for '''height''' and '''width''' attributes for an ImageBitmap object. We use '''impl ImageBitmapMethods for ImageBitmap''' here which includes only the methods that are required as part of the implementation of the ImageBitmap.&lt;br /&gt;
&lt;br /&gt;
[[File:rs_impl_methods.PNG]]&lt;br /&gt;
&lt;br /&gt;
The height and width attributes are as shown below :&lt;br /&gt;
&lt;br /&gt;
[[File:hw.png]]&lt;br /&gt;
&lt;br /&gt;
The detailed description of the algorithm that has been implemented can be seen in the HTML Standard [https://html.spec.whatwg.org/multipage/imagebitmap-and-animations.html#imagebitmap].&lt;br /&gt;
&lt;br /&gt;
'''Note''': Please note that the implementation does not have detailed comments as we were asked to remove them since they are against the servo implementation guidelines.&lt;br /&gt;
&lt;br /&gt;
=='''How to Setup and Run'''==&lt;br /&gt;
The following are the steps to build the servo.&lt;br /&gt;
&lt;br /&gt;
1. git clone the servo repository&lt;br /&gt;
&lt;br /&gt;
2. setup all the pre-requisites[https://github.com/servo/servo/blob/master/README.md#on-windows-msvc]&lt;br /&gt;
&lt;br /&gt;
3. switch into the &amp;quot;servo&amp;quot; directory - cd servo&lt;br /&gt;
&lt;br /&gt;
4. build the project using:&lt;br /&gt;
&lt;br /&gt;
4.1. For Windows&lt;br /&gt;
&lt;br /&gt;
     mach.bat build -dev&lt;br /&gt;
 &lt;br /&gt;
     run the project using:&lt;br /&gt;
&lt;br /&gt;
     mach run -d -- https://github.com&lt;br /&gt;
&lt;br /&gt;
4.2. For Linux / Mac-OS&lt;br /&gt;
     &lt;br /&gt;
     ./mach build --dev&lt;br /&gt;
&lt;br /&gt;
     run the project using:&lt;br /&gt;
&lt;br /&gt;
     ./mach run --release tests/html/about-mozilla.html&lt;br /&gt;
&lt;br /&gt;
=='''Test_Plan and Testing'''==&lt;br /&gt;
&lt;br /&gt;
Upon successful completion of the setup and building the whole browser engine. You should get an output that is something similar to the image below.&lt;br /&gt;
&lt;br /&gt;
[[File:Freak2.PNG]]&lt;br /&gt;
&lt;br /&gt;
===Servo Building Test===&lt;br /&gt;
&lt;br /&gt;
-&amp;gt; This completes the first step of testing as you will able to successfully run the software.&lt;br /&gt;
&lt;br /&gt;
'''Note''': Please be aware that your system may hang up during the process as it involves compiling the whole code from source and this involves usage of the whole processing power of the local system. Don't fret yet, the system will come back to its normal state after the build is completed. &lt;br /&gt;
&lt;br /&gt;
'''Note''': Time to compile depends on the CPU clock speed, and varies widely.&lt;br /&gt;
&lt;br /&gt;
===Servo Tidiness test===&lt;br /&gt;
&lt;br /&gt;
-&amp;gt; The next part of the testing involves checking for file tidiness, i.e. checking if all standards of the servo have been met.&lt;br /&gt;
&lt;br /&gt;
Running the below command will test for the same.&lt;br /&gt;
 [FOR LINUX / MAC-OS]&lt;br /&gt;
&lt;br /&gt;
     ./mach test-tidy&lt;br /&gt;
     ./mach fmt&lt;br /&gt;
&lt;br /&gt;
 [FOR WINDOWS]&lt;br /&gt;
&lt;br /&gt;
     mach.bat test-tidy&lt;br /&gt;
     mach.bat fmt&lt;br /&gt;
&lt;br /&gt;
The output should be similar to the below picture which shows that the tests that were passed.&lt;br /&gt;
&lt;br /&gt;
[[File:Freak.PNG]]&lt;br /&gt;
&lt;br /&gt;
===Servo automated Unit-Testing===&lt;br /&gt;
&lt;br /&gt;
-&amp;gt; The next part of testing is the unit-tests&lt;br /&gt;
&lt;br /&gt;
Running the below command will run all unit-tests&lt;br /&gt;
 [FOR LINUX / MAC-OS]&lt;br /&gt;
&lt;br /&gt;
     ./mach test-unit&lt;br /&gt;
&lt;br /&gt;
 [FOR WINDOWS]&lt;br /&gt;
&lt;br /&gt;
     mach.bat test-unit&lt;br /&gt;
&lt;br /&gt;
'''Note''': The output is too large to include everything here as images, and this [https://community-tc.services.mozilla.com/tasks/Zwl0KyYhTCSa6mEQ1QpsNg/runs/0/logs/https%3A%2F%2Fcommunity-tc.services.mozilla.com%2Fapi%2Fqueue%2Fv1%2Ftask%2FZwl0KyYhTCSa6mEQ1QpsNg%2Fruns%2F0%2Fartifacts%2Fpublic%2Flogs%2Flive.log LOG FILE] has the full details of all the unit-tests passed.&lt;br /&gt;
&lt;br /&gt;
===Servo Automated WPT Tests===&lt;br /&gt;
&lt;br /&gt;
-&amp;gt; Then the next steps involve running the servo-provided automated WPT [Web Platform Tests] that are relevant for our implementation.&lt;br /&gt;
&lt;br /&gt;
I am providing the commands to run the [https://github.com/servo/servo/blob/master/tests/wpt/README.md#running-the-tests WPT tests WPT Tests] on linux.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    ./mach test-wpt tests/wpt/web-platform-tests/html/dom/idlharness.https.html&lt;br /&gt;
&lt;br /&gt;
To save the log results to a file, for example wpt.log&lt;br /&gt;
&lt;br /&gt;
    ./mach test-wpt tests/wpt/web-platform-tests/html/dom/idlharness.https.html --log-raw wpt_dom.log&lt;br /&gt;
&lt;br /&gt;
Once the test results are saved to the log, we need to [https://github.com/servo/servo/blob/master/tests/wpt/README.md#updating-test-expectations update the test expectations].&lt;br /&gt;
&lt;br /&gt;
    ./mach update-wpt wpt_dom.log&lt;br /&gt;
&lt;br /&gt;
Now to test another relevant feature for the above implementation and save it to a log file named wpt_interface-objects.log&lt;br /&gt;
&lt;br /&gt;
     ./mach test-wpt tests/wpt/web-platform-tests/workers/semantics/interface-objects/001.worker.js --log-raw wpt_interface-objects.log&lt;br /&gt;
&lt;br /&gt;
     ./mach update-wpt wpt_interface-objects.log [ UPDATING TEST EXPECTATIONS ]&lt;br /&gt;
&lt;br /&gt;
'''Note''': The output can also be viewed in this [https://community-tc.services.mozilla.com/tasks/f-RoigFcT3iUzkSg9OunvA/runs/0/logs/https%3A%2F%2Fcommunity-tc.services.mozilla.com%2Fapi%2Fqueue%2Fv1%2Ftask%2Ff-RoigFcT3iUzkSg9OunvA%2Fruns%2F0%2Fartifacts%2Fpublic%2Flogs%2Flive.log LOG_FILE] link.&lt;br /&gt;
&lt;br /&gt;
===Manifest Update===&lt;br /&gt;
&lt;br /&gt;
Now to cap it all off,  we need to [https://github.com/servo/servo/blob/master/tests/wpt/README.md#updating-the-wpt-manifest update the WPT manifest] so that all the changes have been registered and reflected appropriately.&lt;br /&gt;
&lt;br /&gt;
It can be done by the command below.&lt;br /&gt;
&lt;br /&gt;
   ./mach update-manifest&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This finishes the testing for the code and you can see that the test coverage has increased.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&lt;br /&gt;
[1] [https://en.wikipedia.org/wiki/Rust_(programming_language) Rust Language Wikipedia]&lt;br /&gt;
&lt;br /&gt;
[2] [https://en.wikipedia.org/wiki/Servo_(software) Servo Software Wikipedia]&lt;br /&gt;
&lt;br /&gt;
[3] [https://www.rust-lang.org/ Rust Language Official Website]&lt;br /&gt;
&lt;br /&gt;
[4] [https://www.slideshare.net/SamsungOSG/how-servo-renders-the-web-52095380 servo working architecture]&lt;br /&gt;
&lt;br /&gt;
[5] [https://doc.rust-lang.org/book/index.html Rust Language Textbook]&lt;br /&gt;
&lt;br /&gt;
[6] [https://developer.mozilla.org/en-US/docs/Web/API/ImageBitmap ImageBitmap API Standard]&lt;br /&gt;
&lt;br /&gt;
[7] [https://developer.mozilla.org/en-US/docs/Web/HTML/Element/canvas Canvas Element]&lt;br /&gt;
&lt;br /&gt;
[8] [https://developers.google.com/web/updates/2016/03/createimagebitmap-in-chrome-50 Bitmap flow]&lt;br /&gt;
&lt;br /&gt;
[9] [https://github.com/servo/servo/wiki/Implement-ImageBitmap-project Implement ImageBitmap problem statement]&lt;br /&gt;
&lt;br /&gt;
[10] [https://github.com/SasiDharKM/servo/blob/master/components/script/dom/webidls/ImageBitmap.webidl ImageBitmap WebIDL code]&lt;br /&gt;
&lt;br /&gt;
[12] [https://html.spec.whatwg.org/multipage/imagebitmap-and-animations.html#imagebitmap ImageBitmap WebIDL Standard]&lt;br /&gt;
&lt;br /&gt;
[13] [https://github.com/SasiDharKM/servo/blob/master/components/script/dom/imagebitmap.rs ImageBitmap Rust code]&lt;br /&gt;
&lt;br /&gt;
[14] [https://doc.rust-lang.org/book/ch07-01-packages-and-crates.html Crates and Packages for Rust]&lt;br /&gt;
&lt;br /&gt;
[14] [https://doc.rust-lang.org/book/ch03-02-data-types.html Data Types in Rust]&lt;br /&gt;
&lt;br /&gt;
[15] [https://en.wikipedia.org/wiki/Color_model Color Model Wikipedia]&lt;br /&gt;
&lt;br /&gt;
[16] [https://doc.rust-lang.org/std/cell/struct.RefCell.html RefCell in Rust]&lt;br /&gt;
&lt;br /&gt;
[17] [https://doc.rust-lang.org/std/keyword.impl.html impl Keyword in Rust]&lt;br /&gt;
&lt;br /&gt;
[18] [https://jeenalee.com/2016/10/03/implementing-doge-for-servo.html Implement a new DOM tutorial]&lt;br /&gt;
&lt;br /&gt;
[19] [https://html.spec.whatwg.org/multipage/imagebitmap-and-animations.html#imagebitmap ImageBitmap Algorithm]&lt;br /&gt;
&lt;br /&gt;
[20] [https://github.com/servo/servo/pull/26009 ImageBitmap Implementation pull request]&lt;br /&gt;
&lt;br /&gt;
[21] [https://github.com/servo/servo/blob/master/README.md#on-windows-msvc Build Pre-requisites for Rust]&lt;br /&gt;
&lt;br /&gt;
[22] [https://github.com/servo/servo/blob/master/tests/wpt/README.md Testing the Servo Code]&lt;/div&gt;</summary>
		<author><name>Skmuppal</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2020_-_M2000._Implement_ImageBitMap_web_API&amp;diff=132516</id>
		<title>CSC/ECE 517 Spring 2020 - M2000. Implement ImageBitMap web API</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2020_-_M2000._Implement_ImageBitMap_web_API&amp;diff=132516"/>
		<updated>2020-03-31T22:27:02Z</updated>

		<summary type="html">&lt;p&gt;Skmuppal: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;A new browser technology that is being implemented with the new rust language to take advantage of the concurrency features of the language is the servo. [https://en.wikipedia.org/wiki/Rust_(programming_language)]. It is an innovation that will be using compiling in a very synchronous style as well as support things like web assembly code. It was an implementation that was a result of the effort of Mozilla research with aid from Samsung to help port it to android and arm processors. The servo does not yet have any support for the ImageBitmap which eventually makes it difficult to write it to the canvas in real-time without any undue latency in the process. This could lead to servo being slow and having very little graphical support, hence it will be requiring to implement support for ImageBitmap to make sure the process is smooth and efficient for graphical canvas support.&lt;br /&gt;
&lt;br /&gt;
=='''Pull Request'''==&lt;br /&gt;
&lt;br /&gt;
The pull request for this implementation has been merged.[https://github.com/servo/servo/pull/26009]&lt;br /&gt;
&lt;br /&gt;
It passes all the test cases and also the build is passing.[https://github.com/servo/servo/pull/26009]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Comments for the code'''==&lt;br /&gt;
&lt;br /&gt;
We will not be having detailed comments for each function of the code, because the servo community does not encourage comments which are not required. &lt;br /&gt;
&lt;br /&gt;
The comments that are more than what is required will fail the servo build checks.&lt;br /&gt;
&lt;br /&gt;
To make up for that, we try to explain wherever possible the code that we have written in this documentation.&lt;br /&gt;
&lt;br /&gt;
=='''Introduction'''==&lt;br /&gt;
&lt;br /&gt;
===Servo===&lt;br /&gt;
Servo [https://en.wikipedia.org/wiki/Servo_(layout_engine)] which is born as an intention from Mozilla to produce an open-source web engine that will work on the rust language implementation[https://www.rust-lang.org/]. It works on a parallel setup where the various rendering activities take place in a highly parallel nature.&lt;br /&gt;
&lt;br /&gt;
The entire nature of flow for the servo is shown in the below diagram:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Flowofservo.png ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here we can see that the servo parses the contents of html and css using dom, which runs on the rust scripts and produces a flow tree using the styling elements. It then renders them as layers which are produced as output using composition.[https://www.slideshare.net/SamsungOSG/how-servo-renders-the-web-52095380]&lt;br /&gt;
&lt;br /&gt;
===Rust===&lt;br /&gt;
Rust [https://doc.rust-lang.org/book/index.html] Rust again is born out of an intention from Mozilla to implement a programming language that is highly efficient for parallel processing that will make sure the threads are safe in execution and implementation. It is being used in the servo browser.&lt;br /&gt;
&lt;br /&gt;
===DOM===&lt;br /&gt;
DOM stands for Document Object Model. It is a method that is being used by web-browsers to effectively arrange web pages and use them in a structured manner. Servo also uses the concept of dom to efficiently access the structure of how the web pages are stored and used effectively.&lt;br /&gt;
&lt;br /&gt;
the general dom structure is shown below that has all head and body elements with a hyperlink :&lt;br /&gt;
&lt;br /&gt;
[[File:dom.png ]]&lt;br /&gt;
&lt;br /&gt;
===Scope===&lt;br /&gt;
Several browsers that we know have the ability to create images of bitmaps that can be reproduced for graphical purposes on canvas elements. The new servo browser from Mozilla is something that has canvas, thus the aim would be to implement code to support imagebitmap() for canvas in the servo.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Untitled_Diagram_(14).png ]]&lt;br /&gt;
&lt;br /&gt;
===Image Bitmap===&lt;br /&gt;
&lt;br /&gt;
Interface for imagebitmap[https://developer.mozilla.org/en-US/docs/Web/API/ImageBitmap] is something that represents an image which is a bitmap that can be drawn to a  &amp;lt;canvas&amp;gt; [https://developer.mozilla.org/en-US/docs/Web/HTML/Element/canvas] without undue latency. the createimagebitmap() factory method is used to produce these images for implementation.&lt;br /&gt;
&lt;br /&gt;
The general flow of an imagebitmap method would be : &lt;br /&gt;
&lt;br /&gt;
[[File:bitmapgeneral.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here we see that the browser holds the main thread which will request the worker thread to obtain the URL that is being passed and uses it to create the image bitmap, Once the image has been created we will be transferring it back to the main thread where the canvas would be drawing the image created.[https://developers.google.com/web/updates/2016/03/createimagebitmap-in-chrome-50]&lt;br /&gt;
&lt;br /&gt;
===Implementation Steps===&lt;br /&gt;
&lt;br /&gt;
The following steps have been implemented:&lt;br /&gt;
&lt;br /&gt;
Step 1- add a ImageBitmap WebIDL interface to components/script/dom/webidls &lt;br /&gt;
&lt;br /&gt;
Step 2- Implement its Rust code in components/script/dom/imagebitmap.rs that is backed by a Vec&amp;lt;u8&amp;gt; buffer&lt;br /&gt;
&lt;br /&gt;
=='''Design Pattern'''==&lt;br /&gt;
&lt;br /&gt;
Our project will not require any design patterns as it will only require the implementation of the methods. Please see below for the steps required in the implementation.&lt;br /&gt;
&lt;br /&gt;
=='''Implementation'''==&lt;br /&gt;
&lt;br /&gt;
The following are the steps that are present it the implementation project description [https://github.com/servo/servo/wiki/Implement-ImageBitmap-project].&lt;br /&gt;
&lt;br /&gt;
'''Step 1:''' add a ImageBitmap WebIDL interface [https://github.com/SasiDharKM/servo/blob/master/components/script/dom/webidls/ImageBitmap.webidl] to components/script/dom/webidls &lt;br /&gt;
&lt;br /&gt;
The webidl information is from the official standard webidl[https://html.spec.whatwg.org/multipage/imagebitmap-and-animations.html#imagebitmap].&lt;br /&gt;
&lt;br /&gt;
Please note that we have removed the &amp;quot;Serializable&amp;quot; and &amp;quot;Transferable&amp;quot; components from the webidl as they are not required for this implementation.&lt;br /&gt;
&lt;br /&gt;
[[File:Webidl.PNG]]&lt;br /&gt;
&lt;br /&gt;
From the implemented the imagebitmap webidl for the dom struct that will be taking the height and width as its attributes.&lt;br /&gt;
&lt;br /&gt;
The webidl specifies that it will hold an interface of the imagebitmap which will have attributes of height and width as unsigned long integers represent as the below diagram.&lt;br /&gt;
&lt;br /&gt;
[[File:bitmap.png]]&lt;br /&gt;
&lt;br /&gt;
enum specifies the various options that are available to the input image type that could be CanvasImageSouce or Blob or ImageData. The options will be used to manipulated these input types specifically - ImageOrientation, preMulitplyAlpha,ColourSpaceCoversion,ResizeQuality&lt;br /&gt;
&lt;br /&gt;
[[File:enum.png]]&lt;br /&gt;
&lt;br /&gt;
The imagebitmap options dictionary will be creating key-value pairs for these with initial default values as seen in the image below :&lt;br /&gt;
&lt;br /&gt;
[[File:dict.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Step 2:''' Create a imagebitmap.rs code implementation [https://github.com/SasiDharKM/servo/blob/master/components/script/dom/imagebitmap.rs] for the webidl&lt;br /&gt;
&lt;br /&gt;
Below we have implemented the image bitmap rust code that uses all the crates[https://doc.rust-lang.org/book/ch07-01-packages-and-crates.html]. Crates are the packages for rust implementation that can be imported.&lt;br /&gt;
&lt;br /&gt;
[[File:rs_crates.PNG]]&lt;br /&gt;
&lt;br /&gt;
The code here creates the crates for the rust implementation. The bitmap options are bound followed by binding to dom root and global scope. Fallible is used to check errors, Reflector is used to link the js side to the rust code. We also use vector of u8 charset to store the bitmap implementation &lt;br /&gt;
&lt;br /&gt;
In the below image we can see the way the reflector object in the above code is used to access and link the javascript objects using rust. The rust node contains the reflector which is using to bind the javascript object every time a thing is manipulated on the rust side.&lt;br /&gt;
&lt;br /&gt;
'''Reflector design in dom'''&lt;br /&gt;
&lt;br /&gt;
[[File:Reflector.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The dom_struct is the DOM structure that the ImageBitMap data has from the javascript object. It consists of the following-&lt;br /&gt;
&lt;br /&gt;
1. Reflector - a reflector has the pointer to the required JavaScript object.&lt;br /&gt;
&lt;br /&gt;
2. width and height - the width and the height part of the ImageBitMap's data as mentioned in the webidl file. The required datatype[https://doc.rust-lang.org/book/ch03-02-data-types.html] is 32-bit unsigned integers, denoted by u32.&lt;br /&gt;
&lt;br /&gt;
3. As the imagebitmap needs to be implemented backed b a &amp;lt;Vec8&amp;gt; buffer, as mentioned in the problem statement, the DomRefCell&amp;lt;Vec&amp;lt;u8&amp;gt;&amp;gt; has been used. Where, u8 stands for 8-bit unsigned integer, which is used to hold the data of colour model[https://en.wikipedia.org/wiki/Color_model] and DOMRefCell is the RefCell[https://doc.rust-lang.org/std/cell/struct.RefCell.html] equivalent for the DOM implementation. RefCell is a wrapper used to make the data mutable, which is a required property here as the colour data might be altering.&lt;br /&gt;
&lt;br /&gt;
[[File:rs_dom_struct.PNG]]&lt;br /&gt;
&lt;br /&gt;
The image below shows how this struct is organised&lt;br /&gt;
&lt;br /&gt;
[[File:struct.png]]&lt;br /&gt;
&lt;br /&gt;
Here we implement the code that reads in the various attributes and the javascript objects required (shown below). We use the words '''impl ImageBitmap'''[https://doc.rust-lang.org/std/keyword.impl.html] which means the implementation of the ImageBitmap type. It will be using the '''newinherited''' and the '''new''' methods to obtain the required javascript objects and resolve the intended promises.&lt;br /&gt;
&lt;br /&gt;
'''new_inheritence''' method is where the new instance of the ImageBitmap is created. '''new''' method is where the javascript object is connected to the ImageBitmap object[https://jeenalee.com/2016/10/03/implementing-doge-for-servo.html].&lt;br /&gt;
&lt;br /&gt;
[[File:rs_impl_ibm.PNG]]&lt;br /&gt;
&lt;br /&gt;
Here we implement the code for the getter methods for '''height''' and '''width''' attributes for an ImageBitmap object. We use '''impl ImageBitmapMethods for ImageBitmap''' here which includes only the methods that are required as part of the implementation of the ImageBitmap.&lt;br /&gt;
&lt;br /&gt;
[[File:rs_impl_methods.PNG]]&lt;br /&gt;
&lt;br /&gt;
The height and width attributes are as shown below :&lt;br /&gt;
&lt;br /&gt;
[[File:hw.png]]&lt;br /&gt;
&lt;br /&gt;
The detailed description of the algorithm that has been implemented can be seen in the HTML Standard [https://html.spec.whatwg.org/multipage/imagebitmap-and-animations.html#imagebitmap].&lt;br /&gt;
&lt;br /&gt;
'''Note''': Please note that the implementation does not have detailed comments as we were asked to remove them since they are against the servo implementation guidelines.&lt;br /&gt;
&lt;br /&gt;
=='''How to Setup and Run'''==&lt;br /&gt;
The following are the steps to build the servo.&lt;br /&gt;
&lt;br /&gt;
1. git clone the servo repository&lt;br /&gt;
&lt;br /&gt;
2. setup all the pre-requisites[https://github.com/servo/servo/blob/master/README.md#on-windows-msvc]&lt;br /&gt;
&lt;br /&gt;
3. switch into the &amp;quot;servo&amp;quot; directory - cd servo&lt;br /&gt;
&lt;br /&gt;
4. build the project using:&lt;br /&gt;
&lt;br /&gt;
4.1. For Windows&lt;br /&gt;
&lt;br /&gt;
     mach.bat build -dev&lt;br /&gt;
 &lt;br /&gt;
     run the project using:&lt;br /&gt;
&lt;br /&gt;
     mach run -d -- https://github.com&lt;br /&gt;
&lt;br /&gt;
4.2. For Linux / Mac-OS&lt;br /&gt;
     &lt;br /&gt;
     ./mach build --dev&lt;br /&gt;
&lt;br /&gt;
     run the project using:&lt;br /&gt;
&lt;br /&gt;
     ./mach run --release tests/html/about-mozilla.html&lt;br /&gt;
&lt;br /&gt;
=='''Test_Plan and Testing'''==&lt;br /&gt;
&lt;br /&gt;
Upon successful completion of the setup and building the whole browser engine. You should get an output that is something similar to the image below.&lt;br /&gt;
&lt;br /&gt;
[[File:Freak2.PNG]]&lt;br /&gt;
&lt;br /&gt;
===Servo Building Test===&lt;br /&gt;
&lt;br /&gt;
-&amp;gt; This completes the first step of testing as you will able to successfully run the software.&lt;br /&gt;
&lt;br /&gt;
'''Note''': Please be aware that your system may hang up during the process as it involves compiling the whole code from source and this involves usage of the whole processing power of the local system. Don't fret yet, the system will come back to its normal state after the build is completed. &lt;br /&gt;
&lt;br /&gt;
'''Note''': Time to compile depends on the CPU clock speed, and varies widely.&lt;br /&gt;
&lt;br /&gt;
===Servo Tidiness test===&lt;br /&gt;
&lt;br /&gt;
-&amp;gt; The next part of the testing involves checking for file tidiness, i.e. checking if all standards of the servo have been met.&lt;br /&gt;
&lt;br /&gt;
Running the below command will test for the same.&lt;br /&gt;
 [FOR LINUX / MAC-OS]&lt;br /&gt;
&lt;br /&gt;
     ./mach test-tidy&lt;br /&gt;
     ./mach fmt&lt;br /&gt;
&lt;br /&gt;
 [FOR WINDOWS]&lt;br /&gt;
&lt;br /&gt;
     mach.bat test-tidy&lt;br /&gt;
     mach.bat fmt&lt;br /&gt;
&lt;br /&gt;
The output should be similar to the below picture which shows that the tests that were passed.&lt;br /&gt;
&lt;br /&gt;
[[File:Freak.PNG]]&lt;br /&gt;
&lt;br /&gt;
===Servo automated Unit-Testing===&lt;br /&gt;
&lt;br /&gt;
-&amp;gt; The next part of testing is the unit-tests&lt;br /&gt;
&lt;br /&gt;
Running the below command will run all unit-tests&lt;br /&gt;
&lt;br /&gt;
     ./mach test-unit [FOR LINUX / MAC-OS]&lt;br /&gt;
&lt;br /&gt;
     mach.bat test-unit [FOR WINDOWS]&lt;br /&gt;
&lt;br /&gt;
'''Note''': The output is too large to include everything here as images, and this [https://community-tc.services.mozilla.com/tasks/Zwl0KyYhTCSa6mEQ1QpsNg/runs/0/logs/https%3A%2F%2Fcommunity-tc.services.mozilla.com%2Fapi%2Fqueue%2Fv1%2Ftask%2FZwl0KyYhTCSa6mEQ1QpsNg%2Fruns%2F0%2Fartifacts%2Fpublic%2Flogs%2Flive.log LOG FILE] has the full details of all the unit-tests passed.&lt;br /&gt;
&lt;br /&gt;
===Servo Automated WPT Tests===&lt;br /&gt;
&lt;br /&gt;
-&amp;gt; Then the next steps involve running the servo-provided automated WPT [Web Platform Tests] that are relevant for our implementation.&lt;br /&gt;
&lt;br /&gt;
I am providing the commands to run the [https://github.com/servo/servo/blob/master/tests/wpt/README.md#running-the-tests WPT tests] on Linux&lt;br /&gt;
&lt;br /&gt;
    ./mach test-wpt tests/wpt/web-platform-tests/html/dom/idlharness.https.html&lt;br /&gt;
&lt;br /&gt;
To save the log results to a file, for example wpt.log&lt;br /&gt;
&lt;br /&gt;
    ./mach test-wpt tests/wpt/web-platform-tests/html/dom/idlharness.https.html --log-raw wpt_dom.log&lt;br /&gt;
&lt;br /&gt;
Once the test results are saved to the log, we need to [https://github.com/servo/servo/blob/master/tests/wpt/README.md#updating-test-expectations update the test expectations].&lt;br /&gt;
&lt;br /&gt;
    ./mach update-wpt wpt_dom.log&lt;br /&gt;
&lt;br /&gt;
Now to test another relevant feature for the above implementation and save it to a log file named wpt_interface-objects.log&lt;br /&gt;
&lt;br /&gt;
     ./mach test-wpt tests/wpt/web-platform-tests/workers/semantics/interface-objects/001.worker.js --log-raw wpt_interface-objects.log&lt;br /&gt;
&lt;br /&gt;
     ./mach update-wpt wpt_interface-objects.log [ UPDATING TEST EXPECTATIONS ]&lt;br /&gt;
&lt;br /&gt;
'''Note''': The output can also be viewed in this [https://community-tc.services.mozilla.com/tasks/f-RoigFcT3iUzkSg9OunvA/runs/0/logs/https%3A%2F%2Fcommunity-tc.services.mozilla.com%2Fapi%2Fqueue%2Fv1%2Ftask%2Ff-RoigFcT3iUzkSg9OunvA%2Fruns%2F0%2Fartifacts%2Fpublic%2Flogs%2Flive.log LOG_FILE] link.&lt;br /&gt;
&lt;br /&gt;
===Manifest Update===&lt;br /&gt;
&lt;br /&gt;
Now to cap it all off,  we need to [https://github.com/servo/servo/blob/master/tests/wpt/README.md#updating-the-wpt-manifest update the WPT manifest] so that all the changes have been registered and reflected appropriately.&lt;br /&gt;
&lt;br /&gt;
It can be done by the command below.&lt;br /&gt;
&lt;br /&gt;
   ./mach update-manifest&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This finishes the testing for the code and you can see that the test coverage has increased.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&lt;br /&gt;
[1] [https://en.wikipedia.org/wiki/Rust_(programming_language) Rust Language Wikipedia]&lt;br /&gt;
&lt;br /&gt;
[2] [https://en.wikipedia.org/wiki/Servo_(software) Servo Software Wikipedia]&lt;br /&gt;
&lt;br /&gt;
[3] [https://www.rust-lang.org/ Rust Language Official Website]&lt;br /&gt;
&lt;br /&gt;
[4] [https://www.slideshare.net/SamsungOSG/how-servo-renders-the-web-52095380 servo working architecture]&lt;br /&gt;
&lt;br /&gt;
[5] [https://doc.rust-lang.org/book/index.html Rust Language Textbook]&lt;br /&gt;
&lt;br /&gt;
[6] [https://developer.mozilla.org/en-US/docs/Web/API/ImageBitmap ImageBitmap API Standard]&lt;br /&gt;
&lt;br /&gt;
[7] [https://developer.mozilla.org/en-US/docs/Web/HTML/Element/canvas Canvas Element]&lt;br /&gt;
&lt;br /&gt;
[8] [https://developers.google.com/web/updates/2016/03/createimagebitmap-in-chrome-50 Bitmap flow]&lt;br /&gt;
&lt;br /&gt;
[9] [https://github.com/servo/servo/wiki/Implement-ImageBitmap-project Implement ImageBitmap problem statement]&lt;br /&gt;
&lt;br /&gt;
[10] [https://github.com/SasiDharKM/servo/blob/master/components/script/dom/webidls/ImageBitmap.webidl ImageBitmap WebIDL code]&lt;br /&gt;
&lt;br /&gt;
[12] [https://html.spec.whatwg.org/multipage/imagebitmap-and-animations.html#imagebitmap ImageBitmap WebIDL Standard]&lt;br /&gt;
&lt;br /&gt;
[13] [https://github.com/SasiDharKM/servo/blob/master/components/script/dom/imagebitmap.rs ImageBitmap Rust code]&lt;br /&gt;
&lt;br /&gt;
[14] [https://doc.rust-lang.org/book/ch07-01-packages-and-crates.html Crates and Packages for Rust]&lt;br /&gt;
&lt;br /&gt;
[14] [https://doc.rust-lang.org/book/ch03-02-data-types.html Data Types in Rust]&lt;br /&gt;
&lt;br /&gt;
[15] [https://en.wikipedia.org/wiki/Color_model Color Model Wikipedia]&lt;br /&gt;
&lt;br /&gt;
[16] [https://doc.rust-lang.org/std/cell/struct.RefCell.html RefCell in Rust]&lt;br /&gt;
&lt;br /&gt;
[17] [https://doc.rust-lang.org/std/keyword.impl.html impl Keyword in Rust]&lt;br /&gt;
&lt;br /&gt;
[18] [https://jeenalee.com/2016/10/03/implementing-doge-for-servo.html Implement a new DOM tutorial]&lt;br /&gt;
&lt;br /&gt;
[19] [https://html.spec.whatwg.org/multipage/imagebitmap-and-animations.html#imagebitmap ImageBitmap Algorithm]&lt;br /&gt;
&lt;br /&gt;
[20] [https://github.com/servo/servo/pull/26009 ImageBitmap Implementation pull request]&lt;br /&gt;
&lt;br /&gt;
[21] [https://github.com/servo/servo/blob/master/README.md#on-windows-msvc Build Pre-requisites for Rust]&lt;br /&gt;
&lt;br /&gt;
[22] [https://github.com/servo/servo/blob/master/tests/wpt/README.md Testing the Servo Code]&lt;/div&gt;</summary>
		<author><name>Skmuppal</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2020_-_M2000._Implement_ImageBitMap_web_API&amp;diff=132512</id>
		<title>CSC/ECE 517 Spring 2020 - M2000. Implement ImageBitMap web API</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2020_-_M2000._Implement_ImageBitMap_web_API&amp;diff=132512"/>
		<updated>2020-03-31T22:25:16Z</updated>

		<summary type="html">&lt;p&gt;Skmuppal: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;A new browser technology that is being implemented with the new rust language to take advantage of the concurrency features of the language is the servo. [https://en.wikipedia.org/wiki/Rust_(programming_language)]. It is an innovation that will be using compiling in a very synchronous style as well as support things like web assembly code. It was an implementation that was a result of the effort of Mozilla research with aid from Samsung to help port it to android and arm processors. The servo does not yet have any support for the ImageBitmap which eventually makes it difficult to write it to the canvas in real-time without any undue latency in the process. This could lead to servo being slow and having very little graphical support, hence it will be requiring to implement support for ImageBitmap to make sure the process is smooth and efficient for graphical canvas support.&lt;br /&gt;
&lt;br /&gt;
=='''Pull Request'''==&lt;br /&gt;
&lt;br /&gt;
The pull request for this implementation has been merged.[https://github.com/servo/servo/pull/26009]&lt;br /&gt;
&lt;br /&gt;
It passes all the test cases and also the build is passing.[https://github.com/servo/servo/pull/26009]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Comments for the code'''==&lt;br /&gt;
&lt;br /&gt;
We will not be having detailed comments for each function of the code, because the servo community does not encourage comments which are not required. &lt;br /&gt;
&lt;br /&gt;
The comments that are more than what is required will fail the servo build checks.&lt;br /&gt;
&lt;br /&gt;
To make up for that, we try to explain wherever possible the code that we have written in this documentation.&lt;br /&gt;
&lt;br /&gt;
=='''Introduction'''==&lt;br /&gt;
&lt;br /&gt;
===Servo===&lt;br /&gt;
Servo [https://en.wikipedia.org/wiki/Servo_(layout_engine)] which is born as an intention from Mozilla to produce an open-source web engine that will work on the rust language implementation[https://www.rust-lang.org/]. It works on a parallel setup where the various rendering activities take place in a highly parallel nature.&lt;br /&gt;
&lt;br /&gt;
The entire nature of flow for the servo is shown in the below diagram:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Flowofservo.png ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here we can see that the servo parses the contents of html and css using dom, which runs on the rust scripts and produces a flow tree using the styling elements. It then renders them as layers which are produced as output using composition.[https://www.slideshare.net/SamsungOSG/how-servo-renders-the-web-52095380]&lt;br /&gt;
&lt;br /&gt;
===Rust===&lt;br /&gt;
Rust [https://doc.rust-lang.org/book/index.html] Rust again is born out of an intention from Mozilla to implement a programming language that is highly efficient for parallel processing that will make sure the threads are safe in execution and implementation. It is being used in the servo browser.&lt;br /&gt;
&lt;br /&gt;
===DOM===&lt;br /&gt;
DOM stands for Document Object Model. It is a method that is being used by web-browsers to effectively arrange web pages and use them in a structured manner. Servo also uses the concept of dom to efficiently access the structure of how the web pages are stored and used effectively.&lt;br /&gt;
&lt;br /&gt;
the general dom structure is shown below that has all head and body elements with a hyperlink :&lt;br /&gt;
&lt;br /&gt;
[[File:dom.png ]]&lt;br /&gt;
&lt;br /&gt;
===Scope===&lt;br /&gt;
Several browsers that we know have the ability to create images of bitmaps that can be reproduced for graphical purposes on canvas elements. The new servo browser from Mozilla is something that has canvas, thus the aim would be to implement code to support imagebitmap() for canvas in the servo.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Untitled_Diagram_(14).png ]]&lt;br /&gt;
&lt;br /&gt;
===Image Bitmap===&lt;br /&gt;
&lt;br /&gt;
Interface for imagebitmap[https://developer.mozilla.org/en-US/docs/Web/API/ImageBitmap] is something that represents an image which is a bitmap that can be drawn to a  &amp;lt;canvas&amp;gt; [https://developer.mozilla.org/en-US/docs/Web/HTML/Element/canvas] without undue latency. the createimagebitmap() factory method is used to produce these images for implementation.&lt;br /&gt;
&lt;br /&gt;
The general flow of an imagebitmap method would be : &lt;br /&gt;
&lt;br /&gt;
[[File:bitmapgeneral.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here we see that the browser holds the main thread which will request the worker thread to obtain the URL that is being passed and uses it to create the image bitmap, Once the image has been created we will be transferring it back to the main thread where the canvas would be drawing the image created.[https://developers.google.com/web/updates/2016/03/createimagebitmap-in-chrome-50]&lt;br /&gt;
&lt;br /&gt;
===Implementation Steps===&lt;br /&gt;
&lt;br /&gt;
The following steps have been implemented:&lt;br /&gt;
&lt;br /&gt;
Step 1- add a ImageBitmap WebIDL interface to components/script/dom/webidls &lt;br /&gt;
&lt;br /&gt;
Step 2- Implement its Rust code in components/script/dom/imagebitmap.rs that is backed by a Vec&amp;lt;u8&amp;gt; buffer&lt;br /&gt;
&lt;br /&gt;
=='''Design Pattern'''==&lt;br /&gt;
&lt;br /&gt;
Our project will not require any design patterns as it will only require the implementation of the methods. Please see below for the steps required in the implementation.&lt;br /&gt;
&lt;br /&gt;
=='''Implementation'''==&lt;br /&gt;
&lt;br /&gt;
The following are the steps that are present it the implementation project description [https://github.com/servo/servo/wiki/Implement-ImageBitmap-project].&lt;br /&gt;
&lt;br /&gt;
'''Step 1:''' add a ImageBitmap WebIDL interface [https://github.com/SasiDharKM/servo/blob/master/components/script/dom/webidls/ImageBitmap.webidl] to components/script/dom/webidls &lt;br /&gt;
&lt;br /&gt;
The webidl information is from the official standard webidl[https://html.spec.whatwg.org/multipage/imagebitmap-and-animations.html#imagebitmap].&lt;br /&gt;
&lt;br /&gt;
Please note that we have removed the &amp;quot;Serializable&amp;quot; and &amp;quot;Transferable&amp;quot; components from the webidl as they are not required for this implementation.&lt;br /&gt;
&lt;br /&gt;
[[File:Webidl.PNG]]&lt;br /&gt;
&lt;br /&gt;
From the implemented the imagebitmap webidl for the dom struct that will be taking the height and width as its attributes.&lt;br /&gt;
&lt;br /&gt;
The webidl specifies that it will hold an interface of the imagebitmap which will have attributes of height and width as unsigned long integers represent as the below diagram.&lt;br /&gt;
&lt;br /&gt;
[[File:bitmap.png]]&lt;br /&gt;
&lt;br /&gt;
enum specifies the various options that are available to the input image type that could be CanvasImageSouce or Blob or ImageData. The options will be used to manipulated these input types specifically - ImageOrientation, preMulitplyAlpha,ColourSpaceCoversion,ResizeQuality&lt;br /&gt;
&lt;br /&gt;
[[File:enum.png]]&lt;br /&gt;
&lt;br /&gt;
The imagebitmap options dictionary will be creating key-value pairs for these with initial default values as seen in the image below :&lt;br /&gt;
&lt;br /&gt;
[[File:dict.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Step 2:''' Create a imagebitmap.rs code implementation [https://github.com/SasiDharKM/servo/blob/master/components/script/dom/imagebitmap.rs] for the webidl&lt;br /&gt;
&lt;br /&gt;
Below we have implemented the image bitmap rust code that uses all the crates[https://doc.rust-lang.org/book/ch07-01-packages-and-crates.html]. Crates are the packages for rust implementation that can be imported.&lt;br /&gt;
&lt;br /&gt;
[[File:rs_crates.PNG]]&lt;br /&gt;
&lt;br /&gt;
The code here creates the crates for the rust implementation. The bitmap options are bound followed by binding to dom root and global scope. Fallible is used to check errors, Reflector is used to link the js side to the rust code. We also use vector of u8 charset to store the bitmap implementation &lt;br /&gt;
&lt;br /&gt;
In the below image we can see the way the reflector object in the above code is used to access and link the javascript objects using rust. The rust node contains the reflector which is using to bind the javascript object every time a thing is manipulated on the rust side.&lt;br /&gt;
&lt;br /&gt;
'''Reflector design in dom'''&lt;br /&gt;
&lt;br /&gt;
[[File:Reflector.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The dom_struct is the DOM structure that the ImageBitMap data has from the javascript object. It consists of the following-&lt;br /&gt;
&lt;br /&gt;
1. Reflector - a reflector has the pointer to the required JavaScript object.&lt;br /&gt;
&lt;br /&gt;
2. width and height - the width and the height part of the ImageBitMap's data as mentioned in the webidl file. The required datatype[https://doc.rust-lang.org/book/ch03-02-data-types.html] is 32-bit unsigned integers, denoted by u32.&lt;br /&gt;
&lt;br /&gt;
3. As the imagebitmap needs to be implemented backed b a &amp;lt;Vec8&amp;gt; buffer, as mentioned in the problem statement, the DomRefCell&amp;lt;Vec&amp;lt;u8&amp;gt;&amp;gt; has been used. Where, u8 stands for 8-bit unsigned integer, which is used to hold the data of colour model[https://en.wikipedia.org/wiki/Color_model] and DOMRefCell is the RefCell[https://doc.rust-lang.org/std/cell/struct.RefCell.html] equivalent for the DOM implementation. RefCell is a wrapper used to make the data mutable, which is a required property here as the colour data might be altering.&lt;br /&gt;
&lt;br /&gt;
[[File:rs_dom_struct.PNG]]&lt;br /&gt;
&lt;br /&gt;
The image below shows how this struct is organised&lt;br /&gt;
&lt;br /&gt;
[[File:struct.png]]&lt;br /&gt;
&lt;br /&gt;
Here we implement the code that reads in the various attributes and the javascript objects required (shown below). We use the words '''impl ImageBitmap'''[https://doc.rust-lang.org/std/keyword.impl.html] which means the implementation of the ImageBitmap type. It will be using the '''newinherited''' and the '''new''' methods to obtain the required javascript objects and resolve the intended promises.&lt;br /&gt;
&lt;br /&gt;
'''new_inheritence''' method is where the new instance of the ImageBitmap is created. '''new''' method is where the javascript object is connected to the ImageBitmap object[https://jeenalee.com/2016/10/03/implementing-doge-for-servo.html].&lt;br /&gt;
&lt;br /&gt;
[[File:rs_impl_ibm.PNG]]&lt;br /&gt;
&lt;br /&gt;
Here we implement the code for the getter methods for '''height''' and '''width''' attributes for an ImageBitmap object. We use '''impl ImageBitmapMethods for ImageBitmap''' here which includes only the methods that are required as part of the implementation of the ImageBitmap.&lt;br /&gt;
&lt;br /&gt;
[[File:rs_impl_methods.PNG]]&lt;br /&gt;
&lt;br /&gt;
The height and width attributes are as shown below :&lt;br /&gt;
&lt;br /&gt;
[[File:hw.png]]&lt;br /&gt;
&lt;br /&gt;
The detailed description of the algorithm that has been implemented can be seen in the HTML Standard [https://html.spec.whatwg.org/multipage/imagebitmap-and-animations.html#imagebitmap].&lt;br /&gt;
&lt;br /&gt;
'''Note''': Please note that the implementation does not have detailed comments as we were asked to remove them since they are against the servo implementation guidelines.&lt;br /&gt;
&lt;br /&gt;
=='''How to Setup and Run'''==&lt;br /&gt;
The following are the steps to build the servo.&lt;br /&gt;
&lt;br /&gt;
1. git clone the servo repository&lt;br /&gt;
&lt;br /&gt;
2. setup all the pre-requisites[https://github.com/servo/servo/blob/master/README.md#on-windows-msvc]&lt;br /&gt;
&lt;br /&gt;
3. switch into the &amp;quot;servo&amp;quot; directory - cd servo&lt;br /&gt;
&lt;br /&gt;
4. build the project using:&lt;br /&gt;
&lt;br /&gt;
4.1. For Windows&lt;br /&gt;
&lt;br /&gt;
     mach.bat build -dev&lt;br /&gt;
 &lt;br /&gt;
     run the project using:&lt;br /&gt;
&lt;br /&gt;
     mach run -d -- https://github.com&lt;br /&gt;
&lt;br /&gt;
4.2. For Linux / Mac-OS&lt;br /&gt;
     &lt;br /&gt;
     ./mach build --dev&lt;br /&gt;
&lt;br /&gt;
     run the project using:&lt;br /&gt;
&lt;br /&gt;
     ./mach run --release tests/html/about-mozilla.html&lt;br /&gt;
&lt;br /&gt;
=='''Test_Plan and Testing'''==&lt;br /&gt;
&lt;br /&gt;
Upon successful completion of the setup and building the whole browser engine. You should get an output that is something similar to the image below.&lt;br /&gt;
&lt;br /&gt;
[[File:Freak2.PNG]]&lt;br /&gt;
&lt;br /&gt;
===Servo Building Test===&lt;br /&gt;
&lt;br /&gt;
-&amp;gt; This completes the first step of testing as you will able to successfully run the software.&lt;br /&gt;
&lt;br /&gt;
'''Note''': Please be aware that your system may hang up during the process as it involves compiling the whole code from source and this involves usage of the whole processing power of the local system. Don't fret yet, the system will come back to its normal state after the build is completed. &lt;br /&gt;
&lt;br /&gt;
'''Note''': Time to compile depends on the CPU clock speed, and varies widely.&lt;br /&gt;
&lt;br /&gt;
===Servo Tidiness test===&lt;br /&gt;
&lt;br /&gt;
-&amp;gt; The next part of the testing involves checking for file tidiness, i.e. checking if all standards of the servo have been met.&lt;br /&gt;
&lt;br /&gt;
Running the below command will test for the same.&lt;br /&gt;
 [FOR LINUX / MAC-OS]&lt;br /&gt;
&lt;br /&gt;
     ./mach test-tidy&lt;br /&gt;
     ./mach fmt&lt;br /&gt;
&lt;br /&gt;
 [FOR WINDOWS]&lt;br /&gt;
&lt;br /&gt;
     mach.bat test-tidy&lt;br /&gt;
     mach.bat fmt&lt;br /&gt;
&lt;br /&gt;
The output should be similar to the below picture which shows that the tests that were passed.&lt;br /&gt;
&lt;br /&gt;
[[File:Freak.PNG]]&lt;br /&gt;
&lt;br /&gt;
===Servo automated Unit-Testing===&lt;br /&gt;
&lt;br /&gt;
-&amp;gt; The next part of testing is the unit-tests&lt;br /&gt;
&lt;br /&gt;
Running the below command will run all unit-tests&lt;br /&gt;
&lt;br /&gt;
     ./mach test-unit [FOR LINUX / MAC-OS]&lt;br /&gt;
&lt;br /&gt;
     mach.bat test-unit [FOR WINDOWS]&lt;br /&gt;
&lt;br /&gt;
'''Note''': The output is too large to include everything here image here but this [https://community-tc.services.mozilla.com/tasks/Zwl0KyYhTCSa6mEQ1QpsNg/runs/0/logs/https%3A%2F%2Fcommunity-tc.services.mozilla.com%2Fapi%2Fqueue%2Fv1%2Ftask%2FZwl0KyYhTCSa6mEQ1QpsNg%2Fruns%2F0%2Fartifacts%2Fpublic%2Flogs%2Flive.log LOG FILE] has the full details of all the unit-tests passed.&lt;br /&gt;
&lt;br /&gt;
===Servo Automated WPT Tests===&lt;br /&gt;
&lt;br /&gt;
-&amp;gt; Then the next steps involve running the servo-provided automated WPT [Web Platform Tests] that are relevant for our implementation.&lt;br /&gt;
&lt;br /&gt;
I am providing the commands to run the [https://github.com/servo/servo/blob/master/tests/wpt/README.md#running-the-tests WPT tests] on Linux&lt;br /&gt;
&lt;br /&gt;
    ./mach test-wpt tests/wpt/web-platform-tests/html/dom/idlharness.https.html&lt;br /&gt;
&lt;br /&gt;
To save the log results to a file, for example wpt.log&lt;br /&gt;
&lt;br /&gt;
    ./mach test-wpt tests/wpt/web-platform-tests/html/dom/idlharness.https.html --log-raw wpt_dom.log&lt;br /&gt;
&lt;br /&gt;
Once the test results are saved to the log, we need to [https://github.com/servo/servo/blob/master/tests/wpt/README.md#updating-test-expectations update the test expectations].&lt;br /&gt;
&lt;br /&gt;
    ./mach update-wpt wpt_dom.log&lt;br /&gt;
&lt;br /&gt;
Now to test another relevant feature for the above implementation and save it to a log file named wpt_interface-objects.log&lt;br /&gt;
&lt;br /&gt;
     ./mach test-wpt tests/wpt/web-platform-tests/workers/semantics/interface-objects/001.worker.js --log-raw wpt_interface-objects.log&lt;br /&gt;
&lt;br /&gt;
     ./mach update-wpt wpt_interface-objects.log [ UPDATING TEST EXPECTATIONS ]&lt;br /&gt;
&lt;br /&gt;
'''Note''': The output can also be viewed in this [https://community-tc.services.mozilla.com/tasks/f-RoigFcT3iUzkSg9OunvA/runs/0/logs/https%3A%2F%2Fcommunity-tc.services.mozilla.com%2Fapi%2Fqueue%2Fv1%2Ftask%2Ff-RoigFcT3iUzkSg9OunvA%2Fruns%2F0%2Fartifacts%2Fpublic%2Flogs%2Flive.log LOG_FILE] link.&lt;br /&gt;
&lt;br /&gt;
===Manifest Update===&lt;br /&gt;
&lt;br /&gt;
Now to cap it all off,  we need to [https://github.com/servo/servo/blob/master/tests/wpt/README.md#updating-the-wpt-manifest update the WPT manifest] so that all the changes have been registered and reflected appropriately.&lt;br /&gt;
&lt;br /&gt;
It can be done by the command below.&lt;br /&gt;
&lt;br /&gt;
   ./mach update-manifest&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This finishes the testing for the code and you can see that the test coverage has increased.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&lt;br /&gt;
[1] [https://en.wikipedia.org/wiki/Rust_(programming_language) Rust Language Wikipedia]&lt;br /&gt;
&lt;br /&gt;
[2] [https://en.wikipedia.org/wiki/Servo_(software) Servo Software Wikipedia]&lt;br /&gt;
&lt;br /&gt;
[3] [https://www.rust-lang.org/ Rust Language Official Website]&lt;br /&gt;
&lt;br /&gt;
[4] [https://www.slideshare.net/SamsungOSG/how-servo-renders-the-web-52095380 servo working architecture]&lt;br /&gt;
&lt;br /&gt;
[5] [https://doc.rust-lang.org/book/index.html Rust Language Textbook]&lt;br /&gt;
&lt;br /&gt;
[6] [https://developer.mozilla.org/en-US/docs/Web/API/ImageBitmap ImageBitmap API Standard]&lt;br /&gt;
&lt;br /&gt;
[7] [https://developer.mozilla.org/en-US/docs/Web/HTML/Element/canvas Canvas Element]&lt;br /&gt;
&lt;br /&gt;
[8] [https://developers.google.com/web/updates/2016/03/createimagebitmap-in-chrome-50 Bitmap flow]&lt;br /&gt;
&lt;br /&gt;
[9] [https://github.com/servo/servo/wiki/Implement-ImageBitmap-project Implement ImageBitmap problem statement]&lt;br /&gt;
&lt;br /&gt;
[10] [https://github.com/SasiDharKM/servo/blob/master/components/script/dom/webidls/ImageBitmap.webidl ImageBitmap WebIDL code]&lt;br /&gt;
&lt;br /&gt;
[12] [https://html.spec.whatwg.org/multipage/imagebitmap-and-animations.html#imagebitmap ImageBitmap WebIDL Standard]&lt;br /&gt;
&lt;br /&gt;
[13] [https://github.com/SasiDharKM/servo/blob/master/components/script/dom/imagebitmap.rs ImageBitmap Rust code]&lt;br /&gt;
&lt;br /&gt;
[14] [https://doc.rust-lang.org/book/ch07-01-packages-and-crates.html Crates and Packages for Rust]&lt;br /&gt;
&lt;br /&gt;
[14] [https://doc.rust-lang.org/book/ch03-02-data-types.html Data Types in Rust]&lt;br /&gt;
&lt;br /&gt;
[15] [https://en.wikipedia.org/wiki/Color_model Color Model Wikipedia]&lt;br /&gt;
&lt;br /&gt;
[16] [https://doc.rust-lang.org/std/cell/struct.RefCell.html RefCell in Rust]&lt;br /&gt;
&lt;br /&gt;
[17] [https://doc.rust-lang.org/std/keyword.impl.html impl Keyword in Rust]&lt;br /&gt;
&lt;br /&gt;
[18] [https://jeenalee.com/2016/10/03/implementing-doge-for-servo.html Implement a new DOM tutorial]&lt;br /&gt;
&lt;br /&gt;
[19] [https://html.spec.whatwg.org/multipage/imagebitmap-and-animations.html#imagebitmap ImageBitmap Algorithm]&lt;br /&gt;
&lt;br /&gt;
[20] [https://github.com/servo/servo/pull/26009 ImageBitmap Implementation pull request]&lt;br /&gt;
&lt;br /&gt;
[21] [https://github.com/servo/servo/blob/master/README.md#on-windows-msvc Build Pre-requisites for Rust]&lt;br /&gt;
&lt;br /&gt;
[22] [https://github.com/servo/servo/blob/master/tests/wpt/README.md Testing the Servo Code]&lt;/div&gt;</summary>
		<author><name>Skmuppal</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2020_-_M2000._Implement_ImageBitMap_web_API&amp;diff=132504</id>
		<title>CSC/ECE 517 Spring 2020 - M2000. Implement ImageBitMap web API</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2020_-_M2000._Implement_ImageBitMap_web_API&amp;diff=132504"/>
		<updated>2020-03-31T22:18:12Z</updated>

		<summary type="html">&lt;p&gt;Skmuppal: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;A new browser technology that is being implemented with the new rust language to take advantage of the concurrency features of the language is the servo. [https://en.wikipedia.org/wiki/Rust_(programming_language)]. It is an innovation that will be using compiling in a very synchronous style as well as support things like web assembly code. It was an implementation that was a result of the effort of Mozilla research with aid from Samsung to help port it to android and arm processors. The servo does not yet have any support for the ImageBitmap which eventually makes it difficult to write it to the canvas in real-time without any undue latency in the process. This could lead to servo being slow and having very little graphical support, hence it will be requiring to implement support for ImageBitmap to make sure the process is smooth and efficient for graphical canvas support.&lt;br /&gt;
&lt;br /&gt;
=='''Pull Request'''==&lt;br /&gt;
&lt;br /&gt;
The pull request for this implementation has been merged.[https://github.com/servo/servo/pull/26009]&lt;br /&gt;
&lt;br /&gt;
It passes all the test cases and also the build is passing.[https://github.com/servo/servo/pull/26009]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Comments for the code'''==&lt;br /&gt;
&lt;br /&gt;
We will not be having detailed comments for each function of the code, because the servo community does not encourage comments which are not required. &lt;br /&gt;
&lt;br /&gt;
The comments that are more than what is required will fail the servo build checks.&lt;br /&gt;
&lt;br /&gt;
To make up for that, we try to explain wherever possible the code that we have written in this documentation.&lt;br /&gt;
&lt;br /&gt;
=='''Introduction'''==&lt;br /&gt;
&lt;br /&gt;
===Servo===&lt;br /&gt;
Servo [https://en.wikipedia.org/wiki/Servo_(layout_engine)] which is born as an intention from Mozilla to produce an open-source web engine that will work on the rust language implementation[https://www.rust-lang.org/]. It works on a parallel setup where the various rendering activities take place in a highly parallel nature.&lt;br /&gt;
&lt;br /&gt;
The entire nature of flow for the servo is shown in the below diagram:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Flowofservo.png ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here we can see that the servo parses the contents of html and css using dom, which runs on the rust scripts and produces a flow tree using the styling elements. It then renders them as layers which are produced as output using composition.[https://www.slideshare.net/SamsungOSG/how-servo-renders-the-web-52095380]&lt;br /&gt;
&lt;br /&gt;
===Rust===&lt;br /&gt;
Rust [https://doc.rust-lang.org/book/index.html] Rust again is born out of an intention from Mozilla to implement a programming language that is highly efficient for parallel processing that will make sure the threads are safe in execution and implementation. It is being used in the servo browser.&lt;br /&gt;
&lt;br /&gt;
===DOM===&lt;br /&gt;
DOM stands for Document Object Model. It is a method that is being used by web-browsers to effectively arrange web pages and use them in a structured manner. Servo also uses the concept of dom to efficiently access the structure of how the web pages are stored and used effectively.&lt;br /&gt;
&lt;br /&gt;
the general dom structure is shown below that has all head and body elements with a hyperlink :&lt;br /&gt;
&lt;br /&gt;
[[File:dom.png ]]&lt;br /&gt;
&lt;br /&gt;
===Scope===&lt;br /&gt;
Several browsers that we know have the ability to create images of bitmaps that can be reproduced for graphical purposes on canvas elements. The new servo browser from Mozilla is something that has canvas, thus the aim would be to implement code to support imagebitmap() for canvas in the servo.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Untitled_Diagram_(14).png ]]&lt;br /&gt;
&lt;br /&gt;
===Image Bitmap===&lt;br /&gt;
&lt;br /&gt;
Interface for imagebitmap[https://developer.mozilla.org/en-US/docs/Web/API/ImageBitmap] is something that represents an image which is a bitmap that can be drawn to a  &amp;lt;canvas&amp;gt; [https://developer.mozilla.org/en-US/docs/Web/HTML/Element/canvas] without undue latency. the createimagebitmap() factory method is used to produce these images for implementation.&lt;br /&gt;
&lt;br /&gt;
The general flow of an imagebitmap method would be : &lt;br /&gt;
&lt;br /&gt;
[[File:bitmapgeneral.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here we see that the browser holds the main thread which will request the worker thread to obtain the URL that is being passed and uses it to create the image bitmap, Once the image has been created we will be transferring it back to the main thread where the canvas would be drawing the image created.[https://developers.google.com/web/updates/2016/03/createimagebitmap-in-chrome-50]&lt;br /&gt;
&lt;br /&gt;
===Implementation Steps===&lt;br /&gt;
&lt;br /&gt;
The following steps have been implemented:&lt;br /&gt;
&lt;br /&gt;
Step 1- add a ImageBitmap WebIDL interface to components/script/dom/webidls &lt;br /&gt;
&lt;br /&gt;
Step 2- Implement its Rust code in components/script/dom/imagebitmap.rs that is backed by a Vec&amp;lt;u8&amp;gt; buffer&lt;br /&gt;
&lt;br /&gt;
=='''Design Pattern'''==&lt;br /&gt;
&lt;br /&gt;
Our project will not require any design patterns as it will only require the implementation of the methods. Please see below for the steps required in the implementation.&lt;br /&gt;
&lt;br /&gt;
=='''Implementation'''==&lt;br /&gt;
&lt;br /&gt;
The following are the steps that are present it the implementation project description [https://github.com/servo/servo/wiki/Implement-ImageBitmap-project].&lt;br /&gt;
&lt;br /&gt;
'''Step 1:''' add a ImageBitmap WebIDL interface [https://github.com/SasiDharKM/servo/blob/master/components/script/dom/webidls/ImageBitmap.webidl] to components/script/dom/webidls &lt;br /&gt;
&lt;br /&gt;
The webidl information is from the official standard webidl[https://html.spec.whatwg.org/multipage/imagebitmap-and-animations.html#imagebitmap].&lt;br /&gt;
&lt;br /&gt;
Please note that we have removed the &amp;quot;Serializable&amp;quot; and &amp;quot;Transferable&amp;quot; components from the webidl as they are not required for this implementation.&lt;br /&gt;
&lt;br /&gt;
[[File:Webidl.PNG]]&lt;br /&gt;
&lt;br /&gt;
From the implemented the imagebitmap webidl for the dom struct that will be taking the height and width as its attributes.&lt;br /&gt;
&lt;br /&gt;
The webidl specifies that it will hold an interface of the imagebitmap which will have attributes of height and width as unsigned long integers represent as the below diagram.&lt;br /&gt;
&lt;br /&gt;
[[File:bitmap.png]]&lt;br /&gt;
&lt;br /&gt;
enum specifies the various options that are available to the input image type that could be CanvasImageSouce or Blob or ImageData. The options will be used to manipulated these input types specifically - ImageOrientation, preMulitplyAlpha,ColourSpaceCoversion,ResizeQuality&lt;br /&gt;
&lt;br /&gt;
[[File:enum.png]]&lt;br /&gt;
&lt;br /&gt;
The imagebitmap options dictionary will be creating key-value pairs for these with initial default values as seen in the image below :&lt;br /&gt;
&lt;br /&gt;
[[File:dict.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Step 2:''' Create a imagebitmap.rs code implementation [https://github.com/SasiDharKM/servo/blob/master/components/script/dom/imagebitmap.rs] for the webidl&lt;br /&gt;
&lt;br /&gt;
Below we have implemented the image bitmap rust code that uses all the crates[https://doc.rust-lang.org/book/ch07-01-packages-and-crates.html]. Crates are the packages for rust implementation that can be imported.&lt;br /&gt;
&lt;br /&gt;
[[File:rs_crates.PNG]]&lt;br /&gt;
&lt;br /&gt;
The code here creates the crates for the rust implementation. The bitmap options are bound followed by binding to dom root and global scope. Fallible is used to check errors, Reflector is used to link the js side to the rust code. We also use vector of u8 charset to store the bitmap implementation &lt;br /&gt;
&lt;br /&gt;
In the below image we can see the way the reflector object in the above code is used to access and link the javascript objects using rust. The rust node contains the reflector which is using to bind the javascript object every time a thing is manipulated on the rust side.&lt;br /&gt;
&lt;br /&gt;
'''Reflector design in dom'''&lt;br /&gt;
&lt;br /&gt;
[[File:Reflector.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The dom_struct is the DOM structure that the ImageBitMap data has from the javascript object. It consists of the following-&lt;br /&gt;
&lt;br /&gt;
1. Reflector - a reflector has the pointer to the required JavaScript object.&lt;br /&gt;
&lt;br /&gt;
2. width and height - the width and the height part of the ImageBitMap's data as mentioned in the webidl file. The required datatype[https://doc.rust-lang.org/book/ch03-02-data-types.html] is 32-bit unsigned integers, denoted by u32.&lt;br /&gt;
&lt;br /&gt;
3. As the imagebitmap needs to be implemented backed b a &amp;lt;Vec8&amp;gt; buffer, as mentioned in the problem statement, the DomRefCell&amp;lt;Vec&amp;lt;u8&amp;gt;&amp;gt; has been used. Where, u8 stands for 8-bit unsigned integer, which is used to hold the data of colour model[https://en.wikipedia.org/wiki/Color_model] and DOMRefCell is the RefCell[https://doc.rust-lang.org/std/cell/struct.RefCell.html] equivalent for the DOM implementation. RefCell is a wrapper used to make the data mutable, which is a required property here as the colour data might be altering.&lt;br /&gt;
&lt;br /&gt;
[[File:rs_dom_struct.PNG]]&lt;br /&gt;
&lt;br /&gt;
The image below shows how this struct is organised&lt;br /&gt;
&lt;br /&gt;
[[File:struct.png]]&lt;br /&gt;
&lt;br /&gt;
Here we implement the code that reads in the various attributes and the javascript objects required (shown below). We use the words '''impl ImageBitmap'''[https://doc.rust-lang.org/std/keyword.impl.html] which means the implementation of the ImageBitmap type. It will be using the '''newinherited''' and the '''new''' methods to obtain the required javascript objects and resolve the intended promises.&lt;br /&gt;
&lt;br /&gt;
'''new_inheritence''' method is where the new instance of the ImageBitmap is created. '''new''' method is where the javascript object is connected to the ImageBitmap object[https://jeenalee.com/2016/10/03/implementing-doge-for-servo.html].&lt;br /&gt;
&lt;br /&gt;
[[File:rs_impl_ibm.PNG]]&lt;br /&gt;
&lt;br /&gt;
Here we implement the code for the getter methods for '''height''' and '''width''' attributes for an ImageBitmap object. We use '''impl ImageBitmapMethods for ImageBitmap''' here which includes only the methods that are required as part of the implementation of the ImageBitmap.&lt;br /&gt;
&lt;br /&gt;
[[File:rs_impl_methods.PNG]]&lt;br /&gt;
&lt;br /&gt;
The height and width attributes are as shown below :&lt;br /&gt;
&lt;br /&gt;
[[File:hw.png]]&lt;br /&gt;
&lt;br /&gt;
The detailed description of the algorithm that has been implemented can be seen in the HTML Standard [https://html.spec.whatwg.org/multipage/imagebitmap-and-animations.html#imagebitmap].&lt;br /&gt;
&lt;br /&gt;
'''Note''': Please note that the implementation does not have detailed comments as we were asked to remove them since they are against the servo implementation guidelines.&lt;br /&gt;
&lt;br /&gt;
=='''How to Setup and Run'''==&lt;br /&gt;
The following are the steps to build the servo.&lt;br /&gt;
&lt;br /&gt;
1. git clone the servo repository&lt;br /&gt;
&lt;br /&gt;
2. setup all the pre-requisites[https://github.com/servo/servo/blob/master/README.md#on-windows-msvc]&lt;br /&gt;
&lt;br /&gt;
3. switch into the &amp;quot;servo&amp;quot; directory - cd servo&lt;br /&gt;
&lt;br /&gt;
4. build the project using:&lt;br /&gt;
&lt;br /&gt;
4.1. For Windows&lt;br /&gt;
&lt;br /&gt;
     mach.bat build -dev&lt;br /&gt;
 &lt;br /&gt;
     run the project using:&lt;br /&gt;
&lt;br /&gt;
     mach run -d -- https://github.com&lt;br /&gt;
&lt;br /&gt;
4.2. For Linux / Mac-OS&lt;br /&gt;
     &lt;br /&gt;
     ./mach build --dev&lt;br /&gt;
&lt;br /&gt;
     run the project using:&lt;br /&gt;
&lt;br /&gt;
     ./mach run --release tests/html/about-mozilla.html&lt;br /&gt;
&lt;br /&gt;
=='''Test_Plan and Testing'''==&lt;br /&gt;
&lt;br /&gt;
Upon successful completion of the setup and building the whole browser engine. You should get an output that is something similar to the image below.&lt;br /&gt;
&lt;br /&gt;
[[File:Freak2.PNG]]&lt;br /&gt;
&lt;br /&gt;
-&amp;gt; This completes the first step of testing as you will able to successfully run the software.&lt;br /&gt;
&lt;br /&gt;
'''Note''': Please be aware that your system may hang up during the process as it involves compiling the whole code from source and this involves usage of the whole processing power of the local system. Don't fret yet, the system will come back to its normal state after the build is completed. &lt;br /&gt;
&lt;br /&gt;
'''Note''': Time to compile depends on the CPU clock speed, and varies widely.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-&amp;gt; The next part of the testing involves checking for file tidiness, i.e. checking if all standards of the servo have been met.&lt;br /&gt;
&lt;br /&gt;
Running the below command will test for the same.&lt;br /&gt;
 [FOR LINUX / MAC-OS]&lt;br /&gt;
&lt;br /&gt;
     ./mach test-tidy&lt;br /&gt;
     ./mach fmt&lt;br /&gt;
&lt;br /&gt;
 [FOR WINDOWS]&lt;br /&gt;
&lt;br /&gt;
     mach.bat test-tidy&lt;br /&gt;
     mach.bat fmt&lt;br /&gt;
&lt;br /&gt;
The output should be similar to the below picture which shows that the tests that were passed.&lt;br /&gt;
&lt;br /&gt;
[[File:Freak.PNG]]&lt;br /&gt;
&lt;br /&gt;
-&amp;gt; The next part of testing is the unit-tests&lt;br /&gt;
&lt;br /&gt;
Running the below command will run all unit-tests&lt;br /&gt;
&lt;br /&gt;
     ./mach test-unit [FOR LINUX / MAC-OS]&lt;br /&gt;
&lt;br /&gt;
     mach.bat test-unit [FOR WINDOWS]&lt;br /&gt;
&lt;br /&gt;
'''Note''': The output is too large to include everything here image here but this [https://community-tc.services.mozilla.com/tasks/Zwl0KyYhTCSa6mEQ1QpsNg/runs/0/logs/https%3A%2F%2Fcommunity-tc.services.mozilla.com%2Fapi%2Fqueue%2Fv1%2Ftask%2FZwl0KyYhTCSa6mEQ1QpsNg%2Fruns%2F0%2Fartifacts%2Fpublic%2Flogs%2Flive.log LOG FILE] has the full details of all the unit-tests passed.&lt;br /&gt;
&lt;br /&gt;
-&amp;gt; Then the next steps involve running the servo-provided automated WPT [Web Platform Tests] that are relevant for our implementation.&lt;br /&gt;
&lt;br /&gt;
I am providing the commands to run the [https://github.com/servo/servo/blob/master/tests/wpt/README.md#running-the-tests WPT tests] on Linux&lt;br /&gt;
&lt;br /&gt;
    ./mach test-wpt tests/wpt/web-platform-tests/html/dom/idlharness.https.html&lt;br /&gt;
&lt;br /&gt;
To save the log results to a file, for example wpt.log&lt;br /&gt;
&lt;br /&gt;
    ./mach test-wpt tests/wpt/web-platform-tests/html/dom/idlharness.https.html --log-raw wpt_dom.log&lt;br /&gt;
&lt;br /&gt;
Once the test results are saved to the log, we need to [https://github.com/servo/servo/blob/master/tests/wpt/README.md#updating-test-expectations update the test expectations].&lt;br /&gt;
&lt;br /&gt;
    ./mach update-wpt wpt_dom.log&lt;br /&gt;
&lt;br /&gt;
Now to test another relevant feature for the above implementation and save it to a log file named wpt_interface-objects.log&lt;br /&gt;
&lt;br /&gt;
     ./mach test-wpt tests/wpt/web-platform-tests/workers/semantics/interface-objects/001.worker.js --log-raw wpt_interface-objects.log&lt;br /&gt;
&lt;br /&gt;
     ./mach update-wpt wpt_interface-objects.log [ UPDATING TEST EXPECTATIONS ]&lt;br /&gt;
&lt;br /&gt;
'''Note''': The output can also be viewed in this [https://community-tc.services.mozilla.com/tasks/f-RoigFcT3iUzkSg9OunvA/runs/0/logs/https%3A%2F%2Fcommunity-tc.services.mozilla.com%2Fapi%2Fqueue%2Fv1%2Ftask%2Ff-RoigFcT3iUzkSg9OunvA%2Fruns%2F0%2Fartifacts%2Fpublic%2Flogs%2Flive.log LOG_FILE] link.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now to cap it all off,  we need to [https://github.com/servo/servo/blob/master/tests/wpt/README.md#updating-the-wpt-manifest update the WPT manifest] so that all the changes have been registered and reflected appropriately.&lt;br /&gt;
&lt;br /&gt;
It can be done by the command below.&lt;br /&gt;
&lt;br /&gt;
   ./mach update-manifest&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This finishes the testing for the code and you can see that the test coverage has increased.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&lt;br /&gt;
[1] [https://en.wikipedia.org/wiki/Rust_(programming_language) Rust Language Wikipedia]&lt;br /&gt;
&lt;br /&gt;
[2] [https://en.wikipedia.org/wiki/Servo_(software) Servo Software Wikipedia]&lt;br /&gt;
&lt;br /&gt;
[3] [https://www.rust-lang.org/ Rust Language Official Website]&lt;br /&gt;
&lt;br /&gt;
[4] [https://www.slideshare.net/SamsungOSG/how-servo-renders-the-web-52095380 servo working architecture]&lt;br /&gt;
&lt;br /&gt;
[5] [https://doc.rust-lang.org/book/index.html Rust Language Textbook]&lt;br /&gt;
&lt;br /&gt;
[6] [https://developer.mozilla.org/en-US/docs/Web/API/ImageBitmap ImageBitmap API Standard]&lt;br /&gt;
&lt;br /&gt;
[7] [https://developer.mozilla.org/en-US/docs/Web/HTML/Element/canvas Canvas Element]&lt;br /&gt;
&lt;br /&gt;
[8] [https://developers.google.com/web/updates/2016/03/createimagebitmap-in-chrome-50 Bitmap flow]&lt;br /&gt;
&lt;br /&gt;
[9] [https://github.com/servo/servo/wiki/Implement-ImageBitmap-project Implement ImageBitmap problem statement]&lt;br /&gt;
&lt;br /&gt;
[10] [https://github.com/SasiDharKM/servo/blob/master/components/script/dom/webidls/ImageBitmap.webidl ImageBitmap WebIDL code]&lt;br /&gt;
&lt;br /&gt;
[12] [https://html.spec.whatwg.org/multipage/imagebitmap-and-animations.html#imagebitmap ImageBitmap WebIDL Standard]&lt;br /&gt;
&lt;br /&gt;
[13] [https://github.com/SasiDharKM/servo/blob/master/components/script/dom/imagebitmap.rs ImageBitmap Rust code]&lt;br /&gt;
&lt;br /&gt;
[14] [https://doc.rust-lang.org/book/ch07-01-packages-and-crates.html Crates and Packages for Rust]&lt;br /&gt;
&lt;br /&gt;
[14] [https://doc.rust-lang.org/book/ch03-02-data-types.html Data Types in Rust]&lt;br /&gt;
&lt;br /&gt;
[15] [https://en.wikipedia.org/wiki/Color_model Color Model Wikipedia]&lt;br /&gt;
&lt;br /&gt;
[16] [https://doc.rust-lang.org/std/cell/struct.RefCell.html RefCell in Rust]&lt;br /&gt;
&lt;br /&gt;
[17] [https://doc.rust-lang.org/std/keyword.impl.html impl Keyword in Rust]&lt;br /&gt;
&lt;br /&gt;
[18] [https://jeenalee.com/2016/10/03/implementing-doge-for-servo.html Implement a new DOM tutorial]&lt;br /&gt;
&lt;br /&gt;
[19] [https://html.spec.whatwg.org/multipage/imagebitmap-and-animations.html#imagebitmap ImageBitmap Algorithm]&lt;br /&gt;
&lt;br /&gt;
[20] [https://github.com/servo/servo/pull/26009 ImageBitmap Implementation pull request]&lt;br /&gt;
&lt;br /&gt;
[21] [https://github.com/servo/servo/blob/master/README.md#on-windows-msvc Build Pre-requisites for Rust]&lt;br /&gt;
&lt;br /&gt;
[22] [https://github.com/servo/servo/blob/master/tests/wpt/README.md Testing the Servo Code]&lt;/div&gt;</summary>
		<author><name>Skmuppal</name></author>
	</entry>
</feed>