Skip to content

Commit 6854c9d

Browse files
authored
updated open dev page for 23t3 (#244)
1 parent ec59e30 commit 6854c9d

File tree

4 files changed

+235
-50
lines changed

4 files changed

+235
-50
lines changed
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
---
2+
title: Line Count
3+
desc: Count the number of line occurrences across multiple files (with threads)!
4+
class: COMP1521
5+
difficulty: 2
6+
---
7+
8+
# Line Count
9+
10+
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!
11+
12+
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:
13+
`./count_lines "Jastavo Fring" a.txt b.txt c.txt`
14+
would search for the number of times lines matching exactly `Jastavo Fring` occurs across `a.txt`, `b.txt`, and `c.txt` combined.
15+
16+
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:.
17+
18+
The output from your program should look **exactly** like this:
19+
20+
```bash:~/1521-revision/count_lines
21+
$ rm count_file_one count_file_two count_file_three
22+
$ printf '%s\n' 'additional supply depots' 'additional supply depots ' 'additional supply depots required' 'additional supply depots' >> count_file_one
23+
$ printf '%s\n' 'additional supply depots' >> count_file_two
24+
$ printf '%s\n' '' 'additional supply depots' '' '' >> count_file_three
25+
$ dcc -pthread count_lines.c -o count_lines
26+
$ ./count_lines "additional supply depots" count_file_one count_file_three
27+
3 lines matching "additional supply depots" found across 2 files.
28+
```
29+
30+
## Assumptions/Restrictions/Clarifications
31+
32+
- All lines within any file will be at most `1000` characters.
33+
- You do not have to free memory in the event of an abnormal termination.
34+
- You do not need to worry about a horrific eldritch abomination destroying your computer midway through runtime.
35+
36+
## CSE Autotest
37+
38+
When you think your program is working, you can use CSE autotest to test your solution.
39+
40+
```bash:~/1521-revision/count_lines
41+
$ 1521 csesoc-autotest count_lines
42+
```
43+
44+
## Solution
45+
46+
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).

pages/opendev/23T2.tsx

