From f3ea8961f1b50175ad659cecc590a5944f99dadf Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Johan=20Skarpsv=C3=A4rd?=
<145796632+Code-lab-web@users.noreply.github.com>
Date: Tue, 18 Mar 2025 13:42:16 +0000
Subject: [PATCH 1/3] $ git add index.html $ git add . $ git status
---
.html | 32 +
script.ts | 827 ++++++++++++++++++++
"var source = new EventSource(\"demo_sse.p" | 27 +
3 files changed, 886 insertions(+)
create mode 100644 .html
create mode 100644 script.ts
create mode 100644 "var source = new EventSource(\"demo_sse.p"
diff --git a/.html b/.html
new file mode 100644
index 0000000..43357dc
--- /dev/null
+++ b/.html
@@ -0,0 +1,32 @@
+
+
+
+
+Count numbers:
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/script.ts b/script.ts
new file mode 100644
index 0000000..52e12e3
--- /dev/null
+++ b/script.ts
@@ -0,0 +1,827 @@
+api.openweathermap.org/data/2.5/forecast?lat={lat}&lon={lon}&appid={}
+{
+ api.openweathermap.org/data/2.5/forecast?lat=44.34&lon=10.99&appid={}
+ {
+ {
+ "cod": "200",
+ "message": 0,
+ "cnt": 40,
+ "list": [
+ {
+ "dt": 1661871600,
+ "main": {
+ "temp": 296.76,
+ "feels_like": 296.98,
+ "temp_min": 296.76,
+ "temp_max": 297.87,
+ "pressure": 1015,
+ "sea_level": 1015,
+ "grnd_level": 933,
+ "humidity": 69,
+ "temp_kf": -1.11
+ },
+ "weather": [
+ {
+ "id": 500,
+ "main": "Rain",
+ "description": "light rain",
+ "icon": "10d"
+ }
+ ],
+ "clouds": {
+ "all": 100
+ },
+ "wind": {
+ "speed": 0.62,
+ "deg": 349,
+ "gust": 1.18
+ },
+ "visibility": 10000,
+ "pop": 0.32,
+ "rain": {
+ "3h": 0.26
+ },
+ "sys": {
+ "pod": "d"
+ },
+ "dt_txt": "2022-08-30 15:00:00"
+ },
+ {
+ "dt": 1661882400,
+ "main": {
+ "temp": 295.45,
+ "feels_like": 295.59,
+ "temp_min": 292.84,
+ "temp_max": 295.45,
+ "pressure": 1015,
+ "sea_level": 1015,
+ "grnd_level": 931,
+ "humidity": 71,
+ "temp_kf": 2.61
+ },
+ "weather": [
+ {
+ "id": 500,
+ "main": "Rain",
+ "description": "light rain",
+ "icon": "10n"
+ }
+ ],
+ "clouds": {
+ "all": 96
+ },
+ "wind": {
+ "speed": 1.97,
+ "deg": 157,
+ "gust": 3.39
+ },
+ "visibility": 10000,
+ "pop": 0.33,
+ "rain": {
+ "3h": 0.57
+ },
+ "sys": {
+ "pod": "n"
+ },
+ "dt_txt": "2022-08-30 18:00:00"
+ },
+ {
+ "dt": 1661893200,
+ "main": {
+ "temp": 292.46,
+ "feels_like": 292.54,
+ "temp_min": 290.31,
+ "temp_max": 292.46,
+ "pressure": 1015,
+ "sea_level": 1015,
+ "grnd_level": 931,
+ "humidity": 80,
+ "temp_kf": 2.15
+ },
+ "weather": [
+ {
+ "id": 500,
+ "main": "Rain",
+ "description": "light rain",
+ "icon": "10n"
+ }
+ ],
+ "clouds": {
+ "all": 68
+ },
+ "wind": {
+ "speed": 2.66,
+ "deg": 210,
+ "gust": 3.58
+ },
+ "visibility": 10000,
+ "pop": 0.7,
+ "rain": {
+ "3h": 0.49
+ },
+ "sys": {
+ "pod": "n"
+ },
+ "dt_txt": "2022-08-30 21:00:00"
+ },
+ ....
+ {
+ "dt": 1662292800,
+ "main": {
+ "temp": 294.93,
+ "feels_like": 294.83,
+ "temp_min": 294.93,
+ "temp_max": 294.93,
+ "pressure": 1018,
+ "sea_level": 1018,
+ "grnd_level": 935,
+ "humidity": 64,
+ "temp_kf": 0
+ },
+ "weather": [
+ {
+ "id": 804,
+ "main": "Clouds",
+ "description": "overcast clouds",
+ "icon": "04d"
+ }
+ ],
+ "clouds": {
+ "all": 88
+ },
+ "wind": {
+ "speed": 1.14,
+ "deg": 17,
+ "gust": 1.57
+ },
+ "visibility": 10000,
+ "pop": 0,
+ "sys": {
+ "pod": "d"
+ },
+ "dt_txt": "2022-09-04 12:00:00"
+ }
+ ],
+ "city": {
+ "id": 3163858,
+ "name": "Zocca",
+ "coord": {
+ "lat": 44.34,
+ "lon": 10.99
+ },
+ "country": "IT",
+ "population": 4593,
+ "timezone": 7200,
+ "sunrise": 1661834187,
+ "sunset": 1661882248
+ }
+ }
+
+
+ Zocca
+
+ IT
+ 7200
+
+
+
+
+
+ 0
+
+
+
+
+
+
+
+ ...
+
+
+
+
+ XML format API response fields
+ {
+ "main":{
+"temp":306.15, //current temperature
+"pressure":1013,
+"humidity":44,
+"temp_min":30.15, //min current temperature in the city
+"temp_max":306.15 //max current temperature in the city
+},
+ }
+ }
+}
+}
+"dt":1406080800,
+"temp":{
+ "day":297.77, //daily averaged temperature
+ "min":293.52, //daily min temperature
+ "max":297.77, //daily max temperature
+ "night":293.52, //night temperature
+ "eve":297.77, //evening temperature
+ "morn":297.77}, //morning temperature
+ {
+ api.openweathermap.org/data/2.5/forecast?q={city name}&appid={API key}
+
+api.openweathermap.org/data/2.5/forecast?q={city name},{country code}&appid={API key}
+
+api.openweathermap.org/data/2.5/forecast?q={city name},{state code},{country code}&appid={API key}
+ }
+ api.openweathermap.org/data/2.5/forecast?q=London,us&mode=xml&appid={API key}
+}
+api.openweathermap.org/data/2.5/forecast?q=München,DE&appid={API key}
+}
+api.openweathermap.org/data/2.5/forecast?id={city ID}&appid={API key}
+}
+api.openweathermap.org/data/2.5/forecast?id=524901&appid={API key}
+}
+api.openweathermap.org/data/2.5/forecast?zip={zip code},{country code}&appid={API key}
+}
+api.openweathermap.org/data/2.5/forecast?zip=94040,us&appid={API key}
+}
+api.openweathermap.org/data/2.5/weather?q=London&appid={API key}
+
+
+
+{
+"cod": "200",
+"message": 0,
+"cnt": 40,
+"list": [
+{
+ "dt": 1647345600,
+ "main": {
+ "temp": 287.39,
+ "feels_like": 286.38,
+ "temp_min": 286.69,
+ "temp_max": 287.39,
+ "pressure": 1021,
+ "sea_level": 1021,
+ "grnd_level": 1018,
+ "humidity": 58,
+ "temp_kf": 0.7
+ },
+ "weather": [
+ {
+ "id": 803,
+ "main": "Clouds",
+ "description": "broken clouds",
+ "icon": "04d"
+ }
+ ],
+ "clouds": {
+ "all": 71
+ },
+ "wind": {
+ "speed": 3.08,
+ "deg": 128,
+ "gust": 4.3
+ },
+ "visibility": 10000,
+ "pop": 0,
+ "sys": {
+ "pod": "d"
+ },
+ "dt_txt": "2022-03-15 12:00:00"
+},
+{
+ "dt": 1647356400,
+ "main": {
+ "temp": 287.09,
+ "feels_like": 286.13,
+ "temp_min": 286.5,
+ "temp_max": 287.09,
+ "pressure": 1021,
+ "sea_level": 1021,
+ "grnd_level": 1016,
+ "humidity": 61,
+ "temp_kf": 0.59
+ },
+ "weather": [
+ {
+ "id": 803,
+ "main": "Clouds",
+ "description": "broken clouds",
+ "icon": "04d"
+ }
+ ],
+ "clouds": {
+ "all": 81
+ },
+ "wind": {
+ "speed": 3.28,
+ "deg": 168,
+ "gust": 3.96
+ },
+ "visibility": 10000,
+ "pop": 0,
+ "sys": {
+ "pod": "d"
+ },
+ "dt_txt": "2022-03-15 15:00:00"
+},
+{
+ "dt": 1647367200,
+ "main": {
+ "temp": 285.44,
+ "feels_like": 284.6,
+ "temp_min": 284.47,
+ "temp_max": 285.44,
+ "pressure": 1020,
+ "sea_level": 1020,
+ "grnd_level": 1016,
+ "humidity": 72,
+ "temp_kf": 0.97
+ },
+ "weather": [
+ {
+ "id": 804,
+ "main": "Clouds",
+ "description": "overcast clouds",
+ "icon": "04d"
+ }
+ ],
+ "clouds": {
+ "all": 90
+ },
+ "wind": {
+ "speed": 2.7,
+ "deg": 183,
+ "gust": 5.59
+ },
+ "visibility": 10000,
+ "pop": 0,
+ "sys": {
+ "pod": "d"
+ },
+ "dt_txt": "2022-03-15 18:00:00"
+},
+.....
+ {
+ "dt": 1647766800,
+ "main": {
+ "temp": 282.42,
+ "feels_like": 280,
+ "temp_min": 282.42,
+ "temp_max": 282.42,
+ "pressure": 1036,
+ "sea_level": 1036,
+ "grnd_level": 1033,
+ "humidity": 60,
+ "temp_kf": 0
+ },
+ "weather": [
+ {
+ "id": 802,
+ "main": "Clouds",
+ "description": "scattered clouds",
+ "icon": "03d"
+ }
+ ],
+ "clouds": {
+ "all": 39
+ },
+ "wind": {
+ "speed": 4.58,
+ "deg": 83,
+ "gust": 8.45
+ },
+ "visibility": 10000,
+ "pop": 0,
+ "sys": {
+ "pod": "d"
+ },
+ "dt_txt": "2022-03-20 09:00:00"
+}
+],
+"city": {
+"id": 2643743,
+"name": "London",
+"coord": {
+ "lat": 51.5085,
+ "lon": -0.1257
+},
+"country": "GB",
+"population": 1000000,
+"timezone": 0,
+"sunrise": 1647324902,
+"sunset": 1647367441
+}
+}
+
+
+
+Zocca
+
+IT
+7200
+
+
+
+
+
+0
+
+
+
+
+
+
+
+...
+
+
+
+{
+"main":{
+"temp":306.15, //current temperature
+"pressure":1013,
+"humidity":44,
+"temp_min":30.15, //min current temperature in the city
+"temp_max":306.15 //max current temperature in the city
+},
+
+ "dt":1406080800,
+"temp":{
+ "day":297.77, //daily averaged temperature
+ "min":293.52, //daily min temperature
+ "max":297.77, //daily max temperature
+ "night":293.52, //night temperature
+ "eve":297.77, //evening temperature
+ "morn":297.77}, //morning temperature
+
+}
+api.openweathermap.org/data/2.5/forecast?q={city name}&appid={API key}
+
+api.openweathermap.org/data/2.5/forecast?q={city name},{country code}&appid={API key}
+
+api.openweathermap.org/data/2.5/forecast?q={city name},{state code},{country code}&appid={API key}
+}
+api.openweathermap.org/data/2.5/forecast?q=London,us&mode=xml&appid={API key}
+}
+api.openweathermap.org/data/2.5/forecast?q=München,DE&appid={API key}
+}
+api.openweathermap.org/data/2.5/forecast?id={city ID}&appid={API key}
+}
+api.openweathermap.org/data/2.5/forecast?id=524901&appid={API key}
+}
+api.openweathermap.org/data/2.5/forecast?zip={zip code},{country code}&appid={API key}
+}
+api.openweathermap.org/data/2.5/forecast?zip=94040,us&appid={API key}
+}
+api.openweathermap.org/data/2.5/weather?q=London&appid={API key}
+
+
+
+{
+"cod": "200",
+"message": 0,
+"cnt": 40,
+"list": [
+{
+ "dt": 1647345600,
+ "main": {
+ "temp": 287.39,
+ "feels_like": 286.38,
+ "temp_min": 286.69,
+ "temp_max": 287.39,
+ "pressure": 1021,
+ "sea_level": 1021,
+ "grnd_level": 1018,
+ "humidity": 58,
+ "temp_kf": 0.7
+ },
+ "weather": [
+ {
+ "id": 803,
+ "main": "Clouds",
+ "description": "broken clouds",
+ "icon": "04d"
+ }
+ ],
+ "clouds": {
+ "all": 71
+ },
+ "wind": {
+ "speed": 3.08,
+ "deg": 128,
+ "gust": 4.3
+ },
+ "visibility": 10000,
+ "pop": 0,
+ "sys": {
+ "pod": "d"
+ },
+ "dt_txt": "2022-03-15 12:00:00"
+},
+{
+ "dt": 1647356400,
+ "main": {
+ "temp": 287.09,
+ "feels_like": 286.13,
+ "temp_min": 286.5,
+ "temp_max": 287.09,
+ "pressure": 1021,
+ "sea_level": 1021,
+ "grnd_level": 1016,
+ "humidity": 61,
+ "temp_kf": 0.59
+ },
+ "weather": [
+ {
+ "id": 803,
+ "main": "Clouds",
+ "description": "broken clouds",
+ "icon": "04d"
+ }
+ ],
+ "clouds": {
+ "all": 81
+ },
+ "wind": {
+ "speed": 3.28,
+ "deg": 168,
+ "gust": 3.96
+ },
+ "visibility": 10000,
+ "pop": 0,
+ "sys": {
+ "pod": "d"
+ },
+ "dt_txt": "2022-03-15 15:00:00"
+},
+{
+ "dt": 1647367200,
+ "main": {
+ "temp": 285.44,
+ "feels_like": 284.6,
+ "temp_min": 284.47,
+ "temp_max": 285.44,
+ "pressure": 1020,
+ "sea_level": 1020,
+ "grnd_level": 1016,
+ "humidity": 72,
+ "temp_kf": 0.97
+ },
+ "weather": [
+ {
+ "id": 804,
+ "main": "Clouds",
+ "description": "overcast clouds",
+ "icon": "04d"
+ }
+ ],
+ "clouds": {
+ "all": 90
+ },
+ "wind": {
+ "speed": 2.7,
+ "deg": 183,
+ "gust": 5.59
+ },
+ "visibility": 10000,
+ "pop": 0,
+ "sys": {
+ "pod": "d"
+ },
+ "dt_txt": "2022-03-15 18:00:00"
+},
+.....
+ {
+ "dt": 1647766800,
+ "main": {
+ "temp": 282.42,
+ "feels_like": 280,
+ "temp_min": 282.42,
+ "temp_max": 282.42,
+ "pressure": 1036,
+ "sea_level": 1036,
+ "grnd_level": 1033,
+ "humidity": 60,
+ "temp_kf": 0
+ },
+ "weather": [
+ {
+ "id": 802,
+ "main": "Clouds",
+ "description": "scattered clouds",
+ "icon": "03d"
+ }
+ ],
+ "clouds": {
+ "all": 39
+ },
+ "wind": {
+ "speed": 4.58,
+ "deg": 83,
+ "gust": 8.45
+ },
+ "visibility": 10000,
+ "pop": 0,
+ "sys": {
+ "pod": "d"
+ },
+ "dt_txt": "2022-03-20 09:00:00"
+}
+],
+"city": {
+"id": 2643743,
+"name": "London",
+"coord": {
+ "lat": 51.5085,
+ "lon": -0.1257
+},
+"country": "GB",
+"population": 1000000,
+"timezone": 0,
+"sunrise": 1647324902,
+"sunset": 1647367441
+}
+}
+api.openweathermap.org/data/2.5/weather?q=London&mode=xml
+
+
+
+
+
+London
+
+GB
+0
+
+
+
+
+
+0
+
+
+
+
+
+
+
+....
+
+
+
+}
+https://api.openweathermap.org/data/2.5/forecast?lat=57&lon=-2.15&cnt=3&appid={API key}
+}
+https://api.openweathermap.org/data/2.5/forecast?lat=57&lon=-2.15&appid={API key}
+}
+https://api.openweathermap.org/data/2.5/forecast?lat=57&lon=-2.15&appid={API key}&units=metric
+}
+https://api.openweathermap.org/data/2.5/forecast?lat=57&lon=-2.15&appid={API key}&units=imperial
+}
+http://api.openweathermap.org/data/2.5/forecast?id=524901&lang={lang}
+}
+http://api.openweathermap.org/data/2.5/forecast?id=524901&lang=zh_cn&appid={API key}
+}
+api.openweathermap.org/data/2.5/forecast?q=London,uk&callback=test&appid={API key}
+ }
diff --git "a/var source = new EventSource(\"demo_sse.p" "b/var source = new EventSource(\"demo_sse.p"
new file mode 100644
index 0000000..79614d6
--- /dev/null
+++ "b/var source = new EventSource(\"demo_sse.p"
@@ -0,0 +1,27 @@
+var source = new EventSource("demo_sse.php");
+source.onmessage = function(event) {
+ document.getElementById("result").innerHTML += event.data + "
";
+};
+}
+if(typeof(EventSource) !== "undefined") {
+ // Yes! Server-sent events support!
+ // Some code.....
+} else {
+ // Sorry! No server-sent events support..
+}
+
+}
+<%
+Response.ContentType = "text/event-stream"
+Response.Expires = -1
+Response.Write("data: The server time is: " & now())
+Response.Flush()
+%>
+}
\ No newline at end of file
From 1d2968fdd10653798ef2f0954099941478df0600 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Johan=20Skarpsv=C3=A4rd?=
<145796632+Code-lab-web@users.noreply.github.com>
Date: Tue, 18 Mar 2025 17:25:34 +0000
Subject: [PATCH 2/3] $ git add
---
index.html | 20 +++++++++++++++
script.js | 72 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
style.css | 14 +++++++++++
3 files changed, 106 insertions(+)
create mode 100644 index.html
create mode 100644 script.js
create mode 100644 style.css
diff --git a/index.html b/index.html
new file mode 100644
index 0000000..19f1c0a
--- /dev/null
+++ b/index.html
@@ -0,0 +1,20 @@
+
+
+
+
+
+
+ Meetup #2 GIT in Teams
+
+ Weather app
+
+
+ Test Weatherapp
+
+
+
+
+