Skip to content
80 changes: 67 additions & 13 deletions assignment_1/table_manager.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<html>
<head>

<!-- CSS -->
<style type="text/css">
div {
Expand All @@ -10,7 +11,7 @@
<!-- Data -->
<script>

// Don't copy this to any other places in this file. You can just use the "organizations" variable to do your assignment.
// Don't copy this to any other places in this file. You can just use the "organizations" variable to do your assignment.
var organizations = [
{
"Region": "East Asia & Pacific",
Expand All @@ -19,7 +20,7 @@
"Organization Name": "200 Square",
"Organization Type": "For-profit",
"Sectors": "Housing, construction & real estate",
"Description": "200 Square is an online real estate agent in New Zealand.",
"Description": "200 Square is an online real estate agent in New Zealand.",
"City": "Wellington",
"State/Region": "Wellington",
"Founding Year": 2010,
Expand All @@ -34,7 +35,7 @@
"Organization Name": "21c Consultancy",
"Organization Type": "For-profit",
"Sectors": "IT and geospatial",
"Description": "21c is ICT innovation consultancy which advises international actors, institutions and governments around the world on technological trends which can affect the way they deliver services.",
"Description": "21c is ICT innovation consultancy which advises international actors, institutions and governments around the world on technological trends which can affect the way they deliver services.",
"City": "London",
"State/Region": "",
"Founding Year": 2015,
Expand All @@ -49,7 +50,7 @@
"Organization Name": "2GIS",
"Organization Type": "For-profit",
"Sectors": "IT and geospatial",
"Description": "2GIS is a city information service combined with a map. ",
"Description": "2GIS is a city information service combined with a map. ",
"City": "Novosibirsk",
"State/Region": "Novosibirsk Oblast",
"Founding Year": 1999,
Expand All @@ -64,7 +65,7 @@
"Organization Name": "2nd City Zoning",
"Organization Type": "Nonprofit",
"Sectors": "Housing, construction & real estate",
"Description": "An Open City App, 2nd City Zoning is an interactive map that lets you find out how your building is zoned, learn where to locate your business and explore zoning patterns throughout the city.",
"Description": "An Open City App, 2nd City Zoning is an interactive map that lets you find out how your building is zoned, learn where to locate your business and explore zoning patterns throughout the city.",
"City": "Chicago",
"State/Region": "Illinois",
"Founding Year": 2013,
Expand Down Expand Up @@ -94,7 +95,7 @@
"Organization Name": "360 Yield Center",
"Organization Type": "For-profit",
"Sectors": "Agriculture",
"Description": "Taking a 360-degree view of key yield-limiting variables, 360 Yield Center develops strategies for better-performing crops and better on-farm profits.",
"Description": "Taking a 360-degree view of key yield-limiting variables, 360 Yield Center develops strategies for better-performing crops and better on-farm profits.",
"City": "Morton",
"State/Region": "Illinois",
"Founding Year": 2014,
Expand Down Expand Up @@ -124,7 +125,7 @@
"Organization Name": "3Tier (Europe) ",
"Organization Type": "For-profit",
"Sectors": "Energy and climate",
"Description": "3TIER is a global environmental and industrial measurement company providing weather-driven renewable energy risk assessment and forecasting for wind, solar, and hydro power projects.",
"Description": "3TIER is a global environmental and industrial measurement company providing weather-driven renewable energy risk assessment and forecasting for wind, solar, and hydro power projects.",
"City": "Helsinki",
"State/Region": "Uusimaa",
"Founding Year": 2012,
Expand All @@ -139,7 +140,7 @@
"Organization Name": "5PSolutions",
"Organization Type": "For-profit",
"Sectors": "IT and geospatial",
"Description": "5PSolutions are artisans of mobile platforms.",
"Description": "5PSolutions are artisans of mobile platforms.",
"City": "Fairfax",
"State/Region": "Virginia",
"Founding Year": 2007,
Expand All @@ -154,7 +155,7 @@
"Organization Name": "AAA National",
"Organization Type": "Other",
"Sectors": "Transportation and logistics",
"Description": "AAA provides services such as travel, automotive, insurance, financial, and discounts.",
"Description": "AAA provides services such as travel, automotive, insurance, financial, and discounts.",
"City": "Irving",
"State/Region": "Texas",
"Founding Year": 1902,
Expand Down Expand Up @@ -184,15 +185,15 @@
"Organization Name": "ABRELATAM",
"Organization Type": "Nonprofit",
"Sectors": "Governance",
"Description": "ABRELATAM is an conference that seeks to accelerate the process of opening information through Open Data transparency and promote the Latin America.",
"Description": "ABRELATAM is an conference that seeks to accelerate the process of opening information through Open Data transparency and promote the Latin America.",
"City": "Santiago",
"State/Region": "",
"Founding Year": 2015,
"Size": "",
"Type of Data Used": "",
"profileID": "1687"
}

];
</script>

Expand All @@ -204,13 +205,66 @@

<script>
// outputs the first item of the organizations array. Just for testing.
// console.log(organizations[0]);
console.log(organizations[0]);
console.log("test");

// Your JavaScript code goes here

num_orgs =0;
num_old_orgs = 0;
num_na_orgs = 0;
num_transportation = 0;
num_high_income = 0;
for (var org in organizations){
num_orgs++;
if (organizations[org]['Founding Year'] <2008)
num_old_orgs++;
if (organizations[org]['Region'] == 'North America')
num_na_orgs++;
if (organizations[org]['Type of Data Used'] == 'Transportation')
num_transportation++;
if (organizations[org]['Country Income Level'] == 'High income')
num_high_income++;
}
var fill_data=[num_orgs, num_old_orgs, num_na_orgs, num_transportation, num_high_income];
var header = ["Number of Organizations", "Number of Organizations older than 10", "Number Of Organizations in North America", "Number of organizations Using the Transportation Data type", "Number of organizations in High Income Countrys"]
var all_data = {header:fill_data};


var body = document.getElementsByTagName("body")[0];

var tbl = document.createElement("table");
var tblBody = document.createElement("tbody");


for (var i = 0; i < 1; i++) {
var row = document.createElement("tr");
for (var j = 0; j < 5; j++) {
var cell = document.createElement("td");
var cellText = document.createTextNode(fill_data[j]);
cell.appendChild(cellText);
row.appendChild(cell);
}
tblBody.appendChild(row);
}
var newRow = tbl.insertRow(tbl.rows.length);
var cell1 = newRow.insertCell(0);
cell1.innerHTML = "Number of Organizations";
var cell2= newRow.insertCell(1);
cell2.innerHTML = "Number of Organizations older than 10";
var cell3 = newRow.insertCell(2);
cell3.innerHTML = "Number Of Organizations in North America";
var cell4 = newRow.insertCell(3);
cell4.innerHTML ="Number of organizations Using the Transportation Data type";
var cell5 = newRow.insertCell(4);
cell5.innerHTML = "Number of organizations in High Income Countrys";
tbl.appendChild(tblBody);
body.appendChild(tbl);
tbl.setAttribute("border", "2");



</script>

</body>
</html>
</html>
8 changes: 8 additions & 0 deletions javascript/dom.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,15 @@

//document.getElementById("test").innerHTML = "Hello by ID";
//document.getElementsByTagName("div")[0].innerHTML = "Hello by Tag";
<<<<<<< HEAD
<<<<<<< HEAD
document.getElementsByClassName("t_class")[0].innerHTML = "<p>Hello by <em>Class</em></p>";
=======
document.getElementsByClassName("t_class")[0].innerHTML = "<p>Hello by <em>Class</em></p>";
>>>>>>> upstream/master
=======

>>>>>>> 8df844986dd1c635b49d9b59250c6f16f33c435b

</script>

Expand Down
16 changes: 16 additions & 0 deletions javascript/get_dom.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,18 @@
<div id="test" class="t_class">INST377</div>

<script>
<<<<<<< HEAD
<<<<<<< HEAD
var t = document.getElementById("test").innerHTML;
alert(t);
console.log("The value of the TEST object is " + t);
document.getElementById("test").innerHTML = t + " HELLO I AM DYNAMIC!";

document.getElementById("test1").innerHTML = t + "hello? Did this work?";
</script>

<div id="test1" class ="t"
=======
function dostuff(){
var t = document.getElementById("test").innerHTML;
alert(t);
Expand All @@ -18,6 +30,10 @@
</script>

<div id="test1" class="t_class">Late DIV</div>
>>>>>>> upstream/master
=======

>>>>>>> 8df844986dd1c635b49d9b59250c6f16f33c435b

</body>
</html>
20 changes: 19 additions & 1 deletion javascript/objects.html
Original file line number Diff line number Diff line change
Expand Up @@ -41,20 +41,38 @@
}
// Task 3

<<<<<<< HEAD
<<<<<<< HEAD
this.putText = function(t){
sq.innerHTML = t
}
=======
Square.prototype.putText = function(t, c) {
sq.innerHTML = t
sq.style.color = c
}

>>>>>>> upstream/master
=======

>>>>>>> 8df844986dd1c635b49d9b59250c6f16f33c435b
}

s1 = new Square("200px", "50px", "grey", "bob", "square")


// Task 1

s1.changeColor('blue')
// Task 2
<<<<<<< HEAD
<<<<<<< HEAD
s2 = new Square("100px", "100px", "red", "square")
=======
s2 = new Square("100px", "100px", "blue", "annette", "square")
>>>>>>> upstream/master
=======

>>>>>>> 8df844986dd1c635b49d9b59250c6f16f33c435b

</script>

Expand Down
10 changes: 10 additions & 0 deletions php_databases/db_demo/organization.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,16 @@ static function fetchTotalCount(mysqli $conn) {
}

// TODO #1: Implement a function to save an new organization
static function insert(mysqli $conn) {
$stmt = $conn->prepare("INSERT INTO organizations
(organization_name, organization_type, region,
country, country_income_level, sectors, description,
city, state_or_region, founding_year, size, type_of_data_used)
VALUES (?, ?, ?,
?, ?, ?,
?, ?, ?)");

}
// return number of rows inserted

// TODO #2: Implement a function to delete an organization.
Expand Down