Lines changed: 182 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,182 @@
1+
import ArticleLayout from 'components/ArticleLayout'
2+
import { Box } from 'components/Box'
3+
import { Flex } from 'components/Flex'
4+
import { Text } from 'components/Text'
5+
import { Card } from 'components/Card'
6+
import { Table } from 'components/Table'
7+
import type { NextPage } from 'next'
8+
import Head from 'next/head'
9+
import Image from 'next/image'
10+
import Link from 'next/link'
11+
import { Button } from 'components/Button'
12+
import { ArrowSquareOut } from 'phosphor-react'
13+
import { styled } from '@stitches/react'
14+
import { constants } from 'os'
15+
import Centerer from 'components/Centerer'
16+
17+
const DisabledExternLink = styled(Flex, {
18+
display: 'flex',
19+
alignItems: 'center',
20+
color: '$slate11',
21+
alignSelf: 'center',
22+
userSelect: 'none',
23+
cursor: 'not-allowed',
24+
paddingBottom: '$2'
25+
})
26+
27+
const EnabledExternLink = styled(Flex, {
28+
display: 'flex',
29+
alignItems: 'center',
30+
color: '#69a2f3',
31+
alignSelf: 'center',
32+
userSelect: 'none',
33+
paddingBottom: '$2'
34+
})
35+
36+
const LinksContainer = styled(Flex, {
37+
width: '60%',
38+
maxWidth: '600px',
39+
margin: '0 auto',
40+
justifyContent: 'space-between',
41+
}
42+
)
43+
44+
const OpenDevTwo: NextPage = () => {
45+
return (
46+
<ArticleLayout>
47+
<Head>
48+
<title>Open Dev Series – CSESoc Learn</title>
49+
<meta name="description" content="CSESoc open dev series" />
50+
<link rel="icon" href="/favicon.ico" />
51+
</Head>
52+
<Text
53+
as="h1"
54+
size="display"
55+
css={{
56+
color: '$slate12',
57+
fontWeight: '600',
58+
paddingTop: '$2',
59+
alignSelf: 'center'
60+
}}>
61+
Open Dev Series
62+
</Text>
63+
<Box css={{ paddingTop: '$2' }}>
64+
<Text
65+
size="info">
66+
<p>
67+
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).
68+
</p>
69+
<p>
70+
Over the course of 4 weeks, you&apos;ll learn how to build your own
71+
project with the popular MERN stack through workshops with
72+
interactive exercises and help sessions where experienced student
73+
developers give you guidance on new coding exercises based on the
74+
the workshops.
75+
</p>
76+
<p>
77+
These workshops are beginner-friendly and students of all skill
78+
levels are welcome.
79+
</p>
80+
<p>
81+
We encourage you to attend as many workshops as you can as it will
82+
form a complete set of skills to allow you to build your own
83+
projects.
84+
</p>
85+
<p>Scroll down to see the slides, code and exercises for all weeks!</p>
86+
</Text>
87+
</Box>
88+
89+
<Text
90+
size="headline"
91+
css={{
92+
color: '$slate12',
93+
fontWeight: '600',
94+
padding: '$2',
95+
alignSelf: 'center',
96+
marginTop: '1rem',
97+
}}>Week 1</Text>
98+
<LinksContainer justify="around">
99+
<a href="https://www.canva.com/design/DAFLpV21DLY/5GP43_9-0QocXmk7aNAurw/view?utm_content=DAFLpV21DLY&utm_campaign=designshare&utm_medium=link&utm_source=viewer" target="_blank">Slides</a>
100+
<a href="https://codepen.io/xylo274/pen/jOQrQQE" target="_blank">Code</a>
101+
<a href="https://www.notion.so/CSESoc-Open-Dev-HTML-CSS-JavaScript-Exercises-7085baebc47e49a0b1710212eebf4b30" target="_blank">Exercises</a>
102+
</LinksContainer>
103+
<a href="https://www.canva.com/design/DAFLpV21DLY/5GP43_9-0QocXmk7aNAurw/view?utm_content=DAFLpV21DLY&utm_campaign=designshare&utm_medium=link&utm_source=viewer" target="_blank">
104+
<Centerer>
105+
<Image src="/images/opendev/opendev-23t2-wk1-cover-slide.png" alt="Week 1 Slides" width="480" height="270" />
106+
107+
</Centerer>
108+
</a>
109+
110+
<Text
111+
size="headline"
112+
css={{
113+
color: '$slate12',
114+
fontWeight: '600',
115+
padding: '$2',
116+
alignSelf: 'center',
117+
marginTop: '1rem',
118+
}}>Week 2</Text>
119+
<LinksContainer justify="around">
120+
<a href="https://www.canva.com/design/DAFj64DPw5g/-h9rLyCEeLi3QzZgVpQFrQ/view?utm_content=DAFj64DPw5g&utm_campaign=designshare&utm_medium=link&utm_source=publishsharelink" target="_blank">Slides</a>
121+
<a href="https://codepen.io/parvyyy/pen/qBJgxwK" target="_blank">Javascript Code</a>
122+
<a href="https://github.com/BinaryGamer/open-dev/tree/main/WEEK2" target="_blank">ReactJS Code</a>
123+
</LinksContainer>
124+
<Text as='body' css={{
125+
marginTop: '1rem',
126+
fontSize: '0.8rem',
127+
textAlign: 'center',
128+
}}>No exercises for week 2</Text>
129+
<a href="https://www.canva.com/design/DAFj64DPw5g/-h9rLyCEeLi3QzZgVpQFrQ/view?utm_content=DAFj64DPw5g&utm_campaign=designshare&utm_medium=link&utm_source=viewer" target="_blank">
130+
<Centerer>
131+
<Image src="/images/opendev/opendev-23t2-wk2-cover-slide.png" alt="Week 2 Slides" width="480" height="270" />
132+
</Centerer>
133+
</a>
134+
135+
<Text
136+
size="headline"
137+
css={{
138+
color: '$slate12',
139+
fontWeight: '600',
140+
padding: '$2',
141+
alignSelf: 'center',
142+
marginTop: '1rem',
143+
}}>Week 3</Text>
144+
<LinksContainer justify="around">
145+
<a href="https://www.canva.com/design/DAFlvj_OQsE/jVRyWqpHGUuW7rdlkBYJyA/view?utm_content=DAFlvj_OQsE&utm_campaign=designshare&utm_medium=link&utm_source=publishsharelink" target="_blank">Slides</a>
146+
<a href="https://github.com/BinaryGamer/open-dev/tree/main/WEEK3" target="_blank">Code</a>
147+
<a href="https://terrie.notion.site/Intro-to-React-Part-1-Exercises-f960c27b17b94115b87c50bdfc4bbb3b" target="_blank">Exercise</a>
148+
</LinksContainer>
149+
<a href="https://www.canva.com/design/DAFlvj_OQsE/jVRyWqpHGUuW7rdlkBYJyA/view?utm_content=DAFlvj_OQsE&utm_campaign=designshare&utm_medium=link&utm_source=viewer" target="_blank">
150+
<Centerer>
151+
<Image src="/images/opendev/opendev-23t2-wk3-cover-slide.png" alt="Week 3 Slides" width="480" height="270" />
152+
</Centerer>
153+
</a>
154+
<Text
155+
size="headline"
156+
css={{
157+
color: '$slate12',
158+
fontWeight: '600',
159+
padding: '$2',
160+
alignSelf: 'center',
161+
marginTop: '1rem',
162+
}}>
163+
Feedback
164+
</Text>
165+
<Text
166+
size="info"
167+
>
168+
After attending, please fill out this anonymous <a href='https://docs.google.com/forms/d/e/1FAIpQLScpydFTRZhLwNRX2Z2lkpBsZxF2mcRzAM_5dvvk237-OIRDmg/viewform' target="_blank" rel="noreferrer" style={{ textDecoration: "none", display: "inline-block" }}>
169+
feedback form <ArrowSquareOut size={16} color="#3f89f1" style={{ verticalAlign: "text-bottom" }} /></a> to help us improve these events! We read every single response :D
170+
<div style={{ marginTop: "1rem", display: "flex", justifyContent: "center" }}>
171+
<a href='https://docs.google.com/forms/d/e/1FAIpQLScpydFTRZhLwNRX2Z2lkpBsZxF2mcRzAM_5dvvk237-OIRDmg/viewform' target="_blank" rel="noreferrer" style={{ textDecoration: "none" }}>
172+
<Button size="default" css={{ backgroundColor: "hsl(256, 73.7%, 61.2%)", color: "white", fontWeight: "600", "&:hover": { backgroundColor: "rgb(177, 152, 246)" } }}>Feedback Form <ArrowSquareOut size={20} color="#dbdbdb" /></Button>
173+
</a>
174+
175+
</div>
176+
</Text>
177+
178+
</ArticleLayout >
179+
)
180+
}
181+
182+
export default OpenDevTwo

