diff --git a/data/course-revision/1521-23T2/line_count.mdx b/data/course-revision/1521-23T2/line_count.mdx new file mode 100644 index 0000000..bf19159 --- /dev/null +++ b/data/course-revision/1521-23T2/line_count.mdx @@ -0,0 +1,46 @@ +--- +title: Line Count +desc: Count the number of line occurrences across multiple files (with threads)! +class: COMP1521 +difficulty: 2 +--- + +# Line Count + +Ruh roh! Daniel has jumbled up all the lines between his files! He wants to search for the number of instances of a specific line in his files, but due to severe time restrictions, he must use multi-threading to go sonic speed! + +Write a program `count_lines.c` which counts the number of times a certain line appears as a line across a library of files. The line and the files will be given as command line arguments. For example: +`./count_lines "Jastavo Fring" a.txt b.txt c.txt` +would search for the number of times lines matching exactly `Jastavo Fring` occurs across `a.txt`, `b.txt`, and `c.txt` combined. + +You program must create a separate thread to count occurrences for each file. Be careful to avoid race conditions, as the autotests will likely miss them! Feel free to ask one of the friendly helpers if you aren't sure whether your code includes any race-conditions or deadlocks :smile:. + +The output from your program should look **exactly** like this: + +```bash:~/1521-revision/count_lines +$ rm count_file_one count_file_two count_file_three +$ printf '%s\n' 'additional supply depots' 'additional supply depots ' 'additional supply depots required' 'additional supply depots' >> count_file_one +$ printf '%s\n' 'additional supply depots' >> count_file_two +$ printf '%s\n' '' 'additional supply depots' '' '' >> count_file_three +$ dcc -pthread count_lines.c -o count_lines +$ ./count_lines "additional supply depots" count_file_one count_file_three +3 lines matching "additional supply depots" found across 2 files. +``` + +## Assumptions/Restrictions/Clarifications + +- All lines within any file will be at most `1000` characters. +- You do not have to free memory in the event of an abnormal termination. +- You do not need to worry about a horrific eldritch abomination destroying your computer midway through runtime. + +## CSE Autotest + +When you think your program is working, you can use CSE autotest to test your solution. + +```bash:~/1521-revision/count_lines +$ 1521 csesoc-autotest count_lines +``` + +## Solution + +You can view the solution code to this problem [here](https://github.com/Allynixtor/comp1521-revision-session/blob/main/problems/count_lines/solution/count_lines.c). diff --git a/pages/opendev/23T2.tsx b/pages/opendev/23T2.tsx new file mode 100644 index 0000000..f1f0c30 --- /dev/null +++ b/pages/opendev/23T2.tsx @@ -0,0 +1,182 @@ +import ArticleLayout from 'components/ArticleLayout' +import { Box } from 'components/Box' +import { Flex } from 'components/Flex' +import { Text } from 'components/Text' +import { Card } from 'components/Card' +import { Table } from 'components/Table' +import type { NextPage } from 'next' +import Head from 'next/head' +import Image from 'next/image' +import Link from 'next/link' +import { Button } from 'components/Button' +import { ArrowSquareOut } from 'phosphor-react' +import { styled } from '@stitches/react' +import { constants } from 'os' +import Centerer from 'components/Centerer' + +const DisabledExternLink = styled(Flex, { + display: 'flex', + alignItems: 'center', + color: '$slate11', + alignSelf: 'center', + userSelect: 'none', + cursor: 'not-allowed', + paddingBottom: '$2' +}) + +const EnabledExternLink = styled(Flex, { + display: 'flex', + alignItems: 'center', + color: '#69a2f3', + alignSelf: 'center', + userSelect: 'none', + paddingBottom: '$2' +}) + +const LinksContainer = styled(Flex, { + width: '60%', + maxWidth: '600px', + margin: '0 auto', + justifyContent: 'space-between', +} +) + +const OpenDevTwo: NextPage = () => { + return ( + + + Open Dev Series – CSESoc Learn + + + + + Open Dev Series + + + +

+ The CSESoc Open Dev Series is back once again for 23T2! This initiative will involving weekly workshops for the first 4 weeks of term on Wednesdays 2-4pm (location may vary, see schedule). +

+

+ Over the course of 4 weeks, you'll learn how to build your own + project with the popular MERN stack through workshops with + interactive exercises and help sessions where experienced student + developers give you guidance on new coding exercises based on the + the workshops. +

+

+ These workshops are beginner-friendly and students of all skill + levels are welcome. +

+

+ We encourage you to attend as many workshops as you can as it will + form a complete set of skills to allow you to build your own + projects. +

+

Scroll down to see the slides, code and exercises for all weeks!

+
+
+ + Week 1 + + Slides + Code + Exercises + + + + Week 1 Slides + + + + + Week 2 + + Slides + Javascript Code + ReactJS Code + + No exercises for week 2 + + + Week 2 Slides + + + + Week 3 + + Slides + Code + Exercise + + + + Week 3 Slides + + + + Feedback + + + After attending, please fill out this anonymous + feedback form to help us improve these events! We read every single response :D +
+ + + + +
+
+ +
+ ) +} + +export default OpenDevTwo diff --git a/pages/opendev/index.tsx b/pages/opendev/index.tsx index 9f1b117..75ce25e 100644 --- a/pages/opendev/index.tsx +++ b/pages/opendev/index.tsx @@ -64,7 +64,7 @@ const OpenDevTwo: NextPage = () => {

- The CSESoc Open Dev Series is back once again for 23T2! This initiative will involving weekly workshops for the first 4 weeks of term on Wednesdays 2-4pm (location may vary, see schedule). + The CSESoc Open Dev Series is back once again for 23T3! This initiative will involving weekly workshops for the first 4 weeks of term on Wednesdays 2-4pm (location may vary, see schedule).

Over the course of 4 weeks, you'll learn how to build your own @@ -96,61 +96,18 @@ const OpenDevTwo: NextPage = () => { marginTop: '1rem', }}>Week 1 - Slides - Code - Exercises + Slides + Demo Code + Exercises + Recording - + - Week 1 Slides + Week 1 Slides - Week 2 - - Slides - Javascript Code - ReactJS Code - - No exercises for week 2 - - - Week 2 Slides - - - - Week 3 - - Slides - Code - Exercise - - - - Week 3 Slides - -