From 7d02fbcc82e42914729a675e68f02f5e95573561 Mon Sep 17 00:00:00 2001 From: borb Date: Mon, 23 Jun 2025 17:52:30 +0300 Subject: [PATCH] add extra and exercise slide themes, apply to 13 and 14 --- .themes/buutti.css | 20 ++++++++++++++++++- ...Generics, IEnumerable and LINQ-slides.html | 9 +++++---- 13. Generics, IEnumerable and LINQ.md | 7 ++++--- 14. Exceptions, Threads and Tasks-slides.html | 6 +++--- 14. Exceptions, Threads and Tasks.md | 7 +++---- 5 files changed, 34 insertions(+), 15 deletions(-) diff --git a/.themes/buutti.css b/.themes/buutti.css index 0a0442f..b4e1310 100644 --- a/.themes/buutti.css +++ b/.themes/buutti.css @@ -42,4 +42,22 @@ .tableborderless td, th { border: none!important; border-collapse: collapse; -} \ No newline at end of file +} + +section.extra { + background-color: #5d275d; + background-image: linear-gradient(to bottom, #401a40, #1d0c1d); + color: white; +} +section.extra a { + color: rgb(145, 255, 209); +} + +section.exercise { + background-color: #29366f; + background-image: linear-gradient(to bottom, #20636a, #173742); + color: white; +} +section.exercise a { + color: rgb(211, 173, 255); +} diff --git a/13. Generics, IEnumerable and LINQ-slides.html b/13. Generics, IEnumerable and LINQ-slides.html index 6aab362..faacf3c 100644 --- a/13. Generics, IEnumerable and LINQ-slides.html +++ b/13. Generics, IEnumerable and LINQ-slides.html @@ -83,7 +83,7 @@ GenericMethodExample<string>(Note: You could name the generic type as anything, e.g. <GenericType>. It is named <T> by convention. -
+

Exercise 1: Initializing a populated list

Create a generic method GetPopulatedList<T> which takes two parameters: T value and int length, and returns a new list of type T which is populated with the value variables and has a length of length.

@@ -496,7 +496,7 @@ Console.WriteLine(userArray.First(GetUserWithId).Name);
+

Exercise 2: Filtering Names

    @@ -506,7 +506,7 @@ Console.WriteLine(userArray.First(GetUserWithId).Name); If there are less than 10 resulting names, print the names as well!
-
+

Exercise 3: Queries on Object Lists

    @@ -517,8 +517,9 @@ Console.WriteLine(userArray.First(GetUserWithId).Name); Print the names and id:s of the users in the sorted list
-
+

Going Further: Extension Methods

+
  • Recap: IEnumerable itself only contains one method
  • How does the LINQ library suddenly add all these methods to our Enumerables?
  • diff --git a/13. Generics, IEnumerable and LINQ.md b/13. Generics, IEnumerable and LINQ.md index 13c00fb..469ff54 100644 --- a/13. Generics, IEnumerable and LINQ.md +++ b/13. Generics, IEnumerable and LINQ.md @@ -86,7 +86,7 @@ GenericMethodExample("ABC"); * ***Note:*** You could name the generic type as anything, e.g. ``. It is named `` by convention. ## Exercise 1: Initializing a populated list - + Create a generic method `GetPopulatedList` which takes two parameters: `T value` and `int length`, and returns a new list of type `T` which is populated with the `value` variables and has a length of `length`. @@ -437,7 +437,7 @@ No error! ## Exercise 2: Filtering Names - + * Download this file of names and add it to your project folder: [https://raw.githubusercontent.com/dominictarr/random-name/master/names.txt](https://raw.githubusercontent.com/dominictarr/random-name/master/names.txt) * Read all the contents into a string array with `File.ReadAllLines()` @@ -445,7 +445,7 @@ No error! * If there are less than 10 resulting names, print the names as well! ## Exercise 3: Queries on Object Lists - + * Expand on the exercise 2. * Create a new class User with two properties, int Id and string Name @@ -454,6 +454,7 @@ No error! * Print the names and id:s of the users in the sorted list ## Going Further: Extension Methods + * Recap: `IEnumerable` itself only contains one method * How does the LINQ library suddenly add all these methods to our Enumerables? diff --git a/14. Exceptions, Threads and Tasks-slides.html b/14. Exceptions, Threads and Tasks-slides.html index 5b5c896..3677576 100644 --- a/14. Exceptions, Threads and Tasks-slides.html +++ b/14. Exceptions, Threads and Tasks-slides.html @@ -121,7 +121,7 @@
-
+

Exercise 1: Debugging Exceptions

Create a savings calculator which asks the user for a target amount of money the user is aiming for (in integers), and the users monthly salary. For parsing, use the int.Parse() method instead of int.TryParse().

@@ -236,7 +236,7 @@ printIntegerThread3.Start();
-
+

Exercise 2: Threaded Loading

Create a method public static void LoadData() which simulates loading resources by printing progress from to . Increase the progress in a loop with increments. Use the Thread.Sleep() method to wait between each increment.

@@ -307,7 +307,7 @@ printIntegerThread3.Start();
-
+

Exercise 3: Asynchronous Loading

Re-create the exercise 2, but instead of using separate threads for "loading the data", use an asynchronous method LoadDataAsync()

diff --git a/14. Exceptions, Threads and Tasks.md b/14. Exceptions, Threads and Tasks.md index b7f4156..cc2fef3 100644 --- a/14. Exceptions, Threads and Tasks.md +++ b/14. Exceptions, Threads and Tasks.md @@ -94,8 +94,7 @@ title: 14. Exceptions, Threads and Tasks ``` ## Exercise 1: Debugging Exceptions - - + Create a savings calculator which asks the user for a target amount of money the user is aiming for (in integers), and the users monthly salary. For parsing, use the int.Parse() method instead of int.TryParse(). @@ -204,7 +203,7 @@ The method keeps executing indefinitely, but the main thread continues execution ``` ## Exercise 2: Threaded Loading - + Create a method `public static void LoadData()` which simulates loading resources by printing progress from $0 \%$ to $100 \%$. Increase the progress in a loop with $1 \%$ increments. Use the `Thread.Sleep()` method to wait $10\,\mathrm{ms}$ between each increment. @@ -279,7 +278,7 @@ class Program ## Exercise 3: Asynchronous Loading - + Re-create the exercise 2, but instead of using separate threads for "loading the data", use an asynchronous method `LoadDataAsync()`