pages/opendev/index.tsx

Lines changed: 7 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ const OpenDevTwo: NextPage = () => {
6464
<Text
6565
size="info">
6666
<p>
67-
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).
67+
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).
6868
</p>
6969
<p>
7070
Over the course of 4 weeks, you&apos;ll learn how to build your own
@@ -96,61 +96,18 @@ const OpenDevTwo: NextPage = () => {
9696
marginTop: '1rem',
9797
}}>Week 1</Text>
9898
<LinksContainer justify="around">
99-
<a href="https://www.canva.com/design/DAFLpV21DLY/5GP43_9-0QocXmk7aNAurw/view?utm_content=DAFLpV21DLY&utm_campaign=designshare&utm_medium=link&utm_source=viewer" target="_blank">Slides</a>
100-
<a href="https://codepen.io/xylo274/pen/jOQrQQE" target="_blank">Code</a>
101-
<a href="https://www.notion.so/CSESoc-Open-Dev-HTML-CSS-JavaScript-Exercises-7085baebc47e49a0b1710212eebf4b30" target="_blank">Exercises</a>
99+
<a href="https://www.canva.com/design/DAFhz2OFo8Y/InPtslQ6diPeqLV_AKynEw/edit" target="_blank">Slides</a>
100+
<a href="https://codepen.io/Allynixtor/pen/GRPOYvX" target="_blank">Demo Code</a>
101+
<a href="https://github.com/CSESocEducation/Open-Dev/tree/main/23T3/workshop-1/exercises" target="_blank">Exercises</a>
102+
<span>Recording</span>
102103
</LinksContainer>
103-
<a href="https://www.canva.com/design/DAFLpV21DLY/5GP43_9-0QocXmk7aNAurw/view?utm_content=DAFLpV21DLY&utm_campaign=designshare&utm_medium=link&utm_source=viewer" target="_blank">
104+
<a href="https://www.canva.com/design/DAFhz2OFo8Y/InPtslQ6diPeqLV_AKynEw/edit" target="_blank">
104105
<Centerer>
105-
<Image src="/images/opendev/opendev-23t2-wk1-cover-slide.png" alt="Week 1 Slides" width="480" height="270" />
106+
<Image src="/images/opendev/opendev-23t3-wk1-cover-slide.png" alt="Week 1 Slides" width="480" height="270" />
106107

107108
</Centerer>
108109
</a>
109110

110-
<Text
111-
size="headline"
112-
css={{
113-
color: '$slate12',
114-
fontWeight: '600',
115-
padding: '$2',
116-
alignSelf: 'center',
117-
marginTop: '1rem',
118-
}}>Week 2</Text>
119-
<LinksContainer justify="around">
120-
<a href="https://www.canva.com/design/DAFj64DPw5g/-h9rLyCEeLi3QzZgVpQFrQ/view?utm_content=DAFj64DPw5g&utm_campaign=designshare&utm_medium=link&utm_source=publishsharelink" target="_blank">Slides</a>
121-
<a href="https://codepen.io/parvyyy/pen/qBJgxwK" target="_blank">Javascript Code</a>
122-
<a href="https://github.com/BinaryGamer/open-dev/tree/main/WEEK2" target="_blank">ReactJS Code</a>
123-
</LinksContainer>
124-
<Text as='body' css={{
125-
marginTop: '1rem',
126-
fontSize: '0.8rem',
127-
textAlign: 'center',
128-
}}>No exercises for week 2</Text>
129-
<a href="https://www.canva.com/design/DAFj64DPw5g/-h9rLyCEeLi3QzZgVpQFrQ/view?utm_content=DAFj64DPw5g&utm_campaign=designshare&utm_medium=link&utm_source=viewer" target="_blank">
130-
<Centerer>
131-
<Image src="/images/opendev/opendev-23t2-wk2-cover-slide.png" alt="Week 2 Slides" width="480" height="270" />
132-
</Centerer>
133-
</a>
134-
135-
<Text
136-
size="headline"
137-
css={{
138-
color: '$slate12',
139-
fontWeight: '600',
140-
padding: '$2',
141-
alignSelf: 'center',
142-
marginTop: '1rem',
143-
}}>Week 3</Text>
144-
<LinksContainer justify="around">
145-
<a href="https://www.canva.com/design/DAFlvj_OQsE/jVRyWqpHGUuW7rdlkBYJyA/view?utm_content=DAFlvj_OQsE&utm_campaign=designshare&utm_medium=link&utm_source=publishsharelink" target="_blank">Slides</a>
146-
<a href="https://github.com/BinaryGamer/open-dev/tree/main/WEEK3" target="_blank">Code</a>
147-
<a href="https://terrie.notion.site/Intro-to-React-Part-1-Exercises-f960c27b17b94115b87c50bdfc4bbb3b" target="_blank">Exercise</a>
148-
</LinksContainer>
149-
<a href="https://www.canva.com/design/DAFlvj_OQsE/jVRyWqpHGUuW7rdlkBYJyA/view?utm_content=DAFlvj_OQsE&utm_campaign=designshare&utm_medium=link&utm_source=viewer" target="_blank">
150-
<Centerer>
151-
<Image src="/images/opendev/opendev-23t2-wk3-cover-slide.png" alt="Week 3 Slides" width="480" height="270" />
152-
</Centerer>
153-
</a>
154111
<Text
155112
size="headline"
156113
css={{
Loading

0 commit comments

Comments
 (0)